vskill 0.5.28 → 0.5.29
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.
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ix;function mh(){if(ix)return je;ix=1;var r=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),p=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),C=Symbol.iterator;function w(j){return j===null||typeof j!="object"?null:(j=C&&j[C]||j["@@iterator"],typeof j=="function"?j:null)}var O={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,G={};function q(j,D,W){this.props=j,this.context=D,this.refs=G,this.updater=W||O}q.prototype.isReactComponent={},q.prototype.setState=function(j,D){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,D,"setState")},q.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function J(){}J.prototype=q.prototype;function ee(j,D,W){this.props=j,this.context=D,this.refs=G,this.updater=W||O}var K=ee.prototype=new J;K.constructor=ee,L(K,q.prototype),K.isPureReactComponent=!0;var P=Array.isArray;function re(){}var X={H:null,A:null,T:null,S:null},te=Object.prototype.hasOwnProperty;function Q(j,D,W){var ne=W.ref;return{$$typeof:r,type:j,key:D,ref:ne!==void 0?ne:null,props:W}}function F(j,D){return Q(j.type,D,j.props)}function pe(j){return typeof j=="object"&&j!==null&&j.$$typeof===r}function ie(j){var D={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(W){return D[W]})}var _=/\/+/g;function le(j,D){return typeof j=="object"&&j!==null&&j.key!=null?ie(""+j.key):D.toString(36)}function I(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(re,re):(j.status="pending",j.then(function(D){j.status==="pending"&&(j.status="fulfilled",j.value=D)},function(D){j.status==="pending"&&(j.status="rejected",j.reason=D)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function E(j,D,W,ne,ue){var fe=typeof j;(fe==="undefined"||fe==="boolean")&&(j=null);var ve=!1;if(j===null)ve=!0;else switch(fe){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(j.$$typeof){case r:case c:ve=!0;break;case S:return ve=j._init,E(ve(j._payload),D,W,ne,ue)}}if(ve)return ue=ue(j),ve=ne===""?"."+le(j,0):ne,P(ue)?(W="",ve!=null&&(W=ve.replace(_,"$&/")+"/"),E(ue,D,W,"",function(pt){return pt})):ue!=null&&(pe(ue)&&(ue=F(ue,W+(ue.key==null||j&&j.key===ue.key?"":(""+ue.key).replace(_,"$&/")+"/")+ve)),D.push(ue)),1;ve=0;var
|
|
17
|
+
*/var ix;function mh(){if(ix)return je;ix=1;var r=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),p=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),C=Symbol.iterator;function w(j){return j===null||typeof j!="object"?null:(j=C&&j[C]||j["@@iterator"],typeof j=="function"?j:null)}var O={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,G={};function q(j,D,W){this.props=j,this.context=D,this.refs=G,this.updater=W||O}q.prototype.isReactComponent={},q.prototype.setState=function(j,D){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,D,"setState")},q.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function J(){}J.prototype=q.prototype;function ee(j,D,W){this.props=j,this.context=D,this.refs=G,this.updater=W||O}var K=ee.prototype=new J;K.constructor=ee,L(K,q.prototype),K.isPureReactComponent=!0;var P=Array.isArray;function re(){}var X={H:null,A:null,T:null,S:null},te=Object.prototype.hasOwnProperty;function Q(j,D,W){var ne=W.ref;return{$$typeof:r,type:j,key:D,ref:ne!==void 0?ne:null,props:W}}function F(j,D){return Q(j.type,D,j.props)}function pe(j){return typeof j=="object"&&j!==null&&j.$$typeof===r}function ie(j){var D={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(W){return D[W]})}var _=/\/+/g;function le(j,D){return typeof j=="object"&&j!==null&&j.key!=null?ie(""+j.key):D.toString(36)}function I(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(re,re):(j.status="pending",j.then(function(D){j.status==="pending"&&(j.status="fulfilled",j.value=D)},function(D){j.status==="pending"&&(j.status="rejected",j.reason=D)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function E(j,D,W,ne,ue){var fe=typeof j;(fe==="undefined"||fe==="boolean")&&(j=null);var ve=!1;if(j===null)ve=!0;else switch(fe){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(j.$$typeof){case r:case c:ve=!0;break;case S:return ve=j._init,E(ve(j._payload),D,W,ne,ue)}}if(ve)return ue=ue(j),ve=ne===""?"."+le(j,0):ne,P(ue)?(W="",ve!=null&&(W=ve.replace(_,"$&/")+"/"),E(ue,D,W,"",function(pt){return pt})):ue!=null&&(pe(ue)&&(ue=F(ue,W+(ue.key==null||j&&j.key===ue.key?"":(""+ue.key).replace(_,"$&/")+"/")+ve)),D.push(ue)),1;ve=0;var Oe=ne===""?".":ne+":";if(P(j))for(var Re=0;Re<j.length;Re++)ne=j[Re],fe=Oe+le(ne,Re),ve+=E(ne,D,W,fe,ue);else if(Re=w(j),typeof Re=="function")for(j=Re.call(j),Re=0;!(ne=j.next()).done;)ne=ne.value,fe=Oe+le(ne,Re++),ve+=E(ne,D,W,fe,ue);else if(fe==="object"){if(typeof j.then=="function")return E(I(j),D,W,ne,ue);throw D=String(j),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.")}return ve}function M(j,D,W){if(j==null)return j;var ne=[],ue=0;return E(j,ne,"","",function(fe){return D.call(W,fe,ue++)}),ne}function ae(j){if(j._status===-1){var D=j._result;D=D(),D.then(function(W){(j._status===0||j._status===-1)&&(j._status=1,j._result=W)},function(W){(j._status===0||j._status===-1)&&(j._status=2,j._result=W)}),j._status===-1&&(j._status=0,j._result=D)}if(j._status===1)return j._result.default;throw j._result}var B=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var D=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(D))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)},de={map:M,forEach:function(j,D,W){M(j,function(){D.apply(this,arguments)},W)},count:function(j){var D=0;return M(j,function(){D++}),D},toArray:function(j){return M(j,function(D){return D})||[]},only:function(j){if(!pe(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return je.Activity=g,je.Children=de,je.Component=q,je.Fragment=o,je.Profiler=x,je.PureComponent=ee,je.StrictMode=u,je.Suspense=y,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=X,je.__COMPILER_RUNTIME={__proto__:null,c:function(j){return X.H.useMemoCache(j)}},je.cache=function(j){return function(){return j.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(j,D,W){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var ne=L({},j.props),ue=j.key;if(D!=null)for(fe in D.key!==void 0&&(ue=""+D.key),D)!te.call(D,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&D.ref===void 0||(ne[fe]=D[fe]);var fe=arguments.length-2;if(fe===1)ne.children=W;else if(1<fe){for(var ve=Array(fe),Oe=0;Oe<fe;Oe++)ve[Oe]=arguments[Oe+2];ne.children=ve}return Q(j.type,ue,ne)},je.createContext=function(j){return j={$$typeof:p,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:v,_context:j},j},je.createElement=function(j,D,W){var ne,ue={},fe=null;if(D!=null)for(ne in D.key!==void 0&&(fe=""+D.key),D)te.call(D,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(ue[ne]=D[ne]);var ve=arguments.length-2;if(ve===1)ue.children=W;else if(1<ve){for(var Oe=Array(ve),Re=0;Re<ve;Re++)Oe[Re]=arguments[Re+2];ue.children=Oe}if(j&&j.defaultProps)for(ne in ve=j.defaultProps,ve)ue[ne]===void 0&&(ue[ne]=ve[ne]);return Q(j,fe,ue)},je.createRef=function(){return{current:null}},je.forwardRef=function(j){return{$$typeof:b,render:j}},je.isValidElement=pe,je.lazy=function(j){return{$$typeof:S,_payload:{_status:-1,_result:j},_init:ae}},je.memo=function(j,D){return{$$typeof:f,type:j,compare:D===void 0?null:D}},je.startTransition=function(j){var D=X.T,W={};X.T=W;try{var ne=j(),ue=X.S;ue!==null&&ue(W,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(re,B)}catch(fe){B(fe)}finally{D!==null&&W.types!==null&&(D.types=W.types),X.T=D}},je.unstable_useCacheRefresh=function(){return X.H.useCacheRefresh()},je.use=function(j){return X.H.use(j)},je.useActionState=function(j,D,W){return X.H.useActionState(j,D,W)},je.useCallback=function(j,D){return X.H.useCallback(j,D)},je.useContext=function(j){return X.H.useContext(j)},je.useDebugValue=function(){},je.useDeferredValue=function(j,D){return X.H.useDeferredValue(j,D)},je.useEffect=function(j,D){return X.H.useEffect(j,D)},je.useEffectEvent=function(j){return X.H.useEffectEvent(j)},je.useId=function(){return X.H.useId()},je.useImperativeHandle=function(j,D,W){return X.H.useImperativeHandle(j,D,W)},je.useInsertionEffect=function(j,D){return X.H.useInsertionEffect(j,D)},je.useLayoutEffect=function(j,D){return X.H.useLayoutEffect(j,D)},je.useMemo=function(j,D){return X.H.useMemo(j,D)},je.useOptimistic=function(j,D){return X.H.useOptimistic(j,D)},je.useReducer=function(j,D,W){return X.H.useReducer(j,D,W)},je.useRef=function(j){return X.H.useRef(j)},je.useState=function(j){return X.H.useState(j)},je.useSyncExternalStore=function(j,D,W){return X.H.useSyncExternalStore(j,D,W)},je.useTransition=function(){return X.H.useTransition()},je.version="19.2.4",je}var ox;function ic(){return ox||(ox=1,qo.exports=mh()),qo.exports}var m=ic(),Vo={exports:{}},ns={},Go={exports:{}},Yo={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.js
|
|
20
20
|
*
|
|
@@ -38,34 +38,34 @@
|
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the MIT license found in the
|
|
40
40
|
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var xx;function bh(){if(xx)return ns;xx=1;var r=vh(),c=ic(),o=gh();function u(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}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,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function p(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 y(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 l=e,n=t;;){var s=l.return;if(s===null)break;var i=s.alternate;if(i===null){if(n=s.return,n!==null){l=n;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===l)return y(s),e;if(i===n)return y(s),t;i=i.sibling}throw Error(u(188))}if(l.return!==n.return)l=s,n=i;else{for(var d=!1,h=s.child;h;){if(h===l){d=!0,l=s,n=i;break}if(h===n){d=!0,n=s,l=i;break}h=h.sibling}if(!d){for(h=i.child;h;){if(h===l){d=!0,l=i,n=s;break}if(h===n){d=!0,n=i,l=s;break}h=h.sibling}if(!d)throw Error(u(189))}}if(l.alternate!==n)throw Error(u(190))}if(l.tag!==3)throw Error(u(188));return l.stateNode.current===l?e:t}function S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var g=Object.assign,C=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),J=Symbol.for("react.consumer"),ee=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),pe=Symbol.iterator;function ie(e){return e===null||typeof e!="object"?null:(e=pe&&e[pe]||e["@@iterator"],typeof e=="function"?e:null)}var _=Symbol.for("react.client.reference");function le(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===_?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case L:return"Fragment";case q:return"Profiler";case G:return"StrictMode";case P:return"Suspense";case re:return"SuspenseList";case Q:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case O:return"Portal";case ee:return e.displayName||"Context";case J:return(e._context.displayName||"Context")+".Consumer";case K:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case X:return t=e.displayName||null,t!==null?t:le(e.type)||"Memo";case te:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}var I=Array.isArray,E=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},B=[],de=-1;function j(e){return{current:e}}function D(e){0>de||(e.current=B[de],B[de]=null,de--)}function W(e,t){de++,B[de]=e.current,e.current=t}var ne=j(null),ue=j(null),fe=j(null),ve=j(null);function
|
|
41
|
+
*/var xx;function bh(){if(xx)return ns;xx=1;var r=vh(),c=ic(),o=gh();function u(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}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,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function p(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 y(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 l=e,n=t;;){var s=l.return;if(s===null)break;var i=s.alternate;if(i===null){if(n=s.return,n!==null){l=n;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===l)return y(s),e;if(i===n)return y(s),t;i=i.sibling}throw Error(u(188))}if(l.return!==n.return)l=s,n=i;else{for(var d=!1,h=s.child;h;){if(h===l){d=!0,l=s,n=i;break}if(h===n){d=!0,n=s,l=i;break}h=h.sibling}if(!d){for(h=i.child;h;){if(h===l){d=!0,l=i,n=s;break}if(h===n){d=!0,n=i,l=s;break}h=h.sibling}if(!d)throw Error(u(189))}}if(l.alternate!==n)throw Error(u(190))}if(l.tag!==3)throw Error(u(188));return l.stateNode.current===l?e:t}function S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var g=Object.assign,C=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),J=Symbol.for("react.consumer"),ee=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),pe=Symbol.iterator;function ie(e){return e===null||typeof e!="object"?null:(e=pe&&e[pe]||e["@@iterator"],typeof e=="function"?e:null)}var _=Symbol.for("react.client.reference");function le(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===_?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case L:return"Fragment";case q:return"Profiler";case G:return"StrictMode";case P:return"Suspense";case re:return"SuspenseList";case Q:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case O:return"Portal";case ee:return e.displayName||"Context";case J:return(e._context.displayName||"Context")+".Consumer";case K:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case X:return t=e.displayName||null,t!==null?t:le(e.type)||"Memo";case te:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}var I=Array.isArray,E=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},B=[],de=-1;function j(e){return{current:e}}function D(e){0>de||(e.current=B[de],B[de]=null,de--)}function W(e,t){de++,B[de]=e.current,e.current=t}var ne=j(null),ue=j(null),fe=j(null),ve=j(null);function Oe(e,t){switch(W(fe,t),W(ue,e),W(ne,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?wf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=wf(t),e=Af(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}D(ne),W(ne,e)}function Re(){D(ne),D(ue),D(fe)}function pt(e){e.memoizedState!==null&&W(ve,e);var t=ne.current,l=Af(t,e.type);t!==l&&(W(ue,e),W(ne,l))}function Lt(e){ue.current===e&&(D(ne),D(ue)),ve.current===e&&(D(ve),Pn._currentValue=ae)}var Z,oe;function se(e){if(Z===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);Z=t&&t[1]||"",oe=-1<l.stack.indexOf(`
|
|
42
42
|
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
43
|
`+Z+e+oe}var me=!1;function ge(e,t){if(!e||me)return"";me=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var Y=function(){throw Error()};if(Object.defineProperty(Y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Y,[])}catch(H){var z=H}Reflect.construct(e,[],Y)}else{try{Y.call()}catch(H){z=H}e.call(Y.prototype)}}else{try{throw Error()}catch(H){z=H}(Y=e())&&typeof Y.catch=="function"&&Y.catch(function(){})}}catch(H){if(H&&z&&typeof H.stack=="string")return[H.stack,z.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=n.DetermineComponentFrameRoot(),d=i[0],h=i[1];if(d&&h){var N=d.split(`
|
|
44
44
|
`),R=h.split(`
|
|
45
45
|
`);for(s=n=0;n<N.length&&!N[n].includes("DetermineComponentFrameRoot");)n++;for(;s<R.length&&!R[s].includes("DetermineComponentFrameRoot");)s++;if(n===N.length||s===R.length)for(n=N.length-1,s=R.length-1;1<=n&&0<=s&&N[n]!==R[s];)s--;for(;1<=n&&0<=s;n--,s--)if(N[n]!==R[s]){if(n!==1||s!==1)do if(n--,s--,0>s||N[n]!==R[s]){var U=`
|
|
46
46
|
`+N[n].replace(" at new "," at ");return e.displayName&&U.includes("<anonymous>")&&(U=U.replace("<anonymous>",e.displayName)),U}while(1<=n&&0<=s);break}}}finally{me=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?se(l):""}function Ye(e,t){switch(e.tag){case 26:case 27:case 5:return se(e.type);case 16:return se("Lazy");case 13:return e.child!==t&&t!==null?se("Suspense Fallback"):se("Suspense");case 19:return se("SuspenseList");case 0:case 15:return ge(e.type,!1);case 11:return ge(e.type.render,!1);case 1:return ge(e.type,!0);case 31:return se("Activity");default:return""}}function ut(e){try{var t="",l=null;do t+=Ye(e,l),l=e,e=e.return;while(e);return t}catch(n){return`
|
|
47
47
|
Error generating stack: `+n.message+`
|
|
48
|
-
`+n.stack}}var Xe=Object.prototype.hasOwnProperty,Dt=r.unstable_scheduleCallback,mt=r.unstable_cancelCallback,ll=r.unstable_shouldYield,Qt=r.unstable_requestPaint,We=r.unstable_now,Et=r.unstable_getCurrentPriorityLevel,$=r.unstable_ImmediatePriority,ze=r.unstable_UserBlockingPriority,at=r.unstable_NormalPriority,Je=r.unstable_LowPriority,Rl=r.unstable_IdlePriority,Ot=r.log,sa=r.unstable_setDisableYieldValue,kt=null,Fe=null;function nt(e){if(typeof Ot=="function"&&sa(e),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(kt,e)}catch{}}var et=Math.clz32?Math.clz32:nl,al=Math.log,Qe=Math.LN2;function nl(e){return e>>>=0,e===0?32:31-(al(e)/Qe|0)|0}var st=256,Ve=262144,_l=4194304;function Ct(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 Ea(e,t,l){var n=e.pendingLanes;if(n===0)return 0;var s=0,i=e.suspendedLanes,d=e.pingedLanes;e=e.warmLanes;var h=n&134217727;return h!==0?(n=h&~i,n!==0?s=Ct(n):(d&=h,d!==0?s=Ct(d):l||(l=h&~e,l!==0&&(s=Ct(l))))):(h=n&~i,h!==0?s=Ct(h):d!==0?s=Ct(d):l||(l=n&~e,l!==0&&(s=Ct(l)))),s===0?0:t!==0&&t!==s&&(t&i)===0&&(i=s&-s,l=t&-t,i>=l||i===32&&(l&4194048)!==0)?t:s}function fn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ep(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 oc(){var e=_l;return _l<<=1,(_l&62914560)===0&&(_l=4194304),e}function Cr(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function xn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tp(e,t,l,n,s,i){var d=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var h=e.entanglements,N=e.expirationTimes,R=e.hiddenUpdates;for(l=d&~l;0<l;){var U=31-et(l),Y=1<<U;h[U]=0,N[U]=-1;var z=R[U];if(z!==null)for(R[U]=null,U=0;U<z.length;U++){var H=z[U];H!==null&&(H.lane&=-536870913)}l&=~Y}n!==0&&cc(e,n,0),i!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=i&~(d&~t))}function cc(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-et(t);e.entangledLanes|=t,e.entanglements[n]=e.entanglements[n]|1073741824|l&261930}function uc(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var n=31-et(l),s=1<<n;s&t|e[n]&t&&(e[n]|=t),l&=~s}}function dc(e,t){var l=t&-t;return l=(l&42)!==0?1:Tr(l),(l&(e.suspendedLanes|t))!==0?0:l}function Tr(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 wr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function fc(){var e=M.p;return e!==0?e:(e=window.event,e===void 0?32:If(e.type))}function xc(e,t){var l=M.p;try{return M.p=e,t()}finally{M.p=l}}var Ml=Math.random().toString(36).slice(2),ht="__reactFiber$"+Ml,Tt="__reactProps$"+Ml,ka="__reactContainer$"+Ml,Ar="__reactEvents$"+Ml,lp="__reactListeners$"+Ml,ap="__reactHandles$"+Ml,pc="__reactResources$"+Ml,pn="__reactMarker$"+Ml;function Rr(e){delete e[ht],delete e[Tt],delete e[Ar],delete e[lp],delete e[ap]}function Ca(e){var t=e[ht];if(t)return t;for(var l=e.parentNode;l;){if(t=l[ka]||l[ht]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=Of(e);e!==null;){if(l=e[ht])return l;e=Of(e)}return t}e=l,l=e.parentNode}return null}function Ta(e){if(e=e[ht]||e[ka]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function mn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(u(33))}function wa(e){var t=e[pc];return t||(t=e[pc]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ft(e){e[pn]=!0}var mc=new Set,hc={};function ra(e,t){Aa(e,t),Aa(e+"Capture",t)}function Aa(e,t){for(hc[e]=t,e=0;e<t.length;e++)mc.add(t[e])}var np=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]*$"),vc={},yc={};function sp(e){return Xe.call(yc,e)?!0:Xe.call(vc,e)?!1:np.test(e)?yc[e]=!0:(vc[e]=!0,!1)}function is(e,t,l){if(sp(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){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,""+l)}}function os(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function fl(e,t,l,n){if(n===null)e.removeAttribute(l);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+n)}}function Xt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function rp(e,t,l){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(d){l=""+d,i.call(this,d)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(d){l=""+d},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function _r(e){if(!e._valueTracker){var t=gc(e)?"checked":"value";e._valueTracker=rp(e,t,""+e[t])}}function bc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),n="";return e&&(n=gc(e)?e.checked?"true":"false":e.value),e=n,e!==l?(t.setValue(e),!0):!1}function cs(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 ip=/[\n"\\]/g;function Kt(e){return e.replace(ip,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Mr(e,t,l,n,s,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=""+Xt(t)):e.value!==""+Xt(t)&&(e.value=""+Xt(t)):d!=="submit"&&d!=="reset"||e.removeAttribute("value"),t!=null?zr(e,d,Xt(t)):l!=null?zr(e,d,Xt(l)):n!=null&&e.removeAttribute("value"),s==null&&i!=null&&(e.defaultChecked=!!i),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.name=""+Xt(h):e.removeAttribute("name")}function jc(e,t,l,n,s,i,d,h){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||l!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){_r(e);return}l=l!=null?""+Xt(l):"",t=t!=null?""+Xt(t):l,h||t===e.value||(e.value=t),e.defaultValue=t}n=n??s,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),_r(e)}function zr(e,t,l){t==="number"&&cs(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Ra(e,t,l,n){if(e=e.options,t){t={};for(var s=0;s<l.length;s++)t["$"+l[s]]=!0;for(l=0;l<e.length;l++)s=t.hasOwnProperty("$"+e[l].value),e[l].selected!==s&&(e[l].selected=s),s&&n&&(e[l].defaultSelected=!0)}else{for(l=""+Xt(l),t=null,s=0;s<e.length;s++){if(e[s].value===l){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Sc(e,t,l){if(t!=null&&(t=""+Xt(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Xt(l):""}function Nc(e,t,l,n){if(t==null){if(n!=null){if(l!=null)throw Error(u(92));if(I(n)){if(1<n.length)throw Error(u(93));n=n[0]}l=n}l==null&&(l=""),t=l}l=Xt(t),e.defaultValue=l,n=e.textContent,n===l&&n!==""&&n!==null&&(e.value=n),_r(e)}function _a(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var op=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 Ec(e,t,l){var n=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?n?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":n?e.setProperty(t,l):typeof l!="number"||l===0||op.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function kc(e,t,l){if(t!=null&&typeof t!="object")throw Error(u(62));if(e=e.style,l!=null){for(var n in l)!l.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="");for(var s in t)n=t[s],t.hasOwnProperty(s)&&l[s]!==n&&Ec(e,s,n)}else for(var i in t)t.hasOwnProperty(i)&&Ec(e,i,t[i])}function Lr(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 cp=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"]]),up=/^[\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 us(e){return up.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function xl(){}var Dr=null;function Or(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ma=null,za=null;function Cc(e){var t=Ta(e);if(t&&(e=t.stateNode)){var l=e[Tt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Mr(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Kt(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var n=l[t];if(n!==e&&n.form===e.form){var s=n[Tt]||null;if(!s)throw Error(u(90));Mr(n,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<l.length;t++)n=l[t],n.form===e.form&&bc(n)}break e;case"textarea":Sc(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Ra(e,!!l.multiple,t,!1)}}}var Br=!1;function Tc(e,t,l){if(Br)return e(t,l);Br=!0;try{var n=e(t);return n}finally{if(Br=!1,(Ma!==null||za!==null)&&(Fs(),Ma&&(t=Ma,e=za,za=Ma=null,Cc(t),e)))for(t=0;t<e.length;t++)Cc(e[t])}}function hn(e,t){var l=e.stateNode;if(l===null)return null;var n=l[Tt]||null;if(n===null)return null;l=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(l&&typeof l!="function")throw Error(u(231,t,typeof l));return l}var pl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hr=!1;if(pl)try{var vn={};Object.defineProperty(vn,"passive",{get:function(){Hr=!0}}),window.addEventListener("test",vn,vn),window.removeEventListener("test",vn,vn)}catch{Hr=!1}var zl=null,Ur=null,ds=null;function wc(){if(ds)return ds;var e,t=Ur,l=t.length,n,s="value"in zl?zl.value:zl.textContent,i=s.length;for(e=0;e<l&&t[e]===s[e];e++);var d=l-e;for(n=1;n<=d&&t[l-n]===s[i-n];n++);return ds=s.slice(e,1<n?1-n:void 0)}function fs(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 xs(){return!0}function Ac(){return!1}function wt(e){function t(l,n,s,i,d){this._reactName=l,this._targetInst=s,this.type=n,this.nativeEvent=i,this.target=d,this.currentTarget=null;for(var h in e)e.hasOwnProperty(h)&&(l=e[h],this[h]=l?l(i):i[h]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?xs:Ac,this.isPropagationStopped=Ac,this}return g(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=xs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=xs)},persist:function(){},isPersistent:xs}),t}var ia={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ps=wt(ia),yn=g({},ia,{view:0,detail:0}),dp=wt(yn),qr,Vr,gn,ms=g({},yn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yr,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!==gn&&(gn&&e.type==="mousemove"?(qr=e.screenX-gn.screenX,Vr=e.screenY-gn.screenY):Vr=qr=0,gn=e),qr)},movementY:function(e){return"movementY"in e?e.movementY:Vr}}),Rc=wt(ms),fp=g({},ms,{dataTransfer:0}),xp=wt(fp),pp=g({},yn,{relatedTarget:0}),Gr=wt(pp),mp=g({},ia,{animationName:0,elapsedTime:0,pseudoElement:0}),hp=wt(mp),vp=g({},ia,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),yp=wt(vp),gp=g({},ia,{data:0}),_c=wt(gp),bp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jp={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"},Sp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Np(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Sp[e])?!!t[e]:!1}function Yr(){return Np}var Ep=g({},yn,{key:function(e){if(e.key){var t=bp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=fs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?jp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yr,charCode:function(e){return e.type==="keypress"?fs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?fs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),kp=wt(Ep),Cp=g({},ms,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mc=wt(Cp),Tp=g({},yn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yr}),wp=wt(Tp),Ap=g({},ia,{propertyName:0,elapsedTime:0,pseudoElement:0}),Rp=wt(Ap),_p=g({},ms,{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}),Mp=wt(_p),zp=g({},ia,{newState:0,oldState:0}),Lp=wt(zp),Dp=[9,13,27,32],Qr=pl&&"CompositionEvent"in window,bn=null;pl&&"documentMode"in document&&(bn=document.documentMode);var Op=pl&&"TextEvent"in window&&!bn,zc=pl&&(!Qr||bn&&8<bn&&11>=bn),Lc=" ",Dc=!1;function Oc(e,t){switch(e){case"keyup":return Dp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var La=!1;function Bp(e,t){switch(e){case"compositionend":return Bc(t);case"keypress":return t.which!==32?null:(Dc=!0,Lc);case"textInput":return e=t.data,e===Lc&&Dc?null:e;default:return null}}function Hp(e,t){if(La)return e==="compositionend"||!Qr&&Oc(e,t)?(e=wc(),ds=Ur=zl=null,La=!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 zc&&t.locale!=="ko"?null:t.data;default:return null}}var Up={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 Hc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Up[e.type]:t==="textarea"}function Uc(e,t,l,n){Ma?za?za.push(n):za=[n]:Ma=n,t=nr(t,"onChange"),0<t.length&&(l=new ps("onChange","change",null,l,n),e.push({event:l,listeners:t}))}var jn=null,Sn=null;function qp(e){Sf(e,0)}function hs(e){var t=mn(e);if(bc(t))return e}function qc(e,t){if(e==="change")return t}var Vc=!1;if(pl){var Xr;if(pl){var Kr="oninput"in document;if(!Kr){var Gc=document.createElement("div");Gc.setAttribute("oninput","return;"),Kr=typeof Gc.oninput=="function"}Xr=Kr}else Xr=!1;Vc=Xr&&(!document.documentMode||9<document.documentMode)}function Yc(){jn&&(jn.detachEvent("onpropertychange",Qc),Sn=jn=null)}function Qc(e){if(e.propertyName==="value"&&hs(Sn)){var t=[];Uc(t,Sn,e,Or(e)),Tc(qp,t)}}function Vp(e,t,l){e==="focusin"?(Yc(),jn=t,Sn=l,jn.attachEvent("onpropertychange",Qc)):e==="focusout"&&Yc()}function Gp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return hs(Sn)}function Yp(e,t){if(e==="click")return hs(t)}function Qp(e,t){if(e==="input"||e==="change")return hs(t)}function Xp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Bt=typeof Object.is=="function"?Object.is:Xp;function Nn(e,t){if(Bt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),n=Object.keys(t);if(l.length!==n.length)return!1;for(n=0;n<l.length;n++){var s=l[n];if(!Xe.call(t,s)||!Bt(e[s],t[s]))return!1}return!0}function Xc(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Kc(e,t){var l=Xc(e);e=0;for(var n;l;){if(l.nodeType===3){if(n=e+l.textContent.length,e<=t&&n>=t)return{node:l,offset:t-e};e=n}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Xc(l)}}function $c(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$c(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zc(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=cs(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=cs(e.document)}return t}function $r(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 Kp=pl&&"documentMode"in document&&11>=document.documentMode,Da=null,Zr=null,En=null,Jr=!1;function Jc(e,t,l){var n=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Jr||Da==null||Da!==cs(n)||(n=Da,"selectionStart"in n&&$r(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}),En&&Nn(En,n)||(En=n,n=nr(Zr,"onSelect"),0<n.length&&(t=new ps("onSelect","select",null,t,l),e.push({event:t,listeners:n}),t.target=Da)))}function oa(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Oa={animationend:oa("Animation","AnimationEnd"),animationiteration:oa("Animation","AnimationIteration"),animationstart:oa("Animation","AnimationStart"),transitionrun:oa("Transition","TransitionRun"),transitionstart:oa("Transition","TransitionStart"),transitioncancel:oa("Transition","TransitionCancel"),transitionend:oa("Transition","TransitionEnd")},Wr={},Wc={};pl&&(Wc=document.createElement("div").style,"AnimationEvent"in window||(delete Oa.animationend.animation,delete Oa.animationiteration.animation,delete Oa.animationstart.animation),"TransitionEvent"in window||delete Oa.transitionend.transition);function ca(e){if(Wr[e])return Wr[e];if(!Oa[e])return e;var t=Oa[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Wc)return Wr[e]=t[l];return e}var Fc=ca("animationend"),Ic=ca("animationiteration"),Pc=ca("animationstart"),$p=ca("transitionrun"),Zp=ca("transitionstart"),Jp=ca("transitioncancel"),eu=ca("transitionend"),tu=new Map,Fr="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(" ");Fr.push("scrollEnd");function sl(e,t){tu.set(e,t),ra(t,[e])}var vs=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)},$t=[],Ba=0,Ir=0;function ys(){for(var e=Ba,t=Ir=Ba=0;t<e;){var l=$t[t];$t[t++]=null;var n=$t[t];$t[t++]=null;var s=$t[t];$t[t++]=null;var i=$t[t];if($t[t++]=null,n!==null&&s!==null){var d=n.pending;d===null?s.next=s:(s.next=d.next,d.next=s),n.pending=s}i!==0&&lu(l,s,i)}}function gs(e,t,l,n){$t[Ba++]=e,$t[Ba++]=t,$t[Ba++]=l,$t[Ba++]=n,Ir|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function Pr(e,t,l,n){return gs(e,t,l,n),bs(e)}function ua(e,t){return gs(e,null,null,t),bs(e)}function lu(e,t,l){e.lanes|=l;var n=e.alternate;n!==null&&(n.lanes|=l);for(var s=!1,i=e.return;i!==null;)i.childLanes|=l,n=i.alternate,n!==null&&(n.childLanes|=l),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(s=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,s&&t!==null&&(s=31-et(l),e=i.hiddenUpdates,n=e[s],n===null?e[s]=[t]:n.push(t),t.lane=l|536870912),i):null}function bs(e){if(50<Kn)throw Kn=0,oo=null,Error(u(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ha={};function Wp(e,t,l,n){this.tag=e,this.key=l,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 Ht(e,t,l,n){return new Wp(e,t,l,n)}function ei(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ml(e,t){var l=e.alternate;return l===null?(l=Ht(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function au(e,t){e.flags&=65011714;var l=e.alternate;return l===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=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function js(e,t,l,n,s,i){var d=0;if(n=e,typeof e=="function")ei(e)&&(d=1);else if(typeof e=="string")d=th(e,l,ne.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Q:return e=Ht(31,l,t,s),e.elementType=Q,e.lanes=i,e;case L:return da(l.children,s,i,t);case G:d=8,s|=24;break;case q:return e=Ht(12,l,t,s|2),e.elementType=q,e.lanes=i,e;case P:return e=Ht(13,l,t,s),e.elementType=P,e.lanes=i,e;case re:return e=Ht(19,l,t,s),e.elementType=re,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ee:d=10;break e;case J:d=9;break e;case K:d=11;break e;case X:d=14;break e;case te:d=16,n=null;break e}d=29,l=Error(u(130,e===null?"null":typeof e,"")),n=null}return t=Ht(d,l,t,s),t.elementType=e,t.type=n,t.lanes=i,t}function da(e,t,l,n){return e=Ht(7,e,n,t),e.lanes=l,e}function ti(e,t,l){return e=Ht(6,e,null,t),e.lanes=l,e}function nu(e){var t=Ht(18,null,null,0);return t.stateNode=e,t}function li(e,t,l){return t=Ht(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var su=new WeakMap;function Zt(e,t){if(typeof e=="object"&&e!==null){var l=su.get(e);return l!==void 0?l:(t={value:e,source:t,stack:ut(t)},su.set(e,t),t)}return{value:e,source:t,stack:ut(t)}}var Ua=[],qa=0,Ss=null,kn=0,Jt=[],Wt=0,Ll=null,ol=1,cl="";function hl(e,t){Ua[qa++]=kn,Ua[qa++]=Ss,Ss=e,kn=t}function ru(e,t,l){Jt[Wt++]=ol,Jt[Wt++]=cl,Jt[Wt++]=Ll,Ll=e;var n=ol;e=cl;var s=32-et(n)-1;n&=~(1<<s),l+=1;var i=32-et(t)+s;if(30<i){var d=s-s%5;i=(n&(1<<d)-1).toString(32),n>>=d,s-=d,ol=1<<32-et(t)+s|l<<s|n,cl=i+e}else ol=1<<i|l<<s|n,cl=e}function ai(e){e.return!==null&&(hl(e,1),ru(e,1,0))}function ni(e){for(;e===Ss;)Ss=Ua[--qa],Ua[qa]=null,kn=Ua[--qa],Ua[qa]=null;for(;e===Ll;)Ll=Jt[--Wt],Jt[Wt]=null,cl=Jt[--Wt],Jt[Wt]=null,ol=Jt[--Wt],Jt[Wt]=null}function iu(e,t){Jt[Wt++]=ol,Jt[Wt++]=cl,Jt[Wt++]=Ll,ol=t.id,cl=t.overflow,Ll=e}var vt=null,Ke=null,we=!1,Dl=null,Ft=!1,si=Error(u(519));function Ol(e){var t=Error(u(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Cn(Zt(t,e)),si}function ou(e){var t=e.stateNode,l=e.type,n=e.memoizedProps;switch(t[ht]=e,t[Tt]=n,l){case"dialog":ke("cancel",t),ke("close",t);break;case"iframe":case"object":case"embed":ke("load",t);break;case"video":case"audio":for(l=0;l<Zn.length;l++)ke(Zn[l],t);break;case"source":ke("error",t);break;case"img":case"image":case"link":ke("error",t),ke("load",t);break;case"details":ke("toggle",t);break;case"input":ke("invalid",t),jc(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":ke("invalid",t);break;case"textarea":ke("invalid",t),Nc(t,n.value,n.defaultValue,n.children)}l=n.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||n.suppressHydrationWarning===!0||Cf(t.textContent,l)?(n.popover!=null&&(ke("beforetoggle",t),ke("toggle",t)),n.onScroll!=null&&ke("scroll",t),n.onScrollEnd!=null&&ke("scrollend",t),n.onClick!=null&&(t.onclick=xl),t=!0):t=!1,t||Ol(e,!0)}function cu(e){for(vt=e.return;vt;)switch(vt.tag){case 5:case 31:case 13:Ft=!1;return;case 27:case 3:Ft=!0;return;default:vt=vt.return}}function Va(e){if(e!==vt)return!1;if(!we)return cu(e),we=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Eo(e.type,e.memoizedProps)),l=!l),l&&Ke&&Ol(e),cu(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Ke=Df(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Ke=Df(e)}else t===27?(t=Ke,Wl(e.type)?(e=Ao,Ao=null,Ke=e):Ke=t):Ke=vt?Pt(e.stateNode.nextSibling):null;return!0}function fa(){Ke=vt=null,we=!1}function ri(){var e=Dl;return e!==null&&(Mt===null?Mt=e:Mt.push.apply(Mt,e),Dl=null),e}function Cn(e){Dl===null?Dl=[e]:Dl.push(e)}var ii=j(null),xa=null,vl=null;function Bl(e,t,l){W(ii,t._currentValue),t._currentValue=l}function yl(e){e._currentValue=ii.current,D(ii)}function oi(e,t,l){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===l)break;e=e.return}}function ci(e,t,l,n){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var i=s.dependencies;if(i!==null){var d=s.child;i=i.firstContext;e:for(;i!==null;){var h=i;i=s;for(var N=0;N<t.length;N++)if(h.context===t[N]){i.lanes|=l,h=i.alternate,h!==null&&(h.lanes|=l),oi(i.return,l,e),n||(d=null);break e}i=h.next}}else if(s.tag===18){if(d=s.return,d===null)throw Error(u(341));d.lanes|=l,i=d.alternate,i!==null&&(i.lanes|=l),oi(d,l,e),d=null}else d=s.child;if(d!==null)d.return=s;else for(d=s;d!==null;){if(d===e){d=null;break}if(s=d.sibling,s!==null){s.return=d.return,d=s;break}d=d.return}s=d}}function Ga(e,t,l,n){e=null;for(var s=t,i=!1;s!==null;){if(!i){if((s.flags&524288)!==0)i=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var d=s.alternate;if(d===null)throw Error(u(387));if(d=d.memoizedProps,d!==null){var h=s.type;Bt(s.pendingProps.value,d.value)||(e!==null?e.push(h):e=[h])}}else if(s===ve.current){if(d=s.alternate,d===null)throw Error(u(387));d.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(Pn):e=[Pn])}s=s.return}e!==null&&ci(t,e,l,n),t.flags|=262144}function Ns(e){for(e=e.firstContext;e!==null;){if(!Bt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function pa(e){xa=e,vl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return uu(xa,e)}function Es(e,t){return xa===null&&pa(e),uu(e,t)}function uu(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},vl===null){if(e===null)throw Error(u(308));vl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else vl=vl.next=t;return l}var Fp=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},Ip=r.unstable_scheduleCallback,Pp=r.unstable_NormalPriority,rt={$$typeof:ee,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ui(){return{controller:new Fp,data:new Map,refCount:0}}function Tn(e){e.refCount--,e.refCount===0&&Ip(Pp,function(){e.controller.abort()})}var wn=null,di=0,Ya=0,Qa=null;function em(e,t){if(wn===null){var l=wn=[];di=0,Ya=mo(),Qa={status:"pending",value:void 0,then:function(n){l.push(n)}}}return di++,t.then(du,du),t}function du(){if(--di===0&&wn!==null){Qa!==null&&(Qa.status="fulfilled");var e=wn;wn=null,Ya=0,Qa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function tm(e,t){var l=[],n={status:"pending",value:null,reason:null,then:function(s){l.push(s)}};return e.then(function(){n.status="fulfilled",n.value=t;for(var s=0;s<l.length;s++)(0,l[s])(t)},function(s){for(n.status="rejected",n.reason=s,s=0;s<l.length;s++)(0,l[s])(void 0)}),n}var fu=E.S;E.S=function(e,t){Jd=We(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&em(e,t),fu!==null&&fu(e,t)};var ma=j(null);function fi(){var e=ma.current;return e!==null?e:Ge.pooledCache}function ks(e,t){t===null?W(ma,ma.current):W(ma,t.pool)}function xu(){var e=fi();return e===null?null:{parent:rt._currentValue,pool:e}}var Xa=Error(u(460)),xi=Error(u(474)),Cs=Error(u(542)),Ts={then:function(){}};function pu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function mu(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(xl,xl),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,vu(e),e;default:if(typeof t.status=="string")t.then(xl,xl);else{if(e=Ge,e!==null&&100<e.shellSuspendCounter)throw Error(u(482));e=t,e.status="pending",e.then(function(n){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=n}},function(n){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,vu(e),e}throw va=t,Xa}}function ha(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(va=l,Xa):l}}var va=null;function hu(){if(va===null)throw Error(u(459));var e=va;return va=null,e}function vu(e){if(e===Xa||e===Cs)throw Error(u(483))}var Ka=null,An=0;function ws(e){var t=An;return An+=1,Ka===null&&(Ka=[]),mu(Ka,e,t)}function Rn(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function As(e,t){throw t.$$typeof===C?Error(u(525)):(e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function yu(e){function t(T,k){if(e){var A=T.deletions;A===null?(T.deletions=[k],T.flags|=16):A.push(k)}}function l(T,k){if(!e)return null;for(;k!==null;)t(T,k),k=k.sibling;return null}function n(T){for(var k=new Map;T!==null;)T.key!==null?k.set(T.key,T):k.set(T.index,T),T=T.sibling;return k}function s(T,k){return T=ml(T,k),T.index=0,T.sibling=null,T}function i(T,k,A){return T.index=A,e?(A=T.alternate,A!==null?(A=A.index,A<k?(T.flags|=67108866,k):A):(T.flags|=67108866,k)):(T.flags|=1048576,k)}function d(T){return e&&T.alternate===null&&(T.flags|=67108866),T}function h(T,k,A,V){return k===null||k.tag!==6?(k=ti(A,T.mode,V),k.return=T,k):(k=s(k,A),k.return=T,k)}function N(T,k,A,V){var he=A.type;return he===L?U(T,k,A.props.children,V,A.key):k!==null&&(k.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===te&&ha(he)===k.type)?(k=s(k,A.props),Rn(k,A),k.return=T,k):(k=js(A.type,A.key,A.props,null,T.mode,V),Rn(k,A),k.return=T,k)}function R(T,k,A,V){return k===null||k.tag!==4||k.stateNode.containerInfo!==A.containerInfo||k.stateNode.implementation!==A.implementation?(k=li(A,T.mode,V),k.return=T,k):(k=s(k,A.children||[]),k.return=T,k)}function U(T,k,A,V,he){return k===null||k.tag!==7?(k=da(A,T.mode,V,he),k.return=T,k):(k=s(k,A),k.return=T,k)}function Y(T,k,A){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=ti(""+k,T.mode,A),k.return=T,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case w:return A=js(k.type,k.key,k.props,null,T.mode,A),Rn(A,k),A.return=T,A;case O:return k=li(k,T.mode,A),k.return=T,k;case te:return k=ha(k),Y(T,k,A)}if(I(k)||ie(k))return k=da(k,T.mode,A,null),k.return=T,k;if(typeof k.then=="function")return Y(T,ws(k),A);if(k.$$typeof===ee)return Y(T,Es(T,k),A);As(T,k)}return null}function z(T,k,A,V){var he=k!==null?k.key:null;if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return he!==null?null:h(T,k,""+A,V);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case w:return A.key===he?N(T,k,A,V):null;case O:return A.key===he?R(T,k,A,V):null;case te:return A=ha(A),z(T,k,A,V)}if(I(A)||ie(A))return he!==null?null:U(T,k,A,V,null);if(typeof A.then=="function")return z(T,k,ws(A),V);if(A.$$typeof===ee)return z(T,k,Es(T,A),V);As(T,A)}return null}function H(T,k,A,V,he){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return T=T.get(A)||null,h(k,T,""+V,he);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case w:return T=T.get(V.key===null?A:V.key)||null,N(k,T,V,he);case O:return T=T.get(V.key===null?A:V.key)||null,R(k,T,V,he);case te:return V=ha(V),H(T,k,A,V,he)}if(I(V)||ie(V))return T=T.get(A)||null,U(k,T,V,he,null);if(typeof V.then=="function")return H(T,k,A,ws(V),he);if(V.$$typeof===ee)return H(T,k,A,Es(k,V),he);As(k,V)}return null}function ce(T,k,A,V){for(var he=null,_e=null,xe=k,Ne=k=0,Te=null;xe!==null&&Ne<A.length;Ne++){xe.index>Ne?(Te=xe,xe=null):Te=xe.sibling;var Me=z(T,xe,A[Ne],V);if(Me===null){xe===null&&(xe=Te);break}e&&xe&&Me.alternate===null&&t(T,xe),k=i(Me,k,Ne),_e===null?he=Me:_e.sibling=Me,_e=Me,xe=Te}if(Ne===A.length)return l(T,xe),we&&hl(T,Ne),he;if(xe===null){for(;Ne<A.length;Ne++)xe=Y(T,A[Ne],V),xe!==null&&(k=i(xe,k,Ne),_e===null?he=xe:_e.sibling=xe,_e=xe);return we&&hl(T,Ne),he}for(xe=n(xe);Ne<A.length;Ne++)Te=H(xe,T,Ne,A[Ne],V),Te!==null&&(e&&Te.alternate!==null&&xe.delete(Te.key===null?Ne:Te.key),k=i(Te,k,Ne),_e===null?he=Te:_e.sibling=Te,_e=Te);return e&&xe.forEach(function(ta){return t(T,ta)}),we&&hl(T,Ne),he}function ye(T,k,A,V){if(A==null)throw Error(u(151));for(var he=null,_e=null,xe=k,Ne=k=0,Te=null,Me=A.next();xe!==null&&!Me.done;Ne++,Me=A.next()){xe.index>Ne?(Te=xe,xe=null):Te=xe.sibling;var ta=z(T,xe,Me.value,V);if(ta===null){xe===null&&(xe=Te);break}e&&xe&&ta.alternate===null&&t(T,xe),k=i(ta,k,Ne),_e===null?he=ta:_e.sibling=ta,_e=ta,xe=Te}if(Me.done)return l(T,xe),we&&hl(T,Ne),he;if(xe===null){for(;!Me.done;Ne++,Me=A.next())Me=Y(T,Me.value,V),Me!==null&&(k=i(Me,k,Ne),_e===null?he=Me:_e.sibling=Me,_e=Me);return we&&hl(T,Ne),he}for(xe=n(xe);!Me.done;Ne++,Me=A.next())Me=H(xe,T,Ne,Me.value,V),Me!==null&&(e&&Me.alternate!==null&&xe.delete(Me.key===null?Ne:Me.key),k=i(Me,k,Ne),_e===null?he=Me:_e.sibling=Me,_e=Me);return e&&xe.forEach(function(fh){return t(T,fh)}),we&&hl(T,Ne),he}function qe(T,k,A,V){if(typeof A=="object"&&A!==null&&A.type===L&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case w:e:{for(var he=A.key;k!==null;){if(k.key===he){if(he=A.type,he===L){if(k.tag===7){l(T,k.sibling),V=s(k,A.props.children),V.return=T,T=V;break e}}else if(k.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===te&&ha(he)===k.type){l(T,k.sibling),V=s(k,A.props),Rn(V,A),V.return=T,T=V;break e}l(T,k);break}else t(T,k);k=k.sibling}A.type===L?(V=da(A.props.children,T.mode,V,A.key),V.return=T,T=V):(V=js(A.type,A.key,A.props,null,T.mode,V),Rn(V,A),V.return=T,T=V)}return d(T);case O:e:{for(he=A.key;k!==null;){if(k.key===he)if(k.tag===4&&k.stateNode.containerInfo===A.containerInfo&&k.stateNode.implementation===A.implementation){l(T,k.sibling),V=s(k,A.children||[]),V.return=T,T=V;break e}else{l(T,k);break}else t(T,k);k=k.sibling}V=li(A,T.mode,V),V.return=T,T=V}return d(T);case te:return A=ha(A),qe(T,k,A,V)}if(I(A))return ce(T,k,A,V);if(ie(A)){if(he=ie(A),typeof he!="function")throw Error(u(150));return A=he.call(A),ye(T,k,A,V)}if(typeof A.then=="function")return qe(T,k,ws(A),V);if(A.$$typeof===ee)return qe(T,k,Es(T,A),V);As(T,A)}return typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint"?(A=""+A,k!==null&&k.tag===6?(l(T,k.sibling),V=s(k,A),V.return=T,T=V):(l(T,k),V=ti(A,T.mode,V),V.return=T,T=V),d(T)):l(T,k)}return function(T,k,A,V){try{An=0;var he=qe(T,k,A,V);return Ka=null,he}catch(xe){if(xe===Xa||xe===Cs)throw xe;var _e=Ht(29,xe,null,T.mode);return _e.lanes=V,_e.return=T,_e}finally{}}}var ya=yu(!0),gu=yu(!1),Hl=!1;function pi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function mi(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 Ul(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ql(e,t,l){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(Le&2)!==0){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,t=bs(e),lu(e,null,l),t}return gs(e,n,t,l),bs(e)}function _n(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,l|=n,t.lanes=l,uc(e,l)}}function hi(e,t){var l=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,l===n)){var s=null,i=null;if(l=l.firstBaseUpdate,l!==null){do{var d={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};i===null?s=i=d:i=i.next=d,l=l.next}while(l!==null);i===null?s=i=t:i=i.next=t}else s=i=t;l={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:n.shared,callbacks:n.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var vi=!1;function Mn(){if(vi){var e=Qa;if(e!==null)throw e}}function zn(e,t,l,n){vi=!1;var s=e.updateQueue;Hl=!1;var i=s.firstBaseUpdate,d=s.lastBaseUpdate,h=s.shared.pending;if(h!==null){s.shared.pending=null;var N=h,R=N.next;N.next=null,d===null?i=R:d.next=R,d=N;var U=e.alternate;U!==null&&(U=U.updateQueue,h=U.lastBaseUpdate,h!==d&&(h===null?U.firstBaseUpdate=R:h.next=R,U.lastBaseUpdate=N))}if(i!==null){var Y=s.baseState;d=0,U=R=N=null,h=i;do{var z=h.lane&-536870913,H=z!==h.lane;if(H?(Ce&z)===z:(n&z)===z){z!==0&&z===Ya&&(vi=!0),U!==null&&(U=U.next={lane:0,tag:h.tag,payload:h.payload,callback:null,next:null});e:{var ce=e,ye=h;z=t;var qe=l;switch(ye.tag){case 1:if(ce=ye.payload,typeof ce=="function"){Y=ce.call(qe,Y,z);break e}Y=ce;break e;case 3:ce.flags=ce.flags&-65537|128;case 0:if(ce=ye.payload,z=typeof ce=="function"?ce.call(qe,Y,z):ce,z==null)break e;Y=g({},Y,z);break e;case 2:Hl=!0}}z=h.callback,z!==null&&(e.flags|=64,H&&(e.flags|=8192),H=s.callbacks,H===null?s.callbacks=[z]:H.push(z))}else H={lane:z,tag:h.tag,payload:h.payload,callback:h.callback,next:null},U===null?(R=U=H,N=Y):U=U.next=H,d|=z;if(h=h.next,h===null){if(h=s.shared.pending,h===null)break;H=h,h=H.next,H.next=null,s.lastBaseUpdate=H,s.shared.pending=null}}while(!0);U===null&&(N=Y),s.baseState=N,s.firstBaseUpdate=R,s.lastBaseUpdate=U,i===null&&(s.shared.lanes=0),Xl|=d,e.lanes=d,e.memoizedState=Y}}function bu(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function ju(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)bu(l[e],t)}var $a=j(null),Rs=j(0);function Su(e,t){e=Tl,W(Rs,e),W($a,t),Tl=e|t.baseLanes}function yi(){W(Rs,Tl),W($a,$a.current)}function gi(){Tl=Rs.current,D($a),D(Rs)}var Ut=j(null),It=null;function Vl(e){var t=e.alternate;W(tt,tt.current&1),W(Ut,e),It===null&&(t===null||$a.current!==null||t.memoizedState!==null)&&(It=e)}function bi(e){W(tt,tt.current),W(Ut,e),It===null&&(It=e)}function Nu(e){e.tag===22?(W(tt,tt.current),W(Ut,e),It===null&&(It=e)):Gl()}function Gl(){W(tt,tt.current),W(Ut,Ut.current)}function qt(e){D(Ut),It===e&&(It=null),D(tt)}var tt=j(0);function _s(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||To(l)||wo(l)))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 gl=0,Se=null,He=null,it=null,Ms=!1,Za=!1,ga=!1,zs=0,Ln=0,Ja=null,lm=0;function Ie(){throw Error(u(321))}function ji(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!Bt(e[l],t[l]))return!1;return!0}function Si(e,t,l,n,s,i){return gl=i,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?rd:Bi,ga=!1,i=l(n,s),ga=!1,Za&&(i=ku(t,l,n,s)),Eu(e),i}function Eu(e){E.H=Bn;var t=He!==null&&He.next!==null;if(gl=0,it=He=Se=null,Ms=!1,Ln=0,Ja=null,t)throw Error(u(300));e===null||ot||(e=e.dependencies,e!==null&&Ns(e)&&(ot=!0))}function ku(e,t,l,n){Se=e;var s=0;do{if(Za&&(Ja=null),Ln=0,Za=!1,25<=s)throw Error(u(301));if(s+=1,it=He=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}E.H=id,i=t(l,n)}while(Za);return i}function am(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?Dn(t):t,e=e.useState()[0],(He!==null?He.memoizedState:null)!==e&&(Se.flags|=1024),t}function Ni(){var e=zs!==0;return zs=0,e}function Ei(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function ki(e){if(Ms){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ms=!1}gl=0,it=He=Se=null,Za=!1,Ln=zs=0,Ja=null}function St(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return it===null?Se.memoizedState=it=e:it=it.next=e,it}function lt(){if(He===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=He.next;var t=it===null?Se.memoizedState:it.next;if(t!==null)it=t,He=e;else{if(e===null)throw Se.alternate===null?Error(u(467)):Error(u(310));He=e,e={memoizedState:He.memoizedState,baseState:He.baseState,baseQueue:He.baseQueue,queue:He.queue,next:null},it===null?Se.memoizedState=it=e:it=it.next=e}return it}function Ls(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Dn(e){var t=Ln;return Ln+=1,Ja===null&&(Ja=[]),e=mu(Ja,e,t),t=Se,(it===null?t.memoizedState:it.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?rd:Bi),e}function Ds(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Dn(e);if(e.$$typeof===ee)return yt(e)}throw Error(u(438,String(e)))}function Ci(e){var t=null,l=Se.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var n=Se.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=Ls(),Se.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),n=0;n<e;n++)l[n]=F;return t.index++,l}function bl(e,t){return typeof t=="function"?t(e):t}function Os(e){var t=lt();return Ti(t,He,e)}function Ti(e,t,l){var n=e.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=l;var s=e.baseQueue,i=n.pending;if(i!==null){if(s!==null){var d=s.next;s.next=i.next,i.next=d}t.baseQueue=s=i,n.pending=null}if(i=e.baseState,s===null)e.memoizedState=i;else{t=s.next;var h=d=null,N=null,R=t,U=!1;do{var Y=R.lane&-536870913;if(Y!==R.lane?(Ce&Y)===Y:(gl&Y)===Y){var z=R.revertLane;if(z===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null}),Y===Ya&&(U=!0);else if((gl&z)===z){R=R.next,z===Ya&&(U=!0);continue}else Y={lane:0,revertLane:R.revertLane,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},N===null?(h=N=Y,d=i):N=N.next=Y,Se.lanes|=z,Xl|=z;Y=R.action,ga&&l(i,Y),i=R.hasEagerState?R.eagerState:l(i,Y)}else z={lane:Y,revertLane:R.revertLane,gesture:R.gesture,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},N===null?(h=N=z,d=i):N=N.next=z,Se.lanes|=Y,Xl|=Y;R=R.next}while(R!==null&&R!==t);if(N===null?d=i:N.next=h,!Bt(i,e.memoizedState)&&(ot=!0,U&&(l=Qa,l!==null)))throw l;e.memoizedState=i,e.baseState=d,e.baseQueue=N,n.lastRenderedState=i}return s===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function wi(e){var t=lt(),l=t.queue;if(l===null)throw Error(u(311));l.lastRenderedReducer=e;var n=l.dispatch,s=l.pending,i=t.memoizedState;if(s!==null){l.pending=null;var d=s=s.next;do i=e(i,d.action),d=d.next;while(d!==s);Bt(i,t.memoizedState)||(ot=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),l.lastRenderedState=i}return[i,n]}function Cu(e,t,l){var n=Se,s=lt(),i=we;if(i){if(l===void 0)throw Error(u(407));l=l()}else l=t();var d=!Bt((He||s).memoizedState,l);if(d&&(s.memoizedState=l,ot=!0),s=s.queue,_i(Au.bind(null,n,s,e),[e]),s.getSnapshot!==t||d||it!==null&&it.memoizedState.tag&1){if(n.flags|=2048,Wa(9,{destroy:void 0},wu.bind(null,n,s,l,t),null),Ge===null)throw Error(u(349));i||(gl&127)!==0||Tu(n,t,l)}return l}function Tu(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Se.updateQueue,t===null?(t=Ls(),Se.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function wu(e,t,l,n){t.value=l,t.getSnapshot=n,Ru(t)&&_u(e)}function Au(e,t,l){return l(function(){Ru(t)&&_u(e)})}function Ru(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!Bt(e,l)}catch{return!0}}function _u(e){var t=ua(e,2);t!==null&&zt(t,e,2)}function Ai(e){var t=St();if(typeof e=="function"){var l=e;if(e=l(),ga){nt(!0);try{l()}finally{nt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bl,lastRenderedState:e},t}function Mu(e,t,l,n){return e.baseState=l,Ti(e,He,typeof n=="function"?n:bl)}function nm(e,t,l,n,s){if(Us(e))throw Error(u(485));if(e=t.action,e!==null){var i={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(d){i.listeners.push(d)}};E.T!==null?l(!0):i.isTransition=!1,n(i),l=t.pending,l===null?(i.next=t.pending=i,zu(t,i)):(i.next=l.next,t.pending=l.next=i)}}function zu(e,t){var l=t.action,n=t.payload,s=e.state;if(t.isTransition){var i=E.T,d={};E.T=d;try{var h=l(s,n),N=E.S;N!==null&&N(d,h),Lu(e,t,h)}catch(R){Ri(e,t,R)}finally{i!==null&&d.types!==null&&(i.types=d.types),E.T=i}}else try{i=l(s,n),Lu(e,t,i)}catch(R){Ri(e,t,R)}}function Lu(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(n){Du(e,t,n)},function(n){return Ri(e,t,n)}):Du(e,t,l)}function Du(e,t,l){t.status="fulfilled",t.value=l,Ou(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,zu(e,l)))}function Ri(e,t,l){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=l,Ou(t),t=t.next;while(t!==n)}e.action=null}function Ou(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Bu(e,t){return t}function Hu(e,t){if(we){var l=Ge.formState;if(l!==null){e:{var n=Se;if(we){if(Ke){t:{for(var s=Ke,i=Ft;s.nodeType!==8;){if(!i){s=null;break t}if(s=Pt(s.nextSibling),s===null){s=null;break t}}i=s.data,s=i==="F!"||i==="F"?s:null}if(s){Ke=Pt(s.nextSibling),n=s.data==="F!";break e}}Ol(n)}n=!1}n&&(t=l[0])}}return l=St(),l.memoizedState=l.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bu,lastRenderedState:t},l.queue=n,l=ad.bind(null,Se,n),n.dispatch=l,n=Ai(!1),i=Oi.bind(null,Se,!1,n.queue),n=St(),s={state:t,dispatch:null,action:e,pending:null},n.queue=s,l=nm.bind(null,Se,s,i,l),s.dispatch=l,n.memoizedState=e,[t,l,!1]}function Uu(e){var t=lt();return qu(t,He,e)}function qu(e,t,l){if(t=Ti(e,t,Bu)[0],e=Os(bl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=Dn(t)}catch(d){throw d===Xa?Cs:d}else n=t;t=lt();var s=t.queue,i=s.dispatch;return l!==t.memoizedState&&(Se.flags|=2048,Wa(9,{destroy:void 0},sm.bind(null,s,l),null)),[n,i,e]}function sm(e,t){e.action=t}function Vu(e){var t=lt(),l=He;if(l!==null)return qu(t,l,e);lt(),t=t.memoizedState,l=lt();var n=l.queue.dispatch;return l.memoizedState=e,[t,n,!1]}function Wa(e,t,l,n){return e={tag:e,create:l,deps:n,inst:t,next:null},t=Se.updateQueue,t===null&&(t=Ls(),Se.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(n=l.next,l.next=e,e.next=n,t.lastEffect=e),e}function Gu(){return lt().memoizedState}function Bs(e,t,l,n){var s=St();Se.flags|=e,s.memoizedState=Wa(1|t,{destroy:void 0},l,n===void 0?null:n)}function Hs(e,t,l,n){var s=lt();n=n===void 0?null:n;var i=s.memoizedState.inst;He!==null&&n!==null&&ji(n,He.memoizedState.deps)?s.memoizedState=Wa(t,i,l,n):(Se.flags|=e,s.memoizedState=Wa(1|t,i,l,n))}function Yu(e,t){Bs(8390656,8,e,t)}function _i(e,t){Hs(2048,8,e,t)}function rm(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=Ls(),Se.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function Qu(e){var t=lt().memoizedState;return rm({ref:t,nextImpl:e}),function(){if((Le&2)!==0)throw Error(u(440));return t.impl.apply(void 0,arguments)}}function Xu(e,t){return Hs(4,2,e,t)}function Ku(e,t){return Hs(4,4,e,t)}function $u(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Zu(e,t,l){l=l!=null?l.concat([e]):null,Hs(4,4,$u.bind(null,t,e),l)}function Mi(){}function Ju(e,t){var l=lt();t=t===void 0?null:t;var n=l.memoizedState;return t!==null&&ji(t,n[1])?n[0]:(l.memoizedState=[e,t],e)}function Wu(e,t){var l=lt();t=t===void 0?null:t;var n=l.memoizedState;if(t!==null&&ji(t,n[1]))return n[0];if(n=e(),ga){nt(!0);try{e()}finally{nt(!1)}}return l.memoizedState=[n,t],n}function zi(e,t,l){return l===void 0||(gl&1073741824)!==0&&(Ce&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=Fd(),Se.lanes|=e,Xl|=e,l)}function Fu(e,t,l,n){return Bt(l,t)?l:$a.current!==null?(e=zi(e,l,n),Bt(e,t)||(ot=!0),e):(gl&42)===0||(gl&1073741824)!==0&&(Ce&261930)===0?(ot=!0,e.memoizedState=l):(e=Fd(),Se.lanes|=e,Xl|=e,t)}function Iu(e,t,l,n,s){var i=M.p;M.p=i!==0&&8>i?i:8;var d=E.T,h={};E.T=h,Oi(e,!1,t,l);try{var N=s(),R=E.S;if(R!==null&&R(h,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var U=tm(N,n);On(e,t,U,Yt(e))}else On(e,t,n,Yt(e))}catch(Y){On(e,t,{then:function(){},status:"rejected",reason:Y},Yt())}finally{M.p=i,d!==null&&h.types!==null&&(d.types=h.types),E.T=d}}function im(){}function Li(e,t,l,n){if(e.tag!==5)throw Error(u(476));var s=Pu(e).queue;Iu(e,s,t,ae,l===null?im:function(){return ed(e),l(n)})}function Pu(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bl,lastRenderedState:ae},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bl,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ed(e){var t=Pu(e);t.next===null&&(t=e.alternate.memoizedState),On(e,t.next.queue,{},Yt())}function Di(){return yt(Pn)}function td(){return lt().memoizedState}function ld(){return lt().memoizedState}function om(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=Yt();e=Ul(l);var n=ql(t,e,l);n!==null&&(zt(n,t,l),_n(n,t,l)),t={cache:ui()},e.payload=t;return}t=t.return}}function cm(e,t,l){var n=Yt();l={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Us(e)?nd(t,l):(l=Pr(e,t,l,n),l!==null&&(zt(l,e,n),sd(l,t,n)))}function ad(e,t,l){var n=Yt();On(e,t,l,n)}function On(e,t,l,n){var s={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Us(e))nd(t,s);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,l);if(s.hasEagerState=!0,s.eagerState=h,Bt(h,d))return gs(e,t,s,0),Ge===null&&ys(),!1}catch{}finally{}if(l=Pr(e,t,s,n),l!==null)return zt(l,e,n),sd(l,t,n),!0}return!1}function Oi(e,t,l,n){if(n={lane:2,revertLane:mo(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Us(e)){if(t)throw Error(u(479))}else t=Pr(e,l,n,2),t!==null&&zt(t,e,2)}function Us(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function nd(e,t){Za=Ms=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function sd(e,t,l){if((l&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,l|=n,t.lanes=l,uc(e,l)}}var Bn={readContext:yt,use:Ds,useCallback:Ie,useContext:Ie,useEffect:Ie,useImperativeHandle:Ie,useLayoutEffect:Ie,useInsertionEffect:Ie,useMemo:Ie,useReducer:Ie,useRef:Ie,useState:Ie,useDebugValue:Ie,useDeferredValue:Ie,useTransition:Ie,useSyncExternalStore:Ie,useId:Ie,useHostTransitionStatus:Ie,useFormState:Ie,useActionState:Ie,useOptimistic:Ie,useMemoCache:Ie,useCacheRefresh:Ie};Bn.useEffectEvent=Ie;var rd={readContext:yt,use:Ds,useCallback:function(e,t){return St().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:Yu,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,Bs(4194308,4,$u.bind(null,t,e),l)},useLayoutEffect:function(e,t){return Bs(4194308,4,e,t)},useInsertionEffect:function(e,t){Bs(4,2,e,t)},useMemo:function(e,t){var l=St();t=t===void 0?null:t;var n=e();if(ga){nt(!0);try{e()}finally{nt(!1)}}return l.memoizedState=[n,t],n},useReducer:function(e,t,l){var n=St();if(l!==void 0){var s=l(t);if(ga){nt(!0);try{l(t)}finally{nt(!1)}}}else s=t;return n.memoizedState=n.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},n.queue=e,e=e.dispatch=cm.bind(null,Se,e),[n.memoizedState,e]},useRef:function(e){var t=St();return e={current:e},t.memoizedState=e},useState:function(e){e=Ai(e);var t=e.queue,l=ad.bind(null,Se,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Mi,useDeferredValue:function(e,t){var l=St();return zi(l,e,t)},useTransition:function(){var e=Ai(!1);return e=Iu.bind(null,Se,e.queue,!0,!1),St().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var n=Se,s=St();if(we){if(l===void 0)throw Error(u(407));l=l()}else{if(l=t(),Ge===null)throw Error(u(349));(Ce&127)!==0||Tu(n,t,l)}s.memoizedState=l;var i={value:l,getSnapshot:t};return s.queue=i,Yu(Au.bind(null,n,i,e),[e]),n.flags|=2048,Wa(9,{destroy:void 0},wu.bind(null,n,i,l,t),null),l},useId:function(){var e=St(),t=Ge.identifierPrefix;if(we){var l=cl,n=ol;l=(n&~(1<<32-et(n)-1)).toString(32)+l,t="_"+t+"R_"+l,l=zs++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=lm++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Di,useFormState:Hu,useActionState:Hu,useOptimistic:function(e){var t=St();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Oi.bind(null,Se,!0,l),l.dispatch=t,[e,t]},useMemoCache:Ci,useCacheRefresh:function(){return St().memoizedState=om.bind(null,Se)},useEffectEvent:function(e){var t=St(),l={impl:e};return t.memoizedState=l,function(){if((Le&2)!==0)throw Error(u(440));return l.impl.apply(void 0,arguments)}}},Bi={readContext:yt,use:Ds,useCallback:Ju,useContext:yt,useEffect:_i,useImperativeHandle:Zu,useInsertionEffect:Xu,useLayoutEffect:Ku,useMemo:Wu,useReducer:Os,useRef:Gu,useState:function(){return Os(bl)},useDebugValue:Mi,useDeferredValue:function(e,t){var l=lt();return Fu(l,He.memoizedState,e,t)},useTransition:function(){var e=Os(bl)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:Dn(e),t]},useSyncExternalStore:Cu,useId:td,useHostTransitionStatus:Di,useFormState:Uu,useActionState:Uu,useOptimistic:function(e,t){var l=lt();return Mu(l,He,e,t)},useMemoCache:Ci,useCacheRefresh:ld};Bi.useEffectEvent=Qu;var id={readContext:yt,use:Ds,useCallback:Ju,useContext:yt,useEffect:_i,useImperativeHandle:Zu,useInsertionEffect:Xu,useLayoutEffect:Ku,useMemo:Wu,useReducer:wi,useRef:Gu,useState:function(){return wi(bl)},useDebugValue:Mi,useDeferredValue:function(e,t){var l=lt();return He===null?zi(l,e,t):Fu(l,He.memoizedState,e,t)},useTransition:function(){var e=wi(bl)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:Dn(e),t]},useSyncExternalStore:Cu,useId:td,useHostTransitionStatus:Di,useFormState:Vu,useActionState:Vu,useOptimistic:function(e,t){var l=lt();return He!==null?Mu(l,He,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Ci,useCacheRefresh:ld};id.useEffectEvent=Qu;function Hi(e,t,l,n){t=e.memoizedState,l=l(n,t),l=l==null?t:g({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Ui={enqueueSetState:function(e,t,l){e=e._reactInternals;var n=Yt(),s=Ul(n);s.payload=t,l!=null&&(s.callback=l),t=ql(e,s,n),t!==null&&(zt(t,e,n),_n(t,e,n))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var n=Yt(),s=Ul(n);s.tag=1,s.payload=t,l!=null&&(s.callback=l),t=ql(e,s,n),t!==null&&(zt(t,e,n),_n(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=Yt(),n=Ul(l);n.tag=2,t!=null&&(n.callback=t),t=ql(e,n,l),t!==null&&(zt(t,e,l),_n(t,e,l))}};function od(e,t,l,n,s,i,d){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,i,d):t.prototype&&t.prototype.isPureReactComponent?!Nn(l,n)||!Nn(s,i):!0}function cd(e,t,l,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,n),t.state!==e&&Ui.enqueueReplaceState(t,t.state,null)}function ba(e,t){var l=t;if("ref"in t){l={};for(var n in t)n!=="ref"&&(l[n]=t[n])}if(e=e.defaultProps){l===t&&(l=g({},l));for(var s in e)l[s]===void 0&&(l[s]=e[s])}return l}function ud(e){vs(e)}function dd(e){console.error(e)}function fd(e){vs(e)}function qs(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function xd(e,t,l){try{var n=e.onCaughtError;n(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function qi(e,t,l){return l=Ul(l),l.tag=3,l.payload={element:null},l.callback=function(){qs(e,t)},l}function pd(e){return e=Ul(e),e.tag=3,e}function md(e,t,l,n){var s=l.type.getDerivedStateFromError;if(typeof s=="function"){var i=n.value;e.payload=function(){return s(i)},e.callback=function(){xd(t,l,n)}}var d=l.stateNode;d!==null&&typeof d.componentDidCatch=="function"&&(e.callback=function(){xd(t,l,n),typeof s!="function"&&(Kl===null?Kl=new Set([this]):Kl.add(this));var h=n.stack;this.componentDidCatch(n.value,{componentStack:h!==null?h:""})})}function um(e,t,l,n,s){if(l.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=l.alternate,t!==null&&Ga(t,l,s,!0),l=Ut.current,l!==null){switch(l.tag){case 31:case 13:return It===null?Is():l.alternate===null&&Pe===0&&(Pe=3),l.flags&=-257,l.flags|=65536,l.lanes=s,n===Ts?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([n]):t.add(n),fo(e,n,s)),!1;case 22:return l.flags|=65536,n===Ts?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([n]):l.add(n)),fo(e,n,s)),!1}throw Error(u(435,l.tag))}return fo(e,n,s),Is(),!1}if(we)return t=Ut.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,n!==si&&(e=Error(u(422),{cause:n}),Cn(Zt(e,l)))):(n!==si&&(t=Error(u(423),{cause:n}),Cn(Zt(t,l))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,n=Zt(n,l),s=qi(e.stateNode,n,s),hi(e,s),Pe!==4&&(Pe=2)),!1;var i=Error(u(520),{cause:n});if(i=Zt(i,l),Xn===null?Xn=[i]:Xn.push(i),Pe!==4&&(Pe=2),t===null)return!0;n=Zt(n,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=s&-s,l.lanes|=e,e=qi(l.stateNode,n,e),hi(l,e),!1;case 1:if(t=l.type,i=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(Kl===null||!Kl.has(i))))return l.flags|=65536,s&=-s,l.lanes|=s,s=pd(s),md(s,e,l,n),hi(l,s),!1}l=l.return}while(l!==null);return!1}var Vi=Error(u(461)),ot=!1;function gt(e,t,l,n){t.child=e===null?gu(t,null,l,n):ya(t,e.child,l,n)}function hd(e,t,l,n,s){l=l.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 pa(t),n=Si(e,t,l,d,i,s),h=Ni(),e!==null&&!ot?(Ei(e,t,s),jl(e,t,s)):(we&&h&&ai(t),t.flags|=1,gt(e,t,n,s),t.child)}function vd(e,t,l,n,s){if(e===null){var i=l.type;return typeof i=="function"&&!ei(i)&&i.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=i,yd(e,t,i,n,s)):(e=js(l.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!Ji(e,s)){var d=i.memoizedProps;if(l=l.compare,l=l!==null?l:Nn,l(d,n)&&e.ref===t.ref)return jl(e,t,s)}return t.flags|=1,e=ml(i,n),e.ref=t.ref,e.return=t,t.child=e}function yd(e,t,l,n,s){if(e!==null){var i=e.memoizedProps;if(Nn(i,n)&&e.ref===t.ref)if(ot=!1,t.pendingProps=n=i,Ji(e,s))(e.flags&131072)!==0&&(ot=!0);else return t.lanes=e.lanes,jl(e,t,s)}return Gi(e,t,l,n,s)}function gd(e,t,l,n){var s=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|l:l,e!==null){for(n=t.child=e.child,s=0;n!==null;)s=s|n.lanes|n.childLanes,n=n.sibling;n=s&~i}else n=0,t.child=null;return bd(e,t,i,l,n)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ks(t,i!==null?i.cachePool:null),i!==null?Su(t,i):yi(),Nu(t);else return n=t.lanes=536870912,bd(e,t,i!==null?i.baseLanes|l:l,l,n)}else i!==null?(ks(t,i.cachePool),Su(t,i),Gl(),t.memoizedState=null):(e!==null&&ks(t,null),yi(),Gl());return gt(e,t,s,l),t.child}function Hn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function bd(e,t,l,n,s){var i=fi();return i=i===null?null:{parent:rt._currentValue,pool:i},t.memoizedState={baseLanes:l,cachePool:i},e!==null&&ks(t,null),yi(),Nu(t),e!==null&&Ga(e,t,n,!0),t.childLanes=s,null}function Vs(e,t){return t=Ys({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function jd(e,t,l){return ya(t,e.child,null,l),e=Vs(t,t.pendingProps),e.flags|=2,qt(t),t.memoizedState=null,e}function dm(e,t,l){var n=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(we){if(n.mode==="hidden")return e=Vs(t,n),t.lanes=536870912,Hn(null,e);if(bi(t),(e=Ke)?(e=Lf(e,Ft),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ll!==null?{id:ol,overflow:cl}:null,retryLane:536870912,hydrationErrors:null},l=nu(e),l.return=t,t.child=l,vt=t,Ke=null)):e=null,e===null)throw Ol(t);return t.lanes=536870912,null}return Vs(t,n)}var i=e.memoizedState;if(i!==null){var d=i.dehydrated;if(bi(t),s)if(t.flags&256)t.flags&=-257,t=jd(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(u(558));else if(ot||Ga(e,t,l,!1),s=(l&e.childLanes)!==0,ot||s){if(n=Ge,n!==null&&(d=dc(n,l),d!==0&&d!==i.retryLane))throw i.retryLane=d,ua(e,d),zt(n,e,d),Vi;Is(),t=jd(e,t,l)}else e=i.treeContext,Ke=Pt(d.nextSibling),vt=t,we=!0,Dl=null,Ft=!1,e!==null&&iu(t,e),t=Vs(t,n),t.flags|=4096;return t}return e=ml(e.child,{mode:n.mode,children:n.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Gs(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(u(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Gi(e,t,l,n,s){return pa(t),l=Si(e,t,l,n,void 0,s),n=Ni(),e!==null&&!ot?(Ei(e,t,s),jl(e,t,s)):(we&&n&&ai(t),t.flags|=1,gt(e,t,l,s),t.child)}function Sd(e,t,l,n,s,i){return pa(t),t.updateQueue=null,l=ku(t,n,l,s),Eu(e),n=Ni(),e!==null&&!ot?(Ei(e,t,i),jl(e,t,i)):(we&&n&&ai(t),t.flags|=1,gt(e,t,l,i),t.child)}function Nd(e,t,l,n,s){if(pa(t),t.stateNode===null){var i=Ha,d=l.contextType;typeof d=="object"&&d!==null&&(i=yt(d)),i=new l(n,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Ui,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=n,i.state=t.memoizedState,i.refs={},pi(t),d=l.contextType,i.context=typeof d=="object"&&d!==null?yt(d):Ha,i.state=t.memoizedState,d=l.getDerivedStateFromProps,typeof d=="function"&&(Hi(t,l,d,n),i.state=t.memoizedState),typeof l.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&&Ui.enqueueReplaceState(i,i.state,null),zn(t,n,i,s),Mn(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(e===null){i=t.stateNode;var h=t.memoizedProps,N=ba(l,h);i.props=N;var R=i.context,U=l.contextType;d=Ha,typeof U=="object"&&U!==null&&(d=yt(U));var Y=l.getDerivedStateFromProps;U=typeof Y=="function"||typeof i.getSnapshotBeforeUpdate=="function",h=t.pendingProps!==h,U||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(h||R!==d)&&cd(t,i,n,d),Hl=!1;var z=t.memoizedState;i.state=z,zn(t,n,i,s),Mn(),R=t.memoizedState,h||z!==R||Hl?(typeof Y=="function"&&(Hi(t,l,Y,n),R=t.memoizedState),(N=Hl||od(t,l,N,n,z,R,d))?(U||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=R),i.props=n,i.state=R,i.context=d,n=N):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{i=t.stateNode,mi(e,t),d=t.memoizedProps,U=ba(l,d),i.props=U,Y=t.pendingProps,z=i.context,R=l.contextType,N=Ha,typeof R=="object"&&R!==null&&(N=yt(R)),h=l.getDerivedStateFromProps,(R=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(d!==Y||z!==N)&&cd(t,i,n,N),Hl=!1,z=t.memoizedState,i.state=z,zn(t,n,i,s),Mn();var H=t.memoizedState;d!==Y||z!==H||Hl||e!==null&&e.dependencies!==null&&Ns(e.dependencies)?(typeof h=="function"&&(Hi(t,l,h,n),H=t.memoizedState),(U=Hl||od(t,l,U,n,z,H,N)||e!==null&&e.dependencies!==null&&Ns(e.dependencies))?(R||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(n,H,N),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(n,H,N)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=H),i.props=n,i.state=H,i.context=N,n=U):(typeof i.componentDidUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),n=!1)}return i=n,Gs(e,t),n=(t.flags&128)!==0,i||n?(i=t.stateNode,l=n&&typeof l.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&n?(t.child=ya(t,e.child,null,s),t.child=ya(t,null,l,s)):gt(e,t,l,s),t.memoizedState=i.state,e=t.child):e=jl(e,t,s),e}function Ed(e,t,l,n){return fa(),t.flags|=256,gt(e,t,l,n),t.child}var Yi={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qi(e){return{baseLanes:e,cachePool:xu()}}function Xi(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=Gt),e}function kd(e,t,l){var n=t.pendingProps,s=!1,i=(t.flags&128)!==0,d;if((d=i)||(d=e!==null&&e.memoizedState===null?!1:(tt.current&2)!==0),d&&(s=!0,t.flags&=-129),d=(t.flags&32)!==0,t.flags&=-33,e===null){if(we){if(s?Vl(t):Gl(),(e=Ke)?(e=Lf(e,Ft),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ll!==null?{id:ol,overflow:cl}:null,retryLane:536870912,hydrationErrors:null},l=nu(e),l.return=t,t.child=l,vt=t,Ke=null)):e=null,e===null)throw Ol(t);return wo(e)?t.lanes=32:t.lanes=536870912,null}var h=n.children;return n=n.fallback,s?(Gl(),s=t.mode,h=Ys({mode:"hidden",children:h},s),n=da(n,s,l,null),h.return=t,n.return=t,h.sibling=n,t.child=h,n=t.child,n.memoizedState=Qi(l),n.childLanes=Xi(e,d,l),t.memoizedState=Yi,Hn(null,n)):(Vl(t),Ki(t,h))}var N=e.memoizedState;if(N!==null&&(h=N.dehydrated,h!==null)){if(i)t.flags&256?(Vl(t),t.flags&=-257,t=$i(e,t,l)):t.memoizedState!==null?(Gl(),t.child=e.child,t.flags|=128,t=null):(Gl(),h=n.fallback,s=t.mode,n=Ys({mode:"visible",children:n.children},s),h=da(h,s,l,null),h.flags|=2,n.return=t,h.return=t,n.sibling=h,t.child=n,ya(t,e.child,null,l),n=t.child,n.memoizedState=Qi(l),n.childLanes=Xi(e,d,l),t.memoizedState=Yi,t=Hn(null,n));else if(Vl(t),wo(h)){if(d=h.nextSibling&&h.nextSibling.dataset,d)var R=d.dgst;d=R,n=Error(u(419)),n.stack="",n.digest=d,Cn({value:n,source:null,stack:null}),t=$i(e,t,l)}else if(ot||Ga(e,t,l,!1),d=(l&e.childLanes)!==0,ot||d){if(d=Ge,d!==null&&(n=dc(d,l),n!==0&&n!==N.retryLane))throw N.retryLane=n,ua(e,n),zt(d,e,n),Vi;To(h)||Is(),t=$i(e,t,l)}else To(h)?(t.flags|=192,t.child=e.child,t=null):(e=N.treeContext,Ke=Pt(h.nextSibling),vt=t,we=!0,Dl=null,Ft=!1,e!==null&&iu(t,e),t=Ki(t,n.children),t.flags|=4096);return t}return s?(Gl(),h=n.fallback,s=t.mode,N=e.child,R=N.sibling,n=ml(N,{mode:"hidden",children:n.children}),n.subtreeFlags=N.subtreeFlags&65011712,R!==null?h=ml(R,h):(h=da(h,s,l,null),h.flags|=2),h.return=t,n.return=t,n.sibling=h,t.child=n,Hn(null,n),n=t.child,h=e.child.memoizedState,h===null?h=Qi(l):(s=h.cachePool,s!==null?(N=rt._currentValue,s=s.parent!==N?{parent:N,pool:N}:s):s=xu(),h={baseLanes:h.baseLanes|l,cachePool:s}),n.memoizedState=h,n.childLanes=Xi(e,d,l),t.memoizedState=Yi,Hn(e.child,n)):(Vl(t),l=e.child,e=l.sibling,l=ml(l,{mode:"visible",children:n.children}),l.return=t,l.sibling=null,e!==null&&(d=t.deletions,d===null?(t.deletions=[e],t.flags|=16):d.push(e)),t.child=l,t.memoizedState=null,l)}function Ki(e,t){return t=Ys({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ys(e,t){return e=Ht(22,e,null,t),e.lanes=0,e}function $i(e,t,l){return ya(t,e.child,null,l),e=Ki(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Cd(e,t,l){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),oi(e.return,t,l)}function Zi(e,t,l,n,s,i){var d=e.memoizedState;d===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:l,tailMode:s,treeForkCount:i}:(d.isBackwards=t,d.rendering=null,d.renderingStartTime=0,d.last=n,d.tail=l,d.tailMode=s,d.treeForkCount=i)}function Td(e,t,l){var n=t.pendingProps,s=n.revealOrder,i=n.tail;n=n.children;var d=tt.current,h=(d&2)!==0;if(h?(d=d&1|2,t.flags|=128):d&=1,W(tt,d),gt(e,t,n,l),n=we?kn:0,!h&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cd(e,l,t);else if(e.tag===19)Cd(e,l,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(s){case"forwards":for(l=t.child,s=null;l!==null;)e=l.alternate,e!==null&&_s(e)===null&&(s=l),l=l.sibling;l=s,l===null?(s=t.child,t.child=null):(s=l.sibling,l.sibling=null),Zi(t,!1,s,l,i,n);break;case"backwards":case"unstable_legacy-backwards":for(l=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&_s(e)===null){t.child=s;break}e=s.sibling,s.sibling=l,l=s,s=e}Zi(t,!0,l,null,i,n);break;case"together":Zi(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function jl(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Xl|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Ga(e,t,l,!1),(l&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,l=ml(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=ml(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Ji(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ns(e)))}function fm(e,t,l){switch(t.tag){case 3:Be(t,t.stateNode.containerInfo),Bl(t,rt,e.memoizedState.cache),fa();break;case 27:case 5:pt(t);break;case 4:Be(t,t.stateNode.containerInfo);break;case 10:Bl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,bi(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(Vl(t),t.flags|=128,null):(l&t.child.childLanes)!==0?kd(e,t,l):(Vl(t),e=jl(e,t,l),e!==null?e.sibling:null);Vl(t);break;case 19:var s=(e.flags&128)!==0;if(n=(l&t.childLanes)!==0,n||(Ga(e,t,l,!1),n=(l&t.childLanes)!==0),s){if(n)return Td(e,t,l);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),W(tt,tt.current),n)break;return null;case 22:return t.lanes=0,gd(e,t,l,t.pendingProps);case 24:Bl(t,rt,e.memoizedState.cache)}return jl(e,t,l)}function wd(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)ot=!0;else{if(!Ji(e,l)&&(t.flags&128)===0)return ot=!1,fm(e,t,l);ot=(e.flags&131072)!==0}else ot=!1,we&&(t.flags&1048576)!==0&&ru(t,kn,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=ha(t.elementType),t.type=e,typeof e=="function")ei(e)?(n=ba(e,n),t.tag=1,t=Nd(null,t,e,n,l)):(t.tag=0,t=Gi(null,t,e,n,l));else{if(e!=null){var s=e.$$typeof;if(s===K){t.tag=11,t=hd(null,t,e,n,l);break e}else if(s===X){t.tag=14,t=vd(null,t,e,n,l);break e}}throw t=le(e)||e,Error(u(306,t,""))}}return t;case 0:return Gi(e,t,t.type,t.pendingProps,l);case 1:return n=t.type,s=ba(n,t.pendingProps),Nd(e,t,n,s,l);case 3:e:{if(Be(t,t.stateNode.containerInfo),e===null)throw Error(u(387));n=t.pendingProps;var i=t.memoizedState;s=i.element,mi(e,t),zn(t,n,null,l);var d=t.memoizedState;if(n=d.cache,Bl(t,rt,n),n!==i.cache&&ci(t,[rt],l,!0),Mn(),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=Ed(e,t,n,l);break e}else if(n!==s){s=Zt(Error(u(424)),t),Cn(s),t=Ed(e,t,n,l);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(Ke=Pt(e.firstChild),vt=t,we=!0,Dl=null,Ft=!0,l=gu(t,null,n,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(fa(),n===s){t=jl(e,t,l);break e}gt(e,t,n,l)}t=t.child}return t;case 26:return Gs(e,t),e===null?(l=qf(t.type,null,t.pendingProps,null))?t.memoizedState=l:we||(l=t.type,e=t.pendingProps,n=sr(fe.current).createElement(l),n[ht]=t,n[Tt]=e,bt(n,l,e),ft(n),t.stateNode=n):t.memoizedState=qf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pt(t),e===null&&we&&(n=t.stateNode=Bf(t.type,t.pendingProps,fe.current),vt=t,Ft=!0,s=Ke,Wl(t.type)?(Ao=s,Ke=Pt(n.firstChild)):Ke=s),gt(e,t,t.pendingProps.children,l),Gs(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&we&&((s=n=Ke)&&(n=Gm(n,t.type,t.pendingProps,Ft),n!==null?(t.stateNode=n,vt=t,Ke=Pt(n.firstChild),Ft=!1,s=!0):s=!1),s||Ol(t)),pt(t),s=t.type,i=t.pendingProps,d=e!==null?e.memoizedProps:null,n=i.children,Eo(s,i)?n=null:d!==null&&Eo(s,d)&&(t.flags|=32),t.memoizedState!==null&&(s=Si(e,t,am,null,null,l),Pn._currentValue=s),Gs(e,t),gt(e,t,n,l),t.child;case 6:return e===null&&we&&((e=l=Ke)&&(l=Ym(l,t.pendingProps,Ft),l!==null?(t.stateNode=l,vt=t,Ke=null,e=!0):e=!1),e||Ol(t)),null;case 13:return kd(e,t,l);case 4:return Be(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=ya(t,null,n,l):gt(e,t,n,l),t.child;case 11:return hd(e,t,t.type,t.pendingProps,l);case 7:return gt(e,t,t.pendingProps,l),t.child;case 8:return gt(e,t,t.pendingProps.children,l),t.child;case 12:return gt(e,t,t.pendingProps.children,l),t.child;case 10:return n=t.pendingProps,Bl(t,t.type,n.value),gt(e,t,n.children,l),t.child;case 9:return s=t.type._context,n=t.pendingProps.children,pa(t),s=yt(s),n=n(s),t.flags|=1,gt(e,t,n,l),t.child;case 14:return vd(e,t,t.type,t.pendingProps,l);case 15:return yd(e,t,t.type,t.pendingProps,l);case 19:return Td(e,t,l);case 31:return dm(e,t,l);case 22:return gd(e,t,l,t.pendingProps);case 24:return pa(t),n=yt(rt),e===null?(s=fi(),s===null&&(s=Ge,i=ui(),s.pooledCache=i,i.refCount++,i!==null&&(s.pooledCacheLanes|=l),s=i),t.memoizedState={parent:n,cache:s},pi(t),Bl(t,rt,s)):((e.lanes&l)!==0&&(mi(e,t),zn(t,null,null,l),Mn()),s=e.memoizedState,i=t.memoizedState,s.parent!==n?(s={parent:n,cache:n},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),Bl(t,rt,n)):(n=i.cache,Bl(t,rt,n),n!==s.cache&&ci(t,[rt],l,!0))),gt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function Sl(e){e.flags|=4}function Wi(e,t,l,n,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(tf())e.flags|=8192;else throw va=Ts,xi}else e.flags&=-16777217}function Ad(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Xf(t))if(tf())e.flags|=8192;else throw va=Ts,xi}function Qs(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?oc():536870912,e.lanes|=t,en|=t)}function Un(e,t){if(!we)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var n=null;l!==null;)l.alternate!==null&&(n=l),l=l.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function $e(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,n=0;if(t)for(var s=e.child;s!==null;)l|=s.lanes|s.childLanes,n|=s.subtreeFlags&65011712,n|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)l|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=l,t}function xm(e,t,l){var n=t.pendingProps;switch(ni(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $e(t),null;case 1:return $e(t),null;case 3:return l=t.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),yl(rt),Re(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Va(t)?Sl(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,ri())),$e(t),null;case 26:var s=t.type,i=t.memoizedState;return e===null?(Sl(t),i!==null?($e(t),Ad(t,i)):($e(t),Wi(t,s,null,n,l))):i?i!==e.memoizedState?(Sl(t),$e(t),Ad(t,i)):($e(t),t.flags&=-16777217):(e=e.memoizedProps,e!==n&&Sl(t),$e(t),Wi(t,s,e,n,l)),null;case 27:if(Lt(t),l=fe.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&Sl(t);else{if(!n){if(t.stateNode===null)throw Error(u(166));return $e(t),null}e=ne.current,Va(t)?ou(t):(e=Bf(s,n,l),t.stateNode=e,Sl(t))}return $e(t),null;case 5:if(Lt(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&Sl(t);else{if(!n){if(t.stateNode===null)throw Error(u(166));return $e(t),null}if(i=ne.current,Va(t))ou(t);else{var d=sr(fe.current);switch(i){case 1:i=d.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:i=d.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":i=d.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":i=d.createElementNS("http://www.w3.org/1998/Math/MathML",s);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(s,{is:n.is}):d.createElement(s)}}i[ht]=t,i[Tt]=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(bt(i,s,n),s){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&Sl(t)}}return $e(t),Wi(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&Sl(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(u(166));if(e=fe.current,Va(t)){if(e=t.stateNode,l=t.memoizedProps,n=null,s=vt,s!==null)switch(s.tag){case 27:case 5:n=s.memoizedProps}e[ht]=t,e=!!(e.nodeValue===l||n!==null&&n.suppressHydrationWarning===!0||Cf(e.nodeValue,l)),e||Ol(t,!0)}else e=sr(e).createTextNode(n),e[ht]=t,t.stateNode=e}return $e(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(n=Va(t),l!==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[ht]=t}else fa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;$e(t),e=!1}else l=ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(qt(t),t):(qt(t),null);if((t.flags&128)!==0)throw Error(u(558))}return $e(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Va(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(u(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(u(317));s[ht]=t}else fa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;$e(t),s=!1}else s=ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(qt(t),t):(qt(t),null)}return qt(t),(t.flags&128)!==0?(t.lanes=l,t):(l=n!==null,e=e!==null&&e.memoizedState!==null,l&&(n=t.child,s=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(s=n.alternate.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==s&&(n.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),Qs(t,t.updateQueue),$e(t),null);case 4:return Re(),e===null&&go(t.stateNode.containerInfo),$e(t),null;case 10:return yl(t.type),$e(t),null;case 19:if(D(tt),n=t.memoizedState,n===null)return $e(t),null;if(s=(t.flags&128)!==0,i=n.rendering,i===null)if(s)Un(n,!1);else{if(Pe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=_s(e),i!==null){for(t.flags|=128,Un(n,!1),e=i.updateQueue,t.updateQueue=e,Qs(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)au(l,e),l=l.sibling;return W(tt,tt.current&1|2),we&&hl(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&We()>Js&&(t.flags|=128,s=!0,Un(n,!1),t.lanes=4194304)}else{if(!s)if(e=_s(i),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Qs(t,e),Un(n,!0),n.tail===null&&n.tailMode==="hidden"&&!i.alternate&&!we)return $e(t),null}else 2*We()-n.renderingStartTime>Js&&l!==536870912&&(t.flags|=128,s=!0,Un(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=We(),e.sibling=null,l=tt.current,W(tt,s?l&1|2:l&1),we&&hl(t,n.treeForkCount),e):($e(t),null);case 22:case 23:return qt(t),gi(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(l&536870912)!==0&&(t.flags&128)===0&&($e(t),t.subtreeFlags&6&&(t.flags|=8192)):$e(t),l=t.updateQueue,l!==null&&Qs(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==l&&(t.flags|=2048),e!==null&&D(ma),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),yl(rt),$e(t),null;case 25:return null;case 30:return null}throw Error(u(156,t.tag))}function pm(e,t){switch(ni(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yl(rt),Re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Lt(t),null;case 31:if(t.memoizedState!==null){if(qt(t),t.alternate===null)throw Error(u(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(qt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return D(tt),null;case 4:return Re(),null;case 10:return yl(t.type),null;case 22:case 23:return qt(t),gi(),e!==null&&D(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return yl(rt),null;case 25:return null;default:return null}}function Rd(e,t){switch(ni(t),t.tag){case 3:yl(rt),Re();break;case 26:case 27:case 5:Lt(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&qt(t);break;case 13:qt(t);break;case 19:D(tt);break;case 10:yl(t.type);break;case 22:case 23:qt(t),gi(),e!==null&&D(ma);break;case 24:yl(rt)}}function qn(e,t){try{var l=t.updateQueue,n=l!==null?l.lastEffect:null;if(n!==null){var s=n.next;l=s;do{if((l.tag&e)===e){n=void 0;var i=l.create,d=l.inst;n=i(),d.destroy=n}l=l.next}while(l!==s)}}catch(h){Oe(t,t.return,h)}}function Yl(e,t,l){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var i=s.next;n=i;do{if((n.tag&e)===e){var d=n.inst,h=d.destroy;if(h!==void 0){d.destroy=void 0,s=t;var N=l,R=h;try{R()}catch(U){Oe(s,N,U)}}}n=n.next}while(n!==i)}}catch(U){Oe(t,t.return,U)}}function _d(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{ju(t,l)}catch(n){Oe(e,e.return,n)}}}function Md(e,t,l){l.props=ba(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(n){Oe(e,t,n)}}function Vn(e,t){try{var l=e.ref;if(l!==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 l=="function"?e.refCleanup=l(n):l.current=n}}catch(s){Oe(e,t,s)}}function ul(e,t){var l=e.ref,n=e.refCleanup;if(l!==null)if(typeof n=="function")try{n()}catch(s){Oe(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(s){Oe(e,t,s)}else l.current=null}function zd(e){var t=e.type,l=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break e;case"img":l.src?n.src=l.src:l.srcSet&&(n.srcset=l.srcSet)}}catch(s){Oe(e,e.return,s)}}function Fi(e,t,l){try{var n=e.stateNode;Om(n,e.type,l,t),n[Tt]=t}catch(s){Oe(e,e.return,s)}}function Ld(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Wl(e.type)||e.tag===4}function Ii(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ld(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&&Wl(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 Pi(e,t,l){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=xl));else if(n!==4&&(n===27&&Wl(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Pi(e,t,l),e=e.sibling;e!==null;)Pi(e,t,l),e=e.sibling}function Xs(e,t,l){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(n!==4&&(n===27&&Wl(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Xs(e,t,l),e=e.sibling;e!==null;)Xs(e,t,l),e=e.sibling}function Dd(e){var t=e.stateNode,l=e.memoizedProps;try{for(var n=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);bt(t,n,l),t[ht]=e,t[Tt]=l}catch(i){Oe(e,e.return,i)}}var Nl=!1,ct=!1,eo=!1,Od=typeof WeakSet=="function"?WeakSet:Set,xt=null;function mm(e,t){if(e=e.containerInfo,So=fr,e=Zc(e),$r(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var n=l.getSelection&&l.getSelection();if(n&&n.rangeCount!==0){l=n.anchorNode;var s=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{l.nodeType,i.nodeType}catch{l=null;break e}var d=0,h=-1,N=-1,R=0,U=0,Y=e,z=null;t:for(;;){for(var H;Y!==l||s!==0&&Y.nodeType!==3||(h=d+s),Y!==i||n!==0&&Y.nodeType!==3||(N=d+n),Y.nodeType===3&&(d+=Y.nodeValue.length),(H=Y.firstChild)!==null;)z=Y,Y=H;for(;;){if(Y===e)break t;if(z===l&&++R===s&&(h=d),z===i&&++U===n&&(N=d),(H=Y.nextSibling)!==null)break;Y=z,z=Y.parentNode}Y=H}l=h===-1||N===-1?null:{start:h,end:N}}else l=null}l=l||{start:0,end:0}}else l=null;for(No={focusedElem:e,selectionRange:l},fr=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,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(l=0;l<e.length;l++)s=e[l],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&i!==null){e=void 0,l=t,s=i.memoizedProps,i=i.memoizedState,n=l.stateNode;try{var ce=ba(l.type,s);e=n.getSnapshotBeforeUpdate(ce,i),n.__reactInternalSnapshotBeforeUpdate=e}catch(ye){Oe(l,l.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Co(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Co(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,xt=e;break}xt=t.return}}function Bd(e,t,l){var n=l.flags;switch(l.tag){case 0:case 11:case 15:kl(e,l),n&4&&qn(5,l);break;case 1:if(kl(e,l),n&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(d){Oe(l,l.return,d)}else{var s=ba(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(d){Oe(l,l.return,d)}}n&64&&_d(l),n&512&&Vn(l,l.return);break;case 3:if(kl(e,l),n&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{ju(e,t)}catch(d){Oe(l,l.return,d)}}break;case 27:t===null&&n&4&&Dd(l);case 26:case 5:kl(e,l),t===null&&n&4&&zd(l),n&512&&Vn(l,l.return);break;case 12:kl(e,l);break;case 31:kl(e,l),n&4&&qd(e,l);break;case 13:kl(e,l),n&4&&Vd(e,l),n&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Em.bind(null,l),Qm(e,l))));break;case 22:if(n=l.memoizedState!==null||Nl,!n){t=t!==null&&t.memoizedState!==null||ct,s=Nl;var i=ct;Nl=n,(ct=t)&&!i?Cl(e,l,(l.subtreeFlags&8772)!==0):kl(e,l),Nl=s,ct=i}break;case 30:break;default:kl(e,l)}}function Hd(e){var t=e.alternate;t!==null&&(e.alternate=null,Hd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Rr(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,At=!1;function El(e,t,l){for(l=l.child;l!==null;)Ud(e,t,l),l=l.sibling}function Ud(e,t,l){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(kt,l)}catch{}switch(l.tag){case 26:ct||ul(l,t),El(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:ct||ul(l,t);var n=Ze,s=At;Wl(l.type)&&(Ze=l.stateNode,At=!1),El(e,t,l),Wn(l.stateNode),Ze=n,At=s;break;case 5:ct||ul(l,t);case 6:if(n=Ze,s=At,Ze=null,El(e,t,l),Ze=n,At=s,Ze!==null)if(At)try{(Ze.nodeType===9?Ze.body:Ze.nodeName==="HTML"?Ze.ownerDocument.body:Ze).removeChild(l.stateNode)}catch(i){Oe(l,t,i)}else try{Ze.removeChild(l.stateNode)}catch(i){Oe(l,t,i)}break;case 18:Ze!==null&&(At?(e=Ze,Mf(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),cn(e)):Mf(Ze,l.stateNode));break;case 4:n=Ze,s=At,Ze=l.stateNode.containerInfo,At=!0,El(e,t,l),Ze=n,At=s;break;case 0:case 11:case 14:case 15:Yl(2,l,t),ct||Yl(4,l,t),El(e,t,l);break;case 1:ct||(ul(l,t),n=l.stateNode,typeof n.componentWillUnmount=="function"&&Md(l,t,n)),El(e,t,l);break;case 21:El(e,t,l);break;case 22:ct=(n=ct)||l.memoizedState!==null,El(e,t,l),ct=n;break;default:El(e,t,l)}}function qd(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{cn(e)}catch(l){Oe(t,t.return,l)}}}function Vd(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{cn(e)}catch(l){Oe(t,t.return,l)}}function hm(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Od),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Od),t;default:throw Error(u(435,e.tag))}}function Ks(e,t){var l=hm(e);t.forEach(function(n){if(!l.has(n)){l.add(n);var s=km.bind(null,e,n);n.then(s,s)}})}function Rt(e,t){var l=t.deletions;if(l!==null)for(var n=0;n<l.length;n++){var s=l[n],i=e,d=t,h=d;e:for(;h!==null;){switch(h.tag){case 27:if(Wl(h.type)){Ze=h.stateNode,At=!1;break e}break;case 5:Ze=h.stateNode,At=!1;break e;case 3:case 4:Ze=h.stateNode.containerInfo,At=!0;break e}h=h.return}if(Ze===null)throw Error(u(160));Ud(i,d,s),Ze=null,At=!1,i=s.alternate,i!==null&&(i.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Gd(t,e),t=t.sibling}var rl=null;function Gd(e,t){var l=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Rt(t,e),_t(e),n&4&&(Yl(3,e,e.return),qn(3,e),Yl(5,e,e.return));break;case 1:Rt(t,e),_t(e),n&512&&(ct||l===null||ul(l,l.return)),n&64&&Nl&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?n:l.concat(n))));break;case 26:var s=rl;if(Rt(t,e),_t(e),n&512&&(ct||l===null||ul(l,l.return)),n&4){var i=l!==null?l.memoizedState:null;if(n=e.memoizedState,l===null)if(n===null)if(e.stateNode===null){e:{n=e.type,l=e.memoizedProps,s=s.ownerDocument||s;t:switch(n){case"title":i=s.getElementsByTagName("title")[0],(!i||i[pn]||i[ht]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=s.createElement(n),s.head.insertBefore(i,s.querySelector("head > title"))),bt(i,n,l),i[ht]=e,ft(i),n=i;break e;case"link":var d=Yf("link","href",s).get(n+(l.href||""));if(d){for(var h=0;h<d.length;h++)if(i=d[h],i.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&i.getAttribute("rel")===(l.rel==null?null:l.rel)&&i.getAttribute("title")===(l.title==null?null:l.title)&&i.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){d.splice(h,1);break t}}i=s.createElement(n),bt(i,n,l),s.head.appendChild(i);break;case"meta":if(d=Yf("meta","content",s).get(n+(l.content||""))){for(h=0;h<d.length;h++)if(i=d[h],i.getAttribute("content")===(l.content==null?null:""+l.content)&&i.getAttribute("name")===(l.name==null?null:l.name)&&i.getAttribute("property")===(l.property==null?null:l.property)&&i.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&i.getAttribute("charset")===(l.charSet==null?null:l.charSet)){d.splice(h,1);break t}}i=s.createElement(n),bt(i,n,l),s.head.appendChild(i);break;default:throw Error(u(468,n))}i[ht]=e,ft(i),n=i}e.stateNode=n}else Qf(s,e.type,e.stateNode);else e.stateNode=Gf(s,n,e.memoizedProps);else i!==n?(i===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):i.count--,n===null?Qf(s,e.type,e.stateNode):Gf(s,n,e.memoizedProps)):n===null&&e.stateNode!==null&&Fi(e,e.memoizedProps,l.memoizedProps)}break;case 27:Rt(t,e),_t(e),n&512&&(ct||l===null||ul(l,l.return)),l!==null&&n&4&&Fi(e,e.memoizedProps,l.memoizedProps);break;case 5:if(Rt(t,e),_t(e),n&512&&(ct||l===null||ul(l,l.return)),e.flags&32){s=e.stateNode;try{_a(s,"")}catch(ce){Oe(e,e.return,ce)}}n&4&&e.stateNode!=null&&(s=e.memoizedProps,Fi(e,s,l!==null?l.memoizedProps:s)),n&1024&&(eo=!0);break;case 6:if(Rt(t,e),_t(e),n&4){if(e.stateNode===null)throw Error(u(162));n=e.memoizedProps,l=e.stateNode;try{l.nodeValue=n}catch(ce){Oe(e,e.return,ce)}}break;case 3:if(or=null,s=rl,rl=rr(t.containerInfo),Rt(t,e),rl=s,_t(e),n&4&&l!==null&&l.memoizedState.isDehydrated)try{cn(t.containerInfo)}catch(ce){Oe(e,e.return,ce)}eo&&(eo=!1,Yd(e));break;case 4:n=rl,rl=rr(e.stateNode.containerInfo),Rt(t,e),_t(e),rl=n;break;case 12:Rt(t,e),_t(e);break;case 31:Rt(t,e),_t(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Ks(e,n)));break;case 13:Rt(t,e),_t(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Zs=We()),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Ks(e,n)));break;case 22:s=e.memoizedState!==null;var N=l!==null&&l.memoizedState!==null,R=Nl,U=ct;if(Nl=R||s,ct=U||N,Rt(t,e),ct=U,Nl=R,_t(e),n&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(l===null||N||Nl||ct||ja(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){N=l=t;try{if(i=N.stateNode,s)d=i.style,typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none";else{h=N.stateNode;var Y=N.memoizedProps.style,z=Y!=null&&Y.hasOwnProperty("display")?Y.display:null;h.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(ce){Oe(N,N.return,ce)}}}else if(t.tag===6){if(l===null){N=t;try{N.stateNode.nodeValue=s?"":N.memoizedProps}catch(ce){Oe(N,N.return,ce)}}}else if(t.tag===18){if(l===null){N=t;try{var H=N.stateNode;s?zf(H,!0):zf(N.stateNode,!1)}catch(ce){Oe(N,N.return,ce)}}}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;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}n&4&&(n=e.updateQueue,n!==null&&(l=n.retryQueue,l!==null&&(n.retryQueue=null,Ks(e,l))));break;case 19:Rt(t,e),_t(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Ks(e,n)));break;case 30:break;case 21:break;default:Rt(t,e),_t(e)}}function _t(e){var t=e.flags;if(t&2){try{for(var l,n=e.return;n!==null;){if(Ld(n)){l=n;break}n=n.return}if(l==null)throw Error(u(160));switch(l.tag){case 27:var s=l.stateNode,i=Ii(e);Xs(e,i,s);break;case 5:var d=l.stateNode;l.flags&32&&(_a(d,""),l.flags&=-33);var h=Ii(e);Xs(e,h,d);break;case 3:case 4:var N=l.stateNode.containerInfo,R=Ii(e);Pi(e,R,N);break;default:throw Error(u(161))}}catch(U){Oe(e,e.return,U)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Yd(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Yd(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function kl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Bd(e,t.alternate,t),t=t.sibling}function ja(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Yl(4,t,t.return),ja(t);break;case 1:ul(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Md(t,t.return,l),ja(t);break;case 27:Wn(t.stateNode);case 26:case 5:ul(t,t.return),ja(t);break;case 22:t.memoizedState===null&&ja(t);break;case 30:ja(t);break;default:ja(t)}e=e.sibling}}function Cl(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,s=e,i=t,d=i.flags;switch(i.tag){case 0:case 11:case 15:Cl(s,i,l),qn(4,i);break;case 1:if(Cl(s,i,l),n=i,s=n.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(R){Oe(n,n.return,R)}if(n=i,s=n.updateQueue,s!==null){var h=n.stateNode;try{var N=s.shared.hiddenCallbacks;if(N!==null)for(s.shared.hiddenCallbacks=null,s=0;s<N.length;s++)bu(N[s],h)}catch(R){Oe(n,n.return,R)}}l&&d&64&&_d(i),Vn(i,i.return);break;case 27:Dd(i);case 26:case 5:Cl(s,i,l),l&&n===null&&d&4&&zd(i),Vn(i,i.return);break;case 12:Cl(s,i,l);break;case 31:Cl(s,i,l),l&&d&4&&qd(s,i);break;case 13:Cl(s,i,l),l&&d&4&&Vd(s,i);break;case 22:i.memoizedState===null&&Cl(s,i,l),Vn(i,i.return);break;case 30:break;default:Cl(s,i,l)}t=t.sibling}}function to(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&Tn(l))}function lo(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Tn(e))}function il(e,t,l,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Qd(e,t,l,n),t=t.sibling}function Qd(e,t,l,n){var s=t.flags;switch(t.tag){case 0:case 11:case 15:il(e,t,l,n),s&2048&&qn(9,t);break;case 1:il(e,t,l,n);break;case 3:il(e,t,l,n),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Tn(e)));break;case 12:if(s&2048){il(e,t,l,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(N){Oe(t,t.return,N)}}else il(e,t,l,n);break;case 31:il(e,t,l,n);break;case 13:il(e,t,l,n);break;case 23:break;case 22:i=t.stateNode,d=t.alternate,t.memoizedState!==null?i._visibility&2?il(e,t,l,n):Gn(e,t):i._visibility&2?il(e,t,l,n):(i._visibility|=2,Fa(e,t,l,n,(t.subtreeFlags&10256)!==0||!1)),s&2048&&to(d,t);break;case 24:il(e,t,l,n),s&2048&&lo(t.alternate,t);break;default:il(e,t,l,n)}}function Fa(e,t,l,n,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,d=t,h=l,N=n,R=d.flags;switch(d.tag){case 0:case 11:case 15:Fa(i,d,h,N,s),qn(8,d);break;case 23:break;case 22:var U=d.stateNode;d.memoizedState!==null?U._visibility&2?Fa(i,d,h,N,s):Gn(i,d):(U._visibility|=2,Fa(i,d,h,N,s)),s&&R&2048&&to(d.alternate,d);break;case 24:Fa(i,d,h,N,s),s&&R&2048&&lo(d.alternate,d);break;default:Fa(i,d,h,N,s)}t=t.sibling}}function Gn(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,n=t,s=n.flags;switch(n.tag){case 22:Gn(l,n),s&2048&&to(n.alternate,n);break;case 24:Gn(l,n),s&2048&&lo(n.alternate,n);break;default:Gn(l,n)}t=t.sibling}}var Yn=8192;function Ia(e,t,l){if(e.subtreeFlags&Yn)for(e=e.child;e!==null;)Xd(e,t,l),e=e.sibling}function Xd(e,t,l){switch(e.tag){case 26:Ia(e,t,l),e.flags&Yn&&e.memoizedState!==null&&lh(l,rl,e.memoizedState,e.memoizedProps);break;case 5:Ia(e,t,l);break;case 3:case 4:var n=rl;rl=rr(e.stateNode.containerInfo),Ia(e,t,l),rl=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=Yn,Yn=16777216,Ia(e,t,l),Yn=n):Ia(e,t,l));break;default:Ia(e,t,l)}}function Kd(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 Qn(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var n=t[l];xt=n,Zd(n,e)}Kd(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$d(e),e=e.sibling}function $d(e){switch(e.tag){case 0:case 11:case 15:Qn(e),e.flags&2048&&Yl(9,e,e.return);break;case 3:Qn(e);break;case 12:Qn(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,$s(e)):Qn(e);break;default:Qn(e)}}function $s(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var n=t[l];xt=n,Zd(n,e)}Kd(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Yl(8,t,t.return),$s(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,$s(t));break;default:$s(t)}e=e.sibling}}function Zd(e,t){for(;xt!==null;){var l=xt;switch(l.tag){case 0:case 11:case 15:Yl(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var n=l.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:Tn(l.memoizedState.cache)}if(n=l.child,n!==null)n.return=l,xt=n;else e:for(l=e;xt!==null;){n=xt;var s=n.sibling,i=n.return;if(Hd(n),n===l){xt=null;break e}if(s!==null){s.return=i,xt=s;break e}xt=i}}}var vm={getCacheForType:function(e){var t=yt(rt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return yt(rt).controller.signal}},ym=typeof WeakMap=="function"?WeakMap:Map,Le=0,Ge=null,Ee=null,Ce=0,De=0,Vt=null,Ql=!1,Pa=!1,ao=!1,Tl=0,Pe=0,Xl=0,Sa=0,no=0,Gt=0,en=0,Xn=null,Mt=null,so=!1,Zs=0,Jd=0,Js=1/0,Ws=null,Kl=null,dt=0,$l=null,tn=null,wl=0,ro=0,io=null,Wd=null,Kn=0,oo=null;function Yt(){return(Le&2)!==0&&Ce!==0?Ce&-Ce:E.T!==null?mo():fc()}function Fd(){if(Gt===0)if((Ce&536870912)===0||we){var e=Ve;Ve<<=1,(Ve&3932160)===0&&(Ve=262144),Gt=e}else Gt=536870912;return e=Ut.current,e!==null&&(e.flags|=32),Gt}function zt(e,t,l){(e===Ge&&(De===2||De===9)||e.cancelPendingCommit!==null)&&(ln(e,0),Zl(e,Ce,Gt,!1)),xn(e,l),((Le&2)===0||e!==Ge)&&(e===Ge&&((Le&2)===0&&(Sa|=l),Pe===4&&Zl(e,Ce,Gt,!1)),dl(e))}function Id(e,t,l){if((Le&6)!==0)throw Error(u(327));var n=!l&&(t&127)===0&&(t&e.expiredLanes)===0||fn(e,t),s=n?jm(e,t):uo(e,t,!0),i=n;do{if(s===0){Pa&&!n&&Zl(e,t,0,!1);break}else{if(l=e.current.alternate,i&&!gm(l)){s=uo(e,t,!1),i=!1;continue}if(s===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;s=Xn;var N=h.current.memoizedState.isDehydrated;if(N&&(ln(h,d).flags|=256),d=uo(h,d,!1),d!==2){if(ao&&!N){h.errorRecoveryDisabledLanes|=i,Sa|=i,s=4;break e}i=Mt,Mt=s,i!==null&&(Mt===null?Mt=i:Mt.push.apply(Mt,i))}s=d}if(i=!1,s!==2)continue}}if(s===1){ln(e,0),Zl(e,t,0,!0);break}e:{switch(n=e,i=s,i){case 0:case 1:throw Error(u(345));case 4:if((t&4194048)!==t)break;case 6:Zl(n,t,Gt,!Ql);break e;case 2:Mt=null;break;case 3:case 5:break;default:throw Error(u(329))}if((t&62914560)===t&&(s=Zs+300-We(),10<s)){if(Zl(n,t,Gt,!Ql),Ea(n,0,!0)!==0)break e;wl=t,n.timeoutHandle=Rf(Pd.bind(null,n,l,Mt,Ws,so,t,Gt,Sa,en,Ql,i,"Throttled",-0,0),s);break e}Pd(n,l,Mt,Ws,so,t,Gt,Sa,en,Ql,i,null,-0,0)}}break}while(!0);dl(e)}function Pd(e,t,l,n,s,i,d,h,N,R,U,Y,z,H){if(e.timeoutHandle=-1,Y=t.subtreeFlags,Y&8192||(Y&16785408)===16785408){Y={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xl},Xd(t,i,Y);var ce=(i&62914560)===i?Zs-We():(i&4194048)===i?Jd-We():0;if(ce=ah(Y,ce),ce!==null){wl=i,e.cancelPendingCommit=ce(of.bind(null,e,t,i,l,n,s,d,h,N,U,Y,null,z,H)),Zl(e,i,d,!R);return}}of(e,t,i,l,n,s,d,h,N)}function gm(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var n=0;n<l.length;n++){var s=l[n],i=s.getSnapshot;s=s.value;try{if(!Bt(i(),s))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;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 Zl(e,t,l,n){t&=~no,t&=~Sa,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var s=t;0<s;){var i=31-et(s),d=1<<i;n[i]=-1,s&=~d}l!==0&&cc(e,l,t)}function Fs(){return(Le&6)===0?($n(0),!1):!0}function co(){if(Ee!==null){if(De===0)var e=Ee.return;else e=Ee,vl=xa=null,ki(e),Ka=null,An=0,e=Ee;for(;e!==null;)Rd(e.alternate,e),e=e.return;Ee=null}}function ln(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,Um(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),wl=0,co(),Ge=e,Ee=l=ml(e.current,null),Ce=t,De=0,Vt=null,Ql=!1,Pa=fn(e,t),ao=!1,en=Gt=no=Sa=Xl=Pe=0,Mt=Xn=null,so=!1,(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var s=31-et(n),i=1<<s;t|=e[s],n&=~i}return Tl=t,ys(),l}function ef(e,t){Se=null,E.H=Bn,t===Xa||t===Cs?(t=hu(),De=3):t===xi?(t=hu(),De=4):De=t===Vi?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Vt=t,Ee===null&&(Pe=1,qs(e,Zt(t,e.current)))}function tf(){var e=Ut.current;return e===null?!0:(Ce&4194048)===Ce?It===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?e===It:!1}function lf(){var e=E.H;return E.H=Bn,e===null?Bn:e}function af(){var e=E.A;return E.A=vm,e}function Is(){Pe=4,Ql||(Ce&4194048)!==Ce&&Ut.current!==null||(Pa=!0),(Xl&134217727)===0&&(Sa&134217727)===0||Ge===null||Zl(Ge,Ce,Gt,!1)}function uo(e,t,l){var n=Le;Le|=2;var s=lf(),i=af();(Ge!==e||Ce!==t)&&(Ws=null,ln(e,t)),t=!1;var d=Pe;e:do try{if(De!==0&&Ee!==null){var h=Ee,N=Vt;switch(De){case 8:co(),d=6;break e;case 3:case 2:case 9:case 6:Ut.current===null&&(t=!0);var R=De;if(De=0,Vt=null,an(e,h,N,R),l&&Pa){d=0;break e}break;default:R=De,De=0,Vt=null,an(e,h,N,R)}}bm(),d=Pe;break}catch(U){ef(e,U)}while(!0);return t&&e.shellSuspendCounter++,vl=xa=null,Le=n,E.H=s,E.A=i,Ee===null&&(Ge=null,Ce=0,ys()),d}function bm(){for(;Ee!==null;)nf(Ee)}function jm(e,t){var l=Le;Le|=2;var n=lf(),s=af();Ge!==e||Ce!==t?(Ws=null,Js=We()+500,ln(e,t)):Pa=fn(e,t);e:do try{if(De!==0&&Ee!==null){t=Ee;var i=Vt;t:switch(De){case 1:De=0,Vt=null,an(e,t,i,1);break;case 2:case 9:if(pu(i)){De=0,Vt=null,sf(t);break}t=function(){De!==2&&De!==9||Ge!==e||(De=7),dl(e)},i.then(t,t);break e;case 3:De=7;break e;case 4:De=5;break e;case 7:pu(i)?(De=0,Vt=null,sf(t)):(De=0,Vt=null,an(e,t,i,7));break;case 5:var d=null;switch(Ee.tag){case 26:d=Ee.memoizedState;case 5:case 27:var h=Ee;if(d?Xf(d):h.stateNode.complete){De=0,Vt=null;var N=h.sibling;if(N!==null)Ee=N;else{var R=h.return;R!==null?(Ee=R,Ps(R)):Ee=null}break t}}De=0,Vt=null,an(e,t,i,5);break;case 6:De=0,Vt=null,an(e,t,i,6);break;case 8:co(),Pe=6;break e;default:throw Error(u(462))}}Sm();break}catch(U){ef(e,U)}while(!0);return vl=xa=null,E.H=n,E.A=s,Le=l,Ee!==null?0:(Ge=null,Ce=0,ys(),Pe)}function Sm(){for(;Ee!==null&&!ll();)nf(Ee)}function nf(e){var t=wd(e.alternate,e,Tl);e.memoizedProps=e.pendingProps,t===null?Ps(e):Ee=t}function sf(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Sd(l,t,t.pendingProps,t.type,void 0,Ce);break;case 11:t=Sd(l,t,t.pendingProps,t.type.render,t.ref,Ce);break;case 5:ki(t);default:Rd(l,t),t=Ee=au(t,Tl),t=wd(l,t,Tl)}e.memoizedProps=e.pendingProps,t===null?Ps(e):Ee=t}function an(e,t,l,n){vl=xa=null,ki(t),Ka=null,An=0;var s=t.return;try{if(um(e,s,t,l,Ce)){Pe=1,qs(e,Zt(l,e.current)),Ee=null;return}}catch(i){if(s!==null)throw Ee=s,i;Pe=1,qs(e,Zt(l,e.current)),Ee=null;return}t.flags&32768?(we||n===1?e=!0:Pa||(Ce&536870912)!==0?e=!1:(Ql=e=!0,(n===2||n===9||n===3||n===6)&&(n=Ut.current,n!==null&&n.tag===13&&(n.flags|=16384))),rf(t,e)):Ps(t)}function Ps(e){var t=e;do{if((t.flags&32768)!==0){rf(t,Ql);return}e=t.return;var l=xm(t.alternate,t,Tl);if(l!==null){Ee=l;return}if(t=t.sibling,t!==null){Ee=t;return}Ee=t=e}while(t!==null);Pe===0&&(Pe=5)}function rf(e,t){do{var l=pm(e.alternate,e);if(l!==null){l.flags&=32767,Ee=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Ee=e;return}Ee=e=l}while(e!==null);Pe=6,Ee=null}function of(e,t,l,n,s,i,d,h,N){e.cancelPendingCommit=null;do er();while(dt!==0);if((Le&6)!==0)throw Error(u(327));if(t!==null){if(t===e.current)throw Error(u(177));if(i=t.lanes|t.childLanes,i|=Ir,tp(e,l,i,d,h,N),e===Ge&&(Ee=Ge=null,Ce=0),tn=t,$l=e,wl=l,ro=i,io=s,Wd=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Cm(at,function(){return xf(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=E.T,E.T=null,s=M.p,M.p=2,d=Le,Le|=4;try{mm(e,t,l)}finally{Le=d,M.p=s,E.T=n}}dt=1,cf(),uf(),df()}}function cf(){if(dt===1){dt=0;var e=$l,t=tn,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=E.T,E.T=null;var n=M.p;M.p=2;var s=Le;Le|=4;try{Gd(t,e);var i=No,d=Zc(e.containerInfo),h=i.focusedElem,N=i.selectionRange;if(d!==h&&h&&h.ownerDocument&&$c(h.ownerDocument.documentElement,h)){if(N!==null&&$r(h)){var R=N.start,U=N.end;if(U===void 0&&(U=R),"selectionStart"in h)h.selectionStart=R,h.selectionEnd=Math.min(U,h.value.length);else{var Y=h.ownerDocument||document,z=Y&&Y.defaultView||window;if(z.getSelection){var H=z.getSelection(),ce=h.textContent.length,ye=Math.min(N.start,ce),qe=N.end===void 0?ye:Math.min(N.end,ce);!H.extend&&ye>qe&&(d=qe,qe=ye,ye=d);var T=Kc(h,ye),k=Kc(h,qe);if(T&&k&&(H.rangeCount!==1||H.anchorNode!==T.node||H.anchorOffset!==T.offset||H.focusNode!==k.node||H.focusOffset!==k.offset)){var A=Y.createRange();A.setStart(T.node,T.offset),H.removeAllRanges(),ye>qe?(H.addRange(A),H.extend(k.node,k.offset)):(A.setEnd(k.node,k.offset),H.addRange(A))}}}}for(Y=[],H=h;H=H.parentNode;)H.nodeType===1&&Y.push({element:H,left:H.scrollLeft,top:H.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<Y.length;h++){var V=Y[h];V.element.scrollLeft=V.left,V.element.scrollTop=V.top}}fr=!!So,No=So=null}finally{Le=s,M.p=n,E.T=l}}e.current=t,dt=2}}function uf(){if(dt===2){dt=0;var e=$l,t=tn,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=E.T,E.T=null;var n=M.p;M.p=2;var s=Le;Le|=4;try{Bd(e,t.alternate,t)}finally{Le=s,M.p=n,E.T=l}}dt=3}}function df(){if(dt===4||dt===3){dt=0,Qt();var e=$l,t=tn,l=wl,n=Wd;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,tn=$l=null,ff(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(Kl=null),wr(l),t=t.stateNode,Fe&&typeof Fe.onCommitFiberRoot=="function")try{Fe.onCommitFiberRoot(kt,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=E.T,s=M.p,M.p=2,E.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{E.T=t,M.p=s}}(wl&3)!==0&&er(),dl(e),s=e.pendingLanes,(l&261930)!==0&&(s&42)!==0?e===oo?Kn++:(Kn=0,oo=e):Kn=0,$n(0)}}function ff(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Tn(t)))}function er(){return cf(),uf(),df(),xf()}function xf(){if(dt!==5)return!1;var e=$l,t=ro;ro=0;var l=wr(wl),n=E.T,s=M.p;try{M.p=32>l?32:l,E.T=null,l=io,io=null;var i=$l,d=wl;if(dt=0,tn=$l=null,wl=0,(Le&6)!==0)throw Error(u(331));var h=Le;if(Le|=4,$d(i.current),Qd(i,i.current,d,l),Le=h,$n(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(kt,i)}catch{}return!0}finally{M.p=s,E.T=n,ff(e,t)}}function pf(e,t,l){t=Zt(l,t),t=qi(e.stateNode,t,2),e=ql(e,t,2),e!==null&&(xn(e,2),dl(e))}function Oe(e,t,l){if(e.tag===3)pf(e,e,l);else for(;t!==null;){if(t.tag===3){pf(t,e,l);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Kl===null||!Kl.has(n))){e=Zt(l,e),l=pd(2),n=ql(t,l,2),n!==null&&(md(l,n,t,e),xn(n,2),dl(n));break}}t=t.return}}function fo(e,t,l){var n=e.pingCache;if(n===null){n=e.pingCache=new ym;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(l)||(ao=!0,s.add(l),e=Nm.bind(null,e,t,l),t.then(e,e))}function Nm(e,t,l){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Ge===e&&(Ce&l)===l&&(Pe===4||Pe===3&&(Ce&62914560)===Ce&&300>We()-Zs?(Le&2)===0&&ln(e,0):no|=l,en===Ce&&(en=0)),dl(e)}function mf(e,t){t===0&&(t=oc()),e=ua(e,t),e!==null&&(xn(e,t),dl(e))}function Em(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),mf(e,l)}function km(e,t){var l=0;switch(e.tag){case 31:case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(l=s.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),mf(e,l)}function Cm(e,t){return Dt(e,t)}var tr=null,nn=null,xo=!1,lr=!1,po=!1,Jl=0;function dl(e){e!==nn&&e.next===null&&(nn===null?tr=nn=e:nn=nn.next=e),lr=!0,xo||(xo=!0,wm())}function $n(e,t){if(!po&&lr){po=!0;do for(var l=!1,n=tr;n!==null;){if(e!==0){var s=n.pendingLanes;if(s===0)var i=0;else{var d=n.suspendedLanes,h=n.pingedLanes;i=(1<<31-et(42|e)+1)-1,i&=s&~(d&~h),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(l=!0,gf(n,i))}else i=Ce,i=Ea(n,n===Ge?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(i&3)===0||fn(n,i)||(l=!0,gf(n,i));n=n.next}while(l);po=!1}}function Tm(){hf()}function hf(){lr=xo=!1;var e=0;Jl!==0&&Hm()&&(e=Jl);for(var t=We(),l=null,n=tr;n!==null;){var s=n.next,i=vf(n,t);i===0?(n.next=null,l===null?tr=s:l.next=s,s===null&&(nn=l)):(l=n,(e!==0||(i&3)!==0)&&(lr=!0)),n=s}dt!==0&&dt!==5||$n(e),Jl!==0&&(Jl=0)}function vf(e,t){for(var l=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var d=31-et(i),h=1<<d,N=s[d];N===-1?((h&l)===0||(h&n)!==0)&&(s[d]=ep(h,t)):N<=t&&(e.expiredLanes|=h),i&=~h}if(t=Ge,l=Ce,l=Ea(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,l===0||e===t&&(De===2||De===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&mt(n),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||fn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(n!==null&&mt(n),wr(l)){case 2:case 8:l=ze;break;case 32:l=at;break;case 268435456:l=Rl;break;default:l=at}return n=yf.bind(null,e),l=Dt(l,n),e.callbackPriority=t,e.callbackNode=l,t}return n!==null&&n!==null&&mt(n),e.callbackPriority=2,e.callbackNode=null,2}function yf(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(er()&&e.callbackNode!==l)return null;var n=Ce;return n=Ea(e,e===Ge?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(Id(e,n,t),vf(e,We()),e.callbackNode!=null&&e.callbackNode===l?yf.bind(null,e):null)}function gf(e,t){if(er())return null;Id(e,t,!0)}function wm(){qm(function(){(Le&6)!==0?Dt($,Tm):hf()})}function mo(){if(Jl===0){var e=Ya;e===0&&(e=st,st<<=1,(st&261888)===0&&(st=256)),Jl=e}return Jl}function bf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:us(""+e)}function jf(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function Am(e,t,l,n,s){if(t==="submit"&&l&&l.stateNode===s){var i=bf((s[Tt]||null).action),d=n.submitter;d&&(t=(t=d[Tt]||null)?bf(t.formAction):d.getAttribute("formAction"),t!==null&&(i=t,d=null));var h=new ps("action","action",null,n,s);e.push({event:h,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(Jl!==0){var N=d?jf(s,d):new FormData(s);Li(l,{pending:!0,data:N,method:s.method,action:i},null,N)}}else typeof i=="function"&&(h.preventDefault(),N=d?jf(s,d):new FormData(s),Li(l,{pending:!0,data:N,method:s.method,action:i},i,N))},currentTarget:s}]})}}for(var ho=0;ho<Fr.length;ho++){var vo=Fr[ho],Rm=vo.toLowerCase(),_m=vo[0].toUpperCase()+vo.slice(1);sl(Rm,"on"+_m)}sl(Fc,"onAnimationEnd"),sl(Ic,"onAnimationIteration"),sl(Pc,"onAnimationStart"),sl("dblclick","onDoubleClick"),sl("focusin","onFocus"),sl("focusout","onBlur"),sl($p,"onTransitionRun"),sl(Zp,"onTransitionStart"),sl(Jp,"onTransitionCancel"),sl(eu,"onTransitionEnd"),Aa("onMouseEnter",["mouseout","mouseover"]),Aa("onMouseLeave",["mouseout","mouseover"]),Aa("onPointerEnter",["pointerout","pointerover"]),Aa("onPointerLeave",["pointerout","pointerover"]),ra("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ra("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ra("onBeforeInput",["compositionend","keypress","textInput","paste"]),ra("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ra("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ra("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zn="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(" "),Mm=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Zn));function Sf(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var n=e[l],s=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],N=h.instance,R=h.currentTarget;if(h=h.listener,N!==i&&s.isPropagationStopped())break e;i=h,s.currentTarget=R;try{i(s)}catch(U){vs(U)}s.currentTarget=null,i=N}else for(d=0;d<n.length;d++){if(h=n[d],N=h.instance,R=h.currentTarget,h=h.listener,N!==i&&s.isPropagationStopped())break e;i=h,s.currentTarget=R;try{i(s)}catch(U){vs(U)}s.currentTarget=null,i=N}}}}function ke(e,t){var l=t[Ar];l===void 0&&(l=t[Ar]=new Set);var n=e+"__bubble";l.has(n)||(Nf(t,e,2,!1),l.add(n))}function yo(e,t,l){var n=0;t&&(n|=4),Nf(l,e,n,t)}var ar="_reactListening"+Math.random().toString(36).slice(2);function go(e){if(!e[ar]){e[ar]=!0,mc.forEach(function(l){l!=="selectionchange"&&(Mm.has(l)||yo(l,!1,e),yo(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ar]||(t[ar]=!0,yo("selectionchange",!1,t))}}function Nf(e,t,l,n){switch(If(t)){case 2:var s=rh;break;case 8:s=ih;break;default:s=Lo}l=s.bind(null,t,l,e),s=void 0,!Hr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,l,{capture:!0,passive:s}):e.addEventListener(t,l,!0):s!==void 0?e.addEventListener(t,l,{passive:s}):e.addEventListener(t,l,!1)}function bo(e,t,l,n,s){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===s)break;if(d===4)for(d=n.return;d!==null;){var N=d.tag;if((N===3||N===4)&&d.stateNode.containerInfo===s)return;d=d.return}for(;h!==null;){if(d=Ca(h),d===null)return;if(N=d.tag,N===5||N===6||N===26||N===27){n=i=d;continue e}h=h.parentNode}}n=n.return}Tc(function(){var R=i,U=Or(l),Y=[];e:{var z=tu.get(e);if(z!==void 0){var H=ps,ce=e;switch(e){case"keypress":if(fs(l)===0)break e;case"keydown":case"keyup":H=kp;break;case"focusin":ce="focus",H=Gr;break;case"focusout":ce="blur",H=Gr;break;case"beforeblur":case"afterblur":H=Gr;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":H=Rc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":H=xp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":H=wp;break;case Fc:case Ic:case Pc:H=hp;break;case eu:H=Rp;break;case"scroll":case"scrollend":H=dp;break;case"wheel":H=Mp;break;case"copy":case"cut":case"paste":H=yp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":H=Mc;break;case"toggle":case"beforetoggle":H=Lp}var ye=(t&4)!==0,qe=!ye&&(e==="scroll"||e==="scrollend"),T=ye?z!==null?z+"Capture":null:z;ye=[];for(var k=R,A;k!==null;){var V=k;if(A=V.stateNode,V=V.tag,V!==5&&V!==26&&V!==27||A===null||T===null||(V=hn(k,T),V!=null&&ye.push(Jn(k,V,A))),qe)break;k=k.return}0<ye.length&&(z=new H(z,ce,null,l,U),Y.push({event:z,listeners:ye}))}}if((t&7)===0){e:{if(z=e==="mouseover"||e==="pointerover",H=e==="mouseout"||e==="pointerout",z&&l!==Dr&&(ce=l.relatedTarget||l.fromElement)&&(Ca(ce)||ce[ka]))break e;if((H||z)&&(z=U.window===U?U:(z=U.ownerDocument)?z.defaultView||z.parentWindow:window,H?(ce=l.relatedTarget||l.toElement,H=R,ce=ce?Ca(ce):null,ce!==null&&(qe=v(ce),ye=ce.tag,ce!==qe||ye!==5&&ye!==27&&ye!==6)&&(ce=null)):(H=null,ce=R),H!==ce)){if(ye=Rc,V="onMouseLeave",T="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(ye=Mc,V="onPointerLeave",T="onPointerEnter",k="pointer"),qe=H==null?z:mn(H),A=ce==null?z:mn(ce),z=new ye(V,k+"leave",H,l,U),z.target=qe,z.relatedTarget=A,V=null,Ca(U)===R&&(ye=new ye(T,k+"enter",ce,l,U),ye.target=A,ye.relatedTarget=qe,V=ye),qe=V,H&&ce)t:{for(ye=zm,T=H,k=ce,A=0,V=T;V;V=ye(V))A++;V=0;for(var he=k;he;he=ye(he))V++;for(;0<A-V;)T=ye(T),A--;for(;0<V-A;)k=ye(k),V--;for(;A--;){if(T===k||k!==null&&T===k.alternate){ye=T;break t}T=ye(T),k=ye(k)}ye=null}else ye=null;H!==null&&Ef(Y,z,H,ye,!1),ce!==null&&qe!==null&&Ef(Y,qe,ce,ye,!0)}}e:{if(z=R?mn(R):window,H=z.nodeName&&z.nodeName.toLowerCase(),H==="select"||H==="input"&&z.type==="file")var _e=qc;else if(Hc(z))if(Vc)_e=Qp;else{_e=Gp;var xe=Vp}else H=z.nodeName,!H||H.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?R&&Lr(R.elementType)&&(_e=qc):_e=Yp;if(_e&&(_e=_e(e,R))){Uc(Y,_e,l,U);break e}xe&&xe(e,z,R),e==="focusout"&&R&&z.type==="number"&&R.memoizedProps.value!=null&&zr(z,"number",z.value)}switch(xe=R?mn(R):window,e){case"focusin":(Hc(xe)||xe.contentEditable==="true")&&(Da=xe,Zr=R,En=null);break;case"focusout":En=Zr=Da=null;break;case"mousedown":Jr=!0;break;case"contextmenu":case"mouseup":case"dragend":Jr=!1,Jc(Y,l,U);break;case"selectionchange":if(Kp)break;case"keydown":case"keyup":Jc(Y,l,U)}var Ne;if(Qr)e:{switch(e){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else La?Oc(e,l)&&(Te="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Te="onCompositionStart");Te&&(zc&&l.locale!=="ko"&&(La||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&La&&(Ne=wc()):(zl=U,Ur="value"in zl?zl.value:zl.textContent,La=!0)),xe=nr(R,Te),0<xe.length&&(Te=new _c(Te,e,null,l,U),Y.push({event:Te,listeners:xe}),Ne?Te.data=Ne:(Ne=Bc(l),Ne!==null&&(Te.data=Ne)))),(Ne=Op?Bp(e,l):Hp(e,l))&&(Te=nr(R,"onBeforeInput"),0<Te.length&&(xe=new _c("onBeforeInput","beforeinput",null,l,U),Y.push({event:xe,listeners:Te}),xe.data=Ne)),Am(Y,e,R,l,U)}Sf(Y,t)})}function Jn(e,t,l){return{instance:e,listener:t,currentTarget:l}}function nr(e,t){for(var l=t+"Capture",n=[];e!==null;){var s=e,i=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||i===null||(s=hn(e,l),s!=null&&n.unshift(Jn(e,s,i)),s=hn(e,t),s!=null&&n.push(Jn(e,s,i))),e.tag===3)return n;e=e.return}return[]}function zm(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ef(e,t,l,n,s){for(var i=t._reactName,d=[];l!==null&&l!==n;){var h=l,N=h.alternate,R=h.stateNode;if(h=h.tag,N!==null&&N===n)break;h!==5&&h!==26&&h!==27||R===null||(N=R,s?(R=hn(l,i),R!=null&&d.unshift(Jn(l,R,N))):s||(R=hn(l,i),R!=null&&d.push(Jn(l,R,N)))),l=l.return}d.length!==0&&e.push({event:t,listeners:d})}var Lm=/\r\n?/g,Dm=/\u0000|\uFFFD/g;function kf(e){return(typeof e=="string"?e:""+e).replace(Lm,`
|
|
49
|
-
`).replace(Dm,"")}function Cf(e,t){return t=kf(t),kf(e)===t}function Ue(e,t,l,n,s,i){switch(l){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||_a(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&_a(e,""+n);break;case"className":os(e,"class",n);break;case"tabIndex":os(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":os(e,l,n);break;case"style":kc(e,n,i);break;case"data":if(t!=="object"){os(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(l);break}n=us(""+n),e.setAttribute(l,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(l,"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"&&(l==="formAction"?(t!=="input"&&Ue(e,t,"name",s.name,s,null),Ue(e,t,"formEncType",s.formEncType,s,null),Ue(e,t,"formMethod",s.formMethod,s,null),Ue(e,t,"formTarget",s.formTarget,s,null)):(Ue(e,t,"encType",s.encType,s,null),Ue(e,t,"method",s.method,s,null),Ue(e,t,"target",s.target,s,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(l);break}n=us(""+n),e.setAttribute(l,n);break;case"onClick":n!=null&&(e.onclick=xl);break;case"onScroll":n!=null&&ke("scroll",e);break;case"onScrollEnd":n!=null&&ke("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(u(61));if(l=n.__html,l!=null){if(s.children!=null)throw Error(u(60));e.innerHTML=l}}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}l=us(""+n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);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(l,""+n):e.removeAttribute(l);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(l,""):e.removeAttribute(l);break;case"capture":case"download":n===!0?e.setAttribute(l,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,n):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(l,n):e.removeAttribute(l);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(l):e.setAttribute(l,n);break;case"popover":ke("beforetoggle",e),ke("toggle",e),is(e,"popover",n);break;case"xlinkActuate":fl(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":fl(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":fl(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":fl(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":fl(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":fl(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":fl(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":fl(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":fl(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":is(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=cp.get(l)||l,is(e,l,n))}}function jo(e,t,l,n,s,i){switch(l){case"style":kc(e,n,i);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(u(61));if(l=n.__html,l!=null){if(s.children!=null)throw Error(u(60));e.innerHTML=l}}break;case"children":typeof n=="string"?_a(e,n):(typeof n=="number"||typeof n=="bigint")&&_a(e,""+n);break;case"onScroll":n!=null&&ke("scroll",e);break;case"onScrollEnd":n!=null&&ke("scrollend",e);break;case"onClick":n!=null&&(e.onclick=xl);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!hc.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(s=l.endsWith("Capture"),t=l.slice(2,s?l.length-7:void 0),i=e[Tt]||null,i=i!=null?i[l]:null,typeof i=="function"&&e.removeEventListener(t,i,s),typeof n=="function")){typeof i!="function"&&i!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,n,s);break e}l in e?e[l]=n:n===!0?e.setAttribute(l,""):is(e,l,n)}}}function bt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ke("error",e),ke("load",e);var n=!1,s=!1,i;for(i in l)if(l.hasOwnProperty(i)){var d=l[i];if(d!=null)switch(i){case"src":n=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:Ue(e,t,i,d,l,null)}}s&&Ue(e,t,"srcSet",l.srcSet,l,null),n&&Ue(e,t,"src",l.src,l,null);return;case"input":ke("invalid",e);var h=i=d=s=null,N=null,R=null;for(n in l)if(l.hasOwnProperty(n)){var U=l[n];if(U!=null)switch(n){case"name":s=U;break;case"type":d=U;break;case"checked":N=U;break;case"defaultChecked":R=U;break;case"value":i=U;break;case"defaultValue":h=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(u(137,t));break;default:Ue(e,t,n,U,l,null)}}jc(e,i,h,N,R,d,s,!1);return;case"select":ke("invalid",e),n=d=i=null;for(s in l)if(l.hasOwnProperty(s)&&(h=l[s],h!=null))switch(s){case"value":i=h;break;case"defaultValue":d=h;break;case"multiple":n=h;default:Ue(e,t,s,h,l,null)}t=i,l=d,e.multiple=!!n,t!=null?Ra(e,!!n,t,!1):l!=null&&Ra(e,!!n,l,!0);return;case"textarea":ke("invalid",e),i=s=n=null;for(d in l)if(l.hasOwnProperty(d)&&(h=l[d],h!=null))switch(d){case"value":n=h;break;case"defaultValue":s=h;break;case"children":i=h;break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(u(91));break;default:Ue(e,t,d,h,l,null)}Nc(e,n,s,i);return;case"option":for(N in l)if(l.hasOwnProperty(N)&&(n=l[N],n!=null))switch(N){case"selected":e.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:Ue(e,t,N,n,l,null)}return;case"dialog":ke("beforetoggle",e),ke("toggle",e),ke("cancel",e),ke("close",e);break;case"iframe":case"object":ke("load",e);break;case"video":case"audio":for(n=0;n<Zn.length;n++)ke(Zn[n],e);break;case"image":ke("error",e),ke("load",e);break;case"details":ke("toggle",e);break;case"embed":case"source":case"link":ke("error",e),ke("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(R in l)if(l.hasOwnProperty(R)&&(n=l[R],n!=null))switch(R){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:Ue(e,t,R,n,l,null)}return;default:if(Lr(t)){for(U in l)l.hasOwnProperty(U)&&(n=l[U],n!==void 0&&jo(e,t,U,n,l,void 0));return}}for(h in l)l.hasOwnProperty(h)&&(n=l[h],n!=null&&Ue(e,t,h,n,l,null))}function Om(e,t,l,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,i=null,d=null,h=null,N=null,R=null,U=null;for(H in l){var Y=l[H];if(l.hasOwnProperty(H)&&Y!=null)switch(H){case"checked":break;case"value":break;case"defaultValue":N=Y;default:n.hasOwnProperty(H)||Ue(e,t,H,null,n,Y)}}for(var z in n){var H=n[z];if(Y=l[z],n.hasOwnProperty(z)&&(H!=null||Y!=null))switch(z){case"type":i=H;break;case"name":s=H;break;case"checked":R=H;break;case"defaultChecked":U=H;break;case"value":d=H;break;case"defaultValue":h=H;break;case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(u(137,t));break;default:H!==Y&&Ue(e,t,z,H,n,Y)}}Mr(e,d,h,N,R,U,i,s);return;case"select":H=d=h=z=null;for(i in l)if(N=l[i],l.hasOwnProperty(i)&&N!=null)switch(i){case"value":break;case"multiple":H=N;default:n.hasOwnProperty(i)||Ue(e,t,i,null,n,N)}for(s in n)if(i=n[s],N=l[s],n.hasOwnProperty(s)&&(i!=null||N!=null))switch(s){case"value":z=i;break;case"defaultValue":h=i;break;case"multiple":d=i;default:i!==N&&Ue(e,t,s,i,n,N)}t=h,l=d,n=H,z!=null?Ra(e,!!l,z,!1):!!n!=!!l&&(t!=null?Ra(e,!!l,t,!0):Ra(e,!!l,l?[]:"",!1));return;case"textarea":H=z=null;for(h in l)if(s=l[h],l.hasOwnProperty(h)&&s!=null&&!n.hasOwnProperty(h))switch(h){case"value":break;case"children":break;default:Ue(e,t,h,null,n,s)}for(d in n)if(s=n[d],i=l[d],n.hasOwnProperty(d)&&(s!=null||i!=null))switch(d){case"value":z=s;break;case"defaultValue":H=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(u(91));break;default:s!==i&&Ue(e,t,d,s,n,i)}Sc(e,z,H);return;case"option":for(var ce in l)if(z=l[ce],l.hasOwnProperty(ce)&&z!=null&&!n.hasOwnProperty(ce))switch(ce){case"selected":e.selected=!1;break;default:Ue(e,t,ce,null,n,z)}for(N in n)if(z=n[N],H=l[N],n.hasOwnProperty(N)&&z!==H&&(z!=null||H!=null))switch(N){case"selected":e.selected=z&&typeof z!="function"&&typeof z!="symbol";break;default:Ue(e,t,N,z,n,H)}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 ye in l)z=l[ye],l.hasOwnProperty(ye)&&z!=null&&!n.hasOwnProperty(ye)&&Ue(e,t,ye,null,n,z);for(R in n)if(z=n[R],H=l[R],n.hasOwnProperty(R)&&z!==H&&(z!=null||H!=null))switch(R){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(u(137,t));break;default:Ue(e,t,R,z,n,H)}return;default:if(Lr(t)){for(var qe in l)z=l[qe],l.hasOwnProperty(qe)&&z!==void 0&&!n.hasOwnProperty(qe)&&jo(e,t,qe,void 0,n,z);for(U in n)z=n[U],H=l[U],!n.hasOwnProperty(U)||z===H||z===void 0&&H===void 0||jo(e,t,U,z,n,H);return}}for(var T in l)z=l[T],l.hasOwnProperty(T)&&z!=null&&!n.hasOwnProperty(T)&&Ue(e,t,T,null,n,z);for(Y in n)z=n[Y],H=l[Y],!n.hasOwnProperty(Y)||z===H||z==null&&H==null||Ue(e,t,Y,z,n,H)}function Tf(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Bm(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),n=0;n<l.length;n++){var s=l[n],i=s.transferSize,d=s.initiatorType,h=s.duration;if(i&&h&&Tf(d)){for(d=0,h=s.responseEnd,n+=1;n<l.length;n++){var N=l[n],R=N.startTime;if(R>h)break;var U=N.transferSize,Y=N.initiatorType;U&&Tf(Y)&&(N=N.responseEnd,d+=U*(N<h?1:(h-R)/(N-R)))}if(--n,t+=8*(i+d)/(s.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 So=null,No=null;function sr(e){return e.nodeType===9?e:e.ownerDocument}function wf(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 Af(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 Eo(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 ko=null;function Hm(){var e=window.event;return e&&e.type==="popstate"?e===ko?!1:(ko=e,!0):(ko=null,!1)}var Rf=typeof setTimeout=="function"?setTimeout:void 0,Um=typeof clearTimeout=="function"?clearTimeout:void 0,_f=typeof Promise=="function"?Promise:void 0,qm=typeof queueMicrotask=="function"?queueMicrotask:typeof _f<"u"?function(e){return _f.resolve(null).then(e).catch(Vm)}:Rf;function Vm(e){setTimeout(function(){throw e})}function Wl(e){return e==="head"}function Mf(e,t){var l=t,n=0;do{var s=l.nextSibling;if(e.removeChild(l),s&&s.nodeType===8)if(l=s.data,l==="/$"||l==="/&"){if(n===0){e.removeChild(s),cn(t);return}n--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")n++;else if(l==="html")Wn(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,Wn(l);for(var i=l.firstChild;i;){var d=i.nextSibling,h=i.nodeName;i[pn]||h==="SCRIPT"||h==="STYLE"||h==="LINK"&&i.rel.toLowerCase()==="stylesheet"||l.removeChild(i),i=d}}else l==="body"&&Wn(e.ownerDocument.body);l=s}while(l);cn(t)}function zf(e,t){var l=e;e=0;do{var n=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),n&&n.nodeType===8)if(l=n.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=n}while(l)}function Co(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Co(l),Rr(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function Gm(e,t,l,n){for(;e.nodeType===1;){var s=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[pn])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!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=Pt(e.nextSibling),e===null)break}return null}function Ym(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Pt(e.nextSibling),e===null))return null;return e}function Lf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Pt(e.nextSibling),e===null))return null;return e}function To(e){return e.data==="$?"||e.data==="$~"}function wo(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Qm(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var n=function(){t(),l.removeEventListener("DOMContentLoaded",n)};l.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function Pt(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 Ao=null;function Df(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Pt(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function Of(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function Bf(e,t,l){switch(t=sr(l),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 Wn(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Rr(e)}var el=new Map,Hf=new Set;function rr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Al=M.d;M.d={f:Xm,r:Km,D:$m,C:Zm,L:Jm,m:Wm,X:Im,S:Fm,M:Pm};function Xm(){var e=Al.f(),t=Fs();return e||t}function Km(e){var t=Ta(e);t!==null&&t.tag===5&&t.type==="form"?ed(t):Al.r(e)}var sn=typeof document>"u"?null:document;function Uf(e,t,l){var n=sn;if(n&&typeof t=="string"&&t){var s=Kt(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof l=="string"&&(s+='[crossorigin="'+l+'"]'),Hf.has(s)||(Hf.add(s),e={rel:e,crossOrigin:l,href:t},n.querySelector(s)===null&&(t=n.createElement("link"),bt(t,"link",e),ft(t),n.head.appendChild(t)))}}function $m(e){Al.D(e),Uf("dns-prefetch",e,null)}function Zm(e,t){Al.C(e,t),Uf("preconnect",e,t)}function Jm(e,t,l){Al.L(e,t,l);var n=sn;if(n&&e&&t){var s='link[rel="preload"][as="'+Kt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(s+='[imagesrcset="'+Kt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(s+='[imagesizes="'+Kt(l.imageSizes)+'"]')):s+='[href="'+Kt(e)+'"]';var i=s;switch(t){case"style":i=rn(e);break;case"script":i=on(e)}el.has(i)||(e=g({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),el.set(i,e),n.querySelector(s)!==null||t==="style"&&n.querySelector(Fn(i))||t==="script"&&n.querySelector(In(i))||(t=n.createElement("link"),bt(t,"link",e),ft(t),n.head.appendChild(t)))}}function Wm(e,t){Al.m(e,t);var l=sn;if(l&&e){var n=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Kt(n)+'"][href="'+Kt(e)+'"]',i=s;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=on(e)}if(!el.has(i)&&(e=g({rel:"modulepreload",href:e},t),el.set(i,e),l.querySelector(s)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(In(i)))return}n=l.createElement("link"),bt(n,"link",e),ft(n),l.head.appendChild(n)}}}function Fm(e,t,l){Al.S(e,t,l);var n=sn;if(n&&e){var s=wa(n).hoistableStyles,i=rn(e);t=t||"default";var d=s.get(i);if(!d){var h={loading:0,preload:null};if(d=n.querySelector(Fn(i)))h.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},l),(l=el.get(i))&&Ro(e,l);var N=d=n.createElement("link");ft(N),bt(N,"link",e),N._p=new Promise(function(R,U){N.onload=R,N.onerror=U}),N.addEventListener("load",function(){h.loading|=1}),N.addEventListener("error",function(){h.loading|=2}),h.loading|=4,ir(d,t,n)}d={type:"stylesheet",instance:d,count:1,state:h},s.set(i,d)}}}function Im(e,t){Al.X(e,t);var l=sn;if(l&&e){var n=wa(l).hoistableScripts,s=on(e),i=n.get(s);i||(i=l.querySelector(In(s)),i||(e=g({src:e,async:!0},t),(t=el.get(s))&&_o(e,t),i=l.createElement("script"),ft(i),bt(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(s,i))}}function Pm(e,t){Al.M(e,t);var l=sn;if(l&&e){var n=wa(l).hoistableScripts,s=on(e),i=n.get(s);i||(i=l.querySelector(In(s)),i||(e=g({src:e,async:!0,type:"module"},t),(t=el.get(s))&&_o(e,t),i=l.createElement("script"),ft(i),bt(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(s,i))}}function qf(e,t,l,n){var s=(s=fe.current)?rr(s):null;if(!s)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=rn(l.href),l=wa(s).hoistableStyles,n=l.get(t),n||(n={type:"style",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=rn(l.href);var i=wa(s).hoistableStyles,d=i.get(e);if(d||(s=s.ownerDocument||s,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,d),(i=s.querySelector(Fn(e)))&&!i._p&&(d.instance=i,d.state.loading=5),el.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},el.set(e,l),i||eh(s,e,l,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=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=on(l),l=wa(s).hoistableScripts,n=l.get(t),n||(n={type:"script",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function rn(e){return'href="'+Kt(e)+'"'}function Fn(e){return'link[rel="stylesheet"]['+e+"]"}function Vf(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function eh(e,t,l,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}),bt(t,"link",l),ft(t),e.head.appendChild(t))}function on(e){return'[src="'+Kt(e)+'"]'}function In(e){return"script[async]"+e}function Gf(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+Kt(l.href)+'"]');if(n)return t.instance=n,ft(n),n;var s=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),ft(n),bt(n,"style",s),ir(n,l.precedence,e),t.instance=n;case"stylesheet":s=rn(l.href);var i=e.querySelector(Fn(s));if(i)return t.state.loading|=4,t.instance=i,ft(i),i;n=Vf(l),(s=el.get(s))&&Ro(n,s),i=(e.ownerDocument||e).createElement("link"),ft(i);var d=i;return d._p=new Promise(function(h,N){d.onload=h,d.onerror=N}),bt(i,"link",n),t.state.loading|=4,ir(i,l.precedence,e),t.instance=i;case"script":return i=on(l.src),(s=e.querySelector(In(i)))?(t.instance=s,ft(s),s):(n=l,(s=el.get(i))&&(n=g({},l),_o(n,s)),e=e.ownerDocument||e,s=e.createElement("script"),ft(s),bt(s,"link",n),e.head.appendChild(s),t.instance=s);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,ir(n,l.precedence,e));return t.instance}function ir(e,t,l){for(var n=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=n.length?n[n.length-1]:null,i=s,d=0;d<n.length;d++){var h=n[d];if(h.dataset.precedence===t)i=h;else if(i!==s)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Ro(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function _o(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var or=null;function Yf(e,t,l){if(or===null){var n=new Map,s=or=new Map;s.set(l,n)}else s=or,n=s.get(l),n||(n=new Map,s.set(l,n));if(n.has(e))return n;for(n.set(e,null),l=l.getElementsByTagName(e),s=0;s<l.length;s++){var i=l[s];if(!(i[pn]||i[ht]||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 Qf(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function th(e,t,l){if(l===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 Xf(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function lh(e,t,l,n){if(l.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var s=rn(n.href),i=t.querySelector(Fn(s));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=cr.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=i,ft(i);return}i=t.ownerDocument||t,n=Vf(n),(s=el.get(s))&&Ro(n,s),i=i.createElement("link"),ft(i);var d=i;d._p=new Promise(function(h,N){d.onload=h,d.onerror=N}),bt(i,"link",n),l.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=cr.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Mo=0;function ah(e,t){return e.stylesheets&&e.count===0&&dr(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var n=setTimeout(function(){if(e.stylesheets&&dr(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&Mo===0&&(Mo=62500*Bm());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&dr(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>Mo?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(s)}}:null}function cr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)dr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ur=null;function dr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ur=new Map,t.forEach(nh,e),ur=null,cr.call(e))}function nh(e,t){if(!(t.state.loading&4)){var l=ur.get(e);if(l)var n=l.get(null);else{l=new Map,ur.set(e,l);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<s.length;i++){var d=s[i];(d.nodeName==="LINK"||d.getAttribute("media")!=="not all")&&(l.set(d.dataset.precedence,d),n=d)}n&&l.set(null,n)}s=t.instance,d=s.getAttribute("data-precedence"),i=l.get(d)||n,i===n&&l.set(null,s),l.set(d,s),this.count++,n=cr.bind(this),s.addEventListener("load",n),s.addEventListener("error",n),i?i.parentNode.insertBefore(s,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var Pn={$$typeof:ee,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function sh(e,t,l,n,s,i,d,h,N){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=Cr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cr(0),this.hiddenUpdates=Cr(null),this.identifierPrefix=n,this.onUncaughtError=s,this.onCaughtError=i,this.onRecoverableError=d,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Kf(e,t,l,n,s,i,d,h,N,R,U,Y){return e=new sh(e,t,l,d,N,R,U,Y,h),t=1,i===!0&&(t|=24),i=Ht(3,null,null,t),e.current=i,i.stateNode=e,t=ui(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:n,isDehydrated:l,cache:t},pi(i),e}function $f(e){return e?(e=Ha,e):Ha}function Zf(e,t,l,n,s,i){s=$f(s),n.context===null?n.context=s:n.pendingContext=s,n=Ul(t),n.payload={element:l},i=i===void 0?null:i,i!==null&&(n.callback=i),l=ql(e,n,t),l!==null&&(zt(l,e,t),_n(l,e,t))}function Jf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function zo(e,t){Jf(e,t),(e=e.alternate)&&Jf(e,t)}function Wf(e){if(e.tag===13||e.tag===31){var t=ua(e,67108864);t!==null&&zt(t,e,67108864),zo(e,67108864)}}function Ff(e){if(e.tag===13||e.tag===31){var t=Yt();t=Tr(t);var l=ua(e,t);l!==null&&zt(l,e,t),zo(e,t)}}var fr=!0;function rh(e,t,l,n){var s=E.T;E.T=null;var i=M.p;try{M.p=2,Lo(e,t,l,n)}finally{M.p=i,E.T=s}}function ih(e,t,l,n){var s=E.T;E.T=null;var i=M.p;try{M.p=8,Lo(e,t,l,n)}finally{M.p=i,E.T=s}}function Lo(e,t,l,n){if(fr){var s=Do(n);if(s===null)bo(e,t,n,xr,l),Pf(e,n);else if(ch(s,e,t,l,n))n.stopPropagation();else if(Pf(e,n),t&4&&-1<oh.indexOf(e)){for(;s!==null;){var i=Ta(s);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var d=Ct(i.pendingLanes);if(d!==0){var h=i;for(h.pendingLanes|=2,h.entangledLanes|=2;d;){var N=1<<31-et(d);h.entanglements[1]|=N,d&=~N}dl(i),(Le&6)===0&&(Js=We()+500,$n(0))}}break;case 31:case 13:h=ua(i,2),h!==null&&zt(h,i,2),Fs(),zo(i,2)}if(i=Do(n),i===null&&bo(e,t,n,xr,l),i===s)break;s=i}s!==null&&n.stopPropagation()}else bo(e,t,n,null,l)}}function Do(e){return e=Or(e),Oo(e)}var xr=null;function Oo(e){if(xr=null,e=Ca(e),e!==null){var t=v(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=p(t),e!==null)return e;e=null}else if(l===31){if(e=b(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xr=e,null}function If(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(Et()){case $:return 2;case ze:return 8;case at:case Je:return 32;case Rl:return 268435456;default:return 32}default:return 32}}var Bo=!1,Fl=null,Il=null,Pl=null,es=new Map,ts=new Map,ea=[],oh="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 Pf(e,t){switch(e){case"focusin":case"focusout":Fl=null;break;case"dragenter":case"dragleave":Il=null;break;case"mouseover":case"mouseout":Pl=null;break;case"pointerover":case"pointerout":es.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ts.delete(t.pointerId)}}function ls(e,t,l,n,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:l,eventSystemFlags:n,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Ta(t),t!==null&&Wf(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function ch(e,t,l,n,s){switch(t){case"focusin":return Fl=ls(Fl,e,t,l,n,s),!0;case"dragenter":return Il=ls(Il,e,t,l,n,s),!0;case"mouseover":return Pl=ls(Pl,e,t,l,n,s),!0;case"pointerover":var i=s.pointerId;return es.set(i,ls(es.get(i)||null,e,t,l,n,s)),!0;case"gotpointercapture":return i=s.pointerId,ts.set(i,ls(ts.get(i)||null,e,t,l,n,s)),!0}return!1}function ex(e){var t=Ca(e.target);if(t!==null){var l=v(t);if(l!==null){if(t=l.tag,t===13){if(t=p(l),t!==null){e.blockedOn=t,xc(e.priority,function(){Ff(l)});return}}else if(t===31){if(t=b(l),t!==null){e.blockedOn=t,xc(e.priority,function(){Ff(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function pr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Do(e.nativeEvent);if(l===null){l=e.nativeEvent;var n=new l.constructor(l.type,l);Dr=n,l.target.dispatchEvent(n),Dr=null}else return t=Ta(l),t!==null&&Wf(t),e.blockedOn=l,!1;t.shift()}return!0}function tx(e,t,l){pr(e)&&l.delete(t)}function uh(){Bo=!1,Fl!==null&&pr(Fl)&&(Fl=null),Il!==null&&pr(Il)&&(Il=null),Pl!==null&&pr(Pl)&&(Pl=null),es.forEach(tx),ts.forEach(tx)}function mr(e,t){e.blockedOn===t&&(e.blockedOn=null,Bo||(Bo=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,uh)))}var hr=null;function lx(e){hr!==e&&(hr=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){hr===e&&(hr=null);for(var t=0;t<e.length;t+=3){var l=e[t],n=e[t+1],s=e[t+2];if(typeof n!="function"){if(Oo(n||l)===null)continue;break}var i=Ta(l);i!==null&&(e.splice(t,3),t-=3,Li(i,{pending:!0,data:s,method:l.method,action:n},n,s))}}))}function cn(e){function t(N){return mr(N,e)}Fl!==null&&mr(Fl,e),Il!==null&&mr(Il,e),Pl!==null&&mr(Pl,e),es.forEach(t),ts.forEach(t);for(var l=0;l<ea.length;l++){var n=ea[l];n.blockedOn===e&&(n.blockedOn=null)}for(;0<ea.length&&(l=ea[0],l.blockedOn===null);)ex(l),l.blockedOn===null&&ea.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(n=0;n<l.length;n+=3){var s=l[n],i=l[n+1],d=s[Tt]||null;if(typeof i=="function")d||lx(l);else if(d){var h=null;if(i&&i.hasAttribute("formAction")){if(s=i,d=i[Tt]||null)h=d.formAction;else if(Oo(s)!==null)continue}else h=d.action;typeof h=="function"?l[n+1]=h:(l.splice(n,3),n-=3),lx(l)}}}function ax(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(d){return s=d})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),n||setTimeout(l,20)}function l(){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,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function Ho(e){this._internalRoot=e}vr.prototype.render=Ho.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));var l=t.current,n=Yt();Zf(l,n,e,t,null,null)},vr.prototype.unmount=Ho.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Zf(e.current,2,null,e,null,null),Fs(),t[ka]=null}};function vr(e){this._internalRoot=e}vr.prototype.unstable_scheduleHydration=function(e){if(e){var t=fc();e={blockedOn:null,target:e,priority:t};for(var l=0;l<ea.length&&t!==0&&t<ea[l].priority;l++);ea.splice(l,0,e),l===0&&ex(e)}};var nx=c.version;if(nx!=="19.2.4")throw Error(u(527,nx,"19.2.4"));M.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?S(e):null,e=e===null?null:e.stateNode,e};var dh={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yr.isDisabled&&yr.supportsFiber)try{kt=yr.inject(dh),Fe=yr}catch{}}return ns.createRoot=function(e,t){if(!x(e))throw Error(u(299));var l=!1,n="",s=ud,i=dd,d=fd;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(d=t.onRecoverableError)),t=Kf(e,1,!1,null,null,l,n,null,s,i,d,ax),e[ka]=t.current,go(e),new Ho(t)},ns.hydrateRoot=function(e,t,l){if(!x(e))throw Error(u(299));var n=!1,s="",i=ud,d=dd,h=fd,N=null;return l!=null&&(l.unstable_strictMode===!0&&(n=!0),l.identifierPrefix!==void 0&&(s=l.identifierPrefix),l.onUncaughtError!==void 0&&(i=l.onUncaughtError),l.onCaughtError!==void 0&&(d=l.onCaughtError),l.onRecoverableError!==void 0&&(h=l.onRecoverableError),l.formState!==void 0&&(N=l.formState)),t=Kf(e,1,!0,t,l??null,n,s,N,i,d,h,ax),t.context=$f(null),l=t.current,n=Yt(),n=Tr(n),s=Ul(n),s.callback=null,ql(l,s,n),l=n,t.current.lanes=l,xn(t,l),dl(t),e[ka]=t.current,go(e),new vr(t)},ns.version="19.2.4",ns}var px;function jh(){if(px)return Vo.exports;px=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(c){console.error(c)}}return r(),Vo.exports=bh(),Vo.exports}var Sh=jh();const tc="";class Ox extends Error{constructor(c,o){super(c),this.name="ApiError",this.status=o}}async function Ae(r,c){const o=await fetch(`${tc}${r}`,c);if(!o.ok){const u=await o.json().catch(()=>({error:o.statusText}));throw new Ox(u.error||`HTTP ${o.status}`,o.status)}return o.json()}const be={getConfig(){return Ae("/api/config")},setConfig(r,c){return Ae("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,model:c})})},getSkills(){return Ae("/api/skills")},getSkillDetail(r,c){return Ae(`/api/skills/${r}/${c}`)},getEvals(r,c){return Ae(`/api/skills/${r}/${c}/evals`)},saveEvals(r,c,o){return Ae(`/api/skills/${r}/${c}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})},generateEvals(r,c){return Ae(`/api/skills/${r}/${c}/generate-evals`,{method:"POST"})},async getLatestBenchmark(r,c){const o=await fetch(`${tc}/api/skills/${r}/${c}/benchmark/latest`);if(o.status===404)return null;if(!o.ok){const u=await o.json().catch(()=>({error:o.statusText}));throw new Ox(u.error||`HTTP ${o.status}`,o.status)}return o.json()},getHistory(r,c,o){const u=new URLSearchParams;o!=null&&o.model&&u.set("model",o.model),o!=null&&o.type&&u.set("type",o.type),o!=null&&o.from&&u.set("from",o.from),o!=null&&o.to&&u.set("to",o.to);const x=u.toString();return Ae(`/api/skills/${r}/${c}/history${x?"?"+x:""}`)},getHistoryEntry(r,c,o){return Ae(`/api/skills/${r}/${c}/history/${encodeURIComponent(o)}`)},compareRuns(r,c,o,u){return Ae(`/api/skills/${r}/${c}/history-compare?a=${encodeURIComponent(o)}&b=${encodeURIComponent(u)}`)},getCaseHistory(r,c,o,u){const x=new URLSearchParams;u&&x.set("model",u);const v=x.toString();return Ae(`/api/skills/${r}/${c}/history/case/${o}${v?"?"+v:""}`)},deleteHistoryEntry(r,c,o){return Ae(`/api/skills/${r}/${c}/history/${encodeURIComponent(o)}`,{method:"DELETE"})},deleteSkill(r,c){return Ae(`/api/skills/${r}/${c}`,{method:"DELETE"})},improveSkill(r,c,o){return Ae(`/api/skills/${r}/${c}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})},instructEdit(r,c,o){return Ae(`/api/skills/${r}/${c}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...o})})},applyImprovement(r,c,o){return Ae(`/api/skills/${r}/${c}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:o})})},getStats(r,c){return Ae(`/api/skills/${r}/${c}/stats`)},getDependencies(r,c){return Ae(`/api/skills/${r}/${c}/dependencies`)},getProjectLayout(){return Ae("/api/project-layout")},createSkill(r){return Ae("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})},saveDraft(r){return Ae("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})},getSkillCreatorStatus(){return Ae("/api/skill-creator-status")},generateSkill(r){return Ae("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})},getSkillFiles(r,c){return Ae(`/api/skills/${r}/${c}/files`)},getSkillFile(r,c,o){return Ae(`/api/skills/${r}/${c}/file?path=${encodeURIComponent(o)}`)},saveSkillFile(r,c,o,u){return Ae(`/api/skills/${r}/${c}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:o,content:u})})},getLeaderboard(r,c){return Ae(`/api/skills/${r}/${c}/leaderboard`)},getLeaderboardEntry(r,c,o){return Ae(`/api/skills/${r}/${c}/leaderboard/${encodeURIComponent(o)}`)},startSweep(r,c,o){const u=`${tc}/api/skills/${r}/${c}/sweep`,x=new EventSource(u);return fetch(u,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(o)}),x},getCredentials(r,c){return Ae(`/api/credentials/${r}/${c}`)},setCredential(r,c,o,u){return Ae(`/api/credentials/${r}/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:o,value:u})})},getParams(r,c){return Ae(`/api/credentials/${r}/${c}/params`)},getParamsRevealed(r,c,o){const u=o?`reveal=true&key=${encodeURIComponent(o)}`:"reveal=true";return Ae(`/api/credentials/${r}/${c}/params?${u}`)},searchModels(){return Ae("/api/openrouter/models")}};function Nh(r){const[c,o]=m.useState(()=>typeof window>"u"?!1:window.matchMedia(r).matches);return m.useEffect(()=>{const u=window.matchMedia(r);o(u.matches);const x=v=>o(v.matches);return u.addEventListener("change",x),()=>u.removeEventListener("change",x)},[r]),c}const Eh={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list"};function kh(r,c){switch(c.type){case"SELECT_SKILL":return{...r,selectedSkill:c.skill,mode:"browse",mobileView:r.isMobile?"detail":r.mobileView};case"CLEAR_SELECTION":return{...r,selectedSkill:null};case"SET_MODE":return{...r,mode:c.mode,selectedSkill:c.mode==="create"?null:r.selectedSkill};case"SET_SEARCH":return{...r,searchQuery:c.query};case"SET_SKILLS":return{...r,skills:c.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...r,skillsError:c.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...r,skillsLoading:c.loading};case"SET_MOBILE":return{...r,isMobile:c.isMobile};case"SET_MOBILE_VIEW":return{...r,mobileView:c.view};default:return r}}const Bx=m.createContext(null);function na(){const r=m.useContext(Bx);if(!r)throw new Error("useStudio must be used within StudioProvider");return r}function Ch({children:r}){const[c,o]=m.useReducer(kh,Eh),u=Nh("(max-width: 767px)");m.useEffect(()=>{o({type:"SET_MOBILE",isMobile:u})},[u]);const x=m.useCallback(()=>{o({type:"SET_SKILLS_LOADING",loading:!0}),be.getSkills().then(g=>{o({type:"SET_SKILLS",skills:g});const w=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(w){const[,O,L]=w,G=g.find(q=>q.plugin===O&&q.skill===L);G&&o({type:"SELECT_SKILL",skill:{plugin:O,skill:L,origin:G.origin}})}}).catch(g=>o({type:"SET_SKILLS_ERROR",error:g.message}))},[]);m.useEffect(()=>{x()},[x]);const v=m.useCallback(g=>{o({type:"SELECT_SKILL",skill:g}),window.location.hash=`/skills/${g.plugin}/${g.skill}`},[]),p=m.useCallback(()=>{o({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),b=m.useCallback(g=>{o({type:"SET_MODE",mode:g})},[]),y=m.useCallback(g=>{o({type:"SET_SEARCH",query:g})},[]),f=m.useCallback(g=>{o({type:"SET_MOBILE_VIEW",view:g})},[]),S=m.useMemo(()=>({state:c,selectSkill:v,clearSelection:p,setMode:b,setSearch:y,setMobileView:f,refreshSkills:x}),[c,v,p,b,y,f,x]);return a.jsx(Bx.Provider,{value:S,children:r})}const Th={config:null,loading:!0};function wh(r,c){switch(c.type){case"SET_CONFIG":return{config:c.config,loading:!1};case"SET_LOADING":return{...r,loading:!0};default:return r}}const Hx=m.createContext(null);function Na(){const r=m.useContext(Hx);if(!r)throw new Error("useConfig must be used within ConfigProvider");return r}function Ah({children:r}){const[c,o]=m.useReducer(wh,Th),u=m.useCallback(()=>{be.getConfig().then(p=>o({type:"SET_CONFIG",config:p})).catch(()=>{})},[]);m.useEffect(()=>{u()},[u]);const x=m.useCallback(async(p,b)=>{const y=await be.setConfig(p,b);return o({type:"SET_CONFIG",config:y}),y},[]),v=m.useMemo(()=>({config:c.config,loading:c.loading,updateConfig:x,refreshConfig:u}),[c,x,u]);return a.jsx(Hx.Provider,{value:v,children:r})}function Rh({left:r,right:c}){const{state:o}=na();return o.isMobile?a.jsx("div",{style:{height:"100vh",overflow:"hidden",background:"var(--surface-0)"},children:o.mobileView==="list"?a.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--surface-1)"},children:r}):a.jsx("div",{style:{height:"100%",overflowY:"auto"},children:c})}):a.jsxs("div",{className:"studio-grid",style:{display:"grid",gridTemplateColumns:"280px 1px 1fr",height:"100vh",overflow:"hidden"},children:[a.jsx("div",{style:{overflowY:"auto",background:"var(--surface-1)"},children:r}),a.jsx("div",{style:{background:"var(--border-subtle)"}}),a.jsx("div",{style:{overflowY:"auto",background:"var(--surface-0)"},children:c})]})}function _h(){const{state:r,setSearch:c}=na(),[o,u]=m.useState(r.searchQuery),x=m.useRef(null);m.useEffect(()=>(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{c(o)},200),()=>{x.current&&clearTimeout(x.current)}),[o,c]),m.useEffect(()=>{r.searchQuery===""&&o!==""&&u("")},[r.searchQuery]);const v=new Set(r.skills.map(p=>p.plugin)).size;return a.jsxs("div",{className:"px-3 py-2",children:[a.jsxs("div",{className:"relative",children:[a.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:[a.jsx("circle",{cx:"11",cy:"11",r:"8"}),a.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),a.jsx("input",{type:"text",value:o,onChange:p=>u(p.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:p=>{p.currentTarget.style.borderColor="var(--accent)"},onBlur:p=>{p.currentTarget.style.borderColor="var(--border-subtle)"}}),o&&a.jsx("button",{onClick:()=>{u(""),c("")},style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:2},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!r.skillsLoading&&a.jsxs("div",{className:"text-[11px] mt-1.5 px-1",style:{color:"var(--text-tertiary)"},children:[r.skills.length," skill",r.skills.length!==1?"s":""," across ",v," plugin",v!==1?"s":""]})]})}const mx={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 hx({skill:r,isSelected:c,onSelect:o}){const u=mx[r.benchmarkStatus]||mx.missing,x=r.origin==="installed";return a.jsxs("button",{onClick:o,className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:c?"var(--surface-2)":"transparent",cursor:"pointer",borderTop:"none",borderRight:"none",borderBottom:"1px solid var(--border-subtle)",borderLeft:c?"2px solid var(--accent)":"2px solid transparent",display:"block",opacity:x?.7:1},onMouseEnter:v=>{c||(v.currentTarget.style.background="var(--surface-2)")},onMouseLeave:v=>{c||(v.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsxs("span",{className:"flex items-center gap-1.5 text-[13px] font-medium truncate",style:{color:"var(--text-primary)"},children:[x&&a.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:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),r.skill]}),a.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:[a.jsx("span",{className:"rounded-full",style:{width:5,height:5,background:u.dot}}),u.label]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:[r.evalCount," eval",r.evalCount!==1?"s":""]}),a.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),a.jsxs("span",{children:[r.assertionCount," assert",r.assertionCount!==1?"s":""]}),r.lastBenchmark&&a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),a.jsx("span",{children:new Date(r.lastBenchmark).toLocaleDateString()})]})]})]})}function vx(r){var o;const c={};for(const u of r)(c[o=u.plugin]||(c[o]=[])).push(u);return c}function Mh(){const{state:r,selectSkill:c}=na(),{skills:o,searchQuery:u,selectedSkill:x}=r,[v,p]=m.useState(!1),[b,y]=m.useState(()=>{try{return sessionStorage.getItem("vskill-origin-banner-dismissed")==="1"}catch{return!1}}),{sourceGroups:f,installedGroups:S}=m.useMemo(()=>{const g=u.toLowerCase(),C=g?o.filter(L=>L.skill.toLowerCase().includes(g)||L.plugin.toLowerCase().includes(g)):o,w=C.filter(L=>L.origin==="source"),O=C.filter(L=>L.origin==="installed");return{sourceGroups:Object.entries(vx(w)),installedGroups:Object.entries(vx(O))}},[o,u]);return r.skillsLoading?a.jsx("div",{className:"px-3 py-4 space-y-3",children:[1,2,3].map(g=>a.jsx("div",{className:"skeleton h-14 w-full rounded-lg"},g))}):f.length===0&&S.length===0?a.jsx("div",{className:"px-4 py-8 text-center",children:a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No skills match your search"})}):a.jsxs("div",{className:"flex-1",children:[f.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(zh,{title:"Your Skills",count:f.reduce((g,[,C])=>g+C.length,0)}),f.map(([g,C])=>a.jsxs("div",{children:[a.jsx(yx,{plugin:g,count:C.length}),C.map(w=>{const O=(x==null?void 0:x.plugin)===w.plugin&&(x==null?void 0:x.skill)===w.skill;return a.jsx(hx,{skill:w,isSelected:O,onSelect:()=>c({plugin:w.plugin,skill:w.skill,origin:w.origin})},`${w.plugin}/${w.skill}`)})]},g))]}),S.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>p(g=>!g),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:[a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Installed"}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",S.reduce((g,[,C])=>g+C.length,0),")"]}),a.jsx("div",{className:"flex-1"}),a.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:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]}),v&&a.jsxs(a.Fragment,{children:[!b&&a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2",style:{background:"var(--surface-1)",borderBottom:"1px solid var(--border-subtle)"},children:[a.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."}),a.jsx("button",{onClick:()=>{y(!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:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),S.map(([g,C])=>a.jsxs("div",{children:[a.jsx(yx,{plugin:g,count:C.length}),C.map(w=>{const O=(x==null?void 0:x.plugin)===w.plugin&&(x==null?void 0:x.skill)===w.skill;return a.jsx(hx,{skill:w,isSelected:O,onSelect:()=>c({plugin:w.plugin,skill:w.skill,origin:w.origin})},`${w.plugin}/${w.skill}`)})]},g))]})]})]})}function zh({title:r,count:c}){return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--surface-1)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-secondary)"},children:r}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",c,")"]})]})}function yx({plugin:r,count:c}){const[o,u]=m.useState(!1),x=`/images/icons/${r}.webp`;return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[o?a.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:a.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"})}):a.jsx("img",{src:x,width:16,height:16,alt:"",onError:()=>u(!0),style:{objectFit:"contain"}}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:r}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",c,")"]}),a.jsx("div",{className:"flex-1 h-px",style:{background:"var(--border-subtle)"}})]})}function Lh({value:r,onChange:c}){const[o,u]=m.useState([]),[x,v]=m.useState(!1),[p,b]=m.useState(null),[y,f]=m.useState(r),[S,g]=m.useState(!1),C=m.useRef(null),w=m.useRef(void 0);m.useEffect(()=>{v(!0),be.searchModels().then(q=>u(q.models)).catch(q=>b(q instanceof Error?q.message:String(q))).finally(()=>v(!1))},[]);const O=m.useCallback(q=>{f(q),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>g(!0),300)},[]),L=m.useMemo(()=>{if(!y.trim())return o.slice(0,50);const q=y.toLowerCase();return o.filter(J=>J.id.toLowerCase().includes(q)||J.name.toLowerCase().includes(q)).slice(0,50)},[o,y]);m.useEffect(()=>{function q(J){C.current&&!C.current.contains(J.target)&&g(!1)}return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[]);function G(q){var K;const J=(K=q.pricing)==null?void 0:K.prompt;return J==null||J===0?"Free":`$${(J*1e6).toFixed(2)}/1M`}return a.jsxs("div",{ref:C,style:{position:"relative"},children:[a.jsx("input",{type:"text",value:y,onChange:q=>O(q.target.value),onFocus:()=>g(!0),placeholder:x?"Loading models...":"Search OpenRouter models...",className:"input-field w-full",style:{fontSize:12}}),S&&!x&&a.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:[p&&a.jsxs("div",{className:"px-3 py-2 text-[11px]",style:{color:"var(--red)"},children:["Failed to load models: ",p]}),L.length===0&&!p&&a.jsx("div",{className:"px-3 py-3 text-[11px]",style:{color:"var(--text-tertiary)"},children:"No models found"}),L.map(q=>a.jsxs("button",{onClick:()=>{c(q.id),f(q.id),g(!1)},className:"w-full text-left px-3 py-2 flex items-center justify-between transition-colors duration-100",style:{background:q.id===r?"var(--accent-muted)":"transparent",border:"none",cursor:"pointer",borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:J=>{J.currentTarget.style.background="var(--surface-3)"},onMouseLeave:J=>{J.currentTarget.style.background=q.id===r?"var(--accent-muted)":"transparent"},children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:q.name}),a.jsx("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:q.id})]}),a.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:G(q)})]},q.id))]})]})}function Dh(){const{config:r,updateConfig:c,refreshConfig:o}=Na(),[u,x]=m.useState(!1),[v,p]=m.useState(!1),b=m.useRef(null);m.useEffect(()=>{function g(C){b.current&&!b.current.contains(C.target)&&x(!1)}return u&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[u]);async function y(g,C){p(!0);try{await c(g.id,C.id),x(!1)}catch{o()}finally{p(!1)}}if(!r)return null;const f=Bh(r),S=Oh(r);return a.jsxs("div",{ref:b,className:"relative",children:[a.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:g=>{u||(g.currentTarget.style.borderColor="var(--accent)")},onMouseLeave:g=>{u||(g.currentTarget.style.borderColor="var(--border-subtle)")},children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:S!=null&&S.available?"var(--green)":"var(--text-tertiary)"}}),a.jsx("span",{className:"flex-1 text-left font-medium truncate",style:{color:"var(--text-primary)"},children:f}),a.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:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),u&&a.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:[a.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Select Model"})}),a.jsx("div",{className:"py-1 max-h-72 overflow-y-auto",children:r.providers.map(g=>a.jsxs("div",{children:[a.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:g.available?"var(--green)":"var(--text-tertiary)",opacity:g.available?1:.3}}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",opacity:g.available?1:.5},children:g.label})]}),g.id==="openrouter"&&g.available?a.jsx("div",{className:"px-3 py-1.5",children:a.jsx(Lh,{value:r.provider==="openrouter"?r.model:"",onChange:C=>{v||y(g,{id:C,label:C})}})}):g.models.map(C=>{const w=Ux(r,g.id,C.id),O=!g.available||v;return a.jsxs("button",{onClick:()=>!O&&y(g,C),disabled:O,className:"w-full px-3 py-1.5 flex items-center gap-2.5 text-left transition-all duration-100",style:{background:w?"var(--accent-muted)":"transparent",color:O?"var(--text-tertiary)":"var(--text-primary)",opacity:O?.4:1,cursor:O?"not-allowed":"pointer"},onMouseEnter:L=>{!O&&!w&&(L.currentTarget.style.background="var(--surface-3)")},onMouseLeave:L=>{w||(L.currentTarget.style.background="transparent")},children:[a.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 flex items-center justify-center",style:{border:`2px solid ${w?"var(--accent)":"var(--border-subtle)"}`},children:w&&a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}})}),a.jsx("span",{className:"text-[12px]",style:{fontWeight:w?600:400},title:C.id,children:C.label})]},`${g.id}-${C.id}`)})]},g.id))})]})]})}function Ux(r,c,o){return r.provider!==c?!1:r.model===o}function Oh(r){return r.providers.find(c=>c.id===r.provider)}function Bh(r){for(const c of r.providers)for(const o of c.models)if(Ux(r,c.id,o.id))return o.label;return r.model}function Hh(){const{state:r,setMode:c}=na(),{config:o}=Na(),[u,x]=m.useState(null),[v,p]=m.useState(!1);return m.useEffect(()=>{be.getSkillCreatorStatus().then(x).catch(()=>{})},[]),a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"px-4 py-4 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:"var(--accent-muted)"},children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-[14px] font-semibold truncate",style:{color:"var(--text-primary)",letterSpacing:"-0.01em"},children:"Skill Studio"}),a.jsx("div",{className:"text-[11px] truncate",style:{color:"var(--text-tertiary)"},children:(o==null?void 0:o.projectName)||"vskill"})]})]}),a.jsx("div",{className:"mt-3",children:a.jsx(Dh,{})})]}),a.jsx(_h,{}),a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("button",{onClick:()=>c("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:r.mode==="create"?"var(--accent)":"var(--surface-3)",color:r.mode==="create"?"#fff":"var(--text-secondary)",border:"none",cursor:"pointer"},onMouseEnter:b=>{r.mode!=="create"&&(b.currentTarget.style.background="var(--surface-4)",b.currentTarget.style.color="var(--text-primary)")},onMouseLeave:b=>{r.mode!=="create"&&(b.currentTarget.style.background="var(--surface-3)",b.currentTarget.style.color="var(--text-secondary)")},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]})}),u&&(()=>{const b=(o==null?void 0:o.provider)==="claude-cli";return u.installed&&b?a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--green)"}}),"Skill Creator installed"]})}):u.installed&&!b?a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-[11px]",style:{color:"var(--text-tertiary)",opacity:.5},children:[a.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--text-tertiary)"}}),"Skill Creator (Claude only)"]})}):!u.installed&&b?a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("div",{className:"px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",style:{color:"var(--yellow)"},children:[a.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--yellow)"}}),a.jsx("span",{className:"font-medium",children:"Skill Creator not installed"})]}),a.jsx("button",{onClick:()=>{navigator.clipboard.writeText(u.installCommand).then(()=>{p(!0),setTimeout(()=>p(!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:y=>{y.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:y=>{y.currentTarget.style.borderColor="var(--border-subtle)"},children:v?"Copied!":u.installCommand})]})}):null})(),a.jsx("div",{className:"flex-1 overflow-y-auto",style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Mh,{})})]})}const Uh="modulepreload",qh=function(r){return"/"+r},gx={},Vh=function(c,o,u){let x=Promise.resolve();if(o&&o.length>0){let p=function(f){return Promise.all(f.map(S=>Promise.resolve(S).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const b=document.querySelector("meta[property=csp-nonce]"),y=(b==null?void 0:b.nonce)||(b==null?void 0:b.getAttribute("nonce"));x=p(o.map(f=>{if(f=qh(f),f in gx)return;gx[f]=!0;const S=f.endsWith(".css"),g=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const C=document.createElement("link");if(C.rel=S?"stylesheet":Uh,S||(C.as="script"),C.crossOrigin="",C.href=f,y&&C.setAttribute("nonce",y),document.head.appendChild(C),S)return new Promise((w,O)=>{C.addEventListener("load",w),C.addEventListener("error",()=>O(new Error(`Unable to preload CSS for ${f}`)))})}))}function v(p){const b=new Event("vite:preloadError",{cancelable:!0});if(b.payload=p,window.dispatchEvent(b),!b.defaultPrevented)throw p}return x.then(p=>{for(const b of p||[])b.status==="rejected"&&v(b.reason);return c().catch(v)})};function qx(r){if(r!==void 0)try{return JSON.stringify(r)}catch(c){console.error("Failed to serialize request body:",c);try{const o=new WeakSet;return JSON.stringify(r,(u,x)=>{if(typeof x=="object"&&x!==null){if(o.has(x))return"[Circular]";o.add(x)}return x})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function Xo(){const[r,c]=m.useState([]),[o,u]=m.useState(!1),[x,v]=m.useState(!1),[p,b]=m.useState(null),y=m.useRef(null),f=m.useCallback(async(g,C)=>{c([]),u(!0),v(!1),b(null);const w=new AbortController;y.current=w;try{const O=qx(C),L=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:O,signal:w.signal});if(!L.ok||!L.body){let K=`HTTP ${L.status}`;try{const P=await L.json();P.error&&(K=P.error)}catch{}throw new Error(K)}const G=L.body.getReader(),q=new TextDecoder;let J="",ee="";for(;;){const{done:K,value:P}=await G.read();if(K)break;J+=q.decode(P,{stream:!0});const re=J.split(`
|
|
48
|
+
`+n.stack}}var Xe=Object.prototype.hasOwnProperty,Dt=r.unstable_scheduleCallback,mt=r.unstable_cancelCallback,ll=r.unstable_shouldYield,Qt=r.unstable_requestPaint,We=r.unstable_now,Et=r.unstable_getCurrentPriorityLevel,$=r.unstable_ImmediatePriority,Be=r.unstable_UserBlockingPriority,at=r.unstable_NormalPriority,Je=r.unstable_LowPriority,Rl=r.unstable_IdlePriority,Ot=r.log,sa=r.unstable_setDisableYieldValue,kt=null,Fe=null;function nt(e){if(typeof Ot=="function"&&sa(e),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(kt,e)}catch{}}var et=Math.clz32?Math.clz32:nl,al=Math.log,Qe=Math.LN2;function nl(e){return e>>>=0,e===0?32:31-(al(e)/Qe|0)|0}var st=256,Ve=262144,_l=4194304;function Ct(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 Ea(e,t,l){var n=e.pendingLanes;if(n===0)return 0;var s=0,i=e.suspendedLanes,d=e.pingedLanes;e=e.warmLanes;var h=n&134217727;return h!==0?(n=h&~i,n!==0?s=Ct(n):(d&=h,d!==0?s=Ct(d):l||(l=h&~e,l!==0&&(s=Ct(l))))):(h=n&~i,h!==0?s=Ct(h):d!==0?s=Ct(d):l||(l=n&~e,l!==0&&(s=Ct(l)))),s===0?0:t!==0&&t!==s&&(t&i)===0&&(i=s&-s,l=t&-t,i>=l||i===32&&(l&4194048)!==0)?t:s}function fn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ep(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 oc(){var e=_l;return _l<<=1,(_l&62914560)===0&&(_l=4194304),e}function Cr(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function xn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tp(e,t,l,n,s,i){var d=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var h=e.entanglements,N=e.expirationTimes,R=e.hiddenUpdates;for(l=d&~l;0<l;){var U=31-et(l),Y=1<<U;h[U]=0,N[U]=-1;var z=R[U];if(z!==null)for(R[U]=null,U=0;U<z.length;U++){var H=z[U];H!==null&&(H.lane&=-536870913)}l&=~Y}n!==0&&cc(e,n,0),i!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=i&~(d&~t))}function cc(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-et(t);e.entangledLanes|=t,e.entanglements[n]=e.entanglements[n]|1073741824|l&261930}function uc(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var n=31-et(l),s=1<<n;s&t|e[n]&t&&(e[n]|=t),l&=~s}}function dc(e,t){var l=t&-t;return l=(l&42)!==0?1:Tr(l),(l&(e.suspendedLanes|t))!==0?0:l}function Tr(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 wr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function fc(){var e=M.p;return e!==0?e:(e=window.event,e===void 0?32:If(e.type))}function xc(e,t){var l=M.p;try{return M.p=e,t()}finally{M.p=l}}var Ml=Math.random().toString(36).slice(2),ht="__reactFiber$"+Ml,Tt="__reactProps$"+Ml,ka="__reactContainer$"+Ml,Ar="__reactEvents$"+Ml,lp="__reactListeners$"+Ml,ap="__reactHandles$"+Ml,pc="__reactResources$"+Ml,pn="__reactMarker$"+Ml;function Rr(e){delete e[ht],delete e[Tt],delete e[Ar],delete e[lp],delete e[ap]}function Ca(e){var t=e[ht];if(t)return t;for(var l=e.parentNode;l;){if(t=l[ka]||l[ht]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=Of(e);e!==null;){if(l=e[ht])return l;e=Of(e)}return t}e=l,l=e.parentNode}return null}function Ta(e){if(e=e[ht]||e[ka]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function mn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(u(33))}function wa(e){var t=e[pc];return t||(t=e[pc]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ft(e){e[pn]=!0}var mc=new Set,hc={};function ra(e,t){Aa(e,t),Aa(e+"Capture",t)}function Aa(e,t){for(hc[e]=t,e=0;e<t.length;e++)mc.add(t[e])}var np=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]*$"),vc={},yc={};function sp(e){return Xe.call(yc,e)?!0:Xe.call(vc,e)?!1:np.test(e)?yc[e]=!0:(vc[e]=!0,!1)}function is(e,t,l){if(sp(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){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,""+l)}}function os(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function fl(e,t,l,n){if(n===null)e.removeAttribute(l);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+n)}}function Xt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function rp(e,t,l){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(d){l=""+d,i.call(this,d)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(d){l=""+d},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function _r(e){if(!e._valueTracker){var t=gc(e)?"checked":"value";e._valueTracker=rp(e,t,""+e[t])}}function bc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),n="";return e&&(n=gc(e)?e.checked?"true":"false":e.value),e=n,e!==l?(t.setValue(e),!0):!1}function cs(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 ip=/[\n"\\]/g;function Kt(e){return e.replace(ip,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Mr(e,t,l,n,s,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=""+Xt(t)):e.value!==""+Xt(t)&&(e.value=""+Xt(t)):d!=="submit"&&d!=="reset"||e.removeAttribute("value"),t!=null?zr(e,d,Xt(t)):l!=null?zr(e,d,Xt(l)):n!=null&&e.removeAttribute("value"),s==null&&i!=null&&(e.defaultChecked=!!i),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.name=""+Xt(h):e.removeAttribute("name")}function jc(e,t,l,n,s,i,d,h){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||l!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){_r(e);return}l=l!=null?""+Xt(l):"",t=t!=null?""+Xt(t):l,h||t===e.value||(e.value=t),e.defaultValue=t}n=n??s,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),_r(e)}function zr(e,t,l){t==="number"&&cs(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Ra(e,t,l,n){if(e=e.options,t){t={};for(var s=0;s<l.length;s++)t["$"+l[s]]=!0;for(l=0;l<e.length;l++)s=t.hasOwnProperty("$"+e[l].value),e[l].selected!==s&&(e[l].selected=s),s&&n&&(e[l].defaultSelected=!0)}else{for(l=""+Xt(l),t=null,s=0;s<e.length;s++){if(e[s].value===l){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Sc(e,t,l){if(t!=null&&(t=""+Xt(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Xt(l):""}function Nc(e,t,l,n){if(t==null){if(n!=null){if(l!=null)throw Error(u(92));if(I(n)){if(1<n.length)throw Error(u(93));n=n[0]}l=n}l==null&&(l=""),t=l}l=Xt(t),e.defaultValue=l,n=e.textContent,n===l&&n!==""&&n!==null&&(e.value=n),_r(e)}function _a(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var op=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 Ec(e,t,l){var n=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?n?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":n?e.setProperty(t,l):typeof l!="number"||l===0||op.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function kc(e,t,l){if(t!=null&&typeof t!="object")throw Error(u(62));if(e=e.style,l!=null){for(var n in l)!l.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="");for(var s in t)n=t[s],t.hasOwnProperty(s)&&l[s]!==n&&Ec(e,s,n)}else for(var i in t)t.hasOwnProperty(i)&&Ec(e,i,t[i])}function Lr(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 cp=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"]]),up=/^[\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 us(e){return up.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function xl(){}var Dr=null;function Or(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ma=null,za=null;function Cc(e){var t=Ta(e);if(t&&(e=t.stateNode)){var l=e[Tt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Mr(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Kt(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var n=l[t];if(n!==e&&n.form===e.form){var s=n[Tt]||null;if(!s)throw Error(u(90));Mr(n,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<l.length;t++)n=l[t],n.form===e.form&&bc(n)}break e;case"textarea":Sc(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Ra(e,!!l.multiple,t,!1)}}}var Br=!1;function Tc(e,t,l){if(Br)return e(t,l);Br=!0;try{var n=e(t);return n}finally{if(Br=!1,(Ma!==null||za!==null)&&(Fs(),Ma&&(t=Ma,e=za,za=Ma=null,Cc(t),e)))for(t=0;t<e.length;t++)Cc(e[t])}}function hn(e,t){var l=e.stateNode;if(l===null)return null;var n=l[Tt]||null;if(n===null)return null;l=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(l&&typeof l!="function")throw Error(u(231,t,typeof l));return l}var pl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hr=!1;if(pl)try{var vn={};Object.defineProperty(vn,"passive",{get:function(){Hr=!0}}),window.addEventListener("test",vn,vn),window.removeEventListener("test",vn,vn)}catch{Hr=!1}var zl=null,Ur=null,ds=null;function wc(){if(ds)return ds;var e,t=Ur,l=t.length,n,s="value"in zl?zl.value:zl.textContent,i=s.length;for(e=0;e<l&&t[e]===s[e];e++);var d=l-e;for(n=1;n<=d&&t[l-n]===s[i-n];n++);return ds=s.slice(e,1<n?1-n:void 0)}function fs(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 xs(){return!0}function Ac(){return!1}function wt(e){function t(l,n,s,i,d){this._reactName=l,this._targetInst=s,this.type=n,this.nativeEvent=i,this.target=d,this.currentTarget=null;for(var h in e)e.hasOwnProperty(h)&&(l=e[h],this[h]=l?l(i):i[h]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?xs:Ac,this.isPropagationStopped=Ac,this}return g(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=xs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=xs)},persist:function(){},isPersistent:xs}),t}var ia={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ps=wt(ia),yn=g({},ia,{view:0,detail:0}),dp=wt(yn),qr,Vr,gn,ms=g({},yn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yr,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!==gn&&(gn&&e.type==="mousemove"?(qr=e.screenX-gn.screenX,Vr=e.screenY-gn.screenY):Vr=qr=0,gn=e),qr)},movementY:function(e){return"movementY"in e?e.movementY:Vr}}),Rc=wt(ms),fp=g({},ms,{dataTransfer:0}),xp=wt(fp),pp=g({},yn,{relatedTarget:0}),Gr=wt(pp),mp=g({},ia,{animationName:0,elapsedTime:0,pseudoElement:0}),hp=wt(mp),vp=g({},ia,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),yp=wt(vp),gp=g({},ia,{data:0}),_c=wt(gp),bp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jp={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"},Sp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Np(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Sp[e])?!!t[e]:!1}function Yr(){return Np}var Ep=g({},yn,{key:function(e){if(e.key){var t=bp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=fs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?jp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yr,charCode:function(e){return e.type==="keypress"?fs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?fs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),kp=wt(Ep),Cp=g({},ms,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mc=wt(Cp),Tp=g({},yn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yr}),wp=wt(Tp),Ap=g({},ia,{propertyName:0,elapsedTime:0,pseudoElement:0}),Rp=wt(Ap),_p=g({},ms,{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}),Mp=wt(_p),zp=g({},ia,{newState:0,oldState:0}),Lp=wt(zp),Dp=[9,13,27,32],Qr=pl&&"CompositionEvent"in window,bn=null;pl&&"documentMode"in document&&(bn=document.documentMode);var Op=pl&&"TextEvent"in window&&!bn,zc=pl&&(!Qr||bn&&8<bn&&11>=bn),Lc=" ",Dc=!1;function Oc(e,t){switch(e){case"keyup":return Dp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var La=!1;function Bp(e,t){switch(e){case"compositionend":return Bc(t);case"keypress":return t.which!==32?null:(Dc=!0,Lc);case"textInput":return e=t.data,e===Lc&&Dc?null:e;default:return null}}function Hp(e,t){if(La)return e==="compositionend"||!Qr&&Oc(e,t)?(e=wc(),ds=Ur=zl=null,La=!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 zc&&t.locale!=="ko"?null:t.data;default:return null}}var Up={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 Hc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Up[e.type]:t==="textarea"}function Uc(e,t,l,n){Ma?za?za.push(n):za=[n]:Ma=n,t=nr(t,"onChange"),0<t.length&&(l=new ps("onChange","change",null,l,n),e.push({event:l,listeners:t}))}var jn=null,Sn=null;function qp(e){Sf(e,0)}function hs(e){var t=mn(e);if(bc(t))return e}function qc(e,t){if(e==="change")return t}var Vc=!1;if(pl){var Xr;if(pl){var Kr="oninput"in document;if(!Kr){var Gc=document.createElement("div");Gc.setAttribute("oninput","return;"),Kr=typeof Gc.oninput=="function"}Xr=Kr}else Xr=!1;Vc=Xr&&(!document.documentMode||9<document.documentMode)}function Yc(){jn&&(jn.detachEvent("onpropertychange",Qc),Sn=jn=null)}function Qc(e){if(e.propertyName==="value"&&hs(Sn)){var t=[];Uc(t,Sn,e,Or(e)),Tc(qp,t)}}function Vp(e,t,l){e==="focusin"?(Yc(),jn=t,Sn=l,jn.attachEvent("onpropertychange",Qc)):e==="focusout"&&Yc()}function Gp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return hs(Sn)}function Yp(e,t){if(e==="click")return hs(t)}function Qp(e,t){if(e==="input"||e==="change")return hs(t)}function Xp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Bt=typeof Object.is=="function"?Object.is:Xp;function Nn(e,t){if(Bt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),n=Object.keys(t);if(l.length!==n.length)return!1;for(n=0;n<l.length;n++){var s=l[n];if(!Xe.call(t,s)||!Bt(e[s],t[s]))return!1}return!0}function Xc(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Kc(e,t){var l=Xc(e);e=0;for(var n;l;){if(l.nodeType===3){if(n=e+l.textContent.length,e<=t&&n>=t)return{node:l,offset:t-e};e=n}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Xc(l)}}function $c(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$c(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zc(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=cs(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=cs(e.document)}return t}function $r(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 Kp=pl&&"documentMode"in document&&11>=document.documentMode,Da=null,Zr=null,En=null,Jr=!1;function Jc(e,t,l){var n=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Jr||Da==null||Da!==cs(n)||(n=Da,"selectionStart"in n&&$r(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}),En&&Nn(En,n)||(En=n,n=nr(Zr,"onSelect"),0<n.length&&(t=new ps("onSelect","select",null,t,l),e.push({event:t,listeners:n}),t.target=Da)))}function oa(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Oa={animationend:oa("Animation","AnimationEnd"),animationiteration:oa("Animation","AnimationIteration"),animationstart:oa("Animation","AnimationStart"),transitionrun:oa("Transition","TransitionRun"),transitionstart:oa("Transition","TransitionStart"),transitioncancel:oa("Transition","TransitionCancel"),transitionend:oa("Transition","TransitionEnd")},Wr={},Wc={};pl&&(Wc=document.createElement("div").style,"AnimationEvent"in window||(delete Oa.animationend.animation,delete Oa.animationiteration.animation,delete Oa.animationstart.animation),"TransitionEvent"in window||delete Oa.transitionend.transition);function ca(e){if(Wr[e])return Wr[e];if(!Oa[e])return e;var t=Oa[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Wc)return Wr[e]=t[l];return e}var Fc=ca("animationend"),Ic=ca("animationiteration"),Pc=ca("animationstart"),$p=ca("transitionrun"),Zp=ca("transitionstart"),Jp=ca("transitioncancel"),eu=ca("transitionend"),tu=new Map,Fr="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(" ");Fr.push("scrollEnd");function sl(e,t){tu.set(e,t),ra(t,[e])}var vs=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)},$t=[],Ba=0,Ir=0;function ys(){for(var e=Ba,t=Ir=Ba=0;t<e;){var l=$t[t];$t[t++]=null;var n=$t[t];$t[t++]=null;var s=$t[t];$t[t++]=null;var i=$t[t];if($t[t++]=null,n!==null&&s!==null){var d=n.pending;d===null?s.next=s:(s.next=d.next,d.next=s),n.pending=s}i!==0&&lu(l,s,i)}}function gs(e,t,l,n){$t[Ba++]=e,$t[Ba++]=t,$t[Ba++]=l,$t[Ba++]=n,Ir|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function Pr(e,t,l,n){return gs(e,t,l,n),bs(e)}function ua(e,t){return gs(e,null,null,t),bs(e)}function lu(e,t,l){e.lanes|=l;var n=e.alternate;n!==null&&(n.lanes|=l);for(var s=!1,i=e.return;i!==null;)i.childLanes|=l,n=i.alternate,n!==null&&(n.childLanes|=l),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(s=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,s&&t!==null&&(s=31-et(l),e=i.hiddenUpdates,n=e[s],n===null?e[s]=[t]:n.push(t),t.lane=l|536870912),i):null}function bs(e){if(50<Kn)throw Kn=0,oo=null,Error(u(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ha={};function Wp(e,t,l,n){this.tag=e,this.key=l,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 Ht(e,t,l,n){return new Wp(e,t,l,n)}function ei(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ml(e,t){var l=e.alternate;return l===null?(l=Ht(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function au(e,t){e.flags&=65011714;var l=e.alternate;return l===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=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function js(e,t,l,n,s,i){var d=0;if(n=e,typeof e=="function")ei(e)&&(d=1);else if(typeof e=="string")d=th(e,l,ne.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Q:return e=Ht(31,l,t,s),e.elementType=Q,e.lanes=i,e;case L:return da(l.children,s,i,t);case G:d=8,s|=24;break;case q:return e=Ht(12,l,t,s|2),e.elementType=q,e.lanes=i,e;case P:return e=Ht(13,l,t,s),e.elementType=P,e.lanes=i,e;case re:return e=Ht(19,l,t,s),e.elementType=re,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ee:d=10;break e;case J:d=9;break e;case K:d=11;break e;case X:d=14;break e;case te:d=16,n=null;break e}d=29,l=Error(u(130,e===null?"null":typeof e,"")),n=null}return t=Ht(d,l,t,s),t.elementType=e,t.type=n,t.lanes=i,t}function da(e,t,l,n){return e=Ht(7,e,n,t),e.lanes=l,e}function ti(e,t,l){return e=Ht(6,e,null,t),e.lanes=l,e}function nu(e){var t=Ht(18,null,null,0);return t.stateNode=e,t}function li(e,t,l){return t=Ht(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var su=new WeakMap;function Zt(e,t){if(typeof e=="object"&&e!==null){var l=su.get(e);return l!==void 0?l:(t={value:e,source:t,stack:ut(t)},su.set(e,t),t)}return{value:e,source:t,stack:ut(t)}}var Ua=[],qa=0,Ss=null,kn=0,Jt=[],Wt=0,Ll=null,ol=1,cl="";function hl(e,t){Ua[qa++]=kn,Ua[qa++]=Ss,Ss=e,kn=t}function ru(e,t,l){Jt[Wt++]=ol,Jt[Wt++]=cl,Jt[Wt++]=Ll,Ll=e;var n=ol;e=cl;var s=32-et(n)-1;n&=~(1<<s),l+=1;var i=32-et(t)+s;if(30<i){var d=s-s%5;i=(n&(1<<d)-1).toString(32),n>>=d,s-=d,ol=1<<32-et(t)+s|l<<s|n,cl=i+e}else ol=1<<i|l<<s|n,cl=e}function ai(e){e.return!==null&&(hl(e,1),ru(e,1,0))}function ni(e){for(;e===Ss;)Ss=Ua[--qa],Ua[qa]=null,kn=Ua[--qa],Ua[qa]=null;for(;e===Ll;)Ll=Jt[--Wt],Jt[Wt]=null,cl=Jt[--Wt],Jt[Wt]=null,ol=Jt[--Wt],Jt[Wt]=null}function iu(e,t){Jt[Wt++]=ol,Jt[Wt++]=cl,Jt[Wt++]=Ll,ol=t.id,cl=t.overflow,Ll=e}var vt=null,Ke=null,we=!1,Dl=null,Ft=!1,si=Error(u(519));function Ol(e){var t=Error(u(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Cn(Zt(t,e)),si}function ou(e){var t=e.stateNode,l=e.type,n=e.memoizedProps;switch(t[ht]=e,t[Tt]=n,l){case"dialog":ke("cancel",t),ke("close",t);break;case"iframe":case"object":case"embed":ke("load",t);break;case"video":case"audio":for(l=0;l<Zn.length;l++)ke(Zn[l],t);break;case"source":ke("error",t);break;case"img":case"image":case"link":ke("error",t),ke("load",t);break;case"details":ke("toggle",t);break;case"input":ke("invalid",t),jc(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":ke("invalid",t);break;case"textarea":ke("invalid",t),Nc(t,n.value,n.defaultValue,n.children)}l=n.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||n.suppressHydrationWarning===!0||Cf(t.textContent,l)?(n.popover!=null&&(ke("beforetoggle",t),ke("toggle",t)),n.onScroll!=null&&ke("scroll",t),n.onScrollEnd!=null&&ke("scrollend",t),n.onClick!=null&&(t.onclick=xl),t=!0):t=!1,t||Ol(e,!0)}function cu(e){for(vt=e.return;vt;)switch(vt.tag){case 5:case 31:case 13:Ft=!1;return;case 27:case 3:Ft=!0;return;default:vt=vt.return}}function Va(e){if(e!==vt)return!1;if(!we)return cu(e),we=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Eo(e.type,e.memoizedProps)),l=!l),l&&Ke&&Ol(e),cu(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Ke=Df(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Ke=Df(e)}else t===27?(t=Ke,Wl(e.type)?(e=Ao,Ao=null,Ke=e):Ke=t):Ke=vt?Pt(e.stateNode.nextSibling):null;return!0}function fa(){Ke=vt=null,we=!1}function ri(){var e=Dl;return e!==null&&(Mt===null?Mt=e:Mt.push.apply(Mt,e),Dl=null),e}function Cn(e){Dl===null?Dl=[e]:Dl.push(e)}var ii=j(null),xa=null,vl=null;function Bl(e,t,l){W(ii,t._currentValue),t._currentValue=l}function yl(e){e._currentValue=ii.current,D(ii)}function oi(e,t,l){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===l)break;e=e.return}}function ci(e,t,l,n){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var i=s.dependencies;if(i!==null){var d=s.child;i=i.firstContext;e:for(;i!==null;){var h=i;i=s;for(var N=0;N<t.length;N++)if(h.context===t[N]){i.lanes|=l,h=i.alternate,h!==null&&(h.lanes|=l),oi(i.return,l,e),n||(d=null);break e}i=h.next}}else if(s.tag===18){if(d=s.return,d===null)throw Error(u(341));d.lanes|=l,i=d.alternate,i!==null&&(i.lanes|=l),oi(d,l,e),d=null}else d=s.child;if(d!==null)d.return=s;else for(d=s;d!==null;){if(d===e){d=null;break}if(s=d.sibling,s!==null){s.return=d.return,d=s;break}d=d.return}s=d}}function Ga(e,t,l,n){e=null;for(var s=t,i=!1;s!==null;){if(!i){if((s.flags&524288)!==0)i=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var d=s.alternate;if(d===null)throw Error(u(387));if(d=d.memoizedProps,d!==null){var h=s.type;Bt(s.pendingProps.value,d.value)||(e!==null?e.push(h):e=[h])}}else if(s===ve.current){if(d=s.alternate,d===null)throw Error(u(387));d.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(Pn):e=[Pn])}s=s.return}e!==null&&ci(t,e,l,n),t.flags|=262144}function Ns(e){for(e=e.firstContext;e!==null;){if(!Bt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function pa(e){xa=e,vl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return uu(xa,e)}function Es(e,t){return xa===null&&pa(e),uu(e,t)}function uu(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},vl===null){if(e===null)throw Error(u(308));vl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else vl=vl.next=t;return l}var Fp=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},Ip=r.unstable_scheduleCallback,Pp=r.unstable_NormalPriority,rt={$$typeof:ee,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ui(){return{controller:new Fp,data:new Map,refCount:0}}function Tn(e){e.refCount--,e.refCount===0&&Ip(Pp,function(){e.controller.abort()})}var wn=null,di=0,Ya=0,Qa=null;function em(e,t){if(wn===null){var l=wn=[];di=0,Ya=mo(),Qa={status:"pending",value:void 0,then:function(n){l.push(n)}}}return di++,t.then(du,du),t}function du(){if(--di===0&&wn!==null){Qa!==null&&(Qa.status="fulfilled");var e=wn;wn=null,Ya=0,Qa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function tm(e,t){var l=[],n={status:"pending",value:null,reason:null,then:function(s){l.push(s)}};return e.then(function(){n.status="fulfilled",n.value=t;for(var s=0;s<l.length;s++)(0,l[s])(t)},function(s){for(n.status="rejected",n.reason=s,s=0;s<l.length;s++)(0,l[s])(void 0)}),n}var fu=E.S;E.S=function(e,t){Jd=We(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&em(e,t),fu!==null&&fu(e,t)};var ma=j(null);function fi(){var e=ma.current;return e!==null?e:Ge.pooledCache}function ks(e,t){t===null?W(ma,ma.current):W(ma,t.pool)}function xu(){var e=fi();return e===null?null:{parent:rt._currentValue,pool:e}}var Xa=Error(u(460)),xi=Error(u(474)),Cs=Error(u(542)),Ts={then:function(){}};function pu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function mu(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(xl,xl),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,vu(e),e;default:if(typeof t.status=="string")t.then(xl,xl);else{if(e=Ge,e!==null&&100<e.shellSuspendCounter)throw Error(u(482));e=t,e.status="pending",e.then(function(n){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=n}},function(n){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,vu(e),e}throw va=t,Xa}}function ha(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(va=l,Xa):l}}var va=null;function hu(){if(va===null)throw Error(u(459));var e=va;return va=null,e}function vu(e){if(e===Xa||e===Cs)throw Error(u(483))}var Ka=null,An=0;function ws(e){var t=An;return An+=1,Ka===null&&(Ka=[]),mu(Ka,e,t)}function Rn(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function As(e,t){throw t.$$typeof===C?Error(u(525)):(e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function yu(e){function t(T,k){if(e){var A=T.deletions;A===null?(T.deletions=[k],T.flags|=16):A.push(k)}}function l(T,k){if(!e)return null;for(;k!==null;)t(T,k),k=k.sibling;return null}function n(T){for(var k=new Map;T!==null;)T.key!==null?k.set(T.key,T):k.set(T.index,T),T=T.sibling;return k}function s(T,k){return T=ml(T,k),T.index=0,T.sibling=null,T}function i(T,k,A){return T.index=A,e?(A=T.alternate,A!==null?(A=A.index,A<k?(T.flags|=67108866,k):A):(T.flags|=67108866,k)):(T.flags|=1048576,k)}function d(T){return e&&T.alternate===null&&(T.flags|=67108866),T}function h(T,k,A,V){return k===null||k.tag!==6?(k=ti(A,T.mode,V),k.return=T,k):(k=s(k,A),k.return=T,k)}function N(T,k,A,V){var he=A.type;return he===L?U(T,k,A.props.children,V,A.key):k!==null&&(k.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===te&&ha(he)===k.type)?(k=s(k,A.props),Rn(k,A),k.return=T,k):(k=js(A.type,A.key,A.props,null,T.mode,V),Rn(k,A),k.return=T,k)}function R(T,k,A,V){return k===null||k.tag!==4||k.stateNode.containerInfo!==A.containerInfo||k.stateNode.implementation!==A.implementation?(k=li(A,T.mode,V),k.return=T,k):(k=s(k,A.children||[]),k.return=T,k)}function U(T,k,A,V,he){return k===null||k.tag!==7?(k=da(A,T.mode,V,he),k.return=T,k):(k=s(k,A),k.return=T,k)}function Y(T,k,A){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=ti(""+k,T.mode,A),k.return=T,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case w:return A=js(k.type,k.key,k.props,null,T.mode,A),Rn(A,k),A.return=T,A;case O:return k=li(k,T.mode,A),k.return=T,k;case te:return k=ha(k),Y(T,k,A)}if(I(k)||ie(k))return k=da(k,T.mode,A,null),k.return=T,k;if(typeof k.then=="function")return Y(T,ws(k),A);if(k.$$typeof===ee)return Y(T,Es(T,k),A);As(T,k)}return null}function z(T,k,A,V){var he=k!==null?k.key:null;if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return he!==null?null:h(T,k,""+A,V);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case w:return A.key===he?N(T,k,A,V):null;case O:return A.key===he?R(T,k,A,V):null;case te:return A=ha(A),z(T,k,A,V)}if(I(A)||ie(A))return he!==null?null:U(T,k,A,V,null);if(typeof A.then=="function")return z(T,k,ws(A),V);if(A.$$typeof===ee)return z(T,k,Es(T,A),V);As(T,A)}return null}function H(T,k,A,V,he){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return T=T.get(A)||null,h(k,T,""+V,he);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case w:return T=T.get(V.key===null?A:V.key)||null,N(k,T,V,he);case O:return T=T.get(V.key===null?A:V.key)||null,R(k,T,V,he);case te:return V=ha(V),H(T,k,A,V,he)}if(I(V)||ie(V))return T=T.get(A)||null,U(k,T,V,he,null);if(typeof V.then=="function")return H(T,k,A,ws(V),he);if(V.$$typeof===ee)return H(T,k,A,Es(k,V),he);As(k,V)}return null}function ce(T,k,A,V){for(var he=null,_e=null,xe=k,Ne=k=0,Te=null;xe!==null&&Ne<A.length;Ne++){xe.index>Ne?(Te=xe,xe=null):Te=xe.sibling;var Me=z(T,xe,A[Ne],V);if(Me===null){xe===null&&(xe=Te);break}e&&xe&&Me.alternate===null&&t(T,xe),k=i(Me,k,Ne),_e===null?he=Me:_e.sibling=Me,_e=Me,xe=Te}if(Ne===A.length)return l(T,xe),we&&hl(T,Ne),he;if(xe===null){for(;Ne<A.length;Ne++)xe=Y(T,A[Ne],V),xe!==null&&(k=i(xe,k,Ne),_e===null?he=xe:_e.sibling=xe,_e=xe);return we&&hl(T,Ne),he}for(xe=n(xe);Ne<A.length;Ne++)Te=H(xe,T,Ne,A[Ne],V),Te!==null&&(e&&Te.alternate!==null&&xe.delete(Te.key===null?Ne:Te.key),k=i(Te,k,Ne),_e===null?he=Te:_e.sibling=Te,_e=Te);return e&&xe.forEach(function(ta){return t(T,ta)}),we&&hl(T,Ne),he}function ye(T,k,A,V){if(A==null)throw Error(u(151));for(var he=null,_e=null,xe=k,Ne=k=0,Te=null,Me=A.next();xe!==null&&!Me.done;Ne++,Me=A.next()){xe.index>Ne?(Te=xe,xe=null):Te=xe.sibling;var ta=z(T,xe,Me.value,V);if(ta===null){xe===null&&(xe=Te);break}e&&xe&&ta.alternate===null&&t(T,xe),k=i(ta,k,Ne),_e===null?he=ta:_e.sibling=ta,_e=ta,xe=Te}if(Me.done)return l(T,xe),we&&hl(T,Ne),he;if(xe===null){for(;!Me.done;Ne++,Me=A.next())Me=Y(T,Me.value,V),Me!==null&&(k=i(Me,k,Ne),_e===null?he=Me:_e.sibling=Me,_e=Me);return we&&hl(T,Ne),he}for(xe=n(xe);!Me.done;Ne++,Me=A.next())Me=H(xe,T,Ne,Me.value,V),Me!==null&&(e&&Me.alternate!==null&&xe.delete(Me.key===null?Ne:Me.key),k=i(Me,k,Ne),_e===null?he=Me:_e.sibling=Me,_e=Me);return e&&xe.forEach(function(fh){return t(T,fh)}),we&&hl(T,Ne),he}function qe(T,k,A,V){if(typeof A=="object"&&A!==null&&A.type===L&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case w:e:{for(var he=A.key;k!==null;){if(k.key===he){if(he=A.type,he===L){if(k.tag===7){l(T,k.sibling),V=s(k,A.props.children),V.return=T,T=V;break e}}else if(k.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===te&&ha(he)===k.type){l(T,k.sibling),V=s(k,A.props),Rn(V,A),V.return=T,T=V;break e}l(T,k);break}else t(T,k);k=k.sibling}A.type===L?(V=da(A.props.children,T.mode,V,A.key),V.return=T,T=V):(V=js(A.type,A.key,A.props,null,T.mode,V),Rn(V,A),V.return=T,T=V)}return d(T);case O:e:{for(he=A.key;k!==null;){if(k.key===he)if(k.tag===4&&k.stateNode.containerInfo===A.containerInfo&&k.stateNode.implementation===A.implementation){l(T,k.sibling),V=s(k,A.children||[]),V.return=T,T=V;break e}else{l(T,k);break}else t(T,k);k=k.sibling}V=li(A,T.mode,V),V.return=T,T=V}return d(T);case te:return A=ha(A),qe(T,k,A,V)}if(I(A))return ce(T,k,A,V);if(ie(A)){if(he=ie(A),typeof he!="function")throw Error(u(150));return A=he.call(A),ye(T,k,A,V)}if(typeof A.then=="function")return qe(T,k,ws(A),V);if(A.$$typeof===ee)return qe(T,k,Es(T,A),V);As(T,A)}return typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint"?(A=""+A,k!==null&&k.tag===6?(l(T,k.sibling),V=s(k,A),V.return=T,T=V):(l(T,k),V=ti(A,T.mode,V),V.return=T,T=V),d(T)):l(T,k)}return function(T,k,A,V){try{An=0;var he=qe(T,k,A,V);return Ka=null,he}catch(xe){if(xe===Xa||xe===Cs)throw xe;var _e=Ht(29,xe,null,T.mode);return _e.lanes=V,_e.return=T,_e}finally{}}}var ya=yu(!0),gu=yu(!1),Hl=!1;function pi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function mi(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 Ul(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ql(e,t,l){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(ze&2)!==0){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,t=bs(e),lu(e,null,l),t}return gs(e,n,t,l),bs(e)}function _n(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,l|=n,t.lanes=l,uc(e,l)}}function hi(e,t){var l=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,l===n)){var s=null,i=null;if(l=l.firstBaseUpdate,l!==null){do{var d={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};i===null?s=i=d:i=i.next=d,l=l.next}while(l!==null);i===null?s=i=t:i=i.next=t}else s=i=t;l={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:n.shared,callbacks:n.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var vi=!1;function Mn(){if(vi){var e=Qa;if(e!==null)throw e}}function zn(e,t,l,n){vi=!1;var s=e.updateQueue;Hl=!1;var i=s.firstBaseUpdate,d=s.lastBaseUpdate,h=s.shared.pending;if(h!==null){s.shared.pending=null;var N=h,R=N.next;N.next=null,d===null?i=R:d.next=R,d=N;var U=e.alternate;U!==null&&(U=U.updateQueue,h=U.lastBaseUpdate,h!==d&&(h===null?U.firstBaseUpdate=R:h.next=R,U.lastBaseUpdate=N))}if(i!==null){var Y=s.baseState;d=0,U=R=N=null,h=i;do{var z=h.lane&-536870913,H=z!==h.lane;if(H?(Ce&z)===z:(n&z)===z){z!==0&&z===Ya&&(vi=!0),U!==null&&(U=U.next={lane:0,tag:h.tag,payload:h.payload,callback:null,next:null});e:{var ce=e,ye=h;z=t;var qe=l;switch(ye.tag){case 1:if(ce=ye.payload,typeof ce=="function"){Y=ce.call(qe,Y,z);break e}Y=ce;break e;case 3:ce.flags=ce.flags&-65537|128;case 0:if(ce=ye.payload,z=typeof ce=="function"?ce.call(qe,Y,z):ce,z==null)break e;Y=g({},Y,z);break e;case 2:Hl=!0}}z=h.callback,z!==null&&(e.flags|=64,H&&(e.flags|=8192),H=s.callbacks,H===null?s.callbacks=[z]:H.push(z))}else H={lane:z,tag:h.tag,payload:h.payload,callback:h.callback,next:null},U===null?(R=U=H,N=Y):U=U.next=H,d|=z;if(h=h.next,h===null){if(h=s.shared.pending,h===null)break;H=h,h=H.next,H.next=null,s.lastBaseUpdate=H,s.shared.pending=null}}while(!0);U===null&&(N=Y),s.baseState=N,s.firstBaseUpdate=R,s.lastBaseUpdate=U,i===null&&(s.shared.lanes=0),Xl|=d,e.lanes=d,e.memoizedState=Y}}function bu(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function ju(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)bu(l[e],t)}var $a=j(null),Rs=j(0);function Su(e,t){e=Tl,W(Rs,e),W($a,t),Tl=e|t.baseLanes}function yi(){W(Rs,Tl),W($a,$a.current)}function gi(){Tl=Rs.current,D($a),D(Rs)}var Ut=j(null),It=null;function Vl(e){var t=e.alternate;W(tt,tt.current&1),W(Ut,e),It===null&&(t===null||$a.current!==null||t.memoizedState!==null)&&(It=e)}function bi(e){W(tt,tt.current),W(Ut,e),It===null&&(It=e)}function Nu(e){e.tag===22?(W(tt,tt.current),W(Ut,e),It===null&&(It=e)):Gl()}function Gl(){W(tt,tt.current),W(Ut,Ut.current)}function qt(e){D(Ut),It===e&&(It=null),D(tt)}var tt=j(0);function _s(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||To(l)||wo(l)))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 gl=0,Se=null,He=null,it=null,Ms=!1,Za=!1,ga=!1,zs=0,Ln=0,Ja=null,lm=0;function Ie(){throw Error(u(321))}function ji(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!Bt(e[l],t[l]))return!1;return!0}function Si(e,t,l,n,s,i){return gl=i,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?rd:Bi,ga=!1,i=l(n,s),ga=!1,Za&&(i=ku(t,l,n,s)),Eu(e),i}function Eu(e){E.H=Bn;var t=He!==null&&He.next!==null;if(gl=0,it=He=Se=null,Ms=!1,Ln=0,Ja=null,t)throw Error(u(300));e===null||ot||(e=e.dependencies,e!==null&&Ns(e)&&(ot=!0))}function ku(e,t,l,n){Se=e;var s=0;do{if(Za&&(Ja=null),Ln=0,Za=!1,25<=s)throw Error(u(301));if(s+=1,it=He=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}E.H=id,i=t(l,n)}while(Za);return i}function am(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?Dn(t):t,e=e.useState()[0],(He!==null?He.memoizedState:null)!==e&&(Se.flags|=1024),t}function Ni(){var e=zs!==0;return zs=0,e}function Ei(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function ki(e){if(Ms){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ms=!1}gl=0,it=He=Se=null,Za=!1,Ln=zs=0,Ja=null}function St(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return it===null?Se.memoizedState=it=e:it=it.next=e,it}function lt(){if(He===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=He.next;var t=it===null?Se.memoizedState:it.next;if(t!==null)it=t,He=e;else{if(e===null)throw Se.alternate===null?Error(u(467)):Error(u(310));He=e,e={memoizedState:He.memoizedState,baseState:He.baseState,baseQueue:He.baseQueue,queue:He.queue,next:null},it===null?Se.memoizedState=it=e:it=it.next=e}return it}function Ls(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Dn(e){var t=Ln;return Ln+=1,Ja===null&&(Ja=[]),e=mu(Ja,e,t),t=Se,(it===null?t.memoizedState:it.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?rd:Bi),e}function Ds(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Dn(e);if(e.$$typeof===ee)return yt(e)}throw Error(u(438,String(e)))}function Ci(e){var t=null,l=Se.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var n=Se.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=Ls(),Se.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),n=0;n<e;n++)l[n]=F;return t.index++,l}function bl(e,t){return typeof t=="function"?t(e):t}function Os(e){var t=lt();return Ti(t,He,e)}function Ti(e,t,l){var n=e.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=l;var s=e.baseQueue,i=n.pending;if(i!==null){if(s!==null){var d=s.next;s.next=i.next,i.next=d}t.baseQueue=s=i,n.pending=null}if(i=e.baseState,s===null)e.memoizedState=i;else{t=s.next;var h=d=null,N=null,R=t,U=!1;do{var Y=R.lane&-536870913;if(Y!==R.lane?(Ce&Y)===Y:(gl&Y)===Y){var z=R.revertLane;if(z===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null}),Y===Ya&&(U=!0);else if((gl&z)===z){R=R.next,z===Ya&&(U=!0);continue}else Y={lane:0,revertLane:R.revertLane,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},N===null?(h=N=Y,d=i):N=N.next=Y,Se.lanes|=z,Xl|=z;Y=R.action,ga&&l(i,Y),i=R.hasEagerState?R.eagerState:l(i,Y)}else z={lane:Y,revertLane:R.revertLane,gesture:R.gesture,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},N===null?(h=N=z,d=i):N=N.next=z,Se.lanes|=Y,Xl|=Y;R=R.next}while(R!==null&&R!==t);if(N===null?d=i:N.next=h,!Bt(i,e.memoizedState)&&(ot=!0,U&&(l=Qa,l!==null)))throw l;e.memoizedState=i,e.baseState=d,e.baseQueue=N,n.lastRenderedState=i}return s===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function wi(e){var t=lt(),l=t.queue;if(l===null)throw Error(u(311));l.lastRenderedReducer=e;var n=l.dispatch,s=l.pending,i=t.memoizedState;if(s!==null){l.pending=null;var d=s=s.next;do i=e(i,d.action),d=d.next;while(d!==s);Bt(i,t.memoizedState)||(ot=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),l.lastRenderedState=i}return[i,n]}function Cu(e,t,l){var n=Se,s=lt(),i=we;if(i){if(l===void 0)throw Error(u(407));l=l()}else l=t();var d=!Bt((He||s).memoizedState,l);if(d&&(s.memoizedState=l,ot=!0),s=s.queue,_i(Au.bind(null,n,s,e),[e]),s.getSnapshot!==t||d||it!==null&&it.memoizedState.tag&1){if(n.flags|=2048,Wa(9,{destroy:void 0},wu.bind(null,n,s,l,t),null),Ge===null)throw Error(u(349));i||(gl&127)!==0||Tu(n,t,l)}return l}function Tu(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Se.updateQueue,t===null?(t=Ls(),Se.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function wu(e,t,l,n){t.value=l,t.getSnapshot=n,Ru(t)&&_u(e)}function Au(e,t,l){return l(function(){Ru(t)&&_u(e)})}function Ru(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!Bt(e,l)}catch{return!0}}function _u(e){var t=ua(e,2);t!==null&&zt(t,e,2)}function Ai(e){var t=St();if(typeof e=="function"){var l=e;if(e=l(),ga){nt(!0);try{l()}finally{nt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bl,lastRenderedState:e},t}function Mu(e,t,l,n){return e.baseState=l,Ti(e,He,typeof n=="function"?n:bl)}function nm(e,t,l,n,s){if(Us(e))throw Error(u(485));if(e=t.action,e!==null){var i={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(d){i.listeners.push(d)}};E.T!==null?l(!0):i.isTransition=!1,n(i),l=t.pending,l===null?(i.next=t.pending=i,zu(t,i)):(i.next=l.next,t.pending=l.next=i)}}function zu(e,t){var l=t.action,n=t.payload,s=e.state;if(t.isTransition){var i=E.T,d={};E.T=d;try{var h=l(s,n),N=E.S;N!==null&&N(d,h),Lu(e,t,h)}catch(R){Ri(e,t,R)}finally{i!==null&&d.types!==null&&(i.types=d.types),E.T=i}}else try{i=l(s,n),Lu(e,t,i)}catch(R){Ri(e,t,R)}}function Lu(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(n){Du(e,t,n)},function(n){return Ri(e,t,n)}):Du(e,t,l)}function Du(e,t,l){t.status="fulfilled",t.value=l,Ou(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,zu(e,l)))}function Ri(e,t,l){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=l,Ou(t),t=t.next;while(t!==n)}e.action=null}function Ou(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Bu(e,t){return t}function Hu(e,t){if(we){var l=Ge.formState;if(l!==null){e:{var n=Se;if(we){if(Ke){t:{for(var s=Ke,i=Ft;s.nodeType!==8;){if(!i){s=null;break t}if(s=Pt(s.nextSibling),s===null){s=null;break t}}i=s.data,s=i==="F!"||i==="F"?s:null}if(s){Ke=Pt(s.nextSibling),n=s.data==="F!";break e}}Ol(n)}n=!1}n&&(t=l[0])}}return l=St(),l.memoizedState=l.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bu,lastRenderedState:t},l.queue=n,l=ad.bind(null,Se,n),n.dispatch=l,n=Ai(!1),i=Oi.bind(null,Se,!1,n.queue),n=St(),s={state:t,dispatch:null,action:e,pending:null},n.queue=s,l=nm.bind(null,Se,s,i,l),s.dispatch=l,n.memoizedState=e,[t,l,!1]}function Uu(e){var t=lt();return qu(t,He,e)}function qu(e,t,l){if(t=Ti(e,t,Bu)[0],e=Os(bl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=Dn(t)}catch(d){throw d===Xa?Cs:d}else n=t;t=lt();var s=t.queue,i=s.dispatch;return l!==t.memoizedState&&(Se.flags|=2048,Wa(9,{destroy:void 0},sm.bind(null,s,l),null)),[n,i,e]}function sm(e,t){e.action=t}function Vu(e){var t=lt(),l=He;if(l!==null)return qu(t,l,e);lt(),t=t.memoizedState,l=lt();var n=l.queue.dispatch;return l.memoizedState=e,[t,n,!1]}function Wa(e,t,l,n){return e={tag:e,create:l,deps:n,inst:t,next:null},t=Se.updateQueue,t===null&&(t=Ls(),Se.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(n=l.next,l.next=e,e.next=n,t.lastEffect=e),e}function Gu(){return lt().memoizedState}function Bs(e,t,l,n){var s=St();Se.flags|=e,s.memoizedState=Wa(1|t,{destroy:void 0},l,n===void 0?null:n)}function Hs(e,t,l,n){var s=lt();n=n===void 0?null:n;var i=s.memoizedState.inst;He!==null&&n!==null&&ji(n,He.memoizedState.deps)?s.memoizedState=Wa(t,i,l,n):(Se.flags|=e,s.memoizedState=Wa(1|t,i,l,n))}function Yu(e,t){Bs(8390656,8,e,t)}function _i(e,t){Hs(2048,8,e,t)}function rm(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=Ls(),Se.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function Qu(e){var t=lt().memoizedState;return rm({ref:t,nextImpl:e}),function(){if((ze&2)!==0)throw Error(u(440));return t.impl.apply(void 0,arguments)}}function Xu(e,t){return Hs(4,2,e,t)}function Ku(e,t){return Hs(4,4,e,t)}function $u(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Zu(e,t,l){l=l!=null?l.concat([e]):null,Hs(4,4,$u.bind(null,t,e),l)}function Mi(){}function Ju(e,t){var l=lt();t=t===void 0?null:t;var n=l.memoizedState;return t!==null&&ji(t,n[1])?n[0]:(l.memoizedState=[e,t],e)}function Wu(e,t){var l=lt();t=t===void 0?null:t;var n=l.memoizedState;if(t!==null&&ji(t,n[1]))return n[0];if(n=e(),ga){nt(!0);try{e()}finally{nt(!1)}}return l.memoizedState=[n,t],n}function zi(e,t,l){return l===void 0||(gl&1073741824)!==0&&(Ce&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=Fd(),Se.lanes|=e,Xl|=e,l)}function Fu(e,t,l,n){return Bt(l,t)?l:$a.current!==null?(e=zi(e,l,n),Bt(e,t)||(ot=!0),e):(gl&42)===0||(gl&1073741824)!==0&&(Ce&261930)===0?(ot=!0,e.memoizedState=l):(e=Fd(),Se.lanes|=e,Xl|=e,t)}function Iu(e,t,l,n,s){var i=M.p;M.p=i!==0&&8>i?i:8;var d=E.T,h={};E.T=h,Oi(e,!1,t,l);try{var N=s(),R=E.S;if(R!==null&&R(h,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var U=tm(N,n);On(e,t,U,Yt(e))}else On(e,t,n,Yt(e))}catch(Y){On(e,t,{then:function(){},status:"rejected",reason:Y},Yt())}finally{M.p=i,d!==null&&h.types!==null&&(d.types=h.types),E.T=d}}function im(){}function Li(e,t,l,n){if(e.tag!==5)throw Error(u(476));var s=Pu(e).queue;Iu(e,s,t,ae,l===null?im:function(){return ed(e),l(n)})}function Pu(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bl,lastRenderedState:ae},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bl,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ed(e){var t=Pu(e);t.next===null&&(t=e.alternate.memoizedState),On(e,t.next.queue,{},Yt())}function Di(){return yt(Pn)}function td(){return lt().memoizedState}function ld(){return lt().memoizedState}function om(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=Yt();e=Ul(l);var n=ql(t,e,l);n!==null&&(zt(n,t,l),_n(n,t,l)),t={cache:ui()},e.payload=t;return}t=t.return}}function cm(e,t,l){var n=Yt();l={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Us(e)?nd(t,l):(l=Pr(e,t,l,n),l!==null&&(zt(l,e,n),sd(l,t,n)))}function ad(e,t,l){var n=Yt();On(e,t,l,n)}function On(e,t,l,n){var s={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Us(e))nd(t,s);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,l);if(s.hasEagerState=!0,s.eagerState=h,Bt(h,d))return gs(e,t,s,0),Ge===null&&ys(),!1}catch{}finally{}if(l=Pr(e,t,s,n),l!==null)return zt(l,e,n),sd(l,t,n),!0}return!1}function Oi(e,t,l,n){if(n={lane:2,revertLane:mo(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Us(e)){if(t)throw Error(u(479))}else t=Pr(e,l,n,2),t!==null&&zt(t,e,2)}function Us(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function nd(e,t){Za=Ms=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function sd(e,t,l){if((l&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,l|=n,t.lanes=l,uc(e,l)}}var Bn={readContext:yt,use:Ds,useCallback:Ie,useContext:Ie,useEffect:Ie,useImperativeHandle:Ie,useLayoutEffect:Ie,useInsertionEffect:Ie,useMemo:Ie,useReducer:Ie,useRef:Ie,useState:Ie,useDebugValue:Ie,useDeferredValue:Ie,useTransition:Ie,useSyncExternalStore:Ie,useId:Ie,useHostTransitionStatus:Ie,useFormState:Ie,useActionState:Ie,useOptimistic:Ie,useMemoCache:Ie,useCacheRefresh:Ie};Bn.useEffectEvent=Ie;var rd={readContext:yt,use:Ds,useCallback:function(e,t){return St().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:Yu,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,Bs(4194308,4,$u.bind(null,t,e),l)},useLayoutEffect:function(e,t){return Bs(4194308,4,e,t)},useInsertionEffect:function(e,t){Bs(4,2,e,t)},useMemo:function(e,t){var l=St();t=t===void 0?null:t;var n=e();if(ga){nt(!0);try{e()}finally{nt(!1)}}return l.memoizedState=[n,t],n},useReducer:function(e,t,l){var n=St();if(l!==void 0){var s=l(t);if(ga){nt(!0);try{l(t)}finally{nt(!1)}}}else s=t;return n.memoizedState=n.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},n.queue=e,e=e.dispatch=cm.bind(null,Se,e),[n.memoizedState,e]},useRef:function(e){var t=St();return e={current:e},t.memoizedState=e},useState:function(e){e=Ai(e);var t=e.queue,l=ad.bind(null,Se,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Mi,useDeferredValue:function(e,t){var l=St();return zi(l,e,t)},useTransition:function(){var e=Ai(!1);return e=Iu.bind(null,Se,e.queue,!0,!1),St().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var n=Se,s=St();if(we){if(l===void 0)throw Error(u(407));l=l()}else{if(l=t(),Ge===null)throw Error(u(349));(Ce&127)!==0||Tu(n,t,l)}s.memoizedState=l;var i={value:l,getSnapshot:t};return s.queue=i,Yu(Au.bind(null,n,i,e),[e]),n.flags|=2048,Wa(9,{destroy:void 0},wu.bind(null,n,i,l,t),null),l},useId:function(){var e=St(),t=Ge.identifierPrefix;if(we){var l=cl,n=ol;l=(n&~(1<<32-et(n)-1)).toString(32)+l,t="_"+t+"R_"+l,l=zs++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=lm++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Di,useFormState:Hu,useActionState:Hu,useOptimistic:function(e){var t=St();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Oi.bind(null,Se,!0,l),l.dispatch=t,[e,t]},useMemoCache:Ci,useCacheRefresh:function(){return St().memoizedState=om.bind(null,Se)},useEffectEvent:function(e){var t=St(),l={impl:e};return t.memoizedState=l,function(){if((ze&2)!==0)throw Error(u(440));return l.impl.apply(void 0,arguments)}}},Bi={readContext:yt,use:Ds,useCallback:Ju,useContext:yt,useEffect:_i,useImperativeHandle:Zu,useInsertionEffect:Xu,useLayoutEffect:Ku,useMemo:Wu,useReducer:Os,useRef:Gu,useState:function(){return Os(bl)},useDebugValue:Mi,useDeferredValue:function(e,t){var l=lt();return Fu(l,He.memoizedState,e,t)},useTransition:function(){var e=Os(bl)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:Dn(e),t]},useSyncExternalStore:Cu,useId:td,useHostTransitionStatus:Di,useFormState:Uu,useActionState:Uu,useOptimistic:function(e,t){var l=lt();return Mu(l,He,e,t)},useMemoCache:Ci,useCacheRefresh:ld};Bi.useEffectEvent=Qu;var id={readContext:yt,use:Ds,useCallback:Ju,useContext:yt,useEffect:_i,useImperativeHandle:Zu,useInsertionEffect:Xu,useLayoutEffect:Ku,useMemo:Wu,useReducer:wi,useRef:Gu,useState:function(){return wi(bl)},useDebugValue:Mi,useDeferredValue:function(e,t){var l=lt();return He===null?zi(l,e,t):Fu(l,He.memoizedState,e,t)},useTransition:function(){var e=wi(bl)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:Dn(e),t]},useSyncExternalStore:Cu,useId:td,useHostTransitionStatus:Di,useFormState:Vu,useActionState:Vu,useOptimistic:function(e,t){var l=lt();return He!==null?Mu(l,He,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Ci,useCacheRefresh:ld};id.useEffectEvent=Qu;function Hi(e,t,l,n){t=e.memoizedState,l=l(n,t),l=l==null?t:g({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Ui={enqueueSetState:function(e,t,l){e=e._reactInternals;var n=Yt(),s=Ul(n);s.payload=t,l!=null&&(s.callback=l),t=ql(e,s,n),t!==null&&(zt(t,e,n),_n(t,e,n))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var n=Yt(),s=Ul(n);s.tag=1,s.payload=t,l!=null&&(s.callback=l),t=ql(e,s,n),t!==null&&(zt(t,e,n),_n(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=Yt(),n=Ul(l);n.tag=2,t!=null&&(n.callback=t),t=ql(e,n,l),t!==null&&(zt(t,e,l),_n(t,e,l))}};function od(e,t,l,n,s,i,d){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,i,d):t.prototype&&t.prototype.isPureReactComponent?!Nn(l,n)||!Nn(s,i):!0}function cd(e,t,l,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,n),t.state!==e&&Ui.enqueueReplaceState(t,t.state,null)}function ba(e,t){var l=t;if("ref"in t){l={};for(var n in t)n!=="ref"&&(l[n]=t[n])}if(e=e.defaultProps){l===t&&(l=g({},l));for(var s in e)l[s]===void 0&&(l[s]=e[s])}return l}function ud(e){vs(e)}function dd(e){console.error(e)}function fd(e){vs(e)}function qs(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function xd(e,t,l){try{var n=e.onCaughtError;n(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function qi(e,t,l){return l=Ul(l),l.tag=3,l.payload={element:null},l.callback=function(){qs(e,t)},l}function pd(e){return e=Ul(e),e.tag=3,e}function md(e,t,l,n){var s=l.type.getDerivedStateFromError;if(typeof s=="function"){var i=n.value;e.payload=function(){return s(i)},e.callback=function(){xd(t,l,n)}}var d=l.stateNode;d!==null&&typeof d.componentDidCatch=="function"&&(e.callback=function(){xd(t,l,n),typeof s!="function"&&(Kl===null?Kl=new Set([this]):Kl.add(this));var h=n.stack;this.componentDidCatch(n.value,{componentStack:h!==null?h:""})})}function um(e,t,l,n,s){if(l.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=l.alternate,t!==null&&Ga(t,l,s,!0),l=Ut.current,l!==null){switch(l.tag){case 31:case 13:return It===null?Is():l.alternate===null&&Pe===0&&(Pe=3),l.flags&=-257,l.flags|=65536,l.lanes=s,n===Ts?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([n]):t.add(n),fo(e,n,s)),!1;case 22:return l.flags|=65536,n===Ts?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([n]):l.add(n)),fo(e,n,s)),!1}throw Error(u(435,l.tag))}return fo(e,n,s),Is(),!1}if(we)return t=Ut.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,n!==si&&(e=Error(u(422),{cause:n}),Cn(Zt(e,l)))):(n!==si&&(t=Error(u(423),{cause:n}),Cn(Zt(t,l))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,n=Zt(n,l),s=qi(e.stateNode,n,s),hi(e,s),Pe!==4&&(Pe=2)),!1;var i=Error(u(520),{cause:n});if(i=Zt(i,l),Xn===null?Xn=[i]:Xn.push(i),Pe!==4&&(Pe=2),t===null)return!0;n=Zt(n,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=s&-s,l.lanes|=e,e=qi(l.stateNode,n,e),hi(l,e),!1;case 1:if(t=l.type,i=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(Kl===null||!Kl.has(i))))return l.flags|=65536,s&=-s,l.lanes|=s,s=pd(s),md(s,e,l,n),hi(l,s),!1}l=l.return}while(l!==null);return!1}var Vi=Error(u(461)),ot=!1;function gt(e,t,l,n){t.child=e===null?gu(t,null,l,n):ya(t,e.child,l,n)}function hd(e,t,l,n,s){l=l.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 pa(t),n=Si(e,t,l,d,i,s),h=Ni(),e!==null&&!ot?(Ei(e,t,s),jl(e,t,s)):(we&&h&&ai(t),t.flags|=1,gt(e,t,n,s),t.child)}function vd(e,t,l,n,s){if(e===null){var i=l.type;return typeof i=="function"&&!ei(i)&&i.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=i,yd(e,t,i,n,s)):(e=js(l.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!Ji(e,s)){var d=i.memoizedProps;if(l=l.compare,l=l!==null?l:Nn,l(d,n)&&e.ref===t.ref)return jl(e,t,s)}return t.flags|=1,e=ml(i,n),e.ref=t.ref,e.return=t,t.child=e}function yd(e,t,l,n,s){if(e!==null){var i=e.memoizedProps;if(Nn(i,n)&&e.ref===t.ref)if(ot=!1,t.pendingProps=n=i,Ji(e,s))(e.flags&131072)!==0&&(ot=!0);else return t.lanes=e.lanes,jl(e,t,s)}return Gi(e,t,l,n,s)}function gd(e,t,l,n){var s=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|l:l,e!==null){for(n=t.child=e.child,s=0;n!==null;)s=s|n.lanes|n.childLanes,n=n.sibling;n=s&~i}else n=0,t.child=null;return bd(e,t,i,l,n)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ks(t,i!==null?i.cachePool:null),i!==null?Su(t,i):yi(),Nu(t);else return n=t.lanes=536870912,bd(e,t,i!==null?i.baseLanes|l:l,l,n)}else i!==null?(ks(t,i.cachePool),Su(t,i),Gl(),t.memoizedState=null):(e!==null&&ks(t,null),yi(),Gl());return gt(e,t,s,l),t.child}function Hn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function bd(e,t,l,n,s){var i=fi();return i=i===null?null:{parent:rt._currentValue,pool:i},t.memoizedState={baseLanes:l,cachePool:i},e!==null&&ks(t,null),yi(),Nu(t),e!==null&&Ga(e,t,n,!0),t.childLanes=s,null}function Vs(e,t){return t=Ys({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function jd(e,t,l){return ya(t,e.child,null,l),e=Vs(t,t.pendingProps),e.flags|=2,qt(t),t.memoizedState=null,e}function dm(e,t,l){var n=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(we){if(n.mode==="hidden")return e=Vs(t,n),t.lanes=536870912,Hn(null,e);if(bi(t),(e=Ke)?(e=Lf(e,Ft),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ll!==null?{id:ol,overflow:cl}:null,retryLane:536870912,hydrationErrors:null},l=nu(e),l.return=t,t.child=l,vt=t,Ke=null)):e=null,e===null)throw Ol(t);return t.lanes=536870912,null}return Vs(t,n)}var i=e.memoizedState;if(i!==null){var d=i.dehydrated;if(bi(t),s)if(t.flags&256)t.flags&=-257,t=jd(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(u(558));else if(ot||Ga(e,t,l,!1),s=(l&e.childLanes)!==0,ot||s){if(n=Ge,n!==null&&(d=dc(n,l),d!==0&&d!==i.retryLane))throw i.retryLane=d,ua(e,d),zt(n,e,d),Vi;Is(),t=jd(e,t,l)}else e=i.treeContext,Ke=Pt(d.nextSibling),vt=t,we=!0,Dl=null,Ft=!1,e!==null&&iu(t,e),t=Vs(t,n),t.flags|=4096;return t}return e=ml(e.child,{mode:n.mode,children:n.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Gs(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(u(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Gi(e,t,l,n,s){return pa(t),l=Si(e,t,l,n,void 0,s),n=Ni(),e!==null&&!ot?(Ei(e,t,s),jl(e,t,s)):(we&&n&&ai(t),t.flags|=1,gt(e,t,l,s),t.child)}function Sd(e,t,l,n,s,i){return pa(t),t.updateQueue=null,l=ku(t,n,l,s),Eu(e),n=Ni(),e!==null&&!ot?(Ei(e,t,i),jl(e,t,i)):(we&&n&&ai(t),t.flags|=1,gt(e,t,l,i),t.child)}function Nd(e,t,l,n,s){if(pa(t),t.stateNode===null){var i=Ha,d=l.contextType;typeof d=="object"&&d!==null&&(i=yt(d)),i=new l(n,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Ui,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=n,i.state=t.memoizedState,i.refs={},pi(t),d=l.contextType,i.context=typeof d=="object"&&d!==null?yt(d):Ha,i.state=t.memoizedState,d=l.getDerivedStateFromProps,typeof d=="function"&&(Hi(t,l,d,n),i.state=t.memoizedState),typeof l.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&&Ui.enqueueReplaceState(i,i.state,null),zn(t,n,i,s),Mn(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(e===null){i=t.stateNode;var h=t.memoizedProps,N=ba(l,h);i.props=N;var R=i.context,U=l.contextType;d=Ha,typeof U=="object"&&U!==null&&(d=yt(U));var Y=l.getDerivedStateFromProps;U=typeof Y=="function"||typeof i.getSnapshotBeforeUpdate=="function",h=t.pendingProps!==h,U||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(h||R!==d)&&cd(t,i,n,d),Hl=!1;var z=t.memoizedState;i.state=z,zn(t,n,i,s),Mn(),R=t.memoizedState,h||z!==R||Hl?(typeof Y=="function"&&(Hi(t,l,Y,n),R=t.memoizedState),(N=Hl||od(t,l,N,n,z,R,d))?(U||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=R),i.props=n,i.state=R,i.context=d,n=N):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{i=t.stateNode,mi(e,t),d=t.memoizedProps,U=ba(l,d),i.props=U,Y=t.pendingProps,z=i.context,R=l.contextType,N=Ha,typeof R=="object"&&R!==null&&(N=yt(R)),h=l.getDerivedStateFromProps,(R=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(d!==Y||z!==N)&&cd(t,i,n,N),Hl=!1,z=t.memoizedState,i.state=z,zn(t,n,i,s),Mn();var H=t.memoizedState;d!==Y||z!==H||Hl||e!==null&&e.dependencies!==null&&Ns(e.dependencies)?(typeof h=="function"&&(Hi(t,l,h,n),H=t.memoizedState),(U=Hl||od(t,l,U,n,z,H,N)||e!==null&&e.dependencies!==null&&Ns(e.dependencies))?(R||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(n,H,N),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(n,H,N)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=H),i.props=n,i.state=H,i.context=N,n=U):(typeof i.componentDidUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),n=!1)}return i=n,Gs(e,t),n=(t.flags&128)!==0,i||n?(i=t.stateNode,l=n&&typeof l.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&n?(t.child=ya(t,e.child,null,s),t.child=ya(t,null,l,s)):gt(e,t,l,s),t.memoizedState=i.state,e=t.child):e=jl(e,t,s),e}function Ed(e,t,l,n){return fa(),t.flags|=256,gt(e,t,l,n),t.child}var Yi={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qi(e){return{baseLanes:e,cachePool:xu()}}function Xi(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=Gt),e}function kd(e,t,l){var n=t.pendingProps,s=!1,i=(t.flags&128)!==0,d;if((d=i)||(d=e!==null&&e.memoizedState===null?!1:(tt.current&2)!==0),d&&(s=!0,t.flags&=-129),d=(t.flags&32)!==0,t.flags&=-33,e===null){if(we){if(s?Vl(t):Gl(),(e=Ke)?(e=Lf(e,Ft),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ll!==null?{id:ol,overflow:cl}:null,retryLane:536870912,hydrationErrors:null},l=nu(e),l.return=t,t.child=l,vt=t,Ke=null)):e=null,e===null)throw Ol(t);return wo(e)?t.lanes=32:t.lanes=536870912,null}var h=n.children;return n=n.fallback,s?(Gl(),s=t.mode,h=Ys({mode:"hidden",children:h},s),n=da(n,s,l,null),h.return=t,n.return=t,h.sibling=n,t.child=h,n=t.child,n.memoizedState=Qi(l),n.childLanes=Xi(e,d,l),t.memoizedState=Yi,Hn(null,n)):(Vl(t),Ki(t,h))}var N=e.memoizedState;if(N!==null&&(h=N.dehydrated,h!==null)){if(i)t.flags&256?(Vl(t),t.flags&=-257,t=$i(e,t,l)):t.memoizedState!==null?(Gl(),t.child=e.child,t.flags|=128,t=null):(Gl(),h=n.fallback,s=t.mode,n=Ys({mode:"visible",children:n.children},s),h=da(h,s,l,null),h.flags|=2,n.return=t,h.return=t,n.sibling=h,t.child=n,ya(t,e.child,null,l),n=t.child,n.memoizedState=Qi(l),n.childLanes=Xi(e,d,l),t.memoizedState=Yi,t=Hn(null,n));else if(Vl(t),wo(h)){if(d=h.nextSibling&&h.nextSibling.dataset,d)var R=d.dgst;d=R,n=Error(u(419)),n.stack="",n.digest=d,Cn({value:n,source:null,stack:null}),t=$i(e,t,l)}else if(ot||Ga(e,t,l,!1),d=(l&e.childLanes)!==0,ot||d){if(d=Ge,d!==null&&(n=dc(d,l),n!==0&&n!==N.retryLane))throw N.retryLane=n,ua(e,n),zt(d,e,n),Vi;To(h)||Is(),t=$i(e,t,l)}else To(h)?(t.flags|=192,t.child=e.child,t=null):(e=N.treeContext,Ke=Pt(h.nextSibling),vt=t,we=!0,Dl=null,Ft=!1,e!==null&&iu(t,e),t=Ki(t,n.children),t.flags|=4096);return t}return s?(Gl(),h=n.fallback,s=t.mode,N=e.child,R=N.sibling,n=ml(N,{mode:"hidden",children:n.children}),n.subtreeFlags=N.subtreeFlags&65011712,R!==null?h=ml(R,h):(h=da(h,s,l,null),h.flags|=2),h.return=t,n.return=t,n.sibling=h,t.child=n,Hn(null,n),n=t.child,h=e.child.memoizedState,h===null?h=Qi(l):(s=h.cachePool,s!==null?(N=rt._currentValue,s=s.parent!==N?{parent:N,pool:N}:s):s=xu(),h={baseLanes:h.baseLanes|l,cachePool:s}),n.memoizedState=h,n.childLanes=Xi(e,d,l),t.memoizedState=Yi,Hn(e.child,n)):(Vl(t),l=e.child,e=l.sibling,l=ml(l,{mode:"visible",children:n.children}),l.return=t,l.sibling=null,e!==null&&(d=t.deletions,d===null?(t.deletions=[e],t.flags|=16):d.push(e)),t.child=l,t.memoizedState=null,l)}function Ki(e,t){return t=Ys({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ys(e,t){return e=Ht(22,e,null,t),e.lanes=0,e}function $i(e,t,l){return ya(t,e.child,null,l),e=Ki(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Cd(e,t,l){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),oi(e.return,t,l)}function Zi(e,t,l,n,s,i){var d=e.memoizedState;d===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:l,tailMode:s,treeForkCount:i}:(d.isBackwards=t,d.rendering=null,d.renderingStartTime=0,d.last=n,d.tail=l,d.tailMode=s,d.treeForkCount=i)}function Td(e,t,l){var n=t.pendingProps,s=n.revealOrder,i=n.tail;n=n.children;var d=tt.current,h=(d&2)!==0;if(h?(d=d&1|2,t.flags|=128):d&=1,W(tt,d),gt(e,t,n,l),n=we?kn:0,!h&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cd(e,l,t);else if(e.tag===19)Cd(e,l,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(s){case"forwards":for(l=t.child,s=null;l!==null;)e=l.alternate,e!==null&&_s(e)===null&&(s=l),l=l.sibling;l=s,l===null?(s=t.child,t.child=null):(s=l.sibling,l.sibling=null),Zi(t,!1,s,l,i,n);break;case"backwards":case"unstable_legacy-backwards":for(l=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&_s(e)===null){t.child=s;break}e=s.sibling,s.sibling=l,l=s,s=e}Zi(t,!0,l,null,i,n);break;case"together":Zi(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function jl(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Xl|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Ga(e,t,l,!1),(l&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,l=ml(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=ml(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Ji(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ns(e)))}function fm(e,t,l){switch(t.tag){case 3:Oe(t,t.stateNode.containerInfo),Bl(t,rt,e.memoizedState.cache),fa();break;case 27:case 5:pt(t);break;case 4:Oe(t,t.stateNode.containerInfo);break;case 10:Bl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,bi(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(Vl(t),t.flags|=128,null):(l&t.child.childLanes)!==0?kd(e,t,l):(Vl(t),e=jl(e,t,l),e!==null?e.sibling:null);Vl(t);break;case 19:var s=(e.flags&128)!==0;if(n=(l&t.childLanes)!==0,n||(Ga(e,t,l,!1),n=(l&t.childLanes)!==0),s){if(n)return Td(e,t,l);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),W(tt,tt.current),n)break;return null;case 22:return t.lanes=0,gd(e,t,l,t.pendingProps);case 24:Bl(t,rt,e.memoizedState.cache)}return jl(e,t,l)}function wd(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)ot=!0;else{if(!Ji(e,l)&&(t.flags&128)===0)return ot=!1,fm(e,t,l);ot=(e.flags&131072)!==0}else ot=!1,we&&(t.flags&1048576)!==0&&ru(t,kn,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=ha(t.elementType),t.type=e,typeof e=="function")ei(e)?(n=ba(e,n),t.tag=1,t=Nd(null,t,e,n,l)):(t.tag=0,t=Gi(null,t,e,n,l));else{if(e!=null){var s=e.$$typeof;if(s===K){t.tag=11,t=hd(null,t,e,n,l);break e}else if(s===X){t.tag=14,t=vd(null,t,e,n,l);break e}}throw t=le(e)||e,Error(u(306,t,""))}}return t;case 0:return Gi(e,t,t.type,t.pendingProps,l);case 1:return n=t.type,s=ba(n,t.pendingProps),Nd(e,t,n,s,l);case 3:e:{if(Oe(t,t.stateNode.containerInfo),e===null)throw Error(u(387));n=t.pendingProps;var i=t.memoizedState;s=i.element,mi(e,t),zn(t,n,null,l);var d=t.memoizedState;if(n=d.cache,Bl(t,rt,n),n!==i.cache&&ci(t,[rt],l,!0),Mn(),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=Ed(e,t,n,l);break e}else if(n!==s){s=Zt(Error(u(424)),t),Cn(s),t=Ed(e,t,n,l);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(Ke=Pt(e.firstChild),vt=t,we=!0,Dl=null,Ft=!0,l=gu(t,null,n,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(fa(),n===s){t=jl(e,t,l);break e}gt(e,t,n,l)}t=t.child}return t;case 26:return Gs(e,t),e===null?(l=qf(t.type,null,t.pendingProps,null))?t.memoizedState=l:we||(l=t.type,e=t.pendingProps,n=sr(fe.current).createElement(l),n[ht]=t,n[Tt]=e,bt(n,l,e),ft(n),t.stateNode=n):t.memoizedState=qf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pt(t),e===null&&we&&(n=t.stateNode=Bf(t.type,t.pendingProps,fe.current),vt=t,Ft=!0,s=Ke,Wl(t.type)?(Ao=s,Ke=Pt(n.firstChild)):Ke=s),gt(e,t,t.pendingProps.children,l),Gs(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&we&&((s=n=Ke)&&(n=Gm(n,t.type,t.pendingProps,Ft),n!==null?(t.stateNode=n,vt=t,Ke=Pt(n.firstChild),Ft=!1,s=!0):s=!1),s||Ol(t)),pt(t),s=t.type,i=t.pendingProps,d=e!==null?e.memoizedProps:null,n=i.children,Eo(s,i)?n=null:d!==null&&Eo(s,d)&&(t.flags|=32),t.memoizedState!==null&&(s=Si(e,t,am,null,null,l),Pn._currentValue=s),Gs(e,t),gt(e,t,n,l),t.child;case 6:return e===null&&we&&((e=l=Ke)&&(l=Ym(l,t.pendingProps,Ft),l!==null?(t.stateNode=l,vt=t,Ke=null,e=!0):e=!1),e||Ol(t)),null;case 13:return kd(e,t,l);case 4:return Oe(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=ya(t,null,n,l):gt(e,t,n,l),t.child;case 11:return hd(e,t,t.type,t.pendingProps,l);case 7:return gt(e,t,t.pendingProps,l),t.child;case 8:return gt(e,t,t.pendingProps.children,l),t.child;case 12:return gt(e,t,t.pendingProps.children,l),t.child;case 10:return n=t.pendingProps,Bl(t,t.type,n.value),gt(e,t,n.children,l),t.child;case 9:return s=t.type._context,n=t.pendingProps.children,pa(t),s=yt(s),n=n(s),t.flags|=1,gt(e,t,n,l),t.child;case 14:return vd(e,t,t.type,t.pendingProps,l);case 15:return yd(e,t,t.type,t.pendingProps,l);case 19:return Td(e,t,l);case 31:return dm(e,t,l);case 22:return gd(e,t,l,t.pendingProps);case 24:return pa(t),n=yt(rt),e===null?(s=fi(),s===null&&(s=Ge,i=ui(),s.pooledCache=i,i.refCount++,i!==null&&(s.pooledCacheLanes|=l),s=i),t.memoizedState={parent:n,cache:s},pi(t),Bl(t,rt,s)):((e.lanes&l)!==0&&(mi(e,t),zn(t,null,null,l),Mn()),s=e.memoizedState,i=t.memoizedState,s.parent!==n?(s={parent:n,cache:n},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),Bl(t,rt,n)):(n=i.cache,Bl(t,rt,n),n!==s.cache&&ci(t,[rt],l,!0))),gt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function Sl(e){e.flags|=4}function Wi(e,t,l,n,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(tf())e.flags|=8192;else throw va=Ts,xi}else e.flags&=-16777217}function Ad(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Xf(t))if(tf())e.flags|=8192;else throw va=Ts,xi}function Qs(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?oc():536870912,e.lanes|=t,en|=t)}function Un(e,t){if(!we)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var n=null;l!==null;)l.alternate!==null&&(n=l),l=l.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function $e(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,n=0;if(t)for(var s=e.child;s!==null;)l|=s.lanes|s.childLanes,n|=s.subtreeFlags&65011712,n|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)l|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=l,t}function xm(e,t,l){var n=t.pendingProps;switch(ni(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $e(t),null;case 1:return $e(t),null;case 3:return l=t.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),yl(rt),Re(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Va(t)?Sl(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,ri())),$e(t),null;case 26:var s=t.type,i=t.memoizedState;return e===null?(Sl(t),i!==null?($e(t),Ad(t,i)):($e(t),Wi(t,s,null,n,l))):i?i!==e.memoizedState?(Sl(t),$e(t),Ad(t,i)):($e(t),t.flags&=-16777217):(e=e.memoizedProps,e!==n&&Sl(t),$e(t),Wi(t,s,e,n,l)),null;case 27:if(Lt(t),l=fe.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&Sl(t);else{if(!n){if(t.stateNode===null)throw Error(u(166));return $e(t),null}e=ne.current,Va(t)?ou(t):(e=Bf(s,n,l),t.stateNode=e,Sl(t))}return $e(t),null;case 5:if(Lt(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&Sl(t);else{if(!n){if(t.stateNode===null)throw Error(u(166));return $e(t),null}if(i=ne.current,Va(t))ou(t);else{var d=sr(fe.current);switch(i){case 1:i=d.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:i=d.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":i=d.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":i=d.createElementNS("http://www.w3.org/1998/Math/MathML",s);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(s,{is:n.is}):d.createElement(s)}}i[ht]=t,i[Tt]=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(bt(i,s,n),s){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&Sl(t)}}return $e(t),Wi(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&Sl(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(u(166));if(e=fe.current,Va(t)){if(e=t.stateNode,l=t.memoizedProps,n=null,s=vt,s!==null)switch(s.tag){case 27:case 5:n=s.memoizedProps}e[ht]=t,e=!!(e.nodeValue===l||n!==null&&n.suppressHydrationWarning===!0||Cf(e.nodeValue,l)),e||Ol(t,!0)}else e=sr(e).createTextNode(n),e[ht]=t,t.stateNode=e}return $e(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(n=Va(t),l!==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[ht]=t}else fa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;$e(t),e=!1}else l=ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(qt(t),t):(qt(t),null);if((t.flags&128)!==0)throw Error(u(558))}return $e(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Va(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(u(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(u(317));s[ht]=t}else fa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;$e(t),s=!1}else s=ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(qt(t),t):(qt(t),null)}return qt(t),(t.flags&128)!==0?(t.lanes=l,t):(l=n!==null,e=e!==null&&e.memoizedState!==null,l&&(n=t.child,s=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(s=n.alternate.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==s&&(n.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),Qs(t,t.updateQueue),$e(t),null);case 4:return Re(),e===null&&go(t.stateNode.containerInfo),$e(t),null;case 10:return yl(t.type),$e(t),null;case 19:if(D(tt),n=t.memoizedState,n===null)return $e(t),null;if(s=(t.flags&128)!==0,i=n.rendering,i===null)if(s)Un(n,!1);else{if(Pe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=_s(e),i!==null){for(t.flags|=128,Un(n,!1),e=i.updateQueue,t.updateQueue=e,Qs(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)au(l,e),l=l.sibling;return W(tt,tt.current&1|2),we&&hl(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&We()>Js&&(t.flags|=128,s=!0,Un(n,!1),t.lanes=4194304)}else{if(!s)if(e=_s(i),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Qs(t,e),Un(n,!0),n.tail===null&&n.tailMode==="hidden"&&!i.alternate&&!we)return $e(t),null}else 2*We()-n.renderingStartTime>Js&&l!==536870912&&(t.flags|=128,s=!0,Un(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=We(),e.sibling=null,l=tt.current,W(tt,s?l&1|2:l&1),we&&hl(t,n.treeForkCount),e):($e(t),null);case 22:case 23:return qt(t),gi(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(l&536870912)!==0&&(t.flags&128)===0&&($e(t),t.subtreeFlags&6&&(t.flags|=8192)):$e(t),l=t.updateQueue,l!==null&&Qs(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==l&&(t.flags|=2048),e!==null&&D(ma),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),yl(rt),$e(t),null;case 25:return null;case 30:return null}throw Error(u(156,t.tag))}function pm(e,t){switch(ni(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yl(rt),Re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Lt(t),null;case 31:if(t.memoizedState!==null){if(qt(t),t.alternate===null)throw Error(u(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(qt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return D(tt),null;case 4:return Re(),null;case 10:return yl(t.type),null;case 22:case 23:return qt(t),gi(),e!==null&&D(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return yl(rt),null;case 25:return null;default:return null}}function Rd(e,t){switch(ni(t),t.tag){case 3:yl(rt),Re();break;case 26:case 27:case 5:Lt(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&qt(t);break;case 13:qt(t);break;case 19:D(tt);break;case 10:yl(t.type);break;case 22:case 23:qt(t),gi(),e!==null&&D(ma);break;case 24:yl(rt)}}function qn(e,t){try{var l=t.updateQueue,n=l!==null?l.lastEffect:null;if(n!==null){var s=n.next;l=s;do{if((l.tag&e)===e){n=void 0;var i=l.create,d=l.inst;n=i(),d.destroy=n}l=l.next}while(l!==s)}}catch(h){De(t,t.return,h)}}function Yl(e,t,l){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var i=s.next;n=i;do{if((n.tag&e)===e){var d=n.inst,h=d.destroy;if(h!==void 0){d.destroy=void 0,s=t;var N=l,R=h;try{R()}catch(U){De(s,N,U)}}}n=n.next}while(n!==i)}}catch(U){De(t,t.return,U)}}function _d(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{ju(t,l)}catch(n){De(e,e.return,n)}}}function Md(e,t,l){l.props=ba(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(n){De(e,t,n)}}function Vn(e,t){try{var l=e.ref;if(l!==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 l=="function"?e.refCleanup=l(n):l.current=n}}catch(s){De(e,t,s)}}function ul(e,t){var l=e.ref,n=e.refCleanup;if(l!==null)if(typeof n=="function")try{n()}catch(s){De(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(s){De(e,t,s)}else l.current=null}function zd(e){var t=e.type,l=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break e;case"img":l.src?n.src=l.src:l.srcSet&&(n.srcset=l.srcSet)}}catch(s){De(e,e.return,s)}}function Fi(e,t,l){try{var n=e.stateNode;Om(n,e.type,l,t),n[Tt]=t}catch(s){De(e,e.return,s)}}function Ld(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Wl(e.type)||e.tag===4}function Ii(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ld(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&&Wl(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 Pi(e,t,l){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=xl));else if(n!==4&&(n===27&&Wl(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Pi(e,t,l),e=e.sibling;e!==null;)Pi(e,t,l),e=e.sibling}function Xs(e,t,l){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(n!==4&&(n===27&&Wl(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Xs(e,t,l),e=e.sibling;e!==null;)Xs(e,t,l),e=e.sibling}function Dd(e){var t=e.stateNode,l=e.memoizedProps;try{for(var n=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);bt(t,n,l),t[ht]=e,t[Tt]=l}catch(i){De(e,e.return,i)}}var Nl=!1,ct=!1,eo=!1,Od=typeof WeakSet=="function"?WeakSet:Set,xt=null;function mm(e,t){if(e=e.containerInfo,So=fr,e=Zc(e),$r(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var n=l.getSelection&&l.getSelection();if(n&&n.rangeCount!==0){l=n.anchorNode;var s=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{l.nodeType,i.nodeType}catch{l=null;break e}var d=0,h=-1,N=-1,R=0,U=0,Y=e,z=null;t:for(;;){for(var H;Y!==l||s!==0&&Y.nodeType!==3||(h=d+s),Y!==i||n!==0&&Y.nodeType!==3||(N=d+n),Y.nodeType===3&&(d+=Y.nodeValue.length),(H=Y.firstChild)!==null;)z=Y,Y=H;for(;;){if(Y===e)break t;if(z===l&&++R===s&&(h=d),z===i&&++U===n&&(N=d),(H=Y.nextSibling)!==null)break;Y=z,z=Y.parentNode}Y=H}l=h===-1||N===-1?null:{start:h,end:N}}else l=null}l=l||{start:0,end:0}}else l=null;for(No={focusedElem:e,selectionRange:l},fr=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,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(l=0;l<e.length;l++)s=e[l],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&i!==null){e=void 0,l=t,s=i.memoizedProps,i=i.memoizedState,n=l.stateNode;try{var ce=ba(l.type,s);e=n.getSnapshotBeforeUpdate(ce,i),n.__reactInternalSnapshotBeforeUpdate=e}catch(ye){De(l,l.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Co(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Co(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,xt=e;break}xt=t.return}}function Bd(e,t,l){var n=l.flags;switch(l.tag){case 0:case 11:case 15:kl(e,l),n&4&&qn(5,l);break;case 1:if(kl(e,l),n&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(d){De(l,l.return,d)}else{var s=ba(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(d){De(l,l.return,d)}}n&64&&_d(l),n&512&&Vn(l,l.return);break;case 3:if(kl(e,l),n&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{ju(e,t)}catch(d){De(l,l.return,d)}}break;case 27:t===null&&n&4&&Dd(l);case 26:case 5:kl(e,l),t===null&&n&4&&zd(l),n&512&&Vn(l,l.return);break;case 12:kl(e,l);break;case 31:kl(e,l),n&4&&qd(e,l);break;case 13:kl(e,l),n&4&&Vd(e,l),n&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Em.bind(null,l),Qm(e,l))));break;case 22:if(n=l.memoizedState!==null||Nl,!n){t=t!==null&&t.memoizedState!==null||ct,s=Nl;var i=ct;Nl=n,(ct=t)&&!i?Cl(e,l,(l.subtreeFlags&8772)!==0):kl(e,l),Nl=s,ct=i}break;case 30:break;default:kl(e,l)}}function Hd(e){var t=e.alternate;t!==null&&(e.alternate=null,Hd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Rr(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,At=!1;function El(e,t,l){for(l=l.child;l!==null;)Ud(e,t,l),l=l.sibling}function Ud(e,t,l){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(kt,l)}catch{}switch(l.tag){case 26:ct||ul(l,t),El(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:ct||ul(l,t);var n=Ze,s=At;Wl(l.type)&&(Ze=l.stateNode,At=!1),El(e,t,l),Wn(l.stateNode),Ze=n,At=s;break;case 5:ct||ul(l,t);case 6:if(n=Ze,s=At,Ze=null,El(e,t,l),Ze=n,At=s,Ze!==null)if(At)try{(Ze.nodeType===9?Ze.body:Ze.nodeName==="HTML"?Ze.ownerDocument.body:Ze).removeChild(l.stateNode)}catch(i){De(l,t,i)}else try{Ze.removeChild(l.stateNode)}catch(i){De(l,t,i)}break;case 18:Ze!==null&&(At?(e=Ze,Mf(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),cn(e)):Mf(Ze,l.stateNode));break;case 4:n=Ze,s=At,Ze=l.stateNode.containerInfo,At=!0,El(e,t,l),Ze=n,At=s;break;case 0:case 11:case 14:case 15:Yl(2,l,t),ct||Yl(4,l,t),El(e,t,l);break;case 1:ct||(ul(l,t),n=l.stateNode,typeof n.componentWillUnmount=="function"&&Md(l,t,n)),El(e,t,l);break;case 21:El(e,t,l);break;case 22:ct=(n=ct)||l.memoizedState!==null,El(e,t,l),ct=n;break;default:El(e,t,l)}}function qd(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{cn(e)}catch(l){De(t,t.return,l)}}}function Vd(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{cn(e)}catch(l){De(t,t.return,l)}}function hm(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Od),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Od),t;default:throw Error(u(435,e.tag))}}function Ks(e,t){var l=hm(e);t.forEach(function(n){if(!l.has(n)){l.add(n);var s=km.bind(null,e,n);n.then(s,s)}})}function Rt(e,t){var l=t.deletions;if(l!==null)for(var n=0;n<l.length;n++){var s=l[n],i=e,d=t,h=d;e:for(;h!==null;){switch(h.tag){case 27:if(Wl(h.type)){Ze=h.stateNode,At=!1;break e}break;case 5:Ze=h.stateNode,At=!1;break e;case 3:case 4:Ze=h.stateNode.containerInfo,At=!0;break e}h=h.return}if(Ze===null)throw Error(u(160));Ud(i,d,s),Ze=null,At=!1,i=s.alternate,i!==null&&(i.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Gd(t,e),t=t.sibling}var rl=null;function Gd(e,t){var l=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Rt(t,e),_t(e),n&4&&(Yl(3,e,e.return),qn(3,e),Yl(5,e,e.return));break;case 1:Rt(t,e),_t(e),n&512&&(ct||l===null||ul(l,l.return)),n&64&&Nl&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?n:l.concat(n))));break;case 26:var s=rl;if(Rt(t,e),_t(e),n&512&&(ct||l===null||ul(l,l.return)),n&4){var i=l!==null?l.memoizedState:null;if(n=e.memoizedState,l===null)if(n===null)if(e.stateNode===null){e:{n=e.type,l=e.memoizedProps,s=s.ownerDocument||s;t:switch(n){case"title":i=s.getElementsByTagName("title")[0],(!i||i[pn]||i[ht]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=s.createElement(n),s.head.insertBefore(i,s.querySelector("head > title"))),bt(i,n,l),i[ht]=e,ft(i),n=i;break e;case"link":var d=Yf("link","href",s).get(n+(l.href||""));if(d){for(var h=0;h<d.length;h++)if(i=d[h],i.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&i.getAttribute("rel")===(l.rel==null?null:l.rel)&&i.getAttribute("title")===(l.title==null?null:l.title)&&i.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){d.splice(h,1);break t}}i=s.createElement(n),bt(i,n,l),s.head.appendChild(i);break;case"meta":if(d=Yf("meta","content",s).get(n+(l.content||""))){for(h=0;h<d.length;h++)if(i=d[h],i.getAttribute("content")===(l.content==null?null:""+l.content)&&i.getAttribute("name")===(l.name==null?null:l.name)&&i.getAttribute("property")===(l.property==null?null:l.property)&&i.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&i.getAttribute("charset")===(l.charSet==null?null:l.charSet)){d.splice(h,1);break t}}i=s.createElement(n),bt(i,n,l),s.head.appendChild(i);break;default:throw Error(u(468,n))}i[ht]=e,ft(i),n=i}e.stateNode=n}else Qf(s,e.type,e.stateNode);else e.stateNode=Gf(s,n,e.memoizedProps);else i!==n?(i===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):i.count--,n===null?Qf(s,e.type,e.stateNode):Gf(s,n,e.memoizedProps)):n===null&&e.stateNode!==null&&Fi(e,e.memoizedProps,l.memoizedProps)}break;case 27:Rt(t,e),_t(e),n&512&&(ct||l===null||ul(l,l.return)),l!==null&&n&4&&Fi(e,e.memoizedProps,l.memoizedProps);break;case 5:if(Rt(t,e),_t(e),n&512&&(ct||l===null||ul(l,l.return)),e.flags&32){s=e.stateNode;try{_a(s,"")}catch(ce){De(e,e.return,ce)}}n&4&&e.stateNode!=null&&(s=e.memoizedProps,Fi(e,s,l!==null?l.memoizedProps:s)),n&1024&&(eo=!0);break;case 6:if(Rt(t,e),_t(e),n&4){if(e.stateNode===null)throw Error(u(162));n=e.memoizedProps,l=e.stateNode;try{l.nodeValue=n}catch(ce){De(e,e.return,ce)}}break;case 3:if(or=null,s=rl,rl=rr(t.containerInfo),Rt(t,e),rl=s,_t(e),n&4&&l!==null&&l.memoizedState.isDehydrated)try{cn(t.containerInfo)}catch(ce){De(e,e.return,ce)}eo&&(eo=!1,Yd(e));break;case 4:n=rl,rl=rr(e.stateNode.containerInfo),Rt(t,e),_t(e),rl=n;break;case 12:Rt(t,e),_t(e);break;case 31:Rt(t,e),_t(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Ks(e,n)));break;case 13:Rt(t,e),_t(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Zs=We()),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Ks(e,n)));break;case 22:s=e.memoizedState!==null;var N=l!==null&&l.memoizedState!==null,R=Nl,U=ct;if(Nl=R||s,ct=U||N,Rt(t,e),ct=U,Nl=R,_t(e),n&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(l===null||N||Nl||ct||ja(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){N=l=t;try{if(i=N.stateNode,s)d=i.style,typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none";else{h=N.stateNode;var Y=N.memoizedProps.style,z=Y!=null&&Y.hasOwnProperty("display")?Y.display:null;h.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(ce){De(N,N.return,ce)}}}else if(t.tag===6){if(l===null){N=t;try{N.stateNode.nodeValue=s?"":N.memoizedProps}catch(ce){De(N,N.return,ce)}}}else if(t.tag===18){if(l===null){N=t;try{var H=N.stateNode;s?zf(H,!0):zf(N.stateNode,!1)}catch(ce){De(N,N.return,ce)}}}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;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}n&4&&(n=e.updateQueue,n!==null&&(l=n.retryQueue,l!==null&&(n.retryQueue=null,Ks(e,l))));break;case 19:Rt(t,e),_t(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Ks(e,n)));break;case 30:break;case 21:break;default:Rt(t,e),_t(e)}}function _t(e){var t=e.flags;if(t&2){try{for(var l,n=e.return;n!==null;){if(Ld(n)){l=n;break}n=n.return}if(l==null)throw Error(u(160));switch(l.tag){case 27:var s=l.stateNode,i=Ii(e);Xs(e,i,s);break;case 5:var d=l.stateNode;l.flags&32&&(_a(d,""),l.flags&=-33);var h=Ii(e);Xs(e,h,d);break;case 3:case 4:var N=l.stateNode.containerInfo,R=Ii(e);Pi(e,R,N);break;default:throw Error(u(161))}}catch(U){De(e,e.return,U)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Yd(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Yd(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function kl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Bd(e,t.alternate,t),t=t.sibling}function ja(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Yl(4,t,t.return),ja(t);break;case 1:ul(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Md(t,t.return,l),ja(t);break;case 27:Wn(t.stateNode);case 26:case 5:ul(t,t.return),ja(t);break;case 22:t.memoizedState===null&&ja(t);break;case 30:ja(t);break;default:ja(t)}e=e.sibling}}function Cl(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,s=e,i=t,d=i.flags;switch(i.tag){case 0:case 11:case 15:Cl(s,i,l),qn(4,i);break;case 1:if(Cl(s,i,l),n=i,s=n.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(R){De(n,n.return,R)}if(n=i,s=n.updateQueue,s!==null){var h=n.stateNode;try{var N=s.shared.hiddenCallbacks;if(N!==null)for(s.shared.hiddenCallbacks=null,s=0;s<N.length;s++)bu(N[s],h)}catch(R){De(n,n.return,R)}}l&&d&64&&_d(i),Vn(i,i.return);break;case 27:Dd(i);case 26:case 5:Cl(s,i,l),l&&n===null&&d&4&&zd(i),Vn(i,i.return);break;case 12:Cl(s,i,l);break;case 31:Cl(s,i,l),l&&d&4&&qd(s,i);break;case 13:Cl(s,i,l),l&&d&4&&Vd(s,i);break;case 22:i.memoizedState===null&&Cl(s,i,l),Vn(i,i.return);break;case 30:break;default:Cl(s,i,l)}t=t.sibling}}function to(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&Tn(l))}function lo(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Tn(e))}function il(e,t,l,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Qd(e,t,l,n),t=t.sibling}function Qd(e,t,l,n){var s=t.flags;switch(t.tag){case 0:case 11:case 15:il(e,t,l,n),s&2048&&qn(9,t);break;case 1:il(e,t,l,n);break;case 3:il(e,t,l,n),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Tn(e)));break;case 12:if(s&2048){il(e,t,l,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(N){De(t,t.return,N)}}else il(e,t,l,n);break;case 31:il(e,t,l,n);break;case 13:il(e,t,l,n);break;case 23:break;case 22:i=t.stateNode,d=t.alternate,t.memoizedState!==null?i._visibility&2?il(e,t,l,n):Gn(e,t):i._visibility&2?il(e,t,l,n):(i._visibility|=2,Fa(e,t,l,n,(t.subtreeFlags&10256)!==0||!1)),s&2048&&to(d,t);break;case 24:il(e,t,l,n),s&2048&&lo(t.alternate,t);break;default:il(e,t,l,n)}}function Fa(e,t,l,n,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,d=t,h=l,N=n,R=d.flags;switch(d.tag){case 0:case 11:case 15:Fa(i,d,h,N,s),qn(8,d);break;case 23:break;case 22:var U=d.stateNode;d.memoizedState!==null?U._visibility&2?Fa(i,d,h,N,s):Gn(i,d):(U._visibility|=2,Fa(i,d,h,N,s)),s&&R&2048&&to(d.alternate,d);break;case 24:Fa(i,d,h,N,s),s&&R&2048&&lo(d.alternate,d);break;default:Fa(i,d,h,N,s)}t=t.sibling}}function Gn(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,n=t,s=n.flags;switch(n.tag){case 22:Gn(l,n),s&2048&&to(n.alternate,n);break;case 24:Gn(l,n),s&2048&&lo(n.alternate,n);break;default:Gn(l,n)}t=t.sibling}}var Yn=8192;function Ia(e,t,l){if(e.subtreeFlags&Yn)for(e=e.child;e!==null;)Xd(e,t,l),e=e.sibling}function Xd(e,t,l){switch(e.tag){case 26:Ia(e,t,l),e.flags&Yn&&e.memoizedState!==null&&lh(l,rl,e.memoizedState,e.memoizedProps);break;case 5:Ia(e,t,l);break;case 3:case 4:var n=rl;rl=rr(e.stateNode.containerInfo),Ia(e,t,l),rl=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=Yn,Yn=16777216,Ia(e,t,l),Yn=n):Ia(e,t,l));break;default:Ia(e,t,l)}}function Kd(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 Qn(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var n=t[l];xt=n,Zd(n,e)}Kd(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$d(e),e=e.sibling}function $d(e){switch(e.tag){case 0:case 11:case 15:Qn(e),e.flags&2048&&Yl(9,e,e.return);break;case 3:Qn(e);break;case 12:Qn(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,$s(e)):Qn(e);break;default:Qn(e)}}function $s(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var n=t[l];xt=n,Zd(n,e)}Kd(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Yl(8,t,t.return),$s(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,$s(t));break;default:$s(t)}e=e.sibling}}function Zd(e,t){for(;xt!==null;){var l=xt;switch(l.tag){case 0:case 11:case 15:Yl(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var n=l.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:Tn(l.memoizedState.cache)}if(n=l.child,n!==null)n.return=l,xt=n;else e:for(l=e;xt!==null;){n=xt;var s=n.sibling,i=n.return;if(Hd(n),n===l){xt=null;break e}if(s!==null){s.return=i,xt=s;break e}xt=i}}}var vm={getCacheForType:function(e){var t=yt(rt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return yt(rt).controller.signal}},ym=typeof WeakMap=="function"?WeakMap:Map,ze=0,Ge=null,Ee=null,Ce=0,Le=0,Vt=null,Ql=!1,Pa=!1,ao=!1,Tl=0,Pe=0,Xl=0,Sa=0,no=0,Gt=0,en=0,Xn=null,Mt=null,so=!1,Zs=0,Jd=0,Js=1/0,Ws=null,Kl=null,dt=0,$l=null,tn=null,wl=0,ro=0,io=null,Wd=null,Kn=0,oo=null;function Yt(){return(ze&2)!==0&&Ce!==0?Ce&-Ce:E.T!==null?mo():fc()}function Fd(){if(Gt===0)if((Ce&536870912)===0||we){var e=Ve;Ve<<=1,(Ve&3932160)===0&&(Ve=262144),Gt=e}else Gt=536870912;return e=Ut.current,e!==null&&(e.flags|=32),Gt}function zt(e,t,l){(e===Ge&&(Le===2||Le===9)||e.cancelPendingCommit!==null)&&(ln(e,0),Zl(e,Ce,Gt,!1)),xn(e,l),((ze&2)===0||e!==Ge)&&(e===Ge&&((ze&2)===0&&(Sa|=l),Pe===4&&Zl(e,Ce,Gt,!1)),dl(e))}function Id(e,t,l){if((ze&6)!==0)throw Error(u(327));var n=!l&&(t&127)===0&&(t&e.expiredLanes)===0||fn(e,t),s=n?jm(e,t):uo(e,t,!0),i=n;do{if(s===0){Pa&&!n&&Zl(e,t,0,!1);break}else{if(l=e.current.alternate,i&&!gm(l)){s=uo(e,t,!1),i=!1;continue}if(s===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;s=Xn;var N=h.current.memoizedState.isDehydrated;if(N&&(ln(h,d).flags|=256),d=uo(h,d,!1),d!==2){if(ao&&!N){h.errorRecoveryDisabledLanes|=i,Sa|=i,s=4;break e}i=Mt,Mt=s,i!==null&&(Mt===null?Mt=i:Mt.push.apply(Mt,i))}s=d}if(i=!1,s!==2)continue}}if(s===1){ln(e,0),Zl(e,t,0,!0);break}e:{switch(n=e,i=s,i){case 0:case 1:throw Error(u(345));case 4:if((t&4194048)!==t)break;case 6:Zl(n,t,Gt,!Ql);break e;case 2:Mt=null;break;case 3:case 5:break;default:throw Error(u(329))}if((t&62914560)===t&&(s=Zs+300-We(),10<s)){if(Zl(n,t,Gt,!Ql),Ea(n,0,!0)!==0)break e;wl=t,n.timeoutHandle=Rf(Pd.bind(null,n,l,Mt,Ws,so,t,Gt,Sa,en,Ql,i,"Throttled",-0,0),s);break e}Pd(n,l,Mt,Ws,so,t,Gt,Sa,en,Ql,i,null,-0,0)}}break}while(!0);dl(e)}function Pd(e,t,l,n,s,i,d,h,N,R,U,Y,z,H){if(e.timeoutHandle=-1,Y=t.subtreeFlags,Y&8192||(Y&16785408)===16785408){Y={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xl},Xd(t,i,Y);var ce=(i&62914560)===i?Zs-We():(i&4194048)===i?Jd-We():0;if(ce=ah(Y,ce),ce!==null){wl=i,e.cancelPendingCommit=ce(of.bind(null,e,t,i,l,n,s,d,h,N,U,Y,null,z,H)),Zl(e,i,d,!R);return}}of(e,t,i,l,n,s,d,h,N)}function gm(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var n=0;n<l.length;n++){var s=l[n],i=s.getSnapshot;s=s.value;try{if(!Bt(i(),s))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;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 Zl(e,t,l,n){t&=~no,t&=~Sa,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var s=t;0<s;){var i=31-et(s),d=1<<i;n[i]=-1,s&=~d}l!==0&&cc(e,l,t)}function Fs(){return(ze&6)===0?($n(0),!1):!0}function co(){if(Ee!==null){if(Le===0)var e=Ee.return;else e=Ee,vl=xa=null,ki(e),Ka=null,An=0,e=Ee;for(;e!==null;)Rd(e.alternate,e),e=e.return;Ee=null}}function ln(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,Um(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),wl=0,co(),Ge=e,Ee=l=ml(e.current,null),Ce=t,Le=0,Vt=null,Ql=!1,Pa=fn(e,t),ao=!1,en=Gt=no=Sa=Xl=Pe=0,Mt=Xn=null,so=!1,(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var s=31-et(n),i=1<<s;t|=e[s],n&=~i}return Tl=t,ys(),l}function ef(e,t){Se=null,E.H=Bn,t===Xa||t===Cs?(t=hu(),Le=3):t===xi?(t=hu(),Le=4):Le=t===Vi?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Vt=t,Ee===null&&(Pe=1,qs(e,Zt(t,e.current)))}function tf(){var e=Ut.current;return e===null?!0:(Ce&4194048)===Ce?It===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?e===It:!1}function lf(){var e=E.H;return E.H=Bn,e===null?Bn:e}function af(){var e=E.A;return E.A=vm,e}function Is(){Pe=4,Ql||(Ce&4194048)!==Ce&&Ut.current!==null||(Pa=!0),(Xl&134217727)===0&&(Sa&134217727)===0||Ge===null||Zl(Ge,Ce,Gt,!1)}function uo(e,t,l){var n=ze;ze|=2;var s=lf(),i=af();(Ge!==e||Ce!==t)&&(Ws=null,ln(e,t)),t=!1;var d=Pe;e:do try{if(Le!==0&&Ee!==null){var h=Ee,N=Vt;switch(Le){case 8:co(),d=6;break e;case 3:case 2:case 9:case 6:Ut.current===null&&(t=!0);var R=Le;if(Le=0,Vt=null,an(e,h,N,R),l&&Pa){d=0;break e}break;default:R=Le,Le=0,Vt=null,an(e,h,N,R)}}bm(),d=Pe;break}catch(U){ef(e,U)}while(!0);return t&&e.shellSuspendCounter++,vl=xa=null,ze=n,E.H=s,E.A=i,Ee===null&&(Ge=null,Ce=0,ys()),d}function bm(){for(;Ee!==null;)nf(Ee)}function jm(e,t){var l=ze;ze|=2;var n=lf(),s=af();Ge!==e||Ce!==t?(Ws=null,Js=We()+500,ln(e,t)):Pa=fn(e,t);e:do try{if(Le!==0&&Ee!==null){t=Ee;var i=Vt;t:switch(Le){case 1:Le=0,Vt=null,an(e,t,i,1);break;case 2:case 9:if(pu(i)){Le=0,Vt=null,sf(t);break}t=function(){Le!==2&&Le!==9||Ge!==e||(Le=7),dl(e)},i.then(t,t);break e;case 3:Le=7;break e;case 4:Le=5;break e;case 7:pu(i)?(Le=0,Vt=null,sf(t)):(Le=0,Vt=null,an(e,t,i,7));break;case 5:var d=null;switch(Ee.tag){case 26:d=Ee.memoizedState;case 5:case 27:var h=Ee;if(d?Xf(d):h.stateNode.complete){Le=0,Vt=null;var N=h.sibling;if(N!==null)Ee=N;else{var R=h.return;R!==null?(Ee=R,Ps(R)):Ee=null}break t}}Le=0,Vt=null,an(e,t,i,5);break;case 6:Le=0,Vt=null,an(e,t,i,6);break;case 8:co(),Pe=6;break e;default:throw Error(u(462))}}Sm();break}catch(U){ef(e,U)}while(!0);return vl=xa=null,E.H=n,E.A=s,ze=l,Ee!==null?0:(Ge=null,Ce=0,ys(),Pe)}function Sm(){for(;Ee!==null&&!ll();)nf(Ee)}function nf(e){var t=wd(e.alternate,e,Tl);e.memoizedProps=e.pendingProps,t===null?Ps(e):Ee=t}function sf(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Sd(l,t,t.pendingProps,t.type,void 0,Ce);break;case 11:t=Sd(l,t,t.pendingProps,t.type.render,t.ref,Ce);break;case 5:ki(t);default:Rd(l,t),t=Ee=au(t,Tl),t=wd(l,t,Tl)}e.memoizedProps=e.pendingProps,t===null?Ps(e):Ee=t}function an(e,t,l,n){vl=xa=null,ki(t),Ka=null,An=0;var s=t.return;try{if(um(e,s,t,l,Ce)){Pe=1,qs(e,Zt(l,e.current)),Ee=null;return}}catch(i){if(s!==null)throw Ee=s,i;Pe=1,qs(e,Zt(l,e.current)),Ee=null;return}t.flags&32768?(we||n===1?e=!0:Pa||(Ce&536870912)!==0?e=!1:(Ql=e=!0,(n===2||n===9||n===3||n===6)&&(n=Ut.current,n!==null&&n.tag===13&&(n.flags|=16384))),rf(t,e)):Ps(t)}function Ps(e){var t=e;do{if((t.flags&32768)!==0){rf(t,Ql);return}e=t.return;var l=xm(t.alternate,t,Tl);if(l!==null){Ee=l;return}if(t=t.sibling,t!==null){Ee=t;return}Ee=t=e}while(t!==null);Pe===0&&(Pe=5)}function rf(e,t){do{var l=pm(e.alternate,e);if(l!==null){l.flags&=32767,Ee=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Ee=e;return}Ee=e=l}while(e!==null);Pe=6,Ee=null}function of(e,t,l,n,s,i,d,h,N){e.cancelPendingCommit=null;do er();while(dt!==0);if((ze&6)!==0)throw Error(u(327));if(t!==null){if(t===e.current)throw Error(u(177));if(i=t.lanes|t.childLanes,i|=Ir,tp(e,l,i,d,h,N),e===Ge&&(Ee=Ge=null,Ce=0),tn=t,$l=e,wl=l,ro=i,io=s,Wd=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Cm(at,function(){return xf(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=E.T,E.T=null,s=M.p,M.p=2,d=ze,ze|=4;try{mm(e,t,l)}finally{ze=d,M.p=s,E.T=n}}dt=1,cf(),uf(),df()}}function cf(){if(dt===1){dt=0;var e=$l,t=tn,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=E.T,E.T=null;var n=M.p;M.p=2;var s=ze;ze|=4;try{Gd(t,e);var i=No,d=Zc(e.containerInfo),h=i.focusedElem,N=i.selectionRange;if(d!==h&&h&&h.ownerDocument&&$c(h.ownerDocument.documentElement,h)){if(N!==null&&$r(h)){var R=N.start,U=N.end;if(U===void 0&&(U=R),"selectionStart"in h)h.selectionStart=R,h.selectionEnd=Math.min(U,h.value.length);else{var Y=h.ownerDocument||document,z=Y&&Y.defaultView||window;if(z.getSelection){var H=z.getSelection(),ce=h.textContent.length,ye=Math.min(N.start,ce),qe=N.end===void 0?ye:Math.min(N.end,ce);!H.extend&&ye>qe&&(d=qe,qe=ye,ye=d);var T=Kc(h,ye),k=Kc(h,qe);if(T&&k&&(H.rangeCount!==1||H.anchorNode!==T.node||H.anchorOffset!==T.offset||H.focusNode!==k.node||H.focusOffset!==k.offset)){var A=Y.createRange();A.setStart(T.node,T.offset),H.removeAllRanges(),ye>qe?(H.addRange(A),H.extend(k.node,k.offset)):(A.setEnd(k.node,k.offset),H.addRange(A))}}}}for(Y=[],H=h;H=H.parentNode;)H.nodeType===1&&Y.push({element:H,left:H.scrollLeft,top:H.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<Y.length;h++){var V=Y[h];V.element.scrollLeft=V.left,V.element.scrollTop=V.top}}fr=!!So,No=So=null}finally{ze=s,M.p=n,E.T=l}}e.current=t,dt=2}}function uf(){if(dt===2){dt=0;var e=$l,t=tn,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=E.T,E.T=null;var n=M.p;M.p=2;var s=ze;ze|=4;try{Bd(e,t.alternate,t)}finally{ze=s,M.p=n,E.T=l}}dt=3}}function df(){if(dt===4||dt===3){dt=0,Qt();var e=$l,t=tn,l=wl,n=Wd;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,tn=$l=null,ff(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(Kl=null),wr(l),t=t.stateNode,Fe&&typeof Fe.onCommitFiberRoot=="function")try{Fe.onCommitFiberRoot(kt,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=E.T,s=M.p,M.p=2,E.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{E.T=t,M.p=s}}(wl&3)!==0&&er(),dl(e),s=e.pendingLanes,(l&261930)!==0&&(s&42)!==0?e===oo?Kn++:(Kn=0,oo=e):Kn=0,$n(0)}}function ff(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Tn(t)))}function er(){return cf(),uf(),df(),xf()}function xf(){if(dt!==5)return!1;var e=$l,t=ro;ro=0;var l=wr(wl),n=E.T,s=M.p;try{M.p=32>l?32:l,E.T=null,l=io,io=null;var i=$l,d=wl;if(dt=0,tn=$l=null,wl=0,(ze&6)!==0)throw Error(u(331));var h=ze;if(ze|=4,$d(i.current),Qd(i,i.current,d,l),ze=h,$n(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(kt,i)}catch{}return!0}finally{M.p=s,E.T=n,ff(e,t)}}function pf(e,t,l){t=Zt(l,t),t=qi(e.stateNode,t,2),e=ql(e,t,2),e!==null&&(xn(e,2),dl(e))}function De(e,t,l){if(e.tag===3)pf(e,e,l);else for(;t!==null;){if(t.tag===3){pf(t,e,l);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Kl===null||!Kl.has(n))){e=Zt(l,e),l=pd(2),n=ql(t,l,2),n!==null&&(md(l,n,t,e),xn(n,2),dl(n));break}}t=t.return}}function fo(e,t,l){var n=e.pingCache;if(n===null){n=e.pingCache=new ym;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(l)||(ao=!0,s.add(l),e=Nm.bind(null,e,t,l),t.then(e,e))}function Nm(e,t,l){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Ge===e&&(Ce&l)===l&&(Pe===4||Pe===3&&(Ce&62914560)===Ce&&300>We()-Zs?(ze&2)===0&&ln(e,0):no|=l,en===Ce&&(en=0)),dl(e)}function mf(e,t){t===0&&(t=oc()),e=ua(e,t),e!==null&&(xn(e,t),dl(e))}function Em(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),mf(e,l)}function km(e,t){var l=0;switch(e.tag){case 31:case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(l=s.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),mf(e,l)}function Cm(e,t){return Dt(e,t)}var tr=null,nn=null,xo=!1,lr=!1,po=!1,Jl=0;function dl(e){e!==nn&&e.next===null&&(nn===null?tr=nn=e:nn=nn.next=e),lr=!0,xo||(xo=!0,wm())}function $n(e,t){if(!po&&lr){po=!0;do for(var l=!1,n=tr;n!==null;){if(e!==0){var s=n.pendingLanes;if(s===0)var i=0;else{var d=n.suspendedLanes,h=n.pingedLanes;i=(1<<31-et(42|e)+1)-1,i&=s&~(d&~h),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(l=!0,gf(n,i))}else i=Ce,i=Ea(n,n===Ge?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(i&3)===0||fn(n,i)||(l=!0,gf(n,i));n=n.next}while(l);po=!1}}function Tm(){hf()}function hf(){lr=xo=!1;var e=0;Jl!==0&&Hm()&&(e=Jl);for(var t=We(),l=null,n=tr;n!==null;){var s=n.next,i=vf(n,t);i===0?(n.next=null,l===null?tr=s:l.next=s,s===null&&(nn=l)):(l=n,(e!==0||(i&3)!==0)&&(lr=!0)),n=s}dt!==0&&dt!==5||$n(e),Jl!==0&&(Jl=0)}function vf(e,t){for(var l=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var d=31-et(i),h=1<<d,N=s[d];N===-1?((h&l)===0||(h&n)!==0)&&(s[d]=ep(h,t)):N<=t&&(e.expiredLanes|=h),i&=~h}if(t=Ge,l=Ce,l=Ea(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,l===0||e===t&&(Le===2||Le===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&mt(n),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||fn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(n!==null&&mt(n),wr(l)){case 2:case 8:l=Be;break;case 32:l=at;break;case 268435456:l=Rl;break;default:l=at}return n=yf.bind(null,e),l=Dt(l,n),e.callbackPriority=t,e.callbackNode=l,t}return n!==null&&n!==null&&mt(n),e.callbackPriority=2,e.callbackNode=null,2}function yf(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(er()&&e.callbackNode!==l)return null;var n=Ce;return n=Ea(e,e===Ge?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(Id(e,n,t),vf(e,We()),e.callbackNode!=null&&e.callbackNode===l?yf.bind(null,e):null)}function gf(e,t){if(er())return null;Id(e,t,!0)}function wm(){qm(function(){(ze&6)!==0?Dt($,Tm):hf()})}function mo(){if(Jl===0){var e=Ya;e===0&&(e=st,st<<=1,(st&261888)===0&&(st=256)),Jl=e}return Jl}function bf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:us(""+e)}function jf(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function Am(e,t,l,n,s){if(t==="submit"&&l&&l.stateNode===s){var i=bf((s[Tt]||null).action),d=n.submitter;d&&(t=(t=d[Tt]||null)?bf(t.formAction):d.getAttribute("formAction"),t!==null&&(i=t,d=null));var h=new ps("action","action",null,n,s);e.push({event:h,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(Jl!==0){var N=d?jf(s,d):new FormData(s);Li(l,{pending:!0,data:N,method:s.method,action:i},null,N)}}else typeof i=="function"&&(h.preventDefault(),N=d?jf(s,d):new FormData(s),Li(l,{pending:!0,data:N,method:s.method,action:i},i,N))},currentTarget:s}]})}}for(var ho=0;ho<Fr.length;ho++){var vo=Fr[ho],Rm=vo.toLowerCase(),_m=vo[0].toUpperCase()+vo.slice(1);sl(Rm,"on"+_m)}sl(Fc,"onAnimationEnd"),sl(Ic,"onAnimationIteration"),sl(Pc,"onAnimationStart"),sl("dblclick","onDoubleClick"),sl("focusin","onFocus"),sl("focusout","onBlur"),sl($p,"onTransitionRun"),sl(Zp,"onTransitionStart"),sl(Jp,"onTransitionCancel"),sl(eu,"onTransitionEnd"),Aa("onMouseEnter",["mouseout","mouseover"]),Aa("onMouseLeave",["mouseout","mouseover"]),Aa("onPointerEnter",["pointerout","pointerover"]),Aa("onPointerLeave",["pointerout","pointerover"]),ra("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ra("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ra("onBeforeInput",["compositionend","keypress","textInput","paste"]),ra("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ra("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ra("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zn="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(" "),Mm=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Zn));function Sf(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var n=e[l],s=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],N=h.instance,R=h.currentTarget;if(h=h.listener,N!==i&&s.isPropagationStopped())break e;i=h,s.currentTarget=R;try{i(s)}catch(U){vs(U)}s.currentTarget=null,i=N}else for(d=0;d<n.length;d++){if(h=n[d],N=h.instance,R=h.currentTarget,h=h.listener,N!==i&&s.isPropagationStopped())break e;i=h,s.currentTarget=R;try{i(s)}catch(U){vs(U)}s.currentTarget=null,i=N}}}}function ke(e,t){var l=t[Ar];l===void 0&&(l=t[Ar]=new Set);var n=e+"__bubble";l.has(n)||(Nf(t,e,2,!1),l.add(n))}function yo(e,t,l){var n=0;t&&(n|=4),Nf(l,e,n,t)}var ar="_reactListening"+Math.random().toString(36).slice(2);function go(e){if(!e[ar]){e[ar]=!0,mc.forEach(function(l){l!=="selectionchange"&&(Mm.has(l)||yo(l,!1,e),yo(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ar]||(t[ar]=!0,yo("selectionchange",!1,t))}}function Nf(e,t,l,n){switch(If(t)){case 2:var s=rh;break;case 8:s=ih;break;default:s=Lo}l=s.bind(null,t,l,e),s=void 0,!Hr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,l,{capture:!0,passive:s}):e.addEventListener(t,l,!0):s!==void 0?e.addEventListener(t,l,{passive:s}):e.addEventListener(t,l,!1)}function bo(e,t,l,n,s){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===s)break;if(d===4)for(d=n.return;d!==null;){var N=d.tag;if((N===3||N===4)&&d.stateNode.containerInfo===s)return;d=d.return}for(;h!==null;){if(d=Ca(h),d===null)return;if(N=d.tag,N===5||N===6||N===26||N===27){n=i=d;continue e}h=h.parentNode}}n=n.return}Tc(function(){var R=i,U=Or(l),Y=[];e:{var z=tu.get(e);if(z!==void 0){var H=ps,ce=e;switch(e){case"keypress":if(fs(l)===0)break e;case"keydown":case"keyup":H=kp;break;case"focusin":ce="focus",H=Gr;break;case"focusout":ce="blur",H=Gr;break;case"beforeblur":case"afterblur":H=Gr;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":H=Rc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":H=xp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":H=wp;break;case Fc:case Ic:case Pc:H=hp;break;case eu:H=Rp;break;case"scroll":case"scrollend":H=dp;break;case"wheel":H=Mp;break;case"copy":case"cut":case"paste":H=yp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":H=Mc;break;case"toggle":case"beforetoggle":H=Lp}var ye=(t&4)!==0,qe=!ye&&(e==="scroll"||e==="scrollend"),T=ye?z!==null?z+"Capture":null:z;ye=[];for(var k=R,A;k!==null;){var V=k;if(A=V.stateNode,V=V.tag,V!==5&&V!==26&&V!==27||A===null||T===null||(V=hn(k,T),V!=null&&ye.push(Jn(k,V,A))),qe)break;k=k.return}0<ye.length&&(z=new H(z,ce,null,l,U),Y.push({event:z,listeners:ye}))}}if((t&7)===0){e:{if(z=e==="mouseover"||e==="pointerover",H=e==="mouseout"||e==="pointerout",z&&l!==Dr&&(ce=l.relatedTarget||l.fromElement)&&(Ca(ce)||ce[ka]))break e;if((H||z)&&(z=U.window===U?U:(z=U.ownerDocument)?z.defaultView||z.parentWindow:window,H?(ce=l.relatedTarget||l.toElement,H=R,ce=ce?Ca(ce):null,ce!==null&&(qe=v(ce),ye=ce.tag,ce!==qe||ye!==5&&ye!==27&&ye!==6)&&(ce=null)):(H=null,ce=R),H!==ce)){if(ye=Rc,V="onMouseLeave",T="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(ye=Mc,V="onPointerLeave",T="onPointerEnter",k="pointer"),qe=H==null?z:mn(H),A=ce==null?z:mn(ce),z=new ye(V,k+"leave",H,l,U),z.target=qe,z.relatedTarget=A,V=null,Ca(U)===R&&(ye=new ye(T,k+"enter",ce,l,U),ye.target=A,ye.relatedTarget=qe,V=ye),qe=V,H&&ce)t:{for(ye=zm,T=H,k=ce,A=0,V=T;V;V=ye(V))A++;V=0;for(var he=k;he;he=ye(he))V++;for(;0<A-V;)T=ye(T),A--;for(;0<V-A;)k=ye(k),V--;for(;A--;){if(T===k||k!==null&&T===k.alternate){ye=T;break t}T=ye(T),k=ye(k)}ye=null}else ye=null;H!==null&&Ef(Y,z,H,ye,!1),ce!==null&&qe!==null&&Ef(Y,qe,ce,ye,!0)}}e:{if(z=R?mn(R):window,H=z.nodeName&&z.nodeName.toLowerCase(),H==="select"||H==="input"&&z.type==="file")var _e=qc;else if(Hc(z))if(Vc)_e=Qp;else{_e=Gp;var xe=Vp}else H=z.nodeName,!H||H.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?R&&Lr(R.elementType)&&(_e=qc):_e=Yp;if(_e&&(_e=_e(e,R))){Uc(Y,_e,l,U);break e}xe&&xe(e,z,R),e==="focusout"&&R&&z.type==="number"&&R.memoizedProps.value!=null&&zr(z,"number",z.value)}switch(xe=R?mn(R):window,e){case"focusin":(Hc(xe)||xe.contentEditable==="true")&&(Da=xe,Zr=R,En=null);break;case"focusout":En=Zr=Da=null;break;case"mousedown":Jr=!0;break;case"contextmenu":case"mouseup":case"dragend":Jr=!1,Jc(Y,l,U);break;case"selectionchange":if(Kp)break;case"keydown":case"keyup":Jc(Y,l,U)}var Ne;if(Qr)e:{switch(e){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else La?Oc(e,l)&&(Te="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Te="onCompositionStart");Te&&(zc&&l.locale!=="ko"&&(La||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&La&&(Ne=wc()):(zl=U,Ur="value"in zl?zl.value:zl.textContent,La=!0)),xe=nr(R,Te),0<xe.length&&(Te=new _c(Te,e,null,l,U),Y.push({event:Te,listeners:xe}),Ne?Te.data=Ne:(Ne=Bc(l),Ne!==null&&(Te.data=Ne)))),(Ne=Op?Bp(e,l):Hp(e,l))&&(Te=nr(R,"onBeforeInput"),0<Te.length&&(xe=new _c("onBeforeInput","beforeinput",null,l,U),Y.push({event:xe,listeners:Te}),xe.data=Ne)),Am(Y,e,R,l,U)}Sf(Y,t)})}function Jn(e,t,l){return{instance:e,listener:t,currentTarget:l}}function nr(e,t){for(var l=t+"Capture",n=[];e!==null;){var s=e,i=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||i===null||(s=hn(e,l),s!=null&&n.unshift(Jn(e,s,i)),s=hn(e,t),s!=null&&n.push(Jn(e,s,i))),e.tag===3)return n;e=e.return}return[]}function zm(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ef(e,t,l,n,s){for(var i=t._reactName,d=[];l!==null&&l!==n;){var h=l,N=h.alternate,R=h.stateNode;if(h=h.tag,N!==null&&N===n)break;h!==5&&h!==26&&h!==27||R===null||(N=R,s?(R=hn(l,i),R!=null&&d.unshift(Jn(l,R,N))):s||(R=hn(l,i),R!=null&&d.push(Jn(l,R,N)))),l=l.return}d.length!==0&&e.push({event:t,listeners:d})}var Lm=/\r\n?/g,Dm=/\u0000|\uFFFD/g;function kf(e){return(typeof e=="string"?e:""+e).replace(Lm,`
|
|
49
|
+
`).replace(Dm,"")}function Cf(e,t){return t=kf(t),kf(e)===t}function Ue(e,t,l,n,s,i){switch(l){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||_a(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&_a(e,""+n);break;case"className":os(e,"class",n);break;case"tabIndex":os(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":os(e,l,n);break;case"style":kc(e,n,i);break;case"data":if(t!=="object"){os(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(l);break}n=us(""+n),e.setAttribute(l,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(l,"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"&&(l==="formAction"?(t!=="input"&&Ue(e,t,"name",s.name,s,null),Ue(e,t,"formEncType",s.formEncType,s,null),Ue(e,t,"formMethod",s.formMethod,s,null),Ue(e,t,"formTarget",s.formTarget,s,null)):(Ue(e,t,"encType",s.encType,s,null),Ue(e,t,"method",s.method,s,null),Ue(e,t,"target",s.target,s,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(l);break}n=us(""+n),e.setAttribute(l,n);break;case"onClick":n!=null&&(e.onclick=xl);break;case"onScroll":n!=null&&ke("scroll",e);break;case"onScrollEnd":n!=null&&ke("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(u(61));if(l=n.__html,l!=null){if(s.children!=null)throw Error(u(60));e.innerHTML=l}}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}l=us(""+n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);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(l,""+n):e.removeAttribute(l);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(l,""):e.removeAttribute(l);break;case"capture":case"download":n===!0?e.setAttribute(l,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,n):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(l,n):e.removeAttribute(l);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(l):e.setAttribute(l,n);break;case"popover":ke("beforetoggle",e),ke("toggle",e),is(e,"popover",n);break;case"xlinkActuate":fl(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":fl(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":fl(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":fl(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":fl(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":fl(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":fl(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":fl(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":fl(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":is(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=cp.get(l)||l,is(e,l,n))}}function jo(e,t,l,n,s,i){switch(l){case"style":kc(e,n,i);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(u(61));if(l=n.__html,l!=null){if(s.children!=null)throw Error(u(60));e.innerHTML=l}}break;case"children":typeof n=="string"?_a(e,n):(typeof n=="number"||typeof n=="bigint")&&_a(e,""+n);break;case"onScroll":n!=null&&ke("scroll",e);break;case"onScrollEnd":n!=null&&ke("scrollend",e);break;case"onClick":n!=null&&(e.onclick=xl);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!hc.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(s=l.endsWith("Capture"),t=l.slice(2,s?l.length-7:void 0),i=e[Tt]||null,i=i!=null?i[l]:null,typeof i=="function"&&e.removeEventListener(t,i,s),typeof n=="function")){typeof i!="function"&&i!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,n,s);break e}l in e?e[l]=n:n===!0?e.setAttribute(l,""):is(e,l,n)}}}function bt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ke("error",e),ke("load",e);var n=!1,s=!1,i;for(i in l)if(l.hasOwnProperty(i)){var d=l[i];if(d!=null)switch(i){case"src":n=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:Ue(e,t,i,d,l,null)}}s&&Ue(e,t,"srcSet",l.srcSet,l,null),n&&Ue(e,t,"src",l.src,l,null);return;case"input":ke("invalid",e);var h=i=d=s=null,N=null,R=null;for(n in l)if(l.hasOwnProperty(n)){var U=l[n];if(U!=null)switch(n){case"name":s=U;break;case"type":d=U;break;case"checked":N=U;break;case"defaultChecked":R=U;break;case"value":i=U;break;case"defaultValue":h=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(u(137,t));break;default:Ue(e,t,n,U,l,null)}}jc(e,i,h,N,R,d,s,!1);return;case"select":ke("invalid",e),n=d=i=null;for(s in l)if(l.hasOwnProperty(s)&&(h=l[s],h!=null))switch(s){case"value":i=h;break;case"defaultValue":d=h;break;case"multiple":n=h;default:Ue(e,t,s,h,l,null)}t=i,l=d,e.multiple=!!n,t!=null?Ra(e,!!n,t,!1):l!=null&&Ra(e,!!n,l,!0);return;case"textarea":ke("invalid",e),i=s=n=null;for(d in l)if(l.hasOwnProperty(d)&&(h=l[d],h!=null))switch(d){case"value":n=h;break;case"defaultValue":s=h;break;case"children":i=h;break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(u(91));break;default:Ue(e,t,d,h,l,null)}Nc(e,n,s,i);return;case"option":for(N in l)if(l.hasOwnProperty(N)&&(n=l[N],n!=null))switch(N){case"selected":e.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:Ue(e,t,N,n,l,null)}return;case"dialog":ke("beforetoggle",e),ke("toggle",e),ke("cancel",e),ke("close",e);break;case"iframe":case"object":ke("load",e);break;case"video":case"audio":for(n=0;n<Zn.length;n++)ke(Zn[n],e);break;case"image":ke("error",e),ke("load",e);break;case"details":ke("toggle",e);break;case"embed":case"source":case"link":ke("error",e),ke("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(R in l)if(l.hasOwnProperty(R)&&(n=l[R],n!=null))switch(R){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:Ue(e,t,R,n,l,null)}return;default:if(Lr(t)){for(U in l)l.hasOwnProperty(U)&&(n=l[U],n!==void 0&&jo(e,t,U,n,l,void 0));return}}for(h in l)l.hasOwnProperty(h)&&(n=l[h],n!=null&&Ue(e,t,h,n,l,null))}function Om(e,t,l,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,i=null,d=null,h=null,N=null,R=null,U=null;for(H in l){var Y=l[H];if(l.hasOwnProperty(H)&&Y!=null)switch(H){case"checked":break;case"value":break;case"defaultValue":N=Y;default:n.hasOwnProperty(H)||Ue(e,t,H,null,n,Y)}}for(var z in n){var H=n[z];if(Y=l[z],n.hasOwnProperty(z)&&(H!=null||Y!=null))switch(z){case"type":i=H;break;case"name":s=H;break;case"checked":R=H;break;case"defaultChecked":U=H;break;case"value":d=H;break;case"defaultValue":h=H;break;case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(u(137,t));break;default:H!==Y&&Ue(e,t,z,H,n,Y)}}Mr(e,d,h,N,R,U,i,s);return;case"select":H=d=h=z=null;for(i in l)if(N=l[i],l.hasOwnProperty(i)&&N!=null)switch(i){case"value":break;case"multiple":H=N;default:n.hasOwnProperty(i)||Ue(e,t,i,null,n,N)}for(s in n)if(i=n[s],N=l[s],n.hasOwnProperty(s)&&(i!=null||N!=null))switch(s){case"value":z=i;break;case"defaultValue":h=i;break;case"multiple":d=i;default:i!==N&&Ue(e,t,s,i,n,N)}t=h,l=d,n=H,z!=null?Ra(e,!!l,z,!1):!!n!=!!l&&(t!=null?Ra(e,!!l,t,!0):Ra(e,!!l,l?[]:"",!1));return;case"textarea":H=z=null;for(h in l)if(s=l[h],l.hasOwnProperty(h)&&s!=null&&!n.hasOwnProperty(h))switch(h){case"value":break;case"children":break;default:Ue(e,t,h,null,n,s)}for(d in n)if(s=n[d],i=l[d],n.hasOwnProperty(d)&&(s!=null||i!=null))switch(d){case"value":z=s;break;case"defaultValue":H=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(u(91));break;default:s!==i&&Ue(e,t,d,s,n,i)}Sc(e,z,H);return;case"option":for(var ce in l)if(z=l[ce],l.hasOwnProperty(ce)&&z!=null&&!n.hasOwnProperty(ce))switch(ce){case"selected":e.selected=!1;break;default:Ue(e,t,ce,null,n,z)}for(N in n)if(z=n[N],H=l[N],n.hasOwnProperty(N)&&z!==H&&(z!=null||H!=null))switch(N){case"selected":e.selected=z&&typeof z!="function"&&typeof z!="symbol";break;default:Ue(e,t,N,z,n,H)}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 ye in l)z=l[ye],l.hasOwnProperty(ye)&&z!=null&&!n.hasOwnProperty(ye)&&Ue(e,t,ye,null,n,z);for(R in n)if(z=n[R],H=l[R],n.hasOwnProperty(R)&&z!==H&&(z!=null||H!=null))switch(R){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(u(137,t));break;default:Ue(e,t,R,z,n,H)}return;default:if(Lr(t)){for(var qe in l)z=l[qe],l.hasOwnProperty(qe)&&z!==void 0&&!n.hasOwnProperty(qe)&&jo(e,t,qe,void 0,n,z);for(U in n)z=n[U],H=l[U],!n.hasOwnProperty(U)||z===H||z===void 0&&H===void 0||jo(e,t,U,z,n,H);return}}for(var T in l)z=l[T],l.hasOwnProperty(T)&&z!=null&&!n.hasOwnProperty(T)&&Ue(e,t,T,null,n,z);for(Y in n)z=n[Y],H=l[Y],!n.hasOwnProperty(Y)||z===H||z==null&&H==null||Ue(e,t,Y,z,n,H)}function Tf(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Bm(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),n=0;n<l.length;n++){var s=l[n],i=s.transferSize,d=s.initiatorType,h=s.duration;if(i&&h&&Tf(d)){for(d=0,h=s.responseEnd,n+=1;n<l.length;n++){var N=l[n],R=N.startTime;if(R>h)break;var U=N.transferSize,Y=N.initiatorType;U&&Tf(Y)&&(N=N.responseEnd,d+=U*(N<h?1:(h-R)/(N-R)))}if(--n,t+=8*(i+d)/(s.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 So=null,No=null;function sr(e){return e.nodeType===9?e:e.ownerDocument}function wf(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 Af(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 Eo(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 ko=null;function Hm(){var e=window.event;return e&&e.type==="popstate"?e===ko?!1:(ko=e,!0):(ko=null,!1)}var Rf=typeof setTimeout=="function"?setTimeout:void 0,Um=typeof clearTimeout=="function"?clearTimeout:void 0,_f=typeof Promise=="function"?Promise:void 0,qm=typeof queueMicrotask=="function"?queueMicrotask:typeof _f<"u"?function(e){return _f.resolve(null).then(e).catch(Vm)}:Rf;function Vm(e){setTimeout(function(){throw e})}function Wl(e){return e==="head"}function Mf(e,t){var l=t,n=0;do{var s=l.nextSibling;if(e.removeChild(l),s&&s.nodeType===8)if(l=s.data,l==="/$"||l==="/&"){if(n===0){e.removeChild(s),cn(t);return}n--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")n++;else if(l==="html")Wn(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,Wn(l);for(var i=l.firstChild;i;){var d=i.nextSibling,h=i.nodeName;i[pn]||h==="SCRIPT"||h==="STYLE"||h==="LINK"&&i.rel.toLowerCase()==="stylesheet"||l.removeChild(i),i=d}}else l==="body"&&Wn(e.ownerDocument.body);l=s}while(l);cn(t)}function zf(e,t){var l=e;e=0;do{var n=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),n&&n.nodeType===8)if(l=n.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=n}while(l)}function Co(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Co(l),Rr(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function Gm(e,t,l,n){for(;e.nodeType===1;){var s=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[pn])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!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=Pt(e.nextSibling),e===null)break}return null}function Ym(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Pt(e.nextSibling),e===null))return null;return e}function Lf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Pt(e.nextSibling),e===null))return null;return e}function To(e){return e.data==="$?"||e.data==="$~"}function wo(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Qm(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var n=function(){t(),l.removeEventListener("DOMContentLoaded",n)};l.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function Pt(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 Ao=null;function Df(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Pt(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function Of(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function Bf(e,t,l){switch(t=sr(l),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 Wn(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Rr(e)}var el=new Map,Hf=new Set;function rr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Al=M.d;M.d={f:Xm,r:Km,D:$m,C:Zm,L:Jm,m:Wm,X:Im,S:Fm,M:Pm};function Xm(){var e=Al.f(),t=Fs();return e||t}function Km(e){var t=Ta(e);t!==null&&t.tag===5&&t.type==="form"?ed(t):Al.r(e)}var sn=typeof document>"u"?null:document;function Uf(e,t,l){var n=sn;if(n&&typeof t=="string"&&t){var s=Kt(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof l=="string"&&(s+='[crossorigin="'+l+'"]'),Hf.has(s)||(Hf.add(s),e={rel:e,crossOrigin:l,href:t},n.querySelector(s)===null&&(t=n.createElement("link"),bt(t,"link",e),ft(t),n.head.appendChild(t)))}}function $m(e){Al.D(e),Uf("dns-prefetch",e,null)}function Zm(e,t){Al.C(e,t),Uf("preconnect",e,t)}function Jm(e,t,l){Al.L(e,t,l);var n=sn;if(n&&e&&t){var s='link[rel="preload"][as="'+Kt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(s+='[imagesrcset="'+Kt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(s+='[imagesizes="'+Kt(l.imageSizes)+'"]')):s+='[href="'+Kt(e)+'"]';var i=s;switch(t){case"style":i=rn(e);break;case"script":i=on(e)}el.has(i)||(e=g({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),el.set(i,e),n.querySelector(s)!==null||t==="style"&&n.querySelector(Fn(i))||t==="script"&&n.querySelector(In(i))||(t=n.createElement("link"),bt(t,"link",e),ft(t),n.head.appendChild(t)))}}function Wm(e,t){Al.m(e,t);var l=sn;if(l&&e){var n=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Kt(n)+'"][href="'+Kt(e)+'"]',i=s;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=on(e)}if(!el.has(i)&&(e=g({rel:"modulepreload",href:e},t),el.set(i,e),l.querySelector(s)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(In(i)))return}n=l.createElement("link"),bt(n,"link",e),ft(n),l.head.appendChild(n)}}}function Fm(e,t,l){Al.S(e,t,l);var n=sn;if(n&&e){var s=wa(n).hoistableStyles,i=rn(e);t=t||"default";var d=s.get(i);if(!d){var h={loading:0,preload:null};if(d=n.querySelector(Fn(i)))h.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},l),(l=el.get(i))&&Ro(e,l);var N=d=n.createElement("link");ft(N),bt(N,"link",e),N._p=new Promise(function(R,U){N.onload=R,N.onerror=U}),N.addEventListener("load",function(){h.loading|=1}),N.addEventListener("error",function(){h.loading|=2}),h.loading|=4,ir(d,t,n)}d={type:"stylesheet",instance:d,count:1,state:h},s.set(i,d)}}}function Im(e,t){Al.X(e,t);var l=sn;if(l&&e){var n=wa(l).hoistableScripts,s=on(e),i=n.get(s);i||(i=l.querySelector(In(s)),i||(e=g({src:e,async:!0},t),(t=el.get(s))&&_o(e,t),i=l.createElement("script"),ft(i),bt(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(s,i))}}function Pm(e,t){Al.M(e,t);var l=sn;if(l&&e){var n=wa(l).hoistableScripts,s=on(e),i=n.get(s);i||(i=l.querySelector(In(s)),i||(e=g({src:e,async:!0,type:"module"},t),(t=el.get(s))&&_o(e,t),i=l.createElement("script"),ft(i),bt(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(s,i))}}function qf(e,t,l,n){var s=(s=fe.current)?rr(s):null;if(!s)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=rn(l.href),l=wa(s).hoistableStyles,n=l.get(t),n||(n={type:"style",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=rn(l.href);var i=wa(s).hoistableStyles,d=i.get(e);if(d||(s=s.ownerDocument||s,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,d),(i=s.querySelector(Fn(e)))&&!i._p&&(d.instance=i,d.state.loading=5),el.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},el.set(e,l),i||eh(s,e,l,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=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=on(l),l=wa(s).hoistableScripts,n=l.get(t),n||(n={type:"script",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function rn(e){return'href="'+Kt(e)+'"'}function Fn(e){return'link[rel="stylesheet"]['+e+"]"}function Vf(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function eh(e,t,l,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}),bt(t,"link",l),ft(t),e.head.appendChild(t))}function on(e){return'[src="'+Kt(e)+'"]'}function In(e){return"script[async]"+e}function Gf(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+Kt(l.href)+'"]');if(n)return t.instance=n,ft(n),n;var s=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),ft(n),bt(n,"style",s),ir(n,l.precedence,e),t.instance=n;case"stylesheet":s=rn(l.href);var i=e.querySelector(Fn(s));if(i)return t.state.loading|=4,t.instance=i,ft(i),i;n=Vf(l),(s=el.get(s))&&Ro(n,s),i=(e.ownerDocument||e).createElement("link"),ft(i);var d=i;return d._p=new Promise(function(h,N){d.onload=h,d.onerror=N}),bt(i,"link",n),t.state.loading|=4,ir(i,l.precedence,e),t.instance=i;case"script":return i=on(l.src),(s=e.querySelector(In(i)))?(t.instance=s,ft(s),s):(n=l,(s=el.get(i))&&(n=g({},l),_o(n,s)),e=e.ownerDocument||e,s=e.createElement("script"),ft(s),bt(s,"link",n),e.head.appendChild(s),t.instance=s);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,ir(n,l.precedence,e));return t.instance}function ir(e,t,l){for(var n=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=n.length?n[n.length-1]:null,i=s,d=0;d<n.length;d++){var h=n[d];if(h.dataset.precedence===t)i=h;else if(i!==s)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Ro(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function _o(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var or=null;function Yf(e,t,l){if(or===null){var n=new Map,s=or=new Map;s.set(l,n)}else s=or,n=s.get(l),n||(n=new Map,s.set(l,n));if(n.has(e))return n;for(n.set(e,null),l=l.getElementsByTagName(e),s=0;s<l.length;s++){var i=l[s];if(!(i[pn]||i[ht]||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 Qf(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function th(e,t,l){if(l===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 Xf(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function lh(e,t,l,n){if(l.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var s=rn(n.href),i=t.querySelector(Fn(s));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=cr.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=i,ft(i);return}i=t.ownerDocument||t,n=Vf(n),(s=el.get(s))&&Ro(n,s),i=i.createElement("link"),ft(i);var d=i;d._p=new Promise(function(h,N){d.onload=h,d.onerror=N}),bt(i,"link",n),l.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=cr.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Mo=0;function ah(e,t){return e.stylesheets&&e.count===0&&dr(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var n=setTimeout(function(){if(e.stylesheets&&dr(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&Mo===0&&(Mo=62500*Bm());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&dr(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>Mo?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(s)}}:null}function cr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)dr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ur=null;function dr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ur=new Map,t.forEach(nh,e),ur=null,cr.call(e))}function nh(e,t){if(!(t.state.loading&4)){var l=ur.get(e);if(l)var n=l.get(null);else{l=new Map,ur.set(e,l);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<s.length;i++){var d=s[i];(d.nodeName==="LINK"||d.getAttribute("media")!=="not all")&&(l.set(d.dataset.precedence,d),n=d)}n&&l.set(null,n)}s=t.instance,d=s.getAttribute("data-precedence"),i=l.get(d)||n,i===n&&l.set(null,s),l.set(d,s),this.count++,n=cr.bind(this),s.addEventListener("load",n),s.addEventListener("error",n),i?i.parentNode.insertBefore(s,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var Pn={$$typeof:ee,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function sh(e,t,l,n,s,i,d,h,N){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=Cr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cr(0),this.hiddenUpdates=Cr(null),this.identifierPrefix=n,this.onUncaughtError=s,this.onCaughtError=i,this.onRecoverableError=d,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Kf(e,t,l,n,s,i,d,h,N,R,U,Y){return e=new sh(e,t,l,d,N,R,U,Y,h),t=1,i===!0&&(t|=24),i=Ht(3,null,null,t),e.current=i,i.stateNode=e,t=ui(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:n,isDehydrated:l,cache:t},pi(i),e}function $f(e){return e?(e=Ha,e):Ha}function Zf(e,t,l,n,s,i){s=$f(s),n.context===null?n.context=s:n.pendingContext=s,n=Ul(t),n.payload={element:l},i=i===void 0?null:i,i!==null&&(n.callback=i),l=ql(e,n,t),l!==null&&(zt(l,e,t),_n(l,e,t))}function Jf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function zo(e,t){Jf(e,t),(e=e.alternate)&&Jf(e,t)}function Wf(e){if(e.tag===13||e.tag===31){var t=ua(e,67108864);t!==null&&zt(t,e,67108864),zo(e,67108864)}}function Ff(e){if(e.tag===13||e.tag===31){var t=Yt();t=Tr(t);var l=ua(e,t);l!==null&&zt(l,e,t),zo(e,t)}}var fr=!0;function rh(e,t,l,n){var s=E.T;E.T=null;var i=M.p;try{M.p=2,Lo(e,t,l,n)}finally{M.p=i,E.T=s}}function ih(e,t,l,n){var s=E.T;E.T=null;var i=M.p;try{M.p=8,Lo(e,t,l,n)}finally{M.p=i,E.T=s}}function Lo(e,t,l,n){if(fr){var s=Do(n);if(s===null)bo(e,t,n,xr,l),Pf(e,n);else if(ch(s,e,t,l,n))n.stopPropagation();else if(Pf(e,n),t&4&&-1<oh.indexOf(e)){for(;s!==null;){var i=Ta(s);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var d=Ct(i.pendingLanes);if(d!==0){var h=i;for(h.pendingLanes|=2,h.entangledLanes|=2;d;){var N=1<<31-et(d);h.entanglements[1]|=N,d&=~N}dl(i),(ze&6)===0&&(Js=We()+500,$n(0))}}break;case 31:case 13:h=ua(i,2),h!==null&&zt(h,i,2),Fs(),zo(i,2)}if(i=Do(n),i===null&&bo(e,t,n,xr,l),i===s)break;s=i}s!==null&&n.stopPropagation()}else bo(e,t,n,null,l)}}function Do(e){return e=Or(e),Oo(e)}var xr=null;function Oo(e){if(xr=null,e=Ca(e),e!==null){var t=v(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=p(t),e!==null)return e;e=null}else if(l===31){if(e=b(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xr=e,null}function If(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(Et()){case $:return 2;case Be:return 8;case at:case Je:return 32;case Rl:return 268435456;default:return 32}default:return 32}}var Bo=!1,Fl=null,Il=null,Pl=null,es=new Map,ts=new Map,ea=[],oh="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 Pf(e,t){switch(e){case"focusin":case"focusout":Fl=null;break;case"dragenter":case"dragleave":Il=null;break;case"mouseover":case"mouseout":Pl=null;break;case"pointerover":case"pointerout":es.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ts.delete(t.pointerId)}}function ls(e,t,l,n,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:l,eventSystemFlags:n,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Ta(t),t!==null&&Wf(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function ch(e,t,l,n,s){switch(t){case"focusin":return Fl=ls(Fl,e,t,l,n,s),!0;case"dragenter":return Il=ls(Il,e,t,l,n,s),!0;case"mouseover":return Pl=ls(Pl,e,t,l,n,s),!0;case"pointerover":var i=s.pointerId;return es.set(i,ls(es.get(i)||null,e,t,l,n,s)),!0;case"gotpointercapture":return i=s.pointerId,ts.set(i,ls(ts.get(i)||null,e,t,l,n,s)),!0}return!1}function ex(e){var t=Ca(e.target);if(t!==null){var l=v(t);if(l!==null){if(t=l.tag,t===13){if(t=p(l),t!==null){e.blockedOn=t,xc(e.priority,function(){Ff(l)});return}}else if(t===31){if(t=b(l),t!==null){e.blockedOn=t,xc(e.priority,function(){Ff(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function pr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Do(e.nativeEvent);if(l===null){l=e.nativeEvent;var n=new l.constructor(l.type,l);Dr=n,l.target.dispatchEvent(n),Dr=null}else return t=Ta(l),t!==null&&Wf(t),e.blockedOn=l,!1;t.shift()}return!0}function tx(e,t,l){pr(e)&&l.delete(t)}function uh(){Bo=!1,Fl!==null&&pr(Fl)&&(Fl=null),Il!==null&&pr(Il)&&(Il=null),Pl!==null&&pr(Pl)&&(Pl=null),es.forEach(tx),ts.forEach(tx)}function mr(e,t){e.blockedOn===t&&(e.blockedOn=null,Bo||(Bo=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,uh)))}var hr=null;function lx(e){hr!==e&&(hr=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){hr===e&&(hr=null);for(var t=0;t<e.length;t+=3){var l=e[t],n=e[t+1],s=e[t+2];if(typeof n!="function"){if(Oo(n||l)===null)continue;break}var i=Ta(l);i!==null&&(e.splice(t,3),t-=3,Li(i,{pending:!0,data:s,method:l.method,action:n},n,s))}}))}function cn(e){function t(N){return mr(N,e)}Fl!==null&&mr(Fl,e),Il!==null&&mr(Il,e),Pl!==null&&mr(Pl,e),es.forEach(t),ts.forEach(t);for(var l=0;l<ea.length;l++){var n=ea[l];n.blockedOn===e&&(n.blockedOn=null)}for(;0<ea.length&&(l=ea[0],l.blockedOn===null);)ex(l),l.blockedOn===null&&ea.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(n=0;n<l.length;n+=3){var s=l[n],i=l[n+1],d=s[Tt]||null;if(typeof i=="function")d||lx(l);else if(d){var h=null;if(i&&i.hasAttribute("formAction")){if(s=i,d=i[Tt]||null)h=d.formAction;else if(Oo(s)!==null)continue}else h=d.action;typeof h=="function"?l[n+1]=h:(l.splice(n,3),n-=3),lx(l)}}}function ax(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(d){return s=d})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),n||setTimeout(l,20)}function l(){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,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function Ho(e){this._internalRoot=e}vr.prototype.render=Ho.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));var l=t.current,n=Yt();Zf(l,n,e,t,null,null)},vr.prototype.unmount=Ho.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Zf(e.current,2,null,e,null,null),Fs(),t[ka]=null}};function vr(e){this._internalRoot=e}vr.prototype.unstable_scheduleHydration=function(e){if(e){var t=fc();e={blockedOn:null,target:e,priority:t};for(var l=0;l<ea.length&&t!==0&&t<ea[l].priority;l++);ea.splice(l,0,e),l===0&&ex(e)}};var nx=c.version;if(nx!=="19.2.4")throw Error(u(527,nx,"19.2.4"));M.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?S(e):null,e=e===null?null:e.stateNode,e};var dh={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yr.isDisabled&&yr.supportsFiber)try{kt=yr.inject(dh),Fe=yr}catch{}}return ns.createRoot=function(e,t){if(!x(e))throw Error(u(299));var l=!1,n="",s=ud,i=dd,d=fd;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(d=t.onRecoverableError)),t=Kf(e,1,!1,null,null,l,n,null,s,i,d,ax),e[ka]=t.current,go(e),new Ho(t)},ns.hydrateRoot=function(e,t,l){if(!x(e))throw Error(u(299));var n=!1,s="",i=ud,d=dd,h=fd,N=null;return l!=null&&(l.unstable_strictMode===!0&&(n=!0),l.identifierPrefix!==void 0&&(s=l.identifierPrefix),l.onUncaughtError!==void 0&&(i=l.onUncaughtError),l.onCaughtError!==void 0&&(d=l.onCaughtError),l.onRecoverableError!==void 0&&(h=l.onRecoverableError),l.formState!==void 0&&(N=l.formState)),t=Kf(e,1,!0,t,l??null,n,s,N,i,d,h,ax),t.context=$f(null),l=t.current,n=Yt(),n=Tr(n),s=Ul(n),s.callback=null,ql(l,s,n),l=n,t.current.lanes=l,xn(t,l),dl(t),e[ka]=t.current,go(e),new vr(t)},ns.version="19.2.4",ns}var px;function jh(){if(px)return Vo.exports;px=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(c){console.error(c)}}return r(),Vo.exports=bh(),Vo.exports}var Sh=jh();const tc="";class Ox extends Error{constructor(c,o){super(c),this.name="ApiError",this.status=o}}async function Ae(r,c){const o=await fetch(`${tc}${r}`,c);if(!o.ok){const u=await o.json().catch(()=>({error:o.statusText}));throw new Ox(u.error||`HTTP ${o.status}`,o.status)}return o.json()}const be={getConfig(){return Ae("/api/config")},setConfig(r,c){return Ae("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,model:c})})},getSkills(){return Ae("/api/skills")},getSkillDetail(r,c){return Ae(`/api/skills/${r}/${c}`)},getEvals(r,c){return Ae(`/api/skills/${r}/${c}/evals`)},saveEvals(r,c,o){return Ae(`/api/skills/${r}/${c}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})},generateEvals(r,c){return Ae(`/api/skills/${r}/${c}/generate-evals`,{method:"POST"})},async getLatestBenchmark(r,c){const o=await fetch(`${tc}/api/skills/${r}/${c}/benchmark/latest`);if(o.status===404)return null;if(!o.ok){const u=await o.json().catch(()=>({error:o.statusText}));throw new Ox(u.error||`HTTP ${o.status}`,o.status)}return o.json()},getHistory(r,c,o){const u=new URLSearchParams;o!=null&&o.model&&u.set("model",o.model),o!=null&&o.type&&u.set("type",o.type),o!=null&&o.from&&u.set("from",o.from),o!=null&&o.to&&u.set("to",o.to);const x=u.toString();return Ae(`/api/skills/${r}/${c}/history${x?"?"+x:""}`)},getHistoryEntry(r,c,o){return Ae(`/api/skills/${r}/${c}/history/${encodeURIComponent(o)}`)},compareRuns(r,c,o,u){return Ae(`/api/skills/${r}/${c}/history-compare?a=${encodeURIComponent(o)}&b=${encodeURIComponent(u)}`)},getCaseHistory(r,c,o,u){const x=new URLSearchParams;u&&x.set("model",u);const v=x.toString();return Ae(`/api/skills/${r}/${c}/history/case/${o}${v?"?"+v:""}`)},deleteHistoryEntry(r,c,o){return Ae(`/api/skills/${r}/${c}/history/${encodeURIComponent(o)}`,{method:"DELETE"})},deleteSkill(r,c){return Ae(`/api/skills/${r}/${c}`,{method:"DELETE"})},improveSkill(r,c,o){return Ae(`/api/skills/${r}/${c}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})},instructEdit(r,c,o){return Ae(`/api/skills/${r}/${c}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...o})})},applyImprovement(r,c,o){return Ae(`/api/skills/${r}/${c}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:o})})},getStats(r,c){return Ae(`/api/skills/${r}/${c}/stats`)},getDependencies(r,c){return Ae(`/api/skills/${r}/${c}/dependencies`)},getProjectLayout(){return Ae("/api/project-layout")},createSkill(r){return Ae("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})},saveDraft(r){return Ae("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})},getSkillCreatorStatus(){return Ae("/api/skill-creator-status")},generateSkill(r){return Ae("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})},getSkillFiles(r,c){return Ae(`/api/skills/${r}/${c}/files`)},getSkillFile(r,c,o){return Ae(`/api/skills/${r}/${c}/file?path=${encodeURIComponent(o)}`)},saveSkillFile(r,c,o,u){return Ae(`/api/skills/${r}/${c}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:o,content:u})})},getLeaderboard(r,c){return Ae(`/api/skills/${r}/${c}/leaderboard`)},getLeaderboardEntry(r,c,o){return Ae(`/api/skills/${r}/${c}/leaderboard/${encodeURIComponent(o)}`)},startSweep(r,c,o){const u=`${tc}/api/skills/${r}/${c}/sweep`,x=new EventSource(u);return fetch(u,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(o)}),x},getCredentials(r,c){return Ae(`/api/credentials/${r}/${c}`)},setCredential(r,c,o,u){return Ae(`/api/credentials/${r}/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:o,value:u})})},getParams(r,c){return Ae(`/api/credentials/${r}/${c}/params`)},getParamsRevealed(r,c,o){const u=o?`reveal=true&key=${encodeURIComponent(o)}`:"reveal=true";return Ae(`/api/credentials/${r}/${c}/params?${u}`)},searchModels(){return Ae("/api/openrouter/models")}};function Nh(r){const[c,o]=m.useState(()=>typeof window>"u"?!1:window.matchMedia(r).matches);return m.useEffect(()=>{const u=window.matchMedia(r);o(u.matches);const x=v=>o(v.matches);return u.addEventListener("change",x),()=>u.removeEventListener("change",x)},[r]),c}const Eh={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list"};function kh(r,c){switch(c.type){case"SELECT_SKILL":return{...r,selectedSkill:c.skill,mode:"browse",mobileView:r.isMobile?"detail":r.mobileView};case"CLEAR_SELECTION":return{...r,selectedSkill:null};case"SET_MODE":return{...r,mode:c.mode,selectedSkill:c.mode==="create"?null:r.selectedSkill};case"SET_SEARCH":return{...r,searchQuery:c.query};case"SET_SKILLS":return{...r,skills:c.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...r,skillsError:c.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...r,skillsLoading:c.loading};case"SET_MOBILE":return{...r,isMobile:c.isMobile};case"SET_MOBILE_VIEW":return{...r,mobileView:c.view};default:return r}}const Bx=m.createContext(null);function na(){const r=m.useContext(Bx);if(!r)throw new Error("useStudio must be used within StudioProvider");return r}function Ch({children:r}){const[c,o]=m.useReducer(kh,Eh),u=Nh("(max-width: 767px)");m.useEffect(()=>{o({type:"SET_MOBILE",isMobile:u})},[u]);const x=m.useCallback(()=>{o({type:"SET_SKILLS_LOADING",loading:!0}),be.getSkills().then(g=>{o({type:"SET_SKILLS",skills:g});const w=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(w){const[,O,L]=w,G=g.find(q=>q.plugin===O&&q.skill===L);G&&o({type:"SELECT_SKILL",skill:{plugin:O,skill:L,origin:G.origin}})}}).catch(g=>o({type:"SET_SKILLS_ERROR",error:g.message}))},[]);m.useEffect(()=>{x()},[x]);const v=m.useCallback(g=>{o({type:"SELECT_SKILL",skill:g}),window.location.hash=`/skills/${g.plugin}/${g.skill}`},[]),p=m.useCallback(()=>{o({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),b=m.useCallback(g=>{o({type:"SET_MODE",mode:g})},[]),y=m.useCallback(g=>{o({type:"SET_SEARCH",query:g})},[]),f=m.useCallback(g=>{o({type:"SET_MOBILE_VIEW",view:g})},[]),S=m.useMemo(()=>({state:c,selectSkill:v,clearSelection:p,setMode:b,setSearch:y,setMobileView:f,refreshSkills:x}),[c,v,p,b,y,f,x]);return a.jsx(Bx.Provider,{value:S,children:r})}const Th={config:null,loading:!0};function wh(r,c){switch(c.type){case"SET_CONFIG":return{config:c.config,loading:!1};case"SET_LOADING":return{...r,loading:!0};default:return r}}const Hx=m.createContext(null);function Na(){const r=m.useContext(Hx);if(!r)throw new Error("useConfig must be used within ConfigProvider");return r}function Ah({children:r}){const[c,o]=m.useReducer(wh,Th),u=m.useCallback(()=>{be.getConfig().then(p=>o({type:"SET_CONFIG",config:p})).catch(()=>{})},[]);m.useEffect(()=>{u()},[u]);const x=m.useCallback(async(p,b)=>{const y=await be.setConfig(p,b);return o({type:"SET_CONFIG",config:y}),y},[]),v=m.useMemo(()=>({config:c.config,loading:c.loading,updateConfig:x,refreshConfig:u}),[c,x,u]);return a.jsx(Hx.Provider,{value:v,children:r})}function Rh({left:r,right:c}){const{state:o}=na();return o.isMobile?a.jsx("div",{style:{height:"100vh",overflow:"hidden",background:"var(--surface-0)"},children:o.mobileView==="list"?a.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--surface-1)"},children:r}):a.jsx("div",{style:{height:"100%",overflowY:"auto"},children:c})}):a.jsxs("div",{className:"studio-grid",style:{display:"grid",gridTemplateColumns:"280px 1px 1fr",height:"100vh",overflow:"hidden"},children:[a.jsx("div",{style:{overflowY:"auto",background:"var(--surface-1)"},children:r}),a.jsx("div",{style:{background:"var(--border-subtle)"}}),a.jsx("div",{style:{overflowY:"auto",background:"var(--surface-0)"},children:c})]})}function _h(){const{state:r,setSearch:c}=na(),[o,u]=m.useState(r.searchQuery),x=m.useRef(null);m.useEffect(()=>(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{c(o)},200),()=>{x.current&&clearTimeout(x.current)}),[o,c]),m.useEffect(()=>{r.searchQuery===""&&o!==""&&u("")},[r.searchQuery]);const v=new Set(r.skills.map(p=>p.plugin)).size;return a.jsxs("div",{className:"px-3 py-2",children:[a.jsxs("div",{className:"relative",children:[a.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:[a.jsx("circle",{cx:"11",cy:"11",r:"8"}),a.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),a.jsx("input",{type:"text",value:o,onChange:p=>u(p.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:p=>{p.currentTarget.style.borderColor="var(--accent)"},onBlur:p=>{p.currentTarget.style.borderColor="var(--border-subtle)"}}),o&&a.jsx("button",{onClick:()=>{u(""),c("")},style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:2},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!r.skillsLoading&&a.jsxs("div",{className:"text-[11px] mt-1.5 px-1",style:{color:"var(--text-tertiary)"},children:[r.skills.length," skill",r.skills.length!==1?"s":""," across ",v," plugin",v!==1?"s":""]})]})}const mx={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 hx({skill:r,isSelected:c,onSelect:o}){const u=mx[r.benchmarkStatus]||mx.missing,x=r.origin==="installed";return a.jsxs("button",{onClick:o,className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:c?"var(--surface-2)":"transparent",cursor:"pointer",borderTop:"none",borderRight:"none",borderBottom:"1px solid var(--border-subtle)",borderLeft:c?"2px solid var(--accent)":"2px solid transparent",display:"block",opacity:x?.7:1},onMouseEnter:v=>{c||(v.currentTarget.style.background="var(--surface-2)")},onMouseLeave:v=>{c||(v.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsxs("span",{className:"flex items-center gap-1.5 text-[13px] font-medium truncate",style:{color:"var(--text-primary)"},children:[x&&a.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:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),r.skill]}),a.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:[a.jsx("span",{className:"rounded-full",style:{width:5,height:5,background:u.dot}}),u.label]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:[r.evalCount," eval",r.evalCount!==1?"s":""]}),a.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),a.jsxs("span",{children:[r.assertionCount," assert",r.assertionCount!==1?"s":""]}),r.lastBenchmark&&a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),a.jsx("span",{children:new Date(r.lastBenchmark).toLocaleDateString()})]})]})]})}function vx(r){var o;const c={};for(const u of r)(c[o=u.plugin]||(c[o]=[])).push(u);return c}function Mh(){const{state:r,selectSkill:c}=na(),{skills:o,searchQuery:u,selectedSkill:x}=r,[v,p]=m.useState(!1),[b,y]=m.useState(()=>{try{return sessionStorage.getItem("vskill-origin-banner-dismissed")==="1"}catch{return!1}}),{sourceGroups:f,installedGroups:S}=m.useMemo(()=>{const g=u.toLowerCase(),C=g?o.filter(L=>L.skill.toLowerCase().includes(g)||L.plugin.toLowerCase().includes(g)):o,w=C.filter(L=>L.origin==="source"),O=C.filter(L=>L.origin==="installed");return{sourceGroups:Object.entries(vx(w)),installedGroups:Object.entries(vx(O))}},[o,u]);return r.skillsLoading?a.jsx("div",{className:"px-3 py-4 space-y-3",children:[1,2,3].map(g=>a.jsx("div",{className:"skeleton h-14 w-full rounded-lg"},g))}):f.length===0&&S.length===0?a.jsx("div",{className:"px-4 py-8 text-center",children:a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No skills match your search"})}):a.jsxs("div",{className:"flex-1",children:[f.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(zh,{title:"Your Skills",count:f.reduce((g,[,C])=>g+C.length,0)}),f.map(([g,C])=>a.jsxs("div",{children:[a.jsx(yx,{plugin:g,count:C.length}),C.map(w=>{const O=(x==null?void 0:x.plugin)===w.plugin&&(x==null?void 0:x.skill)===w.skill;return a.jsx(hx,{skill:w,isSelected:O,onSelect:()=>c({plugin:w.plugin,skill:w.skill,origin:w.origin})},`${w.plugin}/${w.skill}`)})]},g))]}),S.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>p(g=>!g),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:[a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Installed"}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",S.reduce((g,[,C])=>g+C.length,0),")"]}),a.jsx("div",{className:"flex-1"}),a.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:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]}),v&&a.jsxs(a.Fragment,{children:[!b&&a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2",style:{background:"var(--surface-1)",borderBottom:"1px solid var(--border-subtle)"},children:[a.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."}),a.jsx("button",{onClick:()=>{y(!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:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),S.map(([g,C])=>a.jsxs("div",{children:[a.jsx(yx,{plugin:g,count:C.length}),C.map(w=>{const O=(x==null?void 0:x.plugin)===w.plugin&&(x==null?void 0:x.skill)===w.skill;return a.jsx(hx,{skill:w,isSelected:O,onSelect:()=>c({plugin:w.plugin,skill:w.skill,origin:w.origin})},`${w.plugin}/${w.skill}`)})]},g))]})]})]})}function zh({title:r,count:c}){return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--surface-1)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-secondary)"},children:r}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",c,")"]})]})}function yx({plugin:r,count:c}){const[o,u]=m.useState(!1),x=`/images/icons/${r}.webp`;return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[o?a.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:a.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"})}):a.jsx("img",{src:x,width:16,height:16,alt:"",onError:()=>u(!0),style:{objectFit:"contain"}}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:r}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",c,")"]}),a.jsx("div",{className:"flex-1 h-px",style:{background:"var(--border-subtle)"}})]})}function Lh({value:r,onChange:c}){const[o,u]=m.useState([]),[x,v]=m.useState(!1),[p,b]=m.useState(null),[y,f]=m.useState(r),[S,g]=m.useState(!1),C=m.useRef(null),w=m.useRef(void 0);m.useEffect(()=>{v(!0),be.searchModels().then(q=>u(q.models)).catch(q=>b(q instanceof Error?q.message:String(q))).finally(()=>v(!1))},[]);const O=m.useCallback(q=>{f(q),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>g(!0),300)},[]),L=m.useMemo(()=>{if(!y.trim())return o.slice(0,50);const q=y.toLowerCase();return o.filter(J=>J.id.toLowerCase().includes(q)||J.name.toLowerCase().includes(q)).slice(0,50)},[o,y]);m.useEffect(()=>{function q(J){C.current&&!C.current.contains(J.target)&&g(!1)}return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[]);function G(q){var K;const J=(K=q.pricing)==null?void 0:K.prompt;return J==null||J===0?"Free":`$${(J*1e6).toFixed(2)}/1M`}return a.jsxs("div",{ref:C,style:{position:"relative"},children:[a.jsx("input",{type:"text",value:y,onChange:q=>O(q.target.value),onFocus:()=>g(!0),placeholder:x?"Loading models...":"Search OpenRouter models...",className:"input-field w-full",style:{fontSize:12}}),S&&!x&&a.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:[p&&a.jsxs("div",{className:"px-3 py-2 text-[11px]",style:{color:"var(--red)"},children:["Failed to load models: ",p]}),L.length===0&&!p&&a.jsx("div",{className:"px-3 py-3 text-[11px]",style:{color:"var(--text-tertiary)"},children:"No models found"}),L.map(q=>a.jsxs("button",{onClick:()=>{c(q.id),f(q.id),g(!1)},className:"w-full text-left px-3 py-2 flex items-center justify-between transition-colors duration-100",style:{background:q.id===r?"var(--accent-muted)":"transparent",border:"none",cursor:"pointer",borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:J=>{J.currentTarget.style.background="var(--surface-3)"},onMouseLeave:J=>{J.currentTarget.style.background=q.id===r?"var(--accent-muted)":"transparent"},children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:q.name}),a.jsx("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:q.id})]}),a.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:G(q)})]},q.id))]})]})}function Dh(){const{config:r,updateConfig:c,refreshConfig:o}=Na(),[u,x]=m.useState(!1),[v,p]=m.useState(!1),b=m.useRef(null);m.useEffect(()=>{function g(C){b.current&&!b.current.contains(C.target)&&x(!1)}return u&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[u]);async function y(g,C){p(!0);try{await c(g.id,C.id),x(!1)}catch{o()}finally{p(!1)}}if(!r)return null;const f=Bh(r),S=Oh(r);return a.jsxs("div",{ref:b,className:"relative",children:[a.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:g=>{u||(g.currentTarget.style.borderColor="var(--accent)")},onMouseLeave:g=>{u||(g.currentTarget.style.borderColor="var(--border-subtle)")},children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:S!=null&&S.available?"var(--green)":"var(--text-tertiary)"}}),a.jsx("span",{className:"flex-1 text-left font-medium truncate",style:{color:"var(--text-primary)"},children:f}),a.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:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),u&&a.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:[a.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Select Model"})}),a.jsx("div",{className:"py-1 max-h-72 overflow-y-auto",children:r.providers.map(g=>a.jsxs("div",{children:[a.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:g.available?"var(--green)":"var(--text-tertiary)",opacity:g.available?1:.3}}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",opacity:g.available?1:.5},children:g.label})]}),g.id==="openrouter"&&g.available?a.jsx("div",{className:"px-3 py-1.5",children:a.jsx(Lh,{value:r.provider==="openrouter"?r.model:"",onChange:C=>{v||y(g,{id:C,label:C})}})}):g.models.map(C=>{const w=Ux(r,g.id,C.id),O=!g.available||v;return a.jsxs("button",{onClick:()=>!O&&y(g,C),disabled:O,className:"w-full px-3 py-1.5 flex items-center gap-2.5 text-left transition-all duration-100",style:{background:w?"var(--accent-muted)":"transparent",color:O?"var(--text-tertiary)":"var(--text-primary)",opacity:O?.4:1,cursor:O?"not-allowed":"pointer"},onMouseEnter:L=>{!O&&!w&&(L.currentTarget.style.background="var(--surface-3)")},onMouseLeave:L=>{w||(L.currentTarget.style.background="transparent")},children:[a.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 flex items-center justify-center",style:{border:`2px solid ${w?"var(--accent)":"var(--border-subtle)"}`},children:w&&a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}})}),a.jsx("span",{className:"text-[12px]",style:{fontWeight:w?600:400},title:C.id,children:C.label})]},`${g.id}-${C.id}`)})]},g.id))})]})]})}function Ux(r,c,o){return r.provider!==c?!1:r.model===o}function Oh(r){return r.providers.find(c=>c.id===r.provider)}function Bh(r){for(const c of r.providers)for(const o of c.models)if(Ux(r,c.id,o.id))return o.label;return r.model}function Hh(){const{state:r,setMode:c}=na(),{config:o}=Na(),[u,x]=m.useState(null),[v,p]=m.useState(!1);return m.useEffect(()=>{be.getSkillCreatorStatus().then(x).catch(()=>{})},[]),a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"px-4 py-4 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:"var(--accent-muted)"},children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-[14px] font-semibold truncate",style:{color:"var(--text-primary)",letterSpacing:"-0.01em"},children:"Skill Studio"}),a.jsx("div",{className:"text-[11px] truncate",style:{color:"var(--text-tertiary)"},children:(o==null?void 0:o.projectName)||"vskill"})]})]}),a.jsx("div",{className:"mt-3",children:a.jsx(Dh,{})})]}),a.jsx(_h,{}),a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("button",{onClick:()=>c("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:r.mode==="create"?"var(--accent)":"var(--surface-3)",color:r.mode==="create"?"#fff":"var(--text-secondary)",border:"none",cursor:"pointer"},onMouseEnter:b=>{r.mode!=="create"&&(b.currentTarget.style.background="var(--surface-4)",b.currentTarget.style.color="var(--text-primary)")},onMouseLeave:b=>{r.mode!=="create"&&(b.currentTarget.style.background="var(--surface-3)",b.currentTarget.style.color="var(--text-secondary)")},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]})}),u&&(()=>{const b=(o==null?void 0:o.provider)==="claude-cli";return u.installed&&b?a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--green)"}}),"Skill Creator installed"]})}):u.installed&&!b?a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-[11px]",style:{color:"var(--text-tertiary)",opacity:.5},children:[a.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--text-tertiary)"}}),"Skill Creator (Claude only)"]})}):!u.installed&&b?a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("div",{className:"px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",style:{color:"var(--yellow)"},children:[a.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--yellow)"}}),a.jsx("span",{className:"font-medium",children:"Skill Creator not installed"})]}),a.jsx("button",{onClick:()=>{navigator.clipboard.writeText(u.installCommand).then(()=>{p(!0),setTimeout(()=>p(!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:y=>{y.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:y=>{y.currentTarget.style.borderColor="var(--border-subtle)"},children:v?"Copied!":u.installCommand})]})}):null})(),a.jsx("div",{className:"flex-1 overflow-y-auto",style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Mh,{})})]})}const Uh="modulepreload",qh=function(r){return"/"+r},gx={},Vh=function(c,o,u){let x=Promise.resolve();if(o&&o.length>0){let p=function(f){return Promise.all(f.map(S=>Promise.resolve(S).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const b=document.querySelector("meta[property=csp-nonce]"),y=(b==null?void 0:b.nonce)||(b==null?void 0:b.getAttribute("nonce"));x=p(o.map(f=>{if(f=qh(f),f in gx)return;gx[f]=!0;const S=f.endsWith(".css"),g=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const C=document.createElement("link");if(C.rel=S?"stylesheet":Uh,S||(C.as="script"),C.crossOrigin="",C.href=f,y&&C.setAttribute("nonce",y),document.head.appendChild(C),S)return new Promise((w,O)=>{C.addEventListener("load",w),C.addEventListener("error",()=>O(new Error(`Unable to preload CSS for ${f}`)))})}))}function v(p){const b=new Event("vite:preloadError",{cancelable:!0});if(b.payload=p,window.dispatchEvent(b),!b.defaultPrevented)throw p}return x.then(p=>{for(const b of p||[])b.status==="rejected"&&v(b.reason);return c().catch(v)})};function qx(r){if(r!==void 0)try{return JSON.stringify(r)}catch(c){console.error("Failed to serialize request body:",c);try{const o=new WeakSet;return JSON.stringify(r,(u,x)=>{if(typeof x=="object"&&x!==null){if(o.has(x))return"[Circular]";o.add(x)}return x})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function Xo(){const[r,c]=m.useState([]),[o,u]=m.useState(!1),[x,v]=m.useState(!1),[p,b]=m.useState(null),y=m.useRef(null),f=m.useCallback(async(g,C)=>{c([]),u(!0),v(!1),b(null);const w=new AbortController;y.current=w;try{const O=qx(C),L=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:O,signal:w.signal});if(!L.ok||!L.body){let K=`HTTP ${L.status}`;try{const P=await L.json();P.error&&(K=P.error)}catch{}throw new Error(K)}const G=L.body.getReader(),q=new TextDecoder;let J="",ee="";for(;;){const{done:K,value:P}=await G.read();if(K)break;J+=q.decode(P,{stream:!0});const re=J.split(`
|
|
50
50
|
`);J=re.pop()||"";for(const X of re)if(X.startsWith("event: "))ee=X.slice(7).trim();else if(X.startsWith("data: ")){try{const te=JSON.parse(X.slice(6)),Q={event:ee,data:te};ee==="done"?(v(!0),c(F=>[...F,Q])):c(F=>[...F,Q])}catch{}ee=""}}}catch(O){O.name!=="AbortError"&&b(O.message)}finally{u(!1),y.current=null}},[]),S=m.useCallback(()=>{var g;(g=y.current)==null||g.abort()},[]);return{events:r,running:o,done:x,error:p,start:f,stop:S}}function Gh(r){const c=m.useRef(r);c.current=r;const[o,u]=m.useState(new Set),x=m.useRef(new Map),v=m.useCallback(async(f,S,g)=>{var w;(w=x.current.get(f))==null||w.abort();const C=new AbortController;x.current.set(f,C),u(O=>{const L=new Set(O);return L.add(f),L});try{const O=qx(g),L=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"},body:O,signal:C.signal});if(!L.ok||!L.body){let K=`HTTP ${L.status}`;try{const P=await L.json();P.error&&(K=P.error)}catch{}throw new Error(K)}const G=L.body.getReader(),q=new TextDecoder;let J="",ee="";for(;;){const{done:K,value:P}=await G.read();if(K)break;J+=q.decode(P,{stream:!0});const re=J.split(`
|
|
51
|
-
`);J=re.pop()||"";for(const X of re)if(X.startsWith("event: "))ee=X.slice(7).trim();else if(X.startsWith("data: ")){try{const te=JSON.parse(X.slice(6)),Q={event:ee,data:te};c.current.onEvent(f,Q)}catch{}ee=""}}c.current.onDone(f)}catch(O){O.name!=="AbortError"&&c.current.onError(f,O.message)}finally{u(O=>{const L=new Set(O);return L.delete(f),L}),x.current.delete(f)}},[]),p=m.useCallback(f=>{var S;(S=x.current.get(f))==null||S.abort()},[]),b=m.useCallback(()=>{for(const f of x.current.values())f.abort()},[]),y=o.size>0;return{runningSet:o,startCase:v,stopCase:p,stopAll:b,isAnyCaseRunning:y}}const Yh={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 Qh(r,c){var o,u;switch(c.type){case"SET_LOADING":return{...r,loading:c.loading};case"SET_ERROR":return{...r,error:c.error};case"INIT_DATA":{const x=new Map;if(c.benchmark)for(const p of c.benchmark.cases)x.set(p.eval_id,{status:p.status,passRate:p.pass_rate,errorMessage:p.error_message||void 0,durationMs:p.durationMs,tokens:p.tokens,output:p.output,assertions:p.assertions.map(b=>({assertion_id:b.id,text:b.text,pass:b.pass,reasoning:b.reasoning}))});const v=((u=(o=c.evals)==null?void 0:o.evals[0])==null?void 0:u.id)??null;return{...r,skillContent:c.skillContent,savedContent:c.skillContent,isDirty:!1,evals:c.evals,evalsError:c.evalsError??null,latestBenchmark:c.benchmark,inlineResults:x,selectedCaseId:v,loading:!1,error:null}}case"SET_PANEL":return{...r,activePanel:c.panel};case"SET_CONTENT":return{...r,skillContent:c.content,isDirty:c.content!==r.savedContent};case"CONTENT_SAVED":return{...r,savedContent:r.skillContent,isDirty:!1};case"SET_EVALS":return{...r,evals:c.evals};case"SELECT_CASE":return{...r,selectedCaseId:c.caseId};case"CASE_RUN_START":{const x=new Map(r.caseRunStates);return x.set(c.caseId,{status:"running",startedAt:Date.now(),mode:c.mode}),{...r,caseRunStates:x,runMode:c.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const x=new Map(r.caseRunStates),v=x.get(c.caseId);x.set(c.caseId,{status:"complete",mode:v==null?void 0:v.mode});const p=new Map(r.inlineResults);return p.set(c.caseId,c.result),{...r,caseRunStates:x,inlineResults:p}}case"CASE_RUN_ERROR":{const x=new Map(r.caseRunStates),v=x.get(c.caseId);x.set(c.caseId,{status:"error",mode:v==null?void 0:v.mode});const p=new Map(r.inlineResults);return p.set(c.caseId,{status:"error",errorMessage:c.error,assertions:[]}),{...r,caseRunStates:x,inlineResults:p}}case"CASE_RUN_CANCEL":{const x=new Map(r.caseRunStates),v=x.get(c.caseId);return x.set(c.caseId,{status:"cancelled",mode:v==null?void 0:v.mode}),{...r,caseRunStates:x}}case"BULK_RUN_START":{const x=new Map(r.caseRunStates);for(const v of c.caseIds)x.set(v,{status:"queued",mode:c.mode});return{...r,caseRunStates:x,bulkRunActive:!0,runMode:c.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...r,bulkRunActive:!1,latestBenchmark:c.benchmark??r.latestBenchmark,iterationCount:r.iterationCount+1};case"CANCEL_ALL":{const x=new Map(r.caseRunStates);for(const[v,p]of x)(p.status==="running"||p.status==="queued")&&x.set(v,{status:"cancelled"});return{...r,caseRunStates:x,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const x=new Map(r.inlineResults);return x.set(c.evalId,c.result),{...r,inlineResults:x}}case"OPEN_IMPROVE":return{...r,improveTarget:c.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...r,improveTarget:null};case"OPEN_AI_EDIT":return{...r,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...r,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...r,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...r,aiEditProgress:[...r.aiEditProgress,c.entry]};case"AI_EDIT_RESULT":{const x=c.evalChanges??[],v=new Map;for(let p=0;p<x.length;p++)v.set(p,!0);return{...r,aiEditLoading:!1,aiEditResult:{improved:c.improved,reasoning:c.reasoning,evalChanges:x},aiEditEvalChanges:x,aiEditEvalSelections:v}}case"AI_EDIT_ERROR":return{...r,aiEditLoading:!1,aiEditError:c.message,aiEditClassifiedError:c.classified??null};case"GENERATE_EVALS_START":return{...r,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...r,generateEvalsProgress:[...r.generateEvalsProgress,c.entry]};case"GENERATE_EVALS_DONE":return{...r,generateEvalsLoading:!1,evals:c.evals};case"GENERATE_EVALS_ERROR":return{...r,generateEvalsLoading:!1,generateEvalsError:c.classified};case"TOGGLE_EVAL_CHANGE":{const x=new Map(r.aiEditEvalSelections);return x.set(c.index,!x.get(c.index)),{...r,aiEditEvalSelections:x}}case"SELECT_ALL_EVAL_CHANGES":{const x=new Map(r.aiEditEvalSelections);for(const v of x.keys())x.set(v,!0);return{...r,aiEditEvalSelections:x}}case"DESELECT_ALL_EVAL_CHANGES":{const x=new Map(r.aiEditEvalSelections);for(const v of x.keys())x.set(v,!1);return{...r,aiEditEvalSelections:x}}case"SET_EVALS_RETRY":return{...r,aiEditEvalsRetry:c.evalsFile};case"SET_REGRESSIONS":return{...r,regressions:c.regressions};case"INCREMENT_ITERATION":return{...r,iterationCount:r.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...r,activationPrompts:c.prompts};case"ACTIVATION_START":return{...r,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...r,activationResults:[...r.activationResults,c.result]};case"ACTIVATION_DONE":return{...r,activationRunning:!1,activationSummary:c.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...r,activationClassifyingStatus:`Classifying prompt ${c.index}/${c.total}...`};case"ACTIVATION_ERROR":return{...r,activationRunning:!1,activationError:c.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...r,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...r,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...r,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...r,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...r,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...r,generatingPrompts:!1,generatingPromptsError:c.error};case"ACTIVATION_HISTORY_LOADED":return{...r,activationHistory:c.runs,activationHistoryLoading:!1};default:return r}}function Xh(r){if(r==="unit"||r==="integration")return r}function Kh(r,c){const o=c.data;if(c.event==="output_ready"&&(r.output=o.output,o.durationMs!=null&&(r.durationMs=o.durationMs),o.tokens!=null&&(r.tokens=o.tokens)),c.event==="outputs_ready"&&(r.output=o.skillOutput,o.skillDurationMs!=null&&(r.durationMs=o.skillDurationMs),o.skillTokens!=null&&(r.tokens=o.skillTokens)),c.event==="assertion_result"){const u={assertion_id:o.assertion_id,text:o.text,pass:o.pass,reasoning:o.reasoning};r.assertions.find(x=>x.assertion_id===u.assertion_id)||r.assertions.push(u)}c.event==="case_complete"&&(r.status=o.status,r.passRate=o.pass_rate,r.errorMessage=o.error_message||void 0,r.classifiedError=o.classified_error||void 0)}const Vx=m.createContext(null);function tl(){const r=m.useContext(Vx);if(!r)throw new Error("useWorkspace must be used within WorkspaceProvider");return r}function $h({plugin:r,skill:c,origin:o,children:u}){const x=o==="installed",[v,p]=m.useReducer(Qh,{...Yh,plugin:r,skill:c}),b=m.useRef(new Set),y=m.useRef(new Set),f=m.useRef(new Map),S=m.useCallback((Z,oe)=>{let se=f.current.get(Z);se||(se={assertions:[]},f.current.set(Z,se)),Kh(se,oe),p({type:"UPDATE_INLINE_RESULT",evalId:Z,result:{...se,assertions:[...se.assertions]}})},[]),g=m.useCallback(Z=>{if(y.current.has(Z))return;y.current.add(Z);const oe=f.current.get(Z)??{assertions:[]};p({type:"CASE_RUN_COMPLETE",caseId:Z,result:{...oe,assertions:[...oe.assertions]}}),b.current.has(Z)&&(b.current.delete(Z),b.current.size===0&&be.getLatestBenchmark(r,c).then(se=>p({type:"BULK_RUN_COMPLETE",benchmark:se})).catch(()=>p({type:"BULK_RUN_COMPLETE",benchmark:null})))},[r,c]),C=m.useCallback((Z,oe)=>{y.current.has(Z)||(y.current.add(Z),p({type:"CASE_RUN_ERROR",caseId:Z,error:oe}),b.current.has(Z)&&(b.current.delete(Z),b.current.size===0&&be.getLatestBenchmark(r,c).then(se=>p({type:"BULK_RUN_COMPLETE",benchmark:se})).catch(()=>p({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[r,c]),{startCase:w,stopCase:O,stopAll:L}=Gh({onEvent:S,onDone:g,onError:C});m.useEffect(()=>()=>{L()},[L]);const G=m.useCallback(async()=>{try{const Z=await fetch(`/api/skills/${r}/${c}/activation-history`);if(!Z.ok){if(Z.status===404){p({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const oe=await Z.json();p({type:"ACTIVATION_HISTORY_LOADED",runs:oe.runs||[]})}catch{}},[r,c]);m.useEffect(()=>{let Z=!1;async function oe(){try{const[se,me,ge]=await Promise.allSettled([be.getSkillDetail(r,c),be.getEvals(r,c),be.getLatestBenchmark(r,c)]);if(Z)return;let Ye=null,ut=null;if(me.status==="fulfilled")Ye=me.value;else{const Xe=me.reason;(Xe==null?void 0:Xe.status)!==404&&(ut=(Xe==null?void 0:Xe.message)??"Failed to load test cases")}p({type:"INIT_DATA",skillContent:se.status==="fulfilled"?se.value.skillContent:"",evals:Ye,evalsError:ut,benchmark:ge.status==="fulfilled"?ge.value:null})}catch(se){Z||p({type:"SET_ERROR",error:se.message})}}return oe(),G(),()=>{Z=!0}},[r,c,G]);const q=m.useCallback(async()=>{if(!x)try{await be.applyImprovement(r,c,v.skillContent),p({type:"CONTENT_SAVED"})}catch(Z){p({type:"SET_ERROR",error:Z.message})}},[x,r,c,v.skillContent]),J=m.useCallback(async Z=>{if(!x)try{const oe=await be.saveEvals(r,c,Z);p({type:"SET_EVALS",evals:oe})}catch(oe){p({type:"SET_ERROR",error:oe.message})}},[x,r,c]),ee=m.useCallback((Z,oe="benchmark")=>{if(x)return;const se=v.caseRunStates.get(Z);if((se==null?void 0:se.status)!=="running")if(f.current.delete(Z),y.current.delete(Z),p({type:"CASE_RUN_START",caseId:Z,mode:oe}),oe==="comparison"){const me=`/api/skills/${r}/${c}/compare`;w(Z,me,{eval_ids:[Z]})}else{const me=`/api/skills/${r}/${c}/benchmark/case/${Z}`;w(Z,me,oe==="baseline"?{baseline_only:!0}:void 0)}},[x,r,c,v.caseRunStates,w]),K=m.useCallback((Z="benchmark")=>{var me;if(x)return;const oe=((me=v.evals)==null?void 0:me.evals)??[];if(oe.length===0)return;const se=oe.map(ge=>ge.id);for(const ge of se)f.current.delete(ge),y.current.delete(ge);p({type:"BULK_RUN_START",caseIds:se,mode:Z}),b.current=new Set(se);for(const ge of se)if(Z==="comparison")w(ge,`/api/skills/${r}/${c}/compare`,{eval_ids:[ge]});else{const Ye=`/api/skills/${r}/${c}/benchmark/case/${ge}`;w(ge,Ye,Z==="baseline"?{baseline_only:!0}:void 0)}},[x,r,c,v.evals,w]),P=m.useCallback(Z=>{O(Z),p({type:"CASE_RUN_CANCEL",caseId:Z}),b.current.delete(Z),y.current.add(Z)},[O]),re=m.useCallback(()=>{L(),p({type:"CANCEL_ALL"}),b.current.clear()},[L]),X=m.useCallback(async(Z,oe)=>{p({type:"OPEN_IMPROVE",evalId:Z})},[]),te=m.useCallback(async(Z,oe)=>{try{await be.applyImprovement(r,c,oe),p({type:"SET_CONTENT",content:oe}),p({type:"CONTENT_SAVED"}),p({type:"CLOSE_IMPROVE"}),ee(Z,"benchmark")}catch(se){p({type:"SET_ERROR",error:se.message})}},[r,c,ee]),Q=Xo(),F=m.useRef(null),pe=m.useRef(0);m.useEffect(()=>{const Z=Q.events;for(let oe=pe.current;oe<Z.length;oe++){const se=Z[oe],me=se.data;if(se.event==="progress"&&p({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:me.phase,message:me.message}}),se.event==="done"){const ge=me.improved,Ye=me.reasoning,ut=me.evalChanges??[];p({type:"AI_EDIT_RESULT",improved:ge,reasoning:Ye,evalChanges:ut})}if(se.event==="error"){const ge=me;p({type:"AI_EDIT_ERROR",message:ge.description||"Unknown error",classified:ge})}}pe.current=Z.length},[Q.events]),m.useEffect(()=>{Q.error&&p({type:"AI_EDIT_ERROR",message:Q.error})},[Q.error]),m.useEffect(()=>()=>{Q.stop()},[Q.stop]);const ie=m.useCallback(async(Z,oe,se)=>{x||(pe.current=0,p({type:"AI_EDIT_LOADING"}),F.current=Q.stop,Q.start(`/api/skills/${r}/${c}/improve?sse`,{mode:"instruct",instruction:Z,content:v.skillContent,evals:v.evals??{skill_name:c,evals:[]},provider:oe,model:se}))},[x,r,c,v.skillContent,v.evals,Q]),_=m.useCallback(()=>{Q.stop(),p({type:"AI_EDIT_ERROR",message:"Cancelled"})},[Q]),le=m.useCallback(async()=>{const Z=v.aiEditResult;if(Z!=null&&Z.improved)try{if(await be.applyImprovement(r,c,Z.improved),p({type:"SET_CONTENT",content:Z.improved}),p({type:"CONTENT_SAVED"}),v.aiEditEvalChanges.length>0&&Array.from(v.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:se}=await Vh(async()=>{const{mergeEvalChanges:Ye}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Ye}},[]),me=v.evals??{skill_name:c,evals:[]},ge=se(me,v.aiEditEvalChanges,v.aiEditEvalSelections);try{const Ye=await be.saveEvals(r,c,ge);p({type:"SET_EVALS",evals:Ye})}catch(Ye){p({type:"SET_EVALS_RETRY",evalsFile:ge}),p({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Ye.message}. You can retry from the AI Edit panel.`});return}}p({type:"CLOSE_AI_EDIT"})}catch(oe){p({type:"SET_ERROR",error:oe.message})}},[r,c,v.aiEditResult,v.evals,v.aiEditEvalChanges,v.aiEditEvalSelections]),I=m.useCallback(()=>{p({type:"CLOSE_AI_EDIT"})},[]),E=m.useCallback(Z=>{p({type:"TOGGLE_EVAL_CHANGE",index:Z})},[]),M=m.useCallback(()=>{p({type:"SELECT_ALL_EVAL_CHANGES"})},[]),ae=m.useCallback(()=>{p({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),B=m.useCallback(async()=>{const Z=v.aiEditEvalsRetry;if(Z)try{const oe=await be.saveEvals(r,c,Z);p({type:"SET_EVALS",evals:oe}),p({type:"SET_ERROR",error:null}),p({type:"CLOSE_AI_EDIT"})}catch(oe){p({type:"SET_ERROR",error:`Retry failed: ${oe.message}`})}},[r,c,v.aiEditEvalsRetry]),de=m.useCallback(async()=>{try{const Z=await be.getSkillDetail(r,c);p({type:"SET_CONTENT",content:Z.skillContent}),p({type:"CONTENT_SAVED"})}catch{}},[r,c]),{config:j}=Na(),D=Xo(),W=m.useRef(0);m.useEffect(()=>{const Z=D.events;for(let oe=W.current;oe<Z.length;oe++){const se=Z[oe],me=se.data;if(se.event==="progress"&&p({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:me.phase,message:me.message}}),se.event==="done"){const ge=me;be.saveEvals(r,c,ge).then(Ye=>p({type:"GENERATE_EVALS_DONE",evals:Ye})).catch(Ye=>p({type:"SET_ERROR",error:Ye.message}))}se.event==="error"&&p({type:"GENERATE_EVALS_ERROR",classified:me})}W.current=Z.length},[D.events,r,c]),m.useEffect(()=>{D.error&&p({type:"SET_ERROR",error:D.error})},[D.error]),m.useEffect(()=>()=>{D.stop()},[D.stop]);const ne=m.useCallback(async Z=>{if(x)return;W.current=0,p({type:"GENERATE_EVALS_START"});const oe={};j!=null&&j.provider&&(oe.provider=j.provider),j!=null&&j.model&&(oe.model=j.model);const se=Xh(Z==null?void 0:Z.testType);se&&(oe.testType=se),D.start(`/api/skills/${r}/${c}/generate-evals?sse`,Object.keys(oe).length>0?oe:void 0)},[x,r,c,D,j]),ue=Xo(),fe=m.useRef(0);m.useEffect(()=>()=>{ue.stop()},[ue.stop]),m.useEffect(()=>{const Z=ue.events;for(let oe=fe.current;oe<Z.length;oe++){const se=Z[oe];if(se.event==="classifying"){const me=se.data;p({type:"ACTIVATION_CLASSIFYING",index:me.index,total:me.total})}if(se.event==="prompt_result"&&p({type:"ACTIVATION_RESULT",result:se.data}),se.event==="done"){ve.current&&(clearTimeout(ve.current),ve.current=null);const me=se.data;if(me.error)p({type:"ACTIVATION_ERROR",error:me.error});else{p({type:"ACTIVATION_DONE",summary:me});const ge={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(j==null?void 0:j.model)||"unknown",provider:(j==null?void 0:j.provider)||"unknown",promptCount:me.total,summary:{precision:me.precision,recall:me.recall,reliability:me.reliability,tp:me.tp,tn:me.tn,fp:me.fp,fn:me.fn}};p({type:"ACTIVATION_HISTORY_LOADED",runs:[ge,...v.activationHistory??[]]})}}}fe.current=Z.length},[ue.events,j,v.activationHistory]),m.useEffect(()=>{ue.error&&(ve.current&&(clearTimeout(ve.current),ve.current=null),p({type:"ACTIVATION_ERROR",error:ue.error}))},[ue.error]);const ve=m.useRef(null),Be=m.useCallback(()=>{ve.current&&(clearTimeout(ve.current),ve.current=null),ue.stop(),p({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ue]),Re=m.useCallback(Z=>{const se=Z.trim().split(`
|
|
51
|
+
`);J=re.pop()||"";for(const X of re)if(X.startsWith("event: "))ee=X.slice(7).trim();else if(X.startsWith("data: ")){try{const te=JSON.parse(X.slice(6)),Q={event:ee,data:te};c.current.onEvent(f,Q)}catch{}ee=""}}c.current.onDone(f)}catch(O){O.name!=="AbortError"&&c.current.onError(f,O.message)}finally{u(O=>{const L=new Set(O);return L.delete(f),L}),x.current.delete(f)}},[]),p=m.useCallback(f=>{var S;(S=x.current.get(f))==null||S.abort()},[]),b=m.useCallback(()=>{for(const f of x.current.values())f.abort()},[]),y=o.size>0;return{runningSet:o,startCase:v,stopCase:p,stopAll:b,isAnyCaseRunning:y}}const Yh={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 Qh(r,c){var o,u;switch(c.type){case"SET_LOADING":return{...r,loading:c.loading};case"SET_ERROR":return{...r,error:c.error};case"INIT_DATA":{const x=new Map;if(c.benchmark)for(const p of c.benchmark.cases)x.set(p.eval_id,{status:p.status,passRate:p.pass_rate,errorMessage:p.error_message||void 0,durationMs:p.durationMs,tokens:p.tokens,output:p.output,assertions:p.assertions.map(b=>({assertion_id:b.id,text:b.text,pass:b.pass,reasoning:b.reasoning}))});const v=((u=(o=c.evals)==null?void 0:o.evals[0])==null?void 0:u.id)??null;return{...r,skillContent:c.skillContent,savedContent:c.skillContent,isDirty:!1,evals:c.evals,evalsError:c.evalsError??null,latestBenchmark:c.benchmark,inlineResults:x,selectedCaseId:v,loading:!1,error:null}}case"SET_PANEL":return{...r,activePanel:c.panel};case"SET_CONTENT":return{...r,skillContent:c.content,isDirty:c.content!==r.savedContent};case"CONTENT_SAVED":return{...r,savedContent:r.skillContent,isDirty:!1};case"SET_EVALS":return{...r,evals:c.evals};case"SELECT_CASE":return{...r,selectedCaseId:c.caseId};case"CASE_RUN_START":{const x=new Map(r.caseRunStates);return x.set(c.caseId,{status:"running",startedAt:Date.now(),mode:c.mode}),{...r,caseRunStates:x,runMode:c.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const x=new Map(r.caseRunStates),v=x.get(c.caseId);x.set(c.caseId,{status:"complete",mode:v==null?void 0:v.mode});const p=new Map(r.inlineResults);return p.set(c.caseId,c.result),{...r,caseRunStates:x,inlineResults:p}}case"CASE_RUN_ERROR":{const x=new Map(r.caseRunStates),v=x.get(c.caseId);x.set(c.caseId,{status:"error",mode:v==null?void 0:v.mode});const p=new Map(r.inlineResults);return p.set(c.caseId,{status:"error",errorMessage:c.error,assertions:[]}),{...r,caseRunStates:x,inlineResults:p}}case"CASE_RUN_CANCEL":{const x=new Map(r.caseRunStates),v=x.get(c.caseId);return x.set(c.caseId,{status:"cancelled",mode:v==null?void 0:v.mode}),{...r,caseRunStates:x}}case"BULK_RUN_START":{const x=new Map(r.caseRunStates);for(const v of c.caseIds)x.set(v,{status:"queued",mode:c.mode});return{...r,caseRunStates:x,bulkRunActive:!0,runMode:c.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...r,bulkRunActive:!1,latestBenchmark:c.benchmark??r.latestBenchmark,iterationCount:r.iterationCount+1};case"CANCEL_ALL":{const x=new Map(r.caseRunStates);for(const[v,p]of x)(p.status==="running"||p.status==="queued")&&x.set(v,{status:"cancelled"});return{...r,caseRunStates:x,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const x=new Map(r.inlineResults);return x.set(c.evalId,c.result),{...r,inlineResults:x}}case"OPEN_IMPROVE":return{...r,improveTarget:c.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...r,improveTarget:null};case"OPEN_AI_EDIT":return{...r,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...r,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...r,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...r,aiEditProgress:[...r.aiEditProgress,c.entry]};case"AI_EDIT_RESULT":{const x=c.evalChanges??[],v=new Map;for(let p=0;p<x.length;p++)v.set(p,!0);return{...r,aiEditLoading:!1,aiEditResult:{improved:c.improved,reasoning:c.reasoning,evalChanges:x},aiEditEvalChanges:x,aiEditEvalSelections:v}}case"AI_EDIT_ERROR":return{...r,aiEditLoading:!1,aiEditError:c.message,aiEditClassifiedError:c.classified??null};case"GENERATE_EVALS_START":return{...r,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...r,generateEvalsProgress:[...r.generateEvalsProgress,c.entry]};case"GENERATE_EVALS_DONE":return{...r,generateEvalsLoading:!1,evals:c.evals};case"GENERATE_EVALS_ERROR":return{...r,generateEvalsLoading:!1,generateEvalsError:c.classified};case"TOGGLE_EVAL_CHANGE":{const x=new Map(r.aiEditEvalSelections);return x.set(c.index,!x.get(c.index)),{...r,aiEditEvalSelections:x}}case"SELECT_ALL_EVAL_CHANGES":{const x=new Map(r.aiEditEvalSelections);for(const v of x.keys())x.set(v,!0);return{...r,aiEditEvalSelections:x}}case"DESELECT_ALL_EVAL_CHANGES":{const x=new Map(r.aiEditEvalSelections);for(const v of x.keys())x.set(v,!1);return{...r,aiEditEvalSelections:x}}case"SET_EVALS_RETRY":return{...r,aiEditEvalsRetry:c.evalsFile};case"SET_REGRESSIONS":return{...r,regressions:c.regressions};case"INCREMENT_ITERATION":return{...r,iterationCount:r.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...r,activationPrompts:c.prompts};case"ACTIVATION_START":return{...r,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...r,activationResults:[...r.activationResults,c.result]};case"ACTIVATION_DONE":return{...r,activationRunning:!1,activationSummary:c.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...r,activationClassifyingStatus:`Classifying prompt ${c.index}/${c.total}...`};case"ACTIVATION_ERROR":return{...r,activationRunning:!1,activationError:c.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...r,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...r,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...r,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...r,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...r,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...r,generatingPrompts:!1,generatingPromptsError:c.error};case"ACTIVATION_HISTORY_LOADED":return{...r,activationHistory:c.runs,activationHistoryLoading:!1};default:return r}}function Xh(r){if(r==="unit"||r==="integration")return r}function Kh(r,c){const o=c.data;if(c.event==="output_ready"&&(r.output=o.output,o.durationMs!=null&&(r.durationMs=o.durationMs),o.tokens!=null&&(r.tokens=o.tokens)),c.event==="outputs_ready"&&(r.output=o.skillOutput,o.skillDurationMs!=null&&(r.durationMs=o.skillDurationMs),o.skillTokens!=null&&(r.tokens=o.skillTokens)),c.event==="assertion_result"){const u={assertion_id:o.assertion_id,text:o.text,pass:o.pass,reasoning:o.reasoning};r.assertions.find(x=>x.assertion_id===u.assertion_id)||r.assertions.push(u)}c.event==="case_complete"&&(r.status=o.status,r.passRate=o.pass_rate,r.errorMessage=o.error_message||void 0,r.classifiedError=o.classified_error||void 0)}const Vx=m.createContext(null);function tl(){const r=m.useContext(Vx);if(!r)throw new Error("useWorkspace must be used within WorkspaceProvider");return r}function $h({plugin:r,skill:c,origin:o,children:u}){const x=o==="installed",[v,p]=m.useReducer(Qh,{...Yh,plugin:r,skill:c}),b=m.useRef(new Set),y=m.useRef(new Set),f=m.useRef(new Map),S=m.useCallback((Z,oe)=>{let se=f.current.get(Z);se||(se={assertions:[]},f.current.set(Z,se)),Kh(se,oe),p({type:"UPDATE_INLINE_RESULT",evalId:Z,result:{...se,assertions:[...se.assertions]}})},[]),g=m.useCallback(Z=>{if(y.current.has(Z))return;y.current.add(Z);const oe=f.current.get(Z)??{assertions:[]};p({type:"CASE_RUN_COMPLETE",caseId:Z,result:{...oe,assertions:[...oe.assertions]}}),b.current.has(Z)&&(b.current.delete(Z),b.current.size===0&&be.getLatestBenchmark(r,c).then(se=>p({type:"BULK_RUN_COMPLETE",benchmark:se})).catch(()=>p({type:"BULK_RUN_COMPLETE",benchmark:null})))},[r,c]),C=m.useCallback((Z,oe)=>{y.current.has(Z)||(y.current.add(Z),p({type:"CASE_RUN_ERROR",caseId:Z,error:oe}),b.current.has(Z)&&(b.current.delete(Z),b.current.size===0&&be.getLatestBenchmark(r,c).then(se=>p({type:"BULK_RUN_COMPLETE",benchmark:se})).catch(()=>p({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[r,c]),{startCase:w,stopCase:O,stopAll:L}=Gh({onEvent:S,onDone:g,onError:C});m.useEffect(()=>()=>{L()},[L]);const G=m.useCallback(async()=>{try{const Z=await fetch(`/api/skills/${r}/${c}/activation-history`);if(!Z.ok){if(Z.status===404){p({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const oe=await Z.json();p({type:"ACTIVATION_HISTORY_LOADED",runs:oe.runs||[]})}catch{}},[r,c]);m.useEffect(()=>{let Z=!1;async function oe(){try{const[se,me,ge]=await Promise.allSettled([be.getSkillDetail(r,c),be.getEvals(r,c),be.getLatestBenchmark(r,c)]);if(Z)return;let Ye=null,ut=null;if(me.status==="fulfilled")Ye=me.value;else{const Xe=me.reason;(Xe==null?void 0:Xe.status)!==404&&(ut=(Xe==null?void 0:Xe.message)??"Failed to load test cases")}p({type:"INIT_DATA",skillContent:se.status==="fulfilled"?se.value.skillContent:"",evals:Ye,evalsError:ut,benchmark:ge.status==="fulfilled"?ge.value:null})}catch(se){Z||p({type:"SET_ERROR",error:se.message})}}return oe(),G(),()=>{Z=!0}},[r,c,G]);const q=m.useCallback(async()=>{if(!x)try{await be.applyImprovement(r,c,v.skillContent),p({type:"CONTENT_SAVED"})}catch(Z){p({type:"SET_ERROR",error:Z.message})}},[x,r,c,v.skillContent]),J=m.useCallback(async Z=>{if(!x)try{const oe=await be.saveEvals(r,c,Z);p({type:"SET_EVALS",evals:oe})}catch(oe){p({type:"SET_ERROR",error:oe.message})}},[x,r,c]),ee=m.useCallback((Z,oe="benchmark")=>{if(x)return;const se=v.caseRunStates.get(Z);if((se==null?void 0:se.status)!=="running")if(f.current.delete(Z),y.current.delete(Z),p({type:"CASE_RUN_START",caseId:Z,mode:oe}),oe==="comparison"){const me=`/api/skills/${r}/${c}/compare`;w(Z,me,{eval_ids:[Z]})}else{const me=`/api/skills/${r}/${c}/benchmark/case/${Z}`;w(Z,me,oe==="baseline"?{baseline_only:!0}:void 0)}},[x,r,c,v.caseRunStates,w]),K=m.useCallback((Z="benchmark")=>{var me;if(x)return;const oe=((me=v.evals)==null?void 0:me.evals)??[];if(oe.length===0)return;const se=oe.map(ge=>ge.id);for(const ge of se)f.current.delete(ge),y.current.delete(ge);p({type:"BULK_RUN_START",caseIds:se,mode:Z}),b.current=new Set(se);for(const ge of se)if(Z==="comparison")w(ge,`/api/skills/${r}/${c}/compare`,{eval_ids:[ge]});else{const Ye=`/api/skills/${r}/${c}/benchmark/case/${ge}`;w(ge,Ye,Z==="baseline"?{baseline_only:!0}:void 0)}},[x,r,c,v.evals,w]),P=m.useCallback(Z=>{O(Z),p({type:"CASE_RUN_CANCEL",caseId:Z}),b.current.delete(Z),y.current.add(Z)},[O]),re=m.useCallback(()=>{L(),p({type:"CANCEL_ALL"}),b.current.clear()},[L]),X=m.useCallback(async(Z,oe)=>{p({type:"OPEN_IMPROVE",evalId:Z})},[]),te=m.useCallback(async(Z,oe)=>{try{await be.applyImprovement(r,c,oe),p({type:"SET_CONTENT",content:oe}),p({type:"CONTENT_SAVED"}),p({type:"CLOSE_IMPROVE"}),ee(Z,"benchmark")}catch(se){p({type:"SET_ERROR",error:se.message})}},[r,c,ee]),Q=Xo(),F=m.useRef(null),pe=m.useRef(0);m.useEffect(()=>{const Z=Q.events;for(let oe=pe.current;oe<Z.length;oe++){const se=Z[oe],me=se.data;if(se.event==="progress"&&p({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:me.phase,message:me.message}}),se.event==="done"){const ge=me.improved,Ye=me.reasoning,ut=me.evalChanges??[];p({type:"AI_EDIT_RESULT",improved:ge,reasoning:Ye,evalChanges:ut})}if(se.event==="error"){const ge=me;p({type:"AI_EDIT_ERROR",message:ge.description||"Unknown error",classified:ge})}}pe.current=Z.length},[Q.events]),m.useEffect(()=>{Q.error&&p({type:"AI_EDIT_ERROR",message:Q.error})},[Q.error]),m.useEffect(()=>()=>{Q.stop()},[Q.stop]);const ie=m.useCallback(async(Z,oe,se)=>{x||(pe.current=0,p({type:"AI_EDIT_LOADING"}),F.current=Q.stop,Q.start(`/api/skills/${r}/${c}/improve?sse`,{mode:"instruct",instruction:Z,content:v.skillContent,evals:v.evals??{skill_name:c,evals:[]},provider:oe,model:se}))},[x,r,c,v.skillContent,v.evals,Q]),_=m.useCallback(()=>{Q.stop(),p({type:"AI_EDIT_ERROR",message:"Cancelled"})},[Q]),le=m.useCallback(async()=>{const Z=v.aiEditResult;if(Z!=null&&Z.improved)try{if(await be.applyImprovement(r,c,Z.improved),p({type:"SET_CONTENT",content:Z.improved}),p({type:"CONTENT_SAVED"}),v.aiEditEvalChanges.length>0&&Array.from(v.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:se}=await Vh(async()=>{const{mergeEvalChanges:Ye}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Ye}},[]),me=v.evals??{skill_name:c,evals:[]},ge=se(me,v.aiEditEvalChanges,v.aiEditEvalSelections);try{const Ye=await be.saveEvals(r,c,ge);p({type:"SET_EVALS",evals:Ye})}catch(Ye){p({type:"SET_EVALS_RETRY",evalsFile:ge}),p({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Ye.message}. You can retry from the AI Edit panel.`});return}}p({type:"CLOSE_AI_EDIT"})}catch(oe){p({type:"SET_ERROR",error:oe.message})}},[r,c,v.aiEditResult,v.evals,v.aiEditEvalChanges,v.aiEditEvalSelections]),I=m.useCallback(()=>{p({type:"CLOSE_AI_EDIT"})},[]),E=m.useCallback(Z=>{p({type:"TOGGLE_EVAL_CHANGE",index:Z})},[]),M=m.useCallback(()=>{p({type:"SELECT_ALL_EVAL_CHANGES"})},[]),ae=m.useCallback(()=>{p({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),B=m.useCallback(async()=>{const Z=v.aiEditEvalsRetry;if(Z)try{const oe=await be.saveEvals(r,c,Z);p({type:"SET_EVALS",evals:oe}),p({type:"SET_ERROR",error:null}),p({type:"CLOSE_AI_EDIT"})}catch(oe){p({type:"SET_ERROR",error:`Retry failed: ${oe.message}`})}},[r,c,v.aiEditEvalsRetry]),de=m.useCallback(async()=>{try{const Z=await be.getSkillDetail(r,c);p({type:"SET_CONTENT",content:Z.skillContent}),p({type:"CONTENT_SAVED"})}catch{}},[r,c]),{config:j}=Na(),D=Xo(),W=m.useRef(0);m.useEffect(()=>{const Z=D.events;for(let oe=W.current;oe<Z.length;oe++){const se=Z[oe],me=se.data;if(se.event==="progress"&&p({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:me.phase,message:me.message}}),se.event==="done"){const ge=me;be.saveEvals(r,c,ge).then(Ye=>p({type:"GENERATE_EVALS_DONE",evals:Ye})).catch(Ye=>p({type:"SET_ERROR",error:Ye.message}))}se.event==="error"&&p({type:"GENERATE_EVALS_ERROR",classified:me})}W.current=Z.length},[D.events,r,c]),m.useEffect(()=>{D.error&&p({type:"SET_ERROR",error:D.error})},[D.error]),m.useEffect(()=>()=>{D.stop()},[D.stop]);const ne=m.useCallback(async Z=>{if(x)return;W.current=0,p({type:"GENERATE_EVALS_START"});const oe={};j!=null&&j.provider&&(oe.provider=j.provider),j!=null&&j.model&&(oe.model=j.model);const se=Xh(Z==null?void 0:Z.testType);se&&(oe.testType=se),D.start(`/api/skills/${r}/${c}/generate-evals?sse`,Object.keys(oe).length>0?oe:void 0)},[x,r,c,D,j]),ue=Xo(),fe=m.useRef(0);m.useEffect(()=>()=>{ue.stop()},[ue.stop]),m.useEffect(()=>{const Z=ue.events;for(let oe=fe.current;oe<Z.length;oe++){const se=Z[oe];if(se.event==="classifying"){const me=se.data;p({type:"ACTIVATION_CLASSIFYING",index:me.index,total:me.total})}if(se.event==="prompt_result"&&p({type:"ACTIVATION_RESULT",result:se.data}),se.event==="done"){ve.current&&(clearTimeout(ve.current),ve.current=null);const me=se.data;if(me.error)p({type:"ACTIVATION_ERROR",error:me.error});else{p({type:"ACTIVATION_DONE",summary:me});const ge={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(j==null?void 0:j.model)||"unknown",provider:(j==null?void 0:j.provider)||"unknown",promptCount:me.total,summary:{precision:me.precision,recall:me.recall,reliability:me.reliability,tp:me.tp,tn:me.tn,fp:me.fp,fn:me.fn}};p({type:"ACTIVATION_HISTORY_LOADED",runs:[ge,...v.activationHistory??[]]})}}}fe.current=Z.length},[ue.events,j,v.activationHistory]),m.useEffect(()=>{ue.error&&(ve.current&&(clearTimeout(ve.current),ve.current=null),p({type:"ACTIVATION_ERROR",error:ue.error}))},[ue.error]);const ve=m.useRef(null),Oe=m.useCallback(()=>{ve.current&&(clearTimeout(ve.current),ve.current=null),ue.stop(),p({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ue]),Re=m.useCallback(Z=>{const se=Z.trim().split(`
|
|
52
52
|
`).filter(Boolean).map(ge=>ge.startsWith("!")?{prompt:ge.slice(1).trim(),expected:"should_not_activate"}:ge.startsWith("+")?{prompt:ge.slice(1).trim(),expected:"should_activate"}:{prompt:ge.trim(),expected:"auto"});fe.current=0,p({type:"ACTIVATION_START"}),p({type:"SET_ACTIVATION_PROMPTS",prompts:Z});const me={prompts:se};j!=null&&j.provider&&(me.provider=j.provider),j!=null&&j.model&&(me.model=j.model),ue.start(`/api/skills/${r}/${c}/activation-test`,me),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{ue.stop(),p({type:"ACTIVATION_TIMEOUT"}),ve.current=null},12e4)},[r,c,ue,j]),pt=m.useCallback(async(Z=8)=>{p({type:"GENERATE_PROMPTS_START"});try{const oe={count:Z};j!=null&&j.provider&&(oe.provider=j.provider),j!=null&&j.model&&(oe.model=j.model);const se=await fetch(`/api/skills/${r}/${c}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oe)});if(!se.ok){let mt=`HTTP ${se.status}`;try{const ll=await se.json();ll.error&&(mt=ll.error)}catch{}throw new Error(mt)}const me=se.body.getReader(),ge=new TextDecoder;let Ye="",ut="",Xe=[];for(;;){const{done:mt,value:ll}=await me.read();if(mt)break;Ye+=ge.decode(ll,{stream:!0});const Qt=Ye.split(`
|
|
53
53
|
`);Ye=Qt.pop()||"";for(const We of Qt)if(We.startsWith("event: "))ut=We.slice(7).trim();else if(We.startsWith("data: ")){try{const Et=JSON.parse(We.slice(6));if(ut==="done"){if(Et.error)throw new Error(Et.error);Xe=Et.prompts||[]}if(ut==="error")throw new Error(Et.message||Et.description||"Generation failed")}catch(Et){if(!(Et instanceof SyntaxError))throw Et}ut=""}}const Dt=Xe.map(mt=>`${mt.expected==="should_activate"?"+":"!"}${mt.prompt}`).join(`
|
|
54
|
-
`);p({type:"SET_ACTIVATION_PROMPTS",prompts:Dt}),p({type:"GENERATE_PROMPTS_DONE"})}catch(oe){p({type:"GENERATE_PROMPTS_ERROR",error:oe.message})}},[r,c,j]),Lt=m.useMemo(()=>({state:v,dispatch:p,isReadOnly:x,saveContent:q,saveEvals:J,runCase:ee,runAll:K,cancelCase:P,cancelAll:re,improveForCase:X,applyImproveAndRerun:te,refreshSkillContent:de,generateEvals:ne,runActivationTest:Re,cancelActivation:Be,generateActivationPrompts:pt,fetchActivationHistory:G,submitAiEdit:ie,cancelAiEdit:_,applyAiEdit:le,discardAiEdit:I,toggleEvalChange:E,selectAllEvalChanges:M,deselectAllEvalChanges:ae,retryEvalsSave:B}),[v,x,q,J,ee,K,P,re,X,te,de,ne,Re,Be,pt,G,ie,_,le,I,E,M,ae,B]);return a.jsx(Vx.Provider,{value:Lt,children:u})}function Zh(r){return r==null?"var(--text-tertiary)":r>=.7?"var(--green)":r>=.4?"var(--yellow)":"var(--red)"}function Jh(r){return r==null?"var(--surface-3)":r>=.7?"var(--green-muted)":r>=.4?"var(--yellow-muted)":"var(--red-muted)"}function Wh({state:r,isReadOnly:c,onDelete:o}){const{plugin:u,skill:x,evals:v,latestBenchmark:p,isDirty:b,caseRunStates:y,regressions:f,iterationCount:S}=r,g=Array.from(y.values()).some(q=>q.status==="running"||q.status==="queued"),C=p==null?void 0:p.overall_pass_rate,w=(v==null?void 0:v.evals.reduce((q,J)=>q+J.assertions.length,0))??0,O=(v==null?void 0:v.evals.length)??0,L=Zh(C),G=Jh(C);return a.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:[a.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[a.jsx("span",{style:{color:"var(--text-tertiary)"},children:u}),a.jsx(Fh,{}),a.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:x}),c&&a.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:[a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),b&&a.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"}),g&&a.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!c&&o&&a.jsx("button",{disabled:g,onClick:()=>{window.confirm(`Delete skill "${x}"? This cannot be undone.`)&&o()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:g?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:g?.4:1,borderRadius:4},onMouseEnter:q=>{g||(q.currentTarget.style.color="var(--red)")},onMouseLeave:q=>{q.currentTarget.style.color="var(--text-tertiary)"},children:a.jsx(Ih,{})}),f.length>0&&a.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.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"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),f.length," regression",f.length>1?"s":""]}),S>0&&a.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",S]}),a.jsx("span",{className:"pill",style:{background:G,color:L},children:C!=null?`${Math.round(C*100)}%`:"--"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[O," case",O!==1?"s":""," / ",w," assert",w!==1?"s":""]})]})]})}function Fh(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Ih(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.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"}),a.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),a.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const Ph=[{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"}]}];function ev({id:r}){const c={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(r){case"editor":return a.jsxs("svg",{...c,children:[a.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),a.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 a.jsxs("svg",{...c,children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.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 a.jsx("svg",{...c,children:a.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return a.jsxs("svg",{...c,children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"6"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return a.jsxs("svg",{...c,children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return a.jsxs("svg",{...c,children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]});case"deps":return a.jsxs("svg",{...c,children:[a.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"}),a.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"})]})}}function tv({activePanel:r,onPanelChange:c,isDirty:o,isRunning:u,hasRegressions:x,isActivationRunning:v}){return a.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:Ph.map((p,b)=>a.jsxs("div",{className:"flex items-center",children:[b>0&&a.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),p.tabs.map(y=>{const f=r===y.id,S=y.id==="editor"&&o||y.id==="run"&&u||y.id==="activation"&&v||y.id==="history"&&x,g=y.id==="run"||y.id==="activation"?"var(--accent)":y.id==="history"?"var(--red)":"var(--yellow)";return a.jsxs("button",{onClick:()=>c(y.id),title:`${y.label} (Ctrl+${y.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:f?"var(--text-primary)":"var(--text-tertiary)",borderBottom:f?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:f?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:C=>{f||(C.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:C=>{f||(C.currentTarget.style.color="var(--text-tertiary)")},children:[a.jsx(ev,{id:y.id}),y.label,S&&a.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:g}})]},y.id)})]},p.label))})}const bx={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 ss({error:r,onRetry:c,onDismiss:o}){const[u,x]=m.useState(null),v=m.useRef(null);m.useEffect(()=>(r.category==="rate_limit"&&r.retryAfterMs?x(Math.ceil(r.retryAfterMs/1e3)):x(null),()=>{v.current&&clearInterval(v.current)}),[r]),m.useEffect(()=>{if(!(u==null||u<=0))return v.current=setInterval(()=>{x(y=>y==null||y<=1?(v.current&&clearInterval(v.current),0):y-1)},1e3),()=>{v.current&&clearInterval(v.current)}},[u!=null&&u>0]);const p=bx[r.category]||bx.unknown,b=u!=null&&u>0;return a.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${p.color} 30%, transparent)`,background:`color-mix(in srgb, ${p.color} 6%, var(--surface-1))`},children:[a.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{style:{fontSize:14},children:p.icon}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:p.color},children:r.title})]}),o&&a.jsx("button",{onClick:o,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-3.5 pb-3",children:[a.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:r.description}),a.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:r.hint}),(c||u!=null)&&a.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:c&&a.jsx("button",{onClick:c,disabled:b,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:b?.5:1},children:b?`Retry in ${u}s`:"Retry"})})]})]})}class lv extends m.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(c,o){console.error("ErrorBoundary caught:",c,o.componentStack)}render(){return this.state.hasError?a.jsxs("div",{style:{padding:24,textAlign:"center"},children:[a.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),a.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),a.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function av(r){const c=r.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(c)?{category:"rate_limit",title:"Rate Limit",description:r,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(c)?{category:"auth",title:"Authentication Failed",description:r,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(c)?{category:"timeout",title:"Request Timed Out",description:r,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(c)?{category:"model_not_found",title:"Model Not Found",description:r,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(c)?{category:"context_window",title:"Content Too Large",description:r,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(c)?{category:"provider_unavailable",title:"Provider Unavailable",description:r,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(c)?{category:"parse_error",title:"Response Parse Error",description:r,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:r,hint:"",retryable:!1}}function nv(r){const c=r.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!c)return{metadata:{},body:r};const o=c[1],u=c[2].trim(),x={},v=o.split(`
|
|
54
|
+
`);p({type:"SET_ACTIVATION_PROMPTS",prompts:Dt}),p({type:"GENERATE_PROMPTS_DONE"})}catch(oe){p({type:"GENERATE_PROMPTS_ERROR",error:oe.message})}},[r,c,j]),Lt=m.useMemo(()=>({state:v,dispatch:p,isReadOnly:x,saveContent:q,saveEvals:J,runCase:ee,runAll:K,cancelCase:P,cancelAll:re,improveForCase:X,applyImproveAndRerun:te,refreshSkillContent:de,generateEvals:ne,runActivationTest:Re,cancelActivation:Oe,generateActivationPrompts:pt,fetchActivationHistory:G,submitAiEdit:ie,cancelAiEdit:_,applyAiEdit:le,discardAiEdit:I,toggleEvalChange:E,selectAllEvalChanges:M,deselectAllEvalChanges:ae,retryEvalsSave:B}),[v,x,q,J,ee,K,P,re,X,te,de,ne,Re,Oe,pt,G,ie,_,le,I,E,M,ae,B]);return a.jsx(Vx.Provider,{value:Lt,children:u})}function Zh(r){return r==null?"var(--text-tertiary)":r>=.7?"var(--green)":r>=.4?"var(--yellow)":"var(--red)"}function Jh(r){return r==null?"var(--surface-3)":r>=.7?"var(--green-muted)":r>=.4?"var(--yellow-muted)":"var(--red-muted)"}function Wh({state:r,isReadOnly:c,onDelete:o}){const{plugin:u,skill:x,evals:v,latestBenchmark:p,isDirty:b,caseRunStates:y,regressions:f,iterationCount:S}=r,g=Array.from(y.values()).some(q=>q.status==="running"||q.status==="queued"),C=p==null?void 0:p.overall_pass_rate,w=(v==null?void 0:v.evals.reduce((q,J)=>q+J.assertions.length,0))??0,O=(v==null?void 0:v.evals.length)??0,L=Zh(C),G=Jh(C);return a.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:[a.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[a.jsx("span",{style:{color:"var(--text-tertiary)"},children:u}),a.jsx(Fh,{}),a.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:x}),c&&a.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:[a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),b&&a.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"}),g&&a.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!c&&o&&a.jsx("button",{disabled:g,onClick:()=>{window.confirm(`Delete skill "${x}"? This cannot be undone.`)&&o()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:g?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:g?.4:1,borderRadius:4},onMouseEnter:q=>{g||(q.currentTarget.style.color="var(--red)")},onMouseLeave:q=>{q.currentTarget.style.color="var(--text-tertiary)"},children:a.jsx(Ih,{})}),f.length>0&&a.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.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"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),f.length," regression",f.length>1?"s":""]}),S>0&&a.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",S]}),a.jsx("span",{className:"pill",style:{background:G,color:L},children:C!=null?`${Math.round(C*100)}%`:"--"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[O," case",O!==1?"s":""," / ",w," assert",w!==1?"s":""]})]})]})}function Fh(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Ih(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.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"}),a.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),a.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const Ph=[{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"}]}];function ev({id:r}){const c={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(r){case"editor":return a.jsxs("svg",{...c,children:[a.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),a.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 a.jsxs("svg",{...c,children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.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 a.jsx("svg",{...c,children:a.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return a.jsxs("svg",{...c,children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"6"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return a.jsxs("svg",{...c,children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return a.jsxs("svg",{...c,children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]});case"deps":return a.jsxs("svg",{...c,children:[a.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"}),a.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"})]})}}function tv({activePanel:r,onPanelChange:c,isDirty:o,isRunning:u,hasRegressions:x,isActivationRunning:v}){return a.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:Ph.map((p,b)=>a.jsxs("div",{className:"flex items-center",children:[b>0&&a.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),p.tabs.map(y=>{const f=r===y.id,S=y.id==="editor"&&o||y.id==="run"&&u||y.id==="activation"&&v||y.id==="history"&&x,g=y.id==="run"||y.id==="activation"?"var(--accent)":y.id==="history"?"var(--red)":"var(--yellow)";return a.jsxs("button",{onClick:()=>c(y.id),title:`${y.label} (Ctrl+${y.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:f?"var(--text-primary)":"var(--text-tertiary)",borderBottom:f?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:f?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:C=>{f||(C.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:C=>{f||(C.currentTarget.style.color="var(--text-tertiary)")},children:[a.jsx(ev,{id:y.id}),y.label,S&&a.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:g}})]},y.id)})]},p.label))})}const bx={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 ss({error:r,onRetry:c,onDismiss:o}){const[u,x]=m.useState(null),v=m.useRef(null);m.useEffect(()=>(r.category==="rate_limit"&&r.retryAfterMs?x(Math.ceil(r.retryAfterMs/1e3)):x(null),()=>{v.current&&clearInterval(v.current)}),[r]),m.useEffect(()=>{if(!(u==null||u<=0))return v.current=setInterval(()=>{x(y=>y==null||y<=1?(v.current&&clearInterval(v.current),0):y-1)},1e3),()=>{v.current&&clearInterval(v.current)}},[u!=null&&u>0]);const p=bx[r.category]||bx.unknown,b=u!=null&&u>0;return a.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${p.color} 30%, transparent)`,background:`color-mix(in srgb, ${p.color} 6%, var(--surface-1))`},children:[a.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{style:{fontSize:14},children:p.icon}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:p.color},children:r.title})]}),o&&a.jsx("button",{onClick:o,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-3.5 pb-3",children:[a.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:r.description}),a.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:r.hint}),(c||u!=null)&&a.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:c&&a.jsx("button",{onClick:c,disabled:b,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:b?.5:1},children:b?`Retry in ${u}s`:"Retry"})})]})]})}class lv extends m.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(c,o){console.error("ErrorBoundary caught:",c,o.componentStack)}render(){return this.state.hasError?a.jsxs("div",{style:{padding:24,textAlign:"center"},children:[a.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),a.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),a.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function av(r){const c=r.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(c)?{category:"rate_limit",title:"Rate Limit",description:r,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(c)?{category:"auth",title:"Authentication Failed",description:r,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(c)?{category:"timeout",title:"Request Timed Out",description:r,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(c)?{category:"model_not_found",title:"Model Not Found",description:r,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(c)?{category:"context_window",title:"Content Too Large",description:r,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(c)?{category:"provider_unavailable",title:"Provider Unavailable",description:r,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(c)?{category:"parse_error",title:"Response Parse Error",description:r,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:r,hint:"",retryable:!1}}function nv(r){const c=r.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!c)return{metadata:{},body:r};const o=c[1],u=c[2].trim(),x={},v=o.split(`
|
|
55
55
|
`);let p="",b=!1;for(const y of v){const f=y.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(f&&p&&b){const C=f[1],w=f[2].trim();let O=x[p];if((typeof O!="object"||Array.isArray(O))&&(O={},x[p]=O),!w)O[C]=[];else{const L=w.match(/^\[(.+)\]$/);L?O[C]=L[1].split(",").map(G=>G.trim().replace(/^["']|["']$/g,"")).filter(Boolean):O[C]=w.replace(/^["']|["']$/g,"")}continue}const S=y.match(/^\s+-\s+(.+)$/);if(S&&p){b=!1;const C=x[p];Array.isArray(C)?C.push(S[1].trim().replace(/^["']|["']$/g,"")):x[p]=[S[1].trim().replace(/^["']|["']$/g,"")];continue}const g=y.match(/^([\w-]+):\s*(.*)$/);if(g){p=g[1];const C=g[2].trim();if(b=!1,!C){x[p]={},b=!0;continue}const w=C.match(/^\[(.+)\]$/);if(w){x[p]=w[1].split(",").map(O=>O.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}x[p]=C.replace(/^["']|["']$/g,"")}}return{metadata:x,body:u}}function Er(r){if(!r)return"";try{let c=r.replace(/^---\n[\s\S]*?\n---\n?/,""),o=sv(c);return o=o.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>'),o=o.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),o=o.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),o=o.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),o=o.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),o=o.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),o=o.replace(/\*([^*]+)\*/g,"<em>$1</em>"),o=o.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),o=o.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),o=o.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),o=o.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),o=o.replace(/\n/g,"<br/>"),o}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</pre>`}}function sv(r){const c=r.split(`
|
|
56
56
|
`),o=[];let u=0;for(;u<c.length;)if(c[u].trim().startsWith("|")&&u+1<c.length&&c[u+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(c[u+1])){const x=jx(c[u]);u+=2;const v=[];for(;u<c.length&&c[u].trim().startsWith("|");)v.push(jx(c[u])),u++;const p='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 y='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';y+="<thead><tr>";for(const f of x)y+=`<th ${p}>${f}</th>`;y+="</tr></thead><tbody>";for(const f of v){y+="<tr>";for(const S of f)y+=`<td ${b}>${S}</td>`;y+="</tr>"}y+="</tbody></table>",o.push(y)}else o.push(c[u]),u++;return o.join(`
|
|
57
57
|
`)}function jx(r){return r.split("|").map(c=>c.trim()).filter(c=>c.length>0)}function kr(r,c){const o=r.split(`
|
|
58
58
|
`),u=c.split(`
|
|
59
59
|
`);if(o.length>1e3||u.length>1e3)return[...o.map(S=>({type:"unchanged",content:S}))];const x=o.length,v=u.length,p=Array.from({length:x+1},()=>new Array(v+1).fill(0));for(let S=1;S<=x;S++)for(let g=1;g<=v;g++)o[S-1]===u[g-1]?p[S][g]=p[S-1][g-1]+1:p[S][g]=Math.max(p[S-1][g],p[S][g-1]);const b=[];let y=x,f=v;for(;y>0||f>0;)y>0&&f>0&&o[y-1]===u[f-1]?(b.push({type:"unchanged",content:o[y-1]}),y--,f--):f>0&&(y===0||p[y][f-1]>=p[y-1][f])?(b.push({type:"added",content:u[f-1]}),f--):(b.push({type:"removed",content:o[y-1]}),y--);return b.reverse()}function rv(r,c){if(c&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(r))return a.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 a.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:u.has(r)?"var(--accent)":"var(--green)"}})}function rs({entries:r,isRunning:c}){const[o,u]=m.useState(!1),x=m.useRef(null);return m.useEffect(()=>{x.current&&!o&&(x.current.scrollTop=x.current.scrollHeight)},[r,o]),r.length===0&&!c?null:a.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("button",{onClick:()=>u(!o),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:[a.jsxs("span",{className:"flex items-center gap-2",children:[c&&a.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",r.length,")"]}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:o?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!o&&a.jsx("div",{ref:x,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:r.map((v,p)=>{const b=p===r.length-1&&c,y=p===0?"0s":`+${((v.timestamp-r[0].timestamp)/1e3).toFixed(1)}s`;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:b?1:.7},children:[rv(v.phase,b),a.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:y}),a.jsx("span",{style:{color:b?"var(--text-primary)":"var(--text-secondary)"},children:v.message}),v.current!=null&&v.total!=null&&a.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",v.current,"/",v.total,"]"]})]},p)})})]})}function iv({plugin:r,skill:c,skillContent:o,onApplied:u}){const[x,v]=m.useState("closed"),{config:p}=Na(),[b,y]=m.useState("claude-cli"),[f,S]=m.useState("opus"),[g,C]=m.useState([]),[w,O]=m.useState(""),[L,G]=m.useState(""),[q,J]=m.useState(null),[ee,K]=m.useState(null),[P,re]=m.useState([]),[X,te]=m.useState(!1),Q=m.useRef(null);m.useEffect(()=>{if(!p)return;p.providers.find(M=>M.id==="claude-cli"&&M.available)&&(y("claude-cli"),S("opus"))},[p]),m.useEffect(()=>()=>{var E;(E=Q.current)==null||E.abort()},[]);function F(){return p==null?void 0:p.providers.find(E=>E.id===b&&E.available)}const pe=m.useCallback(()=>{var E;(E=Q.current)==null||E.abort(),v("open")},[]);async function ie(){v("loading"),J(null),K(null),re([]);const E=new AbortController;Q.current=E;try{const M=await fetch(`/api/skills/${encodeURIComponent(r)}/${encodeURIComponent(c)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,model:f}),signal:E.signal});if(!M.ok||!M.body){let D=`HTTP ${M.status}`;try{const W=await M.json();W.error&&(D=W.error)}catch{}throw new Error(D)}const ae=M.body.getReader(),B=new TextDecoder;let de="",j="";for(;;){const{done:D,value:W}=await ae.read();if(D)break;de+=B.decode(W,{stream:!0});const ne=de.split(`
|
|
60
|
-
`);de=ne.pop()||"";for(const ue of ne)if(ue.startsWith("event: "))j=ue.slice(7).trim();else if(ue.startsWith("data: ")){try{const fe=JSON.parse(ue.slice(6));j==="progress"?re(ve=>[...ve,{phase:fe.phase,message:fe.message,timestamp:Date.now()}]):j==="done"||j==="complete"?(O(fe.improved),G(fe.reasoning||""),C(kr(fe.original||o,fe.improved)),v("diff_shown")):j==="error"&&(J(fe.message||fe.description||"Unknown error"),fe.category&&K(fe),v("open"))}catch{}j=""}}}catch(M){M.name!=="AbortError"&&(J(M.message),v("open"))}finally{Q.current=null}}async function _(){te(!0);try{await be.applyImprovement(r,c,w),u(w),v("closed")}catch(E){J(E.message)}finally{te(!1)}}function le(){v("closed"),C([]),O(""),G(""),J(null)}if(x==="closed")return a.jsxs("button",{onClick:()=>v("open"),className:"btn btn-secondary mb-5",disabled:!o,children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const I=F();return a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),a.jsx("button",{onClick:le,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:E=>{E.currentTarget.style.background="var(--surface-3)"},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-5 py-4",children:[(x==="open"||x==="loading")&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:b,onChange:E=>{y(E.target.value);const M=p==null?void 0:p.providers.find(ae=>ae.id===E.target.value);M!=null&&M.models[0]&&S(M.models[0].id)},disabled:x==="loading",children:p==null?void 0:p.providers.filter(E=>E.available).map(E=>a.jsx("option",{value:E.id,children:E.label},E.id))})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:f,onChange:E=>S(E.target.value),disabled:x==="loading",children:I==null?void 0:I.models.map(E=>a.jsx("option",{value:E.id,children:E.label},E.id))})]}),x==="loading"?a.jsx("button",{onClick:pe,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):a.jsx("button",{onClick:ie,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),x==="loading"&&P.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx(rs,{entries:P,isRunning:!0})})]}),q&&a.jsx("div",{className:"mb-4",children:ee?a.jsx(ss,{error:ee,onRetry:ie,onDismiss:()=>{J(null),K(null)}}):a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:q})}),x==="diff_shown"&&a.jsxs(a.Fragment,{children:[L&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),L]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:g.map((E,M)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:E.type==="added"?"rgba(34,197,94,0.1)":E.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:E.type==="added"?"var(--green)":E.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:E.type==="added"?"3px solid var(--green)":E.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:E.type==="added"?"+":E.type==="removed"?"-":" "}),E.content]},M))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:_,disabled:X,className:"btn btn-primary",children:X?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),a.jsx("button",{onClick:le,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Sx={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"}},ov={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function cv({change:r,index:c,selected:o,onToggle:u,originalEval:x}){var g;const[v,p]=m.useState(!1),b=Sx[r.action]??Sx.add,y=ov[r.action]??"var(--border-subtle)",f=r.action==="remove"?(x==null?void 0:x.name)??`Eval #${r.evalId}`:((g=r.eval)==null?void 0:g.name)??"Unnamed",S=m.useCallback(()=>u(c),[u,c]);return a.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${y}`,opacity:o?1:.5},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("input",{type:"checkbox",checked:o,onChange:S,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),a.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:b.bg,color:b.color,padding:"1px 6px"},children:b.label}),a.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:f}),a.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:r.reason}),a.jsx("button",{onClick:()=>p(!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:C=>{C.currentTarget.style.background="var(--surface-3)"},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),v&&a.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[r.action==="add"&&r.eval&&a.jsx(uv,{evalCase:r.eval}),r.action==="modify"&&r.eval&&x&&a.jsx(dv,{original:x,proposed:r.eval}),r.action==="remove"&&x&&a.jsx(fv,{evalCase:x})]})]})}function uv({evalCase:r}){var c;return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[a.jsx(lc,{label:"Prompt",value:r.prompt}),a.jsx(lc,{label:"Expected",value:r.expected_output}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((c=r.assertions)==null?void 0:c.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-1",children:(r.assertions??[]).map(o=>a.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",o.text]},o.id))})]})]})}function dv({original:r,proposed:c}){const o=[];r.name!==c.name&&o.push({label:"Name",old:r.name,new:c.name}),r.prompt!==c.prompt&&o.push({label:"Prompt",old:r.prompt,new:c.prompt}),r.expected_output!==c.expected_output&&o.push({label:"Expected",old:r.expected_output,new:c.expected_output});const u=r.assertions??[],x=c.assertions??[],v=new Set(u.map(f=>f.text)),p=new Set(x.map(f=>f.text)),b=x.filter(f=>!v.has(f.text)),y=u.filter(f=>!p.has(f.text));return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[o.map(f=>a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:f.label}),a.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[a.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",ac(f.old,120)]}),a.jsxs("div",{style:{color:"var(--green)"},children:["+ ",ac(f.new,120)]})]})]},f.label)),(b.length>0||y.length>0)&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),a.jsxs("div",{className:"mt-1 space-y-0.5",children:[y.map(f=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",f.text]},f.id)),b.map(f=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",f.text]},f.id))]})]}),o.length===0&&b.length===0&&y.length===0&&a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function fv({evalCase:r}){var c;return a.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[a.jsx(lc,{label:"Prompt",value:r.prompt}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((c=r.assertions)==null?void 0:c.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-0.5",children:(r.assertions??[]).map(o=>a.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:o.text},o.id))})]})]})}function lc({label:r,value:c}){return a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:r}),a.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:ac(c,300)})]})}function ac(r,c){return r.length>c?r.slice(0,c)+"...":r}const Nx={remove:0,modify:1,add:2};function xv({changes:r,selections:c,currentEvals:o,onToggle:u,onSelectAll:x,onDeselectAll:v}){if(r.length===0)return null;const p=r.map((y,f)=>({change:y,originalIndex:f}));p.sort((y,f)=>(Nx[y.change.action]??2)-(Nx[f.change.action]??2));const b=Array.from(c.values()).filter(Boolean).length;return a.jsxs("div",{className:"mt-3 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",b,"/",r.length," selected)"]})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("button",{onClick:x,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:y=>{y.currentTarget.style.background="transparent"},children:"Select All"}),a.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:y=>{y.currentTarget.style.background="var(--surface-3)"},onMouseLeave:y=>{y.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),a.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:p.map(({change:y,originalIndex:f})=>a.jsx(cv,{change:y,index:f,selected:c.get(f)??!1,onToggle:u,originalEval:y.evalId!=null?o.find(S=>S.id===y.evalId):void 0},f))})]})}function pv(){var E;const{state:r,dispatch:c,submitAiEdit:o,applyAiEdit:u,discardAiEdit:x,cancelAiEdit:v,toggleEvalChange:p,selectAllEvalChanges:b,deselectAllEvalChanges:y,retryEvalsSave:f}=tl(),{aiEditLoading:S,aiEditResult:g,aiEditError:C,aiEditClassifiedError:w,aiEditProgress:O,aiEditEvalChanges:L,aiEditEvalSelections:G,aiEditEvalsRetry:q}=r,[J,ee]=m.useState(""),{config:K}=Na(),[P,re]=m.useState("claude-cli"),[X,te]=m.useState("opus"),Q=m.useRef(null);m.useEffect(()=>{var M;(M=Q.current)==null||M.focus()},[]),m.useEffect(()=>{if(!K)return;K.providers.find(ae=>ae.id==="claude-cli"&&ae.available)&&(re("claude-cli"),te("opus"))},[K]);const F=K==null?void 0:K.providers.find(M=>M.id===P&&M.available),pe=m.useCallback(()=>{const M=J.trim();!M||S||o(M,P,X)},[J,S,o,P,X]),ie=m.useCallback(M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),pe()),M.key==="Escape"&&(M.preventDefault(),S?v():x())},[pe,S,v,x]),_=m.useCallback(()=>{c({type:"CLOSE_AI_EDIT"}),c({type:"OPEN_AI_EDIT"})},[c]),le=g?kr(r.skillContent,g.improved):[],I=((E=r.evals)==null?void 0:E.evals)??[];return a.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),a.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:M=>{M.currentTarget.style.background="var(--surface-3)"},onMouseLeave:M=>{M.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-4 py-3",children:[!g&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-2.5",children:[a.jsx("div",{className:"flex-1",children:a.jsx("textarea",{ref:Q,value:J,onChange:M=>ee(M.target.value),onKeyDown:ie,placeholder:"e.g., Add an error handling section...",disabled:S,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:M=>{const ae=M.currentTarget;ae.style.height="auto",ae.style.height=Math.min(ae.scrollHeight,96)+"px"}})}),a.jsxs("div",{style:{minWidth:100},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:P,onChange:M=>{re(M.target.value);const ae=K==null?void 0:K.providers.find(B=>B.id===M.target.value);ae!=null&&ae.models[0]&&te(ae.models[0].id)},disabled:S,style:{width:"100%"},children:K==null?void 0:K.providers.filter(M=>M.available).map(M=>a.jsx("option",{value:M.id,children:M.label},M.id))})]}),a.jsxs("div",{style:{minWidth:80},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:X,onChange:M=>te(M.target.value),disabled:S,style:{width:"100%"},children:F==null?void 0:F.models.map(M=>a.jsx("option",{value:M.id,children:M.label},M.id))})]}),S?a.jsx("button",{onClick:v,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):a.jsx("button",{onClick:pe,disabled:!J.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),S&&O.length>0&&a.jsx("div",{className:"mt-2.5",children:a.jsx(rs,{entries:O,isRunning:!0})})]}),C&&a.jsx("div",{className:"mt-3",children:w?a.jsx(ss,{error:w,onRetry:_,onDismiss:x}):a.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:C})}),g&&a.jsxs("div",{className:"animate-fade-in",children:[g.reasoning&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),g.reasoning]}),a.jsx("div",{className:"mb-1",children:a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:le.map((M,ae)=>a.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:M.type==="added"?"rgba(34,197,94,0.1)":M.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:M.type==="added"?"var(--green)":M.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:M.type==="added"?"3px solid var(--green)":M.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:M.type==="added"?"+":M.type==="removed"?"-":" "}),M.content]},ae))}),a.jsx(xv,{changes:L,selections:G,currentEvals:I,onToggle:p,onSelectAll:b,onDeselectAll:y}),q&&a.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:[a.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),a.jsx("button",{onClick:f,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsxs("button",{onClick:u,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:x,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),a.jsx("button",{onClick:_,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function mv(r,c){const[o,u]=m.useState([]),[x,v]=m.useState("SKILL.md"),[p,b]=m.useState(null),[y,f]=m.useState(!1),[S,g]=m.useState(null),C=m.useCallback(async()=>{try{const L=await be.getSkillFiles(r,c);u(L.files)}catch{u([])}},[r,c]);m.useEffect(()=>{v("SKILL.md"),b(null),g(null),C()},[r,c,C]);const w=m.useCallback(async L=>{if(v(L),L==="SKILL.md"){b(null),g(null);return}f(!0),g(null);try{const G=await be.getSkillFile(r,c,L);b(G)}catch(G){g(`Unable to open file: ${G.message}`),b(null)}finally{f(!1)}},[r,c]),O=m.useCallback(()=>{C()},[C]);return{files:o,activeFile:x,secondaryContent:p,loading:y,error:S,selectFile:w,refresh:O,isSkillMd:x==="SKILL.md"}}function hv(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function vv(r){const c=[],o=new Map;for(const u of r){const x=u.path.split("/"),p={name:x[x.length-1],path:u.path,type:u.type,size:u.size,children:[]};o.set(u.path,p)}for(const u of r){const x=u.path.split("/");if(x.length===1){const v=o.get(u.path);v&&c.push(v)}else{const v=x.slice(0,-1).join("/"),p=o.get(v),b=o.get(u.path);p&&b&&p.children.push(b)}}return c}function Gx({expanded:r}){return a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:r?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Yx(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.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 yv(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function gv(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"23 4 23 10 17 10"}),a.jsx("polyline",{points:"1 20 1 14 7 14"}),a.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 Qx({node:r,depth:c,activeFile:o,onSelect:u}){const[x,v]=m.useState(!0),p=r.path===o;return r.type==="dir"?a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>v(!x),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+c*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:[a.jsx(Gx,{expanded:x}),a.jsx(Yx,{}),a.jsxs("span",{children:[r.name,"/"]})]}),x&&r.children.map(b=>a.jsx(Qx,{node:b,depth:c+1,activeFile:o,onSelect:u},b.path))]}):a.jsxs("button",{onClick:()=>u(r.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+c*14}px`,paddingTop:2,paddingBottom:2,background:p?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:p?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[a.jsx("span",{style:{width:10}}),a.jsx(yv,{}),a.jsx("span",{style:{flex:1},children:r.name}),a.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:hv(r.size)})]})}function bv({files:r,activeFile:c,onSelect:o,onRefresh:u}){const[x,v]=m.useState(!1),p=m.useMemo(()=>vv(r),[r]);return a.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>v(!x),children:[a.jsx(Gx,{expanded:x}),a.jsx(Yx,{}),a.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c}),a.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:a.jsx(gv,{})})]}),x&&a.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:p.length===0?a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):p.map(b=>a.jsx(Qx,{node:b,depth:0,activeFile:c,onSelect:o},b.path))})]})}function gr(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function jv(r){try{return JSON.stringify(JSON.parse(r),null,2)}catch{return r}}function Sv(r){const c=r.toLowerCase();return c.endsWith(".json")?"json":c.endsWith(".md")?"md":"other"}function Ex({content:r}){return a.jsx("textarea",{readOnly:!0,value:r,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 kx({content:r,fileType:c}){if(c==="json"){const o=jv(r);return a.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:o})}return c==="md"?a.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:Er(r)}}):a.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:r})}function Cx(r){try{return JSON.stringify(JSON.parse(r),null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"\\]|\\.)*"\s*:/g,o=>`<span style="color:#6383ff">${o}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,o=>`<span style="color:#22c55e">${o.slice(0,2)}<span style="color:#22c55e">${o.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(o,u)=>`: <span style="color:#fb923c">${u}</span>`).replace(/:\s*(true|false|null)/g,(o,u)=>`: <span style="color:#a855f7">${u}</span>`)}catch{return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}}function Nv({file:r,loading:c,error:o,viewMode:u,plugin:x,skill:v,onSaved:p,onDirtyChange:b}){const[y,f]=m.useState(u),[S,g]=m.useState(!1),[C,w]=m.useState(""),[O,L]=m.useState(!1),[G,q]=m.useState(null),J=u!==y?u:y;m.useEffect(()=>{b==null||b(S)},[S,b]);const ee=m.useCallback(()=>{(r==null?void 0:r.content)!=null&&(w(r.content),g(!0))},[r]),K=m.useCallback(()=>{g(!1)},[]),P=m.useCallback(async()=>{if(!(!x||!v||!r)){L(!0);try{await be.saveSkillFile(x,v,r.path,C),q("Saved"),g(!1),p==null||p(),setTimeout(()=>q(null),2e3)}catch(te){q(`Save failed: ${te.message}`),setTimeout(()=>q(null),3e3)}finally{L(!1)}}},[x,v,r,C,p]);if(m.useEffect(()=>{if(!S)return;const te=Q=>{(Q.ctrlKey||Q.metaKey)&&Q.key==="s"&&(Q.preventDefault(),P())};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[S,P]),c)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(o)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:a.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[a.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),a.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:o})]})});if(!r)return null;if(r.binary)return a.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",gr(r.size),") — cannot be displayed"]});const re=r.content??"",X=Sv(r.path);return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[r.truncated&&a.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 ",gr(512*1024)," — ",gr(r.size)," total"]}),a.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(X==="md"||X==="json")&&["raw","split","preview"].map(te=>a.jsx("button",{onClick:()=>f(te),style:{padding:"2px 8px",fontSize:11,background:J===te?"var(--accent-muted)":"none",color:J===te?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:te},te)),a.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[gr(r.size),x&&v&&!r.binary&&!S&&a.jsx("button",{onClick:ee,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),S&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:P,disabled:O,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:O?.6:1},children:O?"Saving...":"Save"}),a.jsx("button",{onClick:K,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),G&&a.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}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:S?a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[a.jsx("textarea",{value:C,onChange:te=>w(te.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}}),a.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:[a.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),a.jsx("button",{onClick:P,disabled:O,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:O?.6:1},children:O?"Saving...":"Save"}),a.jsx("button",{onClick:K,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):J==="split"&&X!=="other"?a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:a.jsx(Ex,{content:re})}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:X==="json"?a.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:Cx(re)}}):a.jsx(kx,{content:re,fileType:X})})]}):J==="preview"&&X!=="other"?X==="json"?a.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:Cx(re)}}):a.jsx(kx,{content:re,fileType:X}):a.jsx(Ex,{content:re})})]})}function Ev({size:r=15}){return a.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function kv({size:r=15}){return a.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),a.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function Cv({size:r=15}){return a.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Tv({size:r=15}){return a.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}function Ko({size:r=15}){return a.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function wv(){const{state:r,dispatch:c,saveContent:o,isReadOnly:u}=tl(),{plugin:x,skill:v,skillContent:p,isDirty:b,improveTarget:y,aiEditOpen:f}=r,[S,g]=m.useState("split"),[C,w]=m.useState(!1),O=m.useRef(null),[L,G]=m.useState(!1),[q,J]=m.useState(""),[ee,K]=m.useState(!1),[P,re]=m.useState(null),[X,te]=m.useState([]),[Q,F]=m.useState([]),[pe,ie]=m.useState(null),_=m.useRef(null),{config:le}=Na(),{files:I,activeFile:E,secondaryContent:M,loading:ae,error:B,selectFile:de,refresh:j,isSkillMd:D}=mv(x??"",v??""),[W,ne]=m.useState(!1),ue=m.useCallback($=>{W&&!window.confirm("You have unsaved changes. Discard?")||de($)},[W,de]);m.useEffect(()=>()=>{var $;($=_.current)==null||$.abort()},[]);const{metadata:fe,body:ve}=nv(p),Be=fe["allowed-tools"],Re=Array.isArray(Be)?Be:typeof Be=="string"?[Be]:[],pt=fe.name,Lt=fe.description,Z=fe.metadata,oe=typeof Z=="object"&&!Array.isArray(Z)?Z:null,se=fe.version||(oe==null?void 0:oe.version),me=fe.tags||(oe==null?void 0:oe.tags),ge=Array.isArray(me)?me:typeof me=="string"?me.split(",").map($=>$.trim()).filter(Boolean):[],Ye=new Set(["name","description","metadata","allowed-tools","version","tags"]),ut=Object.entries(fe).filter(([$])=>!Ye.has($)),Xe=m.useCallback(async()=>{w(!0),await o(),w(!1)},[o]),Dt=m.useCallback($=>{($.ctrlKey||$.metaKey)&&$.key==="s"&&($.preventDefault(),$.stopPropagation(),b&&Xe()),($.ctrlKey||$.metaKey)&&$.key==="k"&&($.preventDefault(),$.stopPropagation(),c({type:f?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[b,Xe,f,c]),mt=m.useCallback(async()=>{var ze,at;if(!q.trim())return;(ze=_.current)==null||ze.abort();const $=new AbortController;_.current=$,K(!0),ie(null),F([]),re(null),te([]);try{const Je=(le==null?void 0:le.provider)||"claude-cli",Rl=(le==null?void 0:le.model)||"sonnet",Ot=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:q,provider:Je,model:Rl}),signal:$.signal});if(!Ot.ok||!Ot.body){let et=`HTTP ${Ot.status}`;try{const al=await Ot.json();al.error&&(et=al.error)}catch{}throw new Error(et)}const sa=Ot.body.getReader(),kt=new TextDecoder;let Fe="",nt="";for(;;){const{done:et,value:al}=await sa.read();if(et)break;Fe+=kt.decode(al,{stream:!0});const Qe=Fe.split(`
|
|
60
|
+
`);de=ne.pop()||"";for(const ue of ne)if(ue.startsWith("event: "))j=ue.slice(7).trim();else if(ue.startsWith("data: ")){try{const fe=JSON.parse(ue.slice(6));j==="progress"?re(ve=>[...ve,{phase:fe.phase,message:fe.message,timestamp:Date.now()}]):j==="done"||j==="complete"?(O(fe.improved),G(fe.reasoning||""),C(kr(fe.original||o,fe.improved)),v("diff_shown")):j==="error"&&(J(fe.message||fe.description||"Unknown error"),fe.category&&K(fe),v("open"))}catch{}j=""}}}catch(M){M.name!=="AbortError"&&(J(M.message),v("open"))}finally{Q.current=null}}async function _(){te(!0);try{await be.applyImprovement(r,c,w),u(w),v("closed")}catch(E){J(E.message)}finally{te(!1)}}function le(){v("closed"),C([]),O(""),G(""),J(null)}if(x==="closed")return a.jsxs("button",{onClick:()=>v("open"),className:"btn btn-secondary mb-5",disabled:!o,children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const I=F();return a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),a.jsx("button",{onClick:le,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:E=>{E.currentTarget.style.background="var(--surface-3)"},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-5 py-4",children:[(x==="open"||x==="loading")&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:b,onChange:E=>{y(E.target.value);const M=p==null?void 0:p.providers.find(ae=>ae.id===E.target.value);M!=null&&M.models[0]&&S(M.models[0].id)},disabled:x==="loading",children:p==null?void 0:p.providers.filter(E=>E.available).map(E=>a.jsx("option",{value:E.id,children:E.label},E.id))})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:f,onChange:E=>S(E.target.value),disabled:x==="loading",children:I==null?void 0:I.models.map(E=>a.jsx("option",{value:E.id,children:E.label},E.id))})]}),x==="loading"?a.jsx("button",{onClick:pe,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):a.jsx("button",{onClick:ie,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),x==="loading"&&P.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx(rs,{entries:P,isRunning:!0})})]}),q&&a.jsx("div",{className:"mb-4",children:ee?a.jsx(ss,{error:ee,onRetry:ie,onDismiss:()=>{J(null),K(null)}}):a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:q})}),x==="diff_shown"&&a.jsxs(a.Fragment,{children:[L&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),L]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:g.map((E,M)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:E.type==="added"?"rgba(34,197,94,0.1)":E.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:E.type==="added"?"var(--green)":E.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:E.type==="added"?"3px solid var(--green)":E.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:E.type==="added"?"+":E.type==="removed"?"-":" "}),E.content]},M))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:_,disabled:X,className:"btn btn-primary",children:X?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),a.jsx("button",{onClick:le,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Sx={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"}},ov={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function cv({change:r,index:c,selected:o,onToggle:u,originalEval:x}){var g;const[v,p]=m.useState(!1),b=Sx[r.action]??Sx.add,y=ov[r.action]??"var(--border-subtle)",f=r.action==="remove"?(x==null?void 0:x.name)??`Eval #${r.evalId}`:((g=r.eval)==null?void 0:g.name)??"Unnamed",S=m.useCallback(()=>u(c),[u,c]);return a.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${y}`,opacity:o?1:.5},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("input",{type:"checkbox",checked:o,onChange:S,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),a.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:b.bg,color:b.color,padding:"1px 6px"},children:b.label}),a.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:f}),a.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:r.reason}),a.jsx("button",{onClick:()=>p(!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:C=>{C.currentTarget.style.background="var(--surface-3)"},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),v&&a.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[r.action==="add"&&r.eval&&a.jsx(uv,{evalCase:r.eval}),r.action==="modify"&&r.eval&&x&&a.jsx(dv,{original:x,proposed:r.eval}),r.action==="remove"&&x&&a.jsx(fv,{evalCase:x})]})]})}function uv({evalCase:r}){var c;return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[a.jsx(lc,{label:"Prompt",value:r.prompt}),a.jsx(lc,{label:"Expected",value:r.expected_output}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((c=r.assertions)==null?void 0:c.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-1",children:(r.assertions??[]).map(o=>a.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",o.text]},o.id))})]})]})}function dv({original:r,proposed:c}){const o=[];r.name!==c.name&&o.push({label:"Name",old:r.name,new:c.name}),r.prompt!==c.prompt&&o.push({label:"Prompt",old:r.prompt,new:c.prompt}),r.expected_output!==c.expected_output&&o.push({label:"Expected",old:r.expected_output,new:c.expected_output});const u=r.assertions??[],x=c.assertions??[],v=new Set(u.map(f=>f.text)),p=new Set(x.map(f=>f.text)),b=x.filter(f=>!v.has(f.text)),y=u.filter(f=>!p.has(f.text));return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[o.map(f=>a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:f.label}),a.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[a.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",ac(f.old,120)]}),a.jsxs("div",{style:{color:"var(--green)"},children:["+ ",ac(f.new,120)]})]})]},f.label)),(b.length>0||y.length>0)&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),a.jsxs("div",{className:"mt-1 space-y-0.5",children:[y.map(f=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",f.text]},f.id)),b.map(f=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",f.text]},f.id))]})]}),o.length===0&&b.length===0&&y.length===0&&a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function fv({evalCase:r}){var c;return a.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[a.jsx(lc,{label:"Prompt",value:r.prompt}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((c=r.assertions)==null?void 0:c.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-0.5",children:(r.assertions??[]).map(o=>a.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:o.text},o.id))})]})]})}function lc({label:r,value:c}){return a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:r}),a.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:ac(c,300)})]})}function ac(r,c){return r.length>c?r.slice(0,c)+"...":r}const Nx={remove:0,modify:1,add:2};function xv({changes:r,selections:c,currentEvals:o,onToggle:u,onSelectAll:x,onDeselectAll:v}){if(r.length===0)return null;const p=r.map((y,f)=>({change:y,originalIndex:f}));p.sort((y,f)=>(Nx[y.change.action]??2)-(Nx[f.change.action]??2));const b=Array.from(c.values()).filter(Boolean).length;return a.jsxs("div",{className:"mt-3 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",b,"/",r.length," selected)"]})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("button",{onClick:x,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:y=>{y.currentTarget.style.background="transparent"},children:"Select All"}),a.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:y=>{y.currentTarget.style.background="var(--surface-3)"},onMouseLeave:y=>{y.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),a.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:p.map(({change:y,originalIndex:f})=>a.jsx(cv,{change:y,index:f,selected:c.get(f)??!1,onToggle:u,originalEval:y.evalId!=null?o.find(S=>S.id===y.evalId):void 0},f))})]})}function pv(){var E;const{state:r,dispatch:c,submitAiEdit:o,applyAiEdit:u,discardAiEdit:x,cancelAiEdit:v,toggleEvalChange:p,selectAllEvalChanges:b,deselectAllEvalChanges:y,retryEvalsSave:f}=tl(),{aiEditLoading:S,aiEditResult:g,aiEditError:C,aiEditClassifiedError:w,aiEditProgress:O,aiEditEvalChanges:L,aiEditEvalSelections:G,aiEditEvalsRetry:q}=r,[J,ee]=m.useState(""),{config:K}=Na(),[P,re]=m.useState("claude-cli"),[X,te]=m.useState("opus"),Q=m.useRef(null);m.useEffect(()=>{var M;(M=Q.current)==null||M.focus()},[]),m.useEffect(()=>{if(!K)return;K.providers.find(ae=>ae.id==="claude-cli"&&ae.available)&&(re("claude-cli"),te("opus"))},[K]);const F=K==null?void 0:K.providers.find(M=>M.id===P&&M.available),pe=m.useCallback(()=>{const M=J.trim();!M||S||o(M,P,X)},[J,S,o,P,X]),ie=m.useCallback(M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),pe()),M.key==="Escape"&&(M.preventDefault(),S?v():x())},[pe,S,v,x]),_=m.useCallback(()=>{c({type:"CLOSE_AI_EDIT"}),c({type:"OPEN_AI_EDIT"})},[c]),le=g?kr(r.skillContent,g.improved):[],I=((E=r.evals)==null?void 0:E.evals)??[];return a.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),a.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:M=>{M.currentTarget.style.background="var(--surface-3)"},onMouseLeave:M=>{M.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-4 py-3",children:[!g&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-2.5",children:[a.jsx("div",{className:"flex-1",children:a.jsx("textarea",{ref:Q,value:J,onChange:M=>ee(M.target.value),onKeyDown:ie,placeholder:"e.g., Add an error handling section...",disabled:S,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:M=>{const ae=M.currentTarget;ae.style.height="auto",ae.style.height=Math.min(ae.scrollHeight,96)+"px"}})}),a.jsxs("div",{style:{minWidth:100},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:P,onChange:M=>{re(M.target.value);const ae=K==null?void 0:K.providers.find(B=>B.id===M.target.value);ae!=null&&ae.models[0]&&te(ae.models[0].id)},disabled:S,style:{width:"100%"},children:K==null?void 0:K.providers.filter(M=>M.available).map(M=>a.jsx("option",{value:M.id,children:M.label},M.id))})]}),a.jsxs("div",{style:{minWidth:80},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:X,onChange:M=>te(M.target.value),disabled:S,style:{width:"100%"},children:F==null?void 0:F.models.map(M=>a.jsx("option",{value:M.id,children:M.label},M.id))})]}),S?a.jsx("button",{onClick:v,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):a.jsx("button",{onClick:pe,disabled:!J.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),S&&O.length>0&&a.jsx("div",{className:"mt-2.5",children:a.jsx(rs,{entries:O,isRunning:!0})})]}),C&&a.jsx("div",{className:"mt-3",children:w?a.jsx(ss,{error:w,onRetry:_,onDismiss:x}):a.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:C})}),g&&a.jsxs("div",{className:"animate-fade-in",children:[g.reasoning&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),g.reasoning]}),a.jsx("div",{className:"mb-1",children:a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:le.map((M,ae)=>a.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:M.type==="added"?"rgba(34,197,94,0.1)":M.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:M.type==="added"?"var(--green)":M.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:M.type==="added"?"3px solid var(--green)":M.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:M.type==="added"?"+":M.type==="removed"?"-":" "}),M.content]},ae))}),a.jsx(xv,{changes:L,selections:G,currentEvals:I,onToggle:p,onSelectAll:b,onDeselectAll:y}),q&&a.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:[a.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),a.jsx("button",{onClick:f,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsxs("button",{onClick:u,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:x,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),a.jsx("button",{onClick:_,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function mv(r,c){const[o,u]=m.useState([]),[x,v]=m.useState("SKILL.md"),[p,b]=m.useState(null),[y,f]=m.useState(!1),[S,g]=m.useState(null),C=m.useCallback(async()=>{try{const L=await be.getSkillFiles(r,c);u(L.files)}catch{u([])}},[r,c]);m.useEffect(()=>{v("SKILL.md"),b(null),g(null),C()},[r,c,C]);const w=m.useCallback(async L=>{if(v(L),L==="SKILL.md"){b(null),g(null);return}f(!0),g(null);try{const G=await be.getSkillFile(r,c,L);b(G)}catch(G){g(`Unable to open file: ${G.message}`),b(null)}finally{f(!1)}},[r,c]),O=m.useCallback(()=>{C()},[C]);return{files:o,activeFile:x,secondaryContent:p,loading:y,error:S,selectFile:w,refresh:O,isSkillMd:x==="SKILL.md"}}function hv(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function vv(r){const c=[],o=new Map;for(const u of r){const x=u.path.split("/"),p={name:x[x.length-1],path:u.path,type:u.type,size:u.size,children:[]};o.set(u.path,p)}for(const u of r){const x=u.path.split("/");if(x.length===1){const v=o.get(u.path);v&&c.push(v)}else{const v=x.slice(0,-1).join("/"),p=o.get(v),b=o.get(u.path);p&&b&&p.children.push(b)}}return c}function Gx({expanded:r}){return a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:r?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Yx(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.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 yv(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function gv(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"23 4 23 10 17 10"}),a.jsx("polyline",{points:"1 20 1 14 7 14"}),a.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 Qx({node:r,depth:c,activeFile:o,onSelect:u}){const[x,v]=m.useState(!0),p=r.path===o;return r.type==="dir"?a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>v(!x),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+c*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:[a.jsx(Gx,{expanded:x}),a.jsx(Yx,{}),a.jsxs("span",{children:[r.name,"/"]})]}),x&&r.children.map(b=>a.jsx(Qx,{node:b,depth:c+1,activeFile:o,onSelect:u},b.path))]}):a.jsxs("button",{onClick:()=>u(r.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+c*14}px`,paddingTop:2,paddingBottom:2,background:p?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:p?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[a.jsx("span",{style:{width:10}}),a.jsx(yv,{}),a.jsx("span",{style:{flex:1},children:r.name}),a.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:hv(r.size)})]})}function bv({files:r,activeFile:c,onSelect:o,onRefresh:u}){const[x,v]=m.useState(!1),p=m.useMemo(()=>vv(r),[r]);return a.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>v(!x),children:[a.jsx(Gx,{expanded:x}),a.jsx(Yx,{}),a.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c}),a.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:a.jsx(gv,{})})]}),x&&a.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:p.length===0?a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):p.map(b=>a.jsx(Qx,{node:b,depth:0,activeFile:c,onSelect:o},b.path))})]})}function gr(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function jv(r){try{return JSON.stringify(JSON.parse(r),null,2)}catch{return r}}function Sv(r){const c=r.toLowerCase();return c.endsWith(".json")?"json":c.endsWith(".md")?"md":"other"}function Ex({content:r}){return a.jsx("textarea",{readOnly:!0,value:r,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 kx({content:r,fileType:c}){if(c==="json"){const o=jv(r);return a.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:o})}return c==="md"?a.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:Er(r)}}):a.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:r})}function Cx(r){try{return JSON.stringify(JSON.parse(r),null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"\\]|\\.)*"\s*:/g,o=>`<span style="color:#6383ff">${o}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,o=>`<span style="color:#22c55e">${o.slice(0,2)}<span style="color:#22c55e">${o.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(o,u)=>`: <span style="color:#fb923c">${u}</span>`).replace(/:\s*(true|false|null)/g,(o,u)=>`: <span style="color:#a855f7">${u}</span>`)}catch{return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}}function Nv({file:r,loading:c,error:o,viewMode:u,plugin:x,skill:v,onSaved:p,onDirtyChange:b}){const[y,f]=m.useState(u),[S,g]=m.useState(!1),[C,w]=m.useState(""),[O,L]=m.useState(!1),[G,q]=m.useState(null),J=u!==y?u:y;m.useEffect(()=>{b==null||b(S)},[S,b]);const ee=m.useCallback(()=>{(r==null?void 0:r.content)!=null&&(w(r.content),g(!0))},[r]),K=m.useCallback(()=>{g(!1)},[]),P=m.useCallback(async()=>{if(!(!x||!v||!r)){L(!0);try{await be.saveSkillFile(x,v,r.path,C),q("Saved"),g(!1),p==null||p(),setTimeout(()=>q(null),2e3)}catch(te){q(`Save failed: ${te.message}`),setTimeout(()=>q(null),3e3)}finally{L(!1)}}},[x,v,r,C,p]);if(m.useEffect(()=>{if(!S)return;const te=Q=>{(Q.ctrlKey||Q.metaKey)&&Q.key==="s"&&(Q.preventDefault(),P())};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[S,P]),c)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(o)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:a.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[a.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),a.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:o})]})});if(!r)return null;if(r.binary)return a.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",gr(r.size),") — cannot be displayed"]});const re=r.content??"",X=Sv(r.path);return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[r.truncated&&a.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 ",gr(512*1024)," — ",gr(r.size)," total"]}),a.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(X==="md"||X==="json")&&["raw","split","preview"].map(te=>a.jsx("button",{onClick:()=>f(te),style:{padding:"2px 8px",fontSize:11,background:J===te?"var(--accent-muted)":"none",color:J===te?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:te},te)),a.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[gr(r.size),x&&v&&!r.binary&&!S&&a.jsx("button",{onClick:ee,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),S&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:P,disabled:O,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:O?.6:1},children:O?"Saving...":"Save"}),a.jsx("button",{onClick:K,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),G&&a.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}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:S?a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[a.jsx("textarea",{value:C,onChange:te=>w(te.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}}),a.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:[a.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),a.jsx("button",{onClick:P,disabled:O,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:O?.6:1},children:O?"Saving...":"Save"}),a.jsx("button",{onClick:K,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):J==="split"&&X!=="other"?a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:a.jsx(Ex,{content:re})}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:X==="json"?a.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:Cx(re)}}):a.jsx(kx,{content:re,fileType:X})})]}):J==="preview"&&X!=="other"?X==="json"?a.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:Cx(re)}}):a.jsx(kx,{content:re,fileType:X}):a.jsx(Ex,{content:re})})]})}function Ev({size:r=15}){return a.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function kv({size:r=15}){return a.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),a.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function Cv({size:r=15}){return a.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Tv({size:r=15}){return a.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}function Ko({size:r=15}){return a.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function wv(){const{state:r,dispatch:c,saveContent:o,isReadOnly:u}=tl(),{plugin:x,skill:v,skillContent:p,isDirty:b,improveTarget:y,aiEditOpen:f}=r,[S,g]=m.useState("split"),[C,w]=m.useState(!1),O=m.useRef(null),[L,G]=m.useState(!1),[q,J]=m.useState(""),[ee,K]=m.useState(!1),[P,re]=m.useState(null),[X,te]=m.useState([]),[Q,F]=m.useState([]),[pe,ie]=m.useState(null),_=m.useRef(null),{config:le}=Na(),{files:I,activeFile:E,secondaryContent:M,loading:ae,error:B,selectFile:de,refresh:j,isSkillMd:D}=mv(x??"",v??""),[W,ne]=m.useState(!1),ue=m.useCallback($=>{W&&!window.confirm("You have unsaved changes. Discard?")||de($)},[W,de]);m.useEffect(()=>()=>{var $;($=_.current)==null||$.abort()},[]);const{metadata:fe,body:ve}=nv(p),Oe=fe["allowed-tools"],Re=Array.isArray(Oe)?Oe:typeof Oe=="string"?[Oe]:[],pt=fe.name,Lt=fe.description,Z=fe.metadata,oe=typeof Z=="object"&&!Array.isArray(Z)?Z:null,se=fe.version||(oe==null?void 0:oe.version),me=fe.tags||(oe==null?void 0:oe.tags),ge=Array.isArray(me)?me:typeof me=="string"?me.split(",").map($=>$.trim()).filter(Boolean):[],Ye=new Set(["name","description","metadata","allowed-tools","version","tags"]),ut=Object.entries(fe).filter(([$])=>!Ye.has($)),Xe=m.useCallback(async()=>{w(!0),await o(),w(!1)},[o]),Dt=m.useCallback($=>{($.ctrlKey||$.metaKey)&&$.key==="s"&&($.preventDefault(),$.stopPropagation(),b&&Xe()),($.ctrlKey||$.metaKey)&&$.key==="k"&&($.preventDefault(),$.stopPropagation(),c({type:f?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[b,Xe,f,c]),mt=m.useCallback(async()=>{var Be,at;if(!q.trim())return;(Be=_.current)==null||Be.abort();const $=new AbortController;_.current=$,K(!0),ie(null),F([]),re(null),te([]);try{const Je=(le==null?void 0:le.provider)||"claude-cli",Rl=(le==null?void 0:le.model)||"sonnet",Ot=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:q,provider:Je,model:Rl}),signal:$.signal});if(!Ot.ok||!Ot.body){let et=`HTTP ${Ot.status}`;try{const al=await Ot.json();al.error&&(et=al.error)}catch{}throw new Error(et)}const sa=Ot.body.getReader(),kt=new TextDecoder;let Fe="",nt="";for(;;){const{done:et,value:al}=await sa.read();if(et)break;Fe+=kt.decode(al,{stream:!0});const Qe=Fe.split(`
|
|
61
61
|
`);Fe=Qe.pop()||"";for(const nl of Qe)if(nl.startsWith("event: "))nt=nl.slice(7).trim();else if(nl.startsWith("data: ")){try{const st=JSON.parse(nl.slice(6));if(nt==="progress")F(Ve=>[...Ve,{phase:st.phase,message:st.message,timestamp:Date.now()}]);else if(nt==="done"||nt==="complete"){const Ve=["---"];st.name&&Ve.push(`name: ${st.name}`),st.description&&Ve.push(`description: "${st.description.replace(/"/g,'\\"')}"`),st.model&&Ve.push(`model: ${st.model}`),(at=st.allowedTools)!=null&&at.trim()&&Ve.push(`allowed-tools: ${st.allowedTools.trim()}`),Ve.push("---","",st.body||"");const _l=Ve.join(`
|
|
62
|
-
`);re(_l),te(kr(p,_l)),K(!1)}else nt==="error"&&(ie(st.message||st.description||"Generation failed"),K(!1))}catch{}nt=""}}}catch(Je){Je.name!=="AbortError"&&ie(Je.message)}finally{K(!1),_.current=null}},[q,le,p]),ll=m.useCallback(()=>{P&&c({type:"SET_CONTENT",content:P}),G(!1),re(null),te([]),J(""),F([])},[P,c]),Qt=m.useCallback(()=>{G(!1),re(null),te([]),J(""),F([]),ie(null)},[]),We=m.useCallback(()=>{var $;L?(($=_.current)==null||$.abort(),Qt()):(f&&c({type:"CLOSE_AI_EDIT"}),G(!0))},[L,f,c,Qt]),Et=[{mode:"raw",icon:a.jsx(Ev,{}),label:"Editor"},{mode:"split",icon:a.jsx(kv,{}),label:"Split"},{mode:"preview",icon:a.jsx(Cv,{}),label:"Preview"}];return a.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Dt,tabIndex:-1,children:[a.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:[a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:Et.map(({mode:$,icon:ze,label:at})=>a.jsxs("button",{onClick:()=>g($),title:at,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:S===$?"var(--surface-4)":"transparent",color:S===$?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:S===$?600:400,border:"none",cursor:"pointer"},children:[ze,a.jsx("span",{style:{letterSpacing:"0.01em"},children:at})]},$))}),D?u?a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>{f?c({type:"CLOSE_AI_EDIT"}):(L&&Qt(),c({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:[a.jsx(Tv,{size:13}),a.jsx("span",{children:"AI Edit"})]}),a.jsxs("button",{onClick:We,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:L?600:400,border:"none",cursor:"pointer",color:L?"#a855f7":"var(--text-tertiary)",background:L?"rgba(168,85,247,0.12)":"transparent"},children:[a.jsx(Ko,{size:13}),a.jsx("span",{children:"Regenerate"})]}),a.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),b&&a.jsx("button",{onClick:()=>c({type:"SET_CONTENT",content:r.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),a.jsx("button",{onClick:Xe,disabled:!b||C,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:C?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),x&&v&&a.jsx(bv,{files:I,activeFile:E,onSelect:ue,onRefresh:j}),!D&&a.jsx(Nv,{file:M,loading:ae,error:B,viewMode:S,plugin:x??void 0,skill:v??void 0,onSaved:()=>{de(E),j()},onDirtyChange:ne}),D&&a.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:S==="raw"||S==="preview"?"1fr":"1fr 1fr"},children:[S!=="preview"&&a.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:S==="split"?"1px solid var(--border-subtle)":"none"},children:a.jsx("textarea",{ref:O,value:p,onChange:$=>{u||c({type:"SET_CONTENT",content:$.target.value})},onKeyDown:Dt,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}})}),S!=="raw"&&a.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(pt||se||Lt)&&a.jsxs("div",{style:{marginBottom:20},children:[a.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[pt&&a.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:pt}),se&&a.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",se]})]}),Lt&&a.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:Lt})]}),ge.length>0&&a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ge.map($=>a.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:$},$))}),Re.length>0&&a.jsx("div",{style:{marginBottom:16},children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),Re.map($=>a.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:$},$))]})}),ut.length>0&&a.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:ut.map(([$,ze],at)=>{const Je=Array.isArray(ze)?ze.join(", "):typeof ze=="object"?Object.entries(ze).map(([Rl,Ot])=>`${Rl}: ${Array.isArray(Ot)?Ot.join(", "):Ot}`).join(" | "):ze;return a.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:at>0?"1px solid var(--border-subtle)":"none"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:$}),a.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:Je})]},$)})}),(pt||Lt||ge.length>0||Re.length>0||ut.length>0)&&ve&&a.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),ve&&a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Er(ve)}})]})})]}),D&&f&&a.jsx(pv,{}),D&&L&&a.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:a.jsxs("div",{className:"px-4 py-3",children:[!P&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ko,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),a.jsx("div",{className:"flex gap-2 mb-2",children:a.jsx("textarea",{value:q,onChange:$=>J($.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:ee,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:ee?.5:1},onKeyDown:$=>{$.key==="Enter"&&($.ctrlKey||$.metaKey)&&q.trim()&&!ee&&($.preventDefault(),mt())}})}),a.jsxs("div",{className:"flex items-center gap-2",children:[ee?a.jsx("button",{onClick:()=>{var $;($=_.current)==null||$.abort(),K(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):a.jsx("button",{onClick:mt,disabled:!q.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),a.jsx("button",{onClick:Qt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),ee&&Q.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx(rs,{entries:Q,isRunning:!0})}),pe&&a.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[pe,a.jsx("button",{onClick:mt,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),P&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ko,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:X.map(($,ze)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:$.type==="added"?"rgba(34,197,94,0.1)":$.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:$.type==="added"?"var(--green)":$.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:$.type==="added"?"3px solid var(--green)":$.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:$.type==="added"?"+":$.type==="removed"?"-":" "}),$.content]},ze))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:ll,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:Qt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),D&&y!==null&&x&&v&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(iv,{plugin:x,skill:v,skillContent:p,onApplied:$=>{c({type:"SET_CONTENT",content:$}),c({type:"CONTENT_SAVED"}),c({type:"CLOSE_IMPROVE"})}})})]})}function un(r){return r.testType==="integration"?"integration":"unit"}function dn(r){return r>=.8?"var(--green)":r>=.5?"var(--yellow)":"var(--red)"}function Xx(r){const c=new Date(r);return c.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+c.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function Kx(r){return r==null?"--":r>=1e3?`${(r/1e3).toFixed(1)}s`:`${r}ms`}const Av=new Set(["benchmark","comparison","baseline"]);function Tx(r,c,o,u){return r.map(({rate:x,idx:v,total:p})=>{const b=u+v/(p-1)*(c-u*2),y=u+(o-u*2)-x*(o-u*2);return`${b},${y}`})}function $x({entries:r}){const c=r.filter(g=>Av.has(g.type)).slice().reverse(),o=c.map((g,C,w)=>({rate:g.pass_rate,idx:C,total:w.length})).filter((g,C)=>{const w=c[C].type;return w==="benchmark"||w==="comparison"}),u=c.flatMap((g,C)=>g.type==="baseline"?[{rate:g.pass_rate,idx:C,total:c.length}]:g.type==="comparison"&&g.baselinePassRate!=null?[{rate:g.baselinePassRate,idx:C,total:c.length}]:[]);if(o.length<2&&u.length<2)return null;const x=80,v=24,p=2,b=o.length>=2?Tx(o,x,v,p):[],y=u.length>=2?Tx(u,x,v,p):[],f=b[b.length-1],S=y[y.length-1];return a.jsxs("svg",{width:x,height:v,style:{display:"block",flexShrink:0},children:[y.length>0&&a.jsx("polyline",{points:y.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),b.length>0&&a.jsx("polyline",{points:b.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),S&&a.jsx("circle",{cx:parseFloat(S.split(",")[0]),cy:parseFloat(S.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),f&&a.jsx("circle",{cx:parseFloat(f.split(",")[0]),cy:parseFloat(f.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function Zx(r,c,o){const u=[],x=[],v=[];if((r==="PASS"||r==="EFFECTIVE")&&c>=.7){const y=u.length>0?` Met criteria: ${u.map(f=>f.criterion).join(", ")}.`:"";return{explanation:`${r} (score ${c.toFixed(2)}): evaluation met expectations.${y}`}}if((r==="FAIL"||r==="DEGRADING")&&c<.4){const y=x.length>0?` Failed criteria: ${x.map(S=>S.criterion).join(", ")}.`:"",f=[...x.map(S=>`Improve "${S.criterion}" (score: ${S.score.toFixed(2)})`),...v.map(S=>`Strengthen "${S.criterion}" (score: ${S.score.toFixed(2)})`)];return f.length===0&&f.push("Review prompt instructions and add more specific guidance"),{explanation:`${r} (score ${c.toFixed(2)}): evaluation did not meet expectations.${y}`,recommendations:f}}if(r==="INEFFECTIVE"&&c<.2){const y=[...x.map(f=>`Rework "${f.criterion}" — currently at ${f.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${r} (score ${c.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const p=u.length>0?` Passing: ${u.map(y=>y.criterion).join(", ")}.`:"",b=v.length>0?` Needs improvement: ${v.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${r} (score ${c.toFixed(2)}): mixed results.${p}${b}`}}function Rv(){const{state:r}=tl(),{plugin:c,skill:o}=r,[u,x]=m.useState([]),[v,p]=m.useState([]),[b,y]=m.useState(!0),[f,S]=m.useState(null),[g,C]=m.useState(new Set),[w,O]=m.useState(null),[L,G]=m.useState(""),[q,J]=m.useState(!1),[ee,K]=m.useState(""),[P,re]=m.useState(""),X=m.useCallback(async()=>{y(!0),S(null);try{const[_,le]=await Promise.all([be.getCredentials(c,o),be.getParams(c,o)]);x(_.credentials),p(le.params)}catch(_){S(_ instanceof Error?_.message:"Failed to load parameters"),x([]),p([])}finally{y(!1)}},[c,o]);m.useEffect(()=>{X()},[X]);const te=m.useCallback(async(_,le)=>{J(!0),S(null);try{await be.setCredential(c,o,_,le),O(null),G(""),await X()}catch(I){S(I instanceof Error?I.message:`Failed to save ${_}`)}finally{J(!1)}},[c,o,X]),Q=m.useCallback(async()=>{const _=ee.trim().toUpperCase(),le=P.trim();if(!(!_||!le)){J(!0),S(null);try{await be.setCredential(c,o,_,le),K(""),re(""),await X()}catch(I){S(I instanceof Error?I.message:`Failed to add ${_}`)}finally{J(!1)}}},[c,o,ee,P,X]),F=_=>{C(le=>{const I=new Set(le);return I.has(_)?I.delete(_):I.add(_),I})},pe=new Set(u.map(_=>_.name)),ie=[...u.map(_=>{const le=v.find(I=>I.name===_.name);return{name:_.name,status:_.status,maskedValue:(le==null?void 0:le.maskedValue)??""}}),...v.filter(_=>!pe.has(_.name)).map(_=>({name:_.name,status:_.status,maskedValue:_.maskedValue}))];return a.jsxs("div",{className:"py-2 px-3",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),f&&a.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&&ie.length===0&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!b&&ie.length===0&&!f&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),ie.map(_=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:_.name}),a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:_.status==="ready"?"rgba(34,197,94,0.15)":"rgba(239,68,68,0.15)",color:_.status==="ready"?"#22c55e":"#ef4444"},children:_.status}),_.maskedValue&&a.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[g.has(_.name)?_.maskedValue:"***",a.jsx("button",{onClick:()=>F(_.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${g.has(_.name)?"Hide":"Show"} masked value for ${_.name}`,children:g.has(_.name)?"hide":"show"})]}),w===_.name?a.jsxs("div",{className:"flex gap-1",children:[a.jsx("input",{value:L,onChange:le=>G(le.target.value),onKeyDown:le=>{le.key==="Enter"&&L.trim()&&te(_.name,L)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${_.name}`,autoFocus:!0}),a.jsx("button",{onClick:()=>te(_.name,L),disabled:q||!L.trim(),className:"text-[10px] font-medium",style:{color:"#22c55e",background:"none",border:"none",cursor:"pointer"},children:"Save"}),a.jsx("button",{onClick:()=>{O(null),G("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):a.jsx("button",{onClick:()=>{O(_.name),G("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},_.name)),a.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:ee,onChange:_=>K(_.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),a.jsx("input",{value:P,onChange:_=>re(_.target.value),onKeyDown:_=>{_.key==="Enter"&&ee.trim()&&P.trim()&&Q()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),a.jsx("button",{onClick:Q,disabled:q||!ee.trim()||!P.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:q?"not-allowed":"pointer"},children:"Add"})]})]})]})}function _v(r,c,o){const[u,x]=m.useState(null),[v,p]=m.useState(!1),b=m.useRef("");m.useEffect(()=>{const f=`${r}/${c}/${o}`;b.current!==f&&(b.current=f,p(!0),be.getCaseHistory(r,c,o).then(S=>x(S)).catch(()=>x([])).finally(()=>p(!1)))},[r,c,o]);const y=m.useCallback(()=>{p(!0),b.current="",be.getCaseHistory(r,c,o).then(f=>x(f)).catch(()=>x([])).finally(()=>p(!1))},[r,c,o]);return{entries:u,loading:v,refetch:y}}function Mv(r,c,o){const u={flaky:!1,nonDiscriminating:!1,regression:!1};if(!o||o.length===0)return u;const v=o.slice(0,10).map(y=>y.assertions.find(f=>f.id===r)).filter(Boolean);if(v.length>=2){const f=v.filter(S=>S.pass).length/v.length;f>=.3&&f<=.7&&(u.flaky=!0)}const p=o.find(y=>y.type==="benchmark"),b=o.find(y=>y.type==="baseline");if(p&&b){const y=p.assertions.find(S=>S.id===r),f=b.assertions.find(S=>S.id===r);y!=null&&y.pass&&(f!=null&&f.pass)&&(u.nonDiscriminating=!0)}if(c&&!c.pass&&o.length>=1){const f=o[0].assertions.find(S=>S.id===r);f!=null&&f.pass&&(u.regression=!0)}return u}function zv(){var ae;const{state:r,dispatch:c,saveEvals:o,runCase:u,runAll:x,cancelCase:v,cancelAll:p,generateEvals:b,isReadOnly:y}=tl(),{evals:f,evalsError:S,selectedCaseId:g,inlineResults:C,caseRunStates:w,generateEvalsLoading:O,generateEvalsProgress:L,generateEvalsError:G}=r,q=m.useMemo(()=>{for(const B of w.values())if(B.status==="running"||B.status==="queued")return!0;return!1},[w]),[J,ee]=m.useState(!1),[K,P]=m.useState("all"),re={skill_name:r.skill,evals:[]},X=f??re,te=X.evals,Q=m.useMemo(()=>K==="all"?te:te.filter(B=>un(B)===K),[K,te]),F=Q.find(B=>B.id===g)??null;m.useEffect(()=>{g!==null&&!Q.find(B=>B.id===g)&&c({type:"SELECT_CASE",caseId:Q.length>0?Q[0].id:null})},[Q,g,c]);const[pe,ie]=m.useState([]),_=m.useMemo(()=>te.some(B=>un(B)==="integration"),[te]);m.useEffect(()=>{_&&be.getCredentials(r.plugin,r.skill).then(B=>ie(B.credentials)).catch(()=>ie([]))},[r.plugin,r.skill,_]);const le=m.useMemo(()=>new Set(pe.filter(B=>B.status==="missing").map(B=>B.name)),[pe]),[I,E]=m.useState(!1),M=m.useCallback(B=>{E(!1),b(B?{testType:B}:void 0)},[b]);return!f||te.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:S?"var(--error-muted, #3f1a1a)":"var(--accent-muted)"},children:S?a.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:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),a.jsx("div",{className:"text-center",children:S?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--error, #f87171)"},children:"Invalid evals.json"}),a.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:S}),a.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"})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>ee(!0),disabled:y,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),a.jsxs("div",{style:{position:"relative"},children:[a.jsxs("div",{className:"flex",children:[a.jsx("button",{onClick:()=>M("unit"),disabled:O||y,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:O?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),a.jsx("button",{onClick:()=>E(!I),disabled:O||y,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),I&&a.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:a.jsx("button",{onClick:()=>M("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.background="var(--surface-2)"},onMouseLeave:B=>{B.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),O&&L.length>0&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(rs,{entries:L,isRunning:!0})}),G&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(ss,{error:G,onRetry:()=>M()})}),J&&a.jsx(wx,{evals:X,onSave:B=>{o(B),ee(!1)},onCancel:()=>ee(!1)})]}):a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[a.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",Q.length,")"]}),a.jsx("div",{className:"flex items-center gap-1.5",children:q?a.jsx("button",{onClick:p,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"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>x("benchmark"),disabled:Q.length===0||y,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),a.jsx("button",{onClick:()=>x("comparison"),disabled:Q.length===0||y,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),a.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(B=>a.jsx("button",{onClick:()=>P(B),style:{padding:"2px 8px",fontSize:10,fontWeight:K===B?600:400,background:K===B?"var(--accent-muted)":"transparent",color:K===B?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:B==="all"?`All (${te.length})`:B==="unit"?`Unit (${te.filter(de=>un(de)==="unit").length})`:`Integration (${te.filter(de=>un(de)==="integration").length})`},B))}),a.jsxs("div",{className:"py-1",children:[Q.length===0&&te.length>0&&a.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",K==="all"?"":K+" ","tests yet"]}),Q.map(B=>{var W;const de=C.get(B.id),j=g===B.id,D=un(B);return a.jsxs("button",{onClick:()=>c({type:"SELECT_CASE",caseId:B.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:j?"var(--accent-muted)":"transparent",borderLeft:j?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:ne=>{j||(ne.currentTarget.style.background="var(--surface-2)")},onMouseLeave:ne=>{j||(ne.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[a.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:j?"var(--text-primary)":"var(--text-secondary)"},children:["#",B.id," ",B.name,a.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:D==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:D==="unit"?"#6383ff":"#fb923c",whiteSpace:"nowrap"},children:D==="unit"?"U":"I"}),D==="integration"&&((W=B.requiredCredentials)==null?void 0:W.some(ne=>le.has(ne)))&&a.jsx("span",{title:"Configure credentials to run",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),a.jsx(Jx,{result:de})]}),a.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[B.assertions.length," assertion",B.assertions.length!==1?"s":"",(de==null?void 0:de.passRate)!=null&&a.jsx(Ov,{passRate:de.passRate})]})]},B.id)})]}),a.jsx("div",{className:"px-3 py-2",children:!y&&a.jsx("button",{onClick:()=>ee(!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:B=>{B.currentTarget.style.borderColor="var(--accent)",B.currentTarget.style.color="var(--accent)"},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-default)",B.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),_&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Rv,{})})]}),a.jsx("div",{className:"overflow-auto",children:F?a.jsx(Lv,{evalCase:F,result:C.get(F.id),evals:f,caseStatus:((ae=w.get(F.id))==null?void 0:ae.status)??"idle",onSaveEvals:o,onRun:B=>u(B,"benchmark"),onCompare:B=>u(B,"comparison"),onCancel:B=>v(B),onImprove:B=>c({type:"OPEN_IMPROVE",evalId:B})}):a.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),J&&a.jsx(wx,{evals:X,onSave:B=>{o(B),ee(!1)},onCancel:()=>ee(!1)})]})}function Lv({evalCase:r,result:c,evals:o,caseStatus:u,onSaveEvals:x,onRun:v,onCompare:p,onCancel:b,onImprove:y}){const{state:f,isReadOnly:S}=tl(),{plugin:g,skill:C}=f,{entries:w,loading:O}=_v(g,C,r.id),[L,G]=m.useState(!1),[q,J]=m.useState(r.prompt),[ee,K]=m.useState(!1),[P,re]=m.useState(r.expected_output);m.useState(()=>{J(r.prompt),re(r.expected_output)});const X=m.useCallback(B=>{x({...o,evals:o.evals.map(de=>de.id===B.id?B:de)})},[o,x]),te=m.useCallback(()=>{X({...r,prompt:q}),G(!1)},[r,q,X]),Q=m.useCallback(()=>{X({...r,expected_output:P}),K(!1)},[r,P,X]),F=m.useCallback(()=>{X({...r,assertions:[...r.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[r,X]),pe=m.useCallback((B,de)=>{X({...r,assertions:r.assertions.map(j=>j.id===B?{...j,text:de}:j)})},[r,X]),ie=m.useCallback(B=>{X({...r,assertions:r.assertions.filter(de=>de.id!==B)})},[r,X]),_=m.useCallback(()=>{confirm("Delete this test case?")&&x({...o,evals:o.evals.filter(B=>B.id!==r.id)})},[o,r.id,x]),le=c&&c.assertions.length>0&&c.assertions.every(B=>B.pass),I=c&&c.assertions.some(B=>!B.pass),E=un(r),M=r.requiredCredentials??[],ae=E==="integration"&&M.length>0;return a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",r.id," ",r.name]}),S?a.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:E==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:E==="unit"?"#6383ff":"#fb923c"},children:E==="unit"?"Unit":"Integration"}):a.jsx("button",{onClick:()=>{if((E==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:de,requirements:j,cleanup:D,...W}=r;X({...W,testType:"unit"})}else X({...r,testType:"integration"})},title:`Click to switch to ${E==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:E==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:E==="unit"?"#6383ff":"#fb923c",border:"none",cursor:"pointer"},children:E==="unit"?"Unit":"Integration"}),a.jsx(Jx,{result:c})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[u==="running"||u==="queued"?a.jsxs("button",{onClick:()=>b(r.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>v(r.id),disabled:S,className:"btn btn-primary text-[12px]",children:"Run"}),a.jsx("button",{onClick:()=>p(r.id),disabled:S,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),I&&!S&&u!=="running"&&u!=="queued"&&a.jsx("button",{onClick:()=>y(r.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!S&&u!=="running"&&u!=="queued"&&a.jsx("button",{onClick:_,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.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"})]})})]})]}),S&&E==="integration"&&a.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:[a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),a.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),a.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),le&&a.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:[a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[a.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),a.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),ae&&a.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"Required Credentials"})]}),a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:M.map(B=>a.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:B},B))})]}),!S&&E==="integration"&&a.jsx(Uv,{evalCase:r,onUpdate:X}),a.jsx(br,{title:"Prompt",children:L?a.jsxs("div",{children:[a.jsx("textarea",{value:q,onChange:B=>J(B.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:te,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{J(r.prompt),G(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.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:S?"default":"pointer"},onClick:()=>{S||G(!0)},onMouseEnter:B=>{S||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-subtle)"},children:r.prompt||a.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:S?"No prompt":"Click to edit prompt..."})})}),a.jsx(br,{title:"Expected Output",children:ee?a.jsxs("div",{children:[a.jsx("textarea",{value:P,onChange:B=>re(B.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:Q,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{re(r.expected_output),K(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.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:S?"default":"pointer"},onClick:()=>{S||K(!0)},onMouseEnter:B=>{S||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-subtle)"},children:r.expected_output||a.jsx("span",{style:{fontStyle:"italic"},children:S?"No expected output":"Click to edit expected output..."})})}),a.jsx(br,{title:`Assertions (${r.assertions.length})`,action:S?void 0:a.jsx("button",{onClick:F,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:r.assertions.length===0?a.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):a.jsx("div",{className:"space-y-2",children:r.assertions.map(B=>{const de=c==null?void 0:c.assertions.find(D=>D.assertion_id===B.id),j=Mv(B.id,de,w);return a.jsx(Dv,{assertion:B,result:de,badges:j,isReadOnly:S,onUpdate:D=>pe(B.id,D),onDelete:()=>ie(B.id)},B.id)})})}),(c==null?void 0:c.output)&&a.jsx(Bv,{output:c.output,durationMs:c.durationMs,tokens:c.tokens}),c&&c.passRate!=null&&c.passRate<.2&&(()=>{const B=Zx("INEFFECTIVE",c.passRate);return B.recommendations&&B.recommendations.length>0?a.jsx(br,{title:"Recommendations",children:a.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"This eval is significantly below expectations"})]}),a.jsx("ul",{className:"space-y-1.5 ml-1",children:B.recommendations.map((de,j)=>a.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"#fb923c",fontWeight:600,flexShrink:0},children:"•"}),de]},j))})]})}):null})(),a.jsx(Hv,{evalId:r.id,sharedEntries:w,sharedLoading:O})]},r.id)}function Dv({assertion:r,result:c,badges:o,isReadOnly:u,onUpdate:x,onDelete:v}){const[p,b]=m.useState(!1),[y,f]=m.useState(r.text),[S,g]=m.useState(!1),C=()=>{x(y),b(!1)};return a.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:a.jsxs("div",{className:"flex items-start gap-2",children:[c?a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:c.pass?"var(--green-muted)":"var(--red-muted)"},children:c.pass?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):a.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"}),(o==null?void 0:o.regression)&&a.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:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:r.id}),(o==null?void 0:o.flaky)&&a.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"}),(o==null?void 0:o.nonDiscriminating)&&a.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."})]}),p?a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:y,onChange:w=>f(w.target.value),onKeyDown:w=>{w.key==="Enter"&&C(),w.key==="Escape"&&b(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),a.jsx("button",{onClick:C,className:"btn btn-primary text-[11px]",children:"Save"})]}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:u?"default":"pointer"},onClick:()=>{u||(f(r.text),b(!0))},children:r.text}),(c==null?void 0:c.reasoning)&&a.jsx("button",{onClick:()=>g(!S),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:S?"Hide reasoning":"Show reasoning"}),S&&(c==null?void 0:c.reasoning)&&a.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:c.reasoning})]}),!u&&a.jsx("button",{onClick:v,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:w=>{w.currentTarget.style.color="var(--red)",w.currentTarget.style.opacity="1"},onMouseLeave:w=>{w.currentTarget.style.color="var(--text-tertiary)",w.currentTarget.style.opacity=""},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function br({title:r,action:c,children:o}){return a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:r}),c]}),o]})}function Jx({result:r}){const[c,o]=m.useState(!1);if(!r||r.status==null)return a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const u=r.status==="pass",x=r.passRate??0,p=Zx(u?"PASS":"FAIL",x);return a.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:()=>o(!0),onMouseLeave:()=>o(!1),"aria-describedby":c?"verdict-tooltip":void 0,children:[r.passRate!=null?`${Math.round(r.passRate*100)}%`:r.status,c&&a.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:p.explanation})]})}function Ov({passRate:r}){const c=Math.round(r*100);return a.jsx("div",{className:"flex items-center gap-1",children:a.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${c}%`,background:c>=80?"var(--green)":c>=50?"var(--yellow)":"var(--red)"}})})})}function Bv({output:r,durationMs:c,tokens:o}){const[u,x]=m.useState(!1);return a.jsxs("div",{className:"mb-5",children:[a.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:[a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",c!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",(c/1e3).toFixed(1),"s)"]}),o!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",o," tokens)"]})]}),u&&a.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:r})]})}function $o(r){return r==="baseline"?"right":r==="comparison"?"full":"left"}function Zo({entry:r}){return a.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:Xx(r.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:r.model}),a.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:r.type==="benchmark"?"rgba(99,131,255,0.15)":r.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:r.type==="benchmark"?"#6383ff":r.type==="comparison"?"var(--purple)":"#fb923c"},children:r.type}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:dn(r.pass_rate)},children:[Math.round(r.pass_rate*100),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[r.durationMs!=null&&a.jsx("span",{children:Kx(r.durationMs)}),r.tokens!=null&&a.jsxs("span",{children:[r.tokens>=1e3?`${(r.tokens/1e3).toFixed(1)}k`:r.tokens," tok"]})]}),r.type==="comparison"&&r.baselinePassRate!=null&&(()=>{const c=r.pass_rate-r.baselinePassRate,o=c>.001?"skill":c<-.001?"baseline":"tie",u=c>0?"+":"",x=o==="skill"?"var(--green)":o==="baseline"?"var(--red)":"var(--text-tertiary)";return a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:c>=0?"var(--green)":"var(--red)"},children:[u,(c*100).toFixed(1),"%"]}),a.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"rgba(0,0,0,0.2)",color:x},children:o})]})})(),a.jsx("div",{className:"space-y-0.5",children:r.assertions.map(c=>a.jsxs("div",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:c.pass?"var(--green-muted)":"var(--red-muted)"},children:c.pass?a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:c.text})]},c.id))})]})}function Hv({evalId:r,sharedEntries:c,sharedLoading:o}){const{state:u,dispatch:x}=tl(),{plugin:v,skill:p}=u,[b,y]=m.useState(!0),f=c??null,S=o??!1,g=m.useCallback(()=>{y(L=>!L)},[]),C=f?f.slice(0,10):[],w=C.some(L=>{const G=$o(L.type);return G==="left"||G==="full"}),O=C.some(L=>{const G=$o(L.type);return G==="right"||G==="full"});return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:g,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:[a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",f&&f.length>0&&a.jsxs("span",{style:{fontWeight:400},children:["(",f.length," run",f.length!==1?"s":"",")"]})]}),b&&a.jsx("div",{className:"animate-fade-in",children:S?a.jsxs("div",{className:"flex items-center gap-2 py-3",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!f||f.length===0?a.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):a.jsxs("div",{children:[C.length>=2&&a.jsx("div",{className:"mb-2",children:a.jsx($x,{entries:C})}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!w&&a.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!O&&a.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),C.map((L,G)=>{const q=$o(L.type);return q==="full"?a.jsx("div",{style:{gridColumn:"1 / -1"},children:a.jsx(Zo,{entry:L})},G):q==="left"?a.jsxs(m.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"},children:a.jsx(Zo,{entry:L})}),a.jsx("div",{style:{gridColumn:"2"}})]},G):a.jsxs(m.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"}}),a.jsx("div",{style:{gridColumn:"2"},children:a.jsx(Zo,{entry:L})})]},G)})]}),a.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:L=>{L.currentTarget.style.textDecoration="underline"},onMouseLeave:L=>{L.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function wx({evals:r,onSave:c,onCancel:o}){const[u,x]=m.useState(""),[v,p]=m.useState(""),[b,y]=m.useState(""),[f,S]=m.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[g,C]=m.useState("unit"),[w,O]=m.useState(""),[L,G]=m.useState([]),[q,J]=m.useState(""),[ee,K]=m.useState(""),P=Math.max(0,...r.evals.map(Q=>Q.id))+1,re=Q=>{C(Q),Q==="unit"&&(G([]),O(""),J(""),K(""))},X=()=>{const Q=w.trim().toUpperCase();Q&&!L.includes(Q)&&G([...L,Q]),O("")},te=()=>{if(!u.trim()||!v.trim())return;const Q={id:P,name:u.trim(),prompt:v.trim(),expected_output:b.trim(),files:[],assertions:f.filter(F=>F.text.trim()),...g==="integration"?{testType:"integration",...L.length>0?{requiredCredentials:L}:{},...q||ee?{requirements:{...q?{platform:q}:{},...ee?{chromeProfile:ee}:{}}}:{}}:{}};c({...r,evals:[...r.evals,Q]})};return a.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:a.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:[a.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),a.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(Q=>a.jsx("button",{onClick:()=>re(Q),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:g===Q?Q==="unit"?"rgba(99,131,255,0.2)":"rgba(251,146,60,0.2)":"transparent",color:g===Q?Q==="unit"?"#6383ff":"#fb923c":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:Q},Q))})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),a.jsx("input",{value:u,onChange:Q=>x(Q.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),a.jsx("textarea",{value:v,onChange:Q=>p(Q.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),a.jsx("textarea",{value:b,onChange:Q=>y(Q.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),f.map((Q,F)=>a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:Q.text,onChange:pe=>S(f.map((ie,_)=>_===F?{...ie,text:pe.target.value}:ie)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),f.length>1&&a.jsx("button",{onClick:()=>S(f.filter((pe,ie)=>ie!==F)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},Q.id)),a.jsx("button",{onClick:()=>S([...f,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),g==="integration"&&a.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:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:L.map(Q=>a.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:[Q,a.jsx("button",{onClick:()=>G(L.filter(F=>F!==Q)),style:{color:"#fb923c",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},Q))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:w,onChange:Q=>O(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&(Q.preventDefault(),X())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),a.jsx("button",{onClick:X,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:q,onChange:Q=>J(Q.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:ee,onChange:Q=>K(Q.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsx("button",{onClick:te,disabled:!u.trim()||!v.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function Uv({evalCase:r,onUpdate:c}){var p,b;const[o,u]=m.useState(""),x=()=>{const y=o.trim().toUpperCase();y&&!(r.requiredCredentials??[]).includes(y)&&c({...r,requiredCredentials:[...r.requiredCredentials??[],y]}),u("")},v=y=>{const f=(r.requiredCredentials??[]).filter(S=>S!==y);c({...r,requiredCredentials:f.length>0?f:void 0})};return a.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:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(r.requiredCredentials??[]).map(y=>a.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:[y,a.jsx("button",{onClick:()=>v(y),style:{color:"#fb923c",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},y))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:o,onChange:y=>u(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),x())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),a.jsx("button",{onClick:x,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:((p=r.requirements)==null?void 0:p.platform)??"",onChange:y=>c({...r,requirements:{...r.requirements,platform:y.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:((b=r.requirements)==null?void 0:b.chromeProfile)??"",onChange:y=>c({...r,requirements:{...r.requirements,chromeProfile:y.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function qv(r,c){const o=r+c,u=o*10,x=o*25,v=p=>p>=60?`${Math.round(p/60)}m`:`${p}s`;return`${v(u)}–${v(x)}`}function Vv(){const{state:r,runCase:c,runAll:o,cancelCase:u,cancelAll:x,isReadOnly:v}=tl(),{evals:p,caseRunStates:b,bulkRunActive:y,latestBenchmark:f,inlineResults:S}=r,g=(p==null?void 0:p.evals)??[],C=m.useMemo(()=>{for(const K of b.values())if(K.status==="running"||K.status==="queued")return!0;return!1},[b]),w=g.filter(K=>{const P=b.get(K.id);return P&&(P.status==="complete"||P.status==="error"||P.status==="cancelled")}).length,O=g.filter(K=>{const P=b.get(K.id);return P&&(P.status==="running"||P.status==="queued")}).length,L=m.useRef(null),[G,q]=m.useState(0);m.useEffect(()=>{if(C&&!L.current&&(L.current=Date.now()),!C){L.current=null,q(0);return}const K=setInterval(()=>{L.current&&q(Math.round((Date.now()-L.current)/1e3))},1e3);return()=>clearInterval(K)},[C]);const J=g.reduce((K,P)=>K+P.assertions.length,0),ee=m.useMemo(()=>qv(g.length,J),[g.length,J]);return a.jsxs("div",{className:"p-5",children:[v&&a.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:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),a.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),C&&a.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[O," running"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[C&&a.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:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),a.jsx("button",{onClick:()=>o("comparison"),disabled:g.length===0||C||v,className:"btn btn-primary text-[12px]",children:"Compare All"}),a.jsx("button",{onClick:()=>o("benchmark"),disabled:g.length===0||C||v,className:"btn btn-secondary text-[12px]",children:"Skill Only"}),a.jsx("button",{onClick:()=>o("baseline"),disabled:g.length===0||C||v,className:"btn btn-secondary text-[12px]",children:"Baseline Only"})]})]}),C&&g.length>0&&a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",w,"/",g.length," cases"]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(w/g.length*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${w/g.length*100}%`,background:"var(--accent)"}})}),a.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",G>=60?`${Math.floor(G/60)}m ${G%60}s`:`${G}s`]}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",ee]})]})]}),a.jsx("div",{className:"space-y-3 stagger-children",children:g.map(K=>{const P=S.get(K.id),re=b.get(K.id),X=(re==null?void 0:re.status)??"idle";return a.jsx(Yv,{name:K.name,evalId:K.id,result:P,caseStatus:X,runMode:(re==null?void 0:re.mode)??null,isReadOnly:v,onRun:te=>c(te,"benchmark"),onBaseline:te=>c(te,"baseline"),onCompare:te=>c(te,"comparison"),onCancel:te=>u(te)},K.id)})}),!C&&f&&f.cases.length>0&&a.jsxs("div",{className:"mt-5",children:[a.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Overall Pass Rate"}),a.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&&a.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.overall_pass_rate===1&&!f.comparison&&a.jsx("button",{onClick:()=>o("comparison"),disabled:g.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:g.length===0?.5:1},children:"Run Final A/B Comparison"})]}),f.comparison&&a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Ax,{label:"Skill",value:f.comparison.skillPassRate,color:"var(--accent)"}),a.jsx(Ax,{label:"Baseline",value:f.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),a.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&&` | ${f.verdict}`]})]})]})]})}const Gv={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 Yv({name:r,evalId:c,result:o,caseStatus:u,runMode:x,isReadOnly:v,onRun:p,onBaseline:b,onCompare:y,onCancel:f}){const[S,g]=m.useState(!1),C=u==="running"||u==="queued",w=u==="complete"||u==="error";return a.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:C?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:C?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[u==="running"&&a.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),u==="queued"&&a.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),a.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",c," ",r]}),x&&(C||w)&&(()=>{const O=Gv[x];return O?a.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:O.bg,color:O.color,padding:"1px 6px"},children:O.label}):null})()]}),a.jsxs("div",{className:"flex items-center gap-2",children:[C?a.jsx("button",{onClick:()=>f(c),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"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>y(c),disabled:v,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),a.jsx("button",{onClick:()=>p(c),disabled:v,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),a.jsx("button",{onClick:()=>b(c),disabled:v,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),o&&o.status!=null&&a.jsx("span",{className:"pill text-[10px]",style:{background:o.status==="pass"?"var(--green-muted)":(o.status==="error","var(--red-muted)"),color:o.status==="pass"?"var(--green)":"var(--red)"},children:o.passRate!=null?`${Math.round(o.passRate*100)}%`:o.status}),u==="cancelled"&&a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),o&&o.assertions.length>0&&a.jsxs("div",{className:"px-4 pb-3",children:[a.jsx("div",{className:"space-y-1",children:o.assertions.map(O=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{style:{color:O.pass?"var(--green)":"var(--red)"},children:O.pass?"PASS":"FAIL"}),a.jsx("span",{style:{color:"var(--text-secondary)"},children:O.text})]},O.assertion_id))}),o.output&&a.jsx("button",{onClick:()=>g(!S),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:S?"Hide output":"Show output"}),S&&o.output&&a.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:o.output})]}),o&&o.errorMessage&&a.jsx(Qv,{errorMessage:o.errorMessage,classifiedError:o.classifiedError})]})}const Jo={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function Qv({errorMessage:r,classifiedError:c}){const[o,u]=m.useState(!1),x=(c==null?void 0:c.title)??"Error",v=c==null?void 0:c.hint,p=c?Jo[c.category]??Jo.unknown:Jo.unknown;return a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid rgba(239,68,68,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsx("span",{style:{fontSize:12},children:p}),a.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:x}),a.jsx("button",{onClick:()=>u(!o),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:o?"Hide details":"Details"})]}),v&&a.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:v}),o&&a.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:r})]})})}function Ax({label:r,value:c,color:o}){return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:r}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:o},children:[Math.round(c*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${c*100}%`,background:o}})})]})}const Rx={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 Xv(){const{state:r,dispatch:c,runActivationTest:o,cancelActivation:u,generateActivationPrompts:x}=tl(),{plugin:v,skill:p,activationPrompts:b,activationResults:y,activationSummary:f,activationRunning:S,activationError:g,activationStartedAt:C,activationClassifyingStatus:w,generatingPrompts:O,generatingPromptsError:L,activationHistory:G}=r,[q,J]=m.useState(b),[ee,K]=m.useState(null),[P,re]=m.useState(!1);m.useEffect(()=>{b&&b!==q&&J(b)},[b]),m.useEffect(()=>{c({type:"SET_ACTIVATION_PROMPTS",prompts:q})},[q,c]),m.useEffect(()=>{fetch(`/api/skills/${v}/${p}/description`).then(I=>I.json()).then(I=>K(I.rawContent||I.description||null)).catch(()=>K(null))},[v,p]);function X(){o(q)}function te(){x(8)}const Q=q.trim().split(`
|
|
62
|
+
`);re(_l),te(kr(p,_l)),K(!1)}else nt==="error"&&(ie(st.message||st.description||"Generation failed"),K(!1))}catch{}nt=""}}}catch(Je){Je.name!=="AbortError"&&ie(Je.message)}finally{K(!1),_.current=null}},[q,le,p]),ll=m.useCallback(()=>{P&&c({type:"SET_CONTENT",content:P}),G(!1),re(null),te([]),J(""),F([])},[P,c]),Qt=m.useCallback(()=>{G(!1),re(null),te([]),J(""),F([]),ie(null)},[]),We=m.useCallback(()=>{var $;L?(($=_.current)==null||$.abort(),Qt()):(f&&c({type:"CLOSE_AI_EDIT"}),G(!0))},[L,f,c,Qt]),Et=[{mode:"raw",icon:a.jsx(Ev,{}),label:"Editor"},{mode:"split",icon:a.jsx(kv,{}),label:"Split"},{mode:"preview",icon:a.jsx(Cv,{}),label:"Preview"}];return a.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Dt,tabIndex:-1,children:[a.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:[a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:Et.map(({mode:$,icon:Be,label:at})=>a.jsxs("button",{onClick:()=>g($),title:at,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:S===$?"var(--surface-4)":"transparent",color:S===$?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:S===$?600:400,border:"none",cursor:"pointer"},children:[Be,a.jsx("span",{style:{letterSpacing:"0.01em"},children:at})]},$))}),D?u?a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>{f?c({type:"CLOSE_AI_EDIT"}):(L&&Qt(),c({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:[a.jsx(Tv,{size:13}),a.jsx("span",{children:"AI Edit"})]}),a.jsxs("button",{onClick:We,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:L?600:400,border:"none",cursor:"pointer",color:L?"#a855f7":"var(--text-tertiary)",background:L?"rgba(168,85,247,0.12)":"transparent"},children:[a.jsx(Ko,{size:13}),a.jsx("span",{children:"Regenerate"})]}),a.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),b&&a.jsx("button",{onClick:()=>c({type:"SET_CONTENT",content:r.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),a.jsx("button",{onClick:Xe,disabled:!b||C,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:C?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),x&&v&&a.jsx(bv,{files:I,activeFile:E,onSelect:ue,onRefresh:j}),!D&&a.jsx(Nv,{file:M,loading:ae,error:B,viewMode:S,plugin:x??void 0,skill:v??void 0,onSaved:()=>{de(E),j()},onDirtyChange:ne}),D&&a.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:S==="raw"||S==="preview"?"1fr":"1fr 1fr"},children:[S!=="preview"&&a.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:S==="split"?"1px solid var(--border-subtle)":"none"},children:a.jsx("textarea",{ref:O,value:p,onChange:$=>{u||c({type:"SET_CONTENT",content:$.target.value})},onKeyDown:Dt,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}})}),S!=="raw"&&a.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(pt||se||Lt)&&a.jsxs("div",{style:{marginBottom:20},children:[a.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[pt&&a.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:pt}),se&&a.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",se]})]}),Lt&&a.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:Lt})]}),ge.length>0&&a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ge.map($=>a.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:$},$))}),Re.length>0&&a.jsx("div",{style:{marginBottom:16},children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),Re.map($=>a.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:$},$))]})}),ut.length>0&&a.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:ut.map(([$,Be],at)=>{const Je=Array.isArray(Be)?Be.join(", "):typeof Be=="object"?Object.entries(Be).map(([Rl,Ot])=>`${Rl}: ${Array.isArray(Ot)?Ot.join(", "):Ot}`).join(" | "):Be;return a.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:at>0?"1px solid var(--border-subtle)":"none"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:$}),a.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:Je})]},$)})}),(pt||Lt||ge.length>0||Re.length>0||ut.length>0)&&ve&&a.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),ve&&a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Er(ve)}})]})})]}),D&&f&&a.jsx(pv,{}),D&&L&&a.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:a.jsxs("div",{className:"px-4 py-3",children:[!P&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ko,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),a.jsx("div",{className:"flex gap-2 mb-2",children:a.jsx("textarea",{value:q,onChange:$=>J($.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:ee,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:ee?.5:1},onKeyDown:$=>{$.key==="Enter"&&($.ctrlKey||$.metaKey)&&q.trim()&&!ee&&($.preventDefault(),mt())}})}),a.jsxs("div",{className:"flex items-center gap-2",children:[ee?a.jsx("button",{onClick:()=>{var $;($=_.current)==null||$.abort(),K(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):a.jsx("button",{onClick:mt,disabled:!q.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),a.jsx("button",{onClick:Qt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),ee&&Q.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx(rs,{entries:Q,isRunning:!0})}),pe&&a.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[pe,a.jsx("button",{onClick:mt,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),P&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ko,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:X.map(($,Be)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:$.type==="added"?"rgba(34,197,94,0.1)":$.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:$.type==="added"?"var(--green)":$.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:$.type==="added"?"3px solid var(--green)":$.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:$.type==="added"?"+":$.type==="removed"?"-":" "}),$.content]},Be))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:ll,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:Qt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),D&&y!==null&&x&&v&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(iv,{plugin:x,skill:v,skillContent:p,onApplied:$=>{c({type:"SET_CONTENT",content:$}),c({type:"CONTENT_SAVED"}),c({type:"CLOSE_IMPROVE"})}})})]})}function un(r){return r.testType==="integration"?"integration":"unit"}function dn(r){return r>=.8?"var(--green)":r>=.5?"var(--yellow)":"var(--red)"}function Xx(r){const c=new Date(r);return c.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+c.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function Kx(r){return r==null?"--":r>=1e3?`${(r/1e3).toFixed(1)}s`:`${r}ms`}const Av=new Set(["benchmark","comparison","baseline"]);function Tx(r,c,o,u){return r.map(({rate:x,idx:v,total:p})=>{const b=u+v/(p-1)*(c-u*2),y=u+(o-u*2)-x*(o-u*2);return`${b},${y}`})}function $x({entries:r}){const c=r.filter(g=>Av.has(g.type)).slice().reverse(),o=c.map((g,C,w)=>({rate:g.pass_rate,idx:C,total:w.length})).filter((g,C)=>{const w=c[C].type;return w==="benchmark"||w==="comparison"}),u=c.flatMap((g,C)=>g.type==="baseline"?[{rate:g.pass_rate,idx:C,total:c.length}]:g.type==="comparison"&&g.baselinePassRate!=null?[{rate:g.baselinePassRate,idx:C,total:c.length}]:[]);if(o.length<2&&u.length<2)return null;const x=80,v=24,p=2,b=o.length>=2?Tx(o,x,v,p):[],y=u.length>=2?Tx(u,x,v,p):[],f=b[b.length-1],S=y[y.length-1];return a.jsxs("svg",{width:x,height:v,style:{display:"block",flexShrink:0},children:[y.length>0&&a.jsx("polyline",{points:y.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),b.length>0&&a.jsx("polyline",{points:b.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),S&&a.jsx("circle",{cx:parseFloat(S.split(",")[0]),cy:parseFloat(S.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),f&&a.jsx("circle",{cx:parseFloat(f.split(",")[0]),cy:parseFloat(f.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function Zx(r,c,o){const u=[],x=[],v=[];if((r==="PASS"||r==="EFFECTIVE")&&c>=.7){const y=u.length>0?` Met criteria: ${u.map(f=>f.criterion).join(", ")}.`:"";return{explanation:`${r} (score ${c.toFixed(2)}): evaluation met expectations.${y}`}}if((r==="FAIL"||r==="DEGRADING")&&c<.4){const y=x.length>0?` Failed criteria: ${x.map(S=>S.criterion).join(", ")}.`:"",f=[...x.map(S=>`Improve "${S.criterion}" (score: ${S.score.toFixed(2)})`),...v.map(S=>`Strengthen "${S.criterion}" (score: ${S.score.toFixed(2)})`)];return f.length===0&&f.push("Review prompt instructions and add more specific guidance"),{explanation:`${r} (score ${c.toFixed(2)}): evaluation did not meet expectations.${y}`,recommendations:f}}if(r==="INEFFECTIVE"&&c<.2){const y=[...x.map(f=>`Rework "${f.criterion}" — currently at ${f.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${r} (score ${c.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const p=u.length>0?` Passing: ${u.map(y=>y.criterion).join(", ")}.`:"",b=v.length>0?` Needs improvement: ${v.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${r} (score ${c.toFixed(2)}): mixed results.${p}${b}`}}function Rv(){const{state:r}=tl(),{plugin:c,skill:o}=r,[u,x]=m.useState([]),[v,p]=m.useState([]),[b,y]=m.useState(!0),[f,S]=m.useState(null),[g,C]=m.useState(new Set),[w,O]=m.useState(null),[L,G]=m.useState(""),[q,J]=m.useState(!1),[ee,K]=m.useState(""),[P,re]=m.useState(""),X=m.useCallback(async()=>{y(!0),S(null);try{const[_,le]=await Promise.all([be.getCredentials(c,o),be.getParams(c,o)]);x(_.credentials),p(le.params)}catch(_){S(_ instanceof Error?_.message:"Failed to load parameters"),x([]),p([])}finally{y(!1)}},[c,o]);m.useEffect(()=>{X()},[X]);const te=m.useCallback(async(_,le)=>{J(!0),S(null);try{await be.setCredential(c,o,_,le),O(null),G(""),await X()}catch(I){S(I instanceof Error?I.message:`Failed to save ${_}`)}finally{J(!1)}},[c,o,X]),Q=m.useCallback(async()=>{const _=ee.trim().toUpperCase(),le=P.trim();if(!(!_||!le)){J(!0),S(null);try{await be.setCredential(c,o,_,le),K(""),re(""),await X()}catch(I){S(I instanceof Error?I.message:`Failed to add ${_}`)}finally{J(!1)}}},[c,o,ee,P,X]),F=_=>{C(le=>{const I=new Set(le);return I.has(_)?I.delete(_):I.add(_),I})},pe=new Set(u.map(_=>_.name)),ie=[...u.map(_=>{const le=v.find(I=>I.name===_.name);return{name:_.name,status:_.status,maskedValue:(le==null?void 0:le.maskedValue)??""}}),...v.filter(_=>!pe.has(_.name)).map(_=>({name:_.name,status:_.status,maskedValue:_.maskedValue}))];return a.jsxs("div",{className:"py-2 px-3",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),f&&a.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&&ie.length===0&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!b&&ie.length===0&&!f&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),ie.map(_=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:_.name}),a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:_.status==="ready"?"rgba(34,197,94,0.15)":"rgba(239,68,68,0.15)",color:_.status==="ready"?"#22c55e":"#ef4444"},children:_.status}),_.maskedValue&&a.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[g.has(_.name)?_.maskedValue:"***",a.jsx("button",{onClick:()=>F(_.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${g.has(_.name)?"Hide":"Show"} masked value for ${_.name}`,children:g.has(_.name)?"hide":"show"})]}),w===_.name?a.jsxs("div",{className:"flex gap-1",children:[a.jsx("input",{value:L,onChange:le=>G(le.target.value),onKeyDown:le=>{le.key==="Enter"&&L.trim()&&te(_.name,L)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${_.name}`,autoFocus:!0}),a.jsx("button",{onClick:()=>te(_.name,L),disabled:q||!L.trim(),className:"text-[10px] font-medium",style:{color:"#22c55e",background:"none",border:"none",cursor:"pointer"},children:"Save"}),a.jsx("button",{onClick:()=>{O(null),G("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):a.jsx("button",{onClick:()=>{O(_.name),G("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},_.name)),a.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:ee,onChange:_=>K(_.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),a.jsx("input",{value:P,onChange:_=>re(_.target.value),onKeyDown:_=>{_.key==="Enter"&&ee.trim()&&P.trim()&&Q()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),a.jsx("button",{onClick:Q,disabled:q||!ee.trim()||!P.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:q?"not-allowed":"pointer"},children:"Add"})]})]})]})}function _v(r,c,o){const[u,x]=m.useState(null),[v,p]=m.useState(!1),b=m.useRef("");m.useEffect(()=>{const f=`${r}/${c}/${o}`;b.current!==f&&(b.current=f,p(!0),be.getCaseHistory(r,c,o).then(S=>x(S)).catch(()=>x([])).finally(()=>p(!1)))},[r,c,o]);const y=m.useCallback(()=>{p(!0),b.current="",be.getCaseHistory(r,c,o).then(f=>x(f)).catch(()=>x([])).finally(()=>p(!1))},[r,c,o]);return{entries:u,loading:v,refetch:y}}function Mv(r,c,o){const u={flaky:!1,nonDiscriminating:!1,regression:!1};if(!o||o.length===0)return u;const v=o.slice(0,10).map(y=>y.assertions.find(f=>f.id===r)).filter(Boolean);if(v.length>=2){const f=v.filter(S=>S.pass).length/v.length;f>=.3&&f<=.7&&(u.flaky=!0)}const p=o.find(y=>y.type==="benchmark"),b=o.find(y=>y.type==="baseline");if(p&&b){const y=p.assertions.find(S=>S.id===r),f=b.assertions.find(S=>S.id===r);y!=null&&y.pass&&(f!=null&&f.pass)&&(u.nonDiscriminating=!0)}if(c&&!c.pass&&o.length>=1){const f=o[0].assertions.find(S=>S.id===r);f!=null&&f.pass&&(u.regression=!0)}return u}function zv(){var ae;const{state:r,dispatch:c,saveEvals:o,runCase:u,runAll:x,cancelCase:v,cancelAll:p,generateEvals:b,isReadOnly:y}=tl(),{evals:f,evalsError:S,selectedCaseId:g,inlineResults:C,caseRunStates:w,generateEvalsLoading:O,generateEvalsProgress:L,generateEvalsError:G}=r,q=m.useMemo(()=>{for(const B of w.values())if(B.status==="running"||B.status==="queued")return!0;return!1},[w]),[J,ee]=m.useState(!1),[K,P]=m.useState("all"),re={skill_name:r.skill,evals:[]},X=f??re,te=X.evals,Q=m.useMemo(()=>K==="all"?te:te.filter(B=>un(B)===K),[K,te]),F=Q.find(B=>B.id===g)??null;m.useEffect(()=>{g!==null&&!Q.find(B=>B.id===g)&&c({type:"SELECT_CASE",caseId:Q.length>0?Q[0].id:null})},[Q,g,c]);const[pe,ie]=m.useState([]),_=m.useMemo(()=>te.some(B=>un(B)==="integration"),[te]);m.useEffect(()=>{_&&be.getCredentials(r.plugin,r.skill).then(B=>ie(B.credentials)).catch(()=>ie([]))},[r.plugin,r.skill,_]);const le=m.useMemo(()=>new Set(pe.filter(B=>B.status==="missing").map(B=>B.name)),[pe]),[I,E]=m.useState(!1),M=m.useCallback(B=>{E(!1),b(B?{testType:B}:void 0)},[b]);return!f||te.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:S?"var(--error-muted, #3f1a1a)":"var(--accent-muted)"},children:S?a.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:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),a.jsx("div",{className:"text-center",children:S?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--error, #f87171)"},children:"Invalid evals.json"}),a.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:S}),a.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"})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>ee(!0),disabled:y,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),a.jsxs("div",{style:{position:"relative"},children:[a.jsxs("div",{className:"flex",children:[a.jsx("button",{onClick:()=>M("unit"),disabled:O||y,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:O?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),a.jsx("button",{onClick:()=>E(!I),disabled:O||y,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),I&&a.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:a.jsx("button",{onClick:()=>M("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.background="var(--surface-2)"},onMouseLeave:B=>{B.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),O&&L.length>0&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(rs,{entries:L,isRunning:!0})}),G&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(ss,{error:G,onRetry:()=>M()})}),J&&a.jsx(wx,{evals:X,onSave:B=>{o(B),ee(!1)},onCancel:()=>ee(!1)})]}):a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[a.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",Q.length,")"]}),a.jsx("div",{className:"flex items-center gap-1.5",children:q?a.jsx("button",{onClick:p,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"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>x("benchmark"),disabled:Q.length===0||y,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),a.jsx("button",{onClick:()=>x("comparison"),disabled:Q.length===0||y,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),a.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(B=>a.jsx("button",{onClick:()=>P(B),style:{padding:"2px 8px",fontSize:10,fontWeight:K===B?600:400,background:K===B?"var(--accent-muted)":"transparent",color:K===B?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:B==="all"?`All (${te.length})`:B==="unit"?`Unit (${te.filter(de=>un(de)==="unit").length})`:`Integration (${te.filter(de=>un(de)==="integration").length})`},B))}),a.jsxs("div",{className:"py-1",children:[Q.length===0&&te.length>0&&a.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",K==="all"?"":K+" ","tests yet"]}),Q.map(B=>{var W;const de=C.get(B.id),j=g===B.id,D=un(B);return a.jsxs("button",{onClick:()=>c({type:"SELECT_CASE",caseId:B.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:j?"var(--accent-muted)":"transparent",borderLeft:j?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:ne=>{j||(ne.currentTarget.style.background="var(--surface-2)")},onMouseLeave:ne=>{j||(ne.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[a.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:j?"var(--text-primary)":"var(--text-secondary)"},children:["#",B.id," ",B.name,a.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:D==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:D==="unit"?"#6383ff":"#fb923c",whiteSpace:"nowrap"},children:D==="unit"?"U":"I"}),D==="integration"&&((W=B.requiredCredentials)==null?void 0:W.some(ne=>le.has(ne)))&&a.jsx("span",{title:"Configure credentials to run",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),a.jsx(Jx,{result:de})]}),a.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[B.assertions.length," assertion",B.assertions.length!==1?"s":"",(de==null?void 0:de.passRate)!=null&&a.jsx(Ov,{passRate:de.passRate})]})]},B.id)})]}),a.jsx("div",{className:"px-3 py-2",children:!y&&a.jsx("button",{onClick:()=>ee(!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:B=>{B.currentTarget.style.borderColor="var(--accent)",B.currentTarget.style.color="var(--accent)"},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-default)",B.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),_&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Rv,{})})]}),a.jsx("div",{className:"overflow-auto",children:F?a.jsx(Lv,{evalCase:F,result:C.get(F.id),evals:f,caseStatus:((ae=w.get(F.id))==null?void 0:ae.status)??"idle",onSaveEvals:o,onRun:B=>u(B,"benchmark"),onCompare:B=>u(B,"comparison"),onCancel:B=>v(B),onImprove:B=>c({type:"OPEN_IMPROVE",evalId:B})}):a.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),J&&a.jsx(wx,{evals:X,onSave:B=>{o(B),ee(!1)},onCancel:()=>ee(!1)})]})}function Lv({evalCase:r,result:c,evals:o,caseStatus:u,onSaveEvals:x,onRun:v,onCompare:p,onCancel:b,onImprove:y}){const{state:f,isReadOnly:S}=tl(),{plugin:g,skill:C}=f,{entries:w,loading:O}=_v(g,C,r.id),[L,G]=m.useState(!1),[q,J]=m.useState(r.prompt),[ee,K]=m.useState(!1),[P,re]=m.useState(r.expected_output);m.useState(()=>{J(r.prompt),re(r.expected_output)});const X=m.useCallback(B=>{x({...o,evals:o.evals.map(de=>de.id===B.id?B:de)})},[o,x]),te=m.useCallback(()=>{X({...r,prompt:q}),G(!1)},[r,q,X]),Q=m.useCallback(()=>{X({...r,expected_output:P}),K(!1)},[r,P,X]),F=m.useCallback(()=>{X({...r,assertions:[...r.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[r,X]),pe=m.useCallback((B,de)=>{X({...r,assertions:r.assertions.map(j=>j.id===B?{...j,text:de}:j)})},[r,X]),ie=m.useCallback(B=>{X({...r,assertions:r.assertions.filter(de=>de.id!==B)})},[r,X]),_=m.useCallback(()=>{confirm("Delete this test case?")&&x({...o,evals:o.evals.filter(B=>B.id!==r.id)})},[o,r.id,x]),le=c&&c.assertions.length>0&&c.assertions.every(B=>B.pass),I=c&&c.assertions.some(B=>!B.pass),E=un(r),M=r.requiredCredentials??[],ae=E==="integration"&&M.length>0;return a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",r.id," ",r.name]}),S?a.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:E==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:E==="unit"?"#6383ff":"#fb923c"},children:E==="unit"?"Unit":"Integration"}):a.jsx("button",{onClick:()=>{if((E==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:de,requirements:j,cleanup:D,...W}=r;X({...W,testType:"unit"})}else X({...r,testType:"integration"})},title:`Click to switch to ${E==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:E==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:E==="unit"?"#6383ff":"#fb923c",border:"none",cursor:"pointer"},children:E==="unit"?"Unit":"Integration"}),a.jsx(Jx,{result:c})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[u==="running"||u==="queued"?a.jsxs("button",{onClick:()=>b(r.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>v(r.id),disabled:S,className:"btn btn-primary text-[12px]",children:"Run"}),a.jsx("button",{onClick:()=>p(r.id),disabled:S,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),I&&!S&&u!=="running"&&u!=="queued"&&a.jsx("button",{onClick:()=>y(r.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!S&&u!=="running"&&u!=="queued"&&a.jsx("button",{onClick:_,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.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"})]})})]})]}),S&&E==="integration"&&a.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:[a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),a.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),a.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),le&&a.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:[a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[a.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),a.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),ae&&a.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"Required Credentials"})]}),a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:M.map(B=>a.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:B},B))})]}),!S&&E==="integration"&&a.jsx(Uv,{evalCase:r,onUpdate:X}),a.jsx(br,{title:"Prompt",children:L?a.jsxs("div",{children:[a.jsx("textarea",{value:q,onChange:B=>J(B.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:te,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{J(r.prompt),G(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.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:S?"default":"pointer"},onClick:()=>{S||G(!0)},onMouseEnter:B=>{S||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-subtle)"},children:r.prompt||a.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:S?"No prompt":"Click to edit prompt..."})})}),a.jsx(br,{title:"Expected Output",children:ee?a.jsxs("div",{children:[a.jsx("textarea",{value:P,onChange:B=>re(B.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:Q,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{re(r.expected_output),K(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.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:S?"default":"pointer"},onClick:()=>{S||K(!0)},onMouseEnter:B=>{S||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-subtle)"},children:r.expected_output||a.jsx("span",{style:{fontStyle:"italic"},children:S?"No expected output":"Click to edit expected output..."})})}),a.jsx(br,{title:`Assertions (${r.assertions.length})`,action:S?void 0:a.jsx("button",{onClick:F,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:r.assertions.length===0?a.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):a.jsx("div",{className:"space-y-2",children:r.assertions.map(B=>{const de=c==null?void 0:c.assertions.find(D=>D.assertion_id===B.id),j=Mv(B.id,de,w);return a.jsx(Dv,{assertion:B,result:de,badges:j,isReadOnly:S,onUpdate:D=>pe(B.id,D),onDelete:()=>ie(B.id)},B.id)})})}),(c==null?void 0:c.output)&&a.jsx(Bv,{output:c.output,durationMs:c.durationMs,tokens:c.tokens}),c&&c.passRate!=null&&c.passRate<.2&&(()=>{const B=Zx("INEFFECTIVE",c.passRate);return B.recommendations&&B.recommendations.length>0?a.jsx(br,{title:"Recommendations",children:a.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"This eval is significantly below expectations"})]}),a.jsx("ul",{className:"space-y-1.5 ml-1",children:B.recommendations.map((de,j)=>a.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"#fb923c",fontWeight:600,flexShrink:0},children:"•"}),de]},j))})]})}):null})(),a.jsx(Hv,{evalId:r.id,sharedEntries:w,sharedLoading:O})]},r.id)}function Dv({assertion:r,result:c,badges:o,isReadOnly:u,onUpdate:x,onDelete:v}){const[p,b]=m.useState(!1),[y,f]=m.useState(r.text),[S,g]=m.useState(!1),C=()=>{x(y),b(!1)};return a.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:a.jsxs("div",{className:"flex items-start gap-2",children:[c?a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:c.pass?"var(--green-muted)":"var(--red-muted)"},children:c.pass?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):a.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"}),(o==null?void 0:o.regression)&&a.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:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:r.id}),(o==null?void 0:o.flaky)&&a.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"}),(o==null?void 0:o.nonDiscriminating)&&a.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."})]}),p?a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:y,onChange:w=>f(w.target.value),onKeyDown:w=>{w.key==="Enter"&&C(),w.key==="Escape"&&b(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),a.jsx("button",{onClick:C,className:"btn btn-primary text-[11px]",children:"Save"})]}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:u?"default":"pointer"},onClick:()=>{u||(f(r.text),b(!0))},children:r.text}),(c==null?void 0:c.reasoning)&&a.jsx("button",{onClick:()=>g(!S),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:S?"Hide reasoning":"Show reasoning"}),S&&(c==null?void 0:c.reasoning)&&a.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:c.reasoning})]}),!u&&a.jsx("button",{onClick:v,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:w=>{w.currentTarget.style.color="var(--red)",w.currentTarget.style.opacity="1"},onMouseLeave:w=>{w.currentTarget.style.color="var(--text-tertiary)",w.currentTarget.style.opacity=""},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function br({title:r,action:c,children:o}){return a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:r}),c]}),o]})}function Jx({result:r}){const[c,o]=m.useState(!1);if(!r||r.status==null)return a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const u=r.status==="pass",x=r.passRate??0,p=Zx(u?"PASS":"FAIL",x);return a.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:()=>o(!0),onMouseLeave:()=>o(!1),"aria-describedby":c?"verdict-tooltip":void 0,children:[r.passRate!=null?`${Math.round(r.passRate*100)}%`:r.status,c&&a.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:p.explanation})]})}function Ov({passRate:r}){const c=Math.round(r*100);return a.jsx("div",{className:"flex items-center gap-1",children:a.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${c}%`,background:c>=80?"var(--green)":c>=50?"var(--yellow)":"var(--red)"}})})})}function Bv({output:r,durationMs:c,tokens:o}){const[u,x]=m.useState(!1);return a.jsxs("div",{className:"mb-5",children:[a.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:[a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",c!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",(c/1e3).toFixed(1),"s)"]}),o!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",o," tokens)"]})]}),u&&a.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:r})]})}function $o(r){return r==="baseline"?"right":r==="comparison"?"full":"left"}function Zo({entry:r}){return a.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:Xx(r.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:r.model}),a.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:r.type==="benchmark"?"rgba(99,131,255,0.15)":r.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:r.type==="benchmark"?"#6383ff":r.type==="comparison"?"var(--purple)":"#fb923c"},children:r.type}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:dn(r.pass_rate)},children:[Math.round(r.pass_rate*100),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[r.durationMs!=null&&a.jsx("span",{children:Kx(r.durationMs)}),r.tokens!=null&&a.jsxs("span",{children:[r.tokens>=1e3?`${(r.tokens/1e3).toFixed(1)}k`:r.tokens," tok"]})]}),r.type==="comparison"&&r.baselinePassRate!=null&&(()=>{const c=r.pass_rate-r.baselinePassRate,o=c>.001?"skill":c<-.001?"baseline":"tie",u=c>0?"+":"",x=o==="skill"?"var(--green)":o==="baseline"?"var(--red)":"var(--text-tertiary)";return a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:c>=0?"var(--green)":"var(--red)"},children:[u,(c*100).toFixed(1),"%"]}),a.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"rgba(0,0,0,0.2)",color:x},children:o})]})})(),a.jsx("div",{className:"space-y-0.5",children:r.assertions.map(c=>a.jsxs("div",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:c.pass?"var(--green-muted)":"var(--red-muted)"},children:c.pass?a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:c.text})]},c.id))})]})}function Hv({evalId:r,sharedEntries:c,sharedLoading:o}){const{state:u,dispatch:x}=tl(),{plugin:v,skill:p}=u,[b,y]=m.useState(!0),f=c??null,S=o??!1,g=m.useCallback(()=>{y(L=>!L)},[]),C=f?f.slice(0,10):[],w=C.some(L=>{const G=$o(L.type);return G==="left"||G==="full"}),O=C.some(L=>{const G=$o(L.type);return G==="right"||G==="full"});return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:g,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:[a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",f&&f.length>0&&a.jsxs("span",{style:{fontWeight:400},children:["(",f.length," run",f.length!==1?"s":"",")"]})]}),b&&a.jsx("div",{className:"animate-fade-in",children:S?a.jsxs("div",{className:"flex items-center gap-2 py-3",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!f||f.length===0?a.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):a.jsxs("div",{children:[C.length>=2&&a.jsx("div",{className:"mb-2",children:a.jsx($x,{entries:C})}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!w&&a.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!O&&a.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),C.map((L,G)=>{const q=$o(L.type);return q==="full"?a.jsx("div",{style:{gridColumn:"1 / -1"},children:a.jsx(Zo,{entry:L})},G):q==="left"?a.jsxs(m.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"},children:a.jsx(Zo,{entry:L})}),a.jsx("div",{style:{gridColumn:"2"}})]},G):a.jsxs(m.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"}}),a.jsx("div",{style:{gridColumn:"2"},children:a.jsx(Zo,{entry:L})})]},G)})]}),a.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:L=>{L.currentTarget.style.textDecoration="underline"},onMouseLeave:L=>{L.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function wx({evals:r,onSave:c,onCancel:o}){const[u,x]=m.useState(""),[v,p]=m.useState(""),[b,y]=m.useState(""),[f,S]=m.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[g,C]=m.useState("unit"),[w,O]=m.useState(""),[L,G]=m.useState([]),[q,J]=m.useState(""),[ee,K]=m.useState(""),P=Math.max(0,...r.evals.map(Q=>Q.id))+1,re=Q=>{C(Q),Q==="unit"&&(G([]),O(""),J(""),K(""))},X=()=>{const Q=w.trim().toUpperCase();Q&&!L.includes(Q)&&G([...L,Q]),O("")},te=()=>{if(!u.trim()||!v.trim())return;const Q={id:P,name:u.trim(),prompt:v.trim(),expected_output:b.trim(),files:[],assertions:f.filter(F=>F.text.trim()),...g==="integration"?{testType:"integration",...L.length>0?{requiredCredentials:L}:{},...q||ee?{requirements:{...q?{platform:q}:{},...ee?{chromeProfile:ee}:{}}}:{}}:{}};c({...r,evals:[...r.evals,Q]})};return a.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:a.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:[a.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),a.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(Q=>a.jsx("button",{onClick:()=>re(Q),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:g===Q?Q==="unit"?"rgba(99,131,255,0.2)":"rgba(251,146,60,0.2)":"transparent",color:g===Q?Q==="unit"?"#6383ff":"#fb923c":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:Q},Q))})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),a.jsx("input",{value:u,onChange:Q=>x(Q.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),a.jsx("textarea",{value:v,onChange:Q=>p(Q.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),a.jsx("textarea",{value:b,onChange:Q=>y(Q.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),f.map((Q,F)=>a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:Q.text,onChange:pe=>S(f.map((ie,_)=>_===F?{...ie,text:pe.target.value}:ie)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),f.length>1&&a.jsx("button",{onClick:()=>S(f.filter((pe,ie)=>ie!==F)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},Q.id)),a.jsx("button",{onClick:()=>S([...f,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),g==="integration"&&a.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:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:L.map(Q=>a.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:[Q,a.jsx("button",{onClick:()=>G(L.filter(F=>F!==Q)),style:{color:"#fb923c",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},Q))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:w,onChange:Q=>O(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&(Q.preventDefault(),X())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),a.jsx("button",{onClick:X,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:q,onChange:Q=>J(Q.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:ee,onChange:Q=>K(Q.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsx("button",{onClick:te,disabled:!u.trim()||!v.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function Uv({evalCase:r,onUpdate:c}){var p,b;const[o,u]=m.useState(""),x=()=>{const y=o.trim().toUpperCase();y&&!(r.requiredCredentials??[]).includes(y)&&c({...r,requiredCredentials:[...r.requiredCredentials??[],y]}),u("")},v=y=>{const f=(r.requiredCredentials??[]).filter(S=>S!==y);c({...r,requiredCredentials:f.length>0?f:void 0})};return a.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:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(r.requiredCredentials??[]).map(y=>a.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:[y,a.jsx("button",{onClick:()=>v(y),style:{color:"#fb923c",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},y))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:o,onChange:y=>u(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),x())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),a.jsx("button",{onClick:x,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:((p=r.requirements)==null?void 0:p.platform)??"",onChange:y=>c({...r,requirements:{...r.requirements,platform:y.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:((b=r.requirements)==null?void 0:b.chromeProfile)??"",onChange:y=>c({...r,requirements:{...r.requirements,chromeProfile:y.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function qv(r,c){const o=r+c,u=o*10,x=o*25,v=p=>p>=60?`${Math.round(p/60)}m`:`${p}s`;return`${v(u)}–${v(x)}`}function Vv(){const{state:r,runCase:c,runAll:o,cancelCase:u,cancelAll:x,isReadOnly:v}=tl(),{evals:p,caseRunStates:b,bulkRunActive:y,latestBenchmark:f,inlineResults:S}=r,g=(p==null?void 0:p.evals)??[],C=m.useMemo(()=>{for(const K of b.values())if(K.status==="running"||K.status==="queued")return!0;return!1},[b]),w=g.filter(K=>{const P=b.get(K.id);return P&&(P.status==="complete"||P.status==="error"||P.status==="cancelled")}).length,O=g.filter(K=>{const P=b.get(K.id);return P&&(P.status==="running"||P.status==="queued")}).length,L=m.useRef(null),[G,q]=m.useState(0);m.useEffect(()=>{if(C&&!L.current&&(L.current=Date.now()),!C){L.current=null,q(0);return}const K=setInterval(()=>{L.current&&q(Math.round((Date.now()-L.current)/1e3))},1e3);return()=>clearInterval(K)},[C]);const J=g.reduce((K,P)=>K+P.assertions.length,0),ee=m.useMemo(()=>qv(g.length,J),[g.length,J]);return a.jsxs("div",{className:"p-5",children:[v&&a.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:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),a.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),C&&a.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[O," running"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[C&&a.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:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),a.jsx("button",{onClick:()=>o("comparison"),disabled:g.length===0||C||v,className:"btn btn-primary text-[12px]",children:"Compare All"}),a.jsx("button",{onClick:()=>o("benchmark"),disabled:g.length===0||C||v,className:"btn btn-secondary text-[12px]",children:"Skill Only"}),a.jsx("button",{onClick:()=>o("baseline"),disabled:g.length===0||C||v,className:"btn btn-secondary text-[12px]",children:"Baseline Only"})]})]}),C&&g.length>0&&a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",w,"/",g.length," cases"]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(w/g.length*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${w/g.length*100}%`,background:"var(--accent)"}})}),a.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",G>=60?`${Math.floor(G/60)}m ${G%60}s`:`${G}s`]}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",ee]})]})]}),a.jsx("div",{className:"space-y-3 stagger-children",children:g.map(K=>{const P=S.get(K.id),re=b.get(K.id),X=(re==null?void 0:re.status)??"idle";return a.jsx(Yv,{name:K.name,evalId:K.id,result:P,caseStatus:X,runMode:(re==null?void 0:re.mode)??null,isReadOnly:v,onRun:te=>c(te,"benchmark"),onBaseline:te=>c(te,"baseline"),onCompare:te=>c(te,"comparison"),onCancel:te=>u(te)},K.id)})}),!C&&f&&f.cases.length>0&&a.jsxs("div",{className:"mt-5",children:[a.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Overall Pass Rate"}),a.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&&a.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.overall_pass_rate===1&&!f.comparison&&a.jsx("button",{onClick:()=>o("comparison"),disabled:g.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:g.length===0?.5:1},children:"Run Final A/B Comparison"})]}),f.comparison&&a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Ax,{label:"Skill",value:f.comparison.skillPassRate,color:"var(--accent)"}),a.jsx(Ax,{label:"Baseline",value:f.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),a.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&&` | ${f.verdict}`]})]})]})]})}const Gv={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 Yv({name:r,evalId:c,result:o,caseStatus:u,runMode:x,isReadOnly:v,onRun:p,onBaseline:b,onCompare:y,onCancel:f}){const[S,g]=m.useState(!1),C=u==="running"||u==="queued",w=u==="complete"||u==="error";return a.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:C?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:C?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[u==="running"&&a.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),u==="queued"&&a.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),a.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",c," ",r]}),x&&(C||w)&&(()=>{const O=Gv[x];return O?a.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:O.bg,color:O.color,padding:"1px 6px"},children:O.label}):null})()]}),a.jsxs("div",{className:"flex items-center gap-2",children:[C?a.jsx("button",{onClick:()=>f(c),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"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>y(c),disabled:v,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),a.jsx("button",{onClick:()=>p(c),disabled:v,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),a.jsx("button",{onClick:()=>b(c),disabled:v,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),o&&o.status!=null&&a.jsx("span",{className:"pill text-[10px]",style:{background:o.status==="pass"?"var(--green-muted)":(o.status==="error","var(--red-muted)"),color:o.status==="pass"?"var(--green)":"var(--red)"},children:o.passRate!=null?`${Math.round(o.passRate*100)}%`:o.status}),u==="cancelled"&&a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),o&&o.assertions.length>0&&a.jsxs("div",{className:"px-4 pb-3",children:[a.jsx("div",{className:"space-y-1",children:o.assertions.map(O=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{style:{color:O.pass?"var(--green)":"var(--red)"},children:O.pass?"PASS":"FAIL"}),a.jsx("span",{style:{color:"var(--text-secondary)"},children:O.text})]},O.assertion_id))}),o.output&&a.jsx("button",{onClick:()=>g(!S),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:S?"Hide output":"Show output"}),S&&o.output&&a.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:o.output})]}),o&&o.errorMessage&&a.jsx(Qv,{errorMessage:o.errorMessage,classifiedError:o.classifiedError})]})}const Jo={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function Qv({errorMessage:r,classifiedError:c}){const[o,u]=m.useState(!1),x=(c==null?void 0:c.title)??"Error",v=c==null?void 0:c.hint,p=c?Jo[c.category]??Jo.unknown:Jo.unknown;return a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid rgba(239,68,68,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsx("span",{style:{fontSize:12},children:p}),a.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:x}),a.jsx("button",{onClick:()=>u(!o),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:o?"Hide details":"Details"})]}),v&&a.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:v}),o&&a.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:r})]})})}function Ax({label:r,value:c,color:o}){return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:r}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:o},children:[Math.round(c*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${c*100}%`,background:o}})})]})}const Rx={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 Xv(){const{state:r,dispatch:c,runActivationTest:o,cancelActivation:u,generateActivationPrompts:x}=tl(),{plugin:v,skill:p,activationPrompts:b,activationResults:y,activationSummary:f,activationRunning:S,activationError:g,activationStartedAt:C,activationClassifyingStatus:w,generatingPrompts:O,generatingPromptsError:L,activationHistory:G}=r,[q,J]=m.useState(b),[ee,K]=m.useState(null),[P,re]=m.useState(!1);m.useEffect(()=>{b&&b!==q&&J(b)},[b]),m.useEffect(()=>{c({type:"SET_ACTIVATION_PROMPTS",prompts:q})},[q,c]),m.useEffect(()=>{fetch(`/api/skills/${v}/${p}/description`).then(I=>I.json()).then(I=>K(I.rawContent||I.description||null)).catch(()=>K(null))},[v,p]);function X(){o(q)}function te(){x(8)}const Q=q.trim().split(`
|
|
63
63
|
`).filter(Boolean).length,F=y.filter(I=>I.classification==="TP"||I.classification==="TN"),pe=y.filter(I=>I.classification==="FP"||I.classification==="FN"),ie=(ee==null?void 0:ee.replace(/^---[\s\S]*?---\s*/,"").trim())??null,_=q.trim().length>0,le=ie?Er(ie):"";return a.jsxs("div",{className:"p-5 space-y-5",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),a.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."})]}),a.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[a.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),a.jsx("div",{className:"flex gap-1.5",children:a.jsx("button",{onClick:te,disabled:O||!ie||S,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:O?"var(--surface-3)":"var(--surface-2)",color:ie?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:ie?1:.5,cursor:ie?"pointer":"not-allowed"},title:ie?void 0:"No skill description available",onMouseEnter:I=>{ie&&!O&&(I.currentTarget.style.background="var(--surface-3)")},onMouseLeave:I=>{O||(I.currentTarget.style.background="var(--surface-2)")},children:O?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}),_?"Regenerate":"Generate"," Test Prompts"]})})})]}),!ie&&!S&&a.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&&a.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:L}),a.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:q,onChange:I=>J(I.target.value),placeholder:`How do I write a unit test?
|
|
64
64
|
What edge cases should I test?
|
|
65
65
|
+Deploy this to production
|
|
66
66
|
!What's the weather like today?
|
|
67
|
-
!Write me a poem about flowers`}),a.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:"One prompt per line"}),a.jsx(jr,{}),a.jsx("span",{children:"No prefix = auto-classify"}),a.jsx(jr,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),a.jsx(jr,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),a.jsx(jr,{}),a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[Q," prompt",Q!==1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:X,disabled:S||!q.trim(),className:"btn btn-primary",children:S?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"#fff",borderColor:"rgba(255,255,255,0.2)",width:14,height:14}}),"Testing..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"6"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),S&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:u,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[w||`${y.length} / ${Q} prompts tested`,C&&a.jsx(Jv,{startedAt:C})]})]})]})]}),a.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[a.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),a.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:ie?a.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:le}}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),g&&a.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:g}),S&&y.length===0&&a.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[a.jsx("div",{className:"spinner-lg mx-auto mb-4"}),a.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),y.length>0&&a.jsxs("div",{className:"space-y-5",children:[pe.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),a.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",pe.length,")"]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:pe.map((I,E)=>a.jsx(_x,{result:I},`incorrect-${E}`))})]}),F.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"16 10 11 15 8 12"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",F.length,")"]})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:F.map((I,E)=>a.jsx(_x,{result:I},`correct-${E}`))})]})]}),f&&a.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[a.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&&a.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"]}),a.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[a.jsx(Wo,{label:"Precision",value:f.precision,description:"Of all activations, how many were correct?",detail:`${f.tp} true / ${f.tp+f.fp} total activations`}),a.jsx(Wo,{label:"Recall",value:f.recall,description:"Of expected activations, how many fired?",detail:`${f.tp} activated / ${f.tp+f.fn} expected`}),a.jsx(Wo,{label:"Reliability",value:f.reliability,description:"Overall correct classification rate",detail:`${f.tp+f.tn} correct / ${f.total} total`})]}),a.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[a.jsx(Sr,{label:"True Positive",abbr:"TP",count:f.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),a.jsx(Sr,{label:"False Positive",abbr:"FP",count:f.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),a.jsx(Sr,{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"}),a.jsx(Sr,{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"})]})]})]}),a.jsx(Kv,{history:G,expanded:P,onToggle:()=>re(!P)})]})}function Kv({history:r,expanded:c,onToggle:o}){return r===null?null:a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:c?"1px solid var(--border-subtle)":"none"},onClick:o,children:[a.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",r.length>0&&a.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",r.length," run",r.length!==1?"s":"",")"]})]}),a.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:c?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),c&&a.jsx("div",{className:"px-4 py-3",children:r.length===0?a.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):a.jsx("div",{className:"space-y-2",children:r.map(u=>a.jsx($v,{run:u},u.id))})})]})}function $v({run:r}){const c=Math.round(r.summary.reliability*100),o=c>=80?"var(--green)":c>=60?"var(--yellow)":"var(--red)",u=c>=80?"Good":c>=60?"Needs Work":"Poor",x=o;return a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Zv(r.timestamp)}),a.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:r.model||r.provider}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[r.promptCount," prompts"]})]})}),a.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:o,fontVariantNumeric:"tabular-nums"},children:[c,"%"]}),a.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 Zv(r){const c=Date.now(),o=new Date(r).getTime(),u=Math.floor((c-o)/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 p=Math.floor(v/24);return p<7?`${p}d ago`:new Date(r).toLocaleDateString()}function jr(){return a.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function _x({result:r}){const c=Rx[r.classification]||Rx.FN,o=r.classification==="TP"||r.classification==="TN";return a.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:c.bg,border:"1px solid transparent"},children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${c.text} 20%, transparent)`},children:o?a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:c.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:c.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1",children:a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:r.prompt})}),a.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[a.jsx("span",{className:"pill",style:{background:"rgba(0,0,0,0.1)",color:c.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:r.classification}),a.jsx("span",{style:{color:r.activate?"var(--green)":"var(--text-tertiary)"},children:r.activate?"Activated":"Silent"}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",r.expected==="should_activate"?"activate":"stay silent"]}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[r.confidence," confidence"]}),r.autoClassified&&a.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"})]}),r.reasoning&&a.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:r.reasoning})]})]})}function Wo({label:r,value:c,description:o,detail:u}){const x=Math.round(c*100),v=x>=80?"var(--green)":x>=60?"var(--yellow)":"var(--red)";return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:v},children:[x,"%"]}),a.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:r}),a.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:o}),a.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:u})]})}function Sr({abbr:r,count:c,bg:o,color:u,description:x}){return a.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:o},children:[a.jsx("div",{className:"text-[20px] font-bold",style:{color:u},children:c}),a.jsx("div",{className:"text-[11px] font-semibold",style:{color:u},children:r}),a.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:x})]})}function Jv({startedAt:r}){const[c,o]=m.useState(0);return m.useEffect(()=>{const u=setInterval(()=>o(Math.floor((Date.now()-r)/1e3)),1e3);return()=>clearInterval(u)},[r]),a.jsxs("span",{className:"ml-2",children:["(",c,"s)"]})}const Fo={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Mx={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},nc=600,sc=180,Nt=40,Io=nc-Nt*2,la=sc-Nt*2,Wv=[25,50,75,100];function zx(r){return new Date(r).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Fv(r){return r==null?"--":`${(r/1e3).toFixed(1)}s`}function Iv({entries:r,onPointClick:c}){const[o,u]=m.useState(null),x=m.useMemo(()=>[...r].reverse(),[r]);if(x.length<2)return null;const v=x.length,p=x.map((f,S)=>{const g=Nt+S/(v-1)*Io,C=f.passRate*100,w=Nt+la-C/100*la;return{x:g,y:w,pct:C,entry:f}}),b=p.map(f=>`${f.x},${f.y}`).join(" "),y=Array.from(new Set(x.map(f=>f.type)));return a.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:v>=20?"auto":void 0},children:[a.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),a.jsx("div",{className:"flex items-center gap-5 mb-3",children:y.map(f=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Fo[f]??"var(--text-tertiary)"}}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Mx[f]??f})]},f))}),a.jsxs("svg",{width:nc,height:sc,viewBox:`0 0 ${nc} ${sc}`,style:{display:"block",overflow:"visible"},children:[Wv.map(f=>{const S=Nt+la-f/100*la;return a.jsxs("g",{children:[a.jsx("line",{x1:Nt,y1:S,x2:Nt+Io,y2:S,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),a.jsxs("text",{x:Nt-8,y:S+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[f,"%"]})]},f)}),a.jsx("line",{x1:Nt,y1:Nt+la,x2:Nt+Io,y2:Nt+la,stroke:"var(--border-subtle)",strokeWidth:1}),a.jsx("text",{x:Nt-8,y:Nt+la+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),a.jsx("polyline",{points:b,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),p.map((f,S)=>a.jsx("circle",{cx:f.x,cy:f.y,r:5,fill:Fo[f.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:g=>{g.currentTarget.setAttribute("r","7"),u({x:f.x,y:f.y,entry:f.entry})},onMouseLeave:g=>{g.currentTarget.setAttribute("r","5"),u(null)},onClick:()=>c==null?void 0:c(f.entry)},S)),Pv(v).map(f=>a.jsx("text",{x:p[f].x,y:Nt+la+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:zx(x[f].timestamp)},f))]}),o&&a.jsxs("div",{style:{position:"absolute",left:o.x,top:o.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:[a.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:zx(o.entry.timestamp)}),a.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:o.entry.model}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:Fo[o.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Mx[o.entry.type]??o.entry.type}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(o.entry.passRate*100),"%"]})]}),a.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:Fv(o.entry.totalDurationMs)}),a.jsx("span",{children:o.entry.totalTokens!=null?`${o.entry.totalTokens} tokens`:"--"})]})]})]})}function Pv(r){if(r<=3)return Array.from({length:r},(u,x)=>x);if(r<=6)return[0,Math.floor(r/2),r-1];if(r<20)return[0,Math.floor(r/3),Math.floor(2*r/3),r-1];const c=Math.ceil(r/10),o=[0];for(let u=c;u<r-1;u+=c)o.push(u);return o.push(r-1),o}function Nr(r){return r>=.8?"var(--green)":r>=.5?"var(--yellow)":"var(--red)"}function ey(r){return r>=1e3?`${(r/1e3).toFixed(1)}s`:`${Math.round(r)}ms`}function ty({rate:r,label:c}){const o=Math.round(r*100);return a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:c}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:Nr(r)},children:[o,"%"]})]}),a.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${o}%`,background:Nr(r)}})})]})})}function ly({points:r}){if(r.length<2)return null;const c=200,o=48,u=4,x=r.length,v=r.map((y,f)=>{const S=u+f/(x-1)*(c-u*2),g=u+(o-u*2)-y.passRate*(o-u*2);return{x:S,y:g}}),p=`M ${v[0].x},${o-u} `+v.map(y=>`L ${y.x},${y.y}`).join(" ")+` L ${v[v.length-1].x},${o-u} Z`,b=v.map((y,f)=>`${f===0?"M":"L"} ${y.x},${y.y}`).join(" ");return a.jsxs("svg",{width:c,height:o,style:{display:"block"},children:[a.jsx("path",{d:p,fill:"var(--accent-muted)"}),a.jsx("path",{d:b,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),a.jsx("circle",{cx:v[v.length-1].x,cy:v[v.length-1].y,r:3,fill:"var(--accent)"})]})}function ay({plugin:r,skill:c}){const[o,u]=m.useState(null),[x,v]=m.useState(!0);if(m.useEffect(()=>{v(!0),be.getStats(r,c).then(u).catch(()=>u(null)).finally(()=>v(!1))},[r,c]),x)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"skeleton h-24 rounded-xl"}),a.jsx("div",{className:"skeleton h-48 rounded-xl"}),a.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!o||o.totalRuns===0)return a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),a.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const p=o.trendPoints.length>0?o.trendPoints[o.trendPoints.length-1].passRate:0,b=o.trendPoints.length>0?o.trendPoints[0].passRate:0,y=p-b,f=o.assertionStats.slice(0,10);return a.jsxs("div",{className:"space-y-4 stagger-children",children:[a.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:o.totalRuns})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:Nr(p)},children:[Math.round(p*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:y>=0?"var(--green)":"var(--red)"},children:[y>=0?"+":"",Math.round(y*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:o.modelStats.length})]})]}),o.trendPoints.length>=2&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),a.jsx(ly,{points:o.trendPoints})]}),o.modelStats.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"})]})}),a.jsx("tbody",{children:o.modelStats.map(S=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:S.model}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:S.runs}),a.jsx("td",{style:{padding:"8px",textAlign:"center"},children:a.jsxs("span",{className:"font-semibold",style:{color:Nr(S.avgPassRate)},children:[Math.round(S.avgPassRate*100),"%"]})}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:ey(S.avgDurationMs)})]},S.model))})]})]}),f.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),a.jsx("div",{className:"space-y-3",children:f.map(S=>a.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--surface-2)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},onClick:()=>{},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.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:["#",S.evalId]}),a.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:S.evalName}),a.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[S.totalRuns," runs"]})]}),a.jsx(ty,{rate:S.passRate,label:S.text})]},`${S.evalId}:${S.id}`))})]})]})}function ny({plugin:r,skill:c}){const[o,u]=m.useState(null),[x,v]=m.useState(null),[p,b]=m.useState({}),[y,f]=m.useState({});m.useEffect(()=>{be.getEvals(r,c).then(u).catch(()=>u(null))},[r,c]);async function S(g){if(x===g){v(null);return}if(v(g),!p[g]){f(C=>({...C,[g]:!0}));try{const C=await be.getCaseHistory(r,c,g);b(w=>({...w,[g]:C}))}catch{b(C=>({...C,[g]:[]}))}finally{f(C=>({...C,[g]:!1}))}}}return o?a.jsx("div",{className:"space-y-2 stagger-children",children:o.evals.map(g=>{const C=p[g.id]||[],w=x===g.id,O=y[g.id],L=C.length>0?C[0].pass_rate:null;return a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{onClick:()=>S(g.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:w?"var(--surface-2)":"transparent"},onMouseEnter:G=>{w||(G.currentTarget.style.background="var(--surface-2)")},onMouseLeave:G=>{w||(G.currentTarget.style.background="transparent")},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:w?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),a.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:["#",g.id]}),a.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:g.name}),C.length>=2&&a.jsx($x,{entries:C}),L!=null&&a.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:dn(L)},children:[Math.round(L*100),"%"]}),C.length>0&&a.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[C.length," runs"]})]}),w&&a.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:O?a.jsxs("div",{className:"p-4 flex items-center gap-2",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):C.length===0?a.jsx("div",{className:"p-4",children:a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):a.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:C.map((G,q)=>a.jsxs("div",{className:"p-4",style:{background:q===0?"var(--surface-2)":"transparent"},children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:Xx(G.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:G.model}),a.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}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:dn(G.pass_rate)},children:[Math.round(G.pass_rate*100),"%"]})]}),a.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&&a.jsx("span",{children:Kx(G.durationMs)}),G.tokens!=null&&a.jsxs("span",{children:[G.tokens>=1e3?`${(G.tokens/1e3).toFixed(1)}k`:G.tokens," tok"]})]}),a.jsx("div",{className:"space-y-1",children:G.assertions.map(J=>a.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[a.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:J.pass?"var(--green)":"var(--red)"},children:a.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:J.pass?a.jsx("polyline",{points:"20 6 9 17 4 12"}):a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:J.text}),J.reasoning&&a.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:J.reasoning})]})]},J.id))})]},q))})})]},g.id)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function sy(){const{state:r,dispatch:c}=tl(),{plugin:o,skill:u}=r,[x,v]=m.useState("timeline"),[p,b]=m.useState([]),[y,f]=m.useState(!0),[S,g]=m.useState(""),[C,w]=m.useState(""),[O,L]=m.useState(!1),[G,q]=m.useState([]),[J,ee]=m.useState(null),[K,P]=m.useState(!1),[re,X]=m.useState(null),[te,Q]=m.useState(!1);m.useEffect(()=>{f(!0),be.getHistory(o,u,{model:S||void 0,type:C||void 0}).then(_=>{b(_),_.length>=2&&be.compareRuns(o,u,_[0].timestamp,_[1].timestamp).then(le=>{const I=le.regressions.filter(E=>E.change==="regression");c({type:"SET_REGRESSIONS",regressions:I})}).catch(()=>{})}).catch(()=>{}).finally(()=>f(!1))},[o,u,S,C]);const F=m.useCallback(async _=>{if(O){q(le=>le.includes(_)?le.filter(I=>I!==_):le.length>=2?[le[1],_]:[...le,_]);return}Q(!0);try{const le=await be.getHistoryEntry(o,u,_);X(le)}catch{}finally{Q(!1)}},[o,u,O]),pe=m.useCallback(async()=>{if(G.length===2){P(!0);try{const _=await be.compareRuns(o,u,G[0],G[1]);ee(_)}catch{}finally{P(!1)}}},[o,u,G]),ie=[...new Set(p.map(_=>_.model))];return y?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"skeleton h-12 rounded-lg"}),a.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(_=>a.jsx("button",{onClick:()=>v(_),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:x===_?"var(--accent-muted)":"transparent",color:x===_?"var(--accent)":"var(--text-tertiary)"},children:_==="timeline"?"Timeline":_==="per-eval"?"Per Eval":"Statistics"},_))}),x==="timeline"&&a.jsxs("div",{children:[p.length>0&&a.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:a.jsx(Iv,{entries:p,onPointClick:_=>F(_.timestamp)})}),a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("select",{value:S,onChange:_=>g(_.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Models"}),ie.map(_=>a.jsx("option",{value:_,children:_},_))]}),a.jsxs("select",{value:C,onChange:_=>w(_.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Types"}),a.jsx("option",{value:"benchmark",children:"Benchmark"}),a.jsx("option",{value:"comparison",children:"Comparison"}),a.jsx("option",{value:"baseline",children:"Baseline"}),a.jsx("option",{value:"model-compare",children:"Model Compare"}),a.jsx("option",{value:"improve",children:"AI Improve"}),a.jsx("option",{value:"instruct",children:"AI Edit"}),a.jsx("option",{value:"ai-generate",children:"AI Generate"}),a.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{L(!O),q([]),ee(null)},className:`btn text-[12px] ${O?"btn-primary":"btn-secondary"}`,children:O?"Exit Compare":"Compare Runs"}),O&&G.length===2&&a.jsx("button",{onClick:pe,disabled:K,className:"btn btn-primary text-[12px]",children:K?"Comparing...":"Compare"})]}),a.jsx("div",{className:"space-y-2",children:p.length===0?a.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):p.map(_=>{const le=G.includes(_.timestamp);return a.jsx("button",{onClick:()=>F(_.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:le?"var(--accent-muted)":"var(--surface-1)",border:le?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:I=>{le||(I.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:I=>{le||(I.currentTarget.style.borderColor="var(--border-subtle)")},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[O&&a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:le?"var(--accent)":"var(--border-default)",background:le?"var(--accent)":"transparent"},children:le&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(_.timestamp).toLocaleString()}),a.jsx("span",{className:"pill text-[9px]",style:{background:_.type==="comparison"?"var(--purple-muted)":_.type==="baseline"?"var(--surface-3)":_.type==="model-compare"?"rgba(56,189,248,0.15)":_.type==="improve"||_.type==="instruct"?"rgba(168,85,247,0.15)":_.type==="ai-generate"?"rgba(34,197,94,0.15)":_.type==="eval-generate"?"rgba(251,146,60,0.15)":"var(--accent-muted)",color:_.type==="comparison"?"var(--purple)":_.type==="baseline"?"var(--text-tertiary)":_.type==="model-compare"?"#38bdf8":_.type==="improve"||_.type==="instruct"?"#a855f7":_.type==="ai-generate"?"#22c55e":_.type==="eval-generate"?"#fb923c":"var(--accent)"},children:_.type==="model-compare"?"model compare":_.type==="improve"?"ai improve":_.type==="instruct"?"ai edit":_.type==="ai-generate"?"ai generate":_.type==="eval-generate"?"eval generate":_.type})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:_.model}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:_.passRate>=.8?"var(--green)":_.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(_.passRate*100),"%"]})]})]})},_.timestamp)})}),J&&a.jsx(ry,{result:J}),re&&!O&&a.jsx(iy,{run:re,onClose:()=>X(null)})]}),x==="per-eval"&&a.jsx(ny,{plugin:o,skill:u}),x==="statistics"&&a.jsx(ay,{plugin:o,skill:u})]})}function ry({result:r}){const c=r.regressions.filter(u=>u.change==="regression"),o=r.regressions.filter(u=>u.change==="improvement");return a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(r.runA.timestamp).toLocaleDateString()," vs ",new Date(r.runB.timestamp).toLocaleDateString()]}),c.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",c.length,")"]}),c.map(u=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",u.evalId," ",u.evalName,": ",a.jsx("span",{style:{color:"var(--red)"},children:u.assertionId})," (was passing, now failing)"]},`${u.evalId}-${u.assertionId}`))]}),o.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",o.length,")"]}),o.map(u=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",u.evalId," ",u.evalName,": ",a.jsx("span",{style:{color:"var(--green)"},children:u.assertionId})," (was failing, now passing)"]},`${u.evalId}-${u.assertionId}`))]}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),a.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:a.jsxs("table",{className:"w-full text-[12px]",children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"var(--surface-2)"},children:[a.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),a.jsx("tbody",{children:r.caseDiffs.map(u=>a.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",u.eval_id," ",u.eval_name]}),a.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}),a.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 iy({run:r,onClose:c}){return(r.type==="improve"||r.type==="instruct")&&r.improve?a.jsx(oy,{run:r,onClose:c}):a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(r.timestamp).toLocaleString()]}),a.jsx("button",{onClick:c,className:"btn btn-ghost text-[11px]",children:"Close"})]}),a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",r.model," | Cases: ",r.cases.length," | Pass Rate: ",r.overall_pass_rate!=null?`${Math.round(r.overall_pass_rate*100)}%`:"--"]}),a.jsx("div",{className:"space-y-2",children:r.cases.map(o=>a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:o.status==="pass"?"var(--green)":"var(--red)"},children:o.pass_rate!=null?`${Math.round(o.pass_rate*100)}%`:o.status})]})},o.eval_id))})]})}function oy({run:r,onClose:c}){var v;const o=m.useMemo(()=>r.improve?kr(r.improve.original,r.improve.improved):[],[r.improve]),u=m.useMemo(()=>{const p=o.filter(y=>y.type==="added").length,b=o.filter(y=>y.type==="removed").length;return{added:p,removed:b}},[o]),x=m.useMemo(()=>{let p=0,b=0;return o.map(y=>y.type==="removed"?(p++,{...y,origNum:p,newNum:null}):y.type==="added"?(b++,{...y,origNum:null,newNum:b}):(p++,b++,{...y,origNum:p,newNum:b}))},[o]);return a.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),a.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(r.timestamp).toLocaleString()," · ",r.model]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{style:{color:"var(--green)"},children:["+",u.added]}),a.jsxs("span",{style:{color:"var(--red)"},children:["-",u.removed]})]}),a.jsx("button",{onClick:c,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:p=>{p.currentTarget.style.background="var(--surface-3)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((v=r.improve)==null?void 0:v.reasoning)&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),r.improve.reasoning]}),a.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:x.map((p,b)=>a.jsxs("tr",{style:{background:p.type==="added"?"rgba(34,197,94,0.08)":p.type==="removed"?"rgba(239,68,68,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="removed"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:p.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.origNum??""}),a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="added"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:p.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.newNum??""}),a.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"transparent",borderRight:p.type==="added"?"2px solid var(--green)":p.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:p.type==="added"?"+":p.type==="removed"?"-":" "}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"var(--text-secondary)"},children:p.content||""})]},b))})})})]})}function cy({plugin:r,skill:c}){const[o,u]=m.useState([]),[x,v]=m.useState([]),[p,b]=m.useState(!0),[y,f]=m.useState(null);m.useEffect(()=>{be.getDependencies(r,c).then(g=>{u(g.mcpDependencies),v(g.skillDependencies)}).catch(()=>{}).finally(()=>b(!1))},[r,c]);async function S(g,C){try{await navigator.clipboard.writeText(C),f(g),setTimeout(()=>f(null),2e3)}catch{}}return p?null:o.length===0&&x.length===0?a.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"}):a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.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:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.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"}),a.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"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:o.length+x.length})]}),a.jsxs("div",{className:"px-5 py-4",children:[o.length>0&&a.jsxs("div",{className:"space-y-3 mb-4",children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),o.map(g=>a.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:g.server}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.transport})]}),a.jsx("button",{onClick:()=>S(g.server,g.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:y===g.server?"var(--green)":"var(--accent)"},children:y===g.server?a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.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"]})})]}),a.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:g.url}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.matchedTools.map(C=>a.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:C},C))})]},g.server))]}),x.length>0&&a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),a.jsx("div",{className:"space-y-1.5",children:x.map(g=>a.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:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:g.name}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.source==="frontmatter"?"frontmatter":"referenced"})]},g.name))})]})]})]})}function Lx({plugin:r,skill:c}){const[o,u]=m.useState([]),[x,v]=m.useState(!0),[p,b]=m.useState(null),[y,f]=m.useState(""),[S,g]=m.useState(!1),[C,w]=m.useState(null),[O,L]=m.useState(""),[G,q]=m.useState(""),[J,ee]=m.useState(!1),[K,P]=m.useState(new Set),re=m.useCallback(async()=>{v(!0);try{const[F,pe]=await Promise.all([be.getCredentials(r,c).catch(()=>({credentials:[]})),be.getParams(r,c).catch(()=>({params:[]}))]),ie=new Map(pe.params.map(I=>[I.name,I])),_=new Set,le=[];for(const I of F.credentials){_.add(I.name);const E=ie.get(I.name);le.push({name:I.name,status:I.status==="ready"||I.status==="resolved"?"ready":"missing",source:I.source,maskedValue:E==null?void 0:E.maskedValue})}for(const I of pe.params)_.has(I.name)||le.push({name:I.name,status:I.status,maskedValue:I.maskedValue});u(le)}finally{v(!1)}},[r,c]);m.useEffect(()=>{re()},[re]);const X=m.useCallback(async F=>{if(K.has(F)){P(pe=>{const ie=new Set(pe);return ie.delete(F),ie}),u(pe=>pe.map(ie=>ie.name===F?{...ie,revealedValue:void 0}:ie));return}try{const ie=(await be.getParamsRevealed(r,c,F)).params.find(_=>_.name===F);ie&&(u(_=>_.map(le=>le.name===F?{...le,revealedValue:ie.value}:le)),P(_=>new Set(_).add(F)))}catch{}},[r,c,K]),te=async(F,pe)=>{if(!(!F.trim()||!pe.trim())){g(!0),w(null);try{await be.setCredential(r,c,F,pe),b(null),f(""),P(new Set),re()}catch(ie){w(ie.message)}finally{g(!1)}}},Q=async()=>{if(!(!O.trim()||!G.trim())){g(!0),w(null);try{await be.setCredential(r,c,O.trim().toUpperCase(),G),L(""),q(""),ee(!1),re()}catch(F){w(F.message)}finally{g(!1)}}};return x?a.jsxs("div",{className:"mt-6",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):a.jsxs("div",{className:"mt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("button",{onClick:()=>ee(!J),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),C&&a.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--error-muted, #3f1a1a)",color:"var(--error, #f87171)"},children:C}),o.length===0&&!J?a.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"}):a.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:o.map(F=>a.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:[a.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:F.name}),F.maskedValue&&a.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:K.has(F.name)&&F.revealedValue!=null?F.revealedValue:F.maskedValue}),F.maskedValue&&a.jsx("button",{onClick:()=>X(F.name),className:"btn btn-ghost px-1",title:K.has(F.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:K.has(F.name)?a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.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"}),a.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"}),a.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),a.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:F.status==="ready"?"rgba(52,211,153,0.15)":"rgba(251,146,60,0.15)",color:F.status==="ready"?"var(--green)":"#fb923c"},children:F.status==="ready"?"ready":"missing"}),F.source&&a.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:F.source}),p===F.name?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{value:y,onChange:pe=>f(pe.target.value),onKeyDown:pe=>{pe.key==="Enter"&&te(F.name,y)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),a.jsx("button",{onClick:()=>te(F.name,y),disabled:S||!y.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:S?"...":"Save"}),a.jsx("button",{onClick:()=>{b(null),f("")},className:"btn btn-ghost text-[10px] px-1",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):a.jsx("button",{onClick:()=>{b(F.name),f("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},F.name))}),J&&a.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:O,onChange:F=>L(F.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),a.jsx("input",{value:G,onChange:F=>q(F.target.value),onKeyDown:F=>{F.key==="Enter"&&Q()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),a.jsxs("div",{className:"flex justify-end gap-1.5",children:[a.jsx("button",{onClick:()=>{ee(!1),L(""),q("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),a.jsx("button",{onClick:Q,disabled:S||!O.trim()||!G.trim(),className:"btn btn-primary text-[10px]",children:S?"Saving...":"Save"})]})]})]})}function uy(){const{state:r}=tl(),{plugin:c,skill:o}=r,[u,x]=m.useState(null),[v,p]=m.useState(!0);return m.useEffect(()=>{be.getDependencies(c,o).then(x).catch(()=>{}).finally(()=>p(!1))},[c,o]),v?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):u?a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx(cy,{plugin:c,skill:o}),a.jsx(Lx,{plugin:c,skill:o})]}):a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),a.jsx(Lx,{plugin:c,skill:o})]})}function Wx({data:r}){if(r.length<2)return a.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const c=r.slice(-10),o=80,u=24,x=2,v=o-x*2,p=u-x*2,b=c.length,y=Math.min(...c),S=Math.max(...c)-y||1,g=c.map((O,L)=>{const G=x+L/(b-1)*v,q=x+p-(O-y)/S*p;return`${G.toFixed(1)},${q.toFixed(1)}`}),C=c[c.length-1],w=dn(C);return a.jsxs("svg",{width:o,height:u,viewBox:`0 0 ${o} ${u}`,style:{display:"block"},children:[a.jsx("polyline",{points:g.join(" "),fill:"none",stroke:w,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[O,L]=g[g.length-1].split(",");return a.jsx("circle",{cx:O,cy:L,r:2.5,fill:w})})()]})}function dy(){return a.jsxs("span",{className:"pill",style:{background:"rgba(251,191,36,0.15)",color:"#fbbf24",fontSize:9,fontWeight:700,gap:3},children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"#fbbf24",stroke:"none",children:a.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 fy({pct:r}){const c=r>=10?"var(--green)":r>=0?"var(--yellow)":"var(--red)",o=r>=10?"var(--green-muted)":r>=0?"var(--yellow-muted)":"var(--red-muted)",u=r>=0?"+":"";return a.jsxs("span",{className:"pill",style:{background:o,color:c,fontSize:10,fontWeight:600},children:[u,r.toFixed(1),"%"]})}function xy({score:r,rating:c}){const o={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=o[c]??o.minimal,x=r>=0?"+":"";return a.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),a.jsxs("span",{className:"pill",style:{background:u.bg,color:u.fg,fontSize:11,fontWeight:600},children:[x,r.toFixed(1),"% (",c.toUpperCase(),")"]})]})}function py({warning:r}){return a.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:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.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"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:r})]})}function my({active:r,onChange:c,hasBaseline:o}){return a.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[a.jsx("button",{onClick:()=>c("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:r==="rankings"?"var(--surface-3)":"transparent",color:r==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),a.jsx("button",{onClick:()=>c("amplification"),disabled:!o,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:r==="amplification"?"var(--surface-3)":"transparent",color:o&&r==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:o?1:.5,cursor:o?"pointer":"not-allowed"},title:o?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function hy(r){var u,x,v;if(r.length===0)return[];const c=new Map;for(const p of r)for(const b of p.models){if(b.status==="error")continue;const y=`${b.provider}/${b.model}`;c.has(y)||c.set(y,{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=c.get(y);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 o=[];for(const[p,b]of c){const[y,...f]=p.split("/");o.push({rank:0,model:f.join("/"),provider:y,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 o.sort((p,b)=>{const y=p.compositeScore??p.passRate;return(b.compositeScore??b.passRate)-y}),o.forEach((p,b)=>{p.rank=b+1}),o.length>0&&(o[0].isBest=!0),o}const Fx=(r="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:r,whiteSpace:"nowrap"});function vy({entries:r}){return a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(c=>a.jsx("th",{style:Fx(c==="#"?"center":"left"),children:c},c))})}),a.jsx("tbody",{children:r.map(c=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:o=>{o.currentTarget.style.background="var(--surface-2)"},onMouseLeave:o=>{o.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:c.rank}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:c.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:c.provider}),c.isBest&&a.jsx(dy,{})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:c.passRate>=.7?"var(--green-muted)":c.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:dn(c.passRate),fontSize:11,fontWeight:600},children:[Math.round(c.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:c.rubricScore!=null?c.rubricScore.toFixed(1):"--"}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:c.duration<1e3?`${Math.round(c.duration)}ms`:`${(c.duration/1e3).toFixed(1)}s`}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:c.cost!=null?`$${c.cost.toFixed(4)}`:"N/A"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(Wx,{data:c.sparklineData})})]},`${c.provider}/${c.model}`))})]})})}function yy({entries:r}){const c=[...r].filter(o=>o.hasBaseline).sort((o,u)=>(u.amplificationPct??0)-(o.amplificationPct??0));return c.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-center",children:a.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",a.jsx("code",{children:"--baseline"})," flag."]})})}):a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(o=>a.jsx("th",{style:Fx(o==="#"?"center":"left"),children:o},o))})}),a.jsx("tbody",{children:c.map((o,u)=>a.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:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:u+1}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:o.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:o.provider})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:o.passRate>=.7?"var(--green-muted)":o.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:dn(o.passRate),fontSize:11,fontWeight:600},children:[Math.round(o.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px"},children:o.baselinePassRate!=null?a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(o.baselinePassRate*100),"%"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:o.skillDelta!=null?a.jsxs("span",{className:"text-[11px] font-medium",style:{color:o.skillDelta>=0?"var(--green)":"var(--red)"},children:[o.skillDelta>=0?"+":"",(o.skillDelta*100).toFixed(1),"pp"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:o.amplificationPct!=null&&isFinite(o.amplificationPct)?a.jsx(fy,{pct:o.amplificationPct}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(Wx,{data:o.sparklineData})})]},`${o.provider}/${o.model}`))})]})})}function gy(){const{state:r}=tl(),{plugin:c,skill:o}=r,[u,x]=m.useState([]),[v,p]=m.useState(!0),[b,y]=m.useState(null),[f,S]=m.useState("rankings");m.useEffect(()=>{p(!0),y(null),S("rankings"),be.getLeaderboard(c,o).then(L=>x(L.entries)).catch(L=>y(L instanceof Error?L.message:String(L))).finally(()=>p(!1))},[c,o]);const g=m.useMemo(()=>hy(u),[u]),C=g.some(L=>L.hasBaseline),w=u[0],O=w==null?void 0:w.judgeBiasWarning;return v?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"spinner spinner-lg"})}):b?a.jsx("div",{className:"flex items-center justify-center h-full px-8",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Failed to load leaderboard"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:b})]})}):g.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),a.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),a.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"'}),a.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",a.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),a.jsx(my,{active:f,onChange:S,hasBaseline:C})]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[u.length," sweep",u.length!==1?"s":""," · ",g.length," model",g.length!==1?"s":""]})]}),O&&a.jsx(py,{warning:O}),f==="rankings"?a.jsx(vy,{entries:g}):a.jsx(yy,{entries:g}),f==="amplification"&&(w==null?void 0:w.skillQualityScore)!=null&&(w==null?void 0:w.skillQualityRating)&&a.jsx(xy,{score:w.skillQualityScore,rating:w.skillQualityRating})]})}const by=["editor","tests","run","activation","history","leaderboard","deps"];function jy(r){return r!=null&&by.includes(r)}function Sy(){const{state:r,dispatch:c,saveContent:o,isReadOnly:u}=tl(),{refreshSkills:x,clearSelection:v}=na(),p=m.useCallback(async()=>{try{await be.deleteSkill(r.plugin,r.skill),x(),v()}catch(f){const S=f instanceof Error?f.message:String(f);c({type:"SET_ERROR",error:`Failed to delete skill: ${S}`})}},[r.plugin,r.skill,x,v,c]);m.useEffect(()=>{const S=new URLSearchParams(window.location.search).get("panel");jy(S)&&S!==r.activePanel&&c({type:"SET_PANEL",panel:S})},[]),m.useEffect(()=>{const f=new URLSearchParams(window.location.search);f.set("panel",r.activePanel);const S=`${window.location.pathname}?${f.toString()}${window.location.hash}`;history.replaceState(null,"",S)},[r.activePanel]);const b=m.useCallback(f=>{const S=f.ctrlKey||f.metaKey;if(S&&f.key>="1"&&f.key<="7"){f.preventDefault(),c({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps"][parseInt(f.key)-1]});return}if(S&&f.key==="s"&&!f.shiftKey){f.preventDefault(),r.isDirty&&o();return}},[r.isDirty,o,c]);if(m.useEffect(()=>(window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)),[b]),r.loading)return a.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"spinner spinner-lg"}),a.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const y=Array.from(r.caseRunStates.values()).some(f=>f.status==="running"||f.status==="queued");return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[a.jsx(Wh,{state:r,isReadOnly:u,onDelete:u?void 0:p}),r.error&&a.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx(ss,{error:av(r.error),onDismiss:()=>c({type:"SET_ERROR",error:null})})}),a.jsx(tv,{activePanel:r.activePanel,onPanelChange:f=>c({type:"SET_PANEL",panel:f}),isDirty:r.isDirty,isRunning:y,hasRegressions:r.regressions.length>0,isActivationRunning:r.activationRunning}),a.jsx(lv,{children:a.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[r.activePanel==="editor"&&a.jsx(wv,{}),r.activePanel==="tests"&&a.jsx(zv,{}),r.activePanel==="run"&&a.jsx(Vv,{}),r.activePanel==="activation"&&a.jsx(Xv,{}),r.activePanel==="history"&&a.jsx(sy,{}),r.activePanel==="leaderboard"&&a.jsx(gy,{}),r.activePanel==="deps"&&a.jsx(uy,{})]},r.activePanel)})},`${r.plugin}/${r.skill}`)]})}function rc(r,c=!0){let o=r.toLowerCase().replace(/[^a-z0-9]+/g,"-");return c&&(o=o.replace(/^-+|-+$/g,"")),o}function Ny(r,c,o,u){const v=`.../${r.split("/").slice(-2).join("/")}`;switch(c){case 1:return`${v}/${o}/skills/${u}/SKILL.md`;case 2:return`${v}/plugins/${o}/skills/${u}/SKILL.md`;case 3:return`${v}/skills/${u}/SKILL.md`}}function Ey({onCreated:r,resolveAiConfigOverride:c}){const[o,u]=m.useState("ai"),[x,v]=m.useState(null),[p,b]=m.useState(!0),{config:y}=Na(),[f,S]=m.useState(""),[g,C]=m.useState(3),[w,O]=m.useState(""),[L,G]=m.useState(""),[q,J]=m.useState(""),[ee,K]=m.useState(""),[P,re]=m.useState(""),[X,te]=m.useState(""),[Q,F]=m.useState("write"),[pe,ie]=m.useState(!1),[_,le]=m.useState(null),[I,E]=m.useState(""),[M,ae]=m.useState(!1),[B,de]=m.useState(!1),[j,D]=m.useState(null),[W,ne]=m.useState(null),[ue,fe]=m.useState([]),ve=m.useRef(null),Be=m.useRef(null),Re=m.useRef(null),pt=m.useRef(null),[Lt,Z]=m.useState(!1),[oe,se]=m.useState(!1);m.useEffect(()=>{be.getProjectLayout().then($=>{v($),C($.suggestedLayout);const ze=$.detectedLayouts.find(at=>at.layout===$.suggestedLayout);ze!=null&&ze.existingPlugins.length&&O(ze.existingPlugins[0])}).catch(()=>{}).finally(()=>b(!1))},[]),m.useEffect(()=>{var $;o==="ai"&&(($=ve.current)==null||$.focus())},[o]),m.useEffect(()=>()=>{var $;($=Be.current)==null||$.abort()},[]);const me=m.useMemo(()=>{var $;return x?(($=x.detectedLayouts.find(ze=>ze.layout===g))==null?void 0:$.existingPlugins)||[]:[]},[x,g]),ge=w==="__new__"?L:w,Ye=x?Ny(x.root,g,ge||"{plugin}",f||"{skill}"):"",ut=m.useMemo(()=>x?x.detectedLayouts.filter($=>$.layout!==4):[],[x]),Xe=m.useMemo(()=>{if(!x)return null;const $=x.detectedLayouts.find(Je=>Je.layout===2&&Je.existingPlugins.length>0),ze=x.detectedLayouts.find(Je=>Je.layout===1&&Je.existingPlugins.length>0),at=$||ze;return at?{layout:at.layout,plugins:at.existingPlugins}:null},[x]),Dt=m.useCallback(()=>{if(c)return c();if(!y)return{provider:"claude-cli",model:"sonnet"};const $=y.provider||"claude-cli";let ze=y.model||"sonnet";return $==="claude-cli"&&ze.startsWith("claude-")&&(ze=ze.replace("claude-","")),{provider:$,model:ze}},[y,c]),mt=m.useCallback(()=>{var $;($=Be.current)==null||$.abort(),ae(!1)},[]),ll=m.useCallback(()=>{D(null),ne(null)},[]),Qt=m.useCallback(async()=>{if(D(null),ne(null),fe([]),Re.current=null,!I.trim()){D("Describe what your skill should do");return}ae(!0);const $=new AbortController;Be.current=$;const{provider:ze,model:at}=Dt();try{const Je=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:I.trim(),provider:ze,model:at}),signal:$.signal});if(!Je.ok||!Je.body){let Fe=`HTTP ${Je.status}`;try{const nt=await Je.json();nt.error&&(Fe=nt.error)}catch{}throw new Error(Fe)}const Rl=Je.body.getReader(),Ot=new TextDecoder;let sa="",kt="";for(;;){const{done:Fe,value:nt}=await Rl.read();if(Fe)break;sa+=Ot.decode(nt,{stream:!0});const et=sa.split(`
|
|
68
|
-
`);sa=et.pop()||"";for(const al of et)if(al.startsWith("event: "))kt=al.slice(7).trim();else if(al.startsWith("data: ")){try{const Qe=JSON.parse(al.slice(6));if(kt==="progress")fe(nl=>[...nl,{phase:Qe.phase,message:Qe.message,timestamp:Date.now()}]);else if(kt==="done"||kt==="complete"){const nl={prompt:I.trim(),provider:Dt().provider,model:Dt().model,reasoning:Qe.reasoning||""};if(S(Qe.name),J(Qe.description),K(Qe.model||""),re(Qe.allowedTools||""),te(Qe.body),de(!0),Re.current=nl,u("manual"),Qe.suggestedPlugin&&typeof Qe.suggestedPlugin=="object"&&Qe.suggestedPlugin.plugin){const Ve=Qe.suggestedPlugin;if(((x==null?void 0:x.detectedLayouts.flatMap(Ct=>Ct.existingPlugins))??[]).includes(Ve.plugin))if(O(Ve.plugin),Ve.layout&&(Ve.layout===1||Ve.layout===2))C(Ve.layout);else{const Ct=x==null?void 0:x.detectedLayouts.find(Ea=>Ea.existingPlugins.includes(Ve.plugin));Ct&&(Ct.layout===1||Ct.layout===2)&&C(Ct.layout)}else O("__new__"),G(Ve.plugin)}else g===3&&Xe&&se(!0);const st={name:Qe.name,plugin:ge||"",layout:g,description:Qe.description,model:Qe.model||void 0,allowedTools:Qe.allowedTools||void 0,body:Qe.body,aiMeta:nl};be.saveDraft(st).then(Ve=>{Z(!0),Ve!=null&&Ve.dir&&(pt.current=Ve.dir)}).catch(()=>{})}else kt==="error"&&(D(Qe.message||Qe.description||"Unknown error"),Qe.category&&ne(Qe))}catch{}kt=""}}}catch(Je){Je.name!=="AbortError"&&D(Je.message)}finally{ae(!1),
|
|
67
|
+
!Write me a poem about flowers`}),a.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:"One prompt per line"}),a.jsx(jr,{}),a.jsx("span",{children:"No prefix = auto-classify"}),a.jsx(jr,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),a.jsx(jr,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),a.jsx(jr,{}),a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[Q," prompt",Q!==1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:X,disabled:S||!q.trim(),className:"btn btn-primary",children:S?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"#fff",borderColor:"rgba(255,255,255,0.2)",width:14,height:14}}),"Testing..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"6"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),S&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:u,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[w||`${y.length} / ${Q} prompts tested`,C&&a.jsx(Jv,{startedAt:C})]})]})]})]}),a.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[a.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),a.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:ie?a.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:le}}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),g&&a.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:g}),S&&y.length===0&&a.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[a.jsx("div",{className:"spinner-lg mx-auto mb-4"}),a.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),y.length>0&&a.jsxs("div",{className:"space-y-5",children:[pe.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),a.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",pe.length,")"]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:pe.map((I,E)=>a.jsx(_x,{result:I},`incorrect-${E}`))})]}),F.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"16 10 11 15 8 12"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",F.length,")"]})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:F.map((I,E)=>a.jsx(_x,{result:I},`correct-${E}`))})]})]}),f&&a.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[a.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&&a.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"]}),a.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[a.jsx(Wo,{label:"Precision",value:f.precision,description:"Of all activations, how many were correct?",detail:`${f.tp} true / ${f.tp+f.fp} total activations`}),a.jsx(Wo,{label:"Recall",value:f.recall,description:"Of expected activations, how many fired?",detail:`${f.tp} activated / ${f.tp+f.fn} expected`}),a.jsx(Wo,{label:"Reliability",value:f.reliability,description:"Overall correct classification rate",detail:`${f.tp+f.tn} correct / ${f.total} total`})]}),a.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[a.jsx(Sr,{label:"True Positive",abbr:"TP",count:f.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),a.jsx(Sr,{label:"False Positive",abbr:"FP",count:f.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),a.jsx(Sr,{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"}),a.jsx(Sr,{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"})]})]})]}),a.jsx(Kv,{history:G,expanded:P,onToggle:()=>re(!P)})]})}function Kv({history:r,expanded:c,onToggle:o}){return r===null?null:a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:c?"1px solid var(--border-subtle)":"none"},onClick:o,children:[a.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",r.length>0&&a.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",r.length," run",r.length!==1?"s":"",")"]})]}),a.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:c?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),c&&a.jsx("div",{className:"px-4 py-3",children:r.length===0?a.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):a.jsx("div",{className:"space-y-2",children:r.map(u=>a.jsx($v,{run:u},u.id))})})]})}function $v({run:r}){const c=Math.round(r.summary.reliability*100),o=c>=80?"var(--green)":c>=60?"var(--yellow)":"var(--red)",u=c>=80?"Good":c>=60?"Needs Work":"Poor",x=o;return a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Zv(r.timestamp)}),a.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:r.model||r.provider}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[r.promptCount," prompts"]})]})}),a.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:o,fontVariantNumeric:"tabular-nums"},children:[c,"%"]}),a.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 Zv(r){const c=Date.now(),o=new Date(r).getTime(),u=Math.floor((c-o)/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 p=Math.floor(v/24);return p<7?`${p}d ago`:new Date(r).toLocaleDateString()}function jr(){return a.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function _x({result:r}){const c=Rx[r.classification]||Rx.FN,o=r.classification==="TP"||r.classification==="TN";return a.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:c.bg,border:"1px solid transparent"},children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${c.text} 20%, transparent)`},children:o?a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:c.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:c.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1",children:a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:r.prompt})}),a.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[a.jsx("span",{className:"pill",style:{background:"rgba(0,0,0,0.1)",color:c.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:r.classification}),a.jsx("span",{style:{color:r.activate?"var(--green)":"var(--text-tertiary)"},children:r.activate?"Activated":"Silent"}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",r.expected==="should_activate"?"activate":"stay silent"]}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[r.confidence," confidence"]}),r.autoClassified&&a.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"})]}),r.reasoning&&a.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:r.reasoning})]})]})}function Wo({label:r,value:c,description:o,detail:u}){const x=Math.round(c*100),v=x>=80?"var(--green)":x>=60?"var(--yellow)":"var(--red)";return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:v},children:[x,"%"]}),a.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:r}),a.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:o}),a.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:u})]})}function Sr({abbr:r,count:c,bg:o,color:u,description:x}){return a.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:o},children:[a.jsx("div",{className:"text-[20px] font-bold",style:{color:u},children:c}),a.jsx("div",{className:"text-[11px] font-semibold",style:{color:u},children:r}),a.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:x})]})}function Jv({startedAt:r}){const[c,o]=m.useState(0);return m.useEffect(()=>{const u=setInterval(()=>o(Math.floor((Date.now()-r)/1e3)),1e3);return()=>clearInterval(u)},[r]),a.jsxs("span",{className:"ml-2",children:["(",c,"s)"]})}const Fo={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Mx={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},nc=600,sc=180,Nt=40,Io=nc-Nt*2,la=sc-Nt*2,Wv=[25,50,75,100];function zx(r){return new Date(r).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Fv(r){return r==null?"--":`${(r/1e3).toFixed(1)}s`}function Iv({entries:r,onPointClick:c}){const[o,u]=m.useState(null),x=m.useMemo(()=>[...r].reverse(),[r]);if(x.length<2)return null;const v=x.length,p=x.map((f,S)=>{const g=Nt+S/(v-1)*Io,C=f.passRate*100,w=Nt+la-C/100*la;return{x:g,y:w,pct:C,entry:f}}),b=p.map(f=>`${f.x},${f.y}`).join(" "),y=Array.from(new Set(x.map(f=>f.type)));return a.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:v>=20?"auto":void 0},children:[a.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),a.jsx("div",{className:"flex items-center gap-5 mb-3",children:y.map(f=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Fo[f]??"var(--text-tertiary)"}}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Mx[f]??f})]},f))}),a.jsxs("svg",{width:nc,height:sc,viewBox:`0 0 ${nc} ${sc}`,style:{display:"block",overflow:"visible"},children:[Wv.map(f=>{const S=Nt+la-f/100*la;return a.jsxs("g",{children:[a.jsx("line",{x1:Nt,y1:S,x2:Nt+Io,y2:S,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),a.jsxs("text",{x:Nt-8,y:S+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[f,"%"]})]},f)}),a.jsx("line",{x1:Nt,y1:Nt+la,x2:Nt+Io,y2:Nt+la,stroke:"var(--border-subtle)",strokeWidth:1}),a.jsx("text",{x:Nt-8,y:Nt+la+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),a.jsx("polyline",{points:b,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),p.map((f,S)=>a.jsx("circle",{cx:f.x,cy:f.y,r:5,fill:Fo[f.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:g=>{g.currentTarget.setAttribute("r","7"),u({x:f.x,y:f.y,entry:f.entry})},onMouseLeave:g=>{g.currentTarget.setAttribute("r","5"),u(null)},onClick:()=>c==null?void 0:c(f.entry)},S)),Pv(v).map(f=>a.jsx("text",{x:p[f].x,y:Nt+la+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:zx(x[f].timestamp)},f))]}),o&&a.jsxs("div",{style:{position:"absolute",left:o.x,top:o.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:[a.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:zx(o.entry.timestamp)}),a.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:o.entry.model}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:Fo[o.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Mx[o.entry.type]??o.entry.type}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(o.entry.passRate*100),"%"]})]}),a.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:Fv(o.entry.totalDurationMs)}),a.jsx("span",{children:o.entry.totalTokens!=null?`${o.entry.totalTokens} tokens`:"--"})]})]})]})}function Pv(r){if(r<=3)return Array.from({length:r},(u,x)=>x);if(r<=6)return[0,Math.floor(r/2),r-1];if(r<20)return[0,Math.floor(r/3),Math.floor(2*r/3),r-1];const c=Math.ceil(r/10),o=[0];for(let u=c;u<r-1;u+=c)o.push(u);return o.push(r-1),o}function Nr(r){return r>=.8?"var(--green)":r>=.5?"var(--yellow)":"var(--red)"}function ey(r){return r>=1e3?`${(r/1e3).toFixed(1)}s`:`${Math.round(r)}ms`}function ty({rate:r,label:c}){const o=Math.round(r*100);return a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:c}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:Nr(r)},children:[o,"%"]})]}),a.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${o}%`,background:Nr(r)}})})]})})}function ly({points:r}){if(r.length<2)return null;const c=200,o=48,u=4,x=r.length,v=r.map((y,f)=>{const S=u+f/(x-1)*(c-u*2),g=u+(o-u*2)-y.passRate*(o-u*2);return{x:S,y:g}}),p=`M ${v[0].x},${o-u} `+v.map(y=>`L ${y.x},${y.y}`).join(" ")+` L ${v[v.length-1].x},${o-u} Z`,b=v.map((y,f)=>`${f===0?"M":"L"} ${y.x},${y.y}`).join(" ");return a.jsxs("svg",{width:c,height:o,style:{display:"block"},children:[a.jsx("path",{d:p,fill:"var(--accent-muted)"}),a.jsx("path",{d:b,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),a.jsx("circle",{cx:v[v.length-1].x,cy:v[v.length-1].y,r:3,fill:"var(--accent)"})]})}function ay({plugin:r,skill:c}){const[o,u]=m.useState(null),[x,v]=m.useState(!0);if(m.useEffect(()=>{v(!0),be.getStats(r,c).then(u).catch(()=>u(null)).finally(()=>v(!1))},[r,c]),x)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"skeleton h-24 rounded-xl"}),a.jsx("div",{className:"skeleton h-48 rounded-xl"}),a.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!o||o.totalRuns===0)return a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),a.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const p=o.trendPoints.length>0?o.trendPoints[o.trendPoints.length-1].passRate:0,b=o.trendPoints.length>0?o.trendPoints[0].passRate:0,y=p-b,f=o.assertionStats.slice(0,10);return a.jsxs("div",{className:"space-y-4 stagger-children",children:[a.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:o.totalRuns})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:Nr(p)},children:[Math.round(p*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:y>=0?"var(--green)":"var(--red)"},children:[y>=0?"+":"",Math.round(y*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:o.modelStats.length})]})]}),o.trendPoints.length>=2&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),a.jsx(ly,{points:o.trendPoints})]}),o.modelStats.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"})]})}),a.jsx("tbody",{children:o.modelStats.map(S=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:S.model}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:S.runs}),a.jsx("td",{style:{padding:"8px",textAlign:"center"},children:a.jsxs("span",{className:"font-semibold",style:{color:Nr(S.avgPassRate)},children:[Math.round(S.avgPassRate*100),"%"]})}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:ey(S.avgDurationMs)})]},S.model))})]})]}),f.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),a.jsx("div",{className:"space-y-3",children:f.map(S=>a.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--surface-2)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},onClick:()=>{},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.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:["#",S.evalId]}),a.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:S.evalName}),a.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[S.totalRuns," runs"]})]}),a.jsx(ty,{rate:S.passRate,label:S.text})]},`${S.evalId}:${S.id}`))})]})]})}function ny({plugin:r,skill:c}){const[o,u]=m.useState(null),[x,v]=m.useState(null),[p,b]=m.useState({}),[y,f]=m.useState({});m.useEffect(()=>{be.getEvals(r,c).then(u).catch(()=>u(null))},[r,c]);async function S(g){if(x===g){v(null);return}if(v(g),!p[g]){f(C=>({...C,[g]:!0}));try{const C=await be.getCaseHistory(r,c,g);b(w=>({...w,[g]:C}))}catch{b(C=>({...C,[g]:[]}))}finally{f(C=>({...C,[g]:!1}))}}}return o?a.jsx("div",{className:"space-y-2 stagger-children",children:o.evals.map(g=>{const C=p[g.id]||[],w=x===g.id,O=y[g.id],L=C.length>0?C[0].pass_rate:null;return a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{onClick:()=>S(g.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:w?"var(--surface-2)":"transparent"},onMouseEnter:G=>{w||(G.currentTarget.style.background="var(--surface-2)")},onMouseLeave:G=>{w||(G.currentTarget.style.background="transparent")},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:w?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),a.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:["#",g.id]}),a.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:g.name}),C.length>=2&&a.jsx($x,{entries:C}),L!=null&&a.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:dn(L)},children:[Math.round(L*100),"%"]}),C.length>0&&a.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[C.length," runs"]})]}),w&&a.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:O?a.jsxs("div",{className:"p-4 flex items-center gap-2",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):C.length===0?a.jsx("div",{className:"p-4",children:a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):a.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:C.map((G,q)=>a.jsxs("div",{className:"p-4",style:{background:q===0?"var(--surface-2)":"transparent"},children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:Xx(G.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:G.model}),a.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}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:dn(G.pass_rate)},children:[Math.round(G.pass_rate*100),"%"]})]}),a.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&&a.jsx("span",{children:Kx(G.durationMs)}),G.tokens!=null&&a.jsxs("span",{children:[G.tokens>=1e3?`${(G.tokens/1e3).toFixed(1)}k`:G.tokens," tok"]})]}),a.jsx("div",{className:"space-y-1",children:G.assertions.map(J=>a.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[a.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:J.pass?"var(--green)":"var(--red)"},children:a.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:J.pass?a.jsx("polyline",{points:"20 6 9 17 4 12"}):a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:J.text}),J.reasoning&&a.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:J.reasoning})]})]},J.id))})]},q))})})]},g.id)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function sy(){const{state:r,dispatch:c}=tl(),{plugin:o,skill:u}=r,[x,v]=m.useState("timeline"),[p,b]=m.useState([]),[y,f]=m.useState(!0),[S,g]=m.useState(""),[C,w]=m.useState(""),[O,L]=m.useState(!1),[G,q]=m.useState([]),[J,ee]=m.useState(null),[K,P]=m.useState(!1),[re,X]=m.useState(null),[te,Q]=m.useState(!1);m.useEffect(()=>{f(!0),be.getHistory(o,u,{model:S||void 0,type:C||void 0}).then(_=>{b(_),_.length>=2&&be.compareRuns(o,u,_[0].timestamp,_[1].timestamp).then(le=>{const I=le.regressions.filter(E=>E.change==="regression");c({type:"SET_REGRESSIONS",regressions:I})}).catch(()=>{})}).catch(()=>{}).finally(()=>f(!1))},[o,u,S,C]);const F=m.useCallback(async _=>{if(O){q(le=>le.includes(_)?le.filter(I=>I!==_):le.length>=2?[le[1],_]:[...le,_]);return}Q(!0);try{const le=await be.getHistoryEntry(o,u,_);X(le)}catch{}finally{Q(!1)}},[o,u,O]),pe=m.useCallback(async()=>{if(G.length===2){P(!0);try{const _=await be.compareRuns(o,u,G[0],G[1]);ee(_)}catch{}finally{P(!1)}}},[o,u,G]),ie=[...new Set(p.map(_=>_.model))];return y?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"skeleton h-12 rounded-lg"}),a.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(_=>a.jsx("button",{onClick:()=>v(_),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:x===_?"var(--accent-muted)":"transparent",color:x===_?"var(--accent)":"var(--text-tertiary)"},children:_==="timeline"?"Timeline":_==="per-eval"?"Per Eval":"Statistics"},_))}),x==="timeline"&&a.jsxs("div",{children:[p.length>0&&a.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:a.jsx(Iv,{entries:p,onPointClick:_=>F(_.timestamp)})}),a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("select",{value:S,onChange:_=>g(_.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Models"}),ie.map(_=>a.jsx("option",{value:_,children:_},_))]}),a.jsxs("select",{value:C,onChange:_=>w(_.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Types"}),a.jsx("option",{value:"benchmark",children:"Benchmark"}),a.jsx("option",{value:"comparison",children:"Comparison"}),a.jsx("option",{value:"baseline",children:"Baseline"}),a.jsx("option",{value:"model-compare",children:"Model Compare"}),a.jsx("option",{value:"improve",children:"AI Improve"}),a.jsx("option",{value:"instruct",children:"AI Edit"}),a.jsx("option",{value:"ai-generate",children:"AI Generate"}),a.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{L(!O),q([]),ee(null)},className:`btn text-[12px] ${O?"btn-primary":"btn-secondary"}`,children:O?"Exit Compare":"Compare Runs"}),O&&G.length===2&&a.jsx("button",{onClick:pe,disabled:K,className:"btn btn-primary text-[12px]",children:K?"Comparing...":"Compare"})]}),a.jsx("div",{className:"space-y-2",children:p.length===0?a.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):p.map(_=>{const le=G.includes(_.timestamp);return a.jsx("button",{onClick:()=>F(_.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:le?"var(--accent-muted)":"var(--surface-1)",border:le?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:I=>{le||(I.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:I=>{le||(I.currentTarget.style.borderColor="var(--border-subtle)")},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[O&&a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:le?"var(--accent)":"var(--border-default)",background:le?"var(--accent)":"transparent"},children:le&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(_.timestamp).toLocaleString()}),a.jsx("span",{className:"pill text-[9px]",style:{background:_.type==="comparison"?"var(--purple-muted)":_.type==="baseline"?"var(--surface-3)":_.type==="model-compare"?"rgba(56,189,248,0.15)":_.type==="improve"||_.type==="instruct"?"rgba(168,85,247,0.15)":_.type==="ai-generate"?"rgba(34,197,94,0.15)":_.type==="eval-generate"?"rgba(251,146,60,0.15)":"var(--accent-muted)",color:_.type==="comparison"?"var(--purple)":_.type==="baseline"?"var(--text-tertiary)":_.type==="model-compare"?"#38bdf8":_.type==="improve"||_.type==="instruct"?"#a855f7":_.type==="ai-generate"?"#22c55e":_.type==="eval-generate"?"#fb923c":"var(--accent)"},children:_.type==="model-compare"?"model compare":_.type==="improve"?"ai improve":_.type==="instruct"?"ai edit":_.type==="ai-generate"?"ai generate":_.type==="eval-generate"?"eval generate":_.type})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:_.model}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:_.passRate>=.8?"var(--green)":_.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(_.passRate*100),"%"]})]})]})},_.timestamp)})}),J&&a.jsx(ry,{result:J}),re&&!O&&a.jsx(iy,{run:re,onClose:()=>X(null)})]}),x==="per-eval"&&a.jsx(ny,{plugin:o,skill:u}),x==="statistics"&&a.jsx(ay,{plugin:o,skill:u})]})}function ry({result:r}){const c=r.regressions.filter(u=>u.change==="regression"),o=r.regressions.filter(u=>u.change==="improvement");return a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(r.runA.timestamp).toLocaleDateString()," vs ",new Date(r.runB.timestamp).toLocaleDateString()]}),c.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",c.length,")"]}),c.map(u=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",u.evalId," ",u.evalName,": ",a.jsx("span",{style:{color:"var(--red)"},children:u.assertionId})," (was passing, now failing)"]},`${u.evalId}-${u.assertionId}`))]}),o.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",o.length,")"]}),o.map(u=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",u.evalId," ",u.evalName,": ",a.jsx("span",{style:{color:"var(--green)"},children:u.assertionId})," (was failing, now passing)"]},`${u.evalId}-${u.assertionId}`))]}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),a.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:a.jsxs("table",{className:"w-full text-[12px]",children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"var(--surface-2)"},children:[a.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),a.jsx("tbody",{children:r.caseDiffs.map(u=>a.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",u.eval_id," ",u.eval_name]}),a.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}),a.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 iy({run:r,onClose:c}){return(r.type==="improve"||r.type==="instruct")&&r.improve?a.jsx(oy,{run:r,onClose:c}):a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(r.timestamp).toLocaleString()]}),a.jsx("button",{onClick:c,className:"btn btn-ghost text-[11px]",children:"Close"})]}),a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",r.model," | Cases: ",r.cases.length," | Pass Rate: ",r.overall_pass_rate!=null?`${Math.round(r.overall_pass_rate*100)}%`:"--"]}),a.jsx("div",{className:"space-y-2",children:r.cases.map(o=>a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:o.status==="pass"?"var(--green)":"var(--red)"},children:o.pass_rate!=null?`${Math.round(o.pass_rate*100)}%`:o.status})]})},o.eval_id))})]})}function oy({run:r,onClose:c}){var v;const o=m.useMemo(()=>r.improve?kr(r.improve.original,r.improve.improved):[],[r.improve]),u=m.useMemo(()=>{const p=o.filter(y=>y.type==="added").length,b=o.filter(y=>y.type==="removed").length;return{added:p,removed:b}},[o]),x=m.useMemo(()=>{let p=0,b=0;return o.map(y=>y.type==="removed"?(p++,{...y,origNum:p,newNum:null}):y.type==="added"?(b++,{...y,origNum:null,newNum:b}):(p++,b++,{...y,origNum:p,newNum:b}))},[o]);return a.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),a.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(r.timestamp).toLocaleString()," · ",r.model]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{style:{color:"var(--green)"},children:["+",u.added]}),a.jsxs("span",{style:{color:"var(--red)"},children:["-",u.removed]})]}),a.jsx("button",{onClick:c,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:p=>{p.currentTarget.style.background="var(--surface-3)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((v=r.improve)==null?void 0:v.reasoning)&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),r.improve.reasoning]}),a.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:x.map((p,b)=>a.jsxs("tr",{style:{background:p.type==="added"?"rgba(34,197,94,0.08)":p.type==="removed"?"rgba(239,68,68,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="removed"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:p.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.origNum??""}),a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="added"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:p.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.newNum??""}),a.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"transparent",borderRight:p.type==="added"?"2px solid var(--green)":p.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:p.type==="added"?"+":p.type==="removed"?"-":" "}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"var(--text-secondary)"},children:p.content||""})]},b))})})})]})}function cy({plugin:r,skill:c}){const[o,u]=m.useState([]),[x,v]=m.useState([]),[p,b]=m.useState(!0),[y,f]=m.useState(null);m.useEffect(()=>{be.getDependencies(r,c).then(g=>{u(g.mcpDependencies),v(g.skillDependencies)}).catch(()=>{}).finally(()=>b(!1))},[r,c]);async function S(g,C){try{await navigator.clipboard.writeText(C),f(g),setTimeout(()=>f(null),2e3)}catch{}}return p?null:o.length===0&&x.length===0?a.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"}):a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.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:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.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"}),a.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"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:o.length+x.length})]}),a.jsxs("div",{className:"px-5 py-4",children:[o.length>0&&a.jsxs("div",{className:"space-y-3 mb-4",children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),o.map(g=>a.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:g.server}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.transport})]}),a.jsx("button",{onClick:()=>S(g.server,g.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:y===g.server?"var(--green)":"var(--accent)"},children:y===g.server?a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.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"]})})]}),a.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:g.url}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.matchedTools.map(C=>a.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:C},C))})]},g.server))]}),x.length>0&&a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),a.jsx("div",{className:"space-y-1.5",children:x.map(g=>a.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:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:g.name}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.source==="frontmatter"?"frontmatter":"referenced"})]},g.name))})]})]})]})}function Lx({plugin:r,skill:c}){const[o,u]=m.useState([]),[x,v]=m.useState(!0),[p,b]=m.useState(null),[y,f]=m.useState(""),[S,g]=m.useState(!1),[C,w]=m.useState(null),[O,L]=m.useState(""),[G,q]=m.useState(""),[J,ee]=m.useState(!1),[K,P]=m.useState(new Set),re=m.useCallback(async()=>{v(!0);try{const[F,pe]=await Promise.all([be.getCredentials(r,c).catch(()=>({credentials:[]})),be.getParams(r,c).catch(()=>({params:[]}))]),ie=new Map(pe.params.map(I=>[I.name,I])),_=new Set,le=[];for(const I of F.credentials){_.add(I.name);const E=ie.get(I.name);le.push({name:I.name,status:I.status==="ready"||I.status==="resolved"?"ready":"missing",source:I.source,maskedValue:E==null?void 0:E.maskedValue})}for(const I of pe.params)_.has(I.name)||le.push({name:I.name,status:I.status,maskedValue:I.maskedValue});u(le)}finally{v(!1)}},[r,c]);m.useEffect(()=>{re()},[re]);const X=m.useCallback(async F=>{if(K.has(F)){P(pe=>{const ie=new Set(pe);return ie.delete(F),ie}),u(pe=>pe.map(ie=>ie.name===F?{...ie,revealedValue:void 0}:ie));return}try{const ie=(await be.getParamsRevealed(r,c,F)).params.find(_=>_.name===F);ie&&(u(_=>_.map(le=>le.name===F?{...le,revealedValue:ie.value}:le)),P(_=>new Set(_).add(F)))}catch{}},[r,c,K]),te=async(F,pe)=>{if(!(!F.trim()||!pe.trim())){g(!0),w(null);try{await be.setCredential(r,c,F,pe),b(null),f(""),P(new Set),re()}catch(ie){w(ie.message)}finally{g(!1)}}},Q=async()=>{if(!(!O.trim()||!G.trim())){g(!0),w(null);try{await be.setCredential(r,c,O.trim().toUpperCase(),G),L(""),q(""),ee(!1),re()}catch(F){w(F.message)}finally{g(!1)}}};return x?a.jsxs("div",{className:"mt-6",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):a.jsxs("div",{className:"mt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("button",{onClick:()=>ee(!J),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),C&&a.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--error-muted, #3f1a1a)",color:"var(--error, #f87171)"},children:C}),o.length===0&&!J?a.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"}):a.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:o.map(F=>a.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:[a.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:F.name}),F.maskedValue&&a.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:K.has(F.name)&&F.revealedValue!=null?F.revealedValue:F.maskedValue}),F.maskedValue&&a.jsx("button",{onClick:()=>X(F.name),className:"btn btn-ghost px-1",title:K.has(F.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:K.has(F.name)?a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.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"}),a.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"}),a.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),a.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:F.status==="ready"?"rgba(52,211,153,0.15)":"rgba(251,146,60,0.15)",color:F.status==="ready"?"var(--green)":"#fb923c"},children:F.status==="ready"?"ready":"missing"}),F.source&&a.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:F.source}),p===F.name?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{value:y,onChange:pe=>f(pe.target.value),onKeyDown:pe=>{pe.key==="Enter"&&te(F.name,y)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),a.jsx("button",{onClick:()=>te(F.name,y),disabled:S||!y.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:S?"...":"Save"}),a.jsx("button",{onClick:()=>{b(null),f("")},className:"btn btn-ghost text-[10px] px-1",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):a.jsx("button",{onClick:()=>{b(F.name),f("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},F.name))}),J&&a.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:O,onChange:F=>L(F.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),a.jsx("input",{value:G,onChange:F=>q(F.target.value),onKeyDown:F=>{F.key==="Enter"&&Q()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),a.jsxs("div",{className:"flex justify-end gap-1.5",children:[a.jsx("button",{onClick:()=>{ee(!1),L(""),q("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),a.jsx("button",{onClick:Q,disabled:S||!O.trim()||!G.trim(),className:"btn btn-primary text-[10px]",children:S?"Saving...":"Save"})]})]})]})}function uy(){const{state:r}=tl(),{plugin:c,skill:o}=r,[u,x]=m.useState(null),[v,p]=m.useState(!0);return m.useEffect(()=>{be.getDependencies(c,o).then(x).catch(()=>{}).finally(()=>p(!1))},[c,o]),v?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):u?a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx(cy,{plugin:c,skill:o}),a.jsx(Lx,{plugin:c,skill:o})]}):a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),a.jsx(Lx,{plugin:c,skill:o})]})}function Wx({data:r}){if(r.length<2)return a.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const c=r.slice(-10),o=80,u=24,x=2,v=o-x*2,p=u-x*2,b=c.length,y=Math.min(...c),S=Math.max(...c)-y||1,g=c.map((O,L)=>{const G=x+L/(b-1)*v,q=x+p-(O-y)/S*p;return`${G.toFixed(1)},${q.toFixed(1)}`}),C=c[c.length-1],w=dn(C);return a.jsxs("svg",{width:o,height:u,viewBox:`0 0 ${o} ${u}`,style:{display:"block"},children:[a.jsx("polyline",{points:g.join(" "),fill:"none",stroke:w,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[O,L]=g[g.length-1].split(",");return a.jsx("circle",{cx:O,cy:L,r:2.5,fill:w})})()]})}function dy(){return a.jsxs("span",{className:"pill",style:{background:"rgba(251,191,36,0.15)",color:"#fbbf24",fontSize:9,fontWeight:700,gap:3},children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"#fbbf24",stroke:"none",children:a.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 fy({pct:r}){const c=r>=10?"var(--green)":r>=0?"var(--yellow)":"var(--red)",o=r>=10?"var(--green-muted)":r>=0?"var(--yellow-muted)":"var(--red-muted)",u=r>=0?"+":"";return a.jsxs("span",{className:"pill",style:{background:o,color:c,fontSize:10,fontWeight:600},children:[u,r.toFixed(1),"%"]})}function xy({score:r,rating:c}){const o={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=o[c]??o.minimal,x=r>=0?"+":"";return a.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),a.jsxs("span",{className:"pill",style:{background:u.bg,color:u.fg,fontSize:11,fontWeight:600},children:[x,r.toFixed(1),"% (",c.toUpperCase(),")"]})]})}function py({warning:r}){return a.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:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.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"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:r})]})}function my({active:r,onChange:c,hasBaseline:o}){return a.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[a.jsx("button",{onClick:()=>c("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:r==="rankings"?"var(--surface-3)":"transparent",color:r==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),a.jsx("button",{onClick:()=>c("amplification"),disabled:!o,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:r==="amplification"?"var(--surface-3)":"transparent",color:o&&r==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:o?1:.5,cursor:o?"pointer":"not-allowed"},title:o?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function hy(r){var u,x,v;if(r.length===0)return[];const c=new Map;for(const p of r)for(const b of p.models){if(b.status==="error")continue;const y=`${b.provider}/${b.model}`;c.has(y)||c.set(y,{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=c.get(y);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 o=[];for(const[p,b]of c){const[y,...f]=p.split("/");o.push({rank:0,model:f.join("/"),provider:y,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 o.sort((p,b)=>{const y=p.compositeScore??p.passRate;return(b.compositeScore??b.passRate)-y}),o.forEach((p,b)=>{p.rank=b+1}),o.length>0&&(o[0].isBest=!0),o}const Fx=(r="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:r,whiteSpace:"nowrap"});function vy({entries:r}){return a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(c=>a.jsx("th",{style:Fx(c==="#"?"center":"left"),children:c},c))})}),a.jsx("tbody",{children:r.map(c=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:o=>{o.currentTarget.style.background="var(--surface-2)"},onMouseLeave:o=>{o.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:c.rank}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:c.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:c.provider}),c.isBest&&a.jsx(dy,{})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:c.passRate>=.7?"var(--green-muted)":c.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:dn(c.passRate),fontSize:11,fontWeight:600},children:[Math.round(c.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:c.rubricScore!=null?c.rubricScore.toFixed(1):"--"}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:c.duration<1e3?`${Math.round(c.duration)}ms`:`${(c.duration/1e3).toFixed(1)}s`}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:c.cost!=null?`$${c.cost.toFixed(4)}`:"N/A"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(Wx,{data:c.sparklineData})})]},`${c.provider}/${c.model}`))})]})})}function yy({entries:r}){const c=[...r].filter(o=>o.hasBaseline).sort((o,u)=>(u.amplificationPct??0)-(o.amplificationPct??0));return c.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-center",children:a.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",a.jsx("code",{children:"--baseline"})," flag."]})})}):a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(o=>a.jsx("th",{style:Fx(o==="#"?"center":"left"),children:o},o))})}),a.jsx("tbody",{children:c.map((o,u)=>a.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:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:u+1}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:o.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:o.provider})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:o.passRate>=.7?"var(--green-muted)":o.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:dn(o.passRate),fontSize:11,fontWeight:600},children:[Math.round(o.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px"},children:o.baselinePassRate!=null?a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(o.baselinePassRate*100),"%"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:o.skillDelta!=null?a.jsxs("span",{className:"text-[11px] font-medium",style:{color:o.skillDelta>=0?"var(--green)":"var(--red)"},children:[o.skillDelta>=0?"+":"",(o.skillDelta*100).toFixed(1),"pp"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:o.amplificationPct!=null&&isFinite(o.amplificationPct)?a.jsx(fy,{pct:o.amplificationPct}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(Wx,{data:o.sparklineData})})]},`${o.provider}/${o.model}`))})]})})}function gy(){const{state:r}=tl(),{plugin:c,skill:o}=r,[u,x]=m.useState([]),[v,p]=m.useState(!0),[b,y]=m.useState(null),[f,S]=m.useState("rankings");m.useEffect(()=>{p(!0),y(null),S("rankings"),be.getLeaderboard(c,o).then(L=>x(L.entries)).catch(L=>y(L instanceof Error?L.message:String(L))).finally(()=>p(!1))},[c,o]);const g=m.useMemo(()=>hy(u),[u]),C=g.some(L=>L.hasBaseline),w=u[0],O=w==null?void 0:w.judgeBiasWarning;return v?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"spinner spinner-lg"})}):b?a.jsx("div",{className:"flex items-center justify-center h-full px-8",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Failed to load leaderboard"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:b})]})}):g.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),a.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),a.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"'}),a.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",a.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),a.jsx(my,{active:f,onChange:S,hasBaseline:C})]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[u.length," sweep",u.length!==1?"s":""," · ",g.length," model",g.length!==1?"s":""]})]}),O&&a.jsx(py,{warning:O}),f==="rankings"?a.jsx(vy,{entries:g}):a.jsx(yy,{entries:g}),f==="amplification"&&(w==null?void 0:w.skillQualityScore)!=null&&(w==null?void 0:w.skillQualityRating)&&a.jsx(xy,{score:w.skillQualityScore,rating:w.skillQualityRating})]})}const by=["editor","tests","run","activation","history","leaderboard","deps"];function jy(r){return r!=null&&by.includes(r)}function Sy(){const{state:r,dispatch:c,saveContent:o,isReadOnly:u}=tl(),{refreshSkills:x,clearSelection:v}=na(),p=m.useCallback(async()=>{try{await be.deleteSkill(r.plugin,r.skill),x(),v()}catch(f){const S=f instanceof Error?f.message:String(f);c({type:"SET_ERROR",error:`Failed to delete skill: ${S}`})}},[r.plugin,r.skill,x,v,c]);m.useEffect(()=>{const S=new URLSearchParams(window.location.search).get("panel");jy(S)&&S!==r.activePanel&&c({type:"SET_PANEL",panel:S})},[]),m.useEffect(()=>{const f=new URLSearchParams(window.location.search);f.set("panel",r.activePanel);const S=`${window.location.pathname}?${f.toString()}${window.location.hash}`;history.replaceState(null,"",S)},[r.activePanel]);const b=m.useCallback(f=>{const S=f.ctrlKey||f.metaKey;if(S&&f.key>="1"&&f.key<="7"){f.preventDefault(),c({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps"][parseInt(f.key)-1]});return}if(S&&f.key==="s"&&!f.shiftKey){f.preventDefault(),r.isDirty&&o();return}},[r.isDirty,o,c]);if(m.useEffect(()=>(window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)),[b]),r.loading)return a.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"spinner spinner-lg"}),a.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const y=Array.from(r.caseRunStates.values()).some(f=>f.status==="running"||f.status==="queued");return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[a.jsx(Wh,{state:r,isReadOnly:u,onDelete:u?void 0:p}),r.error&&a.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx(ss,{error:av(r.error),onDismiss:()=>c({type:"SET_ERROR",error:null})})}),a.jsx(tv,{activePanel:r.activePanel,onPanelChange:f=>c({type:"SET_PANEL",panel:f}),isDirty:r.isDirty,isRunning:y,hasRegressions:r.regressions.length>0,isActivationRunning:r.activationRunning}),a.jsx(lv,{children:a.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[r.activePanel==="editor"&&a.jsx(wv,{}),r.activePanel==="tests"&&a.jsx(zv,{}),r.activePanel==="run"&&a.jsx(Vv,{}),r.activePanel==="activation"&&a.jsx(Xv,{}),r.activePanel==="history"&&a.jsx(sy,{}),r.activePanel==="leaderboard"&&a.jsx(gy,{}),r.activePanel==="deps"&&a.jsx(uy,{})]},r.activePanel)})},`${r.plugin}/${r.skill}`)]})}function rc(r,c=!0){let o=r.toLowerCase().replace(/[^a-z0-9]+/g,"-");return c&&(o=o.replace(/^-+|-+$/g,"")),o}function Ny(r,c,o,u){const v=`.../${r.split("/").slice(-2).join("/")}`;switch(c){case 1:return`${v}/${o}/skills/${u}/SKILL.md`;case 2:return`${v}/plugins/${o}/skills/${u}/SKILL.md`;case 3:return`${v}/skills/${u}/SKILL.md`}}function Ey({onCreated:r,resolveAiConfigOverride:c}){const[o,u]=m.useState("ai"),[x,v]=m.useState(null),[p,b]=m.useState(!0),{config:y}=Na(),[f,S]=m.useState(""),[g,C]=m.useState(3),[w,O]=m.useState(""),[L,G]=m.useState(""),[q,J]=m.useState(""),[ee,K]=m.useState(""),[P,re]=m.useState(""),[X,te]=m.useState(""),[Q,F]=m.useState("write"),[pe,ie]=m.useState(!1),[_,le]=m.useState(null),[I,E]=m.useState(""),[M,ae]=m.useState(!1),[B,de]=m.useState(!1),[j,D]=m.useState(null),[W,ne]=m.useState(null),[ue,fe]=m.useState([]),ve=m.useRef(null),Oe=m.useRef(null),Re=m.useRef(null),pt=m.useRef(null),[Lt,Z]=m.useState(!1),[oe,se]=m.useState(!1);m.useEffect(()=>{be.getProjectLayout().then($=>{v($),C($.suggestedLayout);const Be=$.detectedLayouts.find(at=>at.layout===$.suggestedLayout);Be!=null&&Be.existingPlugins.length&&O(Be.existingPlugins[0])}).catch(()=>{}).finally(()=>b(!1))},[]),m.useEffect(()=>{var $;o==="ai"&&(($=ve.current)==null||$.focus())},[o]),m.useEffect(()=>()=>{var $;($=Oe.current)==null||$.abort()},[]);const me=m.useMemo(()=>{var $;return x?(($=x.detectedLayouts.find(Be=>Be.layout===g))==null?void 0:$.existingPlugins)||[]:[]},[x,g]),ge=w==="__new__"?L:w,Ye=x?Ny(x.root,g,ge||"{plugin}",f||"{skill}"):"",ut=m.useMemo(()=>x?x.detectedLayouts.filter($=>$.layout!==4):[],[x]),Xe=m.useMemo(()=>{if(!x)return null;const $=x.detectedLayouts.find(Je=>Je.layout===2&&Je.existingPlugins.length>0),Be=x.detectedLayouts.find(Je=>Je.layout===1&&Je.existingPlugins.length>0),at=$||Be;return at?{layout:at.layout,plugins:at.existingPlugins}:null},[x]),Dt=m.useCallback(()=>{if(c)return c();if(!y)return{provider:"claude-cli",model:"sonnet"};const $=y.provider||"claude-cli",Be=y.model||"sonnet";return{provider:$,model:Be}},[y,c]),mt=m.useCallback(()=>{var $;($=Oe.current)==null||$.abort(),ae(!1)},[]),ll=m.useCallback(()=>{D(null),ne(null)},[]),Qt=m.useCallback(async()=>{if(D(null),ne(null),fe([]),Re.current=null,!I.trim()){D("Describe what your skill should do");return}ae(!0);const $=new AbortController;Oe.current=$;const{provider:Be,model:at}=Dt();try{const Je=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:I.trim(),provider:Be,model:at}),signal:$.signal});if(!Je.ok||!Je.body){let Fe=`HTTP ${Je.status}`;try{const nt=await Je.json();nt.error&&(Fe=nt.error)}catch{}throw new Error(Fe)}const Rl=Je.body.getReader(),Ot=new TextDecoder;let sa="",kt="";for(;;){const{done:Fe,value:nt}=await Rl.read();if(Fe)break;sa+=Ot.decode(nt,{stream:!0});const et=sa.split(`
|
|
68
|
+
`);sa=et.pop()||"";for(const al of et)if(al.startsWith("event: "))kt=al.slice(7).trim();else if(al.startsWith("data: ")){try{const Qe=JSON.parse(al.slice(6));if(kt==="progress")fe(nl=>[...nl,{phase:Qe.phase,message:Qe.message,timestamp:Date.now()}]);else if(kt==="done"||kt==="complete"){const nl={prompt:I.trim(),provider:Dt().provider,model:Dt().model,reasoning:Qe.reasoning||""};if(S(Qe.name),J(Qe.description),K(Qe.model||""),re(Qe.allowedTools||""),te(Qe.body),de(!0),Re.current=nl,u("manual"),Qe.suggestedPlugin&&typeof Qe.suggestedPlugin=="object"&&Qe.suggestedPlugin.plugin){const Ve=Qe.suggestedPlugin;if(((x==null?void 0:x.detectedLayouts.flatMap(Ct=>Ct.existingPlugins))??[]).includes(Ve.plugin))if(O(Ve.plugin),Ve.layout&&(Ve.layout===1||Ve.layout===2))C(Ve.layout);else{const Ct=x==null?void 0:x.detectedLayouts.find(Ea=>Ea.existingPlugins.includes(Ve.plugin));Ct&&(Ct.layout===1||Ct.layout===2)&&C(Ct.layout)}else O("__new__"),G(Ve.plugin)}else g===3&&Xe&&se(!0);const st={name:Qe.name,plugin:ge||"",layout:g,description:Qe.description,model:Qe.model||void 0,allowedTools:Qe.allowedTools||void 0,body:Qe.body,aiMeta:nl};be.saveDraft(st).then(Ve=>{Z(!0),Ve!=null&&Ve.dir&&(pt.current=Ve.dir)}).catch(()=>{})}else kt==="error"&&(D(Qe.message||Qe.description||"Unknown error"),Qe.category&&ne(Qe))}catch{}kt=""}}}catch(Je){Je.name!=="AbortError"&&D(Je.message)}finally{ae(!1),Oe.current=null}},[I,Dt,g,Xe,ge,x]),We=m.useCallback(async()=>{if(le(null),!f.trim()){le("Skill name is required");return}if(!q.trim()){le("Description is required");return}if(g!==3&&!ge.trim()){le("Plugin name is required");return}ie(!0);try{const $=await be.createSkill({name:rc(f),plugin:ge||"",layout:g,description:q,model:ee||void 0,allowedTools:P||void 0,body:X,aiMeta:Re.current||void 0,draftDir:pt.current||void 0});pt.current=null,r($.plugin,$.skill)}catch($){le($.message)}finally{ie(!1)}},[f,q,g,ge,ee,P,X,r]),Et=m.useCallback(()=>{Xe&&(C(Xe.layout),O(Xe.plugins[0]),se(!1))},[Xe]);return{mode:o,setMode:u,layout:x,layoutLoading:p,selectedLayout:g,setSelectedLayout:C,creatableLayouts:ut,availablePlugins:me,pathPreview:Ye,plugin:w,setPlugin:O,newPlugin:L,setNewPlugin:G,effectivePlugin:ge,name:f,setName:S,description:q,setDescription:J,model:ee,setModel:K,allowedTools:P,setAllowedTools:re,body:X,setBody:te,bodyViewMode:Q,setBodyViewMode:F,aiPrompt:I,setAiPrompt:E,generating:M,aiGenerated:B,aiError:j,aiClassifiedError:W,aiProgress:ue,promptRef:ve,handleGenerate:Qt,handleCancelGenerate:mt,clearAiError:ll,draftSaved:Lt,showPluginRecommendation:oe,setShowPluginRecommendation:se,pluginLayoutInfo:Xe,applyPluginRecommendation:Et,creating:pe,error:_,handleCreate:We}}function Ix(){return a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.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 ky(){return a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Px({node:r,depth:c=0}){var o;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${c*16}px`,color:r.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[r.type==="dir"?a.jsx(Ix,{}):a.jsx(ky,{}),a.jsxs("span",{children:[r.name,r.type==="dir"?"/":""]})]}),(o=r.children)==null?void 0:o.map(u=>a.jsx(Px,{node:u,depth:c+1},u.name))]})}function Cy(r,c,o){const u=[];c&&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 o&&x.push({name:"draft.json",type:"file"}),{name:r||"{skill}",type:"dir",children:x}}function Ty({skillName:r,hasEvals:c,isDraft:o}){const u=Cy(r,c,o);return a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[a.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsx(Ix,{})}),"Skill Structure"]}),a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:a.jsx(Px,{node:u})})]})}const aa={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Po({size:r=14,color:c="currentColor"}){return a.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:c,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.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 wy({onCreated:r,onCancel:c}){const o=Ey({onCreated:r});return a.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),a.jsx("div",{className:"flex items-center justify-between mt-2",children:a.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsx("button",{onClick:()=>o.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:o.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:o.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:o.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Po,{size:12}),"AI-Assisted"]})}),a.jsx("button",{onClick:()=>o.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:o.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:o.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:o.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),o.layoutLoading&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),a.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!o.layoutLoading&&o.layout&&o.mode==="ai"&&a.jsxs("div",{className:"space-y-4 animate-fade-in",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[a.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsx(Po,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),a.jsx("textarea",{ref:o.promptRef,value:o.aiPrompt,onChange:u=>o.setAiPrompt(u.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
|
|
69
69
|
|
|
70
70
|
Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:o.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...aa,minHeight:"120px"},onKeyDown:u=>{u.key==="Enter"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),o.handleGenerate())}}),a.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),o.generating&&o.aiProgress.length>0&&a.jsx(rs,{entries:o.aiProgress,isRunning:!0}),o.aiError&&a.jsx("div",{children:o.aiClassifiedError?a.jsx(ss,{error:o.aiClassifiedError,onRetry:o.handleGenerate,onDismiss:o.clearAiError}):a.jsxs("div",{children:[a.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:o.aiError}),a.jsx("button",{onClick:o.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),a.jsxs("div",{className:"flex items-center gap-3",children:[o.generating?a.jsx("button",{onClick:o.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"}):a.jsxs("button",{onClick:o.handleGenerate,disabled:!o.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:o.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:o.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:o.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[a.jsx(Po,{size:14}),"Generate"]}),a.jsx("button",{onClick:c,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"}),!o.generating&&a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",a.jsx("button",{onClick:()=>o.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!o.layoutLoading&&o.layout&&o.mode==="manual"&&a.jsxs("div",{className:"space-y-4 animate-fade-in",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),o.creatableLayouts.length>1&&a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),a.jsx("div",{className:"flex gap-2",children:o.creatableLayouts.map(u=>a.jsx("button",{onClick:()=>{o.setSelectedLayout(u.layout),o.setPlugin(u.existingPlugins[0]||""),o.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:o.selectedLayout===u.layout?"var(--accent)":"var(--surface-3)",color:o.selectedLayout===u.layout?"#fff":"var(--text-secondary)",border:`1px solid ${o.selectedLayout===u.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:u.label},u.layout))})]}),o.selectedLayout!==3&&a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),a.jsxs("select",{value:o.plugin,onChange:u=>{o.setPlugin(u.target.value),o.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:aa,children:[o.availablePlugins.map(u=>a.jsx("option",{value:u,children:u},u)),a.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),o.plugin==="__new__"&&a.jsx("input",{type:"text",value:o.newPlugin,onChange:u=>o.setNewPlugin(rc(u.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:aa})]}),a.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:o.pathPreview})]}),o.showPluginRecommendation&&o.pluginLayoutInfo&&o.selectedLayout===3&&a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),a.jsxs("span",{children:["Plugins detected (",a.jsx("strong",{children:o.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("button",{onClick:o.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),a.jsx("button",{onClick:()=>o.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:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),a.jsxs("div",{className:"mb-3",children:[a.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",a.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),a.jsx("input",{type:"text",value:o.name,onChange:u=>o.setName(rc(u.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:aa})]}),a.jsxs("div",{className:"mb-3",children:[a.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",a.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),a.jsx("textarea",{value:o.description,onChange:u=>o.setDescription(u.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...aa,minHeight:"72px"}})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsxs("select",{value:o.model,onChange:u=>o.setModel(u.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:aa,children:[a.jsx("option",{value:"",children:"Any"}),a.jsx("option",{value:"opus",children:"Opus"}),a.jsx("option",{value:"sonnet",children:"Sonnet"}),a.jsx("option",{value:"haiku",children:"Haiku"})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),a.jsx("input",{type:"text",value:o.allowedTools,onChange:u=>o.setAllowedTools(u.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:aa})]})]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"}),a.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),a.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),a.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(u=>a.jsxs("button",{onClick:()=>o.setBodyViewMode(u),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:o.bodyViewMode===u?"var(--surface-4)":"transparent",color:o.bodyViewMode===u?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:o.bodyViewMode===u?600:400,border:"none",cursor:"pointer"},children:[u==="write"?a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]}):a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),a.jsx("span",{children:u==="write"?"Write":"Preview"})]},u))})]}),o.bodyViewMode==="write"?a.jsx("textarea",{value:o.body,onChange:u=>o.setBody(u.target.value),placeholder:`# /my-skill
|
|
71
71
|
|