vskill 0.5.102 → 0.5.104

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.
Files changed (58) hide show
  1. package/README.md +24 -2
  2. package/agents.json +1 -1
  3. package/dist/agents/agents-registry.d.ts +13 -2
  4. package/dist/agents/agents-registry.js +120 -57
  5. package/dist/agents/agents-registry.js.map +1 -1
  6. package/dist/commands/diff.d.ts +9 -0
  7. package/dist/commands/diff.js +139 -0
  8. package/dist/commands/diff.js.map +1 -0
  9. package/dist/commands/eval/serve.js +25 -83
  10. package/dist/commands/eval/serve.js.map +1 -1
  11. package/dist/commands/skill.d.ts +32 -0
  12. package/dist/commands/skill.js +392 -0
  13. package/dist/commands/skill.js.map +1 -0
  14. package/dist/commands/update.js +15 -4
  15. package/dist/commands/update.js.map +1 -1
  16. package/dist/core/skill-emitter.d.ts +37 -0
  17. package/dist/core/skill-emitter.js +333 -0
  18. package/dist/core/skill-emitter.js.map +1 -0
  19. package/dist/core/skill-generator.d.ts +27 -0
  20. package/dist/core/skill-generator.js +100 -0
  21. package/dist/core/skill-generator.js.map +1 -0
  22. package/dist/eval-server/api-routes.d.ts +0 -7
  23. package/dist/eval-server/api-routes.js +5 -29
  24. package/dist/eval-server/api-routes.js.map +1 -1
  25. package/dist/eval-server/authoring-routes.d.ts +1 -0
  26. package/dist/eval-server/authoring-routes.js +42 -0
  27. package/dist/eval-server/authoring-routes.js.map +1 -1
  28. package/dist/eval-server/boot-preflight.d.ts +1 -0
  29. package/dist/eval-server/boot-preflight.js +17 -0
  30. package/dist/eval-server/boot-preflight.js.map +1 -0
  31. package/dist/eval-server/providers.d.ts +16 -0
  32. package/dist/eval-server/providers.js +45 -0
  33. package/dist/eval-server/providers.js.map +1 -0
  34. package/dist/eval-server/skill-create-routes.d.ts +62 -0
  35. package/dist/eval-server/skill-create-routes.js +79 -132
  36. package/dist/eval-server/skill-create-routes.js.map +1 -1
  37. package/dist/eval-ui/assets/{CommandPalette-BSGTaiI4.js → CommandPalette-DiPALzlG.js} +1 -1
  38. package/dist/eval-ui/assets/CreateSkillPage-BMrFELep.js +12 -0
  39. package/dist/eval-ui/assets/{UpdateDropdown-stNmCWki.js → UpdateDropdown-Bj8kZzuR.js} +1 -1
  40. package/dist/eval-ui/assets/_shimNode-D3bBqrAh.js +1 -0
  41. package/dist/eval-ui/assets/index-BSPDkfZG.js +102 -0
  42. package/dist/eval-ui/assets/index-C0Gc_4KC.css +1 -0
  43. package/dist/eval-ui/assets/resolve-binary-DIxhrZ6O.js +2 -0
  44. package/dist/eval-ui/index.html +2 -2
  45. package/dist/index.js +3 -0
  46. package/dist/index.js.map +1 -1
  47. package/dist/installer/canonical.d.ts +2 -0
  48. package/dist/installer/canonical.js +35 -4
  49. package/dist/installer/canonical.js.map +1 -1
  50. package/dist/utils/agent-filter.js +5 -4
  51. package/dist/utils/agent-filter.js.map +1 -1
  52. package/dist/utils/resolve-binary.d.ts +22 -0
  53. package/dist/utils/resolve-binary.js +44 -0
  54. package/dist/utils/resolve-binary.js.map +1 -1
  55. package/package.json +1 -1
  56. package/scripts/preuninstall.cjs +2 -9
  57. package/dist/eval-ui/assets/index-BoCK_s7q.js +0 -91
  58. package/dist/eval-ui/assets/index-D5FxVeoM.css +0 -1
@@ -0,0 +1,102 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-Bj8kZzuR.js","assets/fonts-i7Lkz2zN.css","assets/resolve-binary-DIxhrZ6O.js","assets/_shimNode-D3bBqrAh.js","assets/CommandPalette-DiPALzlG.js","assets/CreateSkillPage-BMrFELep.js"])))=>i.map(i=>d[i]);
2
+ /* empty css */(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function s(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(c){if(c.ep)return;c.ep=!0;const f=s(c);fetch(c.href,f)}})();function Kg(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ad={exports:{}},ks={};/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var Sx;function Pb(){if(Sx)return ks;Sx=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function s(o,c,f){var d=null;if(f!==void 0&&(d=""+f),c.key!==void 0&&(d=""+c.key),"key"in c){f={};for(var x in c)x!=="key"&&(f[x]=c[x])}else f=c;return c=f.ref,{$$typeof:n,type:o,key:d,ref:c!==void 0?c:null,props:f}}return ks.Fragment=l,ks.jsx=s,ks.jsxs=s,ks}var jx;function Fb(){return jx||(jx=1,ad.exports=Pb()),ad.exports}var a=Fb(),rd={exports:{}},He={};/**
11
+ * @license React
12
+ * react.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var kx;function Gb(){if(kx)return He;kx=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),d=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function j(O){return O===null||typeof O!="object"?null:(O=b&&O[b]||O["@@iterator"],typeof O=="function"?O:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,C={};function w(O,Y,se){this.props=O,this.context=Y,this.refs=C,this.updater=se||k}w.prototype.isReactComponent={},w.prototype.setState=function(O,Y){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,Y,"setState")},w.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function A(){}A.prototype=w.prototype;function _(O,Y,se){this.props=O,this.context=Y,this.refs=C,this.updater=se||k}var H=_.prototype=new A;H.constructor=_,N(H,w.prototype),H.isPureReactComponent=!0;var L=Array.isArray;function $(){}var E={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function R(O,Y,se){var de=se.ref;return{$$typeof:n,type:O,key:Y,ref:de!==void 0?de:null,props:se}}function B(O,Y){return R(O.type,Y,O.props)}function V(O){return typeof O=="object"&&O!==null&&O.$$typeof===n}function W(O){var Y={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(se){return Y[se]})}var te=/\/+/g;function Q(O,Y){return typeof O=="object"&&O!==null&&O.key!=null?W(""+O.key):Y.toString(36)}function z(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then($,$):(O.status="pending",O.then(function(Y){O.status==="pending"&&(O.status="fulfilled",O.value=Y)},function(Y){O.status==="pending"&&(O.status="rejected",O.reason=Y)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function M(O,Y,se,de,ge){var xe=typeof O;(xe==="undefined"||xe==="boolean")&&(O=null);var we=!1;if(O===null)we=!0;else switch(xe){case"bigint":case"string":case"number":we=!0;break;case"object":switch(O.$$typeof){case n:case l:we=!0;break;case y:return we=O._init,M(we(O._payload),Y,se,de,ge)}}if(we)return ge=ge(O),we=de===""?"."+Q(O,0):de,L(ge)?(se="",we!=null&&(se=we.replace(te,"$&/")+"/"),M(ge,Y,se,"",function(Oe){return Oe})):ge!=null&&(V(ge)&&(ge=B(ge,se+(ge.key==null||O&&O.key===ge.key?"":(""+ge.key).replace(te,"$&/")+"/")+we)),Y.push(ge)),1;we=0;var ie=de===""?".":de+":";if(L(O))for(var je=0;je<O.length;je++)de=O[je],xe=ie+Q(de,je),we+=M(de,Y,se,xe,ge);else if(je=j(O),typeof je=="function")for(O=je.call(O),je=0;!(de=O.next()).done;)de=de.value,xe=ie+Q(de,je++),we+=M(de,Y,se,xe,ge);else if(xe==="object"){if(typeof O.then=="function")return M(z(O),Y,se,de,ge);throw Y=String(O),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return we}function I(O,Y,se){if(O==null)return O;var de=[],ge=0;return M(O,de,"","",function(xe){return Y.call(se,xe,ge++)}),de}function X(O){if(O._status===-1){var Y=O._result;Y=Y(),Y.then(function(se){(O._status===0||O._status===-1)&&(O._status=1,O._result=se)},function(se){(O._status===0||O._status===-1)&&(O._status=2,O._result=se)}),O._status===-1&&(O._status=0,O._result=Y)}if(O._status===1)return O._result.default;throw O._result}var G=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},ce={map:I,forEach:function(O,Y,se){I(O,function(){Y.apply(this,arguments)},se)},count:function(O){var Y=0;return I(O,function(){Y++}),Y},toArray:function(O){return I(O,function(Y){return Y})||[]},only:function(O){if(!V(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return He.Activity=v,He.Children=ce,He.Component=w,He.Fragment=s,He.Profiler=c,He.PureComponent=_,He.StrictMode=o,He.Suspense=h,He.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=E,He.__COMPILER_RUNTIME={__proto__:null,c:function(O){return E.H.useMemoCache(O)}},He.cache=function(O){return function(){return O.apply(null,arguments)}},He.cacheSignal=function(){return null},He.cloneElement=function(O,Y,se){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var de=N({},O.props),ge=O.key;if(Y!=null)for(xe in Y.key!==void 0&&(ge=""+Y.key),Y)!D.call(Y,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&Y.ref===void 0||(de[xe]=Y[xe]);var xe=arguments.length-2;if(xe===1)de.children=se;else if(1<xe){for(var we=Array(xe),ie=0;ie<xe;ie++)we[ie]=arguments[ie+2];de.children=we}return R(O.type,ge,de)},He.createContext=function(O){return O={$$typeof:d,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:f,_context:O},O},He.createElement=function(O,Y,se){var de,ge={},xe=null;if(Y!=null)for(de in Y.key!==void 0&&(xe=""+Y.key),Y)D.call(Y,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(ge[de]=Y[de]);var we=arguments.length-2;if(we===1)ge.children=se;else if(1<we){for(var ie=Array(we),je=0;je<we;je++)ie[je]=arguments[je+2];ge.children=ie}if(O&&O.defaultProps)for(de in we=O.defaultProps,we)ge[de]===void 0&&(ge[de]=we[de]);return R(O,xe,ge)},He.createRef=function(){return{current:null}},He.forwardRef=function(O){return{$$typeof:x,render:O}},He.isValidElement=V,He.lazy=function(O){return{$$typeof:y,_payload:{_status:-1,_result:O},_init:X}},He.memo=function(O,Y){return{$$typeof:p,type:O,compare:Y===void 0?null:Y}},He.startTransition=function(O){var Y=E.T,se={};E.T=se;try{var de=O(),ge=E.S;ge!==null&&ge(se,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then($,G)}catch(xe){G(xe)}finally{Y!==null&&se.types!==null&&(Y.types=se.types),E.T=Y}},He.unstable_useCacheRefresh=function(){return E.H.useCacheRefresh()},He.use=function(O){return E.H.use(O)},He.useActionState=function(O,Y,se){return E.H.useActionState(O,Y,se)},He.useCallback=function(O,Y){return E.H.useCallback(O,Y)},He.useContext=function(O){return E.H.useContext(O)},He.useDebugValue=function(){},He.useDeferredValue=function(O,Y){return E.H.useDeferredValue(O,Y)},He.useEffect=function(O,Y){return E.H.useEffect(O,Y)},He.useEffectEvent=function(O){return E.H.useEffectEvent(O)},He.useId=function(){return E.H.useId()},He.useImperativeHandle=function(O,Y,se){return E.H.useImperativeHandle(O,Y,se)},He.useInsertionEffect=function(O,Y){return E.H.useInsertionEffect(O,Y)},He.useLayoutEffect=function(O,Y){return E.H.useLayoutEffect(O,Y)},He.useMemo=function(O,Y){return E.H.useMemo(O,Y)},He.useOptimistic=function(O,Y){return E.H.useOptimistic(O,Y)},He.useReducer=function(O,Y,se){return E.H.useReducer(O,Y,se)},He.useRef=function(O){return E.H.useRef(O)},He.useState=function(O){return E.H.useState(O)},He.useSyncExternalStore=function(O,Y,se){return E.H.useSyncExternalStore(O,Y,se)},He.useTransition=function(){return E.H.useTransition()},He.version="19.2.4",He}var wx;function Jd(){return wx||(wx=1,rd.exports=Gb()),rd.exports}var g=Jd();const Ce=Kg(g);var ld={exports:{}},ws={},sd={exports:{}},id={};/**
19
+ * @license React
20
+ * scheduler.production.js
21
+ *
22
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var Cx;function Wb(){return Cx||(Cx=1,(function(n){function l(M,I){var X=M.length;M.push(I);e:for(;0<X;){var G=X-1>>>1,ce=M[G];if(0<c(ce,I))M[G]=I,M[X]=ce,X=G;else break e}}function s(M){return M.length===0?null:M[0]}function o(M){if(M.length===0)return null;var I=M[0],X=M.pop();if(X!==I){M[0]=X;e:for(var G=0,ce=M.length,O=ce>>>1;G<O;){var Y=2*(G+1)-1,se=M[Y],de=Y+1,ge=M[de];if(0>c(se,X))de<ce&&0>c(ge,se)?(M[G]=ge,M[de]=X,G=de):(M[G]=se,M[Y]=X,G=Y);else if(de<ce&&0>c(ge,X))M[G]=ge,M[de]=X,G=de;else break e}}return I}function c(M,I){var X=M.sortIndex-I.sortIndex;return X!==0?X:M.id-I.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var d=Date,x=d.now();n.unstable_now=function(){return d.now()-x}}var h=[],p=[],y=1,v=null,b=3,j=!1,k=!1,N=!1,C=!1,w=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function H(M){for(var I=s(p);I!==null;){if(I.callback===null)o(p);else if(I.startTime<=M)o(p),I.sortIndex=I.expirationTime,l(h,I);else break;I=s(p)}}function L(M){if(N=!1,H(M),!k)if(s(h)!==null)k=!0,$||($=!0,W());else{var I=s(p);I!==null&&z(L,I.startTime-M)}}var $=!1,E=-1,D=5,R=-1;function B(){return C?!0:!(n.unstable_now()-R<D)}function V(){if(C=!1,$){var M=n.unstable_now();R=M;var I=!0;try{e:{k=!1,N&&(N=!1,A(E),E=-1),j=!0;var X=b;try{t:{for(H(M),v=s(h);v!==null&&!(v.expirationTime>M&&B());){var G=v.callback;if(typeof G=="function"){v.callback=null,b=v.priorityLevel;var ce=G(v.expirationTime<=M);if(M=n.unstable_now(),typeof ce=="function"){v.callback=ce,H(M),I=!0;break t}v===s(h)&&o(h),H(M)}else o(h);v=s(h)}if(v!==null)I=!0;else{var O=s(p);O!==null&&z(L,O.startTime-M),I=!1}}break e}finally{v=null,b=X,j=!1}I=void 0}}finally{I?W():$=!1}}}var W;if(typeof _=="function")W=function(){_(V)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,Q=te.port2;te.port1.onmessage=V,W=function(){Q.postMessage(null)}}else W=function(){w(V,0)};function z(M,I){E=w(function(){M(n.unstable_now())},I)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(M){M.callback=null},n.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<M?Math.floor(1e3/M):5},n.unstable_getCurrentPriorityLevel=function(){return b},n.unstable_next=function(M){switch(b){case 1:case 2:case 3:var I=3;break;default:I=b}var X=b;b=I;try{return M()}finally{b=X}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(M,I){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var X=b;b=M;try{return I()}finally{b=X}},n.unstable_scheduleCallback=function(M,I,X){var G=n.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?G+X:G):X=G,M){case 1:var ce=-1;break;case 2:ce=250;break;case 5:ce=1073741823;break;case 4:ce=1e4;break;default:ce=5e3}return ce=X+ce,M={id:y++,callback:I,priorityLevel:M,startTime:X,expirationTime:ce,sortIndex:-1},X>G?(M.sortIndex=X,l(p,M),s(h)===null&&M===s(p)&&(N?(A(E),E=-1):N=!0,z(L,X-G))):(M.sortIndex=ce,l(h,M),k||j||(k=!0,$||($=!0,W()))),M},n.unstable_shouldYield=B,n.unstable_wrapCallback=function(M){var I=b;return function(){var X=b;b=I;try{return M.apply(this,arguments)}finally{b=X}}}})(id)),id}var Ex;function qb(){return Ex||(Ex=1,sd.exports=Wb()),sd.exports}var od={exports:{}},Zt={};/**
27
+ * @license React
28
+ * react-dom.production.js
29
+ *
30
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var Nx;function Yb(){if(Nx)return Zt;Nx=1;var n=Jd();function l(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var o={d:{f:s,r:function(){throw Error(l(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},c=Symbol.for("react.portal");function f(h,p,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:v==null?null:""+v,children:h,containerInfo:p,implementation:y}}var d=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function x(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Zt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Zt.createPortal=function(h,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(l(299));return f(h,p,null,y)},Zt.flushSync=function(h){var p=d.T,y=o.p;try{if(d.T=null,o.p=2,h)return h()}finally{d.T=p,o.p=y,o.d.f()}},Zt.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,o.d.C(h,p))},Zt.prefetchDNS=function(h){typeof h=="string"&&o.d.D(h)},Zt.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var y=p.as,v=x(y,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,j=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?o.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:b,fetchPriority:j}):y==="script"&&o.d.X(h,{crossOrigin:v,integrity:b,fetchPriority:j,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Zt.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=x(p.as,p.crossOrigin);o.d.M(h,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&o.d.M(h)},Zt.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,v=x(y,p.crossOrigin);o.d.L(h,y,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Zt.preloadModule=function(h,p){if(typeof h=="string")if(p){var y=x(p.as,p.crossOrigin);o.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else o.d.m(h)},Zt.requestFormReset=function(h){o.d.r(h)},Zt.unstable_batchedUpdates=function(h,p){return h(p)},Zt.useFormState=function(h,p,y){return d.H.useFormState(h,p,y)},Zt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Zt.version="19.2.4",Zt}var Tx;function Xg(){if(Tx)return od.exports;Tx=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(l){console.error(l)}}return n(),od.exports=Yb(),od.exports}/**
35
+ * @license React
36
+ * react-dom-client.production.js
37
+ *
38
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ */var Rx;function Kb(){if(Rx)return ws;Rx=1;var n=qb(),l=Jd(),s=Xg();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}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 c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function d(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 x(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 h(e){if(f(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(o(188));return t!==e?null:e}for(var r=e,i=t;;){var u=r.return;if(u===null)break;var m=u.alternate;if(m===null){if(i=u.return,i!==null){r=i;continue}break}if(u.child===m.child){for(m=u.child;m;){if(m===r)return h(u),e;if(m===i)return h(u),t;m=m.sibling}throw Error(o(188))}if(r.return!==i.return)r=u,i=m;else{for(var S=!1,T=u.child;T;){if(T===r){S=!0,r=u,i=m;break}if(T===i){S=!0,i=u,r=m;break}T=T.sibling}if(!S){for(T=m.child;T;){if(T===r){S=!0,r=m,i=u;break}if(T===i){S=!0,i=m,r=u;break}T=T.sibling}if(!S)throw Error(o(189))}}if(r.alternate!==i)throw Error(o(190))}if(r.tag!==3)throw Error(o(188));return r.stateNode.current===r?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,b=Symbol.for("react.element"),j=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),_=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=V&&e[V]||e["@@iterator"],typeof e=="function"?e:null)}var te=Symbol.for("react.client.reference");function Q(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case N:return"Fragment";case w:return"Profiler";case C:return"StrictMode";case L:return"Suspense";case $:return"SuspenseList";case R:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case _:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case H:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case E:return t=e.displayName||null,t!==null?t:Q(e.type)||"Memo";case D:t=e._payload,e=e._init;try{return Q(e(t))}catch{}}return null}var z=Array.isArray,M=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},G=[],ce=-1;function O(e){return{current:e}}function Y(e){0>ce||(e.current=G[ce],G[ce]=null,ce--)}function se(e,t){ce++,G[ce]=e.current,e.current=t}var de=O(null),ge=O(null),xe=O(null),we=O(null);function ie(e,t){switch(se(xe,t),se(ge,e),se(de,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Fh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Fh(t),e=Gh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y(de),se(de,e)}function je(){Y(de),Y(ge),Y(xe)}function Oe(e){e.memoizedState!==null&&se(we,e);var t=de.current,r=Gh(t,e.type);t!==r&&(se(ge,e),se(de,r))}function $e(e){ge.current===e&&(Y(de),Y(ge)),we.current===e&&(Y(we),ys._currentValue=X)}var ae,pe;function fe(e){if(ae===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);ae=t&&t[1]||"",pe=-1<r.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+ae+e+pe}var he=!1;function ye(e,t){if(!e||he)return"";he=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(ee){var Z=ee}Reflect.construct(e,[],le)}else{try{le.call()}catch(ee){Z=ee}e.call(le.prototype)}}else{try{throw Error()}catch(ee){Z=ee}(le=e())&&typeof le.catch=="function"&&le.catch(function(){})}}catch(ee){if(ee&&Z&&typeof ee.stack=="string")return[ee.stack,Z.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=i.DetermineComponentFrameRoot(),S=m[0],T=m[1];if(S&&T){var U=S.split(`
45
+ `),K=T.split(`
46
+ `);for(u=i=0;i<U.length&&!U[i].includes("DetermineComponentFrameRoot");)i++;for(;u<K.length&&!K[u].includes("DetermineComponentFrameRoot");)u++;if(i===U.length||u===K.length)for(i=U.length-1,u=K.length-1;1<=i&&0<=u&&U[i]!==K[u];)u--;for(;1<=i&&0<=u;i--,u--)if(U[i]!==K[u]){if(i!==1||u!==1)do if(i--,u--,0>u||U[i]!==K[u]){var ne=`
47
+ `+U[i].replace(" at new "," at ");return e.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",e.displayName)),ne}while(1<=i&&0<=u);break}}}finally{he=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?fe(r):""}function Be(e,t){switch(e.tag){case 26:case 27:case 5:return fe(e.type);case 16:return fe("Lazy");case 13:return e.child!==t&&t!==null?fe("Suspense Fallback"):fe("Suspense");case 19:return fe("SuspenseList");case 0:case 15:return ye(e.type,!1);case 11:return ye(e.type.render,!1);case 1:return ye(e.type,!0);case 31:return fe("Activity");default:return""}}function Me(e){try{var t="",r=null;do t+=Be(e,r),r=e,e=e.return;while(e);return t}catch(i){return`
48
+ Error generating stack: `+i.message+`
49
+ `+i.stack}}var ue=Object.prototype.hasOwnProperty,De=n.unstable_scheduleCallback,Ie=n.unstable_cancelCallback,Bt=n.unstable_shouldYield,Gt=n.unstable_requestPaint,lt=n.unstable_now,kt=n.unstable_getCurrentPriorityLevel,ve=n.unstable_ImmediatePriority,Mt=n.unstable_UserBlockingPriority,_e=n.unstable_NormalPriority,vt=n.unstable_LowPriority,Qt=n.unstable_IdlePriority,st=n.log,sr=n.unstable_setDisableYieldValue,aa=null,Nt=null;function wt(e){if(typeof st=="function"&&sr(e),Nt&&typeof Nt.setStrictMode=="function")try{Nt.setStrictMode(aa,e)}catch{}}var jt=Math.clz32?Math.clz32:Vn,$n=Math.log,ir=Math.LN2;function Vn(e){return e>>>=0,e===0?32:31-($n(e)/ir|0)|0}var Ge=256,Vt=262144,ra=4194304;function Tt(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 Ll(e,t,r){var i=e.pendingLanes;if(i===0)return 0;var u=0,m=e.suspendedLanes,S=e.pingedLanes;e=e.warmLanes;var T=i&134217727;return T!==0?(i=T&~m,i!==0?u=Tt(i):(S&=T,S!==0?u=Tt(S):r||(r=T&~e,r!==0&&(u=Tt(r))))):(T=i&~m,T!==0?u=Tt(T):S!==0?u=Tt(S):r||(r=i&~e,r!==0&&(u=Tt(r)))),u===0?0:t!==0&&t!==u&&(t&m)===0&&(m=u&-u,r=t&-t,m>=r||m===32&&(r&4194048)!==0)?t:u}function Nn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Fo(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 Cf(){var e=ra;return ra<<=1,(ra&62914560)===0&&(ra=4194304),e}function Go(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function zl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function My(e,t,r,i,u,m){var S=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var T=e.entanglements,U=e.expirationTimes,K=e.hiddenUpdates;for(r=S&~r;0<r;){var ne=31-jt(r),le=1<<ne;T[ne]=0,U[ne]=-1;var Z=K[ne];if(Z!==null)for(K[ne]=null,ne=0;ne<Z.length;ne++){var ee=Z[ne];ee!==null&&(ee.lane&=-536870913)}r&=~le}i!==0&&Ef(e,i,0),m!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=m&~(S&~t))}function Ef(e,t,r){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-jt(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|r&261930}function Nf(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var i=31-jt(r),u=1<<i;u&t|e[i]&t&&(e[i]|=t),r&=~u}}function Tf(e,t){var r=t&-t;return r=(r&42)!==0?1:Wo(r),(r&(e.suspendedLanes|t))!==0?0:r}function Wo(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 qo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Rf(){var e=I.p;return e!==0?e:(e=window.event,e===void 0?32:mx(e.type))}function Af(e,t){var r=I.p;try{return I.p=e,t()}finally{I.p=r}}var Ta=Math.random().toString(36).slice(2),Wt="__reactFiber$"+Ta,on="__reactProps$"+Ta,Lr="__reactContainer$"+Ta,Yo="__reactEvents$"+Ta,Ly="__reactListeners$"+Ta,zy="__reactHandles$"+Ta,Mf="__reactResources$"+Ta,Dl="__reactMarker$"+Ta;function Ko(e){delete e[Wt],delete e[on],delete e[Yo],delete e[Ly],delete e[zy]}function zr(e){var t=e[Wt];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Lr]||r[Wt]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Zh(e);e!==null;){if(r=e[Wt])return r;e=Zh(e)}return t}e=r,r=e.parentNode}return null}function Dr(e){if(e=e[Wt]||e[Lr]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _l(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function _r(e){var t=e[Mf];return t||(t=e[Mf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Pt(e){e[Dl]=!0}var Lf=new Set,zf={};function or(e,t){Or(e,t),Or(e+"Capture",t)}function Or(e,t){for(zf[e]=t,e=0;e<t.length;e++)Lf.add(t[e])}var Dy=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]*$"),Df={},_f={};function _y(e){return ue.call(_f,e)?!0:ue.call(Df,e)?!1:Dy.test(e)?_f[e]=!0:(Df[e]=!0,!1)}function Xs(e,t,r){if(_y(t))if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+r)}}function Qs(e,t,r){if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+r)}}function la(e,t,r,i){if(i===null)e.removeAttribute(r);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(t,r,""+i)}}function Tn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Of(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Oy(e,t,r){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,m=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(S){r=""+S,m.call(this,S)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(S){r=""+S},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Xo(e){if(!e._valueTracker){var t=Of(e)?"checked":"value";e._valueTracker=Oy(e,t,""+e[t])}}function Bf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),i="";return e&&(i=Of(e)?e.checked?"true":"false":e.value),e=i,e!==r?(t.setValue(e),!0):!1}function Zs(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 By=/[\n"\\]/g;function Rn(e){return e.replace(By,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Qo(e,t,r,i,u,m,S,T){e.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.type=S:e.removeAttribute("type"),t!=null?S==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Tn(t)):e.value!==""+Tn(t)&&(e.value=""+Tn(t)):S!=="submit"&&S!=="reset"||e.removeAttribute("value"),t!=null?Zo(e,S,Tn(t)):r!=null?Zo(e,S,Tn(r)):i!=null&&e.removeAttribute("value"),u==null&&m!=null&&(e.defaultChecked=!!m),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?e.name=""+Tn(T):e.removeAttribute("name")}function If(e,t,r,i,u,m,S,T){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.type=m),t!=null||r!=null){if(!(m!=="submit"&&m!=="reset"||t!=null)){Xo(e);return}r=r!=null?""+Tn(r):"",t=t!=null?""+Tn(t):r,T||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=T?e.checked:!!i,e.defaultChecked=!!i,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(e.name=S),Xo(e)}function Zo(e,t,r){t==="number"&&Zs(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function Br(e,t,r,i){if(e=e.options,t){t={};for(var u=0;u<r.length;u++)t["$"+r[u]]=!0;for(r=0;r<e.length;r++)u=t.hasOwnProperty("$"+e[r].value),e[r].selected!==u&&(e[r].selected=u),u&&i&&(e[r].defaultSelected=!0)}else{for(r=""+Tn(r),t=null,u=0;u<e.length;u++){if(e[u].value===r){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Hf(e,t,r){if(t!=null&&(t=""+Tn(t),t!==e.value&&(e.value=t),r==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=r!=null?""+Tn(r):""}function Uf(e,t,r,i){if(t==null){if(i!=null){if(r!=null)throw Error(o(92));if(z(i)){if(1<i.length)throw Error(o(93));i=i[0]}r=i}r==null&&(r=""),t=r}r=Tn(t),e.defaultValue=r,i=e.textContent,i===r&&i!==""&&i!==null&&(e.value=i),Xo(e)}function Ir(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Iy=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 $f(e,t,r){var i=t.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,r):typeof r!="number"||r===0||Iy.has(t)?t==="float"?e.cssFloat=r:e[t]=(""+r).trim():e[t]=r+"px"}function Vf(e,t,r){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,r!=null){for(var i in r)!r.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var u in t)i=t[u],t.hasOwnProperty(u)&&r[u]!==i&&$f(e,u,i)}else for(var m in t)t.hasOwnProperty(m)&&$f(e,m,t[m])}function Jo(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 Hy=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"]]),Uy=/^[\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 Js(e){return Uy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function sa(){}var ec=null;function tc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Hr=null,Ur=null;function Pf(e){var t=Dr(e);if(t&&(e=t.stateNode)){var r=e[on]||null;e:switch(e=t.stateNode,t.type){case"input":if(Qo(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+Rn(""+t)+'"][type="radio"]'),t=0;t<r.length;t++){var i=r[t];if(i!==e&&i.form===e.form){var u=i[on]||null;if(!u)throw Error(o(90));Qo(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<r.length;t++)i=r[t],i.form===e.form&&Bf(i)}break e;case"textarea":Hf(e,r.value,r.defaultValue);break e;case"select":t=r.value,t!=null&&Br(e,!!r.multiple,t,!1)}}}var nc=!1;function Ff(e,t,r){if(nc)return e(t,r);nc=!0;try{var i=e(t);return i}finally{if(nc=!1,(Hr!==null||Ur!==null)&&(Ui(),Hr&&(t=Hr,e=Ur,Ur=Hr=null,Pf(t),e)))for(t=0;t<e.length;t++)Pf(e[t])}}function Ol(e,t){var r=e.stateNode;if(r===null)return null;var i=r[on]||null;if(i===null)return null;r=i[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":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(o(231,t,typeof r));return r}var ia=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ac=!1;if(ia)try{var Bl={};Object.defineProperty(Bl,"passive",{get:function(){ac=!0}}),window.addEventListener("test",Bl,Bl),window.removeEventListener("test",Bl,Bl)}catch{ac=!1}var Ra=null,rc=null,ei=null;function Gf(){if(ei)return ei;var e,t=rc,r=t.length,i,u="value"in Ra?Ra.value:Ra.textContent,m=u.length;for(e=0;e<r&&t[e]===u[e];e++);var S=r-e;for(i=1;i<=S&&t[r-i]===u[m-i];i++);return ei=u.slice(e,1<i?1-i:void 0)}function ti(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 ni(){return!0}function Wf(){return!1}function cn(e){function t(r,i,u,m,S){this._reactName=r,this._targetInst=u,this.type=i,this.nativeEvent=m,this.target=S,this.currentTarget=null;for(var T in e)e.hasOwnProperty(T)&&(r=e[T],this[T]=r?r(m):m[T]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?ni:Wf,this.isPropagationStopped=Wf,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=ni)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=ni)},persist:function(){},isPersistent:ni}),t}var cr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ai=cn(cr),Il=v({},cr,{view:0,detail:0}),$y=cn(Il),lc,sc,Hl,ri=v({},Il,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:oc,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!==Hl&&(Hl&&e.type==="mousemove"?(lc=e.screenX-Hl.screenX,sc=e.screenY-Hl.screenY):sc=lc=0,Hl=e),lc)},movementY:function(e){return"movementY"in e?e.movementY:sc}}),qf=cn(ri),Vy=v({},ri,{dataTransfer:0}),Py=cn(Vy),Fy=v({},Il,{relatedTarget:0}),ic=cn(Fy),Gy=v({},cr,{animationName:0,elapsedTime:0,pseudoElement:0}),Wy=cn(Gy),qy=v({},cr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Yy=cn(qy),Ky=v({},cr,{data:0}),Yf=cn(Ky),Xy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Qy={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"},Zy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Jy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Zy[e])?!!t[e]:!1}function oc(){return Jy}var e1=v({},Il,{key:function(e){if(e.key){var t=Xy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ti(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Qy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:oc,charCode:function(e){return e.type==="keypress"?ti(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ti(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),t1=cn(e1),n1=v({},ri,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Kf=cn(n1),a1=v({},Il,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:oc}),r1=cn(a1),l1=v({},cr,{propertyName:0,elapsedTime:0,pseudoElement:0}),s1=cn(l1),i1=v({},ri,{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}),o1=cn(i1),c1=v({},cr,{newState:0,oldState:0}),u1=cn(c1),d1=[9,13,27,32],cc=ia&&"CompositionEvent"in window,Ul=null;ia&&"documentMode"in document&&(Ul=document.documentMode);var f1=ia&&"TextEvent"in window&&!Ul,Xf=ia&&(!cc||Ul&&8<Ul&&11>=Ul),Qf=" ",Zf=!1;function Jf(e,t){switch(e){case"keyup":return d1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ep(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $r=!1;function p1(e,t){switch(e){case"compositionend":return ep(t);case"keypress":return t.which!==32?null:(Zf=!0,Qf);case"textInput":return e=t.data,e===Qf&&Zf?null:e;default:return null}}function m1(e,t){if($r)return e==="compositionend"||!cc&&Jf(e,t)?(e=Gf(),ei=rc=Ra=null,$r=!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 Xf&&t.locale!=="ko"?null:t.data;default:return null}}var h1={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 tp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!h1[e.type]:t==="textarea"}function np(e,t,r,i){Hr?Ur?Ur.push(i):Ur=[i]:Hr=i,t=qi(t,"onChange"),0<t.length&&(r=new ai("onChange","change",null,r,i),e.push({event:r,listeners:t}))}var $l=null,Vl=null;function x1(e){Ih(e,0)}function li(e){var t=_l(e);if(Bf(t))return e}function ap(e,t){if(e==="change")return t}var rp=!1;if(ia){var uc;if(ia){var dc="oninput"in document;if(!dc){var lp=document.createElement("div");lp.setAttribute("oninput","return;"),dc=typeof lp.oninput=="function"}uc=dc}else uc=!1;rp=uc&&(!document.documentMode||9<document.documentMode)}function sp(){$l&&($l.detachEvent("onpropertychange",ip),Vl=$l=null)}function ip(e){if(e.propertyName==="value"&&li(Vl)){var t=[];np(t,Vl,e,tc(e)),Ff(x1,t)}}function g1(e,t,r){e==="focusin"?(sp(),$l=t,Vl=r,$l.attachEvent("onpropertychange",ip)):e==="focusout"&&sp()}function v1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return li(Vl)}function y1(e,t){if(e==="click")return li(t)}function b1(e,t){if(e==="input"||e==="change")return li(t)}function S1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var hn=typeof Object.is=="function"?Object.is:S1;function Pl(e,t){if(hn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(i=0;i<r.length;i++){var u=r[i];if(!ue.call(t,u)||!hn(e[u],t[u]))return!1}return!0}function op(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function cp(e,t){var r=op(e);e=0;for(var i;r;){if(r.nodeType===3){if(i=e+r.textContent.length,e<=t&&i>=t)return{node:r,offset:t-e};e=i}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=op(r)}}function up(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?up(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function dp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Zs(e.document);t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Zs(e.document)}return t}function fc(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 j1=ia&&"documentMode"in document&&11>=document.documentMode,Vr=null,pc=null,Fl=null,mc=!1;function fp(e,t,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;mc||Vr==null||Vr!==Zs(i)||(i=Vr,"selectionStart"in i&&fc(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Fl&&Pl(Fl,i)||(Fl=i,i=qi(pc,"onSelect"),0<i.length&&(t=new ai("onSelect","select",null,t,r),e.push({event:t,listeners:i}),t.target=Vr)))}function ur(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Pr={animationend:ur("Animation","AnimationEnd"),animationiteration:ur("Animation","AnimationIteration"),animationstart:ur("Animation","AnimationStart"),transitionrun:ur("Transition","TransitionRun"),transitionstart:ur("Transition","TransitionStart"),transitioncancel:ur("Transition","TransitionCancel"),transitionend:ur("Transition","TransitionEnd")},hc={},pp={};ia&&(pp=document.createElement("div").style,"AnimationEvent"in window||(delete Pr.animationend.animation,delete Pr.animationiteration.animation,delete Pr.animationstart.animation),"TransitionEvent"in window||delete Pr.transitionend.transition);function dr(e){if(hc[e])return hc[e];if(!Pr[e])return e;var t=Pr[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in pp)return hc[e]=t[r];return e}var mp=dr("animationend"),hp=dr("animationiteration"),xp=dr("animationstart"),k1=dr("transitionrun"),w1=dr("transitionstart"),C1=dr("transitioncancel"),gp=dr("transitionend"),vp=new Map,xc="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(" ");xc.push("scrollEnd");function Pn(e,t){vp.set(e,t),or(t,[e])}var si=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)},An=[],Fr=0,gc=0;function ii(){for(var e=Fr,t=gc=Fr=0;t<e;){var r=An[t];An[t++]=null;var i=An[t];An[t++]=null;var u=An[t];An[t++]=null;var m=An[t];if(An[t++]=null,i!==null&&u!==null){var S=i.pending;S===null?u.next=u:(u.next=S.next,S.next=u),i.pending=u}m!==0&&yp(r,u,m)}}function oi(e,t,r,i){An[Fr++]=e,An[Fr++]=t,An[Fr++]=r,An[Fr++]=i,gc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function vc(e,t,r,i){return oi(e,t,r,i),ci(e)}function fr(e,t){return oi(e,null,null,t),ci(e)}function yp(e,t,r){e.lanes|=r;var i=e.alternate;i!==null&&(i.lanes|=r);for(var u=!1,m=e.return;m!==null;)m.childLanes|=r,i=m.alternate,i!==null&&(i.childLanes|=r),m.tag===22&&(e=m.stateNode,e===null||e._visibility&1||(u=!0)),e=m,m=m.return;return e.tag===3?(m=e.stateNode,u&&t!==null&&(u=31-jt(r),e=m.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=r|536870912),m):null}function ci(e){if(50<fs)throw fs=0,Nu=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Gr={};function E1(e,t,r,i){this.tag=e,this.key=r,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=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xn(e,t,r,i){return new E1(e,t,r,i)}function yc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function oa(e,t){var r=e.alternate;return r===null?(r=xn(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function bp(e,t){e.flags&=65011714;var r=e.alternate;return r===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=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,t=r.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ui(e,t,r,i,u,m){var S=0;if(i=e,typeof e=="function")yc(e)&&(S=1);else if(typeof e=="string")S=Mb(e,r,de.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case R:return e=xn(31,r,t,u),e.elementType=R,e.lanes=m,e;case N:return pr(r.children,u,m,t);case C:S=8,u|=24;break;case w:return e=xn(12,r,t,u|2),e.elementType=w,e.lanes=m,e;case L:return e=xn(13,r,t,u),e.elementType=L,e.lanes=m,e;case $:return e=xn(19,r,t,u),e.elementType=$,e.lanes=m,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _:S=10;break e;case A:S=9;break e;case H:S=11;break e;case E:S=14;break e;case D:S=16,i=null;break e}S=29,r=Error(o(130,e===null?"null":typeof e,"")),i=null}return t=xn(S,r,t,u),t.elementType=e,t.type=i,t.lanes=m,t}function pr(e,t,r,i){return e=xn(7,e,i,t),e.lanes=r,e}function bc(e,t,r){return e=xn(6,e,null,t),e.lanes=r,e}function Sp(e){var t=xn(18,null,null,0);return t.stateNode=e,t}function Sc(e,t,r){return t=xn(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var jp=new WeakMap;function Mn(e,t){if(typeof e=="object"&&e!==null){var r=jp.get(e);return r!==void 0?r:(t={value:e,source:t,stack:Me(t)},jp.set(e,t),t)}return{value:e,source:t,stack:Me(t)}}var Wr=[],qr=0,di=null,Gl=0,Ln=[],zn=0,Aa=null,Kn=1,Xn="";function ca(e,t){Wr[qr++]=Gl,Wr[qr++]=di,di=e,Gl=t}function kp(e,t,r){Ln[zn++]=Kn,Ln[zn++]=Xn,Ln[zn++]=Aa,Aa=e;var i=Kn;e=Xn;var u=32-jt(i)-1;i&=~(1<<u),r+=1;var m=32-jt(t)+u;if(30<m){var S=u-u%5;m=(i&(1<<S)-1).toString(32),i>>=S,u-=S,Kn=1<<32-jt(t)+u|r<<u|i,Xn=m+e}else Kn=1<<m|r<<u|i,Xn=e}function jc(e){e.return!==null&&(ca(e,1),kp(e,1,0))}function kc(e){for(;e===di;)di=Wr[--qr],Wr[qr]=null,Gl=Wr[--qr],Wr[qr]=null;for(;e===Aa;)Aa=Ln[--zn],Ln[zn]=null,Xn=Ln[--zn],Ln[zn]=null,Kn=Ln[--zn],Ln[zn]=null}function wp(e,t){Ln[zn++]=Kn,Ln[zn++]=Xn,Ln[zn++]=Aa,Kn=t.id,Xn=t.overflow,Aa=e}var qt=null,mt=null,Ze=!1,Ma=null,Dn=!1,wc=Error(o(519));function La(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Wl(Mn(t,e)),wc}function Cp(e){var t=e.stateNode,r=e.type,i=e.memoizedProps;switch(t[Wt]=e,t[on]=i,r){case"dialog":Ke("cancel",t),Ke("close",t);break;case"iframe":case"object":case"embed":Ke("load",t);break;case"video":case"audio":for(r=0;r<ms.length;r++)Ke(ms[r],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),If(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Ke("invalid",t);break;case"textarea":Ke("invalid",t),Uf(t,i.value,i.defaultValue,i.children)}r=i.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||t.textContent===""+r||i.suppressHydrationWarning===!0||Vh(t.textContent,r)?(i.popover!=null&&(Ke("beforetoggle",t),Ke("toggle",t)),i.onScroll!=null&&Ke("scroll",t),i.onScrollEnd!=null&&Ke("scrollend",t),i.onClick!=null&&(t.onclick=sa),t=!0):t=!1,t||La(e,!0)}function Ep(e){for(qt=e.return;qt;)switch(qt.tag){case 5:case 31:case 13:Dn=!1;return;case 27:case 3:Dn=!0;return;default:qt=qt.return}}function Yr(e){if(e!==qt)return!1;if(!Ze)return Ep(e),Ze=!0,!1;var t=e.tag,r;if((r=t!==3&&t!==27)&&((r=t===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||Vu(e.type,e.memoizedProps)),r=!r),r&&mt&&La(e),Ep(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));mt=Qh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));mt=Qh(e)}else t===27?(t=mt,Wa(e.type)?(e=qu,qu=null,mt=e):mt=t):mt=qt?On(e.stateNode.nextSibling):null;return!0}function mr(){mt=qt=null,Ze=!1}function Cc(){var e=Ma;return e!==null&&(pn===null?pn=e:pn.push.apply(pn,e),Ma=null),e}function Wl(e){Ma===null?Ma=[e]:Ma.push(e)}var Ec=O(null),hr=null,ua=null;function za(e,t,r){se(Ec,t._currentValue),t._currentValue=r}function da(e){e._currentValue=Ec.current,Y(Ec)}function Nc(e,t,r){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===r)break;e=e.return}}function Tc(e,t,r,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var m=u.dependencies;if(m!==null){var S=u.child;m=m.firstContext;e:for(;m!==null;){var T=m;m=u;for(var U=0;U<t.length;U++)if(T.context===t[U]){m.lanes|=r,T=m.alternate,T!==null&&(T.lanes|=r),Nc(m.return,r,e),i||(S=null);break e}m=T.next}}else if(u.tag===18){if(S=u.return,S===null)throw Error(o(341));S.lanes|=r,m=S.alternate,m!==null&&(m.lanes|=r),Nc(S,r,e),S=null}else S=u.child;if(S!==null)S.return=u;else for(S=u;S!==null;){if(S===e){S=null;break}if(u=S.sibling,u!==null){u.return=S.return,S=u;break}S=S.return}u=S}}function Kr(e,t,r,i){e=null;for(var u=t,m=!1;u!==null;){if(!m){if((u.flags&524288)!==0)m=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var S=u.alternate;if(S===null)throw Error(o(387));if(S=S.memoizedProps,S!==null){var T=u.type;hn(u.pendingProps.value,S.value)||(e!==null?e.push(T):e=[T])}}else if(u===we.current){if(S=u.alternate,S===null)throw Error(o(387));S.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(ys):e=[ys])}u=u.return}e!==null&&Tc(t,e,r,i),t.flags|=262144}function fi(e){for(e=e.firstContext;e!==null;){if(!hn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function xr(e){hr=e,ua=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yt(e){return Np(hr,e)}function pi(e,t){return hr===null&&xr(e),Np(e,t)}function Np(e,t){var r=t._currentValue;if(t={context:t,memoizedValue:r,next:null},ua===null){if(e===null)throw Error(o(308));ua=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ua=ua.next=t;return r}var N1=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(r,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(r){return r()})}},T1=n.unstable_scheduleCallback,R1=n.unstable_NormalPriority,Lt={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Rc(){return{controller:new N1,data:new Map,refCount:0}}function ql(e){e.refCount--,e.refCount===0&&T1(R1,function(){e.controller.abort()})}var Yl=null,Ac=0,Xr=0,Qr=null;function A1(e,t){if(Yl===null){var r=Yl=[];Ac=0,Xr=zu(),Qr={status:"pending",value:void 0,then:function(i){r.push(i)}}}return Ac++,t.then(Tp,Tp),t}function Tp(){if(--Ac===0&&Yl!==null){Qr!==null&&(Qr.status="fulfilled");var e=Yl;Yl=null,Xr=0,Qr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function M1(e,t){var r=[],i={status:"pending",value:null,reason:null,then:function(u){r.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<r.length;u++)(0,r[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<r.length;u++)(0,r[u])(void 0)}),i}var Rp=M.S;M.S=function(e,t){fh=lt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&A1(e,t),Rp!==null&&Rp(e,t)};var gr=O(null);function Mc(){var e=gr.current;return e!==null?e:pt.pooledCache}function mi(e,t){t===null?se(gr,gr.current):se(gr,t.pool)}function Ap(){var e=Mc();return e===null?null:{parent:Lt._currentValue,pool:e}}var Zr=Error(o(460)),Lc=Error(o(474)),hi=Error(o(542)),xi={then:function(){}};function Mp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Lp(e,t,r){switch(r=e[r],r===void 0?e.push(t):r!==t&&(t.then(sa,sa),t=r),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Dp(e),e;default:if(typeof t.status=="string")t.then(sa,sa);else{if(e=pt,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Dp(e),e}throw yr=t,Zr}}function vr(e){try{var t=e._init;return t(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(yr=r,Zr):r}}var yr=null;function zp(){if(yr===null)throw Error(o(459));var e=yr;return yr=null,e}function Dp(e){if(e===Zr||e===hi)throw Error(o(483))}var Jr=null,Kl=0;function gi(e){var t=Kl;return Kl+=1,Jr===null&&(Jr=[]),Lp(Jr,e,t)}function Xl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function vi(e,t){throw t.$$typeof===b?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function _p(e){function t(F,P){if(e){var q=F.deletions;q===null?(F.deletions=[P],F.flags|=16):q.push(P)}}function r(F,P){if(!e)return null;for(;P!==null;)t(F,P),P=P.sibling;return null}function i(F){for(var P=new Map;F!==null;)F.key!==null?P.set(F.key,F):P.set(F.index,F),F=F.sibling;return P}function u(F,P){return F=oa(F,P),F.index=0,F.sibling=null,F}function m(F,P,q){return F.index=q,e?(q=F.alternate,q!==null?(q=q.index,q<P?(F.flags|=67108866,P):q):(F.flags|=67108866,P)):(F.flags|=1048576,P)}function S(F){return e&&F.alternate===null&&(F.flags|=67108866),F}function T(F,P,q,re){return P===null||P.tag!==6?(P=bc(q,F.mode,re),P.return=F,P):(P=u(P,q),P.return=F,P)}function U(F,P,q,re){var Te=q.type;return Te===N?ne(F,P,q.props.children,re,q.key):P!==null&&(P.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===D&&vr(Te)===P.type)?(P=u(P,q.props),Xl(P,q),P.return=F,P):(P=ui(q.type,q.key,q.props,null,F.mode,re),Xl(P,q),P.return=F,P)}function K(F,P,q,re){return P===null||P.tag!==4||P.stateNode.containerInfo!==q.containerInfo||P.stateNode.implementation!==q.implementation?(P=Sc(q,F.mode,re),P.return=F,P):(P=u(P,q.children||[]),P.return=F,P)}function ne(F,P,q,re,Te){return P===null||P.tag!==7?(P=pr(q,F.mode,re,Te),P.return=F,P):(P=u(P,q),P.return=F,P)}function le(F,P,q){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return P=bc(""+P,F.mode,q),P.return=F,P;if(typeof P=="object"&&P!==null){switch(P.$$typeof){case j:return q=ui(P.type,P.key,P.props,null,F.mode,q),Xl(q,P),q.return=F,q;case k:return P=Sc(P,F.mode,q),P.return=F,P;case D:return P=vr(P),le(F,P,q)}if(z(P)||W(P))return P=pr(P,F.mode,q,null),P.return=F,P;if(typeof P.then=="function")return le(F,gi(P),q);if(P.$$typeof===_)return le(F,pi(F,P),q);vi(F,P)}return null}function Z(F,P,q,re){var Te=P!==null?P.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return Te!==null?null:T(F,P,""+q,re);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case j:return q.key===Te?U(F,P,q,re):null;case k:return q.key===Te?K(F,P,q,re):null;case D:return q=vr(q),Z(F,P,q,re)}if(z(q)||W(q))return Te!==null?null:ne(F,P,q,re,null);if(typeof q.then=="function")return Z(F,P,gi(q),re);if(q.$$typeof===_)return Z(F,P,pi(F,q),re);vi(F,q)}return null}function ee(F,P,q,re,Te){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return F=F.get(q)||null,T(P,F,""+re,Te);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case j:return F=F.get(re.key===null?q:re.key)||null,U(P,F,re,Te);case k:return F=F.get(re.key===null?q:re.key)||null,K(P,F,re,Te);case D:return re=vr(re),ee(F,P,q,re,Te)}if(z(re)||W(re))return F=F.get(q)||null,ne(P,F,re,Te,null);if(typeof re.then=="function")return ee(F,P,q,gi(re),Te);if(re.$$typeof===_)return ee(F,P,q,pi(P,re),Te);vi(P,re)}return null}function Se(F,P,q,re){for(var Te=null,et=null,ke=P,Pe=P=0,Qe=null;ke!==null&&Pe<q.length;Pe++){ke.index>Pe?(Qe=ke,ke=null):Qe=ke.sibling;var tt=Z(F,ke,q[Pe],re);if(tt===null){ke===null&&(ke=Qe);break}e&&ke&&tt.alternate===null&&t(F,ke),P=m(tt,P,Pe),et===null?Te=tt:et.sibling=tt,et=tt,ke=Qe}if(Pe===q.length)return r(F,ke),Ze&&ca(F,Pe),Te;if(ke===null){for(;Pe<q.length;Pe++)ke=le(F,q[Pe],re),ke!==null&&(P=m(ke,P,Pe),et===null?Te=ke:et.sibling=ke,et=ke);return Ze&&ca(F,Pe),Te}for(ke=i(ke);Pe<q.length;Pe++)Qe=ee(ke,F,Pe,q[Pe],re),Qe!==null&&(e&&Qe.alternate!==null&&ke.delete(Qe.key===null?Pe:Qe.key),P=m(Qe,P,Pe),et===null?Te=Qe:et.sibling=Qe,et=Qe);return e&&ke.forEach(function(Qa){return t(F,Qa)}),Ze&&ca(F,Pe),Te}function Ae(F,P,q,re){if(q==null)throw Error(o(151));for(var Te=null,et=null,ke=P,Pe=P=0,Qe=null,tt=q.next();ke!==null&&!tt.done;Pe++,tt=q.next()){ke.index>Pe?(Qe=ke,ke=null):Qe=ke.sibling;var Qa=Z(F,ke,tt.value,re);if(Qa===null){ke===null&&(ke=Qe);break}e&&ke&&Qa.alternate===null&&t(F,ke),P=m(Qa,P,Pe),et===null?Te=Qa:et.sibling=Qa,et=Qa,ke=Qe}if(tt.done)return r(F,ke),Ze&&ca(F,Pe),Te;if(ke===null){for(;!tt.done;Pe++,tt=q.next())tt=le(F,tt.value,re),tt!==null&&(P=m(tt,P,Pe),et===null?Te=tt:et.sibling=tt,et=tt);return Ze&&ca(F,Pe),Te}for(ke=i(ke);!tt.done;Pe++,tt=q.next())tt=ee(ke,F,Pe,tt.value,re),tt!==null&&(e&&tt.alternate!==null&&ke.delete(tt.key===null?Pe:tt.key),P=m(tt,P,Pe),et===null?Te=tt:et.sibling=tt,et=tt);return e&&ke.forEach(function(Vb){return t(F,Vb)}),Ze&&ca(F,Pe),Te}function dt(F,P,q,re){if(typeof q=="object"&&q!==null&&q.type===N&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case j:e:{for(var Te=q.key;P!==null;){if(P.key===Te){if(Te=q.type,Te===N){if(P.tag===7){r(F,P.sibling),re=u(P,q.props.children),re.return=F,F=re;break e}}else if(P.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===D&&vr(Te)===P.type){r(F,P.sibling),re=u(P,q.props),Xl(re,q),re.return=F,F=re;break e}r(F,P);break}else t(F,P);P=P.sibling}q.type===N?(re=pr(q.props.children,F.mode,re,q.key),re.return=F,F=re):(re=ui(q.type,q.key,q.props,null,F.mode,re),Xl(re,q),re.return=F,F=re)}return S(F);case k:e:{for(Te=q.key;P!==null;){if(P.key===Te)if(P.tag===4&&P.stateNode.containerInfo===q.containerInfo&&P.stateNode.implementation===q.implementation){r(F,P.sibling),re=u(P,q.children||[]),re.return=F,F=re;break e}else{r(F,P);break}else t(F,P);P=P.sibling}re=Sc(q,F.mode,re),re.return=F,F=re}return S(F);case D:return q=vr(q),dt(F,P,q,re)}if(z(q))return Se(F,P,q,re);if(W(q)){if(Te=W(q),typeof Te!="function")throw Error(o(150));return q=Te.call(q),Ae(F,P,q,re)}if(typeof q.then=="function")return dt(F,P,gi(q),re);if(q.$$typeof===_)return dt(F,P,pi(F,q),re);vi(F,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,P!==null&&P.tag===6?(r(F,P.sibling),re=u(P,q),re.return=F,F=re):(r(F,P),re=bc(q,F.mode,re),re.return=F,F=re),S(F)):r(F,P)}return function(F,P,q,re){try{Kl=0;var Te=dt(F,P,q,re);return Jr=null,Te}catch(ke){if(ke===Zr||ke===hi)throw ke;var et=xn(29,ke,null,F.mode);return et.lanes=re,et.return=F,et}finally{}}}var br=_p(!0),Op=_p(!1),Da=!1;function zc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Dc(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 _a(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Oa(e,t,r){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(at&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=ci(e),yp(e,null,r),t}return oi(e,i,t,r),ci(e)}function Ql(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,Nf(e,r)}}function _c(e,t){var r=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,r===i)){var u=null,m=null;if(r=r.firstBaseUpdate,r!==null){do{var S={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};m===null?u=m=S:m=m.next=S,r=r.next}while(r!==null);m===null?u=m=t:m=m.next=t}else u=m=t;r={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:m,shared:i.shared,callbacks:i.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}var Oc=!1;function Zl(){if(Oc){var e=Qr;if(e!==null)throw e}}function Jl(e,t,r,i){Oc=!1;var u=e.updateQueue;Da=!1;var m=u.firstBaseUpdate,S=u.lastBaseUpdate,T=u.shared.pending;if(T!==null){u.shared.pending=null;var U=T,K=U.next;U.next=null,S===null?m=K:S.next=K,S=U;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,T=ne.lastBaseUpdate,T!==S&&(T===null?ne.firstBaseUpdate=K:T.next=K,ne.lastBaseUpdate=U))}if(m!==null){var le=u.baseState;S=0,ne=K=U=null,T=m;do{var Z=T.lane&-536870913,ee=Z!==T.lane;if(ee?(Xe&Z)===Z:(i&Z)===Z){Z!==0&&Z===Xr&&(Oc=!0),ne!==null&&(ne=ne.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Se=e,Ae=T;Z=t;var dt=r;switch(Ae.tag){case 1:if(Se=Ae.payload,typeof Se=="function"){le=Se.call(dt,le,Z);break e}le=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ae.payload,Z=typeof Se=="function"?Se.call(dt,le,Z):Se,Z==null)break e;le=v({},le,Z);break e;case 2:Da=!0}}Z=T.callback,Z!==null&&(e.flags|=64,ee&&(e.flags|=8192),ee=u.callbacks,ee===null?u.callbacks=[Z]:ee.push(Z))}else ee={lane:Z,tag:T.tag,payload:T.payload,callback:T.callback,next:null},ne===null?(K=ne=ee,U=le):ne=ne.next=ee,S|=Z;if(T=T.next,T===null){if(T=u.shared.pending,T===null)break;ee=T,T=ee.next,ee.next=null,u.lastBaseUpdate=ee,u.shared.pending=null}}while(!0);ne===null&&(U=le),u.baseState=U,u.firstBaseUpdate=K,u.lastBaseUpdate=ne,m===null&&(u.shared.lanes=0),$a|=S,e.lanes=S,e.memoizedState=le}}function Bp(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Ip(e,t){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)Bp(r[e],t)}var el=O(null),yi=O(0);function Hp(e,t){e=ba,se(yi,e),se(el,t),ba=e|t.baseLanes}function Bc(){se(yi,ba),se(el,el.current)}function Ic(){ba=yi.current,Y(el),Y(yi)}var gn=O(null),_n=null;function Ba(e){var t=e.alternate;se(Rt,Rt.current&1),se(gn,e),_n===null&&(t===null||el.current!==null||t.memoizedState!==null)&&(_n=e)}function Hc(e){se(Rt,Rt.current),se(gn,e),_n===null&&(_n=e)}function Up(e){e.tag===22?(se(Rt,Rt.current),se(gn,e),_n===null&&(_n=e)):Ia()}function Ia(){se(Rt,Rt.current),se(gn,gn.current)}function vn(e){Y(gn),_n===e&&(_n=null),Y(Rt)}var Rt=O(0);function bi(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Gu(r)||Wu(r)))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 fa=0,Ve=null,ct=null,zt=null,Si=!1,tl=!1,Sr=!1,ji=0,es=0,nl=null,L1=0;function Ct(){throw Error(o(321))}function Uc(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!hn(e[r],t[r]))return!1;return!0}function $c(e,t,r,i,u,m){return fa=m,Ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?km:nu,Sr=!1,m=r(i,u),Sr=!1,tl&&(m=Vp(t,r,i,u)),$p(e),m}function $p(e){M.H=as;var t=ct!==null&&ct.next!==null;if(fa=0,zt=ct=Ve=null,Si=!1,es=0,nl=null,t)throw Error(o(300));e===null||Dt||(e=e.dependencies,e!==null&&fi(e)&&(Dt=!0))}function Vp(e,t,r,i){Ve=e;var u=0;do{if(tl&&(nl=null),es=0,tl=!1,25<=u)throw Error(o(301));if(u+=1,zt=ct=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}M.H=wm,m=t(r,i)}while(tl);return m}function z1(){var e=M.H,t=e.useState()[0];return t=typeof t.then=="function"?ts(t):t,e=e.useState()[0],(ct!==null?ct.memoizedState:null)!==e&&(Ve.flags|=1024),t}function Vc(){var e=ji!==0;return ji=0,e}function Pc(e,t,r){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r}function Fc(e){if(Si){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Si=!1}fa=0,zt=ct=Ve=null,tl=!1,es=ji=0,nl=null}function tn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zt===null?Ve.memoizedState=zt=e:zt=zt.next=e,zt}function At(){if(ct===null){var e=Ve.alternate;e=e!==null?e.memoizedState:null}else e=ct.next;var t=zt===null?Ve.memoizedState:zt.next;if(t!==null)zt=t,ct=e;else{if(e===null)throw Ve.alternate===null?Error(o(467)):Error(o(310));ct=e,e={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},zt===null?Ve.memoizedState=zt=e:zt=zt.next=e}return zt}function ki(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ts(e){var t=es;return es+=1,nl===null&&(nl=[]),e=Lp(nl,e,t),t=Ve,(zt===null?t.memoizedState:zt.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?km:nu),e}function wi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ts(e);if(e.$$typeof===_)return Yt(e)}throw Error(o(438,String(e)))}function Gc(e){var t=null,r=Ve.updateQueue;if(r!==null&&(t=r.memoCache),t==null){var i=Ve.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),r===null&&(r=ki(),Ve.updateQueue=r),r.memoCache=t,r=t.data[t.index],r===void 0)for(r=t.data[t.index]=Array(e),i=0;i<e;i++)r[i]=B;return t.index++,r}function pa(e,t){return typeof t=="function"?t(e):t}function Ci(e){var t=At();return Wc(t,ct,e)}function Wc(e,t,r){var i=e.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=r;var u=e.baseQueue,m=i.pending;if(m!==null){if(u!==null){var S=u.next;u.next=m.next,m.next=S}t.baseQueue=u=m,i.pending=null}if(m=e.baseState,u===null)e.memoizedState=m;else{t=u.next;var T=S=null,U=null,K=t,ne=!1;do{var le=K.lane&-536870913;if(le!==K.lane?(Xe&le)===le:(fa&le)===le){var Z=K.revertLane;if(Z===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),le===Xr&&(ne=!0);else if((fa&Z)===Z){K=K.next,Z===Xr&&(ne=!0);continue}else le={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},U===null?(T=U=le,S=m):U=U.next=le,Ve.lanes|=Z,$a|=Z;le=K.action,Sr&&r(m,le),m=K.hasEagerState?K.eagerState:r(m,le)}else Z={lane:le,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},U===null?(T=U=Z,S=m):U=U.next=Z,Ve.lanes|=le,$a|=le;K=K.next}while(K!==null&&K!==t);if(U===null?S=m:U.next=T,!hn(m,e.memoizedState)&&(Dt=!0,ne&&(r=Qr,r!==null)))throw r;e.memoizedState=m,e.baseState=S,e.baseQueue=U,i.lastRenderedState=m}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function qc(e){var t=At(),r=t.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=e;var i=r.dispatch,u=r.pending,m=t.memoizedState;if(u!==null){r.pending=null;var S=u=u.next;do m=e(m,S.action),S=S.next;while(S!==u);hn(m,t.memoizedState)||(Dt=!0),t.memoizedState=m,t.baseQueue===null&&(t.baseState=m),r.lastRenderedState=m}return[m,i]}function Pp(e,t,r){var i=Ve,u=At(),m=Ze;if(m){if(r===void 0)throw Error(o(407));r=r()}else r=t();var S=!hn((ct||u).memoizedState,r);if(S&&(u.memoizedState=r,Dt=!0),u=u.queue,Xc(Wp.bind(null,i,u,e),[e]),u.getSnapshot!==t||S||zt!==null&&zt.memoizedState.tag&1){if(i.flags|=2048,al(9,{destroy:void 0},Gp.bind(null,i,u,r,t),null),pt===null)throw Error(o(349));m||(fa&127)!==0||Fp(i,t,r)}return r}function Fp(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Ve.updateQueue,t===null?(t=ki(),Ve.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Gp(e,t,r,i){t.value=r,t.getSnapshot=i,qp(t)&&Yp(e)}function Wp(e,t,r){return r(function(){qp(t)&&Yp(e)})}function qp(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!hn(e,r)}catch{return!0}}function Yp(e){var t=fr(e,2);t!==null&&mn(t,e,2)}function Yc(e){var t=tn();if(typeof e=="function"){var r=e;if(e=r(),Sr){wt(!0);try{r()}finally{wt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pa,lastRenderedState:e},t}function Kp(e,t,r,i){return e.baseState=r,Wc(e,ct,typeof i=="function"?i:pa)}function D1(e,t,r,i,u){if(Ti(e))throw Error(o(485));if(e=t.action,e!==null){var m={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){m.listeners.push(S)}};M.T!==null?r(!0):m.isTransition=!1,i(m),r=t.pending,r===null?(m.next=t.pending=m,Xp(t,m)):(m.next=r.next,t.pending=r.next=m)}}function Xp(e,t){var r=t.action,i=t.payload,u=e.state;if(t.isTransition){var m=M.T,S={};M.T=S;try{var T=r(u,i),U=M.S;U!==null&&U(S,T),Qp(e,t,T)}catch(K){Kc(e,t,K)}finally{m!==null&&S.types!==null&&(m.types=S.types),M.T=m}}else try{m=r(u,i),Qp(e,t,m)}catch(K){Kc(e,t,K)}}function Qp(e,t,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(i){Zp(e,t,i)},function(i){return Kc(e,t,i)}):Zp(e,t,r)}function Zp(e,t,r){t.status="fulfilled",t.value=r,Jp(t),e.state=r,t=e.pending,t!==null&&(r=t.next,r===t?e.pending=null:(r=r.next,t.next=r,Xp(e,r)))}function Kc(e,t,r){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=r,Jp(t),t=t.next;while(t!==i)}e.action=null}function Jp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function em(e,t){return t}function tm(e,t){if(Ze){var r=pt.formState;if(r!==null){e:{var i=Ve;if(Ze){if(mt){t:{for(var u=mt,m=Dn;u.nodeType!==8;){if(!m){u=null;break t}if(u=On(u.nextSibling),u===null){u=null;break t}}m=u.data,u=m==="F!"||m==="F"?u:null}if(u){mt=On(u.nextSibling),i=u.data==="F!";break e}}La(i)}i=!1}i&&(t=r[0])}}return r=tn(),r.memoizedState=r.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:em,lastRenderedState:t},r.queue=i,r=bm.bind(null,Ve,i),i.dispatch=r,i=Yc(!1),m=tu.bind(null,Ve,!1,i.queue),i=tn(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,r=D1.bind(null,Ve,u,m,r),u.dispatch=r,i.memoizedState=e,[t,r,!1]}function nm(e){var t=At();return am(t,ct,e)}function am(e,t,r){if(t=Wc(e,t,em)[0],e=Ci(pa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=ts(t)}catch(S){throw S===Zr?hi:S}else i=t;t=At();var u=t.queue,m=u.dispatch;return r!==t.memoizedState&&(Ve.flags|=2048,al(9,{destroy:void 0},_1.bind(null,u,r),null)),[i,m,e]}function _1(e,t){e.action=t}function rm(e){var t=At(),r=ct;if(r!==null)return am(t,r,e);At(),t=t.memoizedState,r=At();var i=r.queue.dispatch;return r.memoizedState=e,[t,i,!1]}function al(e,t,r,i){return e={tag:e,create:r,deps:i,inst:t,next:null},t=Ve.updateQueue,t===null&&(t=ki(),Ve.updateQueue=t),r=t.lastEffect,r===null?t.lastEffect=e.next=e:(i=r.next,r.next=e,e.next=i,t.lastEffect=e),e}function lm(){return At().memoizedState}function Ei(e,t,r,i){var u=tn();Ve.flags|=e,u.memoizedState=al(1|t,{destroy:void 0},r,i===void 0?null:i)}function Ni(e,t,r,i){var u=At();i=i===void 0?null:i;var m=u.memoizedState.inst;ct!==null&&i!==null&&Uc(i,ct.memoizedState.deps)?u.memoizedState=al(t,m,r,i):(Ve.flags|=e,u.memoizedState=al(1|t,m,r,i))}function sm(e,t){Ei(8390656,8,e,t)}function Xc(e,t){Ni(2048,8,e,t)}function O1(e){Ve.flags|=4;var t=Ve.updateQueue;if(t===null)t=ki(),Ve.updateQueue=t,t.events=[e];else{var r=t.events;r===null?t.events=[e]:r.push(e)}}function im(e){var t=At().memoizedState;return O1({ref:t,nextImpl:e}),function(){if((at&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function om(e,t){return Ni(4,2,e,t)}function cm(e,t){return Ni(4,4,e,t)}function um(e,t){if(typeof t=="function"){e=e();var r=t(e);return function(){typeof r=="function"?r():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function dm(e,t,r){r=r!=null?r.concat([e]):null,Ni(4,4,um.bind(null,t,e),r)}function Qc(){}function fm(e,t){var r=At();t=t===void 0?null:t;var i=r.memoizedState;return t!==null&&Uc(t,i[1])?i[0]:(r.memoizedState=[e,t],e)}function pm(e,t){var r=At();t=t===void 0?null:t;var i=r.memoizedState;if(t!==null&&Uc(t,i[1]))return i[0];if(i=e(),Sr){wt(!0);try{e()}finally{wt(!1)}}return r.memoizedState=[i,t],i}function Zc(e,t,r){return r===void 0||(fa&1073741824)!==0&&(Xe&261930)===0?e.memoizedState=t:(e.memoizedState=r,e=mh(),Ve.lanes|=e,$a|=e,r)}function mm(e,t,r,i){return hn(r,t)?r:el.current!==null?(e=Zc(e,r,i),hn(e,t)||(Dt=!0),e):(fa&42)===0||(fa&1073741824)!==0&&(Xe&261930)===0?(Dt=!0,e.memoizedState=r):(e=mh(),Ve.lanes|=e,$a|=e,t)}function hm(e,t,r,i,u){var m=I.p;I.p=m!==0&&8>m?m:8;var S=M.T,T={};M.T=T,tu(e,!1,t,r);try{var U=u(),K=M.S;if(K!==null&&K(T,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ne=M1(U,i);ns(e,t,ne,Sn(e))}else ns(e,t,i,Sn(e))}catch(le){ns(e,t,{then:function(){},status:"rejected",reason:le},Sn())}finally{I.p=m,S!==null&&T.types!==null&&(S.types=T.types),M.T=S}}function B1(){}function Jc(e,t,r,i){if(e.tag!==5)throw Error(o(476));var u=xm(e).queue;hm(e,u,t,X,r===null?B1:function(){return gm(e),r(i)})}function xm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pa,lastRenderedState:X},next:null};var r={};return t.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pa,lastRenderedState:r},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function gm(e){var t=xm(e);t.next===null&&(t=e.alternate.memoizedState),ns(e,t.next.queue,{},Sn())}function eu(){return Yt(ys)}function vm(){return At().memoizedState}function ym(){return At().memoizedState}function I1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var r=Sn();e=_a(r);var i=Oa(t,e,r);i!==null&&(mn(i,t,r),Ql(i,t,r)),t={cache:Rc()},e.payload=t;return}t=t.return}}function H1(e,t,r){var i=Sn();r={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ti(e)?Sm(t,r):(r=vc(e,t,r,i),r!==null&&(mn(r,e,i),jm(r,t,i)))}function bm(e,t,r){var i=Sn();ns(e,t,r,i)}function ns(e,t,r,i){var u={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Ti(e))Sm(t,u);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=t.lastRenderedReducer,m!==null))try{var S=t.lastRenderedState,T=m(S,r);if(u.hasEagerState=!0,u.eagerState=T,hn(T,S))return oi(e,t,u,0),pt===null&&ii(),!1}catch{}finally{}if(r=vc(e,t,u,i),r!==null)return mn(r,e,i),jm(r,t,i),!0}return!1}function tu(e,t,r,i){if(i={lane:2,revertLane:zu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ti(e)){if(t)throw Error(o(479))}else t=vc(e,r,i,2),t!==null&&mn(t,e,2)}function Ti(e){var t=e.alternate;return e===Ve||t!==null&&t===Ve}function Sm(e,t){tl=Si=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function jm(e,t,r){if((r&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,Nf(e,r)}}var as={readContext:Yt,use:wi,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct};as.useEffectEvent=Ct;var km={readContext:Yt,use:wi,useCallback:function(e,t){return tn().memoizedState=[e,t===void 0?null:t],e},useContext:Yt,useEffect:sm,useImperativeHandle:function(e,t,r){r=r!=null?r.concat([e]):null,Ei(4194308,4,um.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Ei(4194308,4,e,t)},useInsertionEffect:function(e,t){Ei(4,2,e,t)},useMemo:function(e,t){var r=tn();t=t===void 0?null:t;var i=e();if(Sr){wt(!0);try{e()}finally{wt(!1)}}return r.memoizedState=[i,t],i},useReducer:function(e,t,r){var i=tn();if(r!==void 0){var u=r(t);if(Sr){wt(!0);try{r(t)}finally{wt(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=H1.bind(null,Ve,e),[i.memoizedState,e]},useRef:function(e){var t=tn();return e={current:e},t.memoizedState=e},useState:function(e){e=Yc(e);var t=e.queue,r=bm.bind(null,Ve,t);return t.dispatch=r,[e.memoizedState,r]},useDebugValue:Qc,useDeferredValue:function(e,t){var r=tn();return Zc(r,e,t)},useTransition:function(){var e=Yc(!1);return e=hm.bind(null,Ve,e.queue,!0,!1),tn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,r){var i=Ve,u=tn();if(Ze){if(r===void 0)throw Error(o(407));r=r()}else{if(r=t(),pt===null)throw Error(o(349));(Xe&127)!==0||Fp(i,t,r)}u.memoizedState=r;var m={value:r,getSnapshot:t};return u.queue=m,sm(Wp.bind(null,i,m,e),[e]),i.flags|=2048,al(9,{destroy:void 0},Gp.bind(null,i,m,r,t),null),r},useId:function(){var e=tn(),t=pt.identifierPrefix;if(Ze){var r=Xn,i=Kn;r=(i&~(1<<32-jt(i)-1)).toString(32)+r,t="_"+t+"R_"+r,r=ji++,0<r&&(t+="H"+r.toString(32)),t+="_"}else r=L1++,t="_"+t+"r_"+r.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:eu,useFormState:tm,useActionState:tm,useOptimistic:function(e){var t=tn();t.memoizedState=t.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=r,t=tu.bind(null,Ve,!0,r),r.dispatch=t,[e,t]},useMemoCache:Gc,useCacheRefresh:function(){return tn().memoizedState=I1.bind(null,Ve)},useEffectEvent:function(e){var t=tn(),r={impl:e};return t.memoizedState=r,function(){if((at&2)!==0)throw Error(o(440));return r.impl.apply(void 0,arguments)}}},nu={readContext:Yt,use:wi,useCallback:fm,useContext:Yt,useEffect:Xc,useImperativeHandle:dm,useInsertionEffect:om,useLayoutEffect:cm,useMemo:pm,useReducer:Ci,useRef:lm,useState:function(){return Ci(pa)},useDebugValue:Qc,useDeferredValue:function(e,t){var r=At();return mm(r,ct.memoizedState,e,t)},useTransition:function(){var e=Ci(pa)[0],t=At().memoizedState;return[typeof e=="boolean"?e:ts(e),t]},useSyncExternalStore:Pp,useId:vm,useHostTransitionStatus:eu,useFormState:nm,useActionState:nm,useOptimistic:function(e,t){var r=At();return Kp(r,ct,e,t)},useMemoCache:Gc,useCacheRefresh:ym};nu.useEffectEvent=im;var wm={readContext:Yt,use:wi,useCallback:fm,useContext:Yt,useEffect:Xc,useImperativeHandle:dm,useInsertionEffect:om,useLayoutEffect:cm,useMemo:pm,useReducer:qc,useRef:lm,useState:function(){return qc(pa)},useDebugValue:Qc,useDeferredValue:function(e,t){var r=At();return ct===null?Zc(r,e,t):mm(r,ct.memoizedState,e,t)},useTransition:function(){var e=qc(pa)[0],t=At().memoizedState;return[typeof e=="boolean"?e:ts(e),t]},useSyncExternalStore:Pp,useId:vm,useHostTransitionStatus:eu,useFormState:rm,useActionState:rm,useOptimistic:function(e,t){var r=At();return ct!==null?Kp(r,ct,e,t):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:Gc,useCacheRefresh:ym};wm.useEffectEvent=im;function au(e,t,r,i){t=e.memoizedState,r=r(i,t),r=r==null?t:v({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var ru={enqueueSetState:function(e,t,r){e=e._reactInternals;var i=Sn(),u=_a(i);u.payload=t,r!=null&&(u.callback=r),t=Oa(e,u,i),t!==null&&(mn(t,e,i),Ql(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var i=Sn(),u=_a(i);u.tag=1,u.payload=t,r!=null&&(u.callback=r),t=Oa(e,u,i),t!==null&&(mn(t,e,i),Ql(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Sn(),i=_a(r);i.tag=2,t!=null&&(i.callback=t),t=Oa(e,i,r),t!==null&&(mn(t,e,r),Ql(t,e,r))}};function Cm(e,t,r,i,u,m,S){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,m,S):t.prototype&&t.prototype.isPureReactComponent?!Pl(r,i)||!Pl(u,m):!0}function Em(e,t,r,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,i),t.state!==e&&ru.enqueueReplaceState(t,t.state,null)}function jr(e,t){var r=t;if("ref"in t){r={};for(var i in t)i!=="ref"&&(r[i]=t[i])}if(e=e.defaultProps){r===t&&(r=v({},r));for(var u in e)r[u]===void 0&&(r[u]=e[u])}return r}function Nm(e){si(e)}function Tm(e){console.error(e)}function Rm(e){si(e)}function Ri(e,t){try{var r=e.onUncaughtError;r(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Am(e,t,r){try{var i=e.onCaughtError;i(r.value,{componentStack:r.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function lu(e,t,r){return r=_a(r),r.tag=3,r.payload={element:null},r.callback=function(){Ri(e,t)},r}function Mm(e){return e=_a(e),e.tag=3,e}function Lm(e,t,r,i){var u=r.type.getDerivedStateFromError;if(typeof u=="function"){var m=i.value;e.payload=function(){return u(m)},e.callback=function(){Am(t,r,i)}}var S=r.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(e.callback=function(){Am(t,r,i),typeof u!="function"&&(Va===null?Va=new Set([this]):Va.add(this));var T=i.stack;this.componentDidCatch(i.value,{componentStack:T!==null?T:""})})}function U1(e,t,r,i,u){if(r.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=r.alternate,t!==null&&Kr(t,r,u,!0),r=gn.current,r!==null){switch(r.tag){case 31:case 13:return _n===null?$i():r.alternate===null&&Et===0&&(Et=3),r.flags&=-257,r.flags|=65536,r.lanes=u,i===xi?r.flags|=16384:(t=r.updateQueue,t===null?r.updateQueue=new Set([i]):t.add(i),Au(e,i,u)),!1;case 22:return r.flags|=65536,i===xi?r.flags|=16384:(t=r.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},r.updateQueue=t):(r=t.retryQueue,r===null?t.retryQueue=new Set([i]):r.add(i)),Au(e,i,u)),!1}throw Error(o(435,r.tag))}return Au(e,i,u),$i(),!1}if(Ze)return t=gn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==wc&&(e=Error(o(422),{cause:i}),Wl(Mn(e,r)))):(i!==wc&&(t=Error(o(423),{cause:i}),Wl(Mn(t,r))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=Mn(i,r),u=lu(e.stateNode,i,u),_c(e,u),Et!==4&&(Et=2)),!1;var m=Error(o(520),{cause:i});if(m=Mn(m,r),ds===null?ds=[m]:ds.push(m),Et!==4&&(Et=2),t===null)return!0;i=Mn(i,r),r=t;do{switch(r.tag){case 3:return r.flags|=65536,e=u&-u,r.lanes|=e,e=lu(r.stateNode,i,e),_c(r,e),!1;case 1:if(t=r.type,m=r.stateNode,(r.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Va===null||!Va.has(m))))return r.flags|=65536,u&=-u,r.lanes|=u,u=Mm(u),Lm(u,e,r,i),_c(r,u),!1}r=r.return}while(r!==null);return!1}var su=Error(o(461)),Dt=!1;function Kt(e,t,r,i){t.child=e===null?Op(t,null,r,i):br(t,e.child,r,i)}function zm(e,t,r,i,u){r=r.render;var m=t.ref;if("ref"in i){var S={};for(var T in i)T!=="ref"&&(S[T]=i[T])}else S=i;return xr(t),i=$c(e,t,r,S,m,u),T=Vc(),e!==null&&!Dt?(Pc(e,t,u),ma(e,t,u)):(Ze&&T&&jc(t),t.flags|=1,Kt(e,t,i,u),t.child)}function Dm(e,t,r,i,u){if(e===null){var m=r.type;return typeof m=="function"&&!yc(m)&&m.defaultProps===void 0&&r.compare===null?(t.tag=15,t.type=m,_m(e,t,m,i,u)):(e=ui(r.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(m=e.child,!mu(e,u)){var S=m.memoizedProps;if(r=r.compare,r=r!==null?r:Pl,r(S,i)&&e.ref===t.ref)return ma(e,t,u)}return t.flags|=1,e=oa(m,i),e.ref=t.ref,e.return=t,t.child=e}function _m(e,t,r,i,u){if(e!==null){var m=e.memoizedProps;if(Pl(m,i)&&e.ref===t.ref)if(Dt=!1,t.pendingProps=i=m,mu(e,u))(e.flags&131072)!==0&&(Dt=!0);else return t.lanes=e.lanes,ma(e,t,u)}return iu(e,t,r,i,u)}function Om(e,t,r,i){var u=i.children,m=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(m=m!==null?m.baseLanes|r:r,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~m}else i=0,t.child=null;return Bm(e,t,m,r,i)}if((r&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&mi(t,m!==null?m.cachePool:null),m!==null?Hp(t,m):Bc(),Up(t);else return i=t.lanes=536870912,Bm(e,t,m!==null?m.baseLanes|r:r,r,i)}else m!==null?(mi(t,m.cachePool),Hp(t,m),Ia(),t.memoizedState=null):(e!==null&&mi(t,null),Bc(),Ia());return Kt(e,t,u,r),t.child}function rs(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Bm(e,t,r,i,u){var m=Mc();return m=m===null?null:{parent:Lt._currentValue,pool:m},t.memoizedState={baseLanes:r,cachePool:m},e!==null&&mi(t,null),Bc(),Up(t),e!==null&&Kr(e,t,i,!0),t.childLanes=u,null}function Ai(e,t){return t=Li({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Im(e,t,r){return br(t,e.child,null,r),e=Ai(t,t.pendingProps),e.flags|=2,vn(t),t.memoizedState=null,e}function $1(e,t,r){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ze){if(i.mode==="hidden")return e=Ai(t,i),t.lanes=536870912,rs(null,e);if(Hc(t),(e=mt)?(e=Xh(e,Dn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Aa!==null?{id:Kn,overflow:Xn}:null,retryLane:536870912,hydrationErrors:null},r=Sp(e),r.return=t,t.child=r,qt=t,mt=null)):e=null,e===null)throw La(t);return t.lanes=536870912,null}return Ai(t,i)}var m=e.memoizedState;if(m!==null){var S=m.dehydrated;if(Hc(t),u)if(t.flags&256)t.flags&=-257,t=Im(e,t,r);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Dt||Kr(e,t,r,!1),u=(r&e.childLanes)!==0,Dt||u){if(i=pt,i!==null&&(S=Tf(i,r),S!==0&&S!==m.retryLane))throw m.retryLane=S,fr(e,S),mn(i,e,S),su;$i(),t=Im(e,t,r)}else e=m.treeContext,mt=On(S.nextSibling),qt=t,Ze=!0,Ma=null,Dn=!1,e!==null&&wp(t,e),t=Ai(t,i),t.flags|=4096;return t}return e=oa(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Mi(e,t){var r=t.ref;if(r===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(o(284));(e===null||e.ref!==r)&&(t.flags|=4194816)}}function iu(e,t,r,i,u){return xr(t),r=$c(e,t,r,i,void 0,u),i=Vc(),e!==null&&!Dt?(Pc(e,t,u),ma(e,t,u)):(Ze&&i&&jc(t),t.flags|=1,Kt(e,t,r,u),t.child)}function Hm(e,t,r,i,u,m){return xr(t),t.updateQueue=null,r=Vp(t,i,r,u),$p(e),i=Vc(),e!==null&&!Dt?(Pc(e,t,m),ma(e,t,m)):(Ze&&i&&jc(t),t.flags|=1,Kt(e,t,r,m),t.child)}function Um(e,t,r,i,u){if(xr(t),t.stateNode===null){var m=Gr,S=r.contextType;typeof S=="object"&&S!==null&&(m=Yt(S)),m=new r(i,m),t.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=ru,t.stateNode=m,m._reactInternals=t,m=t.stateNode,m.props=i,m.state=t.memoizedState,m.refs={},zc(t),S=r.contextType,m.context=typeof S=="object"&&S!==null?Yt(S):Gr,m.state=t.memoizedState,S=r.getDerivedStateFromProps,typeof S=="function"&&(au(t,r,S,i),m.state=t.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(S=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),S!==m.state&&ru.enqueueReplaceState(m,m.state,null),Jl(t,i,m,u),Zl(),m.state=t.memoizedState),typeof m.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){m=t.stateNode;var T=t.memoizedProps,U=jr(r,T);m.props=U;var K=m.context,ne=r.contextType;S=Gr,typeof ne=="object"&&ne!==null&&(S=Yt(ne));var le=r.getDerivedStateFromProps;ne=typeof le=="function"||typeof m.getSnapshotBeforeUpdate=="function",T=t.pendingProps!==T,ne||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(T||K!==S)&&Em(t,m,i,S),Da=!1;var Z=t.memoizedState;m.state=Z,Jl(t,i,m,u),Zl(),K=t.memoizedState,T||Z!==K||Da?(typeof le=="function"&&(au(t,r,le,i),K=t.memoizedState),(U=Da||Cm(t,r,U,i,Z,K,S))?(ne||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(t.flags|=4194308)):(typeof m.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=K),m.props=i,m.state=K,m.context=S,i=U):(typeof m.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{m=t.stateNode,Dc(e,t),S=t.memoizedProps,ne=jr(r,S),m.props=ne,le=t.pendingProps,Z=m.context,K=r.contextType,U=Gr,typeof K=="object"&&K!==null&&(U=Yt(K)),T=r.getDerivedStateFromProps,(K=typeof T=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(S!==le||Z!==U)&&Em(t,m,i,U),Da=!1,Z=t.memoizedState,m.state=Z,Jl(t,i,m,u),Zl();var ee=t.memoizedState;S!==le||Z!==ee||Da||e!==null&&e.dependencies!==null&&fi(e.dependencies)?(typeof T=="function"&&(au(t,r,T,i),ee=t.memoizedState),(ne=Da||Cm(t,r,ne,i,Z,ee,U)||e!==null&&e.dependencies!==null&&fi(e.dependencies))?(K||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(i,ee,U),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(i,ee,U)),typeof m.componentDidUpdate=="function"&&(t.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof m.componentDidUpdate!="function"||S===e.memoizedProps&&Z===e.memoizedState||(t.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||S===e.memoizedProps&&Z===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=ee),m.props=i,m.state=ee,m.context=U,i=ne):(typeof m.componentDidUpdate!="function"||S===e.memoizedProps&&Z===e.memoizedState||(t.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||S===e.memoizedProps&&Z===e.memoizedState||(t.flags|=1024),i=!1)}return m=i,Mi(e,t),i=(t.flags&128)!==0,m||i?(m=t.stateNode,r=i&&typeof r.getDerivedStateFromError!="function"?null:m.render(),t.flags|=1,e!==null&&i?(t.child=br(t,e.child,null,u),t.child=br(t,null,r,u)):Kt(e,t,r,u),t.memoizedState=m.state,e=t.child):e=ma(e,t,u),e}function $m(e,t,r,i){return mr(),t.flags|=256,Kt(e,t,r,i),t.child}var ou={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function cu(e){return{baseLanes:e,cachePool:Ap()}}function uu(e,t,r){return e=e!==null?e.childLanes&~r:0,t&&(e|=bn),e}function Vm(e,t,r){var i=t.pendingProps,u=!1,m=(t.flags&128)!==0,S;if((S=m)||(S=e!==null&&e.memoizedState===null?!1:(Rt.current&2)!==0),S&&(u=!0,t.flags&=-129),S=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ze){if(u?Ba(t):Ia(),(e=mt)?(e=Xh(e,Dn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Aa!==null?{id:Kn,overflow:Xn}:null,retryLane:536870912,hydrationErrors:null},r=Sp(e),r.return=t,t.child=r,qt=t,mt=null)):e=null,e===null)throw La(t);return Wu(e)?t.lanes=32:t.lanes=536870912,null}var T=i.children;return i=i.fallback,u?(Ia(),u=t.mode,T=Li({mode:"hidden",children:T},u),i=pr(i,u,r,null),T.return=t,i.return=t,T.sibling=i,t.child=T,i=t.child,i.memoizedState=cu(r),i.childLanes=uu(e,S,r),t.memoizedState=ou,rs(null,i)):(Ba(t),du(t,T))}var U=e.memoizedState;if(U!==null&&(T=U.dehydrated,T!==null)){if(m)t.flags&256?(Ba(t),t.flags&=-257,t=fu(e,t,r)):t.memoizedState!==null?(Ia(),t.child=e.child,t.flags|=128,t=null):(Ia(),T=i.fallback,u=t.mode,i=Li({mode:"visible",children:i.children},u),T=pr(T,u,r,null),T.flags|=2,i.return=t,T.return=t,i.sibling=T,t.child=i,br(t,e.child,null,r),i=t.child,i.memoizedState=cu(r),i.childLanes=uu(e,S,r),t.memoizedState=ou,t=rs(null,i));else if(Ba(t),Wu(T)){if(S=T.nextSibling&&T.nextSibling.dataset,S)var K=S.dgst;S=K,i=Error(o(419)),i.stack="",i.digest=S,Wl({value:i,source:null,stack:null}),t=fu(e,t,r)}else if(Dt||Kr(e,t,r,!1),S=(r&e.childLanes)!==0,Dt||S){if(S=pt,S!==null&&(i=Tf(S,r),i!==0&&i!==U.retryLane))throw U.retryLane=i,fr(e,i),mn(S,e,i),su;Gu(T)||$i(),t=fu(e,t,r)}else Gu(T)?(t.flags|=192,t.child=e.child,t=null):(e=U.treeContext,mt=On(T.nextSibling),qt=t,Ze=!0,Ma=null,Dn=!1,e!==null&&wp(t,e),t=du(t,i.children),t.flags|=4096);return t}return u?(Ia(),T=i.fallback,u=t.mode,U=e.child,K=U.sibling,i=oa(U,{mode:"hidden",children:i.children}),i.subtreeFlags=U.subtreeFlags&65011712,K!==null?T=oa(K,T):(T=pr(T,u,r,null),T.flags|=2),T.return=t,i.return=t,i.sibling=T,t.child=i,rs(null,i),i=t.child,T=e.child.memoizedState,T===null?T=cu(r):(u=T.cachePool,u!==null?(U=Lt._currentValue,u=u.parent!==U?{parent:U,pool:U}:u):u=Ap(),T={baseLanes:T.baseLanes|r,cachePool:u}),i.memoizedState=T,i.childLanes=uu(e,S,r),t.memoizedState=ou,rs(e.child,i)):(Ba(t),r=e.child,e=r.sibling,r=oa(r,{mode:"visible",children:i.children}),r.return=t,r.sibling=null,e!==null&&(S=t.deletions,S===null?(t.deletions=[e],t.flags|=16):S.push(e)),t.child=r,t.memoizedState=null,r)}function du(e,t){return t=Li({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Li(e,t){return e=xn(22,e,null,t),e.lanes=0,e}function fu(e,t,r){return br(t,e.child,null,r),e=du(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Pm(e,t,r){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Nc(e.return,t,r)}function pu(e,t,r,i,u,m){var S=e.memoizedState;S===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:r,tailMode:u,treeForkCount:m}:(S.isBackwards=t,S.rendering=null,S.renderingStartTime=0,S.last=i,S.tail=r,S.tailMode=u,S.treeForkCount=m)}function Fm(e,t,r){var i=t.pendingProps,u=i.revealOrder,m=i.tail;i=i.children;var S=Rt.current,T=(S&2)!==0;if(T?(S=S&1|2,t.flags|=128):S&=1,se(Rt,S),Kt(e,t,i,r),i=Ze?Gl:0,!T&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Pm(e,r,t);else if(e.tag===19)Pm(e,r,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(u){case"forwards":for(r=t.child,u=null;r!==null;)e=r.alternate,e!==null&&bi(e)===null&&(u=r),r=r.sibling;r=u,r===null?(u=t.child,t.child=null):(u=r.sibling,r.sibling=null),pu(t,!1,u,r,m,i);break;case"backwards":case"unstable_legacy-backwards":for(r=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&bi(e)===null){t.child=u;break}e=u.sibling,u.sibling=r,r=u,u=e}pu(t,!0,r,null,m,i);break;case"together":pu(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function ma(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),$a|=t.lanes,(r&t.childLanes)===0)if(e!==null){if(Kr(e,t,r,!1),(r&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,r=oa(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=oa(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function mu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&fi(e)))}function V1(e,t,r){switch(t.tag){case 3:ie(t,t.stateNode.containerInfo),za(t,Lt,e.memoizedState.cache),mr();break;case 27:case 5:Oe(t);break;case 4:ie(t,t.stateNode.containerInfo);break;case 10:za(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Hc(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(Ba(t),t.flags|=128,null):(r&t.child.childLanes)!==0?Vm(e,t,r):(Ba(t),e=ma(e,t,r),e!==null?e.sibling:null);Ba(t);break;case 19:var u=(e.flags&128)!==0;if(i=(r&t.childLanes)!==0,i||(Kr(e,t,r,!1),i=(r&t.childLanes)!==0),u){if(i)return Fm(e,t,r);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),se(Rt,Rt.current),i)break;return null;case 22:return t.lanes=0,Om(e,t,r,t.pendingProps);case 24:za(t,Lt,e.memoizedState.cache)}return ma(e,t,r)}function Gm(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps)Dt=!0;else{if(!mu(e,r)&&(t.flags&128)===0)return Dt=!1,V1(e,t,r);Dt=(e.flags&131072)!==0}else Dt=!1,Ze&&(t.flags&1048576)!==0&&kp(t,Gl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=vr(t.elementType),t.type=e,typeof e=="function")yc(e)?(i=jr(e,i),t.tag=1,t=Um(null,t,e,i,r)):(t.tag=0,t=iu(null,t,e,i,r));else{if(e!=null){var u=e.$$typeof;if(u===H){t.tag=11,t=zm(null,t,e,i,r);break e}else if(u===E){t.tag=14,t=Dm(null,t,e,i,r);break e}}throw t=Q(e)||e,Error(o(306,t,""))}}return t;case 0:return iu(e,t,t.type,t.pendingProps,r);case 1:return i=t.type,u=jr(i,t.pendingProps),Um(e,t,i,u,r);case 3:e:{if(ie(t,t.stateNode.containerInfo),e===null)throw Error(o(387));i=t.pendingProps;var m=t.memoizedState;u=m.element,Dc(e,t),Jl(t,i,null,r);var S=t.memoizedState;if(i=S.cache,za(t,Lt,i),i!==m.cache&&Tc(t,[Lt],r,!0),Zl(),i=S.element,m.isDehydrated)if(m={element:i,isDehydrated:!1,cache:S.cache},t.updateQueue.baseState=m,t.memoizedState=m,t.flags&256){t=$m(e,t,i,r);break e}else if(i!==u){u=Mn(Error(o(424)),t),Wl(u),t=$m(e,t,i,r);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(mt=On(e.firstChild),qt=t,Ze=!0,Ma=null,Dn=!0,r=Op(t,null,i,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(mr(),i===u){t=ma(e,t,r);break e}Kt(e,t,i,r)}t=t.child}return t;case 26:return Mi(e,t),e===null?(r=nx(t.type,null,t.pendingProps,null))?t.memoizedState=r:Ze||(r=t.type,e=t.pendingProps,i=Yi(xe.current).createElement(r),i[Wt]=t,i[on]=e,Xt(i,r,e),Pt(i),t.stateNode=i):t.memoizedState=nx(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Oe(t),e===null&&Ze&&(i=t.stateNode=Jh(t.type,t.pendingProps,xe.current),qt=t,Dn=!0,u=mt,Wa(t.type)?(qu=u,mt=On(i.firstChild)):mt=u),Kt(e,t,t.pendingProps.children,r),Mi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ze&&((u=i=mt)&&(i=vb(i,t.type,t.pendingProps,Dn),i!==null?(t.stateNode=i,qt=t,mt=On(i.firstChild),Dn=!1,u=!0):u=!1),u||La(t)),Oe(t),u=t.type,m=t.pendingProps,S=e!==null?e.memoizedProps:null,i=m.children,Vu(u,m)?i=null:S!==null&&Vu(u,S)&&(t.flags|=32),t.memoizedState!==null&&(u=$c(e,t,z1,null,null,r),ys._currentValue=u),Mi(e,t),Kt(e,t,i,r),t.child;case 6:return e===null&&Ze&&((e=r=mt)&&(r=yb(r,t.pendingProps,Dn),r!==null?(t.stateNode=r,qt=t,mt=null,e=!0):e=!1),e||La(t)),null;case 13:return Vm(e,t,r);case 4:return ie(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=br(t,null,i,r):Kt(e,t,i,r),t.child;case 11:return zm(e,t,t.type,t.pendingProps,r);case 7:return Kt(e,t,t.pendingProps,r),t.child;case 8:return Kt(e,t,t.pendingProps.children,r),t.child;case 12:return Kt(e,t,t.pendingProps.children,r),t.child;case 10:return i=t.pendingProps,za(t,t.type,i.value),Kt(e,t,i.children,r),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,xr(t),u=Yt(u),i=i(u),t.flags|=1,Kt(e,t,i,r),t.child;case 14:return Dm(e,t,t.type,t.pendingProps,r);case 15:return _m(e,t,t.type,t.pendingProps,r);case 19:return Fm(e,t,r);case 31:return $1(e,t,r);case 22:return Om(e,t,r,t.pendingProps);case 24:return xr(t),i=Yt(Lt),e===null?(u=Mc(),u===null&&(u=pt,m=Rc(),u.pooledCache=m,m.refCount++,m!==null&&(u.pooledCacheLanes|=r),u=m),t.memoizedState={parent:i,cache:u},zc(t),za(t,Lt,u)):((e.lanes&r)!==0&&(Dc(e,t),Jl(t,null,null,r),Zl()),u=e.memoizedState,m=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),za(t,Lt,i)):(i=m.cache,za(t,Lt,i),i!==u.cache&&Tc(t,[Lt],r,!0))),Kt(e,t,t.pendingProps.children,r),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ha(e){e.flags|=4}function hu(e,t,r,i,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(vh())e.flags|=8192;else throw yr=xi,Lc}else e.flags&=-16777217}function Wm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ix(t))if(vh())e.flags|=8192;else throw yr=xi,Lc}function zi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Cf():536870912,e.lanes|=t,il|=t)}function ls(e,t){if(!Ze)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var i=null;r!==null;)r.alternate!==null&&(i=r),r=r.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function ht(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,i=0;if(t)for(var u=e.child;u!==null;)r|=u.lanes|u.childLanes,i|=u.subtreeFlags&65011712,i|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)r|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=r,t}function P1(e,t,r){var i=t.pendingProps;switch(kc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ht(t),null;case 1:return ht(t),null;case 3:return r=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),da(Lt),je(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Yr(t)?ha(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Cc())),ht(t),null;case 26:var u=t.type,m=t.memoizedState;return e===null?(ha(t),m!==null?(ht(t),Wm(t,m)):(ht(t),hu(t,u,null,i,r))):m?m!==e.memoizedState?(ha(t),ht(t),Wm(t,m)):(ht(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&ha(t),ht(t),hu(t,u,e,i,r)),null;case 27:if($e(t),r=xe.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ha(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return ht(t),null}e=de.current,Yr(t)?Cp(t):(e=Jh(u,i,r),t.stateNode=e,ha(t))}return ht(t),null;case 5:if($e(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ha(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return ht(t),null}if(m=de.current,Yr(t))Cp(t);else{var S=Yi(xe.current);switch(m){case 1:m=S.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:m=S.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":m=S.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":m=S.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":m=S.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof i.is=="string"?S.createElement("select",{is:i.is}):S.createElement("select"),i.multiple?m.multiple=!0:i.size&&(m.size=i.size);break;default:m=typeof i.is=="string"?S.createElement(u,{is:i.is}):S.createElement(u)}}m[Wt]=t,m[on]=i;e:for(S=t.child;S!==null;){if(S.tag===5||S.tag===6)m.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===t)break e;for(;S.sibling===null;){if(S.return===null||S.return===t)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}t.stateNode=m;e:switch(Xt(m,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&ha(t)}}return ht(t),hu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,r),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&ha(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(o(166));if(e=xe.current,Yr(t)){if(e=t.stateNode,r=t.memoizedProps,i=null,u=qt,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[Wt]=t,e=!!(e.nodeValue===r||i!==null&&i.suppressHydrationWarning===!0||Vh(e.nodeValue,r)),e||La(t,!0)}else e=Yi(e).createTextNode(i),e[Wt]=t,t.stateNode=e}return ht(t),null;case 31:if(r=t.memoizedState,e===null||e.memoizedState!==null){if(i=Yr(t),r!==null){if(e===null){if(!i)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Wt]=t}else mr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ht(t),e=!1}else r=Cc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return t.flags&256?(vn(t),t):(vn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return ht(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Yr(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[Wt]=t}else mr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ht(t),u=!1}else u=Cc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(vn(t),t):(vn(t),null)}return vn(t),(t.flags&128)!==0?(t.lanes=r,t):(r=i!==null,e=e!==null&&e.memoizedState!==null,r&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),m=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(m=i.memoizedState.cachePool.pool),m!==u&&(i.flags|=2048)),r!==e&&r&&(t.child.flags|=8192),zi(t,t.updateQueue),ht(t),null);case 4:return je(),e===null&&Bu(t.stateNode.containerInfo),ht(t),null;case 10:return da(t.type),ht(t),null;case 19:if(Y(Rt),i=t.memoizedState,i===null)return ht(t),null;if(u=(t.flags&128)!==0,m=i.rendering,m===null)if(u)ls(i,!1);else{if(Et!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(m=bi(e),m!==null){for(t.flags|=128,ls(i,!1),e=m.updateQueue,t.updateQueue=e,zi(t,e),t.subtreeFlags=0,e=r,r=t.child;r!==null;)bp(r,e),r=r.sibling;return se(Rt,Rt.current&1|2),Ze&&ca(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&lt()>Ii&&(t.flags|=128,u=!0,ls(i,!1),t.lanes=4194304)}else{if(!u)if(e=bi(m),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,zi(t,e),ls(i,!0),i.tail===null&&i.tailMode==="hidden"&&!m.alternate&&!Ze)return ht(t),null}else 2*lt()-i.renderingStartTime>Ii&&r!==536870912&&(t.flags|=128,u=!0,ls(i,!1),t.lanes=4194304);i.isBackwards?(m.sibling=t.child,t.child=m):(e=i.last,e!==null?e.sibling=m:t.child=m,i.last=m)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=lt(),e.sibling=null,r=Rt.current,se(Rt,u?r&1|2:r&1),Ze&&ca(t,i.treeForkCount),e):(ht(t),null);case 22:case 23:return vn(t),Ic(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(r&536870912)!==0&&(t.flags&128)===0&&(ht(t),t.subtreeFlags&6&&(t.flags|=8192)):ht(t),r=t.updateQueue,r!==null&&zi(t,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==r&&(t.flags|=2048),e!==null&&Y(gr),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),da(Lt),ht(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function F1(e,t){switch(kc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return da(Lt),je(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return $e(t),null;case 31:if(t.memoizedState!==null){if(vn(t),t.alternate===null)throw Error(o(340));mr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(vn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));mr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Y(Rt),null;case 4:return je(),null;case 10:return da(t.type),null;case 22:case 23:return vn(t),Ic(),e!==null&&Y(gr),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return da(Lt),null;case 25:return null;default:return null}}function qm(e,t){switch(kc(t),t.tag){case 3:da(Lt),je();break;case 26:case 27:case 5:$e(t);break;case 4:je();break;case 31:t.memoizedState!==null&&vn(t);break;case 13:vn(t);break;case 19:Y(Rt);break;case 10:da(t.type);break;case 22:case 23:vn(t),Ic(),e!==null&&Y(gr);break;case 24:da(Lt)}}function ss(e,t){try{var r=t.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var u=i.next;r=u;do{if((r.tag&e)===e){i=void 0;var m=r.create,S=r.inst;i=m(),S.destroy=i}r=r.next}while(r!==u)}}catch(T){ot(t,t.return,T)}}function Ha(e,t,r){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var m=u.next;i=m;do{if((i.tag&e)===e){var S=i.inst,T=S.destroy;if(T!==void 0){S.destroy=void 0,u=t;var U=r,K=T;try{K()}catch(ne){ot(u,U,ne)}}}i=i.next}while(i!==m)}}catch(ne){ot(t,t.return,ne)}}function Ym(e){var t=e.updateQueue;if(t!==null){var r=e.stateNode;try{Ip(t,r)}catch(i){ot(e,e.return,i)}}}function Km(e,t,r){r.props=jr(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(i){ot(e,t,i)}}function is(e,t){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof r=="function"?e.refCleanup=r(i):r.current=i}}catch(u){ot(e,t,u)}}function Qn(e,t){var r=e.ref,i=e.refCleanup;if(r!==null)if(typeof i=="function")try{i()}catch(u){ot(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(u){ot(e,t,u)}else r.current=null}function Xm(e){var t=e.type,r=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":r.autoFocus&&i.focus();break e;case"img":r.src?i.src=r.src:r.srcSet&&(i.srcset=r.srcSet)}}catch(u){ot(e,e.return,u)}}function xu(e,t,r){try{var i=e.stateNode;fb(i,e.type,r,t),i[on]=t}catch(u){ot(e,e.return,u)}}function Qm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Wa(e.type)||e.tag===4}function gu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Qm(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&&Wa(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 vu(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,t):(t=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,t.appendChild(e),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=sa));else if(i!==4&&(i===27&&Wa(e.type)&&(r=e.stateNode,t=null),e=e.child,e!==null))for(vu(e,t,r),e=e.sibling;e!==null;)vu(e,t,r),e=e.sibling}function Di(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(i!==4&&(i===27&&Wa(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(Di(e,t,r),e=e.sibling;e!==null;)Di(e,t,r),e=e.sibling}function Zm(e){var t=e.stateNode,r=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Xt(t,i,r),t[Wt]=e,t[on]=r}catch(m){ot(e,e.return,m)}}var xa=!1,_t=!1,yu=!1,Jm=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function G1(e,t){if(e=e.containerInfo,Uu=to,e=dp(e),fc(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var u=i.anchorOffset,m=i.focusNode;i=i.focusOffset;try{r.nodeType,m.nodeType}catch{r=null;break e}var S=0,T=-1,U=-1,K=0,ne=0,le=e,Z=null;t:for(;;){for(var ee;le!==r||u!==0&&le.nodeType!==3||(T=S+u),le!==m||i!==0&&le.nodeType!==3||(U=S+i),le.nodeType===3&&(S+=le.nodeValue.length),(ee=le.firstChild)!==null;)Z=le,le=ee;for(;;){if(le===e)break t;if(Z===r&&++K===u&&(T=S),Z===m&&++ne===i&&(U=S),(ee=le.nextSibling)!==null)break;le=Z,Z=le.parentNode}le=ee}r=T===-1||U===-1?null:{start:T,end:U}}else r=null}r=r||{start:0,end:0}}else r=null;for($u={focusedElem:e,selectionRange:r},to=!1,Ft=t;Ft!==null;)if(t=Ft,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ft=e;else for(;Ft!==null;){switch(t=Ft,m=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(r=0;r<e.length;r++)u=e[r],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&m!==null){e=void 0,r=t,u=m.memoizedProps,m=m.memoizedState,i=r.stateNode;try{var Se=jr(r.type,u);e=i.getSnapshotBeforeUpdate(Se,m),i.__reactInternalSnapshotBeforeUpdate=e}catch(Ae){ot(r,r.return,Ae)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,r=e.nodeType,r===9)Fu(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Fu(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(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Ft=e;break}Ft=t.return}}function eh(e,t,r){var i=r.flags;switch(r.tag){case 0:case 11:case 15:va(e,r),i&4&&ss(5,r);break;case 1:if(va(e,r),i&4)if(e=r.stateNode,t===null)try{e.componentDidMount()}catch(S){ot(r,r.return,S)}else{var u=jr(r.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(S){ot(r,r.return,S)}}i&64&&Ym(r),i&512&&is(r,r.return);break;case 3:if(va(e,r),i&64&&(e=r.updateQueue,e!==null)){if(t=null,r.child!==null)switch(r.child.tag){case 27:case 5:t=r.child.stateNode;break;case 1:t=r.child.stateNode}try{Ip(e,t)}catch(S){ot(r,r.return,S)}}break;case 27:t===null&&i&4&&Zm(r);case 26:case 5:va(e,r),t===null&&i&4&&Xm(r),i&512&&is(r,r.return);break;case 12:va(e,r);break;case 31:va(e,r),i&4&&ah(e,r);break;case 13:va(e,r),i&4&&rh(e,r),i&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=eb.bind(null,r),bb(e,r))));break;case 22:if(i=r.memoizedState!==null||xa,!i){t=t!==null&&t.memoizedState!==null||_t,u=xa;var m=_t;xa=i,(_t=t)&&!m?ya(e,r,(r.subtreeFlags&8772)!==0):va(e,r),xa=u,_t=m}break;case 30:break;default:va(e,r)}}function th(e){var t=e.alternate;t!==null&&(e.alternate=null,th(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ko(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 yt=null,un=!1;function ga(e,t,r){for(r=r.child;r!==null;)nh(e,t,r),r=r.sibling}function nh(e,t,r){if(Nt&&typeof Nt.onCommitFiberUnmount=="function")try{Nt.onCommitFiberUnmount(aa,r)}catch{}switch(r.tag){case 26:_t||Qn(r,t),ga(e,t,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:_t||Qn(r,t);var i=yt,u=un;Wa(r.type)&&(yt=r.stateNode,un=!1),ga(e,t,r),xs(r.stateNode),yt=i,un=u;break;case 5:_t||Qn(r,t);case 6:if(i=yt,u=un,yt=null,ga(e,t,r),yt=i,un=u,yt!==null)if(un)try{(yt.nodeType===9?yt.body:yt.nodeName==="HTML"?yt.ownerDocument.body:yt).removeChild(r.stateNode)}catch(m){ot(r,t,m)}else try{yt.removeChild(r.stateNode)}catch(m){ot(r,t,m)}break;case 18:yt!==null&&(un?(e=yt,Yh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),hl(e)):Yh(yt,r.stateNode));break;case 4:i=yt,u=un,yt=r.stateNode.containerInfo,un=!0,ga(e,t,r),yt=i,un=u;break;case 0:case 11:case 14:case 15:Ha(2,r,t),_t||Ha(4,r,t),ga(e,t,r);break;case 1:_t||(Qn(r,t),i=r.stateNode,typeof i.componentWillUnmount=="function"&&Km(r,t,i)),ga(e,t,r);break;case 21:ga(e,t,r);break;case 22:_t=(i=_t)||r.memoizedState!==null,ga(e,t,r),_t=i;break;default:ga(e,t,r)}}function ah(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hl(e)}catch(r){ot(t,t.return,r)}}}function rh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{hl(e)}catch(r){ot(t,t.return,r)}}function W1(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Jm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Jm),t;default:throw Error(o(435,e.tag))}}function _i(e,t){var r=W1(e);t.forEach(function(i){if(!r.has(i)){r.add(i);var u=tb.bind(null,e,i);i.then(u,u)}})}function dn(e,t){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var u=r[i],m=e,S=t,T=S;e:for(;T!==null;){switch(T.tag){case 27:if(Wa(T.type)){yt=T.stateNode,un=!1;break e}break;case 5:yt=T.stateNode,un=!1;break e;case 3:case 4:yt=T.stateNode.containerInfo,un=!0;break e}T=T.return}if(yt===null)throw Error(o(160));nh(m,S,u),yt=null,un=!1,m=u.alternate,m!==null&&(m.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)lh(t,e),t=t.sibling}var Fn=null;function lh(e,t){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:dn(t,e),fn(e),i&4&&(Ha(3,e,e.return),ss(3,e),Ha(5,e,e.return));break;case 1:dn(t,e),fn(e),i&512&&(_t||r===null||Qn(r,r.return)),i&64&&xa&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?i:r.concat(i))));break;case 26:var u=Fn;if(dn(t,e),fn(e),i&512&&(_t||r===null||Qn(r,r.return)),i&4){var m=r!==null?r.memoizedState:null;if(i=e.memoizedState,r===null)if(i===null)if(e.stateNode===null){e:{i=e.type,r=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":m=u.getElementsByTagName("title")[0],(!m||m[Dl]||m[Wt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=u.createElement(i),u.head.insertBefore(m,u.querySelector("head > title"))),Xt(m,i,r),m[Wt]=e,Pt(m),i=m;break e;case"link":var S=lx("link","href",u).get(i+(r.href||""));if(S){for(var T=0;T<S.length;T++)if(m=S[T],m.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&m.getAttribute("rel")===(r.rel==null?null:r.rel)&&m.getAttribute("title")===(r.title==null?null:r.title)&&m.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){S.splice(T,1);break t}}m=u.createElement(i),Xt(m,i,r),u.head.appendChild(m);break;case"meta":if(S=lx("meta","content",u).get(i+(r.content||""))){for(T=0;T<S.length;T++)if(m=S[T],m.getAttribute("content")===(r.content==null?null:""+r.content)&&m.getAttribute("name")===(r.name==null?null:r.name)&&m.getAttribute("property")===(r.property==null?null:r.property)&&m.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&m.getAttribute("charset")===(r.charSet==null?null:r.charSet)){S.splice(T,1);break t}}m=u.createElement(i),Xt(m,i,r),u.head.appendChild(m);break;default:throw Error(o(468,i))}m[Wt]=e,Pt(m),i=m}e.stateNode=i}else sx(u,e.type,e.stateNode);else e.stateNode=rx(u,i,e.memoizedProps);else m!==i?(m===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):m.count--,i===null?sx(u,e.type,e.stateNode):rx(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&xu(e,e.memoizedProps,r.memoizedProps)}break;case 27:dn(t,e),fn(e),i&512&&(_t||r===null||Qn(r,r.return)),r!==null&&i&4&&xu(e,e.memoizedProps,r.memoizedProps);break;case 5:if(dn(t,e),fn(e),i&512&&(_t||r===null||Qn(r,r.return)),e.flags&32){u=e.stateNode;try{Ir(u,"")}catch(Se){ot(e,e.return,Se)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,xu(e,u,r!==null?r.memoizedProps:u)),i&1024&&(yu=!0);break;case 6:if(dn(t,e),fn(e),i&4){if(e.stateNode===null)throw Error(o(162));i=e.memoizedProps,r=e.stateNode;try{r.nodeValue=i}catch(Se){ot(e,e.return,Se)}}break;case 3:if(Qi=null,u=Fn,Fn=Ki(t.containerInfo),dn(t,e),Fn=u,fn(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{hl(t.containerInfo)}catch(Se){ot(e,e.return,Se)}yu&&(yu=!1,sh(e));break;case 4:i=Fn,Fn=Ki(e.stateNode.containerInfo),dn(t,e),fn(e),Fn=i;break;case 12:dn(t,e),fn(e);break;case 31:dn(t,e),fn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,_i(e,i)));break;case 13:dn(t,e),fn(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Bi=lt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,_i(e,i)));break;case 22:u=e.memoizedState!==null;var U=r!==null&&r.memoizedState!==null,K=xa,ne=_t;if(xa=K||u,_t=ne||U,dn(t,e),_t=ne,xa=K,fn(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(r===null||U||xa||_t||kr(e)),r=null,t=e;;){if(t.tag===5||t.tag===26){if(r===null){U=r=t;try{if(m=U.stateNode,u)S=m.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{T=U.stateNode;var le=U.memoizedProps.style,Z=le!=null&&le.hasOwnProperty("display")?le.display:null;T.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(Se){ot(U,U.return,Se)}}}else if(t.tag===6){if(r===null){U=t;try{U.stateNode.nodeValue=u?"":U.memoizedProps}catch(Se){ot(U,U.return,Se)}}}else if(t.tag===18){if(r===null){U=t;try{var ee=U.stateNode;u?Kh(ee,!0):Kh(U.stateNode,!1)}catch(Se){ot(U,U.return,Se)}}}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;r===t&&(r=null),t=t.return}r===t&&(r=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(r=i.retryQueue,r!==null&&(i.retryQueue=null,_i(e,r))));break;case 19:dn(t,e),fn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,_i(e,i)));break;case 30:break;case 21:break;default:dn(t,e),fn(e)}}function fn(e){var t=e.flags;if(t&2){try{for(var r,i=e.return;i!==null;){if(Qm(i)){r=i;break}i=i.return}if(r==null)throw Error(o(160));switch(r.tag){case 27:var u=r.stateNode,m=gu(e);Di(e,m,u);break;case 5:var S=r.stateNode;r.flags&32&&(Ir(S,""),r.flags&=-33);var T=gu(e);Di(e,T,S);break;case 3:case 4:var U=r.stateNode.containerInfo,K=gu(e);vu(e,K,U);break;default:throw Error(o(161))}}catch(ne){ot(e,e.return,ne)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function sh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;sh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function va(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)eh(e,t.alternate,t),t=t.sibling}function kr(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ha(4,t,t.return),kr(t);break;case 1:Qn(t,t.return);var r=t.stateNode;typeof r.componentWillUnmount=="function"&&Km(t,t.return,r),kr(t);break;case 27:xs(t.stateNode);case 26:case 5:Qn(t,t.return),kr(t);break;case 22:t.memoizedState===null&&kr(t);break;case 30:kr(t);break;default:kr(t)}e=e.sibling}}function ya(e,t,r){for(r=r&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,m=t,S=m.flags;switch(m.tag){case 0:case 11:case 15:ya(u,m,r),ss(4,m);break;case 1:if(ya(u,m,r),i=m,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(K){ot(i,i.return,K)}if(i=m,u=i.updateQueue,u!==null){var T=i.stateNode;try{var U=u.shared.hiddenCallbacks;if(U!==null)for(u.shared.hiddenCallbacks=null,u=0;u<U.length;u++)Bp(U[u],T)}catch(K){ot(i,i.return,K)}}r&&S&64&&Ym(m),is(m,m.return);break;case 27:Zm(m);case 26:case 5:ya(u,m,r),r&&i===null&&S&4&&Xm(m),is(m,m.return);break;case 12:ya(u,m,r);break;case 31:ya(u,m,r),r&&S&4&&ah(u,m);break;case 13:ya(u,m,r),r&&S&4&&rh(u,m);break;case 22:m.memoizedState===null&&ya(u,m,r),is(m,m.return);break;case 30:break;default:ya(u,m,r)}t=t.sibling}}function bu(e,t){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&ql(r))}function Su(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ql(e))}function Gn(e,t,r,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)ih(e,t,r,i),t=t.sibling}function ih(e,t,r,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:Gn(e,t,r,i),u&2048&&ss(9,t);break;case 1:Gn(e,t,r,i);break;case 3:Gn(e,t,r,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ql(e)));break;case 12:if(u&2048){Gn(e,t,r,i),e=t.stateNode;try{var m=t.memoizedProps,S=m.id,T=m.onPostCommit;typeof T=="function"&&T(S,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(U){ot(t,t.return,U)}}else Gn(e,t,r,i);break;case 31:Gn(e,t,r,i);break;case 13:Gn(e,t,r,i);break;case 23:break;case 22:m=t.stateNode,S=t.alternate,t.memoizedState!==null?m._visibility&2?Gn(e,t,r,i):os(e,t):m._visibility&2?Gn(e,t,r,i):(m._visibility|=2,rl(e,t,r,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&bu(S,t);break;case 24:Gn(e,t,r,i),u&2048&&Su(t.alternate,t);break;default:Gn(e,t,r,i)}}function rl(e,t,r,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var m=e,S=t,T=r,U=i,K=S.flags;switch(S.tag){case 0:case 11:case 15:rl(m,S,T,U,u),ss(8,S);break;case 23:break;case 22:var ne=S.stateNode;S.memoizedState!==null?ne._visibility&2?rl(m,S,T,U,u):os(m,S):(ne._visibility|=2,rl(m,S,T,U,u)),u&&K&2048&&bu(S.alternate,S);break;case 24:rl(m,S,T,U,u),u&&K&2048&&Su(S.alternate,S);break;default:rl(m,S,T,U,u)}t=t.sibling}}function os(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var r=e,i=t,u=i.flags;switch(i.tag){case 22:os(r,i),u&2048&&bu(i.alternate,i);break;case 24:os(r,i),u&2048&&Su(i.alternate,i);break;default:os(r,i)}t=t.sibling}}var cs=8192;function ll(e,t,r){if(e.subtreeFlags&cs)for(e=e.child;e!==null;)oh(e,t,r),e=e.sibling}function oh(e,t,r){switch(e.tag){case 26:ll(e,t,r),e.flags&cs&&e.memoizedState!==null&&Lb(r,Fn,e.memoizedState,e.memoizedProps);break;case 5:ll(e,t,r);break;case 3:case 4:var i=Fn;Fn=Ki(e.stateNode.containerInfo),ll(e,t,r),Fn=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=cs,cs=16777216,ll(e,t,r),cs=i):ll(e,t,r));break;default:ll(e,t,r)}}function ch(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 us(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var i=t[r];Ft=i,dh(i,e)}ch(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)uh(e),e=e.sibling}function uh(e){switch(e.tag){case 0:case 11:case 15:us(e),e.flags&2048&&Ha(9,e,e.return);break;case 3:us(e);break;case 12:us(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Oi(e)):us(e);break;default:us(e)}}function Oi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var i=t[r];Ft=i,dh(i,e)}ch(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ha(8,t,t.return),Oi(t);break;case 22:r=t.stateNode,r._visibility&2&&(r._visibility&=-3,Oi(t));break;default:Oi(t)}e=e.sibling}}function dh(e,t){for(;Ft!==null;){var r=Ft;switch(r.tag){case 0:case 11:case 15:Ha(8,r,t);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var i=r.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:ql(r.memoizedState.cache)}if(i=r.child,i!==null)i.return=r,Ft=i;else e:for(r=e;Ft!==null;){i=Ft;var u=i.sibling,m=i.return;if(th(i),i===r){Ft=null;break e}if(u!==null){u.return=m,Ft=u;break e}Ft=m}}}var q1={getCacheForType:function(e){var t=Yt(Lt),r=t.data.get(e);return r===void 0&&(r=e(),t.data.set(e,r)),r},cacheSignal:function(){return Yt(Lt).controller.signal}},Y1=typeof WeakMap=="function"?WeakMap:Map,at=0,pt=null,Ye=null,Xe=0,it=0,yn=null,Ua=!1,sl=!1,ju=!1,ba=0,Et=0,$a=0,wr=0,ku=0,bn=0,il=0,ds=null,pn=null,wu=!1,Bi=0,fh=0,Ii=1/0,Hi=null,Va=null,It=0,Pa=null,ol=null,Sa=0,Cu=0,Eu=null,ph=null,fs=0,Nu=null;function Sn(){return(at&2)!==0&&Xe!==0?Xe&-Xe:M.T!==null?zu():Rf()}function mh(){if(bn===0)if((Xe&536870912)===0||Ze){var e=Vt;Vt<<=1,(Vt&3932160)===0&&(Vt=262144),bn=e}else bn=536870912;return e=gn.current,e!==null&&(e.flags|=32),bn}function mn(e,t,r){(e===pt&&(it===2||it===9)||e.cancelPendingCommit!==null)&&(cl(e,0),Fa(e,Xe,bn,!1)),zl(e,r),((at&2)===0||e!==pt)&&(e===pt&&((at&2)===0&&(wr|=r),Et===4&&Fa(e,Xe,bn,!1)),Zn(e))}function hh(e,t,r){if((at&6)!==0)throw Error(o(327));var i=!r&&(t&127)===0&&(t&e.expiredLanes)===0||Nn(e,t),u=i?Q1(e,t):Ru(e,t,!0),m=i;do{if(u===0){sl&&!i&&Fa(e,t,0,!1);break}else{if(r=e.current.alternate,m&&!K1(r)){u=Ru(e,t,!1),m=!1;continue}if(u===2){if(m=t,e.errorRecoveryDisabledLanes&m)var S=0;else S=e.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){t=S;e:{var T=e;u=ds;var U=T.current.memoizedState.isDehydrated;if(U&&(cl(T,S).flags|=256),S=Ru(T,S,!1),S!==2){if(ju&&!U){T.errorRecoveryDisabledLanes|=m,wr|=m,u=4;break e}m=pn,pn=u,m!==null&&(pn===null?pn=m:pn.push.apply(pn,m))}u=S}if(m=!1,u!==2)continue}}if(u===1){cl(e,0),Fa(e,t,0,!0);break}e:{switch(i=e,m=u,m){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:Fa(i,t,bn,!Ua);break e;case 2:pn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(u=Bi+300-lt(),10<u)){if(Fa(i,t,bn,!Ua),Ll(i,0,!0)!==0)break e;Sa=t,i.timeoutHandle=Wh(xh.bind(null,i,r,pn,Hi,wu,t,bn,wr,il,Ua,m,"Throttled",-0,0),u);break e}xh(i,r,pn,Hi,wu,t,bn,wr,il,Ua,m,null,-0,0)}}break}while(!0);Zn(e)}function xh(e,t,r,i,u,m,S,T,U,K,ne,le,Z,ee){if(e.timeoutHandle=-1,le=t.subtreeFlags,le&8192||(le&16785408)===16785408){le={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:sa},oh(t,m,le);var Se=(m&62914560)===m?Bi-lt():(m&4194048)===m?fh-lt():0;if(Se=zb(le,Se),Se!==null){Sa=m,e.cancelPendingCommit=Se(wh.bind(null,e,t,m,r,i,u,S,T,U,ne,le,null,Z,ee)),Fa(e,m,S,!K);return}}wh(e,t,m,r,i,u,S,T,U)}function K1(e){for(var t=e;;){var r=t.tag;if((r===0||r===11||r===15)&&t.flags&16384&&(r=t.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var i=0;i<r.length;i++){var u=r[i],m=u.getSnapshot;u=u.value;try{if(!hn(m(),u))return!1}catch{return!1}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Fa(e,t,r,i){t&=~ku,t&=~wr,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var m=31-jt(u),S=1<<m;i[m]=-1,u&=~S}r!==0&&Ef(e,r,t)}function Ui(){return(at&6)===0?(ps(0),!1):!0}function Tu(){if(Ye!==null){if(it===0)var e=Ye.return;else e=Ye,ua=hr=null,Fc(e),Jr=null,Kl=0,e=Ye;for(;e!==null;)qm(e.alternate,e),e=e.return;Ye=null}}function cl(e,t){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,hb(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),Sa=0,Tu(),pt=e,Ye=r=oa(e.current,null),Xe=t,it=0,yn=null,Ua=!1,sl=Nn(e,t),ju=!1,il=bn=ku=wr=$a=Et=0,pn=ds=null,wu=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var u=31-jt(i),m=1<<u;t|=e[u],i&=~m}return ba=t,ii(),r}function gh(e,t){Ve=null,M.H=as,t===Zr||t===hi?(t=zp(),it=3):t===Lc?(t=zp(),it=4):it=t===su?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,yn=t,Ye===null&&(Et=1,Ri(e,Mn(t,e.current)))}function vh(){var e=gn.current;return e===null?!0:(Xe&4194048)===Xe?_n===null:(Xe&62914560)===Xe||(Xe&536870912)!==0?e===_n:!1}function yh(){var e=M.H;return M.H=as,e===null?as:e}function bh(){var e=M.A;return M.A=q1,e}function $i(){Et=4,Ua||(Xe&4194048)!==Xe&&gn.current!==null||(sl=!0),($a&134217727)===0&&(wr&134217727)===0||pt===null||Fa(pt,Xe,bn,!1)}function Ru(e,t,r){var i=at;at|=2;var u=yh(),m=bh();(pt!==e||Xe!==t)&&(Hi=null,cl(e,t)),t=!1;var S=Et;e:do try{if(it!==0&&Ye!==null){var T=Ye,U=yn;switch(it){case 8:Tu(),S=6;break e;case 3:case 2:case 9:case 6:gn.current===null&&(t=!0);var K=it;if(it=0,yn=null,ul(e,T,U,K),r&&sl){S=0;break e}break;default:K=it,it=0,yn=null,ul(e,T,U,K)}}X1(),S=Et;break}catch(ne){gh(e,ne)}while(!0);return t&&e.shellSuspendCounter++,ua=hr=null,at=i,M.H=u,M.A=m,Ye===null&&(pt=null,Xe=0,ii()),S}function X1(){for(;Ye!==null;)Sh(Ye)}function Q1(e,t){var r=at;at|=2;var i=yh(),u=bh();pt!==e||Xe!==t?(Hi=null,Ii=lt()+500,cl(e,t)):sl=Nn(e,t);e:do try{if(it!==0&&Ye!==null){t=Ye;var m=yn;t:switch(it){case 1:it=0,yn=null,ul(e,t,m,1);break;case 2:case 9:if(Mp(m)){it=0,yn=null,jh(t);break}t=function(){it!==2&&it!==9||pt!==e||(it=7),Zn(e)},m.then(t,t);break e;case 3:it=7;break e;case 4:it=5;break e;case 7:Mp(m)?(it=0,yn=null,jh(t)):(it=0,yn=null,ul(e,t,m,7));break;case 5:var S=null;switch(Ye.tag){case 26:S=Ye.memoizedState;case 5:case 27:var T=Ye;if(S?ix(S):T.stateNode.complete){it=0,yn=null;var U=T.sibling;if(U!==null)Ye=U;else{var K=T.return;K!==null?(Ye=K,Vi(K)):Ye=null}break t}}it=0,yn=null,ul(e,t,m,5);break;case 6:it=0,yn=null,ul(e,t,m,6);break;case 8:Tu(),Et=6;break e;default:throw Error(o(462))}}Z1();break}catch(ne){gh(e,ne)}while(!0);return ua=hr=null,M.H=i,M.A=u,at=r,Ye!==null?0:(pt=null,Xe=0,ii(),Et)}function Z1(){for(;Ye!==null&&!Bt();)Sh(Ye)}function Sh(e){var t=Gm(e.alternate,e,ba);e.memoizedProps=e.pendingProps,t===null?Vi(e):Ye=t}function jh(e){var t=e,r=t.alternate;switch(t.tag){case 15:case 0:t=Hm(r,t,t.pendingProps,t.type,void 0,Xe);break;case 11:t=Hm(r,t,t.pendingProps,t.type.render,t.ref,Xe);break;case 5:Fc(t);default:qm(r,t),t=Ye=bp(t,ba),t=Gm(r,t,ba)}e.memoizedProps=e.pendingProps,t===null?Vi(e):Ye=t}function ul(e,t,r,i){ua=hr=null,Fc(t),Jr=null,Kl=0;var u=t.return;try{if(U1(e,u,t,r,Xe)){Et=1,Ri(e,Mn(r,e.current)),Ye=null;return}}catch(m){if(u!==null)throw Ye=u,m;Et=1,Ri(e,Mn(r,e.current)),Ye=null;return}t.flags&32768?(Ze||i===1?e=!0:sl||(Xe&536870912)!==0?e=!1:(Ua=e=!0,(i===2||i===9||i===3||i===6)&&(i=gn.current,i!==null&&i.tag===13&&(i.flags|=16384))),kh(t,e)):Vi(t)}function Vi(e){var t=e;do{if((t.flags&32768)!==0){kh(t,Ua);return}e=t.return;var r=P1(t.alternate,t,ba);if(r!==null){Ye=r;return}if(t=t.sibling,t!==null){Ye=t;return}Ye=t=e}while(t!==null);Et===0&&(Et=5)}function kh(e,t){do{var r=F1(e.alternate,e);if(r!==null){r.flags&=32767,Ye=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!t&&(e=e.sibling,e!==null)){Ye=e;return}Ye=e=r}while(e!==null);Et=6,Ye=null}function wh(e,t,r,i,u,m,S,T,U){e.cancelPendingCommit=null;do Pi();while(It!==0);if((at&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(m=t.lanes|t.childLanes,m|=gc,My(e,r,m,S,T,U),e===pt&&(Ye=pt=null,Xe=0),ol=t,Pa=e,Sa=r,Cu=m,Eu=u,ph=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,nb(_e,function(){return Rh(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=M.T,M.T=null,u=I.p,I.p=2,S=at,at|=4;try{G1(e,t,r)}finally{at=S,I.p=u,M.T=i}}It=1,Ch(),Eh(),Nh()}}function Ch(){if(It===1){It=0;var e=Pa,t=ol,r=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||r){r=M.T,M.T=null;var i=I.p;I.p=2;var u=at;at|=4;try{lh(t,e);var m=$u,S=dp(e.containerInfo),T=m.focusedElem,U=m.selectionRange;if(S!==T&&T&&T.ownerDocument&&up(T.ownerDocument.documentElement,T)){if(U!==null&&fc(T)){var K=U.start,ne=U.end;if(ne===void 0&&(ne=K),"selectionStart"in T)T.selectionStart=K,T.selectionEnd=Math.min(ne,T.value.length);else{var le=T.ownerDocument||document,Z=le&&le.defaultView||window;if(Z.getSelection){var ee=Z.getSelection(),Se=T.textContent.length,Ae=Math.min(U.start,Se),dt=U.end===void 0?Ae:Math.min(U.end,Se);!ee.extend&&Ae>dt&&(S=dt,dt=Ae,Ae=S);var F=cp(T,Ae),P=cp(T,dt);if(F&&P&&(ee.rangeCount!==1||ee.anchorNode!==F.node||ee.anchorOffset!==F.offset||ee.focusNode!==P.node||ee.focusOffset!==P.offset)){var q=le.createRange();q.setStart(F.node,F.offset),ee.removeAllRanges(),Ae>dt?(ee.addRange(q),ee.extend(P.node,P.offset)):(q.setEnd(P.node,P.offset),ee.addRange(q))}}}}for(le=[],ee=T;ee=ee.parentNode;)ee.nodeType===1&&le.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<le.length;T++){var re=le[T];re.element.scrollLeft=re.left,re.element.scrollTop=re.top}}to=!!Uu,$u=Uu=null}finally{at=u,I.p=i,M.T=r}}e.current=t,It=2}}function Eh(){if(It===2){It=0;var e=Pa,t=ol,r=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||r){r=M.T,M.T=null;var i=I.p;I.p=2;var u=at;at|=4;try{eh(e,t.alternate,t)}finally{at=u,I.p=i,M.T=r}}It=3}}function Nh(){if(It===4||It===3){It=0,Gt();var e=Pa,t=ol,r=Sa,i=ph;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?It=5:(It=0,ol=Pa=null,Th(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(Va=null),qo(r),t=t.stateNode,Nt&&typeof Nt.onCommitFiberRoot=="function")try{Nt.onCommitFiberRoot(aa,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=M.T,u=I.p,I.p=2,M.T=null;try{for(var m=e.onRecoverableError,S=0;S<i.length;S++){var T=i[S];m(T.value,{componentStack:T.stack})}}finally{M.T=t,I.p=u}}(Sa&3)!==0&&Pi(),Zn(e),u=e.pendingLanes,(r&261930)!==0&&(u&42)!==0?e===Nu?fs++:(fs=0,Nu=e):fs=0,ps(0)}}function Th(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ql(t)))}function Pi(){return Ch(),Eh(),Nh(),Rh()}function Rh(){if(It!==5)return!1;var e=Pa,t=Cu;Cu=0;var r=qo(Sa),i=M.T,u=I.p;try{I.p=32>r?32:r,M.T=null,r=Eu,Eu=null;var m=Pa,S=Sa;if(It=0,ol=Pa=null,Sa=0,(at&6)!==0)throw Error(o(331));var T=at;if(at|=4,uh(m.current),ih(m,m.current,S,r),at=T,ps(0,!1),Nt&&typeof Nt.onPostCommitFiberRoot=="function")try{Nt.onPostCommitFiberRoot(aa,m)}catch{}return!0}finally{I.p=u,M.T=i,Th(e,t)}}function Ah(e,t,r){t=Mn(r,t),t=lu(e.stateNode,t,2),e=Oa(e,t,2),e!==null&&(zl(e,2),Zn(e))}function ot(e,t,r){if(e.tag===3)Ah(e,e,r);else for(;t!==null;){if(t.tag===3){Ah(t,e,r);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Va===null||!Va.has(i))){e=Mn(r,e),r=Mm(2),i=Oa(t,r,2),i!==null&&(Lm(r,i,t,e),zl(i,2),Zn(i));break}}t=t.return}}function Au(e,t,r){var i=e.pingCache;if(i===null){i=e.pingCache=new Y1;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(r)||(ju=!0,u.add(r),e=J1.bind(null,e,t,r),t.then(e,e))}function J1(e,t,r){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,pt===e&&(Xe&r)===r&&(Et===4||Et===3&&(Xe&62914560)===Xe&&300>lt()-Bi?(at&2)===0&&cl(e,0):ku|=r,il===Xe&&(il=0)),Zn(e)}function Mh(e,t){t===0&&(t=Cf()),e=fr(e,t),e!==null&&(zl(e,t),Zn(e))}function eb(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Mh(e,r)}function tb(e,t){var r=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(r=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(o(314))}i!==null&&i.delete(t),Mh(e,r)}function nb(e,t){return De(e,t)}var Fi=null,dl=null,Mu=!1,Gi=!1,Lu=!1,Ga=0;function Zn(e){e!==dl&&e.next===null&&(dl===null?Fi=dl=e:dl=dl.next=e),Gi=!0,Mu||(Mu=!0,rb())}function ps(e,t){if(!Lu&&Gi){Lu=!0;do for(var r=!1,i=Fi;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var m=0;else{var S=i.suspendedLanes,T=i.pingedLanes;m=(1<<31-jt(42|e)+1)-1,m&=u&~(S&~T),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(r=!0,_h(i,m))}else m=Xe,m=Ll(i,i===pt?m:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(m&3)===0||Nn(i,m)||(r=!0,_h(i,m));i=i.next}while(r);Lu=!1}}function ab(){Lh()}function Lh(){Gi=Mu=!1;var e=0;Ga!==0&&mb()&&(e=Ga);for(var t=lt(),r=null,i=Fi;i!==null;){var u=i.next,m=zh(i,t);m===0?(i.next=null,r===null?Fi=u:r.next=u,u===null&&(dl=r)):(r=i,(e!==0||(m&3)!==0)&&(Gi=!0)),i=u}It!==0&&It!==5||ps(e),Ga!==0&&(Ga=0)}function zh(e,t){for(var r=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var S=31-jt(m),T=1<<S,U=u[S];U===-1?((T&r)===0||(T&i)!==0)&&(u[S]=Fo(T,t)):U<=t&&(e.expiredLanes|=T),m&=~T}if(t=pt,r=Xe,r=Ll(e,e===t?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,r===0||e===t&&(it===2||it===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&Ie(i),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||Nn(e,r)){if(t=r&-r,t===e.callbackPriority)return t;switch(i!==null&&Ie(i),qo(r)){case 2:case 8:r=Mt;break;case 32:r=_e;break;case 268435456:r=Qt;break;default:r=_e}return i=Dh.bind(null,e),r=De(r,i),e.callbackPriority=t,e.callbackNode=r,t}return i!==null&&i!==null&&Ie(i),e.callbackPriority=2,e.callbackNode=null,2}function Dh(e,t){if(It!==0&&It!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(Pi()&&e.callbackNode!==r)return null;var i=Xe;return i=Ll(e,e===pt?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(hh(e,i,t),zh(e,lt()),e.callbackNode!=null&&e.callbackNode===r?Dh.bind(null,e):null)}function _h(e,t){if(Pi())return null;hh(e,t,!0)}function rb(){xb(function(){(at&6)!==0?De(ve,ab):Lh()})}function zu(){if(Ga===0){var e=Xr;e===0&&(e=Ge,Ge<<=1,(Ge&261888)===0&&(Ge=256)),Ga=e}return Ga}function Oh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Js(""+e)}function Bh(e,t){var r=t.ownerDocument.createElement("input");return r.name=t.name,r.value=t.value,e.id&&r.setAttribute("form",e.id),t.parentNode.insertBefore(r,t),e=new FormData(e),r.parentNode.removeChild(r),e}function lb(e,t,r,i,u){if(t==="submit"&&r&&r.stateNode===u){var m=Oh((u[on]||null).action),S=i.submitter;S&&(t=(t=S[on]||null)?Oh(t.formAction):S.getAttribute("formAction"),t!==null&&(m=t,S=null));var T=new ai("action","action",null,i,u);e.push({event:T,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Ga!==0){var U=S?Bh(u,S):new FormData(u);Jc(r,{pending:!0,data:U,method:u.method,action:m},null,U)}}else typeof m=="function"&&(T.preventDefault(),U=S?Bh(u,S):new FormData(u),Jc(r,{pending:!0,data:U,method:u.method,action:m},m,U))},currentTarget:u}]})}}for(var Du=0;Du<xc.length;Du++){var _u=xc[Du],sb=_u.toLowerCase(),ib=_u[0].toUpperCase()+_u.slice(1);Pn(sb,"on"+ib)}Pn(mp,"onAnimationEnd"),Pn(hp,"onAnimationIteration"),Pn(xp,"onAnimationStart"),Pn("dblclick","onDoubleClick"),Pn("focusin","onFocus"),Pn("focusout","onBlur"),Pn(k1,"onTransitionRun"),Pn(w1,"onTransitionStart"),Pn(C1,"onTransitionCancel"),Pn(gp,"onTransitionEnd"),Or("onMouseEnter",["mouseout","mouseover"]),Or("onMouseLeave",["mouseout","mouseover"]),Or("onPointerEnter",["pointerout","pointerover"]),Or("onPointerLeave",["pointerout","pointerover"]),or("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),or("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),or("onBeforeInput",["compositionend","keypress","textInput","paste"]),or("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),or("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),or("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ms="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(" "),ob=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ms));function Ih(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var i=e[r],u=i.event;i=i.listeners;e:{var m=void 0;if(t)for(var S=i.length-1;0<=S;S--){var T=i[S],U=T.instance,K=T.currentTarget;if(T=T.listener,U!==m&&u.isPropagationStopped())break e;m=T,u.currentTarget=K;try{m(u)}catch(ne){si(ne)}u.currentTarget=null,m=U}else for(S=0;S<i.length;S++){if(T=i[S],U=T.instance,K=T.currentTarget,T=T.listener,U!==m&&u.isPropagationStopped())break e;m=T,u.currentTarget=K;try{m(u)}catch(ne){si(ne)}u.currentTarget=null,m=U}}}}function Ke(e,t){var r=t[Yo];r===void 0&&(r=t[Yo]=new Set);var i=e+"__bubble";r.has(i)||(Hh(t,e,2,!1),r.add(i))}function Ou(e,t,r){var i=0;t&&(i|=4),Hh(r,e,i,t)}var Wi="_reactListening"+Math.random().toString(36).slice(2);function Bu(e){if(!e[Wi]){e[Wi]=!0,Lf.forEach(function(r){r!=="selectionchange"&&(ob.has(r)||Ou(r,!1,e),Ou(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Wi]||(t[Wi]=!0,Ou("selectionchange",!1,t))}}function Hh(e,t,r,i){switch(mx(t)){case 2:var u=Ob;break;case 8:u=Bb;break;default:u=Zu}r=u.bind(null,t,r,e),u=void 0,!ac||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,r,{capture:!0,passive:u}):e.addEventListener(t,r,!0):u!==void 0?e.addEventListener(t,r,{passive:u}):e.addEventListener(t,r,!1)}function Iu(e,t,r,i,u){var m=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var S=i.tag;if(S===3||S===4){var T=i.stateNode.containerInfo;if(T===u)break;if(S===4)for(S=i.return;S!==null;){var U=S.tag;if((U===3||U===4)&&S.stateNode.containerInfo===u)return;S=S.return}for(;T!==null;){if(S=zr(T),S===null)return;if(U=S.tag,U===5||U===6||U===26||U===27){i=m=S;continue e}T=T.parentNode}}i=i.return}Ff(function(){var K=m,ne=tc(r),le=[];e:{var Z=vp.get(e);if(Z!==void 0){var ee=ai,Se=e;switch(e){case"keypress":if(ti(r)===0)break e;case"keydown":case"keyup":ee=t1;break;case"focusin":Se="focus",ee=ic;break;case"focusout":Se="blur",ee=ic;break;case"beforeblur":case"afterblur":ee=ic;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ee=qf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=Py;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=r1;break;case mp:case hp:case xp:ee=Wy;break;case gp:ee=s1;break;case"scroll":case"scrollend":ee=$y;break;case"wheel":ee=o1;break;case"copy":case"cut":case"paste":ee=Yy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=Kf;break;case"toggle":case"beforetoggle":ee=u1}var Ae=(t&4)!==0,dt=!Ae&&(e==="scroll"||e==="scrollend"),F=Ae?Z!==null?Z+"Capture":null:Z;Ae=[];for(var P=K,q;P!==null;){var re=P;if(q=re.stateNode,re=re.tag,re!==5&&re!==26&&re!==27||q===null||F===null||(re=Ol(P,F),re!=null&&Ae.push(hs(P,re,q))),dt)break;P=P.return}0<Ae.length&&(Z=new ee(Z,Se,null,r,ne),le.push({event:Z,listeners:Ae}))}}if((t&7)===0){e:{if(Z=e==="mouseover"||e==="pointerover",ee=e==="mouseout"||e==="pointerout",Z&&r!==ec&&(Se=r.relatedTarget||r.fromElement)&&(zr(Se)||Se[Lr]))break e;if((ee||Z)&&(Z=ne.window===ne?ne:(Z=ne.ownerDocument)?Z.defaultView||Z.parentWindow:window,ee?(Se=r.relatedTarget||r.toElement,ee=K,Se=Se?zr(Se):null,Se!==null&&(dt=f(Se),Ae=Se.tag,Se!==dt||Ae!==5&&Ae!==27&&Ae!==6)&&(Se=null)):(ee=null,Se=K),ee!==Se)){if(Ae=qf,re="onMouseLeave",F="onMouseEnter",P="mouse",(e==="pointerout"||e==="pointerover")&&(Ae=Kf,re="onPointerLeave",F="onPointerEnter",P="pointer"),dt=ee==null?Z:_l(ee),q=Se==null?Z:_l(Se),Z=new Ae(re,P+"leave",ee,r,ne),Z.target=dt,Z.relatedTarget=q,re=null,zr(ne)===K&&(Ae=new Ae(F,P+"enter",Se,r,ne),Ae.target=q,Ae.relatedTarget=dt,re=Ae),dt=re,ee&&Se)t:{for(Ae=cb,F=ee,P=Se,q=0,re=F;re;re=Ae(re))q++;re=0;for(var Te=P;Te;Te=Ae(Te))re++;for(;0<q-re;)F=Ae(F),q--;for(;0<re-q;)P=Ae(P),re--;for(;q--;){if(F===P||P!==null&&F===P.alternate){Ae=F;break t}F=Ae(F),P=Ae(P)}Ae=null}else Ae=null;ee!==null&&Uh(le,Z,ee,Ae,!1),Se!==null&&dt!==null&&Uh(le,dt,Se,Ae,!0)}}e:{if(Z=K?_l(K):window,ee=Z.nodeName&&Z.nodeName.toLowerCase(),ee==="select"||ee==="input"&&Z.type==="file")var et=ap;else if(tp(Z))if(rp)et=b1;else{et=v1;var ke=g1}else ee=Z.nodeName,!ee||ee.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?K&&Jo(K.elementType)&&(et=ap):et=y1;if(et&&(et=et(e,K))){np(le,et,r,ne);break e}ke&&ke(e,Z,K),e==="focusout"&&K&&Z.type==="number"&&K.memoizedProps.value!=null&&Zo(Z,"number",Z.value)}switch(ke=K?_l(K):window,e){case"focusin":(tp(ke)||ke.contentEditable==="true")&&(Vr=ke,pc=K,Fl=null);break;case"focusout":Fl=pc=Vr=null;break;case"mousedown":mc=!0;break;case"contextmenu":case"mouseup":case"dragend":mc=!1,fp(le,r,ne);break;case"selectionchange":if(j1)break;case"keydown":case"keyup":fp(le,r,ne)}var Pe;if(cc)e:{switch(e){case"compositionstart":var Qe="onCompositionStart";break e;case"compositionend":Qe="onCompositionEnd";break e;case"compositionupdate":Qe="onCompositionUpdate";break e}Qe=void 0}else $r?Jf(e,r)&&(Qe="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(Qe="onCompositionStart");Qe&&(Xf&&r.locale!=="ko"&&($r||Qe!=="onCompositionStart"?Qe==="onCompositionEnd"&&$r&&(Pe=Gf()):(Ra=ne,rc="value"in Ra?Ra.value:Ra.textContent,$r=!0)),ke=qi(K,Qe),0<ke.length&&(Qe=new Yf(Qe,e,null,r,ne),le.push({event:Qe,listeners:ke}),Pe?Qe.data=Pe:(Pe=ep(r),Pe!==null&&(Qe.data=Pe)))),(Pe=f1?p1(e,r):m1(e,r))&&(Qe=qi(K,"onBeforeInput"),0<Qe.length&&(ke=new Yf("onBeforeInput","beforeinput",null,r,ne),le.push({event:ke,listeners:Qe}),ke.data=Pe)),lb(le,e,K,r,ne)}Ih(le,t)})}function hs(e,t,r){return{instance:e,listener:t,currentTarget:r}}function qi(e,t){for(var r=t+"Capture",i=[];e!==null;){var u=e,m=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||m===null||(u=Ol(e,r),u!=null&&i.unshift(hs(e,u,m)),u=Ol(e,t),u!=null&&i.push(hs(e,u,m))),e.tag===3)return i;e=e.return}return[]}function cb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Uh(e,t,r,i,u){for(var m=t._reactName,S=[];r!==null&&r!==i;){var T=r,U=T.alternate,K=T.stateNode;if(T=T.tag,U!==null&&U===i)break;T!==5&&T!==26&&T!==27||K===null||(U=K,u?(K=Ol(r,m),K!=null&&S.unshift(hs(r,K,U))):u||(K=Ol(r,m),K!=null&&S.push(hs(r,K,U)))),r=r.return}S.length!==0&&e.push({event:t,listeners:S})}var ub=/\r\n?/g,db=/\u0000|\uFFFD/g;function $h(e){return(typeof e=="string"?e:""+e).replace(ub,`
50
+ `).replace(db,"")}function Vh(e,t){return t=$h(t),$h(e)===t}function ut(e,t,r,i,u,m){switch(r){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||Ir(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&Ir(e,""+i);break;case"className":Qs(e,"class",i);break;case"tabIndex":Qs(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Qs(e,r,i);break;case"style":Vf(e,i,m);break;case"data":if(t!=="object"){Qs(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||r!=="href")){e.removeAttribute(r);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=Js(""+i),e.setAttribute(r,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(r,"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 m=="function"&&(r==="formAction"?(t!=="input"&&ut(e,t,"name",u.name,u,null),ut(e,t,"formEncType",u.formEncType,u,null),ut(e,t,"formMethod",u.formMethod,u,null),ut(e,t,"formTarget",u.formTarget,u,null)):(ut(e,t,"encType",u.encType,u,null),ut(e,t,"method",u.method,u,null),ut(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=Js(""+i),e.setAttribute(r,i);break;case"onClick":i!=null&&(e.onclick=sa);break;case"onScroll":i!=null&&Ke("scroll",e);break;case"onScrollEnd":i!=null&&Ke("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(r=i.__html,r!=null){if(u.children!=null)throw Error(o(60));e.innerHTML=r}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}r=Js(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""+i):e.removeAttribute(r);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":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":i===!0?e.setAttribute(r,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,i):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(r,i):e.removeAttribute(r);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(r):e.setAttribute(r,i);break;case"popover":Ke("beforetoggle",e),Ke("toggle",e),Xs(e,"popover",i);break;case"xlinkActuate":la(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":la(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":la(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":la(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":la(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":la(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":la(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":la(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":la(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Xs(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=Hy.get(r)||r,Xs(e,r,i))}}function Hu(e,t,r,i,u,m){switch(r){case"style":Vf(e,i,m);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(r=i.__html,r!=null){if(u.children!=null)throw Error(o(60));e.innerHTML=r}}break;case"children":typeof i=="string"?Ir(e,i):(typeof i=="number"||typeof i=="bigint")&&Ir(e,""+i);break;case"onScroll":i!=null&&Ke("scroll",e);break;case"onScrollEnd":i!=null&&Ke("scrollend",e);break;case"onClick":i!=null&&(e.onclick=sa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!zf.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(u=r.endsWith("Capture"),t=r.slice(2,u?r.length-7:void 0),m=e[on]||null,m=m!=null?m[r]:null,typeof m=="function"&&e.removeEventListener(t,m,u),typeof i=="function")){typeof m!="function"&&m!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(t,i,u);break e}r in e?e[r]=i:i===!0?e.setAttribute(r,""):Xs(e,r,i)}}}function Xt(e,t,r){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 i=!1,u=!1,m;for(m in r)if(r.hasOwnProperty(m)){var S=r[m];if(S!=null)switch(m){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:ut(e,t,m,S,r,null)}}u&&ut(e,t,"srcSet",r.srcSet,r,null),i&&ut(e,t,"src",r.src,r,null);return;case"input":Ke("invalid",e);var T=m=S=u=null,U=null,K=null;for(i in r)if(r.hasOwnProperty(i)){var ne=r[i];if(ne!=null)switch(i){case"name":u=ne;break;case"type":S=ne;break;case"checked":U=ne;break;case"defaultChecked":K=ne;break;case"value":m=ne;break;case"defaultValue":T=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(o(137,t));break;default:ut(e,t,i,ne,r,null)}}If(e,m,T,U,K,S,u,!1);return;case"select":Ke("invalid",e),i=S=m=null;for(u in r)if(r.hasOwnProperty(u)&&(T=r[u],T!=null))switch(u){case"value":m=T;break;case"defaultValue":S=T;break;case"multiple":i=T;default:ut(e,t,u,T,r,null)}t=m,r=S,e.multiple=!!i,t!=null?Br(e,!!i,t,!1):r!=null&&Br(e,!!i,r,!0);return;case"textarea":Ke("invalid",e),m=u=i=null;for(S in r)if(r.hasOwnProperty(S)&&(T=r[S],T!=null))switch(S){case"value":i=T;break;case"defaultValue":u=T;break;case"children":m=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(o(91));break;default:ut(e,t,S,T,r,null)}Uf(e,i,u,m);return;case"option":for(U in r)if(r.hasOwnProperty(U)&&(i=r[U],i!=null))switch(U){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:ut(e,t,U,i,r,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(i=0;i<ms.length;i++)Ke(ms[i],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(K in r)if(r.hasOwnProperty(K)&&(i=r[K],i!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:ut(e,t,K,i,r,null)}return;default:if(Jo(t)){for(ne in r)r.hasOwnProperty(ne)&&(i=r[ne],i!==void 0&&Hu(e,t,ne,i,r,void 0));return}}for(T in r)r.hasOwnProperty(T)&&(i=r[T],i!=null&&ut(e,t,T,i,r,null))}function fb(e,t,r,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,m=null,S=null,T=null,U=null,K=null,ne=null;for(ee in r){var le=r[ee];if(r.hasOwnProperty(ee)&&le!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":U=le;default:i.hasOwnProperty(ee)||ut(e,t,ee,null,i,le)}}for(var Z in i){var ee=i[Z];if(le=r[Z],i.hasOwnProperty(Z)&&(ee!=null||le!=null))switch(Z){case"type":m=ee;break;case"name":u=ee;break;case"checked":K=ee;break;case"defaultChecked":ne=ee;break;case"value":S=ee;break;case"defaultValue":T=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(o(137,t));break;default:ee!==le&&ut(e,t,Z,ee,i,le)}}Qo(e,S,T,U,K,ne,m,u);return;case"select":ee=S=T=Z=null;for(m in r)if(U=r[m],r.hasOwnProperty(m)&&U!=null)switch(m){case"value":break;case"multiple":ee=U;default:i.hasOwnProperty(m)||ut(e,t,m,null,i,U)}for(u in i)if(m=i[u],U=r[u],i.hasOwnProperty(u)&&(m!=null||U!=null))switch(u){case"value":Z=m;break;case"defaultValue":T=m;break;case"multiple":S=m;default:m!==U&&ut(e,t,u,m,i,U)}t=T,r=S,i=ee,Z!=null?Br(e,!!r,Z,!1):!!i!=!!r&&(t!=null?Br(e,!!r,t,!0):Br(e,!!r,r?[]:"",!1));return;case"textarea":ee=Z=null;for(T in r)if(u=r[T],r.hasOwnProperty(T)&&u!=null&&!i.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:ut(e,t,T,null,i,u)}for(S in i)if(u=i[S],m=r[S],i.hasOwnProperty(S)&&(u!=null||m!=null))switch(S){case"value":Z=u;break;case"defaultValue":ee=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(o(91));break;default:u!==m&&ut(e,t,S,u,i,m)}Hf(e,Z,ee);return;case"option":for(var Se in r)if(Z=r[Se],r.hasOwnProperty(Se)&&Z!=null&&!i.hasOwnProperty(Se))switch(Se){case"selected":e.selected=!1;break;default:ut(e,t,Se,null,i,Z)}for(U in i)if(Z=i[U],ee=r[U],i.hasOwnProperty(U)&&Z!==ee&&(Z!=null||ee!=null))switch(U){case"selected":e.selected=Z&&typeof Z!="function"&&typeof Z!="symbol";break;default:ut(e,t,U,Z,i,ee)}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 Ae in r)Z=r[Ae],r.hasOwnProperty(Ae)&&Z!=null&&!i.hasOwnProperty(Ae)&&ut(e,t,Ae,null,i,Z);for(K in i)if(Z=i[K],ee=r[K],i.hasOwnProperty(K)&&Z!==ee&&(Z!=null||ee!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(o(137,t));break;default:ut(e,t,K,Z,i,ee)}return;default:if(Jo(t)){for(var dt in r)Z=r[dt],r.hasOwnProperty(dt)&&Z!==void 0&&!i.hasOwnProperty(dt)&&Hu(e,t,dt,void 0,i,Z);for(ne in i)Z=i[ne],ee=r[ne],!i.hasOwnProperty(ne)||Z===ee||Z===void 0&&ee===void 0||Hu(e,t,ne,Z,i,ee);return}}for(var F in r)Z=r[F],r.hasOwnProperty(F)&&Z!=null&&!i.hasOwnProperty(F)&&ut(e,t,F,null,i,Z);for(le in i)Z=i[le],ee=r[le],!i.hasOwnProperty(le)||Z===ee||Z==null&&ee==null||ut(e,t,le,Z,i,ee)}function Ph(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function pb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,r=performance.getEntriesByType("resource"),i=0;i<r.length;i++){var u=r[i],m=u.transferSize,S=u.initiatorType,T=u.duration;if(m&&T&&Ph(S)){for(S=0,T=u.responseEnd,i+=1;i<r.length;i++){var U=r[i],K=U.startTime;if(K>T)break;var ne=U.transferSize,le=U.initiatorType;ne&&Ph(le)&&(U=U.responseEnd,S+=ne*(U<T?1:(T-K)/(U-K)))}if(--i,t+=8*(m+S)/(u.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 Uu=null,$u=null;function Yi(e){return e.nodeType===9?e:e.ownerDocument}function Fh(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 Gh(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 Vu(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 Pu=null;function mb(){var e=window.event;return e&&e.type==="popstate"?e===Pu?!1:(Pu=e,!0):(Pu=null,!1)}var Wh=typeof setTimeout=="function"?setTimeout:void 0,hb=typeof clearTimeout=="function"?clearTimeout:void 0,qh=typeof Promise=="function"?Promise:void 0,xb=typeof queueMicrotask=="function"?queueMicrotask:typeof qh<"u"?function(e){return qh.resolve(null).then(e).catch(gb)}:Wh;function gb(e){setTimeout(function(){throw e})}function Wa(e){return e==="head"}function Yh(e,t){var r=t,i=0;do{var u=r.nextSibling;if(e.removeChild(r),u&&u.nodeType===8)if(r=u.data,r==="/$"||r==="/&"){if(i===0){e.removeChild(u),hl(t);return}i--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")i++;else if(r==="html")xs(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,xs(r);for(var m=r.firstChild;m;){var S=m.nextSibling,T=m.nodeName;m[Dl]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&m.rel.toLowerCase()==="stylesheet"||r.removeChild(m),m=S}}else r==="body"&&xs(e.ownerDocument.body);r=u}while(r);hl(t)}function Kh(e,t){var r=e;e=0;do{var i=r.nextSibling;if(r.nodeType===1?t?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(t?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=i}while(r)}function Fu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var r=t;switch(t=t.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Fu(r),Ko(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function vb(e,t,r,i){for(;e.nodeType===1;){var u=r;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Dl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(m=e.getAttribute("rel"),m==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(m!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(m=e.getAttribute("src"),(m!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&m&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var m=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===m)return e}else return e;if(e=On(e.nextSibling),e===null)break}return null}function yb(e,t,r){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=On(e.nextSibling),e===null))return null;return e}function Xh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=On(e.nextSibling),e===null))return null;return e}function Gu(e){return e.data==="$?"||e.data==="$~"}function Wu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function bb(e,t){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||r.readyState!=="loading")t();else{var i=function(){t(),r.removeEventListener("DOMContentLoaded",i)};r.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function On(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 qu=null;function Qh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(t===0)return On(e.nextSibling);t--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||t++}e=e.nextSibling}return null}function Zh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(t===0)return e;t--}else r!=="/$"&&r!=="/&"||t++}e=e.previousSibling}return null}function Jh(e,t,r){switch(t=Yi(r),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function xs(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ko(e)}var Bn=new Map,ex=new Set;function Ki(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ja=I.d;I.d={f:Sb,r:jb,D:kb,C:wb,L:Cb,m:Eb,X:Tb,S:Nb,M:Rb};function Sb(){var e=ja.f(),t=Ui();return e||t}function jb(e){var t=Dr(e);t!==null&&t.tag===5&&t.type==="form"?gm(t):ja.r(e)}var fl=typeof document>"u"?null:document;function tx(e,t,r){var i=fl;if(i&&typeof t=="string"&&t){var u=Rn(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),ex.has(u)||(ex.add(u),e={rel:e,crossOrigin:r,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),Xt(t,"link",e),Pt(t),i.head.appendChild(t)))}}function kb(e){ja.D(e),tx("dns-prefetch",e,null)}function wb(e,t){ja.C(e,t),tx("preconnect",e,t)}function Cb(e,t,r){ja.L(e,t,r);var i=fl;if(i&&e&&t){var u='link[rel="preload"][as="'+Rn(t)+'"]';t==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+Rn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+Rn(r.imageSizes)+'"]')):u+='[href="'+Rn(e)+'"]';var m=u;switch(t){case"style":m=pl(e);break;case"script":m=ml(e)}Bn.has(m)||(e=v({rel:"preload",href:t==="image"&&r&&r.imageSrcSet?void 0:e,as:t},r),Bn.set(m,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(gs(m))||t==="script"&&i.querySelector(vs(m))||(t=i.createElement("link"),Xt(t,"link",e),Pt(t),i.head.appendChild(t)))}}function Eb(e,t){ja.m(e,t);var r=fl;if(r&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Rn(i)+'"][href="'+Rn(e)+'"]',m=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=ml(e)}if(!Bn.has(m)&&(e=v({rel:"modulepreload",href:e},t),Bn.set(m,e),r.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(vs(m)))return}i=r.createElement("link"),Xt(i,"link",e),Pt(i),r.head.appendChild(i)}}}function Nb(e,t,r){ja.S(e,t,r);var i=fl;if(i&&e){var u=_r(i).hoistableStyles,m=pl(e);t=t||"default";var S=u.get(m);if(!S){var T={loading:0,preload:null};if(S=i.querySelector(gs(m)))T.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},r),(r=Bn.get(m))&&Yu(e,r);var U=S=i.createElement("link");Pt(U),Xt(U,"link",e),U._p=new Promise(function(K,ne){U.onload=K,U.onerror=ne}),U.addEventListener("load",function(){T.loading|=1}),U.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Xi(S,t,i)}S={type:"stylesheet",instance:S,count:1,state:T},u.set(m,S)}}}function Tb(e,t){ja.X(e,t);var r=fl;if(r&&e){var i=_r(r).hoistableScripts,u=ml(e),m=i.get(u);m||(m=r.querySelector(vs(u)),m||(e=v({src:e,async:!0},t),(t=Bn.get(u))&&Ku(e,t),m=r.createElement("script"),Pt(m),Xt(m,"link",e),r.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},i.set(u,m))}}function Rb(e,t){ja.M(e,t);var r=fl;if(r&&e){var i=_r(r).hoistableScripts,u=ml(e),m=i.get(u);m||(m=r.querySelector(vs(u)),m||(e=v({src:e,async:!0,type:"module"},t),(t=Bn.get(u))&&Ku(e,t),m=r.createElement("script"),Pt(m),Xt(m,"link",e),r.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},i.set(u,m))}}function nx(e,t,r,i){var u=(u=xe.current)?Ki(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(t=pl(r.href),r=_r(u).hoistableStyles,i=r.get(t),i||(i={type:"style",instance:null,count:0,state:null},r.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=pl(r.href);var m=_r(u).hoistableStyles,S=m.get(e);if(S||(u=u.ownerDocument||u,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(e,S),(m=u.querySelector(gs(e)))&&!m._p&&(S.instance=m,S.state.loading=5),Bn.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Bn.set(e,r),m||Ab(u,e,r,S.state))),t&&i===null)throw Error(o(528,""));return S}if(t&&i!==null)throw Error(o(529,""));return null;case"script":return t=r.async,r=r.src,typeof r=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ml(r),r=_r(u).hoistableScripts,i=r.get(t),i||(i={type:"script",instance:null,count:0,state:null},r.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function pl(e){return'href="'+Rn(e)+'"'}function gs(e){return'link[rel="stylesheet"]['+e+"]"}function ax(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function Ab(e,t,r,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Xt(t,"link",r),Pt(t),e.head.appendChild(t))}function ml(e){return'[src="'+Rn(e)+'"]'}function vs(e){return"script[async]"+e}function rx(e,t,r){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Rn(r.href)+'"]');if(i)return t.instance=i,Pt(i),i;var u=v({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),Pt(i),Xt(i,"style",u),Xi(i,r.precedence,e),t.instance=i;case"stylesheet":u=pl(r.href);var m=e.querySelector(gs(u));if(m)return t.state.loading|=4,t.instance=m,Pt(m),m;i=ax(r),(u=Bn.get(u))&&Yu(i,u),m=(e.ownerDocument||e).createElement("link"),Pt(m);var S=m;return S._p=new Promise(function(T,U){S.onload=T,S.onerror=U}),Xt(m,"link",i),t.state.loading|=4,Xi(m,r.precedence,e),t.instance=m;case"script":return m=ml(r.src),(u=e.querySelector(vs(m)))?(t.instance=u,Pt(u),u):(i=r,(u=Bn.get(m))&&(i=v({},r),Ku(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),Pt(u),Xt(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Xi(i,r.precedence,e));return t.instance}function Xi(e,t,r){for(var i=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,m=u,S=0;S<i.length;S++){var T=i[S];if(T.dataset.precedence===t)m=T;else if(m!==u)break}m?m.parentNode.insertBefore(e,m.nextSibling):(t=r.nodeType===9?r.head:r,t.insertBefore(e,t.firstChild))}function Yu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Qi=null;function lx(e,t,r){if(Qi===null){var i=new Map,u=Qi=new Map;u.set(r,i)}else u=Qi,i=u.get(r),i||(i=new Map,u.set(r,i));if(i.has(e))return i;for(i.set(e,null),r=r.getElementsByTagName(e),u=0;u<r.length;u++){var m=r[u];if(!(m[Dl]||m[Wt]||e==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var S=m.getAttribute(t)||"";S=e+S;var T=i.get(S);T?T.push(m):i.set(S,[m])}}return i}function sx(e,t,r){e=e.ownerDocument||e,e.head.insertBefore(r,t==="title"?e.querySelector("head > title"):null)}function Mb(e,t,r){if(r===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 ix(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Lb(e,t,r,i){if(r.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var u=pl(i.href),m=t.querySelector(gs(u));if(m){t=m._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Zi.bind(e),t.then(e,e)),r.state.loading|=4,r.instance=m,Pt(m);return}m=t.ownerDocument||t,i=ax(i),(u=Bn.get(u))&&Yu(i,u),m=m.createElement("link"),Pt(m);var S=m;S._p=new Promise(function(T,U){S.onload=T,S.onerror=U}),Xt(m,"link",i),r.instance=m}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,t),(t=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=Zi.bind(e),t.addEventListener("load",r),t.addEventListener("error",r))}}var Xu=0;function zb(e,t){return e.stylesheets&&e.count===0&&eo(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var i=setTimeout(function(){if(e.stylesheets&&eo(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+t);0<e.imgBytes&&Xu===0&&(Xu=62500*pb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&eo(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>Xu?50:800)+t);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Zi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)eo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ji=null;function eo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ji=new Map,t.forEach(Db,e),Ji=null,Zi.call(e))}function Db(e,t){if(!(t.state.loading&4)){var r=Ji.get(e);if(r)var i=r.get(null);else{r=new Map,Ji.set(e,r);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<u.length;m++){var S=u[m];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(r.set(S.dataset.precedence,S),i=S)}i&&r.set(null,i)}u=t.instance,S=u.getAttribute("data-precedence"),m=r.get(S)||i,m===i&&r.set(null,u),r.set(S,u),this.count++,i=Zi.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),m?m.parentNode.insertBefore(u,m.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var ys={$$typeof:_,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function _b(e,t,r,i,u,m,S,T,U){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=Go(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Go(0),this.hiddenUpdates=Go(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=m,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function ox(e,t,r,i,u,m,S,T,U,K,ne,le){return e=new _b(e,t,r,S,U,K,ne,le,T),t=1,m===!0&&(t|=24),m=xn(3,null,null,t),e.current=m,m.stateNode=e,t=Rc(),t.refCount++,e.pooledCache=t,t.refCount++,m.memoizedState={element:i,isDehydrated:r,cache:t},zc(m),e}function cx(e){return e?(e=Gr,e):Gr}function ux(e,t,r,i,u,m){u=cx(u),i.context===null?i.context=u:i.pendingContext=u,i=_a(t),i.payload={element:r},m=m===void 0?null:m,m!==null&&(i.callback=m),r=Oa(e,i,t),r!==null&&(mn(r,e,t),Ql(r,e,t))}function dx(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Qu(e,t){dx(e,t),(e=e.alternate)&&dx(e,t)}function fx(e){if(e.tag===13||e.tag===31){var t=fr(e,67108864);t!==null&&mn(t,e,67108864),Qu(e,67108864)}}function px(e){if(e.tag===13||e.tag===31){var t=Sn();t=Wo(t);var r=fr(e,t);r!==null&&mn(r,e,t),Qu(e,t)}}var to=!0;function Ob(e,t,r,i){var u=M.T;M.T=null;var m=I.p;try{I.p=2,Zu(e,t,r,i)}finally{I.p=m,M.T=u}}function Bb(e,t,r,i){var u=M.T;M.T=null;var m=I.p;try{I.p=8,Zu(e,t,r,i)}finally{I.p=m,M.T=u}}function Zu(e,t,r,i){if(to){var u=Ju(i);if(u===null)Iu(e,t,i,no,r),hx(e,i);else if(Hb(u,e,t,r,i))i.stopPropagation();else if(hx(e,i),t&4&&-1<Ib.indexOf(e)){for(;u!==null;){var m=Dr(u);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var S=Tt(m.pendingLanes);if(S!==0){var T=m;for(T.pendingLanes|=2,T.entangledLanes|=2;S;){var U=1<<31-jt(S);T.entanglements[1]|=U,S&=~U}Zn(m),(at&6)===0&&(Ii=lt()+500,ps(0))}}break;case 31:case 13:T=fr(m,2),T!==null&&mn(T,m,2),Ui(),Qu(m,2)}if(m=Ju(i),m===null&&Iu(e,t,i,no,r),m===u)break;u=m}u!==null&&i.stopPropagation()}else Iu(e,t,i,null,r)}}function Ju(e){return e=tc(e),ed(e)}var no=null;function ed(e){if(no=null,e=zr(e),e!==null){var t=f(e);if(t===null)e=null;else{var r=t.tag;if(r===13){if(e=d(t),e!==null)return e;e=null}else if(r===31){if(e=x(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return no=e,null}function mx(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(kt()){case ve:return 2;case Mt:return 8;case _e:case vt:return 32;case Qt:return 268435456;default:return 32}default:return 32}}var td=!1,qa=null,Ya=null,Ka=null,bs=new Map,Ss=new Map,Xa=[],Ib="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 hx(e,t){switch(e){case"focusin":case"focusout":qa=null;break;case"dragenter":case"dragleave":Ya=null;break;case"mouseover":case"mouseout":Ka=null;break;case"pointerover":case"pointerout":bs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ss.delete(t.pointerId)}}function js(e,t,r,i,u,m){return e===null||e.nativeEvent!==m?(e={blockedOn:t,domEventName:r,eventSystemFlags:i,nativeEvent:m,targetContainers:[u]},t!==null&&(t=Dr(t),t!==null&&fx(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Hb(e,t,r,i,u){switch(t){case"focusin":return qa=js(qa,e,t,r,i,u),!0;case"dragenter":return Ya=js(Ya,e,t,r,i,u),!0;case"mouseover":return Ka=js(Ka,e,t,r,i,u),!0;case"pointerover":var m=u.pointerId;return bs.set(m,js(bs.get(m)||null,e,t,r,i,u)),!0;case"gotpointercapture":return m=u.pointerId,Ss.set(m,js(Ss.get(m)||null,e,t,r,i,u)),!0}return!1}function xx(e){var t=zr(e.target);if(t!==null){var r=f(t);if(r!==null){if(t=r.tag,t===13){if(t=d(r),t!==null){e.blockedOn=t,Af(e.priority,function(){px(r)});return}}else if(t===31){if(t=x(r),t!==null){e.blockedOn=t,Af(e.priority,function(){px(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ao(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Ju(e.nativeEvent);if(r===null){r=e.nativeEvent;var i=new r.constructor(r.type,r);ec=i,r.target.dispatchEvent(i),ec=null}else return t=Dr(r),t!==null&&fx(t),e.blockedOn=r,!1;t.shift()}return!0}function gx(e,t,r){ao(e)&&r.delete(t)}function Ub(){td=!1,qa!==null&&ao(qa)&&(qa=null),Ya!==null&&ao(Ya)&&(Ya=null),Ka!==null&&ao(Ka)&&(Ka=null),bs.forEach(gx),Ss.forEach(gx)}function ro(e,t){e.blockedOn===t&&(e.blockedOn=null,td||(td=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Ub)))}var lo=null;function vx(e){lo!==e&&(lo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){lo===e&&(lo=null);for(var t=0;t<e.length;t+=3){var r=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(ed(i||r)===null)continue;break}var m=Dr(r);m!==null&&(e.splice(t,3),t-=3,Jc(m,{pending:!0,data:u,method:r.method,action:i},i,u))}}))}function hl(e){function t(U){return ro(U,e)}qa!==null&&ro(qa,e),Ya!==null&&ro(Ya,e),Ka!==null&&ro(Ka,e),bs.forEach(t),Ss.forEach(t);for(var r=0;r<Xa.length;r++){var i=Xa[r];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Xa.length&&(r=Xa[0],r.blockedOn===null);)xx(r),r.blockedOn===null&&Xa.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(i=0;i<r.length;i+=3){var u=r[i],m=r[i+1],S=u[on]||null;if(typeof m=="function")S||vx(r);else if(S){var T=null;if(m&&m.hasAttribute("formAction")){if(u=m,S=m[on]||null)T=S.formAction;else if(ed(u)!==null)continue}else T=S.action;typeof T=="function"?r[i+1]=T:(r.splice(i,3),i-=3),vx(r)}}}function yx(){function e(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(S){return u=S})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(r,20)}function r(){if(!i&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(r,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function nd(e){this._internalRoot=e}so.prototype.render=nd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var r=t.current,i=Sn();ux(r,i,e,t,null,null)},so.prototype.unmount=nd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ux(e.current,2,null,e,null,null),Ui(),t[Lr]=null}};function so(e){this._internalRoot=e}so.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rf();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Xa.length&&t!==0&&t<Xa[r].priority;r++);Xa.splice(r,0,e),r===0&&xx(e)}};var bx=l.version;if(bx!=="19.2.4")throw Error(o(527,bx,"19.2.4"));I.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=p(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var $b={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var io=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!io.isDisabled&&io.supportsFiber)try{aa=io.inject($b),Nt=io}catch{}}return ws.createRoot=function(e,t){if(!c(e))throw Error(o(299));var r=!1,i="",u=Nm,m=Tm,S=Rm;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(m=t.onCaughtError),t.onRecoverableError!==void 0&&(S=t.onRecoverableError)),t=ox(e,1,!1,null,null,r,i,null,u,m,S,yx),e[Lr]=t.current,Bu(e),new nd(t)},ws.hydrateRoot=function(e,t,r){if(!c(e))throw Error(o(299));var i=!1,u="",m=Nm,S=Tm,T=Rm,U=null;return r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(m=r.onUncaughtError),r.onCaughtError!==void 0&&(S=r.onCaughtError),r.onRecoverableError!==void 0&&(T=r.onRecoverableError),r.formState!==void 0&&(U=r.formState)),t=ox(e,1,!0,t,r??null,i,u,U,m,S,T,yx),t.context=cx(null),r=t.current,i=Sn(),i=Wo(i),u=_a(i),u.callback=null,Oa(r,u,i),r=i,t.current.lanes=r,zl(t,r),Zn(t),e[Lr]=t.current,Bu(e),new so(t)},ws.version="19.2.4",ws}var Ax;function Xb(){if(Ax)return ld.exports;Ax=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(l){console.error(l)}}return n(),ld.exports=Kb(),ld.exports}var Qb=Xb();/**
51
+ * react-router v7.13.1
52
+ *
53
+ * Copyright (c) Remix Software Inc.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE.md file in the root directory of this source tree.
57
+ *
58
+ * @license MIT
59
+ */var Mx="popstate";function Lx(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function Zb(n={}){function l(c,f){let{pathname:d="/",search:x="",hash:h=""}=Cl(c.location.hash.substring(1));return!d.startsWith("/")&&!d.startsWith(".")&&(d="/"+d),Bd("",{pathname:d,search:x,hash:h},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function s(c,f){let d=c.document.querySelector("base"),x="";if(d&&d.getAttribute("href")){let h=c.location.href,p=h.indexOf("#");x=p===-1?h:h.slice(0,p)}return x+"#"+(typeof f=="string"?f:_s(f))}function o(c,f){qn(c.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(f)})`)}return e0(l,s,o,n)}function $t(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function qn(n,l){if(!n){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function Jb(){return Math.random().toString(36).substring(2,10)}function zx(n,l){return{usr:n.state,key:n.key,idx:l,masked:n.unstable_mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Bd(n,l,s=null,o,c){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof l=="string"?Cl(l):l,state:s,key:l&&l.key||o||Jb(),unstable_mask:c}}function _s({pathname:n="/",search:l="",hash:s=""}){return l&&l!=="?"&&(n+=l.charAt(0)==="?"?l:"?"+l),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function Cl(n){let l={};if(n){let s=n.indexOf("#");s>=0&&(l.hash=n.substring(s),n=n.substring(0,s));let o=n.indexOf("?");o>=0&&(l.search=n.substring(o),n=n.substring(0,o)),n&&(l.pathname=n)}return l}function e0(n,l,s,o={}){let{window:c=document.defaultView,v5Compat:f=!1}=o,d=c.history,x="POP",h=null,p=y();p==null&&(p=0,d.replaceState({...d.state,idx:p},""));function y(){return(d.state||{idx:null}).idx}function v(){x="POP";let C=y(),w=C==null?null:C-p;p=C,h&&h({action:x,location:N.location,delta:w})}function b(C,w){x="PUSH";let A=Lx(C)?C:Bd(N.location,C,w);s&&s(A,C),p=y()+1;let _=zx(A,p),H=N.createHref(A.unstable_mask||A);try{d.pushState(_,"",H)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;c.location.assign(H)}f&&h&&h({action:x,location:N.location,delta:1})}function j(C,w){x="REPLACE";let A=Lx(C)?C:Bd(N.location,C,w);s&&s(A,C),p=y();let _=zx(A,p),H=N.createHref(A.unstable_mask||A);d.replaceState(_,"",H),f&&h&&h({action:x,location:N.location,delta:0})}function k(C){return t0(C)}let N={get action(){return x},get location(){return n(c,d)},listen(C){if(h)throw new Error("A history only accepts one active listener");return c.addEventListener(Mx,v),h=C,()=>{c.removeEventListener(Mx,v),h=null}},createHref(C){return l(c,C)},createURL:k,encodeLocation(C){let w=k(C);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:b,replace:j,go(C){return d.go(C)}};return N}function t0(n,l=!1){let s="http://localhost";typeof window<"u"&&(s=window.location.origin!=="null"?window.location.origin:window.location.href),$t(s,"No window.location.(origin|href) available to create URL");let o=typeof n=="string"?n:_s(n);return o=o.replace(/ $/,"%20"),!l&&o.startsWith("//")&&(o=s+o),new URL(o,s)}function Qg(n,l,s="/"){return n0(n,l,s,!1)}function n0(n,l,s,o){let c=typeof l=="string"?Cl(l):l,f=wa(c.pathname||"/",s);if(f==null)return null;let d=Zg(n);a0(d);let x=null;for(let h=0;x==null&&h<d.length;++h){let p=m0(f);x=f0(d[h],p,o)}return x}function Zg(n,l=[],s=[],o="",c=!1){let f=(d,x,h=c,p)=>{let y={relativePath:p===void 0?d.path||"":p,caseSensitive:d.caseSensitive===!0,childrenIndex:x,route:d};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(o)&&h)return;$t(y.relativePath.startsWith(o),`Absolute route path "${y.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(o.length)}let v=ta([o,y.relativePath]),b=s.concat(y);d.children&&d.children.length>0&&($t(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),Zg(d.children,l,b,v,h)),!(d.path==null&&!d.index)&&l.push({path:v,score:u0(v,d.index),routesMeta:b})};return n.forEach((d,x)=>{var h;if(d.path===""||!((h=d.path)!=null&&h.includes("?")))f(d,x);else for(let p of Jg(d.path))f(d,x,!0,p)}),l}function Jg(n){let l=n.split("/");if(l.length===0)return[];let[s,...o]=l,c=s.endsWith("?"),f=s.replace(/\?$/,"");if(o.length===0)return c?[f,""]:[f];let d=Jg(o.join("/")),x=[];return x.push(...d.map(h=>h===""?f:[f,h].join("/"))),c&&x.push(...d),x.map(h=>n.startsWith("/")&&h===""?"/":h)}function a0(n){n.sort((l,s)=>l.score!==s.score?s.score-l.score:d0(l.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var r0=/^:[\w-]+$/,l0=3,s0=2,i0=1,o0=10,c0=-2,Dx=n=>n==="*";function u0(n,l){let s=n.split("/"),o=s.length;return s.some(Dx)&&(o+=c0),l&&(o+=s0),s.filter(c=>!Dx(c)).reduce((c,f)=>c+(r0.test(f)?l0:f===""?i0:o0),o)}function d0(n,l){return n.length===l.length&&n.slice(0,-1).every((o,c)=>o===l[c])?n[n.length-1]-l[l.length-1]:0}function f0(n,l,s=!1){let{routesMeta:o}=n,c={},f="/",d=[];for(let x=0;x<o.length;++x){let h=o[x],p=x===o.length-1,y=f==="/"?l:l.slice(f.length)||"/",v=No({path:h.relativePath,caseSensitive:h.caseSensitive,end:p},y),b=h.route;if(!v&&p&&s&&!o[o.length-1].route.index&&(v=No({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},y)),!v)return null;Object.assign(c,v.params),d.push({params:c,pathname:ta([f,v.pathname]),pathnameBase:v0(ta([f,v.pathnameBase])),route:b}),v.pathnameBase!=="/"&&(f=ta([f,v.pathnameBase]))}return d}function No(n,l){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[s,o]=p0(n.path,n.caseSensitive,n.end),c=l.match(s);if(!c)return null;let f=c[0],d=f.replace(/(.)\/+$/,"$1"),x=c.slice(1);return{params:o.reduce((p,{paramName:y,isOptional:v},b)=>{if(y==="*"){let k=x[b]||"";d=f.slice(0,f.length-k.length).replace(/(.)\/+$/,"$1")}const j=x[b];return v&&!j?p[y]=void 0:p[y]=(j||"").replace(/%2F/g,"/"),p},{}),pathname:f,pathnameBase:d,pattern:n}}function p0(n,l=!1,s=!0){qn(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let o=[],c="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,x,h,p,y)=>{if(o.push({paramName:x,isOptional:h!=null}),h){let v=y.charAt(p+d.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(o.push({paramName:"*"}),c+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?c+="\\/*$":n!==""&&n!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,l?void 0:"i"),o]}function m0(n){try{return n.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return qn(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${l}).`),n}}function wa(n,l){if(l==="/")return n;if(!n.toLowerCase().startsWith(l.toLowerCase()))return null;let s=l.endsWith("/")?l.length-1:l.length,o=n.charAt(s);return o&&o!=="/"?null:n.slice(s)||"/"}var h0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function x0(n,l="/"){let{pathname:s,search:o="",hash:c=""}=typeof n=="string"?Cl(n):n,f;return s?(s=s.replace(/\/\/+/g,"/"),s.startsWith("/")?f=_x(s.substring(1),"/"):f=_x(s,l)):f=l,{pathname:f,search:y0(o),hash:b0(c)}}function _x(n,l){let s=l.replace(/\/+$/,"").split("/");return n.split("/").forEach(c=>{c===".."?s.length>1&&s.pop():c!=="."&&s.push(c)}),s.length>1?s.join("/"):"/"}function cd(n,l,s,o){return`Cannot include a '${n}' character in a manually specified \`to.${l}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function g0(n){return n.filter((l,s)=>s===0||l.route.path&&l.route.path.length>0)}function ev(n){let l=g0(n);return l.map((s,o)=>o===l.length-1?s.pathname:s.pathnameBase)}function ef(n,l,s,o=!1){let c;typeof n=="string"?c=Cl(n):(c={...n},$t(!c.pathname||!c.pathname.includes("?"),cd("?","pathname","search",c)),$t(!c.pathname||!c.pathname.includes("#"),cd("#","pathname","hash",c)),$t(!c.search||!c.search.includes("#"),cd("#","search","hash",c)));let f=n===""||c.pathname==="",d=f?"/":c.pathname,x;if(d==null)x=s;else{let v=l.length-1;if(!o&&d.startsWith("..")){let b=d.split("/");for(;b[0]==="..";)b.shift(),v-=1;c.pathname=b.join("/")}x=v>=0?l[v]:"/"}let h=x0(c,x),p=d&&d!=="/"&&d.endsWith("/"),y=(f||d===".")&&s.endsWith("/");return!h.pathname.endsWith("/")&&(p||y)&&(h.pathname+="/"),h}var ta=n=>n.join("/").replace(/\/\/+/g,"/"),v0=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),y0=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,b0=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,S0=class{constructor(n,l,s,o=!1){this.status=n,this.statusText=l||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function j0(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function k0(n){return n.map(l=>l.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var tv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nv(n,l){let s=n;if(typeof s!="string"||!h0.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,c=!1;if(tv)try{let f=new URL(window.location.href),d=s.startsWith("//")?new URL(f.protocol+s):new URL(s),x=wa(d.pathname,l);d.origin===f.origin&&x!=null?s=x+d.search+d.hash:c=!0}catch{qn(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var av=["POST","PUT","PATCH","DELETE"];new Set(av);var w0=["GET",...av];new Set(w0);var El=g.createContext(null);El.displayName="DataRouter";var zo=g.createContext(null);zo.displayName="DataRouterState";var C0=g.createContext(!1),rv=g.createContext({isTransitioning:!1});rv.displayName="ViewTransition";var E0=g.createContext(new Map);E0.displayName="Fetchers";var N0=g.createContext(null);N0.displayName="Await";var Un=g.createContext(null);Un.displayName="Navigation";var Do=g.createContext(null);Do.displayName="Location";var Ca=g.createContext({outlet:null,matches:[],isDataRoute:!1});Ca.displayName="Route";var tf=g.createContext(null);tf.displayName="RouteError";var lv="REACT_ROUTER_ERROR",T0="REDIRECT",R0="ROUTE_ERROR_RESPONSE";function A0(n){if(n.startsWith(`${lv}:${T0}:{`))try{let l=JSON.parse(n.slice(28));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string"&&typeof l.location=="string"&&typeof l.reloadDocument=="boolean"&&typeof l.replace=="boolean")return l}catch{}}function M0(n){if(n.startsWith(`${lv}:${R0}:{`))try{let l=JSON.parse(n.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new S0(l.status,l.statusText,l.data)}catch{}}function L0(n,{relative:l}={}){$t(Ps(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=g.useContext(Un),{hash:c,pathname:f,search:d}=Fs(n,{relative:l}),x=f;return s!=="/"&&(x=f==="/"?s:ta([s,f])),o.createHref({pathname:x,search:d,hash:c})}function Ps(){return g.useContext(Do)!=null}function nr(){return $t(Ps(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Do).location}var sv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function iv(n){g.useContext(Un).static||g.useLayoutEffect(n)}function z0(){let{isDataRoute:n}=g.useContext(Ca);return n?W0():D0()}function D0(){$t(Ps(),"useNavigate() may be used only in the context of a <Router> component.");let n=g.useContext(El),{basename:l,navigator:s}=g.useContext(Un),{matches:o}=g.useContext(Ca),{pathname:c}=nr(),f=JSON.stringify(ev(o)),d=g.useRef(!1);return iv(()=>{d.current=!0}),g.useCallback((h,p={})=>{if(qn(d.current,sv),!d.current)return;if(typeof h=="number"){s.go(h);return}let y=ef(h,JSON.parse(f),c,p.relative==="path");n==null&&l!=="/"&&(y.pathname=y.pathname==="/"?l:ta([l,y.pathname])),(p.replace?s.replace:s.push)(y,p.state,p)},[l,s,f,c,n])}g.createContext(null);function Fs(n,{relative:l}={}){let{matches:s}=g.useContext(Ca),{pathname:o}=nr(),c=JSON.stringify(ev(s));return g.useMemo(()=>ef(n,JSON.parse(c),o,l==="path"),[n,c,o,l])}function _0(n,l,s){$t(Ps(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=g.useContext(Un),{matches:c}=g.useContext(Ca),f=c[c.length-1],d=f?f.params:{},x=f?f.pathname:"/",h=f?f.pathnameBase:"/",p=f&&f.route;{let C=p&&p.path||"";cv(x,!p||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${x}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
60
+
61
+ Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let y=nr(),v;v=y;let b=v.pathname||"/",j=b;if(h!=="/"){let C=h.replace(/^\//,"").split("/");j="/"+b.replace(/^\//,"").split("/").slice(C.length).join("/")}let k=Qg(n,{pathname:j});return qn(p||k!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),qn(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),U0(k&&k.map(C=>Object.assign({},C,{params:Object.assign({},d,C.params),pathname:ta([h,o.encodeLocation?o.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?h:ta([h,o.encodeLocation?o.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),c,s)}function O0(){let n=G0(),l=j0(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),s=n instanceof Error?n.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},f={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",n),d=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:f},"ErrorBoundary")," or"," ",g.createElement("code",{style:f},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},l),s?g.createElement("pre",{style:c},s):null,d)}var B0=g.createElement(O0,null),ov=class extends g.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,l){return l.location!==n.location||l.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:l.error,location:l.location,revalidation:n.revalidation||l.revalidation}}componentDidCatch(n,l){this.props.onError?this.props.onError(n,l):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const s=M0(n.digest);s&&(n=s)}let l=n!==void 0?g.createElement(Ca.Provider,{value:this.props.routeContext},g.createElement(tf.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?g.createElement(I0,{error:n},l):l}};ov.contextType=C0;var ud=new WeakMap;function I0({children:n,error:l}){let{basename:s}=g.useContext(Un);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let o=A0(l.digest);if(o){let c=ud.get(l);if(c)throw c;let f=nv(o.location,s);if(tv&&!ud.get(l))if(f.isExternal||o.reloadDocument)window.location.href=f.absoluteURL||f.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:o.replace}));throw ud.set(l,d),d}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return n}function H0({routeContext:n,match:l,children:s}){let o=g.useContext(El);return o&&o.static&&o.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=l.route.id),g.createElement(Ca.Provider,{value:n},s)}function U0(n,l=[],s){let o=s==null?void 0:s.state;if(n==null){if(!o)return null;if(o.errors)n=o.matches;else if(l.length===0&&!o.initialized&&o.matches.length>0)n=o.matches;else return null}let c=n,f=o==null?void 0:o.errors;if(f!=null){let y=c.findIndex(v=>v.route.id&&(f==null?void 0:f[v.route.id])!==void 0);$t(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),c=c.slice(0,Math.min(c.length,y+1))}let d=!1,x=-1;if(s&&o){d=o.renderFallback;for(let y=0;y<c.length;y++){let v=c[y];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(x=y),v.route.id){let{loaderData:b,errors:j}=o,k=v.route.loader&&!b.hasOwnProperty(v.route.id)&&(!j||j[v.route.id]===void 0);if(v.route.lazy||k){s.isStatic&&(d=!0),x>=0?c=c.slice(0,x+1):c=[c[0]];break}}}}let h=s==null?void 0:s.onError,p=o&&h?(y,v)=>{var b,j;h(y,{location:o.location,params:((j=(b=o.matches)==null?void 0:b[0])==null?void 0:j.params)??{},unstable_pattern:k0(o.matches),errorInfo:v})}:void 0;return c.reduceRight((y,v,b)=>{let j,k=!1,N=null,C=null;o&&(j=f&&v.route.id?f[v.route.id]:void 0,N=v.route.errorElement||B0,d&&(x<0&&b===0?(cv("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,C=null):x===b&&(k=!0,C=v.route.hydrateFallbackElement||null)));let w=l.concat(c.slice(0,b+1)),A=()=>{let _;return j?_=N:k?_=C:v.route.Component?_=g.createElement(v.route.Component,null):v.route.element?_=v.route.element:_=y,g.createElement(H0,{match:v,routeContext:{outlet:y,matches:w,isDataRoute:o!=null},children:_})};return o&&(v.route.ErrorBoundary||v.route.errorElement||b===0)?g.createElement(ov,{location:o.location,revalidation:o.revalidation,component:N,error:j,children:A(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:p}):A()},null)}function nf(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $0(n){let l=g.useContext(El);return $t(l,nf(n)),l}function V0(n){let l=g.useContext(zo);return $t(l,nf(n)),l}function P0(n){let l=g.useContext(Ca);return $t(l,nf(n)),l}function af(n){let l=P0(n),s=l.matches[l.matches.length-1];return $t(s.route.id,`${n} can only be used on routes that contain a unique "id"`),s.route.id}function F0(){return af("useRouteId")}function G0(){var o;let n=g.useContext(tf),l=V0("useRouteError"),s=af("useRouteError");return n!==void 0?n:(o=l.errors)==null?void 0:o[s]}function W0(){let{router:n}=$0("useNavigate"),l=af("useNavigate"),s=g.useRef(!1);return iv(()=>{s.current=!0}),g.useCallback(async(c,f={})=>{qn(s.current,sv),s.current&&(typeof c=="number"?await n.navigate(c):await n.navigate(c,{fromRouteId:l,...f}))},[n,l])}var Ox={};function cv(n,l,s){!l&&!Ox[n]&&(Ox[n]=!0,qn(!1,s))}g.memo(q0);function q0({routes:n,future:l,state:s,isStatic:o,onError:c}){return _0(n,void 0,{state:s,isStatic:o,onError:c})}function Y0({basename:n="/",children:l=null,location:s,navigationType:o="POP",navigator:c,static:f=!1,unstable_useTransitions:d}){$t(!Ps(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let x=n.replace(/^\/*/,"/"),h=g.useMemo(()=>({basename:x,navigator:c,static:f,unstable_useTransitions:d,future:{}}),[x,c,f,d]);typeof s=="string"&&(s=Cl(s));let{pathname:p="/",search:y="",hash:v="",state:b=null,key:j="default",unstable_mask:k}=s,N=g.useMemo(()=>{let C=wa(p,x);return C==null?null:{location:{pathname:C,search:y,hash:v,state:b,key:j,unstable_mask:k},navigationType:o}},[x,p,y,v,b,j,o,k]);return qn(N!=null,`<Router basename="${x}"> is not able to match the URL "${p}${y}${v}" because it does not start with the basename, so the <Router> won't render anything.`),N==null?null:g.createElement(Un.Provider,{value:h},g.createElement(Do.Provider,{children:l,value:N}))}var bo="get",So="application/x-www-form-urlencoded";function _o(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function K0(n){return _o(n)&&n.tagName.toLowerCase()==="button"}function X0(n){return _o(n)&&n.tagName.toLowerCase()==="form"}function Q0(n){return _o(n)&&n.tagName.toLowerCase()==="input"}function Z0(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function J0(n,l){return n.button===0&&(!l||l==="_self")&&!Z0(n)}var oo=null;function eS(){if(oo===null)try{new FormData(document.createElement("form"),0),oo=!1}catch{oo=!0}return oo}var tS=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function dd(n){return n!=null&&!tS.has(n)?(qn(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${So}"`),null):n}function nS(n,l){let s,o,c,f,d;if(X0(n)){let x=n.getAttribute("action");o=x?wa(x,l):null,s=n.getAttribute("method")||bo,c=dd(n.getAttribute("enctype"))||So,f=new FormData(n)}else if(K0(n)||Q0(n)&&(n.type==="submit"||n.type==="image")){let x=n.form;if(x==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=n.getAttribute("formaction")||x.getAttribute("action");if(o=h?wa(h,l):null,s=n.getAttribute("formmethod")||x.getAttribute("method")||bo,c=dd(n.getAttribute("formenctype"))||dd(x.getAttribute("enctype"))||So,f=new FormData(x,n),!eS()){let{name:p,type:y,value:v}=n;if(y==="image"){let b=p?`${p}.`:"";f.append(`${b}x`,"0"),f.append(`${b}y`,"0")}else p&&f.append(p,v)}}else{if(_o(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=bo,o=null,c=So,d=n}return f&&c==="text/plain"&&(d=f,f=void 0),{action:o,method:s.toLowerCase(),encType:c,formData:f,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function rf(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function aS(n,l,s,o){let c=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return s?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:l&&wa(c.pathname,l)==="/"?c.pathname=`${l.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function rS(n,l){if(n.id in l)return l[n.id];try{let s=await import(n.module);return l[n.id]=s,s}catch(s){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function lS(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function sS(n,l,s){let o=await Promise.all(n.map(async c=>{let f=l.routes[c.route.id];if(f){let d=await rS(f,s);return d.links?d.links():[]}return[]}));return uS(o.flat(1).filter(lS).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Bx(n,l,s,o,c,f){let d=(h,p)=>s[p]?h.route.id!==s[p].route.id:!0,x=(h,p)=>{var y;return s[p].pathname!==h.pathname||((y=s[p].route.path)==null?void 0:y.endsWith("*"))&&s[p].params["*"]!==h.params["*"]};return f==="assets"?l.filter((h,p)=>d(h,p)||x(h,p)):f==="data"?l.filter((h,p)=>{var v;let y=o.routes[h.route.id];if(!y||!y.hasLoader)return!1;if(d(h,p)||x(h,p))return!0;if(h.route.shouldRevalidate){let b=h.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((v=s[0])==null?void 0:v.params)||{},nextUrl:new URL(n,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function iS(n,l,{includeHydrateFallback:s}={}){return oS(n.map(o=>{let c=l.routes[o.route.id];if(!c)return[];let f=[c.module];return c.clientActionModule&&(f=f.concat(c.clientActionModule)),c.clientLoaderModule&&(f=f.concat(c.clientLoaderModule)),s&&c.hydrateFallbackModule&&(f=f.concat(c.hydrateFallbackModule)),c.imports&&(f=f.concat(c.imports)),f}).flat(1))}function oS(n){return[...new Set(n)]}function cS(n){let l={},s=Object.keys(n).sort();for(let o of s)l[o]=n[o];return l}function uS(n,l){let s=new Set;return new Set(l),n.reduce((o,c)=>{let f=JSON.stringify(cS(c));return s.has(f)||(s.add(f),o.push({key:f,link:c})),o},[])}function uv(){let n=g.useContext(El);return rf(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function dS(){let n=g.useContext(zo);return rf(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var lf=g.createContext(void 0);lf.displayName="FrameworkContext";function dv(){let n=g.useContext(lf);return rf(n,"You must render this element inside a <HydratedRouter> element"),n}function fS(n,l){let s=g.useContext(lf),[o,c]=g.useState(!1),[f,d]=g.useState(!1),{onFocus:x,onBlur:h,onMouseEnter:p,onMouseLeave:y,onTouchStart:v}=l,b=g.useRef(null);g.useEffect(()=>{if(n==="render"&&d(!0),n==="viewport"){let N=w=>{w.forEach(A=>{d(A.isIntersecting)})},C=new IntersectionObserver(N,{threshold:.5});return b.current&&C.observe(b.current),()=>{C.disconnect()}}},[n]),g.useEffect(()=>{if(o){let N=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(N)}}},[o]);let j=()=>{c(!0)},k=()=>{c(!1),d(!1)};return s?n!=="intent"?[f,b,{}]:[f,b,{onFocus:Cs(x,j),onBlur:Cs(h,k),onMouseEnter:Cs(p,j),onMouseLeave:Cs(y,k),onTouchStart:Cs(v,j)}]:[!1,b,{}]}function Cs(n,l){return s=>{n&&n(s),s.defaultPrevented||l(s)}}function pS({page:n,...l}){let{router:s}=uv(),o=g.useMemo(()=>Qg(s.routes,n,s.basename),[s.routes,n,s.basename]);return o?g.createElement(hS,{page:n,matches:o,...l}):null}function mS(n){let{manifest:l,routeModules:s}=dv(),[o,c]=g.useState([]);return g.useEffect(()=>{let f=!1;return sS(n,l,s).then(d=>{f||c(d)}),()=>{f=!0}},[n,l,s]),o}function hS({page:n,matches:l,...s}){let o=nr(),{future:c,manifest:f,routeModules:d}=dv(),{basename:x}=uv(),{loaderData:h,matches:p}=dS(),y=g.useMemo(()=>Bx(n,l,p,f,o,"data"),[n,l,p,f,o]),v=g.useMemo(()=>Bx(n,l,p,f,o,"assets"),[n,l,p,f,o]),b=g.useMemo(()=>{if(n===o.pathname+o.search+o.hash)return[];let N=new Set,C=!1;if(l.forEach(A=>{var H;let _=f.routes[A.route.id];!_||!_.hasLoader||(!y.some(L=>L.route.id===A.route.id)&&A.route.id in h&&((H=d[A.route.id])!=null&&H.shouldRevalidate)||_.hasClientLoader?C=!0:N.add(A.route.id))}),N.size===0)return[];let w=aS(n,x,c.unstable_trailingSlashAwareDataRequests,"data");return C&&N.size>0&&w.searchParams.set("_routes",l.filter(A=>N.has(A.route.id)).map(A=>A.route.id).join(",")),[w.pathname+w.search]},[x,c.unstable_trailingSlashAwareDataRequests,h,o,f,y,l,n,d]),j=g.useMemo(()=>iS(v,f),[v,f]),k=mS(v);return g.createElement(g.Fragment,null,b.map(N=>g.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...s})),j.map(N=>g.createElement("link",{key:N,rel:"modulepreload",href:N,...s})),k.map(({key:N,link:C})=>g.createElement("link",{key:N,nonce:s.nonce,...C,crossOrigin:C.crossOrigin??s.crossOrigin})))}function xS(...n){return l=>{n.forEach(s=>{typeof s=="function"?s(l):s!=null&&(s.current=l)})}}var gS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{gS&&(window.__reactRouterVersion="7.13.1")}catch{}function vS({basename:n,children:l,unstable_useTransitions:s,window:o}){let c=g.useRef();c.current==null&&(c.current=Zb({window:o,v5Compat:!0}));let f=c.current,[d,x]=g.useState({action:f.action,location:f.location}),h=g.useCallback(p=>{s===!1?x(p):g.startTransition(()=>x(p))},[s]);return g.useLayoutEffect(()=>f.listen(h),[f,h]),g.createElement(Y0,{basename:n,children:l,location:d.location,navigationType:d.action,navigator:f,unstable_useTransitions:s})}var fv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,pv=g.forwardRef(function({onClick:l,discover:s="render",prefetch:o="none",relative:c,reloadDocument:f,replace:d,unstable_mask:x,state:h,target:p,to:y,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:j,...k},N){let{basename:C,navigator:w,unstable_useTransitions:A}=g.useContext(Un),_=typeof y=="string"&&fv.test(y),H=nv(y,C);y=H.to;let L=L0(y,{relative:c}),$=nr(),E=null;if(x){let z=ef(x,[],$.unstable_mask?$.unstable_mask.pathname:"/",!0);C!=="/"&&(z.pathname=z.pathname==="/"?C:ta([C,z.pathname])),E=w.createHref(z)}let[D,R,B]=fS(o,k),V=jS(y,{replace:d,unstable_mask:x,state:h,target:p,preventScrollReset:v,relative:c,viewTransition:b,unstable_defaultShouldRevalidate:j,unstable_useTransitions:A});function W(z){l&&l(z),z.defaultPrevented||V(z)}let te=!(H.isExternal||f),Q=g.createElement("a",{...k,...B,href:(te?E:void 0)||H.absoluteURL||L,onClick:te?W:l,ref:xS(N,R),target:p,"data-discover":!_&&s==="render"?"true":void 0});return D&&!_?g.createElement(g.Fragment,null,Q,g.createElement(pS,{page:L})):Q});pv.displayName="Link";var yS=g.forwardRef(function({"aria-current":l="page",caseSensitive:s=!1,className:o="",end:c=!1,style:f,to:d,viewTransition:x,children:h,...p},y){let v=Fs(d,{relative:p.relative}),b=nr(),j=g.useContext(zo),{navigator:k,basename:N}=g.useContext(Un),C=j!=null&&NS(v)&&x===!0,w=k.encodeLocation?k.encodeLocation(v).pathname:v.pathname,A=b.pathname,_=j&&j.navigation&&j.navigation.location?j.navigation.location.pathname:null;s||(A=A.toLowerCase(),_=_?_.toLowerCase():null,w=w.toLowerCase()),_&&N&&(_=wa(_,N)||_);const H=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let L=A===w||!c&&A.startsWith(w)&&A.charAt(H)==="/",$=_!=null&&(_===w||!c&&_.startsWith(w)&&_.charAt(w.length)==="/"),E={isActive:L,isPending:$,isTransitioning:C},D=L?l:void 0,R;typeof o=="function"?R=o(E):R=[o,L?"active":null,$?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let B=typeof f=="function"?f(E):f;return g.createElement(pv,{...p,"aria-current":D,className:R,ref:y,style:B,to:d,viewTransition:x},typeof h=="function"?h(E):h)});yS.displayName="NavLink";var bS=g.forwardRef(({discover:n="render",fetcherKey:l,navigate:s,reloadDocument:o,replace:c,state:f,method:d=bo,action:x,onSubmit:h,relative:p,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:b,...j},k)=>{let{unstable_useTransitions:N}=g.useContext(Un),C=CS(),w=ES(x,{relative:p}),A=d.toLowerCase()==="get"?"get":"post",_=typeof x=="string"&&fv.test(x),H=L=>{if(h&&h(L),L.defaultPrevented)return;L.preventDefault();let $=L.nativeEvent.submitter,E=($==null?void 0:$.getAttribute("formmethod"))||d,D=()=>C($||L.currentTarget,{fetcherKey:l,method:E,navigate:s,replace:c,state:f,relative:p,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:b});N&&s!==!1?g.startTransition(()=>D()):D()};return g.createElement("form",{ref:k,method:A,action:w,onSubmit:o?h:H,...j,"data-discover":!_&&n==="render"?"true":void 0})});bS.displayName="Form";function SS(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function mv(n){let l=g.useContext(El);return $t(l,SS(n)),l}function jS(n,{target:l,replace:s,unstable_mask:o,state:c,preventScrollReset:f,relative:d,viewTransition:x,unstable_defaultShouldRevalidate:h,unstable_useTransitions:p}={}){let y=z0(),v=nr(),b=Fs(n,{relative:d});return g.useCallback(j=>{if(J0(j,l)){j.preventDefault();let k=s!==void 0?s:_s(v)===_s(b),N=()=>y(n,{replace:k,unstable_mask:o,state:c,preventScrollReset:f,relative:d,viewTransition:x,unstable_defaultShouldRevalidate:h});p?g.startTransition(()=>N()):N()}},[v,y,b,s,o,c,l,n,f,d,x,h,p])}var kS=0,wS=()=>`__${String(++kS)}__`;function CS(){let{router:n}=mv("useSubmit"),{basename:l}=g.useContext(Un),s=F0(),o=n.fetch,c=n.navigate;return g.useCallback(async(f,d={})=>{let{action:x,method:h,encType:p,formData:y,body:v}=nS(f,l);if(d.navigate===!1){let b=d.fetcherKey||wS();await o(b,s,d.action||x,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:y,body:v,formMethod:d.method||h,formEncType:d.encType||p,flushSync:d.flushSync})}else await c(d.action||x,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:y,body:v,formMethod:d.method||h,formEncType:d.encType||p,replace:d.replace,state:d.state,fromRouteId:s,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,c,l,s])}function ES(n,{relative:l}={}){let{basename:s}=g.useContext(Un),o=g.useContext(Ca);$t(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),f={...Fs(n||".",{relative:l})},d=nr();if(n==null){f.search=d.search;let x=new URLSearchParams(f.search),h=x.getAll("index");if(h.some(y=>y==="")){x.delete("index"),h.filter(v=>v).forEach(v=>x.append("index",v));let y=x.toString();f.search=y?`?${y}`:""}}return(!n||n===".")&&c.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(f.pathname=f.pathname==="/"?s:ta([s,f.pathname])),_s(f)}function NS(n,{relative:l}={}){let s=g.useContext(rv);$t(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=mv("useViewTransitionState"),c=Fs(n,{relative:l});if(!s.isTransitioning)return!1;let f=wa(s.currentLocation.pathname,o)||s.currentLocation.pathname,d=wa(s.nextLocation.pathname,o)||s.nextLocation.pathname;return No(c.pathname,d)!=null||No(c.pathname,f)!=null}var Oo=Xg();const TS=Kg(Oo),RS="modulepreload",AS=function(n){return"/"+n},Ix={},Ea=function(l,s,o){let c=Promise.resolve();if(s&&s.length>0){let d=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const x=document.querySelector("meta[property=csp-nonce]"),h=(x==null?void 0:x.nonce)||(x==null?void 0:x.getAttribute("nonce"));c=d(s.map(p=>{if(p=AS(p),p in Ix)return;Ix[p]=!0;const y=p.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":RS,y||(b.as="script"),b.crossOrigin="",b.href=p,h&&b.setAttribute("nonce",h),document.head.appendChild(b),y)return new Promise((j,k)=>{b.addEventListener("load",j),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${p}`)))})}))}function f(d){const x=new Event("vite:preloadError",{cancelable:!0});if(x.payload=d,window.dispatchEvent(x),!x.defaultPrevented)throw d}return c.then(d=>{for(const x of d||[])x.status==="rejected"&&f(x.reason);return l().catch(f)})},Hx={own:"authoring-project",installed:"available-project",global:"available-personal"},Id=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function MS(n){if(typeof n=="string"){if(Id.has(n))return n;if(Object.prototype.hasOwnProperty.call(Hx,n))return Hx[n]}return"authoring-project"}function LS(n){return n.startsWith("available-")?"available":"authoring"}function zS(n){const l=n.indexOf("-");return n.slice(l+1)}const er="";class Ms extends Error{constructor(l,s){super(l),this.name="ApiError",this.status=s}}async function qe(n,l){const s=await fetch(`${er}${n}`,l);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Ms(o.error||`HTTP ${s.status}`,s.status)}return s.json()}function nn(n){return typeof n=="string"&&n.length>0?n:null}function DS(n){return typeof n=="number"&&Number.isFinite(n)?n:null}function fd(n){if(!Array.isArray(n))return null;const l=n.filter(s=>typeof s=="string"&&s.length>0);return l.length>0?l:null}function _S(n){const l=n??{};let s;l.origin==="source"||l.origin==="installed"?s=l.origin:(s="source",console.warn(`[api.getSkills] skill ${String(l.plugin)}/${String(l.skill)} has invalid origin=${JSON.stringify(l.origin)}; defaulting to 'source'`));let o;l.scope==="own"||l.scope==="installed"||l.scope==="global"?o=l.scope:o=s==="installed"?"installed":"own";let c;l.installMethod==="authored"||l.installMethod==="copied"||l.installMethod==="symlinked"?c=l.installMethod:c=o==="own"?"authored":"copied";const f=typeof l.scopeV2=="string"&&Id.has(l.scopeV2)?l.scopeV2:MS(l.scope),d=LS(f),x=zS(f),h=typeof l.precedenceRank=="number"?l.precedenceRank:void 0;let p;l.shadowedBy===null?p=null:typeof l.shadowedBy=="string"&&Id.has(l.shadowedBy)?p=l.shadowedBy:p=void 0;const y={plugin:typeof l.plugin=="string"?l.plugin:"",skill:typeof l.skill=="string"?l.skill:"",dir:typeof l.dir=="string"?l.dir:"",hasEvals:!!l.hasEvals,hasBenchmark:!!l.hasBenchmark,evalCount:typeof l.evalCount=="number"?l.evalCount:0,assertionCount:typeof l.assertionCount=="number"?l.assertionCount:0,benchmarkStatus:l.benchmarkStatus==="pass"||l.benchmarkStatus==="fail"||l.benchmarkStatus==="pending"||l.benchmarkStatus==="stale"||l.benchmarkStatus==="missing"?l.benchmarkStatus:"missing",lastBenchmark:typeof l.lastBenchmark=="string"?l.lastBenchmark:null,origin:s,scope:o,isSymlink:typeof l.isSymlink=="boolean"?l.isSymlink:!1,symlinkTarget:nn(l.symlinkTarget),installMethod:c,scopeV2:f,group:d,source:x,pluginName:nn(l.pluginName),pluginNamespace:nn(l.pluginNamespace),pluginMarketplace:nn(l.pluginMarketplace),pluginManifestPath:nn(l.pluginManifestPath),pluginVersion:nn(l.pluginVersion),precedenceRank:h,shadowedBy:p,description:nn(l.description),version:nn(l.version),category:nn(l.category),author:nn(l.author),license:nn(l.license),homepage:nn(l.homepage),tags:fd(l.tags),deps:fd(l.deps),mcpDeps:fd(l.mcpDeps),entryPoint:nn(l.entryPoint),lastModified:nn(l.lastModified),sizeBytes:DS(l.sizeBytes),sourceAgent:nn(l.sourceAgent)};if(l.provenance&&typeof l.provenance=="object"){const v=l.provenance;(v.promotedFrom==="installed"||v.promotedFrom==="global")&&typeof v.sourcePath=="string"&&typeof v.promotedAt=="number"?y.provenance={promotedFrom:v.promotedFrom,sourcePath:v.sourcePath,promotedAt:v.promotedAt,sourceSkillVersion:typeof v.sourceSkillVersion=="string"?v.sourceSkillVersion:void 0}:y.provenance=null}else l.provenance===null&&(y.provenance=null);return typeof l.updateAvailable=="boolean"&&(y.updateAvailable=l.updateAvailable),typeof l.currentVersion=="string"&&(y.currentVersion=l.currentVersion),typeof l.latestVersion=="string"&&(y.latestVersion=l.latestVersion),typeof l.pinnedVersion=="string"&&(y.pinnedVersion=l.pinnedVersion),y}const Ne={getConfig(){return qe("/api/config")},setConfig(n,l){return qe("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n,model:l})})},async getSkills(n){const l=new URLSearchParams;n!=null&&n.scope&&l.set("scope",n.scope),n!=null&&n.agent&&l.set("agent",n.agent);const s=l.toString(),o=await qe(`/api/skills${s?"?"+s:""}`);return Array.isArray(o)?o.map(_S):[]},getAgents(){return qe("/api/agents")},getSkillDetail(n,l){return qe(`/api/skills/${n}/${l}`)},getEvals(n,l){return qe(`/api/skills/${n}/${l}/evals`)},saveEvals(n,l,s){return qe(`/api/skills/${n}/${l}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},generateEvals(n,l){return qe(`/api/skills/${n}/${l}/generate-evals`,{method:"POST"})},async getLatestBenchmark(n,l){const s=await fetch(`${er}/api/skills/${n}/${l}/benchmark/latest`);if(s.status===404)return null;if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Ms(o.error||`HTTP ${s.status}`,s.status)}return s.json()},getHistory(n,l,s){const o=new URLSearchParams;s!=null&&s.model&&o.set("model",s.model),s!=null&&s.type&&o.set("type",s.type),s!=null&&s.from&&o.set("from",s.from),s!=null&&s.to&&o.set("to",s.to);const c=o.toString();return qe(`/api/skills/${n}/${l}/history${c?"?"+c:""}`)},getHistoryEntry(n,l,s){return qe(`/api/skills/${n}/${l}/history/${encodeURIComponent(s)}`)},compareRuns(n,l,s,o){return qe(`/api/skills/${n}/${l}/history-compare?a=${encodeURIComponent(s)}&b=${encodeURIComponent(o)}`)},getCaseHistory(n,l,s,o){const c=new URLSearchParams;o&&c.set("model",o);const f=c.toString();return qe(`/api/skills/${n}/${l}/history/case/${s}${f?"?"+f:""}`)},deleteHistoryEntry(n,l,s){return qe(`/api/skills/${n}/${l}/history/${encodeURIComponent(s)}`,{method:"DELETE"})},deleteSkill(n,l){return qe(`/api/skills/${n}/${l}`,{method:"DELETE"})},improveSkill(n,l,s){return qe(`/api/skills/${n}/${l}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},instructEdit(n,l,s){return qe(`/api/skills/${n}/${l}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...s})})},applyImprovement(n,l,s){return qe(`/api/skills/${n}/${l}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s})})},getStats(n,l){return qe(`/api/skills/${n}/${l}/stats`)},getDependencies(n,l){return qe(`/api/skills/${n}/${l}/dependencies`)},getProjectLayout(){return qe("/api/project-layout")},createSkill(n){return qe("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})},saveDraft(n){return qe("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})},getSkillCreatorStatus(){return qe("/api/skill-creator-status")},generateSkill(n){return qe("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})},getSkillFiles(n,l){return qe(`/api/skills/${n}/${l}/files`)},getSkillFile(n,l,s){return qe(`/api/skills/${n}/${l}/file?path=${encodeURIComponent(s)}`)},saveSkillFile(n,l,s,o){return qe(`/api/skills/${n}/${l}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s,content:o})})},getLeaderboard(n,l){return qe(`/api/skills/${n}/${l}/leaderboard`)},getLeaderboardEntry(n,l,s){return qe(`/api/skills/${n}/${l}/leaderboard/${encodeURIComponent(s)}`)},startSweep(n,l,s){const o=`${er}/api/skills/${n}/${l}/sweep`,c=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(s)}),c},getCredentials(n,l){return qe(`/api/credentials/${n}/${l}`)},setCredential(n,l,s,o){return qe(`/api/credentials/${n}/${l}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,value:o})})},getParams(n,l){return qe(`/api/credentials/${n}/${l}/params`)},getParamsRevealed(n,l,s){const o=s?`reveal=true&key=${encodeURIComponent(s)}`:"reveal=true";return qe(`/api/credentials/${n}/${l}/params?${o}`)},searchModels(){return qe("/api/openrouter/models")},getSkillVersions(n,l){return qe(`/api/skills/${n}/${l}/versions`)},getVersionDiff(n,l,s,o){return qe(`/api/skills/${n}/${l}/versions/diff?from=${s}&to=${o}`)},startBatchUpdate(n){const l=`${er}/api/skills/batch-update`,s=new EventSource(l);return fetch(l,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:n})}),s},startSkillUpdate(n,l){const s=`${er}/api/skills/${n}/${l}/update`,o=new EventSource(s);return fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async getSkillUpdates(){try{const n=await fetch(`${er}/api/skills/updates`);return n.ok?await n.json():[]}catch{return[]}},promoteSkill(n,l,s){const o=s!=null&&s.overwrite?"?overwrite=true":"";return pd(`/api/skills/${n}/${l}/promote${o}`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},testInstallSkill(n,l,s){const o=new URLSearchParams;(s==null?void 0:s.dest)==="global"&&o.set("dest","global"),s!=null&&s.overwrite&&o.set("overwrite","true");const c=o.toString();return pd(`/api/skills/${n}/${l}/test-install${c?"?"+c:""}`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},revertSkill(n,l,s){return pd(`/api/skills/${n}/${l}/revert`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},listStudioOps(n){const l=new URLSearchParams;(n==null?void 0:n.before)!=null&&l.set("before",String(n.before)),(n==null?void 0:n.limit)!=null&&l.set("limit",String(n.limit));const s=l.toString();return qe(`/api/studio/ops${s?"?"+s:""}`)},deleteStudioOp(n){return qe(`/api/studio/ops/${encodeURIComponent(n)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${er}/api/studio/ops/stream`)}};async function pd(n,l,s){const o=await fetch(`${er}${n}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:s});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,v;try{const j=await o.json();j.error&&(y=j.error),typeof j.code=="string"&&(v=j.code)}catch{}const b=new Ms(y,o.status);throw v&&(b.code=v),b}const c=o.body.getReader(),f=new TextDecoder;let d="",x="",h=null,p=null;for(;;){const{done:y,value:v}=await c.read();if(y)break;d+=f.decode(v,{stream:!0});const b=d.split(`
62
+ `);d=b.pop()??"";for(const j of b)if(j.startsWith("event: "))x=j.slice(7).trim();else if(j.startsWith("data: ")){let k={};try{k=JSON.parse(j.slice(6))}catch{x="";continue}if(x==="started"||x==="copied"||x==="deleted"||x==="indexed"||x==="done"||x==="error"){const N={type:x,...k};l==null||l(N),N.type==="done"&&(h=N),N.type==="error"&&(p=N)}x=""}}if(p){const y=new Ms(p.message,500);throw y.code=p.code,y}if(!h)throw new Ms("Transfer stream ended without 'done' event",500);return h}function OS(n,l){if(!l.length)return n;const s=new Map;for(const o of l){const c=o.name.split("/").pop()||o.name;s.set(c,o)}return n.map(o=>{const c=s.get(o.skill);return c?{...o,updateAvailable:c.updateAvailable,currentVersion:c.installed,latestVersion:c.latest??void 0}:o})}function BS(n){const[l,s]=g.useState(()=>typeof window>"u"?!1:window.matchMedia(n).matches);return g.useEffect(()=>{const o=window.matchMedia(n);s(o.matches);const c=f=>s(f.matches);return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[n]),l}const IS=3e5,HS=500,US=15e3,$S=6e4;function VS(n){const l=new Map;for(const s of n){const o=s.name.split("/").pop()||s.name;l.set(o,s)}return l}function PS(n){let l=0;for(const s of n)s.updateAvailable&&l++;return l}function FS(n){n()}function GS(n){const l=IS,s=HS,o=US,c=$S,[f,d]=g.useState([]),[x,h]=g.useState(()=>new Map),[p,y]=g.useState(0),[v,b]=g.useState(!1),[j,k]=g.useState(null),[N,C]=g.useState(null),w=g.useRef(null),A=g.useRef(null),_=g.useRef(null),H=g.useRef(null),L=g.useRef(!0),$=g.useCallback(async()=>{b(!0);const B=new AbortController,V=setTimeout(()=>B.abort(),o);try{const W=await Promise.race([Ne.getSkillUpdates(),new Promise((te,Q)=>{B.signal.addEventListener("abort",()=>{Q(new Error("TIMEOUT"))})})]);if(W==="TIMEOUT")throw new Error("TIMEOUT");if(!L.current)return;d(W),h(VS(W)),y(PS(W)),A.current=Date.now(),k(A.current),C(null)}catch(W){if(!L.current)return;C(W instanceof Error?W:new Error(String(W)))}finally{clearTimeout(V),L.current&&b(!1)}},[o]),E=g.useCallback(()=>{if(w.current)return w.current;const B=$().finally(()=>{w.current=null});return w.current=B,B},[$]),D=g.useCallback(()=>{_.current==null&&(_.current=setInterval(()=>{E()},l))},[l,E]),R=g.useCallback(()=>{_.current!=null&&(clearInterval(_.current),_.current=null)},[]);return g.useEffect(()=>{L.current=!0,(A.current==null||Date.now()-A.current>c)&&FS(()=>void E()),(typeof document>"u"||document.visibilityState!=="hidden")&&D();const W=()=>{if(H.current&&(clearTimeout(H.current),H.current=null),document.visibilityState==="hidden"){R();return}H.current=setTimeout(()=>{H.current=null,(A.current==null||Date.now()-A.current>c)&&E(),D()},s)};return typeof document<"u"&&document.addEventListener("visibilitychange",W),()=>{L.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",W),H.current&&clearTimeout(H.current),R()}},[]),{updates:f,updatesMap:x,updateCount:p,isRefreshing:v,lastFetchAt:j,error:N,refresh:E}}const WS={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function qS(n,l){switch(l.type){case"SELECT_SKILL":return{...n,selectedSkill:l.skill,mode:"browse",mobileView:n.isMobile?"detail":n.mobileView};case"CLEAR_SELECTION":return{...n,selectedSkill:null};case"SET_MODE":return{...n,mode:l.mode,selectedSkill:l.mode==="create"?null:n.selectedSkill};case"SET_SEARCH":return{...n,searchQuery:l.query};case"SET_SKILLS":return{...n,skills:l.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...n,skillsError:l.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...n,skillsLoading:l.loading};case"SET_MOBILE":return{...n,isMobile:l.isMobile};case"SET_MOBILE_VIEW":return{...n,mobileView:l.view};case"DISMISS_UPDATE_NOTIFICATION":return{...n,updateNotificationDismissed:!0};default:return n}}const hv=g.createContext(null);function Na(){const n=g.useContext(hv);if(!n)throw new Error("useStudio must be used within StudioProvider");return n}function YS({children:n}){const[l,s]=g.useReducer(qS,WS),o=BS("(max-width: 767px)");g.useEffect(()=>{s({type:"SET_MOBILE",isMobile:o})},[o]);const[c,f]=g.useState(()=>{try{const L=window.localStorage.getItem("vskill.studio.prefs");if(!L)return null;const $=JSON.parse(L);return typeof $.activeAgent=="string"?$.activeAgent:null}catch{return null}});g.useEffect(()=>{function L($){if(!($ instanceof CustomEvent))return;const E=$.detail;E!=null&&E.agentId&&f(E.agentId)}return window.addEventListener("studio:agent-changed",L),()=>window.removeEventListener("studio:agent-changed",L)},[]);const d=g.useCallback(()=>{s({type:"SET_SKILLS_LOADING",loading:!0});const L=c?{agent:c}:void 0;Ne.getSkills(L).then($=>{s({type:"SET_SKILLS",skills:$});const D=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(D){const[,R,B]=D,V=$.find(W=>W.plugin===R&&W.skill===B);V&&s({type:"SELECT_SKILL",skill:{plugin:R,skill:B,origin:V.origin}})}}).catch($=>s({type:"SET_SKILLS_ERROR",error:$.message}))},[c]);g.useEffect(()=>{d()},[d]);const x=g.useCallback(L=>{s({type:"SELECT_SKILL",skill:L}),window.location.hash=`/skills/${L.plugin}/${L.skill}`},[]),h=g.useCallback(()=>{s({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),p=g.useCallback(L=>{s({type:"SET_MODE",mode:L})},[]),y=g.useCallback(L=>{s({type:"SET_SEARCH",query:L})},[]),v=g.useCallback(L=>{s({type:"SET_MOBILE_VIEW",view:L})},[]),b=g.useCallback(()=>{s({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),j=GS(),k=g.useMemo(()=>{const L=l.skills.map($=>{if(!$.updateAvailable&&$.latestVersion===void 0)return $;const E={...$};return delete E.updateAvailable,delete E.currentVersion,delete E.latestVersion,E});return OS(L,j.updates)},[l.skills,j.updates]),N=g.useMemo(()=>{const L={source:0,installed:0};for(const $ of k)$.updateAvailable&&(L[$.origin]+=1);return L},[k]),C=g.useMemo(()=>({...l,skills:k}),[l,k]),w=j.updateCount,A=j.refresh,_=j.isRefreshing,H=g.useMemo(()=>({state:C,selectSkill:x,clearSelection:h,setMode:p,setSearch:y,setMobileView:v,refreshSkills:d,updateCount:w,dismissUpdateNotification:b,updates:j.updates,outdatedByOrigin:N,isRefreshingUpdates:_,refreshUpdates:A}),[C,x,h,p,y,v,d,w,b,j.updates,N,_,A]);return a.jsx(hv.Provider,{value:H,children:n})}const KS={config:null,loading:!0};function XS(n,l){switch(l.type){case"SET_CONFIG":return{config:l.config,loading:!1};case"SET_LOADING":return{...n,loading:!0};default:return n}}const xv=g.createContext(null);function Rr(){const n=g.useContext(xv);if(!n)throw new Error("useConfig must be used within ConfigProvider");return n}function QS({children:n}){const[l,s]=g.useReducer(XS,KS),o=g.useCallback(()=>{Ne.getConfig().then(d=>s({type:"SET_CONFIG",config:d})).catch(()=>{})},[]);g.useEffect(()=>{o()},[o]);const c=g.useCallback(async(d,x)=>{const h=await Ne.setConfig(d,x);return s({type:"SET_CONFIG",config:h}),h},[]),f=g.useMemo(()=>({config:l.config,loading:l.loading,updateConfig:c,refreshConfig:o}),[l,c,o]);return a.jsx(xv.Provider,{value:f,children:n})}function ZS({topRail:n,sidebar:l,main:s,statusBar:o,resizeHandle:c,banner:f,liveMessage:d,sidebarWidth:x=320,sidebarHidden:h=!1}){const p={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${x}px`,display:"grid",gridTemplateRows:"var(--top-rail-height) 1fr var(--status-bar-height)",height:"100vh",overflow:"hidden",background:"var(--bg-canvas)",color:"var(--text-primary)"},y={display:"grid",gridTemplateColumns:h?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return a.jsxs("div",{className:"studio-shell",style:p,children:[f,a.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:n}),a.jsxs("div",{style:y,children:[!h&&a.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:c?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:l}),!h&&c,a.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:s})]}),a.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),a.jsx("div",{"aria-live":"polite",role:"status",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},children:d??""})]})}const Ux=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],JS={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},ej={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},tj={"claude-cli":"cli-install",anthropic:"api-key",openrouter:"api-key",cursor:"cli-install","codex-cli":"cli-install","gemini-cli":"cli-install",copilot:"cli-install",zed:"cli-install",ollama:"start-service","lm-studio":"start-service"},nj={"claude-cli":"subscription",anthropic:"per-token",openrouter:"per-token",cursor:"subscription","codex-cli":"subscription","gemini-cli":"subscription",copilot:"subscription",zed:"subscription",ollama:"free","lm-studio":"free"};function aj(n,l){var x,h;const s=JS[n.id]??null,o=ej[n.id]??null,c=s?!!((x=l==null?void 0:l.wrapperFolders)!=null&&x[s]):!1,f=o?!!((h=l==null?void 0:l.binaries)!=null&&h[o]):!0,d=n.models.map(p=>({id:p.id,displayName:p.label,billingMode:nj[n.id]??"per-token"}));return{id:n.id,displayName:rj(n.id,n.label),wrapperFolder:s,wrapperFolderPresent:c,binaryAvailable:f,endpointReachable:n.id==="ollama"||n.id==="lm-studio"?n.available:null,available:n.available,ctaType:n.available?null:tj[n.id]??null,models:d}}function rj(n,l){return{"claude-cli":"Claude Code",anthropic:"Anthropic API",openrouter:"OpenRouter",cursor:"Cursor","codex-cli":"Codex CLI","gemini-cli":"Gemini CLI",copilot:"GitHub Copilot",zed:"Zed",ollama:"Ollama","lm-studio":"LM Studio"}[n]??l}function lj(n){const l=new Map(n.map(o=>[o.id,o])),s=[];for(const o of Ux){const c=l.get(o);c&&s.push(c)}for(const o of n)Ux.includes(o.id)||s.push(o);return s}function sj(n){const[l,s]=g.useState(null),[o,c]=g.useState("loading"),[f,d]=g.useState(null),x=g.useRef(null),h=g.useRef(0),p=g.useCallback(async()=>{try{const k=await fetch("/api/config");if(!k.ok)throw new Error(`/api/config returned ${k.status}`);const N=await k.json(),C=lj((N.providers||[]).map(w=>aj(w,N.detection)));s({agents:C,activeAgent:N.provider??null,activeModel:N.model??null}),c("ready"),d(null)}catch(k){c("error"),d(k.message)}},[]);g.useEffect(()=>{p()},[p]);const y=g.useCallback(async()=>{const k=Date.now();if(!(k-h.current<5*6e4))try{const N=await fetch("/api/openrouter/models");if(!N.ok)return;const C=await N.json();h.current=k,s(w=>{if(!w)return w;const A=w.agents.map(_=>{if(_.id!=="openrouter")return _;const H=C.models.map($=>({id:$.id,displayName:$.name,contextWindow:$.contextWindow,pricing:$.pricing,billingMode:"per-token"}));return{..._,models:H,catalogAgeMs:C.ageSec?C.ageSec*1e3:0,cacheStale:!!C.stale}});return{...w,agents:A}}),C.stale&&(n!=null&&n.onStaleCatalog)&&n.onStaleCatalog("openrouter",(C.ageSec??0)*1e3)}catch{}},[n]),v=g.useCallback(k=>{x.current=k,k==="openrouter"&&y()},[y]),b=g.useCallback(()=>{h.current=0,p()},[p]),j=g.useCallback(async(k,N)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:k,model:N})})).ok&&s(w=>w&&{...w,activeAgent:k,activeModel:N})},[]);return{status:o,catalog:l,error:f,focusAgent:v,refresh:b,activeAgentId:(l==null?void 0:l.activeAgent)??null,activeModelId:(l==null?void 0:l.activeModel)??null,setActive:j}}function md({variant:n,label:l,onActivate:s,installUrl:o}){function c(d){if(d.stopPropagation(),n==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}s()}function f(d){(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),c(d))}return a.jsx("button",{type:"button","data-testid":`locked-cta-${n}`,onClick:c,onKeyDown:f,className:"inline-flex items-center gap-1.5 px-0 py-0 text-[11px] font-medium",style:{color:"var(--accent, var(--text-primary))",background:"transparent",border:"none",cursor:"pointer"},"aria-label":l,children:l})}function Hd({unlocked:n=!1,size:l=10}){return n?a.jsxs("svg",{width:l,height:l,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),a.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):a.jsxs("svg",{width:l,height:l,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),a.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const ij={sectionOwn:"Own",sectionInstalled:"Installed",searchPlaceholder:"Search skills",searchShortcutHint:"Press / to search",emptyOwnHeadline:"No skills yet.",emptyOwnBody:"Run vskill new <name> to create one.",emptyInstalledHeadline:"No installed skills.",emptyInstalledBody:"Run vskill install <plugin> to add one.",emptyFilteredHeadline:"No matches in this section.",emptyFilteredBody:"Clear the search or try another query.",loadErrorHeadline:"Couldn't load skills.",loadErrorRetry:"Retry",duplicateBadge:"synced from Own",updateAvailableBadge:"Update available",countBadgeFiltered:(n,l)=>`${n} of ${l}`},oj={appTitle:"Skill Studio",commandPaletteButtonLabel:"Open command palette",commandPaletteHint:"⌘K",themeToggleLight:"Switch to light theme",themeToggleDark:"Switch to dark theme",themeToggleAuto:"Switch to auto theme",projectPathLabel:"Project",modelLabel:"Model",healthLabel:"Health"},cj={tabOverview:"Overview",tabVersions:"Versions",tabBenchmark:"Benchmark",emptyHeadline:"Select a skill to see details.",emptyBody:"Pick one from the sidebar.",loadErrorHeadline:n=>`Couldn't load SKILL.md for ${n}.`,loadErrorBody:"Check the file path and your workspace permissions.",openInEditor:"Open in editor",copyPath:"Copy path",copyConfigSnippet:"Copy config snippet",depNotInstalledTooltip:"Not installed",missingValue:"—",announceViewingOwn:n=>`Viewing ${n} (Own)`,announceViewingInstalled:n=>`Viewing ${n} (Installed)`,moreFields:"More fields",sourceAgent:"Source agent",noMcpDependencies:"No MCP dependencies.",filesystemGroup:"Filesystem",benchmarkGroup:"Benchmark",metadataGroup:"Frontmatter"},uj={open:"Open",copyPath:"Copy Path",revealInEditor:"Reveal in Editor",edit:"Edit",duplicate:"Duplicate",runBenchmark:"Run Benchmark",update:"Update",uninstall:"Uninstall",retry:"Retry",editPlaceholder:"Edit lands with 0675. Open the file in your editor."},dj={inputPlaceholder:"Type a command or search",emptyResults:"No matches. Try a different query.",groupNavigation:"Navigation",groupActions:"Actions",groupTheme:"Theme",actionSelectSkill:"Select skill",actionRunBenchmark:"Run benchmark",actionSwitchTheme:"Switch theme",actionNewSkill:"New skill",closeLabel:"Close palette"},fj={title:"Keyboard shortcuts",closeLabel:"Close shortcuts",groupNavigation:"Navigation",groupActions:"Actions",groupTheme:"Theme",search:"Focus search",moveDown:"Move selection down",moveUp:"Move selection up",openSelected:"Open selected skill",openPalette:"Open command palette",openShortcuts:"Open this cheatsheet",toggleSidebar:"Toggle sidebar",toggleTheme:"Toggle theme"},pj={pathCopied:"Path copied.",configCopied:"Config copied.",skillDuplicated:"Skill duplicated.",benchmarkQueued:"Benchmark queued.",themeUpdated:"Theme updated.",skillUpdated:"Skill updated.",actionFailed:"Action failed. Retry or check logs.",networkError:"Network error. Check your connection.",permissionDenied:"Permission denied. Check file access.",unknownError:"Something went wrong. Retry or check logs."},mj={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},hj={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},xj={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},gj={triggerLabel:"Agent and model",popoverTitle:"Select agent and model",footerHint:"↑↓ navigate · Enter select · Esc close",settingsButton:"Settings",keyboardShortcut:"⌘K",noModelsYet:"No models yet.",searchPlaceholder:"Search 300+ models…",noMatches:n=>`No models match "${n}"`,clearSearch:"Clear",currentlyActive:"Currently active"},vj={claudeCli:{name:"Claude Code",caption:"Delegates to the `claude` CLI — your existing Claude Code session handles quota.",missingBinary:"Claude Code not found. Install it: `npm install -g @anthropic-ai/claude-code`. Or choose a provider with an API key.",installCta:"Install Claude Code →",installUrl:"https://docs.claude.com/en/docs/claude-code"},anthropic:{name:"Anthropic API",caption:"Direct access via your Anthropic API key.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.claude.com/settings/keys",keyPrefix:"sk-ant-"},openrouter:{name:"OpenRouter",caption:"300+ models from every major vendor.",addKeyCta:"Add API key →",emptyCardBody:"Add your OpenRouter API key to browse 300+ models",keyIssuanceUrl:"https://openrouter.ai/settings/keys",keyPrefix:"sk-or-"},cursor:{name:"Cursor",caption:"Cursor IDE composer.",installCta:"Install Cursor →"},codexCli:{name:"Codex CLI",caption:"OpenAI Codex CLI.",installCta:"Install Codex CLI →"},geminiCli:{name:"Gemini CLI",caption:"Google Gemini CLI.",installCta:"Install Gemini CLI →"},copilot:{name:"GitHub Copilot",caption:"GitHub Copilot CLI.",installCta:"Install Copilot →"},zed:{name:"Zed",caption:"Zed editor.",installCta:"Install Zed →"},ollama:{name:"Ollama",caption:"Local models, free.",startServiceCta:"Start service →"},lmStudio:{name:"LM Studio",caption:"Local models, free.",startServiceCta:"Start LM Studio server →",startServiceTooltip:"Open LM Studio → Developer tab → Start Server (default port 1234)."}},yj={subscriptionBilling:"· subscription",free:"· free"},bj={title:"Settings",sectionApiKeys:"API Keys",sectionStorage:"Storage",banner:"Keys are stored locally on this device only. Never synced, never committed to git, never transmitted off-device except to the provider's own API.",storageBrowser:"Browser storage (default)",storageKeychain:"macOS Keychain (recommended)",storageDarwinOnly:"macOS Keychain is only available on macOS",show:"Show",hide:"Hide",paste:"Paste",save:"Save",remove:"Remove",removeConfirm:n=>`Remove ${n} API key?`,keyStoredAt:n=>`Key stored locally — updated ${n}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:n=>`This doesn't look like a typical ${n} key. Save anyway?`,keySaved:n=>`${n} API key saved (local only, never synced)`,keyRemoved:n=>`${n} API key removed`},Sj={providersLabel:"Providers",providerSummary:(n,l)=>`${n}/${l} providers`,locked:n=>`${n} — locked. Click to add a key.`,lockedCli:n=>`${n} — locked. Click for install instructions.`,unlocked:n=>`${n} — unlocked.`},jj={triggerAriaLabel:"Choose active agent for the sidebar",popoverTitle:"Choose active agent",statsInstalled:"Installed",statsGlobal:"Global",statsLastSync:"Last sync",statsHealthOk:"Fresh",statsHealthStale:"Updates available",statsHealthMissing:"Not detected",switchCta:"Switch for this studio session",notDetectedSubheading:"Not detected",setUpCta:n=>`Set up ${n}`,sharedFolderBanner:n=>`Shared folder — consumed by ${n}`},kj={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:n=>`No skills installed for ${n} in this project — run vskill install.`,emptyGlobal:n=>`No global skills for ${n} — run vskill install --global.`},wj={compactLabel:"Covered by Max/Pro · overflow billed at API rates",tooltip:"Your Claude Code CLI usage runs under your Pro/Max subscription quota. If you've enabled extra usage in your account settings, excess usage continues at standard API rates. Run /usage in Claude Code or visit claude.com Settings → Usage to see remaining quota — vskill can't display it directly.",firstUseBanner:"Claude Code uses your Pro/Max subscription. No API key needed — vskill just runs the official claude binary on your behalf.",learnMore:"Learn more"},Cj={title:n=>`Set up ${n}`,close:"Close",copy:"Copy",copied:"Copied",requiredEnv:"Required env vars",getKey:"Get a key",installRun:"Install & run",learnMore:"Learn more",fallbackTitle:"No setup guide available",fallbackBody:"We don't ship a setup guide for this provider yet."},Ej={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},Nj={anthropic:{name:"Anthropic API",description:"Direct API access to Claude via your Anthropic API key. Pay-per-token billing.",envVars:["ANTHROPIC_API_KEY"],keyUrl:"https://platform.claude.com/settings/keys",learnMoreUrl:"https://docs.claude.com/en/docs/get-started"},openai:{name:"OpenAI",description:"Access to GPT-4, GPT-5 and the o-series reasoning models via your OpenAI API key.",envVars:["OPENAI_API_KEY"],keyUrl:"https://platform.openai.com/api-keys",learnMoreUrl:"https://platform.openai.com/docs"},openrouter:{name:"OpenRouter",description:"One API key, 300+ models from Anthropic, OpenAI, Google, Meta, and more.",envVars:["OPENROUTER_API_KEY"],keyUrl:"https://openrouter.ai/keys",learnMoreUrl:"https://openrouter.ai/docs"},gemini:{name:"Gemini",description:"Google Gemini models (2.5 Pro, Flash) via Google AI Studio. Free tier available.",envVars:["GEMINI_API_KEY"],keyUrl:"https://aistudio.google.com/apikey",learnMoreUrl:"https://ai.google.dev/gemini-api/docs"},ollama:{name:"Ollama",description:"Local models on your own machine. Zero external calls, zero cost after download.",envVars:["OLLAMA_HOST"],installCmd:"curl -fsSL https://ollama.com/install.sh | sh",startCmd:"ollama serve",pullExample:"ollama pull llama3.2",learnMoreUrl:"https://ollama.com/download"},lmStudio:{name:"LM Studio",description:"Desktop app + local server for running open models with a GUI. Compatible with the OpenAI API.",envVars:["LM_STUDIO_BASE_URL"],installCmd:"Download from https://lmstudio.ai and launch the app, then start the local server.",startCmd:"# In LM Studio: Developer → Start Server (default port 1234)",pullExample:"# In LM Studio: Discover → download any GGUF model",learnMoreUrl:"https://lmstudio.ai/docs"},claudeCode:{name:"Claude Code",description:"No API key needed if you're logged into Claude Code. vskill just runs the official claude binary on your behalf under your Pro/Max subscription.",loginHint:"If you're not logged in, run claude in your terminal and authenticate with your Pro/Max account.",learnMoreUrl:"https://docs.claude.com/en/docs/claude-code"}},J={sidebar:ij,shell:oj,detail:cj,actions:uj,palette:dj,shortcuts:fj,toasts:pj,connection:mj,forms:hj,errors:xj,picker:gj,providers:vj,models:yj,settings:bj,statusBar:Sj,scopePicker:jj,scopeSection:kj,claudeCodeLabel:wj,setupDrawer:Cj,setupProviders:Nj,scopeLabels:Ej},$x=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function Tj({agents:n,activeAgentId:l,focusedAgentId:s,onFocus:o,onSelect:c,onOpenSettings:f}){const d=n.filter(h=>$x.has(h.id)),x=n.filter(h=>!$x.has(h.id));return a.jsxs("div",{role:"listbox","aria-label":"Agent","data-testid":"agent-list",style:{width:240,borderRight:"1px solid var(--border-default, var(--border-subtle))",display:"flex",flexDirection:"column",overflowY:"auto"},children:[d.map(h=>a.jsx(Vx,{agent:h,isActive:h.id===l,isFocused:h.id===s,onFocus:o,onSelect:c,onOpenSettings:f},h.id)),x.length>0&&a.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),x.map(h=>a.jsx(Vx,{agent:h,isActive:h.id===l,isFocused:h.id===s,onFocus:o,onSelect:c,onOpenSettings:f},h.id))]})}function Vx({agent:n,isActive:l,isFocused:s,onFocus:o,onSelect:c,onOpenSettings:f}){const{providers:d}=J,x={"claude-cli":d.claudeCli.caption,anthropic:d.anthropic.caption,openrouter:d.openrouter.caption},h={"claude-cli":{label:d.claudeCli.installCta,url:d.claudeCli.installUrl},cursor:{label:d.cursor.installCta},"codex-cli":{label:d.codexCli.installCta},"gemini-cli":{label:d.geminiCli.installCta},copilot:{label:d.copilot.installCta},zed:{label:d.zed.installCta}},p=n.id==="claude-cli"||n.id==="claude-code",y={minHeight:36,height:p?"auto":36,padding:p?"6px 12px":"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:s?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:l?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:l?500:400,color:"var(--text-primary)"};return l&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),a.jsxs("div",{role:"option","aria-selected":l,"data-testid":`agent-row-${n.id}`,"data-focused":s||void 0,tabIndex:s?0:-1,onMouseEnter:()=>o(n.id),onFocus:()=>o(n.id),onClick:()=>c(n.id),style:y,children:[n.wrapperFolder&&a.jsx("span",{"data-testid":`wrapper-dot-${n.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:n.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:n.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!n.wrapperFolder&&a.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),a.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.displayName}),(n.id==="claude-cli"||n.id==="claude-code")&&a.jsx("span",{"data-testid":"claude-code-billing-label",title:J.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:J.claudeCodeLabel.compactLabel})]}),a.jsx("span",{"aria-label":n.available?"available":"locked",style:{color:n.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:n.available?a.jsx(Hd,{unlocked:!0,size:10}):a.jsx(Hd,{size:10})}),l&&a.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${n.id}`,children:J.picker.currentlyActive}),!n.available&&n.ctaType==="api-key"&&a.jsx(md,{variant:"api-key",label:n.id==="anthropic"?d.anthropic.addKeyCta:d.openrouter.addKeyCta,onActivate:()=>f(n.id)}),!n.available&&n.ctaType==="cli-install"&&h[n.id]&&a.jsx(md,{variant:"cli-install",label:h[n.id].label,installUrl:h[n.id].url,onActivate:()=>{}}),!n.available&&n.ctaType==="start-service"&&a.jsx(md,{variant:"start-service",label:n.id==="ollama"?d.ollama.startServiceCta:d.lmStudio.startServiceCta,onActivate:()=>f(n.id)}),x[n.id]&&a.jsx("span",{className:"sr-only","data-testid":`caption-${n.id}`,children:x[n.id]})]})}function Rj(n,l,s,o){const d=n>=80,x=g.useRef(null),[h,p]=g.useState(0),y=g.useCallback(j=>{p(j.currentTarget.scrollTop)},[]),{visibleStart:v,visibleEnd:b}=g.useMemo(()=>{if(!d)return{visibleStart:0,visibleEnd:n};const j=Math.max(0,Math.floor(h/l)-4),k=Math.ceil(s/l)+8,N=Math.min(n,j+k);return{visibleStart:j,visibleEnd:N}},[d,h,l,s,n,4]);return{visibleStart:v,visibleEnd:b,totalHeight:n*l,offsetTop:v*l,virtualised:d,containerProps:{onScroll:y,ref:x,style:{overflowY:"auto",maxHeight:s,willChange:d?"transform":void 0}}}}const gv=44,Aj=352,Mj=60;function Lj(n){var f,d;const l=n.contextWindow?n.contextWindow>=1e6?`${Math.round(n.contextWindow/1e6)}M`:n.contextWindow>=1e3?`${Math.round(n.contextWindow/1e3)}k`:String(n.contextWindow):null;if(n.billingMode==="subscription")return l?`${l} ctx ${J.models.subscriptionBilling}`:J.models.subscriptionBilling.trim();if(n.billingMode==="free")return l?`local · ${l} ctx · free`:"local · free";const s=((f=n.pricing)==null?void 0:f.prompt)??0,o=((d=n.pricing)==null?void 0:d.completion)??0,c=`$${s.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return l?`${l} ctx · ${c}`:c}function zj(n,l){if(!l)return n;const s=l.toLowerCase();return n.filter(c=>c.displayName.toLowerCase().includes(s)).sort((c,f)=>{const d=c.displayName.toLowerCase().indexOf(s),x=f.displayName.toLowerCase().indexOf(s);return d!==x?d-x:c.displayName.length-f.displayName.length})}function Dj({agent:n,activeModelId:l,onSelect:s,onOpenSettings:o}){const[c,f]=g.useState(""),[d,x]=g.useState(""),h=g.useRef(null);if(g.useEffect(()=>{const v=setTimeout(()=>x(c),Mj);return()=>clearTimeout(v)},[c]),g.useEffect(()=>{n.id==="openrouter"&&n.available&&h.current&&h.current.focus()},[n.id,n.available]),n.id==="openrouter"&&!n.available)return a.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:360,padding:20,display:"flex",flexDirection:"column",gap:12},children:[a.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:J.providers.openrouter.emptyCardBody}),a.jsx("button",{type:"button",onClick:()=>o("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:J.providers.openrouter.addKeyCta})]});const p=g.useMemo(()=>zj(n.models,d),[n.models,d]),y=Rj(p.length,gv,Aj);return a.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:360,display:"flex",flexDirection:"column"},children:[n.id==="openrouter"&&a.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:a.jsx("input",{ref:h,type:"text",placeholder:J.picker.searchPlaceholder,value:c,onChange:v=>f(v.target.value),"data-testid":"model-search-input","aria-label":J.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),p.length===0&&d?a.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[a.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:J.picker.noMatches(d)}),a.jsx("button",{type:"button",onClick:()=>f(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:J.picker.clearSearch})]}):p.length===0?a.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:J.picker.noModelsYet}):a.jsx("div",{...y.containerProps,children:a.jsx("div",{style:{height:y.virtualised?y.totalHeight:"auto",position:"relative"},children:a.jsx("div",{style:{transform:y.virtualised?`translateY(${y.offsetTop}px)`:void 0},children:p.slice(y.visibleStart,y.visibleEnd).map(v=>a.jsx(Oj,{model:v,isActive:v.id===l,onSelect:()=>s(v.id),resolvedModel:n.id==="claude-cli"?n.resolvedModel??null:null},v.id))})})})]})}function _j(n,l){return l?l.toLowerCase().includes(n.toLowerCase()):!1}function Oj({model:n,isActive:l,onSelect:s,resolvedModel:o}){const c=Lj(n),f=_j(n.id,o);return a.jsxs("button",{type:"button",role:"option","aria-selected":l,"data-testid":`model-row-${n.id}`,onClick:s,title:n.id,style:{width:"100%",minHeight:gv,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:l?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":"transparent",borderLeft:l?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[a.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:n.displayName}),a.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:c}),f&&a.jsxs("span",{"data-testid":`model-row-${n.id}-resolved`,style:{fontSize:11,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",color:"var(--text-muted, var(--text-tertiary))"},children:["routing to ",o]})]})}const Px={anthropic:{stored:!1,updatedAt:null,tier:"browser"},openrouter:{stored:!1,updatedAt:null,tier:"browser"}};function Bj(){const[n,l]=g.useState(null),[s,o]=g.useState(!0),[c,f]=g.useState(null),d=g.useCallback(async()=>{o(!0);try{const p=await fetch("/api/settings/keys");if(!p.ok)throw new Error(`GET /api/settings/keys returned ${p.status}`);const y=await p.json();l({...Px,...y}),f(null)}catch(p){f(p.message),l(Px)}finally{o(!1)}},[]);g.useEffect(()=>{d()},[d]);const x=g.useCallback(async(p,y,v="browser")=>{const b=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:p,key:y,tier:v})});if(!b.ok){const k=await b.json().catch(()=>({error:b.statusText}));throw new Error(k.error||`POST /api/settings/keys returned ${b.status}`)}const j=await b.json();return await d(),j},[d]),h=g.useCallback(async p=>{const y=await fetch(`/api/settings/keys/${p}`,{method:"DELETE"});if(!y.ok)throw new Error(`DELETE /api/settings/keys/${p} returned ${y.status}`);await d()},[d]);return{state:n,loading:s,error:c,save:x,remove:h,refresh:d}}const Ij=[{id:"anthropic",name:J.providers.anthropic.name,keyIssuanceUrl:J.providers.anthropic.keyIssuanceUrl,prefix:J.providers.anthropic.keyPrefix},{id:"openrouter",name:J.providers.openrouter.name,keyIssuanceUrl:J.providers.openrouter.keyIssuanceUrl,prefix:J.providers.openrouter.keyPrefix}];function Hj(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform)}function Uj(n){const l=Date.now()-new Date(n).getTime();return l<6e4?"just now":l<36e5?`${Math.round(l/6e4)}m ago`:l<864e5?`${Math.round(l/36e5)}h ago`:new Date(n).toLocaleString()}function $j({open:n,onClose:l,initialProvider:s,onToast:o}){const{state:c,save:f,remove:d}=Bj(),[x,h]=g.useState("browser"),p=g.useRef(null),y=g.useRef(null),[v,b]=g.useState(s??"anthropic");if(g.useEffect(()=>{if(!n)return;const k=document.activeElement,N=setTimeout(()=>{var A;const C=s?`input[data-provider="${s}"]`:"input[data-provider]",w=(A=p.current)==null?void 0:A.querySelector(C);w==null||w.focus()},0);return()=>{var C;clearTimeout(N),(C=k==null?void 0:k.focus)==null||C.call(k)}},[n,s]),g.useEffect(()=>{if(!n)return;const k=N=>{if(N.key==="Escape"){N.preventDefault(),l();return}if(N.key==="Tab"&&p.current){const C=p.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(C.length===0)return;const w=C[0],A=C[C.length-1];N.shiftKey&&document.activeElement===w?(N.preventDefault(),A.focus()):!N.shiftKey&&document.activeElement===A&&(N.preventDefault(),w.focus())}};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[n,l]),!n)return null;const j=Hj();return a.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:k=>{k.target===k.currentTarget&&l()},children:a.jsxs("div",{ref:p,style:{background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,width:560,maxHeight:"80vh",overflowY:"auto",padding:20,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",color:"var(--text-primary)"},onClick:k=>k.stopPropagation(),children:[a.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:J.settings.title}),a.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:J.settings.banner}),a.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[a.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionApiKeys}),Ij.map(k=>a.jsx(Vj,{providerId:k.id,providerName:k.name,keyIssuanceUrl:k.keyIssuanceUrl,prefix:k.prefix,metadata:c==null?void 0:c[k.id],tier:x,onSave:async N=>{const C=await f(k.id,N,x);return o==null||o(J.settings.keySaved(k.name)),C},onRemove:async()=>{await d(k.id),o==null||o(J.settings.keyRemoved(k.name))},inputRef:k.id===(s??"anthropic")?y:void 0},k.id))]}),a.jsxs("section",{"aria-labelledby":"settings-storage-title",children:[a.jsx("h3",{id:"settings-storage-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionStorage}),j?a.jsxs("fieldset",{style:{border:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:6},children:[a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[a.jsx("input",{type:"radio",name:"storage-tier",value:"browser",checked:x==="browser",onChange:()=>h("browser")}),J.settings.storageBrowser]}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[a.jsx("input",{type:"radio",name:"storage-tier",value:"keychain",checked:x==="keychain",onChange:()=>h("keychain")}),J.settings.storageKeychain]})]}):a.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, var(--text-tertiary))"},children:[J.settings.storageBrowser,a.jsxs("span",{title:J.settings.storageDarwinOnly,style:{marginLeft:8},children:["(",J.settings.storageDarwinOnly,")"]})]})]}),a.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:a.jsx("button",{type:"button",onClick:l,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})})}function Vj({providerId:n,providerName:l,keyIssuanceUrl:s,prefix:o,metadata:c,onSave:f,onRemove:d,inputRef:x}){const[h,p]=g.useState(""),[y,v]=g.useState(!1),[b,j]=g.useState(!1),[k,N]=g.useState(!1),[C,w]=g.useState(null),A=h.trim(),_=A.length===0,H=A.length>0&&!A.startsWith(o),L=g.useCallback(async()=>{if(!_){j(!0);try{const D=await f(A);D.warning?w(D.warning):w(null),p("")}finally{j(!1)}}},[_,f,A]),$=g.useCallback(async()=>{var D;try{if(!((D=navigator.clipboard)!=null&&D.readText))return;const R=await navigator.clipboard.readText();p(R)}catch{}},[]),E=g.useCallback(async()=>{N(!1),await d()},[d]);return a.jsxs("div",{"data-testid":`provider-row-${n}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsx("strong",{style:{fontSize:13},children:l}),a.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),a.jsxs("div",{style:{display:"flex",gap:6},children:[a.jsx("input",{ref:x,type:y?"text":"password",value:h,onChange:D=>{p(D.target.value),w(null)},"data-provider":n,placeholder:`Paste ${l} key`,style:{flex:1,padding:"6px 8px",border:"1px solid var(--border-subtle)",borderRadius:4,background:"var(--surface-2, var(--bg-surface))",color:"var(--text-primary)",fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"}}),a.jsx("button",{type:"button",onClick:()=>v(!y),style:xl,children:y?J.settings.hide:J.settings.show}),a.jsx("button",{type:"button",onClick:$,style:xl,children:J.settings.paste})]}),_&&h.length>0&&a.jsx("div",{role:"status",style:Pj,children:J.settings.enterNonEmpty}),H&&a.jsx("div",{role:"status","data-testid":`prefix-warn-${n}`,style:Fx,children:J.settings.prefixWarn(l)}),C&&a.jsx("div",{role:"status",style:Fx,children:C}),a.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[a.jsx("button",{type:"button",onClick:L,disabled:_||b,"data-testid":`save-${n}`,style:{...xl,background:_?"var(--surface-2)":"var(--accent, var(--color-accent))",color:_?"var(--text-muted)":"white",cursor:_?"not-allowed":"pointer"},children:J.settings.save}),(c==null?void 0:c.stored)&&a.jsx(a.Fragment,{children:k?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{fontSize:12},children:J.settings.removeConfirm(l)}),a.jsx("button",{type:"button",onClick:E,"data-testid":`remove-confirm-${n}`,style:{...xl,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),a.jsx("button",{type:"button",onClick:()=>N(!1),style:xl,children:"Cancel"})]}):a.jsx("button",{type:"button",onClick:()=>N(!0),"data-testid":`remove-${n}`,style:{...xl,color:"var(--text-muted)"},children:J.settings.remove})}),a.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${n}`,children:c!=null&&c.stored&&c.updatedAt?J.settings.keyStoredAt(Uj(c.updatedAt)):J.settings.noKey})]})]})}const xl={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},Pj={fontSize:11,color:"var(--danger, #b33)"},Fx={fontSize:11,color:"var(--warning, var(--text-muted))"};function Fj(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Gj({onToast:n}){const{status:l,catalog:s,focusAgent:o,setActive:c}=sj({onStaleCatalog:(D,R)=>{const B=Math.round(R/6e4);n==null||n(`Using cached ${D} catalog (${B} min old)`)}}),[f,d]=g.useState(!1),[x,h]=g.useState(!1),[p,y]=g.useState(),[v,b]=g.useState(null),[j,k]=g.useState("agents"),N=g.useRef(null);g.useRef(null),g.useEffect(()=>{var D;s&&!v&&b(s.activeAgent??((D=s.agents[0])==null?void 0:D.id)??null)},[s,v]);const C=(s==null?void 0:s.agents)??[],w=g.useMemo(()=>C.find(D=>D.id===v)??C[0],[C,v]),A=g.useCallback(()=>{var D;d(!0),k("agents"),b((s==null?void 0:s.activeAgent)??((D=C[0])==null?void 0:D.id)??null)},[s,C]),_=g.useCallback(()=>{var D;d(!1),(D=N.current)==null||D.focus()},[]);g.useEffect(()=>{const D=R=>{var V;if(!(R.metaKey||R.ctrlKey)||R.key.toLowerCase()!=="k")return;const B=(V=document.activeElement)==null?void 0:V.tagName;B==="INPUT"||B==="TEXTAREA"||(R.preventDefault(),d(W=>!W))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),g.useEffect(()=>{if(!f)return;const D=B=>{if(B.key==="Escape"){B.preventDefault(),_();return}if(B.key==="ArrowDown"){B.preventDefault(),R(1);return}if(B.key==="ArrowUp"){B.preventDefault(),R(-1);return}if(B.key==="ArrowRight"&&j==="agents"){B.preventDefault(),k("models");return}if(B.key==="ArrowLeft"&&j==="models"){B.preventDefault(),k("agents");return}if(B.key==="Enter"){B.preventDefault(),j==="agents"&&w?k("models"):j==="models"&&w&&w.models[0]&&(c(w.id,w.models[0].id),_());return}};function R(B){if(j==="agents"){const V=C.findIndex(te=>te.id===v),W=C[Math.max(0,Math.min(C.length-1,V+B))];W&&(b(W.id),o(W.id))}}return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[f,j,C,v,w,_,o,c]);const H=g.useCallback(D=>{y(D==="anthropic"||D==="openrouter"?D:void 0),h(!0),d(!1)},[]),L=C.find(D=>D.id===(s==null?void 0:s.activeAgent)),$=L==null?void 0:L.models.find(D=>D.id===(s==null?void 0:s.activeModel)),E=g.useMemo(()=>{if(l!=="ready"||!s)return"Loading…";const D=(L==null?void 0:L.displayName)??"Agent",R=($==null?void 0:$.displayName)??s.activeModel??"Model";return`${D} · ${R}`},[l,s,L,$]);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:N,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>f?_():A(),"aria-haspopup":"listbox","aria-expanded":f,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"},children:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:L!=null&&L.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),a.jsx("span",{children:E})]}),f&&typeof document<"u"&&Oo.createPortal(a.jsxs(Wj,{reducedMotion:Fj(),onClickOutside:_,children:[a.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[a.jsx(Tj,{agents:C,activeAgentId:(s==null?void 0:s.activeAgent)??null,focusedAgentId:v,onFocus:D=>{b(D),o(D)},onSelect:D=>{b(D),o(D),k("models")},onOpenSettings:H}),w&&a.jsx(Dj,{agent:w,activeModelId:(s==null?void 0:s.activeModel)??null,onSelect:D=>{c(w.id,D),_()},onOpenSettings:H})]}),a.jsxs("div",{style:{height:32,borderTop:"1px solid var(--border-default, var(--border-subtle))",padding:"0 12px",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},children:[a.jsx("button",{type:"button",onClick:()=>H(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.picker.settingsButton}),a.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:J.picker.footerHint})]})]}),document.body),a.jsx($j,{open:x,onClose:()=>h(!1),initialProvider:p,onToast:n})]})}function Wj({children:n,reducedMotion:l,onClickOutside:s}){const o=g.useRef(null);return g.useEffect(()=>{const c=f=>{o.current&&!o.current.contains(f.target)&&s()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]),a.jsxs("div",{ref:o,"data-testid":"agent-model-picker-popover",role:"dialog","aria-label":"Select agent and model",style:{position:"fixed",top:56,left:"50%",transform:"translateX(-50%)",width:600,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:l?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[n,a.jsx("style",{children:`@keyframes agentPickerFadeIn {
63
+ from { opacity: 0; transform: translateX(-50%) translateY(2px); }
64
+ to { opacity: 1; transform: translateX(-50%) translateY(0); }
65
+ }`})]})}function Gx(){typeof window>"u"||(window.location.hash="#/")}function qj({onHome:n}){const[l,s]=g.useState(!1),[o,c]=g.useState(!1),f=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.button!==0||(x.preventDefault(),Gx(),n==null||n())},d=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),Gx(),n==null||n())};return a.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:f,onKeyDown:d,onFocus:()=>s(!0),onBlur:()=>s(!1),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0,padding:"4px 6px",margin:"-4px -6px",borderRadius:6,textDecoration:"none",color:"inherit",cursor:"pointer",outline:l?"2px solid var(--border-focus)":"none",outlineOffset:2,background:o?"color-mix(in srgb, var(--text-primary) 4%, transparent)":"transparent",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease)"},children:[a.jsx("span",{"aria-hidden":"true",style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,background:"color-mix(in srgb, var(--accent-surface) 20%, transparent)"},children:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-surface)",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.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const Yj="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='1.75'%20stroke-linecap='round'%20stroke-linejoin='round'%20aria-hidden='true'%20focusable='false'%3e%3cpath%20d='M5.5%2017h11l-1.2-1.8a2%202%200%200%201-.3-1.1V10a4%204%200%201%200-8%200v4.1a2%202%200%200%201-.3%201.1L5.5%2017Z'%20/%3e%3cpath%20d='M10%2020a2%202%200%200%200%204%200'%20/%3e%3ccircle%20cx='17'%20cy='7'%20r='2.2'%20fill='currentColor'%20stroke='none'%20/%3e%3c/svg%3e",Kj=g.lazy(()=>Ea(()=>import("./UpdateDropdown-Bj8kZzuR.js"),__vite__mapDeps([0,1])));function Xj(){const{updateCount:n,updates:l,isRefreshingUpdates:s,refreshUpdates:o,selectSkill:c}=Na(),[f,d]=g.useState(!1),x=g.useRef(null),h=g.useCallback(()=>d(!1),[]),p=n>0?"var(--text-primary)":"var(--text-secondary)",y=n>9?"9+":String(n),v=n===0?"No updates available":`${n} updates available, open summary`;return a.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[a.jsxs("button",{ref:x,type:"button","data-testid":"update-bell","aria-label":v,"aria-haspopup":"dialog","aria-expanded":f,onClick:()=>d(b=>!b),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:26,width:26,padding:0,borderRadius:4,border:"1px solid transparent",background:"transparent",color:p,cursor:"pointer"},children:[a.jsx("img",{src:Yj,alt:"",width:18,height:18,style:{display:"block",opacity:n>0?1:.75}}),n>0&&a.jsx("span",{"data-testid":"update-bell-badge","aria-hidden":"true",style:{position:"absolute",top:-2,right:-2,minWidth:14,height:14,padding:"0 3px",borderRadius:999,background:"var(--color-own)",color:"var(--color-paper)",fontSize:9,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:600,lineHeight:1},children:y})]}),f&&a.jsx(g.Suspense,{fallback:a.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:a.jsx(Kj,{updates:l,isRefreshing:s,onRefresh:()=>o(),onSelectSkill:b=>{const j=b.name.split("/"),k=j.length>=2?j[j.length-2]:j[0],N=j[j.length-1];c({plugin:k,skill:N,origin:"installed"}),h()},onViewAll:()=>{window.location.hash="#/updates",h()},onClose:h,anchorRef:x})})]})}function Wx(n){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:n}))}function Qj({projectName:n,selected:l,onOpenPalette:s,onHome:o,projectPickerSlot:c,onRequestCreateSkill:f}){const d=l?l.origin==="installed"?"Project":"Skills":null;return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[a.jsx(qj,{onHome:o}),c?a.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:c}):n&&a.jsx("span",{title:n,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]}),a.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:l&&d&&a.jsxs(a.Fragment,{children:[a.jsx(qx,{segment:"origin",onClick:()=>Wx({scope:"origin",origin:l.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:l.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:d}),a.jsx(Yx,{}),a.jsx(qx,{segment:"plugin",onClick:()=>Wx({scope:"plugin",plugin:l.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:l.plugin}),a.jsx(Yx,{}),a.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.skill})]})}),a.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[f&&a.jsxs("button",{type:"button","data-slot":"create-skill-button",onClick:f,"aria-label":"Create a new skill",title:"Create a new skill",style:{display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 12px",borderRadius:6,border:"1px solid var(--color-action, #2F5B8E)",background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",fontSize:12,fontWeight:600,fontFamily:"var(--font-sans)",cursor:"pointer",letterSpacing:"0.01em",boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,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"]}),a.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:a.jsx(Gj,{})}),a.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:a.jsx(Xj,{})}),a.jsx("button",{type:"button",onClick:s,"aria-label":"Open command palette",title:"Command palette (⌘K)",style:{display:"inline-flex",alignItems:"center",gap:6,height:26,padding:"0 10px",borderRadius:4,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:"pointer"},children:a.jsx("span",{children:"⌘K"})})]})]})}function qx({segment:n,onClick:l,style:s,children:o}){return a.jsx("button",{type:"button","data-breadcrumb-segment":n,onClick:l,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...s},onMouseEnter:c=>{c.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:c=>{const f=(s==null?void 0:s.color)??"var(--text-secondary)";c.currentTarget.style.color=f},children:o})}function Yx(){return a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const Bo="vskill-theme";function vv(n){return n==="light"||n==="dark"||n==="auto"?n:"auto"}function Zj(n,l){return n==="light"||n==="dark"?n:l?"dark":"light"}function Jj(n){try{const l=n.getItem(Bo);return vv(l)}catch{return"auto"}}function e2(n,l){try{n.setItem(Bo,l)}catch{}}function t2(n,l,s){n.dataset.theme=s,n.dataset.themeMode=l}function n2(n){if(!n)return!1;try{return n("(prefers-color-scheme: dark)").matches}catch{return!1}}const yv=g.createContext(null);function a2({storage:n,matchMedia:l,target:s,children:o}){const c=n??(typeof window<"u"?window.localStorage:void 0),f=l??(typeof window<"u"?window.matchMedia.bind(window):void 0),d=s??(typeof document<"u"?document.documentElement:void 0),[x,h]=g.useState(()=>c?Jj(c):"auto"),[p,y]=g.useState(()=>n2(f)),v=g.useMemo(()=>Zj(x,p),[x,p]);g.useEffect(()=>{d&&t2(d,x,v)},[d,x,v]),g.useEffect(()=>{if(!f)return;const k=f("(prefers-color-scheme: dark)"),N=w=>y(w.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",N),()=>k.removeEventListener("change",N);const C=k;return C.addListener(N),()=>C.removeListener(N)},[f]),g.useEffect(()=>{if(typeof window>"u")return;const k=N=>{N.key===Bo&&h(vv(N.newValue))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[]),g.useEffect(()=>{if(!f||!d)return;let k;try{k=f("(prefers-contrast: more)")}catch{return}const N=A=>{A?d.dataset.contrast="more":d.dataset.contrast==="more"&&delete d.dataset.contrast};N(k.matches);const C=A=>N(A.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",C),()=>k.removeEventListener("change",C);const w=k;return w.addListener(C),()=>w.removeListener(C)},[f,d]);const b=g.useCallback(k=>{h(k),c&&e2(c,k)},[c]),j=g.useMemo(()=>({mode:x,resolvedTheme:v,setTheme:b}),[x,v,b]);return a.jsx(yv.Provider,{value:j,children:o})}function bv(){const n=g.useContext(yv);if(!n)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return n}const Kx=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function r2(n){const l=new Map(n.map(o=>[o.id,o])),s=[];for(const o of Kx){const c=l.get(o);c&&s.push(c)}for(const o of n)Kx.includes(o.id)||s.push(o);return s}function l2(n){const[l,s]=g.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${n}px)`).matches);return g.useEffect(()=>{var f;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${n}px)`),c=()=>s(o.matches);return(f=o.addEventListener)==null||f.call(o,"change",c),()=>{var d;return(d=o.removeEventListener)==null?void 0:d.call(o,"change",c)}},[n]),l}function s2({providers:n,onOpenSettings:l,onOpenInstallHelp:s}){const o=r2(n),c=l2(640),[f,d]=g.useState(!1),x=g.useCallback(h=>{h.available||h.kind==="api-key"?l==null||l(h.id):s==null||s(h.id)},[l,s]);if(c){const h=o.filter(p=>p.available).length;return a.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[a.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>d(!f),"aria-label":J.statusBar.providerSummary(h,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.statusBar.providerSummary(h,o.length)}),f&&a.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(p=>a.jsx(Xx,{p,onClick:x},p.id))})]})}return a.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(h=>a.jsx(Xx,{p:h,onClick:x,compact:!0},h.id))})}function Xx({p:n,onClick:l,compact:s}){const o=n.available?J.statusBar.unlocked(n.label):n.kind==="cli-install"?J.statusBar.lockedCli(n.label):J.statusBar.locked(n.label);return a.jsxs("button",{type:"button","data-testid":`provider-glyph-${n.id}`,"data-available":n.available,"aria-label":o,title:o,onClick:()=>l(n),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:n.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:s?"2px":"4px 6px",fontSize:11},children:[a.jsx(Hd,{unlocked:n.available,size:10}),!s&&a.jsx("span",{children:n.label})]})}function i2(){try{return typeof localStorage>"u"?null:localStorage.getItem(Bo)}catch{return null}}function o2({projectPath:n,modelName:l,health:s="ok",onPathClick:o,providers:c,onOpenProviderSettings:f,onOpenProviderInstallHelp:d}){const{mode:x,resolvedTheme:h,setTheme:p}=bv(),v=i2()==="auto",b=c2(x,h,v),j=s==="down"||s==="degraded"?"var(--status-own)":"var(--status-installed)";return a.jsxs("div",{role:"contentinfo",style:{display:"flex",alignItems:"center",gap:12,height:"100%",width:"100%",padding:"0 12px",fontSize:11,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[a.jsx("span",{title:l??"",style:{fontFamily:"var(--font-mono)"},children:l??"—"}),a.jsx(Qx,{}),a.jsxs("span",{"aria-label":`Health: ${s}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[a.jsx(u2,{color:j}),a.jsx("span",{style:{textTransform:"capitalize"},children:s})]}),c&&c.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Qx,{}),a.jsx(s2,{providers:c,onOpenSettings:f,onOpenInstallHelp:d})]}),a.jsx("div",{style:{flex:1}}),a.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>p(b),"aria-label":`Switch to ${b} theme`,title:`Theme: ${x} — click for ${b}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"1px solid var(--border-default)",padding:"2px 8px",borderRadius:4,color:"var(--text-secondary)",cursor:"pointer",fontSize:11,height:20},children:[a.jsx(d2,{mode:x}),a.jsx("span",{style:{textTransform:"capitalize"},children:x})]})]})}function c2(n,l,s){return n==="light"?"dark":n==="dark"?"auto":s?"light":l==="light"?"dark":"light"}function u2({color:n}){return a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:n,display:"inline-block",flexShrink:0}})}function Qx(){return a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function d2({mode:n}){return n==="dark"?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):n==="light"?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("circle",{cx:"12",cy:"12",r:"4"}),a.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):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("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const jo=new Map,Er=new Map,Ts=new Map;function ln(n){jo.delete(n),Er.delete(n);const l=Ts.get(n);if(l)for(const s of l)s()}function Nl(n,l,s={}){const{ttl:o=3e4,enabled:c=!0}=s,[,f]=g.useState(0),d=g.useRef(!0),x=g.useRef(n);x.current=n;const h=()=>ln(n);g.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]),g.useEffect(()=>{if(!c)return;const b=()=>{d.current&&f(j=>j+1)};return Ts.has(n)||Ts.set(n,new Set),Ts.get(n).add(b),()=>{var j;(j=Ts.get(n))==null||j.delete(b)}},[n,c]),g.useEffect(()=>{if(!c)return;const b=jo.get(n);if(!(!b||Date.now()-b.fetchedAt>o))return;if(Er.has(n)){const C=Er.get(n),w=()=>{d.current&&x.current===n&&f(A=>A+1)};C.subscribers.push(w);return}const k={promise:Promise.resolve(),subscribers:[]},N=l().then(C=>{jo.set(n,{data:C,fetchedAt:Date.now()}),Er.delete(n),d.current&&x.current===n&&f(w=>w+1);for(const w of k.subscribers)w()},C=>{Er.delete(n),d.current&&x.current===n&&f(w=>w+1);for(const w of k.subscribers)w();throw C});k.promise=N,Er.set(n,k)},[n,l,o,c]);const p=jo.get(n),y=c&&!p&&Er.has(n);return{data:p==null?void 0:p.data,loading:y||c&&!p,error:void 0,revalidate:h}}const Io=0,ar=1,Tl=2,Sv=4;function Zx(n){return()=>n}function f2(n){n()}function jv(n,l){return s=>n(l(s))}function Jx(n,l){return()=>n(l)}function p2(n,l){return s=>n(l,s)}function sf(n){return n!==void 0}function m2(...n){return()=>{n.map(f2)}}function Rl(){}function Ho(n,l){return l(n),n}function h2(n,l){return l(n)}function gt(...n){return n}function rt(n,l){return n(ar,l)}function Fe(n,l){n(Io,l)}function of(n){n(Tl)}function St(n){return n(Sv)}function Ee(n,l){return rt(n,p2(l,Io))}function Wn(n,l){const s=n(ar,o=>{s(),l(o)});return s}function eg(n){let l,s;return o=>c=>{l=c,s&&clearTimeout(s),s=setTimeout(()=>{o(l)},n)}}function kv(n,l){return n===l}function xt(n=kv){let l;return s=>o=>{n(l,o)||(l=o,s(o))}}function ze(n){return l=>s=>{n(s)&&l(s)}}function be(n){return l=>jv(l,n)}function Jn(n){return l=>()=>{l(n)}}function oe(n,...l){const s=x2(...l);return((o,c)=>{switch(o){case Tl:of(n);return;case ar:return rt(n,s(c))}})}function ea(n,l){return s=>o=>{s(l=n(l,o))}}function Tr(n){return l=>s=>{n>0?n--:l(s)}}function ka(n){let l=null,s;return o=>c=>{l=c,!s&&(s=setTimeout(()=>{s=void 0,o(l)},n))}}function We(...n){const l=new Array(n.length);let s=0,o=null;const c=2**n.length-1;return n.forEach((f,d)=>{const x=2**d;rt(f,h=>{const p=s;s|=x,l[d]=h,p!==c&&s===c&&o&&(o(),o=null)})}),f=>d=>{const x=()=>{f([d].concat(l))};s===c?x():o=x}}function x2(...n){return l=>n.reduceRight(h2,l)}function g2(n){let l,s;const o=()=>l==null?void 0:l();return function(c,f){switch(c){case ar:return f?s===f?void 0:(o(),s=f,l=rt(n,f),l):(o(),Rl);case Tl:o(),s=null;return}}}function me(n){let l=n;const s=Je();return((o,c)=>{switch(o){case Io:l=c;break;case ar:{c(l);break}case Sv:return l}return s(o,c)})}function en(n,l){return Ho(me(l),s=>Ee(n,s))}function Je(){const n=[];return((l,s)=>{switch(l){case Io:n.slice().forEach(o=>{o(s)});return;case Tl:n.splice(0,n.length);return;case ar:return n.push(s),()=>{const o=n.indexOf(s);o>-1&&n.splice(o,1)}}})}function wn(n){return Ho(Je(),l=>Ee(n,l))}function nt(n,l=[],{singleton:s}={singleton:!0}){return{constructor:n,dependencies:l,id:v2(),singleton:s}}const v2=()=>Symbol();function y2(n){const l=new Map,s=({constructor:o,dependencies:c,id:f,singleton:d})=>{if(d&&l.has(f))return l.get(f);const x=o(c.map(h=>s(h)));return d&&l.set(f,x),x};return s(n)}function Ot(...n){const l=Je(),s=new Array(n.length);let o=0;const c=2**n.length-1;return n.forEach((f,d)=>{const x=2**d;rt(f,h=>{s[d]=h,o|=x,o===c&&Fe(l,s)})}),function(f,d){switch(f){case Tl:{of(l);return}case ar:return o===c&&d(s),rt(l,d)}}}function Le(n,l=kv){return oe(n,xt(l))}function Ud(...n){return function(l,s){switch(l){case Tl:return;case ar:return m2(...n.map(o=>rt(o,s)))}}}const Ut={DEBUG:0,INFO:1,WARN:2,ERROR:3},b2={[Ut.DEBUG]:"debug",[Ut.ERROR]:"error",[Ut.INFO]:"log",[Ut.WARN]:"warn"},S2=()=>typeof globalThis>"u"?window:globalThis,rr=nt(()=>{const n=me(Ut.ERROR);return{log:me((l,s,o=Ut.INFO)=>{const c=S2().VIRTUOSO_LOG_LEVEL??St(n);o>=c&&console[b2[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",l,s)}),logLevel:n}},[],{singleton:!0});function Ar(n,l,s){return cf(n,l,s).callbackRef}function cf(n,l,s){const o=Ce.useRef(null);let c=d=>{};const f=Ce.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(d=>{const x=()=>{const h=d[0].target;h.offsetParent!==null&&n(h)};s?x():requestAnimationFrame(x)}):null,[n,s]);return c=d=>{d&&l?(f==null||f.observe(d),o.current=d):(o.current&&(f==null||f.unobserve(o.current)),o.current=null)},{callbackRef:c,ref:o}}function j2(n,l,s,o,c,f,d,x,h){const p=Ce.useCallback(y=>{const v=k2(y.children,l,x?"offsetWidth":"offsetHeight",c);let b=y.parentElement;for(;b.dataset.virtuosoScroller===void 0;)b=b.parentElement;const j=b.lastElementChild.dataset.viewportType==="window";let k;j&&(k=b.ownerDocument.defaultView);const N=d?x?d.scrollLeft:d.scrollTop:j?x?k.scrollX||k.document.documentElement.scrollLeft:k.scrollY||k.document.documentElement.scrollTop:x?b.scrollLeft:b.scrollTop,C=d?x?d.scrollWidth:d.scrollHeight:j?x?k.document.documentElement.scrollWidth:k.document.documentElement.scrollHeight:x?b.scrollWidth:b.scrollHeight,w=d?x?d.offsetWidth:d.offsetHeight:j?x?k.innerWidth:k.innerHeight:x?b.offsetWidth:b.offsetHeight;o({scrollHeight:C,scrollTop:Math.max(N,0),viewportHeight:w}),f==null||f(x?tg("column-gap",getComputedStyle(y).columnGap,c):tg("row-gap",getComputedStyle(y).rowGap,c)),v!==null&&n(v)},[n,l,c,f,d,o,x]);return cf(p,s,h)}function k2(n,l,s,o){const c=n.length;if(c===0)return null;const f=[];for(let d=0;d<c;d++){const x=n.item(d);if(x.dataset.index===void 0)continue;const h=parseInt(x.dataset.index),p=parseFloat(x.dataset.knownSize),y=l(x,s);if(y===0&&o("Zero-sized element, this should not happen",{child:x},Ut.ERROR),y===p)continue;const v=f[f.length-1];f.length===0||v.size!==y||v.endIndex!==h-1?f.push({endIndex:h,size:y,startIndex:h}):f[f.length-1].endIndex++}return f}function tg(n,l,s){return l!=="normal"&&(l==null?void 0:l.endsWith("px"))!==!0&&s(`${n} was not resolved to pixel value correctly`,l,Ut.WARN),l==="normal"?0:parseInt(l??"0",10)}function wv(n,l,s){const o=Ce.useRef(null),c=Ce.useCallback(h=>{if(!(h!=null&&h.offsetParent))return;const p=h.getBoundingClientRect(),y=p.width;let v,b;if(l){const j=l.getBoundingClientRect(),k=p.top-j.top;b=j.height-Math.max(0,k),v=k+l.scrollTop}else{const j=d.current.ownerDocument.defaultView;b=j.innerHeight-Math.max(0,p.top),v=p.top+j.scrollY}o.current={listHeight:p.height,offsetTop:v,visibleHeight:b,visibleWidth:y},n(o.current)},[n,l]),{callbackRef:f,ref:d}=cf(c,!0,s),x=Ce.useCallback(()=>{c(d.current)},[c,d]);return Ce.useEffect(()=>{var p;if(l){l.addEventListener("scroll",x);const y=new ResizeObserver(()=>{requestAnimationFrame(x)});return y.observe(l),()=>{l.removeEventListener("scroll",x),y.unobserve(l)}}const h=(p=d.current)==null?void 0:p.ownerDocument.defaultView;return h==null||h.addEventListener("scroll",x),h==null||h.addEventListener("resize",x),()=>{h==null||h.removeEventListener("scroll",x),h==null||h.removeEventListener("resize",x)}},[x,l,d]),f}const sn=nt(()=>{const n=Je(),l=Je(),s=me(0),o=Je(),c=me(0),f=Je(),d=Je(),x=me(0),h=me(0),p=me(0),y=me(0),v=Je(),b=Je(),j=me(!1),k=me(!1),N=me(!1);return Ee(oe(n,be(({scrollTop:C})=>C)),l),Ee(oe(n,be(({scrollHeight:C})=>C)),d),Ee(l,c),{deviation:s,fixedFooterHeight:p,fixedHeaderHeight:h,footerHeight:y,headerHeight:x,horizontalDirection:k,scrollBy:b,scrollContainerState:n,scrollHeight:d,scrollingInProgress:j,scrollTo:v,scrollTop:l,skipAnimationFrameInResizeObserver:N,smoothScrollTargetReached:o,statefulScrollTop:c,viewportHeight:f}},[],{singleton:!0}),Os={lvl:0};function Cv(n,l){const s=n.length;if(s===0)return[];let{index:o,value:c}=l(n[0]);const f=[];for(let d=1;d<s;d++){const{index:x,value:h}=l(n[d]);f.push({end:x-1,start:o,value:c}),o=x,c=h}return f.push({end:1/0,start:o,value:c}),f}function ft(n){return n===Os}function Bs(n,l){if(!ft(n))return l===n.k?n.v:l<n.k?Bs(n.l,l):Bs(n.r,l)}function Yn(n,l,s="k"){if(ft(n))return[-1/0,void 0];if(Number(n[s])===l)return[n.k,n.v];if(Number(n[s])<l){const o=Yn(n.r,l,s);return o[0]===-1/0?[n.k,n.v]:o}return Yn(n.l,l,s)}function jn(n,l,s){return ft(n)?Tv(l,s,1):l===n.k?Ht(n,{k:l,v:s}):l<n.k?ng(Ht(n,{l:jn(n.l,l,s)})):ng(Ht(n,{r:jn(n.r,l,s)}))}function yl(){return Os}function bl(n,l,s){if(ft(n))return[];const o=Yn(n,l)[0];return w2(Vd(n,o,s))}function $d(n,l){if(ft(n))return Os;const{k:s,l:o,r:c}=n;if(l===s){if(ft(o))return c;if(ft(c))return o;const[f,d]=Nv(o);return ko(Ht(n,{k:f,l:Ev(o),v:d}))}return l<s?ko(Ht(n,{l:$d(o,l)})):ko(Ht(n,{r:$d(c,l)}))}function Nr(n){return ft(n)?[]:[...Nr(n.l),{k:n.k,v:n.v},...Nr(n.r)]}function Vd(n,l,s){if(ft(n))return[];const{k:o,l:c,r:f,v:d}=n;let x=[];return o>l&&(x=x.concat(Vd(c,l,s))),o>=l&&o<=s&&x.push({k:o,v:d}),o<=s&&(x=x.concat(Vd(f,l,s))),x}function ko(n){const{l,lvl:s,r:o}=n;if(o.lvl>=s-1&&l.lvl>=s-1)return n;if(s>o.lvl+1){if(hd(l))return Rv(Ht(n,{lvl:s-1}));if(!ft(l)&&!ft(l.r))return Ht(l.r,{l:Ht(l,{r:l.r.l}),lvl:s,r:Ht(n,{l:l.r.r,lvl:s-1})});throw new Error("Unexpected empty nodes")}if(hd(n))return Pd(Ht(n,{lvl:s-1}));if(!ft(o)&&!ft(o.l)){const c=o.l,f=hd(c)?o.lvl-1:o.lvl;return Ht(c,{l:Ht(n,{lvl:s-1,r:c.l}),lvl:c.lvl+1,r:Pd(Ht(o,{l:c.r,lvl:f}))})}throw new Error("Unexpected empty nodes")}function Ht(n,l){return Tv(l.k!==void 0?l.k:n.k,l.v!==void 0?l.v:n.v,l.lvl!==void 0?l.lvl:n.lvl,l.l!==void 0?l.l:n.l,l.r!==void 0?l.r:n.r)}function Ev(n){return ft(n.r)?n.l:ko(Ht(n,{r:Ev(n.r)}))}function hd(n){return ft(n)||n.lvl>n.r.lvl}function Nv(n){return ft(n.r)?[n.k,n.v]:Nv(n.r)}function Tv(n,l,s,o=Os,c=Os){return{k:n,l:o,lvl:s,r:c,v:l}}function ng(n){return Pd(Rv(n))}function Rv(n){const{l}=n;return!ft(l)&&l.lvl===n.lvl?Ht(l,{r:Ht(n,{l:l.r})}):n}function Pd(n){const{lvl:l,r:s}=n;return!ft(s)&&!ft(s.r)&&s.lvl===l&&s.r.lvl===l?Ht(s,{l:Ht(n,{r:s.l}),lvl:l+1}):n}function w2(n){return Cv(n,({k:l,v:s})=>({index:l,value:s}))}function Av(n,l){return!!(n&&n.startIndex===l.startIndex&&n.endIndex===l.endIndex)}function Is(n,l){return!!(n&&n[0]===l[0]&&n[1]===l[1])}const uf=nt(()=>({recalcInProgress:me(!1)}),[],{singleton:!0});function Mv(n,l,s){return n[To(n,l,s)]}function To(n,l,s,o=0){let c=n.length-1;for(;o<=c;){const f=Math.floor((o+c)/2),d=n[f],x=s(d,l);if(x===0)return f;if(x===-1){if(c-o<2)return f-1;c=f-1}else{if(c===o)return f;o=f+1}}throw new Error(`Failed binary finding record in array - ${n.join(",")}, searched for ${l}`)}function C2(n,l,s,o){const c=To(n,l,o),f=To(n,s,o,c);return n.slice(c,f+1)}function tr(n,l){return Math.round(n.getBoundingClientRect()[l])}function Uo(n){return!ft(n.groupOffsetTree)}function df({index:n},l){return l===n?0:l<n?-1:1}function E2(){return{groupIndices:[],groupOffsetTree:yl(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:yl()}}function N2(n,l){let s=ft(n)?0:1/0;for(const o of l){const{endIndex:c,size:f,startIndex:d}=o;if(s=Math.min(s,d),ft(n)){n=jn(n,0,f);continue}const x=bl(n,d-1,c+1);if(x.some(D2(o)))continue;let h=!1,p=!1;for(const{end:y,start:v,value:b}of x)h?(c>=v||f===b)&&(n=$d(n,v)):(p=b!==f,h=!0),y>c&&c>=v&&b!==f&&(n=jn(n,c+1,b));p&&(n=jn(n,d,f))}return[n,s]}function T2(n){return typeof n.groupIndex<"u"}function R2({offset:n},l){return l===n?0:l<n?-1:1}function Hs(n,l,s){if(l.length===0)return 0;const{index:o,offset:c,size:f}=Mv(l,n,df),d=n-o,x=f*d+(d-1)*s+c;return x>0?x+s:x}function Lv(n,l){if(!Uo(l))return n;let s=0;for(;l.groupIndices[s]<=n+s;)s++;return n+s}function zv(n,l,s){if(T2(n))return l.groupIndices[n.groupIndex]+1;const o=n.index==="LAST"?s:n.index;let c=Lv(o,l);return c=Math.max(0,c,Math.min(s,c)),c}function A2(n,l,s,o=0){return o>0&&(l=Math.max(l,Mv(n,o,df).offset)),Cv(C2(n,l,s,R2),z2)}function M2(n,[l,s,o,c]){l.length>0&&o("received item sizes",l,Ut.DEBUG);const f=n.sizeTree;let d=f,x=0;if(s.length>0&&ft(f)&&l.length===2){const b=l[0].size,j=l[1].size;d=s.reduce((k,N)=>jn(jn(k,N,b),N+1,j),d)}else[d,x]=N2(d,l);if(d===f)return n;const{lastIndex:h,lastOffset:p,lastSize:y,offsetTree:v}=Fd(n.offsetTree,x,d,c);return{groupIndices:s,groupOffsetTree:s.reduce((b,j)=>jn(b,j,Hs(j,v,c)),yl()),lastIndex:h,lastOffset:p,lastSize:y,offsetTree:v,sizeTree:d}}function L2(n){return Nr(n).map(({k:l,v:s},o,c)=>{const f=c[o+1];return{endIndex:f!==void 0?f.k-1:1/0,size:s,startIndex:l}})}function ag(n,l){let s=0,o=0;for(;s<n;)s+=l[o+1]-l[o]-1,o++;return o-(s===n?0:1)}function Fd(n,l,s,o){let c=n,f=0,d=0,x=0,h=0;if(l!==0){h=To(c,l-1,df),x=c[h].offset;const p=Yn(s,l-1);f=p[0],d=p[1],c.length&&c[h].size===Yn(s,l)[1]&&(h-=1),c=c.slice(0,h+1)}else c=[];for(const{start:p,value:y}of bl(s,l,1/0)){const v=p-f,b=v*d+x+v*o;c.push({index:p,offset:b,size:y}),f=p,x=b,d=y}return{lastIndex:f,lastOffset:x,lastSize:d,offsetTree:c}}function z2(n){return{index:n.index,value:n}}function D2(n){const{endIndex:l,size:s,startIndex:o}=n;return c=>c.start===o&&(c.end===l||c.end===1/0)&&c.value===s}const _2={offsetHeight:"height",offsetWidth:"width"},na=nt(([{log:n},{recalcInProgress:l}])=>{const s=Je(),o=Je(),c=en(o,0),f=Je(),d=Je(),x=me(0),h=me([]),p=me(void 0),y=me(void 0),v=me(void 0),b=me(void 0),j=me((E,D)=>tr(E,_2[D])),k=me(void 0),N=me(0),C=E2(),w=en(oe(s,We(h,n,N),ea(M2,C),xt()),C),A=en(oe(h,xt(),ea((E,D)=>({current:D,prev:E.current}),{current:[],prev:[]}),be(({prev:E})=>E)),[]);Ee(oe(h,ze(E=>E.length>0),We(w,N),be(([E,D,R])=>{const B=E.reduce((V,W,te)=>jn(V,W,Hs(W,D.offsetTree,R)||te),yl());return{...D,groupIndices:E,groupOffsetTree:B}})),w),Ee(oe(o,We(w),ze(([E,{lastIndex:D}])=>E<D),be(([E,{lastIndex:D,lastSize:R}])=>[{endIndex:D,size:R,startIndex:E}])),s),Ee(p,y);const _=en(oe(p,be(E=>E===void 0)),!0);Ee(oe(y,ze(E=>E!==void 0&&ft(St(w).sizeTree)),be(E=>{const D=St(v),R=St(h).length>0;return D!==void 0&&D!==0?R?[{endIndex:0,size:D,startIndex:0},{endIndex:1,size:E,startIndex:1}]:[]:[{endIndex:0,size:E,startIndex:0}]})),s),Ee(oe(b,ze(E=>E!==void 0&&E.length>0&&ft(St(w).sizeTree)),be(E=>{const D=[];let R=E[0],B=0;for(let V=1;V<E.length;V++){const W=E[V];W!==R&&(D.push({endIndex:V-1,size:R,startIndex:B}),R=W,B=V)}return D.push({endIndex:E.length-1,size:R,startIndex:B}),D})),s),Ee(oe(h,We(v,y),ze(([,E,D])=>E!==void 0&&D!==void 0),be(([E,D,R])=>{const B=[];for(let V=0;V<E.length;V++){const W=E[V],te=E[V+1];B.push({startIndex:W,endIndex:W,size:D}),te!==void 0&&B.push({startIndex:W+1,endIndex:te-1,size:R})}return B})),s);const H=wn(oe(s,We(w),ea(({sizes:E},[D,R])=>({changed:R!==E,sizes:R}),{changed:!1,sizes:C}),be(E=>E.changed)));rt(oe(x,ea((E,D)=>({diff:E.prev-D,prev:D}),{diff:0,prev:0}),be(E=>E.diff)),E=>{const{groupIndices:D}=St(w);if(E>0)Fe(l,!0),Fe(f,E+ag(E,D));else if(E<0){const R=St(A);R.length>0&&(E-=ag(-E,R)),Fe(d,E)}}),rt(oe(x,We(n)),([E,D])=>{E<0&&D("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:x},Ut.ERROR)});const L=wn(f);Ee(oe(f,We(w),be(([E,D])=>{const R=D.groupIndices.length>0,B=[],V=D.lastSize;if(R){const W=Bs(D.sizeTree,0);let te=0,Q=0;for(;te<E;){const M=D.groupIndices[Q],I=D.groupIndices.length===Q+1?1/0:D.groupIndices[Q+1]-M-1;B.push({endIndex:M,size:W,startIndex:M}),B.push({endIndex:M+1+I-1,size:V,startIndex:M+1}),Q++,te+=I+1}const z=Nr(D.sizeTree);return te!==E&&z.shift(),z.reduce((M,{k:I,v:X})=>{let G=M.ranges;return M.prevSize!==0&&(G=[...M.ranges,{endIndex:I+E-1,size:M.prevSize,startIndex:M.prevIndex}]),{prevIndex:I+E,prevSize:X,ranges:G}},{prevIndex:E,prevSize:0,ranges:B}).ranges}return Nr(D.sizeTree).reduce((W,{k:te,v:Q})=>({prevIndex:te+E,prevSize:Q,ranges:[...W.ranges,{endIndex:te+E-1,size:W.prevSize,startIndex:W.prevIndex}]}),{prevIndex:0,prevSize:V,ranges:[]}).ranges})),s);const $=wn(oe(d,We(w,N),be(([E,{offsetTree:D},R])=>{const B=-E;return Hs(B,D,R)})));return Ee(oe(d,We(w,N),be(([E,D,R])=>{if(D.groupIndices.length>0){if(ft(D.sizeTree))return D;let V=yl();const W=St(A);let te=0,Q=0,z=0;for(;te<-E;){z=W[Q];const M=W[Q+1]-z-1;Q++,te+=M+1}if(V=Nr(D.sizeTree).reduce((M,{k:I,v:X})=>jn(M,Math.max(0,I+E),X),V),te!==-E){const M=Bs(D.sizeTree,z);V=jn(V,0,M);const I=Yn(D.sizeTree,-E+1)[1];V=jn(V,1,I)}return{...D,sizeTree:V,...Fd(D.offsetTree,0,V,R)}}const B=Nr(D.sizeTree).reduce((V,{k:W,v:te})=>jn(V,Math.max(0,W+E),te),yl());return{...D,sizeTree:B,...Fd(D.offsetTree,0,B,R)}})),w),{beforeUnshiftWith:L,data:k,defaultItemSize:y,firstItemIndex:x,fixedItemSize:p,fixedGroupSize:v,gap:N,groupIndices:h,heightEstimates:b,itemSize:j,listRefresh:H,shiftWith:d,shiftWithOffset:$,sizeRanges:s,sizes:w,statefulTotalCount:c,totalCount:o,trackItemSizes:_,unshiftWith:f}},gt(rr,uf),{singleton:!0});function O2(n){return n.reduce((l,s)=>(l.groupIndices.push(l.totalCount),l.totalCount+=s+1,l),{groupIndices:[],totalCount:0})}const Dv=nt(([{groupIndices:n,sizes:l,totalCount:s},{headerHeight:o,scrollTop:c}])=>{const f=Je(),d=Je(),x=wn(oe(f,be(O2)));return Ee(oe(x,be(h=>h.totalCount)),s),Ee(oe(x,be(h=>h.groupIndices)),n),Ee(oe(Ot(c,l,o),ze(([h,p])=>Uo(p)),be(([h,p,y])=>Yn(p.groupOffsetTree,Math.max(h-y,0),"v")[0]),xt(),be(h=>[h])),d),{groupCounts:f,topItemsIndexes:d}},gt(na,sn)),lr=nt(([{log:n}])=>{const l=me(!1),s=wn(oe(l,ze(o=>o),xt()));return rt(l,o=>{o&&St(n)("props updated",{},Ut.DEBUG)}),{didMount:s,propsReady:l}},gt(rr),{singleton:!0}),B2=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function _v(n){const l=typeof n=="number"?{index:n}:n;return l.align||(l.align="start"),(!l.behavior||!B2)&&(l.behavior="auto"),l.offset===void 0&&(l.offset=0),l}const Gs=nt(([{gap:n,listRefresh:l,sizes:s,totalCount:o},{fixedFooterHeight:c,fixedHeaderHeight:f,footerHeight:d,headerHeight:x,scrollingInProgress:h,scrollTo:p,smoothScrollTargetReached:y,viewportHeight:v},{log:b}])=>{const j=Je(),k=Je(),N=me(0);let C=null,w=null,A=null;function _(){C!==null&&(C(),C=null),A!==null&&(A(),A=null),w&&(clearTimeout(w),w=null),Fe(h,!1)}return Ee(oe(j,We(s,v,o,N,x,d,b),We(n,f,c),be(([[H,L,$,E,D,R,B,V],W,te,Q])=>{const z=_v(H),{align:M,behavior:I,offset:X}=z,G=E-1,ce=zv(z,L,G);let O=Hs(ce,L.offsetTree,W)+R;M==="end"?(O+=te+Yn(L.sizeTree,ce)[1]-$+Q,ce===G&&(O+=B)):M==="center"?O+=(te+Yn(L.sizeTree,ce)[1]-$+Q)/2:O-=D,X!==void 0&&X!==0&&(O+=X);const Y=se=>{_(),se?(V("retrying to scroll to",{location:H},Ut.DEBUG),Fe(j,H)):(Fe(k,!0),V("list did not change, scroll successful",{},Ut.DEBUG))};if(_(),I==="smooth"){let se=!1;A=rt(l,de=>{se=se||de}),C=Wn(y,()=>{Y(se)})}else C=Wn(oe(l,I2(150)),Y);return w=setTimeout(()=>{_()},1200),Fe(h,!0),V("scrolling from index to",{behavior:I,index:ce,top:O},Ut.DEBUG),{behavior:I,top:O}})),p),{scrollTargetReached:k,scrollToIndex:j,topListHeight:N}},gt(na,sn,rr),{singleton:!0});function I2(n){return l=>{const s=setTimeout(()=>{l(!1)},n);return o=>{o&&(l(!0),clearTimeout(s))}}}function ff(n,l){n===0?l():requestAnimationFrame(()=>{ff(n-1,l)})}function pf(n,l){const s=l-1;return typeof n=="number"?n:n.index==="LAST"?s:n.index}const Ws=nt(([{defaultItemSize:n,listRefresh:l,sizes:s},{scrollTop:o},{scrollTargetReached:c,scrollToIndex:f},{didMount:d}])=>{const x=me(!0),h=me(0),p=me(!0);return Ee(oe(d,We(h),ze(([y,v])=>v!==0),Jn(!1)),x),Ee(oe(d,We(h),ze(([y,v])=>v!==0),Jn(!1)),p),rt(oe(Ot(l,d),We(x,s,n,p),ze(([[,y],v,{sizeTree:b},j,k])=>y&&(!ft(b)||sf(j))&&!v&&!k),We(h)),([,y])=>{Wn(c,()=>{Fe(p,!0)}),ff(4,()=>{Wn(o,()=>{Fe(x,!0)}),Fe(f,y)})}),{initialItemFinalLocationReached:p,initialTopMostItemIndex:h,scrolledToInitialItem:x}},gt(na,sn,Gs,lr),{singleton:!0});function Ov(n,l){return Math.abs(n-l)<1.01}const Us="up",Ls="down",H2="none",U2={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},$2=0,qs=nt(([{footerHeight:n,headerHeight:l,scrollBy:s,scrollContainerState:o,scrollTop:c,viewportHeight:f}])=>{const d=me(!1),x=me(!0),h=Je(),p=Je(),y=me(4),v=me($2),b=en(oe(Ud(oe(Le(c),Tr(1),Jn(!0)),oe(Le(c),Tr(1),Jn(!1),eg(100))),xt()),!1),j=en(oe(Ud(oe(s,Jn(!0)),oe(s,Jn(!1),eg(200))),xt()),!1);Ee(oe(Ot(Le(c),Le(v)),be(([A,_])=>A<=_),xt()),x),Ee(oe(x,ka(50)),p);const k=wn(oe(Ot(o,Le(f),Le(l),Le(n),Le(y)),ea((A,[{scrollHeight:_,scrollTop:H},L,$,E,D])=>{const R=H+L-_>-D,B={scrollHeight:_,scrollTop:H,viewportHeight:L};if(R){let W,te;return H>A.state.scrollTop?(W="SCROLLED_DOWN",te=A.state.scrollTop-H):(W="SIZE_DECREASED",te=A.state.scrollTop-H||A.scrollTopDelta),{atBottom:!0,atBottomBecause:W,scrollTopDelta:te,state:B}}let V;return B.scrollHeight>A.state.scrollHeight?V="SIZE_INCREASED":L<A.state.viewportHeight?V="VIEWPORT_HEIGHT_DECREASING":H<A.state.scrollTop?V="SCROLLING_UPWARDS":V="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:V,state:B}},U2),xt((A,_)=>A!==void 0&&A.atBottom===_.atBottom))),N=en(oe(o,ea((A,{scrollHeight:_,scrollTop:H,viewportHeight:L})=>{if(!Ov(A.scrollHeight,_)){const $=_-(H+L)<1;return A.scrollTop!==H&&$?{changed:!0,jump:A.scrollTop-H,scrollHeight:_,scrollTop:H}:{changed:!0,jump:0,scrollHeight:_,scrollTop:H}}return{changed:!1,jump:0,scrollHeight:_,scrollTop:H}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ze(A=>A.changed),be(A=>A.jump)),0);Ee(oe(k,be(A=>A.atBottom)),d),Ee(oe(d,ka(50)),h);const C=me(Ls);Ee(oe(o,be(({scrollTop:A})=>A),xt(),ea((A,_)=>St(j)?{direction:A.direction,prevScrollTop:_}:{direction:_<A.prevScrollTop?Us:Ls,prevScrollTop:_},{direction:Ls,prevScrollTop:0}),be(A=>A.direction)),C),Ee(oe(o,ka(50),Jn(H2)),C);const w=me(0);return Ee(oe(b,ze(A=>!A),Jn(0)),w),Ee(oe(c,ka(100),We(b),ze(([A,_])=>_),ea(([A,_],[H])=>[_,H],[0,0]),be(([A,_])=>_-A)),w),{atBottomState:k,atBottomStateChange:h,atBottomThreshold:y,atTopStateChange:p,atTopThreshold:v,isAtBottom:d,isAtTop:x,isScrolling:b,lastJumpDueToItemResize:N,scrollDirection:C,scrollVelocity:w}},gt(sn)),$s="top",Vs="bottom",rg="none";function lg(n,l,s){return typeof n=="number"?s===Us&&l===$s||s===Ls&&l===Vs?n:0:s===Us?l===$s?n.main:n.reverse:l===Vs?n.main:n.reverse}function sg(n,l){return typeof n=="number"?n:n[l]??0}const mf=nt(([{deviation:n,fixedHeaderHeight:l,headerHeight:s,scrollTop:o,viewportHeight:c}])=>{const f=Je(),d=me(0),x=me(0),h=me(0),p=en(oe(Ot(Le(o),Le(c),Le(s),Le(f,Is),Le(h),Le(d),Le(l),Le(n),Le(x)),be(([y,v,b,[j,k],N,C,w,A,_])=>{const H=y-A,L=C+w,$=Math.max(b-H,0);let E=rg;const D=sg(_,$s),R=sg(_,Vs);return j-=A,j+=b+w,k+=b+w,k-=A,j>y+L-D&&(E=Us),k<y-$+v+R&&(E=Ls),E!==rg?[Math.max(H-b-lg(N,$s,E)-D,0),H-$-w+v+lg(N,Vs,E)+R]:null}),ze(y=>y!==null),xt(Is)),[0,0]);return{increaseViewportBy:x,listBoundary:f,overscan:h,topListHeight:d,visibleRange:p}},gt(sn),{singleton:!0});function V2(n,l,s){if(Uo(l)){const o=Lv(n,l);return[{index:Yn(l.groupOffsetTree,o)[0],offset:0,size:0},{data:s==null?void 0:s[0],index:o,offset:0,size:0}]}return[{data:s==null?void 0:s[0],index:n,offset:0,size:0}]}const xd={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function wo(n,l,s,o,c,f){const{lastIndex:d,lastOffset:x,lastSize:h}=c;let p=0,y=0;if(n.length>0){p=n[0].offset;const N=n[n.length-1];y=N.offset+N.size}const v=s-d,b=x+v*h+(v-1)*o,j=p,k=b-y;return{bottom:y,firstItemIndex:f,items:ig(n,c,f),offsetBottom:k,offsetTop:p,top:j,topItems:ig(l,c,f),topListHeight:l.reduce((N,C)=>C.size+N,0),totalCount:s}}function Bv(n,l,s,o,c,f){let d=0;if(s.groupIndices.length>0)for(const y of s.groupIndices){if(y-d>=n)break;d++}const x=n+d,h=pf(l,x),p=Array.from({length:x}).map((y,v)=>({data:f[v+h],index:v+h,offset:0,size:0}));return wo(p,[],x,c,s,o)}function ig(n,l,s){if(n.length===0)return[];if(!Uo(l))return n.map(p=>({...p,index:p.index+s,originalIndex:p.index}));const o=n[0].index,c=n[n.length-1].index,f=[],d=bl(l.groupOffsetTree,o,c);let x,h=0;for(const p of n){(!x||x.end<p.index)&&(x=d.shift(),h=l.groupIndices.indexOf(x.start));let y;p.index===x.start?y={index:h,type:"group"}:y={groupIndex:h,index:p.index-(h+1)+s},f.push({...y,data:p.data,offset:p.offset,originalIndex:p.index,size:p.size})}return f}function og(n,l){return n===void 0?0:typeof n=="number"?n:n[l]??0}const Mr=nt(([{data:n,firstItemIndex:l,gap:s,sizes:o,totalCount:c},f,{listBoundary:d,topListHeight:x,visibleRange:h},{initialTopMostItemIndex:p,scrolledToInitialItem:y},{topListHeight:v},b,{didMount:j},{recalcInProgress:k}])=>{const N=me([]),C=me(0),w=Je(),A=me(0);Ee(f.topItemsIndexes,N);const _=en(oe(Ot(j,k,Le(h,Is),Le(c),Le(o),Le(p),y,Le(N),Le(l),Le(s),Le(A),n),ze(([E,D,,R,,,,,,,,B])=>{const V=B!==void 0&&B.length!==R;return E&&!D&&!V}),be(([,,[E,D],R,B,V,W,te,Q,z,M,I])=>{var je,Oe;const X=B,{offsetTree:G,sizeTree:ce}=X,O=St(C);if(R===0)return{...xd,totalCount:R};if(E===0&&D===0)return O===0?{...xd,totalCount:R}:Bv(O,V,B,Q,z,I||[]);if(ft(ce))return O>0?null:wo(V2(pf(V,R),X,I),[],R,z,X,Q);const Y=[];if(te.length>0){const $e=te[0],ae=te[te.length-1];let pe=0;for(const fe of bl(ce,$e,ae)){const he=fe.value,ye=Math.max(fe.start,$e),Be=Math.min(fe.end,ae);for(let Me=ye;Me<=Be;Me++)Y.push({data:I==null?void 0:I[Me],index:Me,offset:pe,size:he}),pe+=he}}if(!W)return wo([],Y,R,z,X,Q);const se=te.length>0?te[te.length-1]+1:0,de=A2(G,E,D,se);if(de.length===0)return null;const ge=R-1,xe=Ho([],$e=>{for(const ae of de){const pe=ae.value;let fe=pe.offset,he=ae.start;const ye=pe.size;if(pe.offset<E){he+=Math.floor((E-pe.offset+z)/(ye+z));const Me=he-ae.start;fe+=Me*ye+Me*z}he<se&&(fe+=(se-he)*ye,he=se);const Be=Math.min(ae.end,ge);for(let Me=he;Me<=Be&&!(fe>=D);Me++)$e.push({data:I==null?void 0:I[Me],index:Me,offset:fe,size:ye}),fe+=ye+z}}),we=og(M,$s),ie=og(M,Vs);if(xe.length>0&&(we>0||ie>0)){const $e=xe[0],ae=xe[xe.length-1];if(we>0&&$e.index>se){const pe=Math.min(we,$e.index-se),fe=[];let he=$e.offset;for(let ye=$e.index-1;ye>=$e.index-pe;ye--){const Be=((je=bl(ce,ye,ye)[0])==null?void 0:je.value)??$e.size;he-=Be+z,fe.unshift({data:I==null?void 0:I[ye],index:ye,offset:he,size:Be})}xe.unshift(...fe)}if(ie>0&&ae.index<ge){const pe=Math.min(ie,ge-ae.index);let fe=ae.offset+ae.size+z;for(let he=ae.index+1;he<=ae.index+pe;he++){const ye=((Oe=bl(ce,he,he)[0])==null?void 0:Oe.value)??ae.size;xe.push({data:I==null?void 0:I[he],index:he,offset:fe,size:ye}),fe+=ye+z}}}return wo(xe,Y,R,z,X,Q)}),ze(E=>E!==null),xt()),xd);Ee(oe(n,ze(sf),be(E=>E==null?void 0:E.length)),c),Ee(oe(_,be(E=>E.topListHeight)),v),Ee(v,x),Ee(oe(_,be(E=>[E.top,E.bottom])),d),Ee(oe(_,be(E=>E.items)),w);const H=wn(oe(_,ze(({items:E})=>E.length>0),We(c,n),ze(([{items:E},D])=>E[E.length-1].originalIndex===D-1),be(([,E,D])=>[E-1,D]),xt(Is),be(([E])=>E))),L=wn(oe(_,ka(200),ze(({items:E,topItems:D})=>E.length>0&&E[0].originalIndex===D.length),be(({items:E})=>E[0].index),xt())),$=wn(oe(_,ze(({items:E})=>E.length>0),be(({items:E})=>{let D=0,R=E.length-1;for(;E[D].type==="group"&&D<R;)D++;for(;E[R].type==="group"&&R>D;)R--;return{endIndex:E[R].index,startIndex:E[D].index}}),xt(Av)));return{endReached:H,initialItemCount:C,itemsRendered:w,listState:_,minOverscanItemCount:A,rangeChanged:$,startReached:L,topItemsIndexes:N,...b}},gt(na,Dv,mf,Ws,Gs,qs,lr,uf),{singleton:!0}),Iv=nt(([{fixedFooterHeight:n,fixedHeaderHeight:l,footerHeight:s,headerHeight:o},{listState:c}])=>{const f=Je(),d=en(oe(Ot(s,n,o,l,c),be(([x,h,p,y,v])=>x+h+p+y+v.offsetBottom+v.bottom)),0);return Ee(Le(d),f),{totalListHeight:d,totalListHeightChanged:f}},gt(sn,Mr),{singleton:!0}),P2=nt(([{viewportHeight:n},{totalListHeight:l}])=>{const s=me(!1),o=en(oe(Ot(s,n,l),ze(([c])=>c),be(([,c,f])=>Math.max(0,c-f)),ka(0),xt()),0);return{alignToBottom:s,paddingTopAddition:o}},gt(sn,Iv),{singleton:!0}),Hv=nt(()=>({context:me(null)})),F2=({itemBottom:n,itemTop:l,locationParams:{align:s,behavior:o,...c},viewportBottom:f,viewportTop:d})=>l<d?{...c,align:s??"start",...o!==void 0?{behavior:o}:{}}:n>f?{...c,align:s??"end",...o!==void 0?{behavior:o}:{}}:null,Uv=nt(([{gap:n,sizes:l,totalCount:s},{fixedFooterHeight:o,fixedHeaderHeight:c,headerHeight:f,scrollingInProgress:d,scrollTop:x,viewportHeight:h},{scrollToIndex:p}])=>{const y=Je();return Ee(oe(y,We(l,h,s,f,c,o,x),We(n),be(([[v,b,j,k,N,C,w,A],_])=>{const{calculateViewLocation:H=F2,done:L,...$}=v,E=zv(v,b,k-1),D=Hs(E,b.offsetTree,_)+N+C,R=D+Yn(b.sizeTree,E)[1],B=A+C,V=A+j-w,W=H({itemBottom:R,itemTop:D,locationParams:$,viewportBottom:V,viewportTop:B});return W!==null?L&&Wn(oe(d,ze(te=>!te),Tr(St(d)?1:2)),L):L==null||L(),W}),ze(v=>v!==null)),p),{scrollIntoView:y}},gt(na,sn,Gs,Mr,rr),{singleton:!0});function cg(n){return n===!1?!1:n==="smooth"?"smooth":"auto"}const G2=(n,l)=>typeof n=="function"?cg(n(l)):l&&cg(n),W2=nt(([{listRefresh:n,totalCount:l,fixedItemSize:s,data:o},{atBottomState:c,isAtBottom:f},{scrollToIndex:d},{scrolledToInitialItem:x},{didMount:h,propsReady:p},{log:y},{scrollingInProgress:v},{context:b},{scrollIntoView:j}])=>{const k=me(!1),N=Je();let C=null;function w(L){Fe(d,{align:"end",behavior:L,index:"LAST"})}rt(oe(Ot(oe(Le(l),Tr(1)),h),We(Le(k),f,x,v),be(([[L,$],E,D,R,B])=>{let V=$&&R,W="auto";return V&&(W=G2(E,D||B),V=V&&W!==!1),{followOutputBehavior:W,shouldFollow:V,totalCount:L}}),ze(({shouldFollow:L})=>L)),({followOutputBehavior:L,totalCount:$})=>{C!==null&&(C(),C=null),St(s)!==void 0?requestAnimationFrame(()=>{St(y)("following output to ",{totalCount:$},Ut.DEBUG),w(L)}):C=Wn(n,()=>{St(y)("following output to ",{totalCount:$},Ut.DEBUG),w(L),C=null})});function A(L){const $=Wn(c,E=>{L&&!E.atBottom&&E.notAtBottomBecause==="SIZE_INCREASED"&&C===null&&(St(y)("scrolling to bottom due to increased size",{},Ut.DEBUG),w("auto"))});setTimeout($,100)}rt(oe(Ot(Le(k),l,p),ze(([L,,$])=>L!==!1&&$),ea(({value:L},[,$])=>({refreshed:L===$,value:$}),{refreshed:!1,value:0}),ze(({refreshed:L})=>L),We(k,l)),([,L])=>{St(x)&&A(L!==!1)}),rt(N,()=>{A(St(k)!==!1)}),rt(Ot(Le(k),c),([L,$])=>{L!==!1&&!$.atBottom&&$.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&w("auto")});const _=me(null),H=Je();return Ee(Ud(oe(Le(o),be(L=>(L==null?void 0:L.length)??0)),oe(Le(l))),H),rt(oe(Ot(oe(H,Tr(1)),h),We(Le(_),x,v,b),be(([[L,$],E,D,R,B])=>$&&D&&(E==null?void 0:E({context:B,totalCount:L,scrollingInProgress:R}))),ze(L=>!!L),ka(0)),L=>{C!==null&&(C(),C=null),St(s)!==void 0?requestAnimationFrame(()=>{St(y)("scrolling into view",{}),Fe(j,L)}):C=Wn(n,()=>{St(y)("scrolling into view",{}),Fe(j,L),C=null})}),{autoscrollToBottom:N,followOutput:k,scrollIntoViewOnChange:_}},gt(na,qs,Gs,Ws,lr,rr,sn,Hv,Uv)),q2=nt(([{data:n,firstItemIndex:l,gap:s,sizes:o},{initialTopMostItemIndex:c},{initialItemCount:f,listState:d},{didMount:x}])=>(Ee(oe(x,We(f),ze(([,h])=>h!==0),We(c,o,l,s,n),be(([[,h],p,y,v,b,j=[]])=>Bv(h,p,y,v,b,j))),d),{}),gt(na,Ws,Mr,lr),{singleton:!0}),Y2=nt(([{didMount:n},{scrollTo:l},{listState:s}])=>{const o=me(0);return rt(oe(n,We(o),ze(([,c])=>c!==0),be(([,c])=>({top:c}))),c=>{Wn(oe(s,Tr(1),ze(f=>f.items.length>1)),()=>{requestAnimationFrame(()=>{Fe(l,c)})})}),{initialScrollTop:o}},gt(lr,sn,Mr),{singleton:!0}),$v=nt(([{scrollVelocity:n}])=>{const l=me(!1),s=Je(),o=me(!1);return Ee(oe(n,We(o,l,s),ze(([c,f])=>f!==!1&&f!==void 0),be(([c,f,d,x])=>{const{enter:h,exit:p}=f;if(d){if(p(c,x))return!1}else if(h(c,x))return!0;return d}),xt()),l),rt(oe(Ot(l,n,s),We(o)),([[c,f,d],x])=>{c&&x!==!1&&x!==void 0&&x.change&&x.change(f,d)}),{isSeeking:l,scrollSeekConfiguration:o,scrollSeekRangeChanged:s,scrollVelocity:n}},gt(qs),{singleton:!0}),hf=nt(([{scrollContainerState:n,scrollTo:l}])=>{const s=Je(),o=Je(),c=Je(),f=me(!1),d=me(void 0);return Ee(oe(Ot(s,o),be(([{scrollTop:x,viewportHeight:h},{offsetTop:p,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,x-p),viewportHeight:h}))),n),Ee(oe(l,We(o),be(([x,{offsetTop:h}])=>({...x,top:x.top+h}))),c),{customScrollParent:d,useWindowScroll:f,windowScrollContainerState:s,windowScrollTo:c,windowViewportRect:o}},gt(sn)),K2=nt(([{sizeRanges:n,sizes:l},{headerHeight:s,scrollTop:o},{initialTopMostItemIndex:c},{didMount:f},{useWindowScroll:d,windowScrollContainerState:x,windowViewportRect:h}])=>{const p=Je(),y=me(void 0),v=me(null),b=me(null);return Ee(x,v),Ee(h,b),rt(oe(p,We(l,o,d,v,b,s)),([j,k,N,C,w,A,_])=>{const H=L2(k.sizeTree);C&&w!==null&&A!==null&&(N=w.scrollTop-A.offsetTop),N-=_,j({ranges:H,scrollTop:N})}),Ee(oe(y,ze(sf),be(X2)),c),Ee(oe(f,We(y),ze(([,j])=>j!==void 0),xt(),be(([,j])=>j.ranges)),n),{getState:p,restoreStateFrom:y}},gt(na,sn,Ws,lr,hf));function X2(n){return{align:"start",index:0,offset:n.scrollTop}}const Q2=nt(([{topItemsIndexes:n}])=>{const l=me(0);return Ee(oe(l,ze(s=>s>=0),be(s=>Array.from({length:s}).map((o,c)=>c))),n),{topItemCount:l}},gt(Mr));function Vv(n){let l=!1,s;return(()=>(l||(l=!0,s=n()),s))}const Z2=Vv(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),J2=nt(([{deviation:n,scrollBy:l,scrollingInProgress:s,scrollTop:o},{isAtBottom:c,isScrolling:f,lastJumpDueToItemResize:d,scrollDirection:x},{listState:h},{beforeUnshiftWith:p,gap:y,shiftWithOffset:v,sizes:b},{log:j},{recalcInProgress:k}])=>{const N=wn(oe(h,We(d),ea(([,w,A,_],[{bottom:H,items:L,offsetBottom:$,totalCount:E},D])=>{const R=H+$;let B=0;return A===E&&w.length>0&&L.length>0&&(L[0].originalIndex===0&&w[0].originalIndex===0||(B=R-_,B!==0&&(B+=D))),[B,L,E,R]},[0,[],0,0]),ze(([w])=>w!==0),We(o,x,s,c,j,k),ze(([,w,A,_,,,H])=>!H&&!_&&w!==0&&A===Us),be(([[w],,,,,A])=>(A("Upward scrolling compensation",{amount:w},Ut.DEBUG),w))));function C(w){w>0?(Fe(l,{behavior:"auto",top:-w}),Fe(n,0)):(Fe(n,0),Fe(l,{behavior:"auto",top:-w}))}return rt(oe(N,We(n,f)),([w,A,_])=>{_&&Z2()?Fe(n,A-w):C(-w)}),rt(oe(Ot(en(f,!1),n,k),ze(([w,A,_])=>!w&&!_&&A!==0),be(([w,A])=>A),ka(1)),C),Ee(oe(v,be(w=>({top:-w}))),l),rt(oe(p,We(b,y),be(([w,{groupIndices:A,lastSize:_,sizeTree:H},L])=>{function $(V){return V*(_+L)}if(A.length===0)return $(w);let E=0;const D=Bs(H,0);let R=0,B=0;for(;R<w;){R++,E+=D;let V=A.length===B+1?1/0:A[B+1]-A[B]-1;R+V>w&&(E-=D,V=w-R+1),R+=V,E+=$(V),B++}return E})),w=>{Fe(n,w),requestAnimationFrame(()=>{Fe(l,{top:w}),requestAnimationFrame(()=>{Fe(n,0),Fe(k,!1)})})}),{deviation:n}},gt(sn,qs,Mr,na,rr,uf)),ek=nt(([n,l,s,o,c,f,d,x,h,p,y])=>({...n,...l,...s,...o,...c,...f,...d,...x,...h,...p,...y}),gt(mf,q2,lr,$v,Iv,Y2,P2,hf,Uv,rr,Hv)),Pv=nt(([{data:n,defaultItemSize:l,firstItemIndex:s,fixedItemSize:o,fixedGroupSize:c,gap:f,groupIndices:d,heightEstimates:x,itemSize:h,sizeRanges:p,sizes:y,statefulTotalCount:v,totalCount:b,trackItemSizes:j},{initialItemFinalLocationReached:k,initialTopMostItemIndex:N,scrolledToInitialItem:C},w,A,_,H,{scrollToIndex:L},$,{topItemCount:E},{groupCounts:D},R])=>{const{listState:B,minOverscanItemCount:V,topItemsIndexes:W,rangeChanged:te,...Q}=H;return Ee(te,R.scrollSeekRangeChanged),Ee(oe(R.windowViewportRect,be(z=>z.visibleHeight)),w.viewportHeight),{data:n,defaultItemHeight:l,firstItemIndex:s,fixedItemHeight:o,fixedGroupHeight:c,gap:f,groupCounts:D,heightEstimates:x,initialItemFinalLocationReached:k,initialTopMostItemIndex:N,scrolledToInitialItem:C,sizeRanges:p,topItemCount:E,topItemsIndexes:W,totalCount:b,..._,groupIndices:d,itemSize:h,listState:B,minOverscanItemCount:V,scrollToIndex:L,statefulTotalCount:v,trackItemSizes:j,rangeChanged:te,...Q,...R,...w,sizes:y,...A}},gt(na,Ws,sn,K2,W2,Mr,Gs,J2,Q2,Dv,ek));function tk(n,l){const s={},o={};let c=0;const f=n.length;for(;c<f;)o[n[c]]=1,c+=1;for(const d in l)Object.hasOwn(o,d)||(s[d]=l[d]);return s}const co=typeof document<"u"?Ce.useLayoutEffect:Ce.useEffect;function Fv(n,l,s){const o=Object.keys(l.required||{}),c=Object.keys(l.optional||{}),f=Object.keys(l.methods||{}),d=Object.keys(l.events||{}),x=Ce.createContext({});function h(C,w){C.propsReady!==void 0&&Fe(C.propsReady,!1);for(const A of o){const _=C[l.required[A]];Fe(_,w[A])}for(const A of c)if(A in w){const _=C[l.optional[A]];Fe(_,w[A])}C.propsReady!==void 0&&Fe(C.propsReady,!0)}function p(C){return f.reduce((w,A)=>(w[A]=_=>{const H=C[l.methods[A]];Fe(H,_)},w),{})}function y(C){return d.reduce((w,A)=>(w[A]=g2(C[l.events[A]]),w),{})}const v=Ce.forwardRef(function(C,w){const{children:A,..._}=C,[H]=Ce.useState(()=>Ho(y2(n),E=>{h(E,_)})),[L]=Ce.useState(Jx(y,H));co(()=>{for(const E of d)E in _&&rt(L[E],_[E]);return()=>{Object.values(L).map(of)}},[_,L,H]),co(()=>{h(H,_)}),Ce.useImperativeHandle(w,Zx(p(H)));const $=s;return a.jsx(x.Provider,{value:H,children:s!==void 0?a.jsx($,{...tk([...o,...c,...d],_),children:A}):A})}),b=C=>{const w=Ce.useContext(x);return Ce.useCallback(A=>{Fe(w[C],A)},[w,C])},j=C=>{const w=Ce.useContext(x)[C],A=Ce.useCallback(_=>rt(w,_),[w]);return Ce.useSyncExternalStore(A,()=>St(w),()=>St(w))},k=C=>{const w=Ce.useContext(x)[C],[A,_]=Ce.useState(Jx(St,w));return co(()=>rt(w,H=>{H!==A&&_(Zx(H))}),[w,A]),A},N=parseInt(Ce.version)>=18?j:k;return{Component:v,useEmitter:(C,w)=>{const A=Ce.useContext(x)[C];co(()=>rt(A,w),[w,A])},useEmitterValue:N,usePublisher:b}}const Gv=Ce.createContext(void 0),Wv=Ce.createContext(void 0),gd="-webkit-sticky",ug="sticky",xf=Vv(()=>{if(typeof document>"u")return ug;const n=document.createElement("div");return n.style.position=gd,n.style.position===gd?gd:ug}),qv=typeof document<"u"?Ce.useLayoutEffect:Ce.useEffect;function vd(n){return"self"in n}function nk(n){return"body"in n}function Yv(n,l,s,o=Rl,c,f){const d=Ce.useRef(null),x=Ce.useRef(null),h=Ce.useRef(null),p=Ce.useCallback(b=>{let j,k,N;const C=b.target;if(nk(C)||vd(C)){const A=vd(C)?C:C.defaultView;N=f===!0?A.scrollX:A.scrollY,j=f===!0?A.document.documentElement.scrollWidth:A.document.documentElement.scrollHeight,k=f===!0?A.innerWidth:A.innerHeight}else N=f===!0?C.scrollLeft:C.scrollTop,j=f===!0?C.scrollWidth:C.scrollHeight,k=f===!0?C.offsetWidth:C.offsetHeight;const w=()=>{n({scrollHeight:j,scrollTop:Math.max(N,0),viewportHeight:k})};b.suppressFlushSync===!0?w():TS.flushSync(w),x.current!==null&&(N===x.current||N<=0||N===j-k)&&(x.current=null,l(!0),h.current&&(clearTimeout(h.current),h.current=null))},[n,l,f]);Ce.useEffect(()=>{const b=c||d.current;return o(c||d.current),p({suppressFlushSync:!0,target:b}),b.addEventListener("scroll",p,{passive:!0}),()=>{o(null),b.removeEventListener("scroll",p)}},[d,p,s,o,c]);function y(b){const j=d.current;if(!j||(f===!0?"offsetWidth"in j&&j.offsetWidth===0:"offsetHeight"in j&&j.offsetHeight===0))return;const k=b.behavior==="smooth";let N,C,w;vd(j)?(C=Math.max(tr(j.document.documentElement,f===!0?"width":"height"),f===!0?j.document.documentElement.scrollWidth:j.document.documentElement.scrollHeight),N=f===!0?j.innerWidth:j.innerHeight,w=f===!0?window.scrollX:window.scrollY):(C=j[f===!0?"scrollWidth":"scrollHeight"],N=tr(j,f===!0?"width":"height"),w=j[f===!0?"scrollLeft":"scrollTop"]);const A=C-N;if(b.top=Math.ceil(Math.max(Math.min(A,b.top),0)),Ov(N,C)||b.top===w){n({scrollHeight:C,scrollTop:w,viewportHeight:N}),k&&l(!0);return}k?(x.current=b.top,h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,x.current=null,l(!0)},1e3)):x.current=null,f===!0&&(b={...b.behavior!==void 0?{behavior:b.behavior}:{},left:b.top}),j.scrollTo(b)}function v(b){f===!0&&(b={...b.behavior!==void 0?{behavior:b.behavior}:{},...b.top!==void 0?{left:b.top}:{}}),d.current.scrollBy(b)}return{scrollByCallback:v,scrollerRef:d,scrollToCallback:y}}function gf(n){return n}const ak=nt(()=>{const n=me(x=>`Item ${x}`),l=me(x=>`Group ${x}`),s=me({}),o=me(gf),c=me("div"),f=me(Rl),d=(x,h=null)=>en(oe(s,be(p=>p[x]),xt()),h);return{components:s,computeItemKey:o,EmptyPlaceholder:d("EmptyPlaceholder"),FooterComponent:d("Footer"),GroupComponent:d("Group","div"),groupContent:l,HeaderComponent:d("Header"),HeaderFooterTag:c,ItemComponent:d("Item","div"),itemContent:n,ListComponent:d("List","div"),ScrollerComponent:d("Scroller","div"),scrollerRef:f,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder"),TopItemListComponent:d("TopItemList")}}),rk=nt(([n,l])=>({...n,...l}),gt(Pv,ak)),lk=({height:n})=>a.jsx("div",{style:{height:n}}),sk={overflowAnchor:"none",position:xf(),zIndex:1},Kv={overflowAnchor:"none"},ik={...Kv,display:"inline-block",height:"100%"},dg=Ce.memo(function({showTopList:n=!1}){const l=Ue("listState"),s=In("sizeRanges"),o=Ue("useWindowScroll"),c=Ue("customScrollParent"),f=In("windowScrollContainerState"),d=In("scrollContainerState"),x=c||o?f:d,h=Ue("itemContent"),p=Ue("context"),y=Ue("groupContent"),v=Ue("trackItemSizes"),b=Ue("itemSize"),j=Ue("log"),k=In("gap"),N=Ue("horizontalDirection"),{callbackRef:C}=j2(s,b,v,n?Rl:x,j,k,c,N,Ue("skipAnimationFrameInResizeObserver")),[w,A]=Ce.useState(0);vf("deviation",Q=>{w!==Q&&A(Q)});const _=Ue("EmptyPlaceholder"),H=Ue("ScrollSeekPlaceholder")??lk,L=Ue("ListComponent"),$=Ue("ItemComponent"),E=Ue("GroupComponent"),D=Ue("computeItemKey"),R=Ue("isSeeking"),B=Ue("groupIndices").length>0,V=Ue("alignToBottom"),W=Ue("initialItemFinalLocationReached"),te=n?{}:{boxSizing:"border-box",...N?{display:"inline-block",height:"100%",marginLeft:w!==0?w:V?"auto":0,paddingLeft:l.offsetTop,paddingRight:l.offsetBottom,whiteSpace:"nowrap"}:{marginTop:w!==0?w:V?"auto":0,paddingBottom:l.offsetBottom,paddingTop:l.offsetTop},...W?{}:{visibility:"hidden"}};return!n&&l.totalCount===0&&_!==null&&_!==void 0?a.jsx(_,{...Jt(_,p)}):a.jsx(L,{...Jt(L,p),"data-testid":n?"virtuoso-top-item-list":"virtuoso-item-list",ref:C,style:te,children:(n?l.topItems:l.items).map(Q=>{const z=Q.originalIndex,M=D(z+l.firstItemIndex,Q.data,p);return R?g.createElement(H,{...Jt(H,p),height:Q.size,index:Q.index,key:M,type:Q.type||"item",...Q.type==="group"?{}:{groupIndex:Q.groupIndex}}):Q.type==="group"?g.createElement(E,{...Jt(E,p),"data-index":z,"data-item-index":Q.index,"data-known-size":Q.size,key:M,style:sk},y(Q.index,p)):g.createElement($,{...Jt($,p),...dk($,Q.data),"data-index":z,"data-item-group-index":Q.groupIndex,"data-item-index":Q.index,"data-known-size":Q.size,key:M,style:N?ik:Kv},B?h(Q.index,Q.groupIndex,Q.data,p):h(Q.index,Q.data,p))})})}),ok={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},ck={outline:"none",overflowX:"auto",position:"relative"},$o=n=>({height:"100%",position:"absolute",top:0,width:"100%",...n?{display:"flex",flexDirection:"column"}:void 0}),uk={position:xf(),top:0,width:"100%",zIndex:1};function Jt(n,l){if(typeof n!="string")return{context:l}}function dk(n,l){return{item:typeof n=="string"?void 0:l}}const fk=Ce.memo(function(){const n=Ue("HeaderComponent"),l=In("headerHeight"),s=Ue("HeaderFooterTag"),o=Ar(Ce.useMemo(()=>f=>{l(tr(f,"height"))},[l]),!0,Ue("skipAnimationFrameInResizeObserver")),c=Ue("context");return n!=null?a.jsx(s,{ref:o,children:a.jsx(n,{...Jt(n,c)})}):null}),pk=Ce.memo(function(){const n=Ue("FooterComponent"),l=In("footerHeight"),s=Ue("HeaderFooterTag"),o=Ar(Ce.useMemo(()=>f=>{l(tr(f,"height"))},[l]),!0,Ue("skipAnimationFrameInResizeObserver")),c=Ue("context");return n!=null?a.jsx(s,{ref:o,children:a.jsx(n,{...Jt(n,c)})}):null});function Xv({useEmitter:n,useEmitterValue:l,usePublisher:s}){return Ce.memo(function({children:o,style:c,context:f,...d}){const x=s("scrollContainerState"),h=l("ScrollerComponent"),p=s("smoothScrollTargetReached"),y=l("scrollerRef"),v=l("horizontalDirection")||!1,{scrollByCallback:b,scrollerRef:j,scrollToCallback:k}=Yv(x,p,h,y,void 0,v);return n("scrollTo",k),n("scrollBy",b),a.jsx(h,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:j,style:{...v?ck:ok,...c},tabIndex:0,...d,...Jt(h,f),children:o})})}function Qv({useEmitter:n,useEmitterValue:l,usePublisher:s}){return Ce.memo(function({children:o,style:c,context:f,...d}){const x=s("windowScrollContainerState"),h=l("ScrollerComponent"),p=s("smoothScrollTargetReached"),y=l("totalListHeight"),v=l("deviation"),b=l("customScrollParent"),j=Ce.useRef(null),k=l("scrollerRef"),{scrollByCallback:N,scrollerRef:C,scrollToCallback:w}=Yv(x,p,h,k,b);return qv(()=>{var A;return C.current=b||((A=j.current)==null?void 0:A.ownerDocument.defaultView),()=>{C.current=null}},[C,b]),n("windowScrollTo",w),n("scrollBy",N),a.jsx(h,{ref:j,"data-virtuoso-scroller":!0,style:{position:"relative",...c,...y!==0?{height:y+v}:void 0},...d,...Jt(h,f),children:o})})}const mk=({children:n})=>{const l=Ce.useContext(Gv),s=In("viewportHeight"),o=In("fixedItemHeight"),c=Ue("alignToBottom"),f=Ue("horizontalDirection"),d=Ce.useMemo(()=>jv(s,h=>tr(h,f?"width":"height")),[s,f]),x=Ar(d,!0,Ue("skipAnimationFrameInResizeObserver"));return Ce.useEffect(()=>{l&&(s(l.viewportHeight),o(l.itemHeight))},[l,s,o]),a.jsx("div",{"data-viewport-type":"element",ref:x,style:$o(c),children:n})},hk=({children:n})=>{const l=Ce.useContext(Gv),s=In("windowViewportRect"),o=In("fixedItemHeight"),c=Ue("customScrollParent"),f=wv(s,c,Ue("skipAnimationFrameInResizeObserver")),d=Ue("alignToBottom");return Ce.useEffect(()=>{l&&(o(l.itemHeight),s({listHeight:0,offsetTop:0,visibleHeight:l.viewportHeight,visibleWidth:100}))},[l,s,o]),a.jsx("div",{"data-viewport-type":"window",ref:f,style:$o(d),children:n})},xk=({children:n})=>{const l=Ue("TopItemListComponent")??"div",s=Ue("headerHeight"),o={...uk,marginTop:`${s}px`},c=Ue("context");return a.jsx(l,{style:o,...Jt(l,c),children:n})},gk=Ce.memo(function(n){const l=Ue("useWindowScroll"),s=Ue("topItemsIndexes").length>0,o=Ue("customScrollParent"),c=Ue("context");return a.jsxs(o||l?bk:yk,{...n,context:c,children:[s&&a.jsx(xk,{children:a.jsx(dg,{showTopList:!0})}),a.jsxs(o||l?hk:mk,{children:[a.jsx(fk,{}),a.jsx(dg,{}),a.jsx(pk,{})]})]})}),{Component:vk,useEmitter:vf,useEmitterValue:Ue,usePublisher:In}=Fv(rk,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},gk),yk=Xv({useEmitter:vf,useEmitterValue:Ue,usePublisher:In}),bk=Qv({useEmitter:vf,useEmitterValue:Ue,usePublisher:In}),Sk=vk,jk=nt(()=>{const n=me(p=>a.jsxs("td",{children:["Item $",p]})),l=me(null),s=me(p=>a.jsxs("td",{colSpan:1e3,children:["Group ",p]})),o=me(null),c=me(null),f=me({}),d=me(gf),x=me(Rl),h=(p,y=null)=>en(oe(f,be(v=>v[p]),xt()),y);return{components:f,computeItemKey:d,context:l,EmptyPlaceholder:h("EmptyPlaceholder"),FillerRow:h("FillerRow"),fixedFooterContent:c,fixedHeaderContent:o,itemContent:n,groupContent:s,ScrollerComponent:h("Scroller","div"),scrollerRef:x,ScrollSeekPlaceholder:h("ScrollSeekPlaceholder"),TableBodyComponent:h("TableBody","tbody"),TableComponent:h("Table","table"),TableFooterComponent:h("TableFoot","tfoot"),TableHeadComponent:h("TableHead","thead"),TableRowComponent:h("TableRow","tr"),GroupComponent:h("Group","tr")}});gt(Pv,jk);xf();const fg={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},kk={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:pg,floor:Ro,max:zs,min:yd,round:mg}=Math;function hg(n,l,s){return Array.from({length:l-n+1}).map((o,c)=>({data:s===null?null:s[c+n],index:c+n}))}function wk(n){return{...kk,items:n}}function uo(n,l){return n!==void 0&&n.width===l.width&&n.height===l.height}function Ck(n,l){return n!==void 0&&n.column===l.column&&n.row===l.row}const Ek=nt(([{increaseViewportBy:n,listBoundary:l,overscan:s,visibleRange:o},{footerHeight:c,headerHeight:f,scrollBy:d,scrollContainerState:x,scrollTo:h,scrollTop:p,smoothScrollTargetReached:y,viewportHeight:v},b,j,{didMount:k,propsReady:N},{customScrollParent:C,useWindowScroll:w,windowScrollContainerState:A,windowScrollTo:_,windowViewportRect:H},L])=>{const $=me(0),E=me(0),D=me(fg),R=me({height:0,width:0}),B=me({height:0,width:0}),V=Je(),W=Je(),te=me(0),Q=me(null),z=me({column:0,row:0}),M=Je(),I=Je(),X=me(!1),G=me(0),ce=me(!0),O=me(!1),Y=me(!1);rt(oe(k,We(G),ze(([ie,je])=>je!==0)),()=>{Fe(ce,!1)}),rt(oe(Ot(k,ce,B,R,G,O),ze(([ie,je,Oe,$e,,ae])=>ie&&!je&&Oe.height!==0&&$e.height!==0&&!ae)),([,,,,ie])=>{Fe(O,!0),ff(1,()=>{Fe(V,ie)}),Wn(oe(p),()=>{Fe(l,[0,0]),Fe(ce,!0)})}),Ee(oe(I,ze(ie=>ie!=null&&ie.scrollTop>0),Jn(0)),E),rt(oe(k,We(I),ze(([,ie])=>ie!=null)),([,ie])=>{ie&&(Fe(R,ie.viewport),Fe(B,ie.item),Fe(z,ie.gap),ie.scrollTop>0&&(Fe(X,!0),Wn(oe(p,Tr(1)),je=>{Fe(X,!1)}),Fe(h,{top:ie.scrollTop})))}),Ee(oe(R,be(({height:ie})=>ie)),v),Ee(oe(Ot(Le(R,uo),Le(B,uo),Le(z,(ie,je)=>ie!==void 0&&ie.column===je.column&&ie.row===je.row),Le(p)),be(([ie,je,Oe,$e])=>({gap:Oe,item:je,scrollTop:$e,viewport:ie}))),M),Ee(oe(Ot(Le($),o,Le(z,Ck),Le(B,uo),Le(R,uo),Le(Q),Le(E),Le(X),Le(ce),Le(G)),ze(([,,,,,,,ie])=>!ie),be(([ie,[je,Oe],$e,ae,pe,fe,he,,ye,Be])=>{const{column:Me,row:ue}=$e,{height:De,width:Ie}=ae,{width:Bt}=pe;if(he===0&&(ie===0||Bt===0))return fg;if(Ie===0){const st=pf(Be,ie),sr=st+Math.max(he-1,0);return wk(hg(st,sr,fe))}const Gt=Zv(Bt,Ie,Me);let lt,kt;ye?je===0&&Oe===0&&he>0?(lt=0,kt=he-1):(lt=Gt*Ro((je+ue)/(De+ue)),kt=Gt*pg((Oe+ue)/(De+ue))-1,kt=yd(ie-1,zs(kt,Gt-1)),lt=yd(kt,zs(0,lt))):(lt=0,kt=-1);const ve=hg(lt,kt,fe),{bottom:Mt,top:_e}=xg(pe,$e,ae,ve),vt=pg(ie/Gt),Qt=vt*De+(vt-1)*ue-Mt;return{bottom:Mt,itemHeight:De,items:ve,itemWidth:Ie,offsetBottom:Qt,offsetTop:_e,top:_e}})),D),Ee(oe(Q,ze(ie=>ie!==null),be(ie=>ie.length)),$),Ee(oe(Ot(R,B,D,z),ze(([ie,je,{items:Oe}])=>Oe.length>0&&je.height!==0&&ie.height!==0),be(([ie,je,{items:Oe},$e])=>{const{bottom:ae,top:pe}=xg(ie,$e,je,Oe);return[pe,ae]}),xt(Is)),l);const se=me(!1);Ee(oe(p,We(se),be(([ie,je])=>je||ie!==0)),se);const de=wn(oe(Ot(D,$),ze(([{items:ie}])=>ie.length>0),We(se),ze(([[ie,je],Oe])=>{const $e=ie.items[ie.items.length-1].index===je-1;return(Oe||ie.bottom>0&&ie.itemHeight>0&&ie.offsetBottom===0&&ie.items.length===je)&&$e}),be(([[,ie]])=>ie-1),xt())),ge=wn(oe(Le(D),ze(({items:ie})=>ie.length>0&&ie[0].index===0),Jn(0),xt())),xe=wn(oe(Le(D),We(X),ze(([{items:ie},je])=>ie.length>0&&!je),be(([{items:ie}])=>({endIndex:ie[ie.length-1].index,startIndex:ie[0].index})),xt(Av),ka(0)));Ee(xe,j.scrollSeekRangeChanged),Ee(oe(V,We(R,B,$,z),be(([ie,je,Oe,$e,ae])=>{const pe=_v(ie),{align:fe,behavior:he,offset:ye}=pe;let Be=pe.index;Be==="LAST"&&(Be=$e-1),Be=zs(0,Be,yd($e-1,Be));let Me=Gd(je,ae,Oe,Be);return fe==="end"?Me=mg(Me-je.height+Oe.height):fe==="center"&&(Me=mg(Me-je.height/2+Oe.height/2)),ye!==void 0&&ye!==0&&(Me+=ye),{behavior:he,top:Me}})),h);const we=en(oe(D,be(ie=>ie.offsetBottom+ie.bottom)),0);return Ee(oe(H,be(ie=>({height:ie.visibleHeight,width:ie.visibleWidth}))),R),{customScrollParent:C,data:Q,deviation:te,footerHeight:c,gap:z,headerHeight:f,increaseViewportBy:n,initialItemCount:E,itemDimensions:B,overscan:s,restoreStateFrom:I,scrollBy:d,scrollContainerState:x,scrollHeight:W,scrollTo:h,scrollToIndex:V,scrollTop:p,smoothScrollTargetReached:y,totalCount:$,useWindowScroll:w,viewportDimensions:R,windowScrollContainerState:A,windowScrollTo:_,windowViewportRect:H,...j,gridState:D,horizontalDirection:Y,initialTopMostItemIndex:G,totalListHeight:we,...b,endReached:de,propsReady:N,rangeChanged:xe,startReached:ge,stateChanged:M,stateRestoreInProgress:X,...L}},gt(mf,sn,qs,$v,lr,hf,rr));function Zv(n,l,s){return zs(1,Ro((n+s)/(Ro(l)+s)))}function xg(n,l,s,o){const{height:c}=s;if(c===void 0||o.length===0)return{bottom:0,top:0};const f=Gd(n,l,s,o[0].index);return{bottom:Gd(n,l,s,o[o.length-1].index)+c,top:f}}function Gd(n,l,s,o){const c=Zv(n.width,s.width,l.column),f=Ro(o/c),d=f*s.height+zs(0,f-1)*l.row;return d>0?d+l.row:d}const Nk=nt(()=>{const n=me(v=>`Item ${v}`),l=me({}),s=me(null),o=me("virtuoso-grid-item"),c=me("virtuoso-grid-list"),f=me(gf),d=me("div"),x=me(Rl),h=(v,b=null)=>en(oe(l,be(j=>j[v]),xt()),b),p=me(!1),y=me(!1);return Ee(Le(y),p),{components:l,computeItemKey:f,context:s,FooterComponent:h("Footer"),HeaderComponent:h("Header"),headerFooterTag:d,itemClassName:o,ItemComponent:h("Item","div"),itemContent:n,listClassName:c,ListComponent:h("List","div"),readyStateChanged:p,reportReadyState:y,ScrollerComponent:h("Scroller","div"),scrollerRef:x,ScrollSeekPlaceholder:h("ScrollSeekPlaceholder","div")}}),Tk=nt(([n,l])=>({...n,...l}),gt(Ek,Nk)),Rk=Ce.memo(function(){const n=bt("gridState"),l=bt("listClassName"),s=bt("itemClassName"),o=bt("itemContent"),c=bt("computeItemKey"),f=bt("isSeeking"),d=Hn("scrollHeight"),x=bt("ItemComponent"),h=bt("ListComponent"),p=bt("ScrollSeekPlaceholder"),y=bt("context"),v=Hn("itemDimensions"),b=Hn("gap"),j=bt("log"),k=bt("stateRestoreInProgress"),N=Hn("reportReadyState"),C=Ar(Ce.useMemo(()=>w=>{const A=w.parentElement.parentElement.scrollHeight;d(A);const _=w.firstChild;if(_!==null){const{height:H,width:L}=_.getBoundingClientRect();v({height:H,width:L})}b({column:gg("column-gap",getComputedStyle(w).columnGap,j),row:gg("row-gap",getComputedStyle(w).rowGap,j)})},[d,v,b,j]),!0,!1);return qv(()=>{n.itemHeight>0&&n.itemWidth>0&&N(!0)},[n]),k?null:a.jsx(h,{className:l,ref:C,...Jt(h,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},children:n.items.map(w=>{const A=c(w.index,w.data,y);return f?a.jsx(p,{...Jt(p,y),height:n.itemHeight,index:w.index,width:n.itemWidth},A):g.createElement(x,{...Jt(x,y),className:s,"data-index":w.index,key:A},o(w.index,w.data,y))})})}),Ak=Ce.memo(function(){const n=bt("HeaderComponent"),l=Hn("headerHeight"),s=bt("headerFooterTag"),o=Ar(Ce.useMemo(()=>f=>{l(tr(f,"height"))},[l]),!0,!1),c=bt("context");return n!=null?a.jsx(s,{ref:o,children:a.jsx(n,{...Jt(n,c)})}):null}),Mk=Ce.memo(function(){const n=bt("FooterComponent"),l=Hn("footerHeight"),s=bt("headerFooterTag"),o=Ar(Ce.useMemo(()=>f=>{l(tr(f,"height"))},[l]),!0,!1),c=bt("context");return n!=null?a.jsx(s,{ref:o,children:a.jsx(n,{...Jt(n,c)})}):null}),Lk=({children:n})=>{const l=Ce.useContext(Wv),s=Hn("itemDimensions"),o=Hn("viewportDimensions"),c=Ar(Ce.useMemo(()=>f=>{o(f.getBoundingClientRect())},[o]),!0,!1);return Ce.useEffect(()=>{l&&(o({height:l.viewportHeight,width:l.viewportWidth}),s({height:l.itemHeight,width:l.itemWidth}))},[l,o,s]),a.jsx("div",{ref:c,style:$o(!1),children:n})},zk=({children:n})=>{const l=Ce.useContext(Wv),s=Hn("windowViewportRect"),o=Hn("itemDimensions"),c=bt("customScrollParent"),f=wv(s,c,!1);return Ce.useEffect(()=>{l&&(o({height:l.itemHeight,width:l.itemWidth}),s({listHeight:0,offsetTop:0,visibleHeight:l.viewportHeight,visibleWidth:l.viewportWidth}))},[l,s,o]),a.jsx("div",{ref:f,style:$o(!1),children:n})},Dk=Ce.memo(function({...n}){const l=bt("useWindowScroll"),s=bt("customScrollParent"),o=s||l?Ok:_k,c=s||l?zk:Lk,f=bt("context");return a.jsx(o,{...n,...Jt(o,f),children:a.jsxs(c,{children:[a.jsx(Ak,{}),a.jsx(Rk,{}),a.jsx(Mk,{})]})})}),{useEmitter:Jv,useEmitterValue:bt,usePublisher:Hn}=Fv(Tk,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Dk),_k=Xv({useEmitter:Jv,useEmitterValue:bt,usePublisher:Hn}),Ok=Qv({useEmitter:Jv,useEmitterValue:bt,usePublisher:Hn});function gg(n,l,s){return l!=="normal"&&(l==null?void 0:l.endsWith("px"))!==!0&&s(`${n} was not resolved to pixel value correctly`,l,Ut.WARN),l==="normal"?0:parseInt(l??"0",10)}const Bk={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},ey={source:"Own",installed:"Installed"};function Ik(n){try{const l=localStorage.getItem(n);if(l!=null)return l==="true"}catch{}try{if(typeof sessionStorage<"u"){const l=sessionStorage.getItem(n);if(l!=null)return l==="true"}}catch{}return!1}function Hk(n,l){const s=l?"true":"false";try{localStorage.setItem(n,s)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(n,s)}catch{}}function vg({origin:n,count:l,filteredCount:s,updateCount:o,children:c}){const f=Bk[n],[d,x]=g.useState(()=>Ik(f)),h=g.useCallback(()=>{x(b=>{const j=!b;return Hk(f,j),j})},[f]),p=ey[n],y=`sidebar-section-${n}-header`,v=`sidebar-section-${n}-group`;return a.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[a.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!d,"aria-controls":v,onClick:h,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[a.jsx($k,{collapsed:d}),a.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:p}),a.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:s!=null&&s!==l?`(${s} of ${l})`:`(${l})`}),o!=null&&o>0&&a.jsx(Uk,{origin:n,updateCount:o})]}),!d&&a.jsx("div",{id:v,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:c})]})}function Uk({origin:n,updateCount:l}){const[s,o]=g.useState(!1),c=ey[n].toLowerCase(),f=`${l} updates available in ${c} section, view all`;return a.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":f,onClick:d=>{d.stopPropagation(),window.location.hash="#/updates"},onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),d.stopPropagation(),window.location.hash="#/updates")},onFocus:()=>o(!0),onBlur:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:2,fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3,outline:s?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[l," updates",a.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function $k({collapsed:n}){return a.jsx("svg",{"aria-hidden":"true",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:n?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function yf(n,l){const s=l.trim().toLowerCase();return s?n.skill.toLowerCase().includes(s)||n.plugin.toLowerCase().includes(s)||n.dir.toLowerCase().includes(s):!0}function Vk({value:n,onChange:l,placeholder:s="Filter skills…",validationPattern:o,validationMessage:c="Invalid filter expression"}){const f=g.useRef(null),d=g.useId(),x=!!o&&n.trim()!==""&&!o.test(n);return g.useEffect(()=>{function h(p){var b;if(p.key!=="/")return;const y=p.target;if(!y)return;const v=y.tagName;v==="INPUT"||v==="TEXTAREA"||y.isContentEditable||(p.preventDefault(),(b=f.current)==null||b.focus())}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[]),a.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[a.jsxs("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[a.jsx("circle",{cx:"11",cy:"11",r:"8"}),a.jsx("path",{d:"M21 21l-4.35-4.35"})]}),a.jsx("input",{ref:f,type:"search","aria-label":"Filter skills","aria-invalid":x?!0:void 0,"aria-describedby":x?d:void 0,value:n,placeholder:s,onChange:h=>l(h.currentTarget.value),onKeyDown:h=>{h.key==="Escape"&&(l(""),h.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),x&&a.jsx("span",{id:d,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:c}),a.jsx("kbd",{"aria-hidden":"true",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",border:"1px solid var(--border-default)",padding:"1px 5px",borderRadius:3,display:n?"none":"inline-block"},children:"/"})]})}function Pk({target:n}){const l=typeof n=="string"&&n.length>0,s=l?`symlinked → ${n}`:"symlinked — cycle detected or target unresolved",o=l?`symlinked from ${n}`:"symlinked, target unresolved";return a.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:s,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:a.jsxs("svg",{"data-testid":"symlink-glyph",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",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"})]})})}function Fk({skill:n}){if(!n.updateAvailable)return null;const l=n.currentVersion??"",s=n.latestVersion,o=s?`Update available: ${l} → ${s}`.trim():"Update available";return a.jsx("span",{"data-testid":"skill-row-update-glyph",title:o,"aria-label":"Update available",style:{color:"var(--color-own)",display:"inline-flex",flexShrink:0},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("path",{d:"M12 19V5"}),a.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function Gk({skill:n,isSelected:l,onSelect:s,onContextMenu:o}){const c=n.origin==="installed"?"var(--status-installed)":"var(--status-own)";return a.jsxs("button",{type:"button",onClick:s,onContextMenu:o?f=>{f.preventDefault(),o(f,n)}:void 0,"aria-current":l?"true":void 0,"aria-selected":!!l,"data-testid":"skill-row","data-selected":l,"data-origin":n.origin,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:l?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:l?"inset 2px 0 0 var(--color-accent, var(--accent-surface))":"none",border:"none",borderRadius:0,color:"var(--text-primary)",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,textAlign:"left",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease), box-shadow var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[a.jsx("span",{"aria-hidden":"true","aria-label":n.updateAvailable?"Update available":void 0,title:n.updateAvailable?`Update available${n.latestVersion?` → ${n.latestVersion}`:""}`:void 0,style:{width:n.updateAvailable?10:6,height:n.updateAvailable?10:6,borderRadius:"50%",background:c,display:"inline-block",flexShrink:0,boxShadow:n.updateAvailable?"0 0 0 2px var(--color-own, #d97706)":"none",transition:"box-shadow 180ms ease, width 180ms ease, height 180ms ease"}}),a.jsx("span",{title:n.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.skill}),n.version&&a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",flexShrink:0},children:n.version}),n.isSymlink&&a.jsx(Pk,{target:n.symlinkTarget??null}),a.jsx(Fk,{skill:n})]})}const Ao=g.memo(Gk);function Wk({plugin:n,skills:l,selectedKey:s,onSelect:o,onContextMenu:c}){const f=[...l].sort((d,x)=>d.skill.localeCompare(x.skill));return a.jsxs("div",{role:"group","aria-label":`${n} (${l.length})`,children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:n,children:n}),a.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",l.length,")"]})]}),a.jsx("div",{role:"list",children:f.map(d=>{const x=!!s&&s.plugin===d.plugin&&s.skill===d.skill;return a.jsx("div",{role:"listitem",children:a.jsx(Ao,{skill:d,isSelected:x,onSelect:()=>o(d),onContextMenu:c})},`${d.plugin}/${d.skill}`)})})]})}function qk(n,l){if(!n||typeof window>"u")return l;try{const s=window.localStorage.getItem(n);return s===null?l:s==="true"}catch{return l}}function yg({skills:n,pluginName:l,initialCollapsed:s=!1,persistKey:o,renderSkill:c,headerActionSlot:f}){var v;const d=l??((v=n[0])==null?void 0:v.pluginName)??"unknown-plugin",[x,h]=g.useState(()=>qk(o,s)),p=g.useCallback(()=>{h(b=>{const j=!b;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(j))}catch{}return j})},[o]),y=x?"▸":"▾";return a.jsxs("div",{"data-vskill-plugin-tree":d,role:"group","aria-label":`${d} (${n.length})`,children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",paddingRight:6},children:[a.jsxs("button",{type:"button",onClick:p,"aria-expanded":!x,style:{display:"flex",alignItems:"center",gap:6,flex:1,padding:"4px 4px 4px 18px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",color:"var(--text-primary)",fontSize:12,fontWeight:500},children:[a.jsx("span",{"aria-hidden":!0,className:"vskill-chevron tabular-nums",style:{width:16,display:"inline-block",textAlign:"center",fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))"},children:y}),a.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:d}),a.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",n.length,")"]})]}),f&&a.jsx("div",{style:{display:"inline-flex",alignItems:"center",flexShrink:0},children:f})]}),!x&&a.jsx("div",{className:"vskill-plugin-tree-children",style:{paddingLeft:36,borderLeft:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",marginLeft:24},children:n.map(b=>a.jsx("div",{"data-vskill-plugin-skill":b.pluginNamespace??b.skill,children:c(b)},`${b.pluginNamespace??b.skill}`))})]})}function Yk({pluginName:n,enabled:l,onAfterAction:s}){const[o,c]=g.useState(!1),[f,d]=g.useState(null),[x,h]=g.useState(null),p=g.useRef(null);g.useEffect(()=>{if(!o)return;function v(b){p.current&&!p.current.contains(b.target)&&c(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]);async function y(v){d(v),h(null);try{if(v==="uninstall"&&!window.confirm(`Uninstall ${n}? This removes the plugin and its skills.`)){d(null);return}const b=await fetch(`/api/plugins/${encodeURIComponent(n)}/${v}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),j=await b.json().catch(()=>({}));if(!b.ok||!j.ok){h(j.error??`${v} failed (${b.status})`);return}ln("skills"),ln("plugins"),s==null||s(),c(!1)}catch(b){h(b instanceof Error?b.message:String(b))}finally{d(null)}}return a.jsxs("div",{ref:p,style:{position:"relative",display:"inline-flex"},children:[a.jsx("button",{type:"button","aria-label":`Manage ${n}`,title:`Manage ${n}`,onClick:v=>{v.stopPropagation(),c(b=>!b)},"data-vskill-plugin-action-trigger":n,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,padding:0,marginLeft:4,border:"none",background:o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent",color:"var(--text-tertiary)",borderRadius:4,cursor:"pointer",fontSize:14,lineHeight:1},onMouseEnter:v=>{v.currentTarget.style.color="var(--text-primary)",v.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.06))"},onMouseLeave:v=>{v.currentTarget.style.color="var(--text-tertiary)",v.currentTarget.style.background=o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent"},children:"⋯"}),o&&a.jsxs("div",{role:"menu",style:{position:"absolute",top:"calc(100% + 2px)",right:0,minWidth:160,background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 8px 14px -4px rgba(0,0,0,0.12)",padding:4,zIndex:30,fontFamily:"var(--font-sans)"},children:[l?a.jsx(bd,{onClick:()=>void y("disable"),disabled:f!==null,busy:f==="disable",label:"Disable",hint:"Keep installed, turn off"}):a.jsx(bd,{onClick:()=>void y("enable"),disabled:f!==null,busy:f==="enable",label:"Enable",hint:"Activate plugin"}),a.jsx(bd,{onClick:()=>void y("uninstall"),disabled:f!==null,busy:f==="uninstall",label:"Uninstall",hint:"Remove plugin + skills",danger:!0}),x&&a.jsx("div",{style:{padding:"6px 8px",fontSize:11,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4,marginTop:4,lineHeight:1.4,maxWidth:240,wordBreak:"break-word"},children:x})]})]})}function bd({onClick:n,disabled:l,busy:s,label:o,hint:c,danger:f}){return a.jsxs("button",{type:"button",onClick:d=>{d.stopPropagation(),n()},disabled:l,role:"menuitem",style:{display:"block",width:"100%",padding:"6px 10px",textAlign:"left",border:"none",background:"transparent",borderRadius:4,cursor:l?"not-allowed":"pointer",color:f?"var(--color-error, #b91c1c)":"var(--text-primary)",opacity:l&&!s?.5:1,fontFamily:"inherit"},onMouseEnter:d=>{l||(d.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.05))")},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:500},children:s?`${o}…`:o}),a.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)"},children:c})]})}function bg({name:n,count:l,className:s,variant:o,collapsed:c,onToggle:f,action:d}){const x=o==="authoring"?"var(--color-own, #f59e0b)":"var(--color-accent, #2f6f8f)",h=o==="authoring"?"color-mix(in oklch, var(--color-own, #f59e0b) 10%, var(--color-paper, #fff))":"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))",p=typeof f=="function",y={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:h,borderLeft:`3px solid ${x}`,borderBottom:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",padding:"7px 10px 7px 9px",fontFamily:"var(--font-serif, ui-serif)",fontSize:13,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:8,width:"100%",cursor:p?"pointer":"default",border:"none",textAlign:"left"},v=c?"▸":"▾",b=a.jsxs(a.Fragment,{children:[p&&a.jsx("span",{"aria-hidden":!0,style:{fontSize:15,fontWeight:700,color:x,width:16,display:"inline-block",textAlign:"center",letterSpacing:0,textTransform:"none"},children:v}),a.jsx("span",{className:"vskill-group-header-name",children:n}),a.jsxs("span",{className:"vskill-group-header-count tabular-nums",style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:500,color:"var(--text-secondary)",letterSpacing:0,textTransform:"none"},children:["(",l,")"]}),d&&a.jsx("span",{style:{marginLeft:"auto"},children:a.jsx(Kk,{label:d.label,title:d.title,icon:d.icon,onClick:d.onClick,accent:x})})]});return p?a.jsx("button",{type:"button","data-vskill-group-header":n,className:["vskill-group-header select-none",s??""].join(" ").trim(),style:y,onClick:()=>f(!c),"aria-expanded":!c,children:b}):a.jsx("div",{"data-vskill-group-header":n,role:"heading","aria-level":3,className:["vskill-group-header select-none",s??""].join(" ").trim(),style:y,children:b})}function Kk({label:n,title:l,icon:s,onClick:o,accent:c}){return a.jsxs("button",{type:"button","aria-label":n,title:l??n,onClick:f=>{f.stopPropagation(),o()},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,height:22,padding:"0 7px",border:`1px solid ${c}`,background:"transparent",color:c,borderRadius:4,fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",cursor:"pointer",fontFamily:"inherit"},onMouseEnter:f=>{f.currentTarget.style.background=`color-mix(in oklch, ${c} 15%, transparent)`},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:[s,n]})}function Xk(){return a.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[a.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),a.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function Qk(n){const l=n.key.split("+").map(x=>x.trim()).filter(Boolean);let s=!!n.meta,o=!!n.ctrl,c=!!n.shift,f=!!n.alt,d=n.key;if(l.length>1){for(const x of l.slice(0,-1)){const h=x.toLowerCase();h==="cmd"||h==="meta"||h==="⌘"?s=!0:h==="ctrl"||h==="control"?o=!0:h==="shift"?c=!0:(h==="alt"||h==="option")&&(f=!0)}d=l[l.length-1]}return{key:d.length===1?d.toLowerCase():d,meta:s,ctrl:o,shift:c,alt:f,allowInInputs:!!n.allowInInputs,handler:n.handler}}function Zk(n){if(!n||!(n instanceof HTMLElement))return!1;const l=n.tagName;if(l==="INPUT"||l==="TEXTAREA"||n.isContentEditable)return!0;const s=n.getAttribute("contenteditable");return s!=null&&s!=="false"||n.getAttribute("role")==="textbox"}function Jk(n,l){const s=!!n.metaKey,o=!!n.ctrlKey,c=!!n.shiftKey,f=!!n.altKey;return s!==l.meta||o!==l.ctrl||c!==l.shift||f!==l.alt?!1:(n.key.length===1?n.key.toLowerCase():n.key)===l.key}function Wd(n,l={}){const{enabled:s=!0,target:o}=l,c=g.useRef([]),f=Array.isArray(n)?n:[n];c.current=f.map(Qk),g.useEffect(()=>{if(!s)return;const d=o??(typeof window<"u"?window:void 0);if(!d)return;function x(h){const p=h,y=Zk(p.target);for(const v of c.current){if(!Jk(p,v))continue;const b=v.meta||v.ctrl||v.alt;if(!(y&&!v.allowInInputs&&!b)){v.handler(p);return}}}return d.addEventListener("keydown",x),()=>{d.removeEventListener("keydown",x)}},[s,o])}const ew=200;function tw(n){return n.scope==="own"||n.scope==="installed"||n.scope==="global"?n.scope:n.origin==="installed"?"installed":"own"}function nw(n,l){const s={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const c of n){const f=c.scopeV2??(c.scope==="installed"?"available-project":c.scope==="global"?"available-personal":"authoring-project");f==="available-project"?s.availableProject.push(c):f==="available-personal"?s.availablePersonal.push(c):f==="available-plugin"?s.availablePlugin.push(c):f==="authoring-plugin"?s.authoringPlugin.push(c):s.authoringProject.push(c)}function o(c){const f=c.filter(h=>yf(h,l)),d={};for(const h of f){const p=h.pluginName??h.plugin;(d[p]||(d[p]=[])).push(h)}const x=Object.entries(d).sort((h,p)=>h[0].localeCompare(p[0]));return{total:c.length,filtered:f.length,byPlugin:x}}return{availableProject:o(s.availableProject),availablePersonal:o(s.availablePersonal),availablePlugin:o(s.availablePlugin),authoringProject:o(s.authoringProject),authoringPlugin:o(s.authoringPlugin)}}function aw(n,l){const s=[],o=[],c=[];for(const d of n){const x=tw(d);x==="global"?c.push(d):x==="installed"?o.push(d):s.push(d)}function f(d){var y;const x=d.filter(v=>yf(v,l)),h={};for(const v of x)(h[y=v.plugin]||(h[y]=[])).push(v);const p=Object.entries(h).sort((v,b)=>v[0].localeCompare(b[0]));return{total:d.length,filtered:x.length,byPlugin:p}}return{own:f(s),installed:f(o),global:f(c)}}function rw(n,l){const s=[],o=[];for(const f of n)(f.origin==="installed"?o:s).push(f);function c(f){var p;const d=f.filter(y=>yf(y,l)),x={};for(const y of d)(x[p=y.plugin]||(x[p]=[])).push(y);const h=Object.entries(x).sort((y,v)=>y[0].localeCompare(v[0]));return{total:f.length,filtered:d.length,byPlugin:h}}return{own:c(s),installed:c(o)}}function lw({skills:n,selectedKey:l,onSelect:s,isLoading:o,error:c,onRetry:f,onContextMenu:d,outdatedByOrigin:x,activeAgentId:h,outdatedByScope:p,topSlot:y}){const v=!!h||n.some(X=>X.scope!==void 0&&X.scope!==null),b=h??"claude-cli",[j,k]=g.useState(""),N=g.useDeferredValue(j),C=g.useMemo(()=>aw(n,N),[n,N]),w=g.useMemo(()=>nw(n,N),[n,N]),A=b==="claude-code",{data:_}=Nl("plugins",()=>fetch("/api/plugins").then(X=>X.json()),{enabled:A,ttl:6e4}),H=g.useMemo(()=>{const X=new Map;for(const G of(_==null?void 0:_.plugins)??[]){const ce=X.get(G.name);X.set(G.name,!!ce||!!G.enabled)}return X},[_==null?void 0:_.plugins]),[L,$]=g.useState(()=>qd(`vskill-sidebar-${b}-group-available-collapsed`)),[E,D]=g.useState(()=>qd(`vskill-sidebar-${b}-group-authoring-collapsed`)),R=g.useCallback(X=>{$(X);try{window.localStorage.setItem(`vskill-sidebar-${b}-group-available-collapsed`,String(X))}catch{}},[b]),B=g.useCallback(X=>{D(X);try{window.localStorage.setItem(`vskill-sidebar-${b}-group-authoring-collapsed`,String(X))}catch{}},[b]),{own:V,installed:W}=g.useMemo(()=>rw(n,N),[n,N]),Q=C.own.filtered+C.installed.filtered+C.global.filtered>=ew,z=g.useMemo(()=>{const X=G=>{const ce=[];for(const[,O]of G){const Y=[...O].sort((se,de)=>se.skill.localeCompare(de.skill));ce.push(...Y)}return ce};return v?[...X(C.own.byPlugin),...X(C.installed.byPlugin),...X(C.global.byPlugin)]:[...X(V.byPlugin),...X(W.byPlugin)]},[v,C.own.byPlugin,C.installed.byPlugin,C.global.byPlugin,V.byPlugin,W.byPlugin]),M=g.useMemo(()=>l?z.findIndex(X=>X.plugin===l.plugin&&X.skill===l.skill):-1,[z,l]),I=g.useCallback(X=>{if(z.length===0)return;const G=M<0?X>0?0:z.length-1:Math.min(Math.max(M+X,0),z.length-1);s(z[G])},[z,M,s]);return Wd([{key:"j",handler:()=>I(1)},{key:"k",handler:()=>I(-1)},{key:"Enter",handler:()=>{M>=0&&s(z[M])}}],{enabled:!o&&!c}),a.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,a.jsx(Vk,{value:j,onChange:k}),o&&a.jsx(uw,{}),!o&&c&&a.jsx(dw,{error:c,onRetry:f}),!o&&!c&&v&&a.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[a.jsx(bg,{name:J.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:L,onToggle:R,count:w.availableProject.total+w.availablePersonal.total+w.availablePlugin.total}),!L&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{label:J.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${b}-available-project-collapsed`,count:w.availableProject.total,filteredCount:j?w.availableProject.filtered:null,updateCount:(p==null?void 0:p.installed)??(x==null?void 0:x.installed),children:w.availableProject.filtered===0?a.jsx(jg,{queryActive:!!j,agentId:b}):a.jsx(Ns,{items:w.availableProject.byPlugin,selectedKey:l,onSelect:s,onContextMenu:d,useVirtual:Q})}),a.jsx(Es,{label:J.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${b}-available-personal-collapsed`,count:w.availablePersonal.total,filteredCount:j?w.availablePersonal.filtered:null,updateCount:p==null?void 0:p.global,children:w.availablePersonal.filtered===0?a.jsx(iw,{queryActive:!!j,agentId:b}):a.jsx(Ns,{items:w.availablePersonal.byPlugin,selectedKey:l,onSelect:s,onContextMenu:d,useVirtual:Q})}),A&&a.jsxs(Es,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${b}-available-plugin-collapsed`,count:w.availablePlugin.total,filteredCount:j?w.availablePlugin.filtered:null,children:[a.jsxs("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("studio:open-marketplace")),style:{display:"flex",alignItems:"center",gap:6,margin:"4px 14px 6px",padding:"4px 8px",fontSize:11,fontWeight:500,border:"1px dashed var(--color-accent, #2f6f8f)",borderRadius:4,background:"transparent",color:"var(--color-accent, #2f6f8f)",cursor:"pointer"},children:[a.jsx("span",{"aria-hidden":!0,children:"🛒"})," Browse marketplaces…"]}),w.availablePlugin.filtered===0?a.jsx("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:"No plugin skills installed yet."}):w.availablePlugin.byPlugin.map(([X,G])=>a.jsx(yg,{pluginName:X,skills:G,persistKey:`vskill-plugin-available-${X}-collapsed`,headerActionSlot:A?a.jsx(Yk,{pluginName:X,enabled:H.get(X)??!0}):void 0,renderSkill:ce=>a.jsx(Ao,{skill:ce,isSelected:(l==null?void 0:l.plugin)===ce.plugin&&(l==null?void 0:l.skill)===ce.skill,onSelect:()=>s(ce),onContextMenu:d})},`available-${X}`))]})]}),a.jsx(cw,{}),a.jsx(bg,{name:J.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:E,onToggle:B,count:w.authoringProject.total+w.authoringPlugin.total,action:{label:"New",title:"Create a new skill (standalone or plugin)",icon:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),onClick:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:request-create-skill",{detail:{mode:"standalone"}}))}}}),!E&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{label:J.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${b}-authoring-project-collapsed`,count:w.authoringProject.total,filteredCount:j?w.authoringProject.filtered:null,updateCount:(p==null?void 0:p.own)??(x==null?void 0:x.source),children:w.authoringProject.filtered===0?a.jsx(Sg,{queryActive:!!j}):a.jsx(Ns,{items:w.authoringProject.byPlugin,selectedKey:l,onSelect:s,onContextMenu:d,useVirtual:Q})}),A&&a.jsx(Es,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${b}-authoring-plugin-collapsed`,count:w.authoringPlugin.total,filteredCount:j?w.authoringPlugin.filtered:null,children:w.authoringPlugin.filtered===0?a.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",a.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):w.authoringPlugin.byPlugin.map(([X,G])=>a.jsx(yg,{pluginName:X,skills:G,persistKey:`vskill-plugin-authoring-${X}-collapsed`,renderSkill:ce=>a.jsx(Ao,{skill:ce,isSelected:(l==null?void 0:l.plugin)===ce.plugin&&(l==null?void 0:l.skill)===ce.skill,onSelect:()=>s(ce),onContextMenu:d})},`authoring-${X}`))})]})]}),!o&&!c&&!v&&a.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[a.jsx(vg,{origin:"source",count:V.total,filteredCount:j?V.filtered:null,updateCount:x==null?void 0:x.source,children:V.filtered===0?a.jsx(Sg,{queryActive:!!j}):a.jsx(Ns,{items:V.byPlugin,selectedKey:l,onSelect:s,onContextMenu:d,useVirtual:Q})}),a.jsx(ow,{}),a.jsx(vg,{origin:"installed",count:W.total,filteredCount:j?W.filtered:null,updateCount:x==null?void 0:x.installed,children:W.filtered===0?a.jsx(jg,{queryActive:!!j}):a.jsx(Ns,{items:W.byPlugin,selectedKey:l,onSelect:s,onContextMenu:d,useVirtual:Q})})]})]})}function qd(n){if(typeof window>"u")return!1;try{return window.localStorage.getItem(n)==="true"}catch{return!1}}function Es({label:n,storageKey:l,count:s,filteredCount:o,updateCount:c,children:f}){const[d,x]=g.useState(()=>qd(l)),h=g.useCallback(()=>{x(y=>{const v=!y;if(typeof window<"u")try{window.localStorage.setItem(l,String(v))}catch{}return v})},[l]),p=o!=null&&o!==s?`${o} of ${s}`:String(s);return a.jsxs("section",{"data-vskill-named-scope":n,children:[a.jsxs("button",{type:"button",onClick:h,"aria-expanded":!d,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))",width:16,display:"inline-block",textAlign:"center"},children:d?"▸":"▾"}),a.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:n}),a.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",p,")"]}),c!=null&&c>0&&a.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[c," update",c!==1?"s":""]})]}),!d&&a.jsx("div",{style:{paddingLeft:18},children:f})]})}function sw(n){const l=[];for(const[s,o]of n){const c=[...o].sort((f,d)=>f.skill.localeCompare(d.skill));l.push({kind:"header",plugin:s,count:c.length});for(const f of c)l.push({kind:"row",skill:f})}return l}function Ns({items:n,selectedKey:l,onSelect:s,onContextMenu:o,useVirtual:c}){if(c){const f=sw(n);return a.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:a.jsx(Sk,{overscan:4,totalCount:f.length,itemContent:d=>{const x=f[d];if(!x)return null;if(x.kind==="header")return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:x.plugin}),a.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",x.count,")"]})]});const h=x.skill,p=!!l&&l.plugin===h.plugin&&l.skill===h.skill;return a.jsx(Ao,{skill:h,isSelected:p,onSelect:()=>s(h),onContextMenu:o})}})})}return a.jsx("div",{"data-virtualized":"false",children:n.map(([f,d])=>a.jsx(Wk,{plugin:f,skills:d,selectedKey:l,onSelect:s,onContextMenu:o},f))})}function Sg({queryActive:n}){return n?a.jsx(jl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(jl,{headline:"No skills yet.",body:a.jsxs(a.Fragment,{children:["Create one with ",a.jsx(bf,{children:"vskill new"})," or the"," ",a.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function jg({queryActive:n,agentId:l}){return n?a.jsx(jl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(jl,{headline:l?`No skills installed for ${l} in this project.`:"No installed skills.",body:a.jsxs(a.Fragment,{children:["Run ",a.jsx(bf,{children:"vskill install <plugin>"})," to add one."]})})}function iw({queryActive:n,agentId:l}){return n?a.jsx(jl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(jl,{headline:`No global skills for ${l}.`,body:a.jsxs(a.Fragment,{children:["Run ",a.jsx(bf,{children:"vskill install --global <plugin>"})," to add one."]})})}function jl({headline:n,body:l}){return a.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[a.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:n}),a.jsx("div",{children:l})]})}function bf({children:n}){return a.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-primary)",background:"color-mix(in srgb, var(--border-default) 45%, transparent)",padding:"1px 4px",borderRadius:3},children:n})}function ow(){return a.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function cw(){return a.jsx("div",{"aria-hidden":"true","data-testid":"scope-bold-divider",style:{height:3,background:"var(--color-rule)",boxShadow:"inset 0 1px 0 color-mix(in srgb, var(--color-rule) 50%, transparent)",margin:"12px 0"}})}function uw(){return a.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(n=>a.jsx(Xk,{},n))})}function dw({error:n,onRetry:l}){return a.jsxs("div",{role:"alert",style:{margin:"12px 14px",padding:12,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-canvas)",color:"var(--text-primary)",fontSize:12},children:[a.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),a.jsxs("details",{children:[a.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:fw(n)}),a.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:n})]}),l&&a.jsx("button",{type:"button",onClick:l,style:{marginTop:8,background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"4px 10px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry"})]})}function fw(n){const l=n.split(`
66
+ `)[0]??n;return l.length>80?l.slice(0,77)+"…":l}const ty=240,ny=480,ay="vskill-sidebar-width",Ds=320;function Sf(n){return Number.isFinite(n)?Math.round(Math.max(ty,Math.min(ny,n))):Ds}function pw(){try{const n=localStorage.getItem(ay);if(!n)return Ds;const l=Number(n);return Number.isFinite(l)?Sf(l):Ds}catch{return Ds}}function mw(n){try{localStorage.setItem(ay,String(Sf(n)))}catch{}}function hw({initialWidth:n,onChange:l}){const s=g.useRef({startX:0,startWidth:n,pointerId:null}),o=g.useRef(n);return g.useEffect(()=>{o.current=n},[n]),g.useEffect(()=>{function c(d){if(s.current.pointerId==null||d.pointerId!==s.current.pointerId)return;const x=d.clientX-s.current.startX,h=Sf(s.current.startWidth+x);o.current=h,l(h)}function f(d){s.current.pointerId==null||d.pointerId!==s.current.pointerId||(s.current.pointerId=null,mw(o.current))}return window.addEventListener("pointermove",c),window.addEventListener("pointerup",f),window.addEventListener("pointercancel",f),()=>{window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f)}},[l]),a.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":ty,"aria-valuemax":ny,"aria-valuenow":n,"aria-label":"Resize sidebar",title:"Drag to resize sidebar",onPointerDown:c=>{const f=c.currentTarget;s.current.startX=c.clientX,s.current.startWidth=o.current,s.current.pointerId=c.pointerId;try{f.setPointerCapture(c.pointerId)}catch{}},style:{width:4,alignSelf:"stretch",cursor:"col-resize",background:"var(--border-default)",userSelect:"none",touchAction:"none"}})}function xw({connected:n,hint:l,onRetry:s}){return n?null:a.jsxs("aside",{"aria-live":"assertive",role:"alert",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",background:"color-mix(in srgb, var(--status-own) 15%, transparent)",borderBottom:"1px solid var(--border-default)",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12},children:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-own)",display:"inline-block",flexShrink:0}}),a.jsx("span",{style:{fontWeight:500},children:"Disconnected — reconnecting…"}),l&&a.jsx("span",{style:{color:"var(--text-secondary)",fontSize:11},children:l}),a.jsx("div",{style:{flex:1}}),s&&a.jsx("button",{type:"button",onClick:s,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry now"})]})}function ry(n){if(n!==void 0)try{return JSON.stringify(n)}catch(l){console.error("Failed to serialize request body:",l);try{const s=new WeakSet;return JSON.stringify(n,(o,c)=>{if(typeof c=="object"&&c!==null){if(s.has(c))return"[Circular]";s.add(c)}return c})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function Sd(){const[n,l]=g.useState([]),[s,o]=g.useState(!1),[c,f]=g.useState(!1),[d,x]=g.useState(null),h=g.useRef(null),p=g.useCallback(async(v,b)=>{l([]),o(!0),f(!1),x(null);const j=new AbortController;h.current=j;try{const k=ry(b),N=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:k,signal:j.signal});if(!N.ok||!N.body){let H=`HTTP ${N.status}`;try{const L=await N.json();L.error&&(H=L.error)}catch{}throw new Error(H)}const C=N.body.getReader(),w=new TextDecoder;let A="",_="";for(;;){const{done:H,value:L}=await C.read();if(H)break;A+=w.decode(L,{stream:!0});const $=A.split(`
67
+ `);A=$.pop()||"";for(const E of $)if(E.startsWith("event: "))_=E.slice(7).trim();else if(E.startsWith("data: ")){try{const D=JSON.parse(E.slice(6)),R={event:_,data:D};_==="done"?(f(!0),l(B=>[...B,R])):l(B=>[...B,R])}catch{}_=""}}}catch(k){k.name!=="AbortError"&&x(k.message)}finally{o(!1),h.current=null}},[]),y=g.useCallback(()=>{var v;(v=h.current)==null||v.abort()},[]);return{events:n,running:s,done:c,error:d,start:p,stop:y}}function gw(n){const l=g.useRef(n);l.current=n;const[s,o]=g.useState(new Set),c=g.useRef(new Map),f=g.useCallback(async(p,y,v)=>{var j;(j=c.current.get(p))==null||j.abort();const b=new AbortController;c.current.set(p,b),o(k=>{const N=new Set(k);return N.add(p),N});try{const k=ry(v),N=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:k,signal:b.signal});if(!N.ok||!N.body){let H=`HTTP ${N.status}`;try{const L=await N.json();L.error&&(H=L.error)}catch{}throw new Error(H)}const C=N.body.getReader(),w=new TextDecoder;let A="",_="";for(;;){const{done:H,value:L}=await C.read();if(H)break;A+=w.decode(L,{stream:!0});const $=A.split(`
68
+ `);A=$.pop()||"";for(const E of $)if(E.startsWith("event: "))_=E.slice(7).trim();else if(E.startsWith("data: ")){try{const D=JSON.parse(E.slice(6)),R={event:_,data:D};l.current.onEvent(p,R)}catch{}_=""}}l.current.onDone(p)}catch(k){k.name!=="AbortError"&&l.current.onError(p,k.message)}finally{o(k=>{const N=new Set(k);return N.delete(p),N}),c.current.delete(p)}},[]),d=g.useCallback(p=>{var y;(y=c.current.get(p))==null||y.abort()},[]),x=g.useCallback(()=>{for(const p of c.current.values())p.abort()},[]),h=s.size>0;return{runningSet:s,startCase:f,stopCase:d,stopAll:x,isAnyCaseRunning:h}}const vw={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 yw(n,l){var s,o;switch(l.type){case"SET_LOADING":return{...n,loading:l.loading};case"SET_ERROR":return{...n,error:l.error};case"INIT_DATA":{const c=new Map;if(l.benchmark)for(const d of l.benchmark.cases)c.set(d.eval_id,{status:d.status,passRate:d.pass_rate,errorMessage:d.error_message||void 0,durationMs:d.durationMs,tokens:d.tokens,output:d.output,assertions:d.assertions.map(x=>({assertion_id:x.id,text:x.text,pass:x.pass,reasoning:x.reasoning}))});const f=((o=(s=l.evals)==null?void 0:s.evals[0])==null?void 0:o.id)??null;return{...n,skillContent:l.skillContent,savedContent:l.skillContent,isDirty:!1,evals:l.evals,evalsError:l.evalsError??null,latestBenchmark:l.benchmark,inlineResults:c,selectedCaseId:f,loading:!1,error:null}}case"SET_PANEL":return{...n,activePanel:l.panel};case"SET_CONTENT":return{...n,skillContent:l.content,isDirty:l.content!==n.savedContent};case"CONTENT_SAVED":return{...n,savedContent:n.skillContent,isDirty:!1};case"SET_EVALS":return{...n,evals:l.evals};case"SELECT_CASE":return{...n,selectedCaseId:l.caseId};case"CASE_RUN_START":{const c=new Map(n.caseRunStates);return c.set(l.caseId,{status:"running",startedAt:Date.now(),mode:l.mode}),{...n,caseRunStates:c,runMode:l.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const c=new Map(n.caseRunStates),f=c.get(l.caseId);c.set(l.caseId,{status:"complete",mode:f==null?void 0:f.mode});const d=new Map(n.inlineResults);return d.set(l.caseId,l.result),{...n,caseRunStates:c,inlineResults:d}}case"CASE_RUN_ERROR":{const c=new Map(n.caseRunStates),f=c.get(l.caseId);c.set(l.caseId,{status:"error",mode:f==null?void 0:f.mode});const d=new Map(n.inlineResults);return d.set(l.caseId,{status:"error",errorMessage:l.error,assertions:[]}),{...n,caseRunStates:c,inlineResults:d}}case"CASE_RUN_CANCEL":{const c=new Map(n.caseRunStates),f=c.get(l.caseId);return c.set(l.caseId,{status:"cancelled",mode:f==null?void 0:f.mode}),{...n,caseRunStates:c}}case"BULK_RUN_START":{const c=new Map(n.caseRunStates);for(const f of l.caseIds)c.set(f,{status:"queued",mode:l.mode});return{...n,caseRunStates:c,bulkRunActive:!0,runMode:l.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...n,bulkRunActive:!1,latestBenchmark:l.benchmark??n.latestBenchmark,iterationCount:n.iterationCount+1};case"CANCEL_ALL":{const c=new Map(n.caseRunStates);for(const[f,d]of c)(d.status==="running"||d.status==="queued")&&c.set(f,{status:"cancelled"});return{...n,caseRunStates:c,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const c=new Map(n.inlineResults);return c.set(l.evalId,l.result),{...n,inlineResults:c}}case"OPEN_IMPROVE":return{...n,improveTarget:l.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...n,improveTarget:null};case"OPEN_AI_EDIT":return{...n,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...n,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...n,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...n,aiEditProgress:[...n.aiEditProgress,l.entry]};case"AI_EDIT_RESULT":{const c=l.evalChanges??[],f=new Map;for(let d=0;d<c.length;d++)f.set(d,!0);return{...n,aiEditLoading:!1,aiEditResult:{improved:l.improved,reasoning:l.reasoning,evalChanges:c},aiEditEvalChanges:c,aiEditEvalSelections:f}}case"AI_EDIT_ERROR":return{...n,aiEditLoading:!1,aiEditError:l.message,aiEditClassifiedError:l.classified??null};case"GENERATE_EVALS_START":return{...n,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...n,generateEvalsProgress:[...n.generateEvalsProgress,l.entry]};case"GENERATE_EVALS_DONE":return{...n,generateEvalsLoading:!1,evals:l.evals};case"GENERATE_EVALS_ERROR":return{...n,generateEvalsLoading:!1,generateEvalsError:l.classified};case"TOGGLE_EVAL_CHANGE":{const c=new Map(n.aiEditEvalSelections);return c.set(l.index,!c.get(l.index)),{...n,aiEditEvalSelections:c}}case"SELECT_ALL_EVAL_CHANGES":{const c=new Map(n.aiEditEvalSelections);for(const f of c.keys())c.set(f,!0);return{...n,aiEditEvalSelections:c}}case"DESELECT_ALL_EVAL_CHANGES":{const c=new Map(n.aiEditEvalSelections);for(const f of c.keys())c.set(f,!1);return{...n,aiEditEvalSelections:c}}case"SET_EVALS_RETRY":return{...n,aiEditEvalsRetry:l.evalsFile};case"SET_REGRESSIONS":return{...n,regressions:l.regressions};case"INCREMENT_ITERATION":return{...n,iterationCount:n.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...n,activationPrompts:l.prompts};case"ACTIVATION_START":return{...n,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...n,activationResults:[...n.activationResults,l.result]};case"ACTIVATION_DONE":return{...n,activationRunning:!1,activationSummary:l.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...n,activationClassifyingStatus:`Classifying prompt ${l.index}/${l.total}...`};case"ACTIVATION_ERROR":return{...n,activationRunning:!1,activationError:l.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...n,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...n,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...n,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...n,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...n,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...n,generatingPrompts:!1,generatingPromptsError:l.error};case"ACTIVATION_HISTORY_LOADED":return{...n,activationHistory:l.runs,activationHistoryLoading:!1};default:return n}}function bw(n){if(n==="unit"||n==="integration")return n}function Sw(n,l){const s=l.data;if(l.event==="output_ready"&&(n.output=s.output,s.durationMs!=null&&(n.durationMs=s.durationMs),s.tokens!=null&&(n.tokens=s.tokens)),l.event==="outputs_ready"&&(n.output=s.skillOutput,s.skillDurationMs!=null&&(n.durationMs=s.skillDurationMs),s.skillTokens!=null&&(n.tokens=s.skillTokens)),l.event==="assertion_result"){const o={assertion_id:s.assertion_id,text:s.text,pass:s.pass,reasoning:s.reasoning};n.assertions.find(c=>c.assertion_id===o.assertion_id)||n.assertions.push(o)}l.event==="case_complete"&&(n.status=s.status,n.passRate=s.pass_rate,n.errorMessage=s.error_message||void 0,n.classifiedError=s.classified_error||void 0)}const ly=g.createContext(null);function En(){const n=g.useContext(ly);if(!n)throw new Error("useWorkspace must be used within WorkspaceProvider");return n}function kg({plugin:n,skill:l,origin:s,children:o}){const c=s==="installed",[f,d]=g.useReducer(yw,{...vw,plugin:n,skill:l}),x=g.useRef(new Set),h=g.useRef(new Set),p=g.useRef(new Map),y=g.useCallback((ae,pe)=>{let fe=p.current.get(ae);fe||(fe={assertions:[]},p.current.set(ae,fe)),Sw(fe,pe),d({type:"UPDATE_INLINE_RESULT",evalId:ae,result:{...fe,assertions:[...fe.assertions]}})},[]),v=g.useCallback(ae=>{if(h.current.has(ae))return;h.current.add(ae);const pe=p.current.get(ae)??{assertions:[]};d({type:"CASE_RUN_COMPLETE",caseId:ae,result:{...pe,assertions:[...pe.assertions]}}),x.current.has(ae)&&(x.current.delete(ae),x.current.size===0&&Ne.getLatestBenchmark(n,l).then(fe=>d({type:"BULK_RUN_COMPLETE",benchmark:fe})).catch(()=>d({type:"BULK_RUN_COMPLETE",benchmark:null})))},[n,l]),b=g.useCallback((ae,pe)=>{h.current.has(ae)||(h.current.add(ae),d({type:"CASE_RUN_ERROR",caseId:ae,error:pe}),x.current.has(ae)&&(x.current.delete(ae),x.current.size===0&&Ne.getLatestBenchmark(n,l).then(fe=>d({type:"BULK_RUN_COMPLETE",benchmark:fe})).catch(()=>d({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[n,l]),{startCase:j,stopCase:k,stopAll:N}=gw({onEvent:y,onDone:v,onError:b});g.useEffect(()=>()=>{N()},[N]);const C=g.useCallback(async()=>{try{const ae=await fetch(`/api/skills/${n}/${l}/activation-history`);if(!ae.ok){if(ae.status===404){d({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const pe=await ae.json();d({type:"ACTIVATION_HISTORY_LOADED",runs:pe.runs||[]})}catch{}},[n,l]);g.useEffect(()=>{let ae=!1;async function pe(){try{const[fe,he,ye]=await Promise.allSettled([Ne.getSkillDetail(n,l),Ne.getEvals(n,l),Ne.getLatestBenchmark(n,l)]);if(ae)return;let Be=null,Me=null;if(he.status==="fulfilled")Be=he.value;else{const ue=he.reason;(ue==null?void 0:ue.status)!==404&&(Me=(ue==null?void 0:ue.message)??"Failed to load test cases")}d({type:"INIT_DATA",skillContent:fe.status==="fulfilled"?fe.value.skillContent:"",evals:Be,evalsError:Me,benchmark:ye.status==="fulfilled"?ye.value:null})}catch(fe){ae||d({type:"SET_ERROR",error:fe.message})}}return pe(),C(),()=>{ae=!0}},[n,l,C]);const w=g.useCallback(async()=>{if(!c)try{await Ne.applyImprovement(n,l,f.skillContent),d({type:"CONTENT_SAVED"})}catch(ae){d({type:"SET_ERROR",error:ae.message})}},[c,n,l,f.skillContent]),A=g.useCallback(async ae=>{if(!c)try{const pe=await Ne.saveEvals(n,l,ae);d({type:"SET_EVALS",evals:pe})}catch(pe){d({type:"SET_ERROR",error:pe.message})}},[c,n,l]),_=g.useCallback((ae,pe="benchmark")=>{if(c)return;const fe=f.caseRunStates.get(ae);if((fe==null?void 0:fe.status)!=="running")if(p.current.delete(ae),h.current.delete(ae),d({type:"CASE_RUN_START",caseId:ae,mode:pe}),pe==="comparison"){const he=`/api/skills/${n}/${l}/compare`;j(ae,he,{eval_ids:[ae]})}else{const he=`/api/skills/${n}/${l}/benchmark/case/${ae}`;j(ae,he,pe==="baseline"?{baseline_only:!0}:void 0)}},[c,n,l,f.caseRunStates,j]),H=g.useCallback((ae="benchmark")=>{var he;if(c)return;const pe=((he=f.evals)==null?void 0:he.evals)??[];if(pe.length===0)return;const fe=pe.map(ye=>ye.id);for(const ye of fe)p.current.delete(ye),h.current.delete(ye);d({type:"BULK_RUN_START",caseIds:fe,mode:ae}),x.current=new Set(fe);for(const ye of fe)if(ae==="comparison")j(ye,`/api/skills/${n}/${l}/compare`,{eval_ids:[ye]});else{const Be=`/api/skills/${n}/${l}/benchmark/case/${ye}`;j(ye,Be,ae==="baseline"?{baseline_only:!0}:void 0)}},[c,n,l,f.evals,j]),L=g.useCallback(ae=>{k(ae),d({type:"CASE_RUN_CANCEL",caseId:ae}),x.current.delete(ae),h.current.add(ae)},[k]),$=g.useCallback(()=>{N(),d({type:"CANCEL_ALL"}),x.current.clear()},[N]),E=g.useCallback(async(ae,pe)=>{d({type:"OPEN_IMPROVE",evalId:ae})},[]),D=g.useCallback(async(ae,pe)=>{try{await Ne.applyImprovement(n,l,pe),d({type:"SET_CONTENT",content:pe}),d({type:"CONTENT_SAVED"}),d({type:"CLOSE_IMPROVE"}),_(ae,"benchmark")}catch(fe){d({type:"SET_ERROR",error:fe.message})}},[n,l,_]),R=Sd(),B=g.useRef(null),V=g.useRef(0);g.useEffect(()=>{const ae=R.events;for(let pe=V.current;pe<ae.length;pe++){const fe=ae[pe],he=fe.data;if(fe.event==="progress"&&d({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),fe.event==="done"){const ye=he.improved,Be=he.reasoning,Me=he.evalChanges??[];d({type:"AI_EDIT_RESULT",improved:ye,reasoning:Be,evalChanges:Me})}if(fe.event==="error"){const ye=he;d({type:"AI_EDIT_ERROR",message:ye.description||"Unknown error",classified:ye})}}V.current=ae.length},[R.events]),g.useEffect(()=>{R.error&&d({type:"AI_EDIT_ERROR",message:R.error})},[R.error]),g.useEffect(()=>()=>{R.stop()},[R.stop]);const W=g.useCallback(async(ae,pe,fe)=>{c||(V.current=0,d({type:"AI_EDIT_LOADING"}),B.current=R.stop,R.start(`/api/skills/${n}/${l}/improve?sse`,{mode:"instruct",instruction:ae,content:f.skillContent,evals:f.evals??{skill_name:l,evals:[]},provider:pe,model:fe}))},[c,n,l,f.skillContent,f.evals,R]),te=g.useCallback(()=>{R.stop(),d({type:"AI_EDIT_ERROR",message:"Cancelled"})},[R]),Q=g.useCallback(async()=>{const ae=f.aiEditResult;if(ae!=null&&ae.improved)try{if(await Ne.applyImprovement(n,l,ae.improved),d({type:"SET_CONTENT",content:ae.improved}),d({type:"CONTENT_SAVED"}),f.aiEditEvalChanges.length>0&&Array.from(f.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:fe}=await Ea(async()=>{const{mergeEvalChanges:Be}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Be}},[]),he=f.evals??{skill_name:l,evals:[]},ye=fe(he,f.aiEditEvalChanges,f.aiEditEvalSelections);try{const Be=await Ne.saveEvals(n,l,ye);d({type:"SET_EVALS",evals:Be})}catch(Be){d({type:"SET_EVALS_RETRY",evalsFile:ye}),d({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Be.message}. You can retry from the AI Edit panel.`});return}}d({type:"CLOSE_AI_EDIT"})}catch(pe){d({type:"SET_ERROR",error:pe.message})}},[n,l,f.aiEditResult,f.evals,f.aiEditEvalChanges,f.aiEditEvalSelections]),z=g.useCallback(()=>{d({type:"CLOSE_AI_EDIT"})},[]),M=g.useCallback(ae=>{d({type:"TOGGLE_EVAL_CHANGE",index:ae})},[]),I=g.useCallback(()=>{d({type:"SELECT_ALL_EVAL_CHANGES"})},[]),X=g.useCallback(()=>{d({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),G=g.useCallback(async()=>{const ae=f.aiEditEvalsRetry;if(ae)try{const pe=await Ne.saveEvals(n,l,ae);d({type:"SET_EVALS",evals:pe}),d({type:"SET_ERROR",error:null}),d({type:"CLOSE_AI_EDIT"})}catch(pe){d({type:"SET_ERROR",error:`Retry failed: ${pe.message}`})}},[n,l,f.aiEditEvalsRetry]),ce=g.useCallback(async()=>{try{const ae=await Ne.getSkillDetail(n,l);d({type:"SET_CONTENT",content:ae.skillContent}),d({type:"CONTENT_SAVED"})}catch{}},[n,l]),{config:O}=Rr(),Y=Sd(),se=g.useRef(0);g.useEffect(()=>{const ae=Y.events;for(let pe=se.current;pe<ae.length;pe++){const fe=ae[pe],he=fe.data;if(fe.event==="progress"&&d({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),fe.event==="done"){const ye=he;Ne.saveEvals(n,l,ye).then(Be=>d({type:"GENERATE_EVALS_DONE",evals:Be})).catch(Be=>d({type:"SET_ERROR",error:Be.message}))}fe.event==="error"&&d({type:"GENERATE_EVALS_ERROR",classified:he})}se.current=ae.length},[Y.events,n,l]),g.useEffect(()=>{Y.error&&d({type:"SET_ERROR",error:Y.error})},[Y.error]),g.useEffect(()=>()=>{Y.stop()},[Y.stop]);const de=g.useCallback(async ae=>{if(c)return;se.current=0,d({type:"GENERATE_EVALS_START"});const pe={};O!=null&&O.provider&&(pe.provider=O.provider),O!=null&&O.model&&(pe.model=O.model);const fe=bw(ae==null?void 0:ae.testType);fe&&(pe.testType=fe),Y.start(`/api/skills/${n}/${l}/generate-evals?sse`,Object.keys(pe).length>0?pe:void 0)},[c,n,l,Y,O]),ge=Sd(),xe=g.useRef(0);g.useEffect(()=>()=>{ge.stop()},[ge.stop]),g.useEffect(()=>{const ae=ge.events;for(let pe=xe.current;pe<ae.length;pe++){const fe=ae[pe];if(fe.event==="classifying"){const he=fe.data;d({type:"ACTIVATION_CLASSIFYING",index:he.index,total:he.total})}if(fe.event==="prompt_result"&&d({type:"ACTIVATION_RESULT",result:fe.data}),fe.event==="done"){we.current&&(clearTimeout(we.current),we.current=null);const he=fe.data;if(he.error)d({type:"ACTIVATION_ERROR",error:he.error});else{d({type:"ACTIVATION_DONE",summary:he});const ye={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(O==null?void 0:O.model)||"unknown",provider:(O==null?void 0:O.provider)||"unknown",promptCount:he.total,summary:{precision:he.precision,recall:he.recall,reliability:he.reliability,tp:he.tp,tn:he.tn,fp:he.fp,fn:he.fn}};d({type:"ACTIVATION_HISTORY_LOADED",runs:[ye,...f.activationHistory??[]]})}}}xe.current=ae.length},[ge.events,O,f.activationHistory]),g.useEffect(()=>{ge.error&&(we.current&&(clearTimeout(we.current),we.current=null),d({type:"ACTIVATION_ERROR",error:ge.error}))},[ge.error]);const we=g.useRef(null),ie=g.useCallback(()=>{we.current&&(clearTimeout(we.current),we.current=null),ge.stop(),d({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ge]),je=g.useCallback(ae=>{const fe=ae.trim().split(`
69
+ `).filter(Boolean).map(ye=>ye.startsWith("!")?{prompt:ye.slice(1).trim(),expected:"should_not_activate"}:ye.startsWith("+")?{prompt:ye.slice(1).trim(),expected:"should_activate"}:{prompt:ye.trim(),expected:"auto"});xe.current=0,d({type:"ACTIVATION_START"}),d({type:"SET_ACTIVATION_PROMPTS",prompts:ae});const he={prompts:fe};O!=null&&O.provider&&(he.provider=O.provider),O!=null&&O.model&&(he.model=O.model),ge.start(`/api/skills/${n}/${l}/activation-test`,he),we.current&&clearTimeout(we.current),we.current=setTimeout(()=>{ge.stop(),d({type:"ACTIVATION_TIMEOUT"}),we.current=null},12e4)},[n,l,ge,O]),Oe=g.useCallback(async(ae=8)=>{d({type:"GENERATE_PROMPTS_START"});try{const pe={count:ae};O!=null&&O.provider&&(pe.provider=O.provider),O!=null&&O.model&&(pe.model=O.model);const fe=await fetch(`/api/skills/${n}/${l}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(pe)});if(!fe.ok){let Ie=`HTTP ${fe.status}`;try{const Bt=await fe.json();Bt.error&&(Ie=Bt.error)}catch{}throw new Error(Ie)}const he=fe.body.getReader(),ye=new TextDecoder;let Be="",Me="",ue=[];for(;;){const{done:Ie,value:Bt}=await he.read();if(Ie)break;Be+=ye.decode(Bt,{stream:!0});const Gt=Be.split(`
70
+ `);Be=Gt.pop()||"";for(const lt of Gt)if(lt.startsWith("event: "))Me=lt.slice(7).trim();else if(lt.startsWith("data: ")){try{const kt=JSON.parse(lt.slice(6));if(Me==="done"){if(kt.error)throw new Error(kt.error);ue=kt.prompts||[]}if(Me==="error")throw new Error(kt.message||kt.description||"Generation failed")}catch(kt){if(!(kt instanceof SyntaxError))throw kt}Me=""}}const De=ue.map(Ie=>`${Ie.expected==="should_activate"?"+":"!"}${Ie.prompt}`).join(`
71
+ `);d({type:"SET_ACTIVATION_PROMPTS",prompts:De}),d({type:"GENERATE_PROMPTS_DONE"})}catch(pe){d({type:"GENERATE_PROMPTS_ERROR",error:pe.message})}},[n,l,O]),$e=g.useMemo(()=>({state:f,dispatch:d,isReadOnly:c,saveContent:w,saveEvals:A,runCase:_,runAll:H,cancelCase:L,cancelAll:$,improveForCase:E,applyImproveAndRerun:D,refreshSkillContent:ce,generateEvals:de,runActivationTest:je,cancelActivation:ie,generateActivationPrompts:Oe,fetchActivationHistory:C,submitAiEdit:W,cancelAiEdit:te,applyAiEdit:Q,discardAiEdit:z,toggleEvalChange:M,selectAllEvalChanges:I,deselectAllEvalChanges:X,retryEvalsSave:G}),[f,c,w,A,_,H,L,$,E,D,ce,de,je,ie,Oe,C,W,te,Q,z,M,I,X,G]);return a.jsx(ly.Provider,{value:$e,children:o})}function jw(n){if(!n)return[];const l=n.split(`
72
+ `),s=[];for(const o of l)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){s.push({type:"header",content:o});continue}if(o.startsWith("+")){s.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){s.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&s.length>0)&&s.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return s}function jf({contentDiff:n,fromLabel:l,toLabel:s,diffSummary:o,maxHeight:c=480,collapsible:f=!1,renderContext:d="inline",onRetry:x}){const[h,p]=g.useState(f),[y,v]=g.useState("unified"),b=g.useRef(null),j=g.useRef(null),k=g.useMemo(()=>jw(n),[n]),N=g.useMemo(()=>{const L=k.filter(E=>E.type==="add").length,$=k.filter(E=>E.type==="remove").length;return{added:L,removed:$}},[k]),C=g.useMemo(()=>{let L=0,$=0;return k.filter(E=>E.type!=="header").map(E=>E.type==="remove"?(L++,{...E,origNum:L,newNum:null}):E.type==="add"?($++,{...E,origNum:null,newNum:$}):(L++,$++,{...E,origNum:L,newNum:$}))},[k]),w=g.useMemo(()=>{const L=[],$=[];for(const E of C)if(E.type==="remove")L.push(E);else if(E.type==="add")$.push(E);else{for(;L.length<$.length;)L.push({type:"context",content:"",origNum:null,newNum:null});for(;$.length<L.length;)$.push({type:"context",content:"",origNum:null,newNum:null});L.push(E),$.push(E)}for(;L.length<$.length;)L.push({type:"context",content:"",origNum:null,newNum:null});for(;$.length<L.length;)$.push({type:"context",content:"",origNum:null,newNum:null});return{left:L,right:$}},[C]),A=g.useCallback(L=>{const $=L==="left"?b.current:j.current,E=L==="left"?j.current:b.current;$&&E&&(E.scrollTop=$.scrollTop)},[]);if(!n||k.length===0)return a.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),x&&a.jsx("button",{onClick:x,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const _=d==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",H=a.jsxs("div",{className:"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",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[l," → ",s]}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{style:{color:"var(--green)"},children:["+",N.added]}),a.jsxs("span",{style:{color:"var(--red)"},children:["-",N.removed]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>v(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),f&&a.jsx("button",{onClick:()=>p(!h),className:"btn btn-ghost text-[11px]",children:h?"Expand":"Collapse"})]})]}),o&&a.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:o}),!h&&(y==="unified"?a.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:c,overflowY:"auto"},children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:C.map((L,$)=>a.jsxs("tr",{style:{background:L.type==="add"?"rgba(34,197,94,0.08)":L.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:L.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:L.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:L.origNum??""}),a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:L.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:L.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:L.newNum??""}),a.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:L.type==="add"?"var(--green)":L.type==="remove"?"var(--red)":"transparent",borderRight:L.type==="add"?"2px solid var(--green)":L.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:L.type==="add"?"+":L.type==="remove"?"-":" "}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="add"?"var(--green)":L.type==="remove"?"var(--red)":"var(--text-secondary)"},children:L.content||"​"})]},$))})})}):a.jsxs("div",{className:"mx-4 my-4 grid grid-cols-2 gap-0 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{ref:b,style:{maxHeight:c,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>A("left"),children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:w.left.map((L,$)=>a.jsxs("tr",{style:{background:L.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:L.origNum??""}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="remove"?"var(--red)":"var(--text-secondary)"},children:L.content||"​"})]},$))})})}),a.jsx("div",{ref:j,style:{maxHeight:c,overflowY:"auto"},onScroll:()=>A("right"),children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:w.right.map((L,$)=>a.jsxs("tr",{style:{background:L.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:L.newNum??""}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="add"?"var(--green)":"var(--text-secondary)"},children:L.content||"​"})]},$))})})})]}))]});return d==="modal"?a.jsx("div",{className:_,children:a.jsx("div",{style:{width:"80%",maxWidth:900},children:H})}):H}const wg={CERTIFIED:{bg:"var(--yellow-muted)",text:"var(--yellow)"},VERIFIED:{bg:"var(--accent-muted)",text:"var(--accent)"},COMMUNITY:{bg:"var(--surface-3)",text:"var(--text-tertiary)"}};function kw(n,l){return n?n.length>l?n.slice(0,l)+"…":n:""}function sy(){const{state:n}=En(),{plugin:l,skill:s}=n,{refreshSkills:o,updateCount:c}=Na(),f=`versions/${l}/${s}`,d=g.useCallback(()=>Ne.getSkillVersions(l,s),[l,s]),{data:x,loading:h}=Nl(f,d),[p,y]=g.useState(null),[v,b]=g.useState(null),[j,k]=g.useState(null),[N,C]=g.useState(!1),[w,A]=g.useState("idle"),[_,H]=g.useState(null),L=g.useRef(null),$=g.useRef(null),E=g.useMemo(()=>(x==null?void 0:x.find(Q=>Q.isInstalled))??null,[x]),D=g.useMemo(()=>(x==null?void 0:x[0])??null,[x]),R=E&&D&&E.version!==D.version,B=g.useCallback(Q=>{p?!v&&Q!==p?b(Q):(y(Q),b(null),k(null)):(y(Q),k(null))},[p,v]),V=g.useCallback(async(Q,z)=>{C(!0);try{const M=await Ne.getVersionDiff(l,s,Q,z);k(M)}catch{k(null)}finally{C(!1)}},[l,s]);g.useEffect(()=>{if(p&&v){const Q=x||[],z=Q.findIndex(G=>G.version===p),M=Q.findIndex(G=>G.version===v),[I,X]=z>M?[p,v]:[v,p];V(I,X)}},[p,v,x,V]);const W=g.useCallback(()=>{!E||!D||(y(E.version),b(D.version))},[E,D]),te=g.useCallback(()=>{A("updating"),H(null);const Q=Ne.startSkillUpdate(l,s);L.current=Q,Q.addEventListener("progress",z=>{try{switch(JSON.parse(z.data).status){case"scanning":A("scanning");break;case"installing":A("installing");break;case"done":A("done");break}}catch{A("error"),H("Unexpected response from server")}}),Q.addEventListener("done",()=>{Q.close(),L.current=null,o(),ln(f),A("done")}),Q.addEventListener("error",z=>{const M=z;let I="Connection lost";if(M.data)try{I=JSON.parse(M.data).error||"Update failed"}catch{}A("error"),H(I),Q.close(),L.current=null})},[l,s,f,o]);return g.useEffect(()=>()=>{L.current&&(L.current.close(),L.current=null)},[]),h?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-14 rounded-lg"}),a.jsx("div",{className:"skeleton h-14 rounded-lg"}),a.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]}):!x||x.length===0?a.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16",children:a.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})}):a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),a.jsxs("div",{className:"flex items-center gap-2",children:[R&&a.jsx("button",{onClick:W,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),R&&w!=="done"&&(w==="error"?a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:_||"Update failed"}),a.jsx("button",{onClick:te,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):a.jsx("button",{onClick:te,disabled:w!=="idle",className:"btn btn-primary text-[11px]",children:w==="idle"?`Update to ${D==null?void 0:D.version}`:w==="updating"?"Starting update...":w==="scanning"?"Scanning...":"Installing..."})),c>1&&a.jsxs("button",{onClick:()=>{window.location.hash="#/updates"},className:"text-[11px] hover:underline",style:{color:"var(--text-tertiary)",background:"transparent",border:"none",cursor:"pointer"},children:["Manage all updates (",c,")"]})]})]}),p&&!v&&a.jsxs("div",{className:"text-[11px] mb-3 px-3 py-2 rounded-lg",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:["Click another version to compare with ",p]}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),a.jsx("div",{className:"space-y-1",children:x.map(Q=>{const z=wg[Q.certTier]||wg.COMMUNITY,M=Q.version===p||Q.version===v,I=Q.isInstalled;return a.jsxs("button",{onClick:()=>B(Q.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:M?"var(--accent-muted)":"transparent",border:M?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:X=>{M||(X.currentTarget.style.background="var(--surface-1)")},onMouseLeave:X=>{M||(X.currentTarget.style.background="transparent")},children:[a.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:I?10:8,height:I?10:8,background:I?"var(--accent)":"var(--surface-3)",border:I?"2px solid var(--accent)":"2px solid var(--border-default)"}}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:Q.version}),a.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:z.bg,color:z.text},children:Q.certTier}),I&&a.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:"installed"})]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(Q.createdAt).toLocaleDateString()})]}),Q.diffSummary&&a.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:kw(Q.diffSummary,80)})]},Q.version)})}),a.jsx("div",{ref:$,style:{height:1}})]}),N&&a.jsx("div",{className:"mt-4",children:a.jsx("div",{className:"skeleton h-48 rounded-xl"})}),j&&!N&&a.jsx("div",{className:"mt-4",children:a.jsx(jf,{contentDiff:j.contentDiff,fromLabel:j.from,toLabel:j.to,diffSummary:j.diffSummary,renderContext:"inline",onRetry:()=>p&&v&&V(j.from,j.to)})})]})}function ww(n){return n==null?"var(--text-tertiary)":n>=.7?"var(--green)":n>=.4?"var(--yellow)":"var(--red)"}function Cw(n){return n==null?"var(--surface-3)":n>=.7?"var(--green-muted)":n>=.4?"var(--yellow-muted)":"var(--red-muted)"}function Cg(n,l="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:n,severity:l}}))}function kf(n){return n.skill?Nw({skill:n.skill}):Rw({state:n.state,isReadOnly:n.isReadOnly,onDelete:n.onDelete})}function Ew(n,l=48){if(n.length<=l)return n;const s=n.slice(0,12),o=n.slice(n.length-(l-12-1));return`${s}…${o}`}function Nw({skill:n}){const[l,s]=g.useState(!1),o=g.useCallback(async()=>{var d;try{await((d=navigator.clipboard)==null?void 0:d.writeText(n.dir)),s(!0),setTimeout(()=>s(!1),1500),Cg(J.toasts.pathCopied,"info")}catch{Cg(J.toasts.permissionDenied,"error")}},[n.dir]),c=n.origin==="installed"?"Project":"Skills",f=n.origin==="installed"?"var(--status-installed)":"var(--status-own)";return a.jsxs("div",{"data-testid":"detail-header",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",marginBottom:4},children:[a.jsx("span",{"data-testid":"detail-header-plugin",children:n.plugin}),a.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-secondary)"},children:"›"}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-secondary)",fontSize:11,letterSpacing:.3,textTransform:"uppercase"},children:[a.jsx("span",{"data-origin-dot":n.origin,"aria-label":`Origin: ${c}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:f}}),c]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,marginBottom:8},children:[a.jsx("h2",{"data-testid":"detail-header-name",style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,lineHeight:1.25,color:"var(--text-primary)",margin:0},children:n.skill}),a.jsx("span",{"data-testid":"detail-header-version",style:{fontFamily:"var(--font-sans)",fontVariantNumeric:"tabular-nums",fontSize:12,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:n.version??"—"})]}),a.jsx(Tw,{skill:n}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("button",{type:"button","data-testid":"detail-header-path-chip",title:n.dir,"aria-label":`Copy path ${n.dir} to clipboard`,onClick:o,style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},children:Ew(n.dir||"—")}),a.jsxs("button",{"data-testid":"detail-header-copy-path",type:"button",onClick:o,"aria-label":"Copy skill path to clipboard",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:11,cursor:"pointer"},children:[a.jsxs("svg",{width:"11",height:"11",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"})]}),l?"Copied":"Copy"]})]})]})}function Tw({skill:n}){const l=n.installMethod,s=n.symlinkTarget;if(!l)return null;let o="";switch(l){case"symlinked":o=s?`Symlinked from ${s}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return a.jsxs("div",{"data-testid":"detail-header-install-method",style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",margin:"6px 0 8px"},children:[a.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function Rw({state:n,isReadOnly:l,onDelete:s}){const{plugin:o,skill:c,evals:f,latestBenchmark:d,isDirty:x,caseRunStates:h,regressions:p,iterationCount:y}=n,v=Array.from(h.values()).some(w=>w.status==="running"||w.status==="queued"),b=d==null?void 0:d.overall_pass_rate,j=(f==null?void 0:f.evals.reduce((w,A)=>w+A.assertions.length,0))??0,k=(f==null?void 0:f.evals.length)??0,N=ww(b),C=Cw(b);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:o}),a.jsx(Aw,{}),a.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:c}),l&&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"]}),x&&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"}),v&&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:[!l&&s&&a.jsx("button",{disabled:v,onClick:()=>{window.confirm(`Delete skill "${c}"? This cannot be undone.`)&&s()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:v?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:v?.4:1,borderRadius:4},onMouseEnter:w=>{v||(w.currentTarget.style.color="var(--red)")},onMouseLeave:w=>{w.currentTarget.style.color="var(--text-tertiary)"},children:a.jsx(Mw,{})}),p.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"})]}),p.length," regression",p.length>1?"s":""]}),y>0&&a.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),a.jsx("span",{className:"pill",style:{background:C,color:N},children:b!=null?`${Math.round(b*100)}%`:"--"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[k," case",k!==1?"s":""," / ",j," assert",j!==1?"s":""]})]})]})}function Aw(){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 Mw(){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 Lw=[{label:"Build",tabs:[{id:"editor",label:"Editor",shortcut:"1"},{id:"tests",label:"Tests",shortcut:"2"}]},{label:"Evaluate",tabs:[{id:"run",label:"Run",shortcut:"3"},{id:"activation",label:"Activation",shortcut:"4"}]},{label:"Insights",tabs:[{id:"history",label:"History",shortcut:"5"},{id:"leaderboard",label:"Leaderboard",shortcut:"6"},{id:"deps",label:"Deps",shortcut:"7"},{id:"versions",label:"Versions",shortcut:"8"}]}];function zw({id:n}){const l={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(n){case"editor":return a.jsxs("svg",{...l,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",{...l,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",{...l,children:a.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return a.jsxs("svg",{...l,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",{...l,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",{...l,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",{...l,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"})]});case"versions":return a.jsxs("svg",{...l,children:[a.jsx("path",{d:"M12 8v4l3 3"}),a.jsx("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]})}}function Dw({activePanel:n,onPanelChange:l,isDirty:s,isRunning:o,hasRegressions:c,isActivationRunning:f,hasUpdate:d}){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:Lw.map((x,h)=>a.jsxs("div",{className:"flex items-center",children:[h>0&&a.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),x.tabs.map(p=>{const y=n===p.id,v=p.id==="editor"&&s||p.id==="run"&&o||p.id==="activation"&&f||p.id==="history"&&c||p.id==="versions"&&d,b=p.id==="run"||p.id==="activation"?"var(--accent)":p.id==="history"?"var(--red)":"var(--yellow)";return a.jsxs("button",{onClick:()=>l(p.id),title:`${p.label} (Ctrl+${p.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:y?"var(--text-primary)":"var(--text-tertiary)",borderBottom:y?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:y?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:j=>{y||(j.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:j=>{y||(j.currentTarget.style.color="var(--text-tertiary)")},children:[a.jsx(zw,{id:p.id}),p.label,v&&a.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:b}})]},p.id)})]},x.label))})}const Eg={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 Ys({error:n,onRetry:l,onDismiss:s}){const[o,c]=g.useState(null),f=g.useRef(null);g.useEffect(()=>(n.category==="rate_limit"&&n.retryAfterMs?c(Math.ceil(n.retryAfterMs/1e3)):c(null),()=>{f.current&&clearInterval(f.current)}),[n]),g.useEffect(()=>{if(!(o==null||o<=0))return f.current=setInterval(()=>{c(h=>h==null||h<=1?(f.current&&clearInterval(f.current),0):h-1)},1e3),()=>{f.current&&clearInterval(f.current)}},[o!=null&&o>0]);const d=Eg[n.category]||Eg.unknown,x=o!=null&&o>0;return a.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${d.color} 30%, transparent)`,background:`color-mix(in srgb, ${d.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:d.icon}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:d.color},children:n.title})]}),s&&a.jsx("button",{onClick:s,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:n.description}),a.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:n.hint}),(l||o!=null)&&a.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:l&&a.jsx("button",{onClick:l,disabled:x,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:x?.5:1},children:x?`Retry in ${o}s`:"Retry"})})]})]})}class _w extends g.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(l,s){console.error("ErrorBoundary caught:",l,s.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 Ow(n){const l=n.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(l)?{category:"rate_limit",title:"Rate Limit",description:n,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(l)?{category:"auth",title:"Authentication Failed",description:n,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(l)?{category:"timeout",title:"Request Timed Out",description:n,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(l)?{category:"model_not_found",title:"Model Not Found",description:n,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(l)?{category:"context_window",title:"Content Too Large",description:n,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(l)?{category:"provider_unavailable",title:"Provider Unavailable",description:n,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(l)?{category:"parse_error",title:"Response Parse Error",description:n,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:n,hint:"",retryable:!1}}function Bw(n){const l=n.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!l)return{metadata:{},body:n};const s=l[1],o=l[2].trim(),c={},f=s.split(`
73
+ `);let d="",x=!1;for(const h of f){const p=h.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(p&&d&&x){const b=p[1],j=p[2].trim();let k=c[d];if((typeof k!="object"||Array.isArray(k))&&(k={},c[d]=k),!j)k[b]=[];else{const N=j.match(/^\[(.+)\]$/);N?k[b]=N[1].split(",").map(C=>C.trim().replace(/^["']|["']$/g,"")).filter(Boolean):k[b]=j.replace(/^["']|["']$/g,"")}continue}const y=h.match(/^\s+-\s+(.+)$/);if(y&&d){x=!1;const b=c[d];Array.isArray(b)?b.push(y[1].trim().replace(/^["']|["']$/g,"")):c[d]=[y[1].trim().replace(/^["']|["']$/g,"")];continue}const v=h.match(/^([\w-]+):\s*(.*)$/);if(v){d=v[1];const b=v[2].trim();if(x=!1,!b){c[d]={},x=!0;continue}const j=b.match(/^\[(.+)\]$/);if(j){c[d]=j[1].split(",").map(k=>k.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}c[d]=b.replace(/^["']|["']$/g,"")}}return{metadata:c,body:o}}function Vo(n){if(!n)return"";try{let l=n.replace(/^---\n[\s\S]*?\n---\n?/,""),s=Iw(l);return s=s.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>'),s=s.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),s=s.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),s=s.replace(/\*([^*]+)\*/g,"<em>$1</em>"),s=s.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),s=s.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),s=s.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),s=s.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),s=s.replace(/\n/g,"<br/>"),s}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</pre>`}}function Iw(n){const l=n.split(`
74
+ `),s=[];let o=0;for(;o<l.length;)if(l[o].trim().startsWith("|")&&o+1<l.length&&l[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(l[o+1])){const c=Ng(l[o]);o+=2;const f=[];for(;o<l.length&&l[o].trim().startsWith("|");)f.push(Ng(l[o])),o++;const d='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)"',x='style="padding:0.4rem 0.6rem;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)"';let h='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';h+="<thead><tr>";for(const p of c)h+=`<th ${d}>${p}</th>`;h+="</tr></thead><tbody>";for(const p of f){h+="<tr>";for(const y of p)h+=`<td ${x}>${y}</td>`;h+="</tr>"}h+="</tbody></table>",s.push(h)}else s.push(l[o]),o++;return s.join(`
75
+ `)}function Ng(n){return n.split("|").map(l=>l.trim()).filter(l=>l.length>0)}function Po(n,l){const s=n.split(`
76
+ `),o=l.split(`
77
+ `);if(s.length>1e3||o.length>1e3)return[...s.map(y=>({type:"unchanged",content:y}))];const c=s.length,f=o.length,d=Array.from({length:c+1},()=>new Array(f+1).fill(0));for(let y=1;y<=c;y++)for(let v=1;v<=f;v++)s[y-1]===o[v-1]?d[y][v]=d[y-1][v-1]+1:d[y][v]=Math.max(d[y-1][v],d[y][v-1]);const x=[];let h=c,p=f;for(;h>0||p>0;)h>0&&p>0&&s[h-1]===o[p-1]?(x.push({type:"unchanged",content:s[h-1]}),h--,p--):p>0&&(h===0||d[h][p-1]>=d[h-1][p])?(x.push({type:"added",content:o[p-1]}),p--):(x.push({type:"removed",content:s[h-1]}),h--);return x.reverse()}function Hw(n,l){if(l&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(n))return a.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const o=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:o.has(n)?"var(--accent)":"var(--green)"}})}function Ks({entries:n,isRunning:l}){const[s,o]=g.useState(!1),c=g.useRef(null);return g.useEffect(()=>{c.current&&!s&&(c.current.scrollTop=c.current.scrollHeight)},[n,s]),n.length===0&&!l?null:a.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("button",{onClick:()=>o(!s),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:f=>{f.currentTarget.style.color="var(--text-primary)"},onMouseLeave:f=>{f.currentTarget.style.color="var(--text-tertiary)"},children:[a.jsxs("span",{className:"flex items-center gap-2",children:[l&&a.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",n.length,")"]}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:s?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!s&&a.jsx("div",{ref:c,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:n.map((f,d)=>{const x=d===n.length-1&&l,h=d===0?"0s":`+${((f.timestamp-n[0].timestamp)/1e3).toFixed(1)}s`;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:x?1:.7},children:[Hw(f.phase,x),a.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:h}),a.jsx("span",{style:{color:x?"var(--text-primary)":"var(--text-secondary)"},children:f.message}),f.current!=null&&f.total!=null&&a.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",f.current,"/",f.total,"]"]})]},d)})})]})}function Uw({plugin:n,skill:l,skillContent:s,onApplied:o}){const[c,f]=g.useState("closed"),{config:d}=Rr(),[x,h]=g.useState("claude-cli"),[p,y]=g.useState("opus"),[v,b]=g.useState([]),[j,k]=g.useState(""),[N,C]=g.useState(""),[w,A]=g.useState(null),[_,H]=g.useState(null),[L,$]=g.useState([]),[E,D]=g.useState(!1),R=g.useRef(null);g.useEffect(()=>{if(!d)return;d.providers.find(I=>I.id==="claude-cli"&&I.available)&&(h("claude-cli"),y("opus"))},[d]),g.useEffect(()=>()=>{var M;(M=R.current)==null||M.abort()},[]);function B(){return d==null?void 0:d.providers.find(M=>M.id===x&&M.available)}const V=g.useCallback(()=>{var M;(M=R.current)==null||M.abort(),f("open")},[]);async function W(){f("loading"),A(null),H(null),$([]);const M=new AbortController;R.current=M;try{const I=await fetch(`/api/skills/${encodeURIComponent(n)}/${encodeURIComponent(l)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:x,model:p}),signal:M.signal});if(!I.ok||!I.body){let Y=`HTTP ${I.status}`;try{const se=await I.json();se.error&&(Y=se.error)}catch{}throw new Error(Y)}const X=I.body.getReader(),G=new TextDecoder;let ce="",O="";for(;;){const{done:Y,value:se}=await X.read();if(Y)break;ce+=G.decode(se,{stream:!0});const de=ce.split(`
78
+ `);ce=de.pop()||"";for(const ge of de)if(ge.startsWith("event: "))O=ge.slice(7).trim();else if(ge.startsWith("data: ")){try{const xe=JSON.parse(ge.slice(6));O==="progress"?$(we=>[...we,{phase:xe.phase,message:xe.message,timestamp:Date.now()}]):O==="done"||O==="complete"?(k(xe.improved),C(xe.reasoning||""),b(Po(xe.original||s,xe.improved)),f("diff_shown")):O==="error"&&(A(xe.message||xe.description||"Unknown error"),xe.category&&H(xe),f("open"))}catch{}O=""}}}catch(I){I.name!=="AbortError"&&(A(I.message),f("open"))}finally{R.current=null}}async function te(){D(!0);try{await Ne.applyImprovement(n,l,j),o(j),f("closed")}catch(M){A(M.message)}finally{D(!1)}}function Q(){f("closed"),b([]),k(""),C(""),A(null)}if(c==="closed")return a.jsxs("button",{onClick:()=>f("open"),className:"btn btn-secondary mb-5",disabled:!s,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 z=B();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:Q,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:M=>{M.currentTarget.style.background="var(--surface-3)"},onMouseLeave:M=>{M.currentTarget.style.background="transparent"},children: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:[(c==="open"||c==="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:x,onChange:M=>{h(M.target.value);const I=d==null?void 0:d.providers.find(X=>X.id===M.target.value);I!=null&&I.models[0]&&y(I.models[0].id)},disabled:c==="loading",children:d==null?void 0:d.providers.filter(M=>M.available).map(M=>a.jsx("option",{value:M.id,children:M.label},M.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:p,onChange:M=>y(M.target.value),disabled:c==="loading",children:z==null?void 0:z.models.map(M=>a.jsx("option",{value:M.id,children:M.label},M.id))})]}),c==="loading"?a.jsx("button",{onClick:V,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):a.jsx("button",{onClick:W,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),c==="loading"&&L.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx(Ks,{entries:L,isRunning:!0})})]}),w&&a.jsx("div",{className:"mb-4",children:_?a.jsx(Ys,{error:_,onRetry:W,onDismiss:()=>{A(null),H(null)}}):a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:w})}),c==="diff_shown"&&a.jsxs(a.Fragment,{children:[N&&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: "}),N]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:v.map((M,I)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] 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]},I))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:te,disabled:E,className:"btn btn-primary",children:E?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:Q,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Tg={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"}},$w={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function Vw({change:n,index:l,selected:s,onToggle:o,originalEval:c}){var v;const[f,d]=g.useState(!1),x=Tg[n.action]??Tg.add,h=$w[n.action]??"var(--border-subtle)",p=n.action==="remove"?(c==null?void 0:c.name)??`Eval #${n.evalId}`:((v=n.eval)==null?void 0:v.name)??"Unnamed",y=g.useCallback(()=>o(l),[o,l]);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 ${h}`,opacity:s?1:.5},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("input",{type:"checkbox",checked:s,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),a.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:x.bg,color:x.color,padding:"1px 6px"},children:x.label}),a.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:p}),a.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:n.reason}),a.jsx("button",{onClick:()=>d(!f),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:b=>{b.currentTarget.style.background="var(--surface-3)"},onMouseLeave:b=>{b.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:f?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),f&&a.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.action==="add"&&n.eval&&a.jsx(Pw,{evalCase:n.eval}),n.action==="modify"&&n.eval&&c&&a.jsx(Fw,{original:c,proposed:n.eval}),n.action==="remove"&&c&&a.jsx(Gw,{evalCase:c})]})]})}function Pw({evalCase:n}){var l;return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[a.jsx(Yd,{label:"Prompt",value:n.prompt}),a.jsx(Yd,{label:"Expected",value:n.expected_output}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((l=n.assertions)==null?void 0:l.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-1",children:(n.assertions??[]).map(s=>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:"+"})," ",s.text]},s.id))})]})]})}function Fw({original:n,proposed:l}){const s=[];n.name!==l.name&&s.push({label:"Name",old:n.name,new:l.name}),n.prompt!==l.prompt&&s.push({label:"Prompt",old:n.prompt,new:l.prompt}),n.expected_output!==l.expected_output&&s.push({label:"Expected",old:n.expected_output,new:l.expected_output});const o=n.assertions??[],c=l.assertions??[],f=new Set(o.map(p=>p.text)),d=new Set(c.map(p=>p.text)),x=c.filter(p=>!f.has(p.text)),h=o.filter(p=>!d.has(p.text));return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[s.map(p=>a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:p.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:["- ",Kd(p.old,120)]}),a.jsxs("div",{style:{color:"var(--green)"},children:["+ ",Kd(p.new,120)]})]})]},p.label)),(x.length>0||h.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:[h.map(p=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",p.text]},p.id)),x.map(p=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",p.text]},p.id))]})]}),s.length===0&&x.length===0&&h.length===0&&a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function Gw({evalCase:n}){var l;return a.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[a.jsx(Yd,{label:"Prompt",value:n.prompt}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((l=n.assertions)==null?void 0:l.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-0.5",children:(n.assertions??[]).map(s=>a.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:s.text},s.id))})]})]})}function Yd({label:n,value:l}){return a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:n}),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:Kd(l,300)})]})}function Kd(n,l){return n.length>l?n.slice(0,l)+"...":n}const Rg={remove:0,modify:1,add:2};function Ww({changes:n,selections:l,currentEvals:s,onToggle:o,onSelectAll:c,onDeselectAll:f}){if(n.length===0)return null;const d=n.map((h,p)=>({change:h,originalIndex:p}));d.sort((h,p)=>(Rg[h.change.action]??2)-(Rg[p.change.action]??2));const x=Array.from(l.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:["(",x,"/",n.length," selected)"]})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("button",{onClick:c,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:h=>{h.currentTarget.style.background="transparent"},children:"Select All"}),a.jsx("button",{onClick:f,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--surface-3)"},onMouseLeave:h=>{h.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),a.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:d.map(({change:h,originalIndex:p})=>a.jsx(Vw,{change:h,index:p,selected:l.get(p)??!1,onToggle:o,originalEval:h.evalId!=null?s.find(y=>y.id===h.evalId):void 0},p))})]})}function qw(){var M;const{state:n,dispatch:l,submitAiEdit:s,applyAiEdit:o,discardAiEdit:c,cancelAiEdit:f,toggleEvalChange:d,selectAllEvalChanges:x,deselectAllEvalChanges:h,retryEvalsSave:p}=En(),{aiEditLoading:y,aiEditResult:v,aiEditError:b,aiEditClassifiedError:j,aiEditProgress:k,aiEditEvalChanges:N,aiEditEvalSelections:C,aiEditEvalsRetry:w}=n,[A,_]=g.useState(""),{config:H}=Rr(),[L,$]=g.useState("claude-cli"),[E,D]=g.useState("opus"),R=g.useRef(null);g.useEffect(()=>{var I;(I=R.current)==null||I.focus()},[]),g.useEffect(()=>{if(!H)return;H.providers.find(X=>X.id==="claude-cli"&&X.available)&&($("claude-cli"),D("opus"))},[H]);const B=H==null?void 0:H.providers.find(I=>I.id===L&&I.available),V=g.useCallback(()=>{const I=A.trim();!I||y||s(I,L,E)},[A,y,s,L,E]),W=g.useCallback(I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),V()),I.key==="Escape"&&(I.preventDefault(),y?f():c())},[V,y,f,c]),te=g.useCallback(()=>{l({type:"CLOSE_AI_EDIT"}),l({type:"OPEN_AI_EDIT"})},[l]),Q=v?Po(n.skillContent,v.improved):[],z=((M=n.evals)==null?void 0:M.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:c,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:I=>{I.currentTarget.style.background="var(--surface-3)"},onMouseLeave:I=>{I.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:[!v&&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:R,value:A,onChange:I=>_(I.target.value),onKeyDown:W,placeholder:"e.g., Add an error handling section...",disabled:y,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:I=>{const X=I.currentTarget;X.style.height="auto",X.style.height=Math.min(X.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:L,onChange:I=>{$(I.target.value);const X=H==null?void 0:H.providers.find(G=>G.id===I.target.value);X!=null&&X.models[0]&&D(X.models[0].id)},disabled:y,style:{width:"100%"},children:H==null?void 0:H.providers.filter(I=>I.available).map(I=>a.jsx("option",{value:I.id,children:I.label},I.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:E,onChange:I=>D(I.target.value),disabled:y,style:{width:"100%"},children:B==null?void 0:B.models.map(I=>a.jsx("option",{value:I.id,children:I.label},I.id))})]}),y?a.jsx("button",{onClick:f,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):a.jsx("button",{onClick:V,disabled:!A.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&k.length>0&&a.jsx("div",{className:"mt-2.5",children:a.jsx(Ks,{entries:k,isRunning:!0})})]}),b&&a.jsx("div",{className:"mt-3",children:j?a.jsx(Ys,{error:j,onRetry:te,onDismiss:c}):a.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:b})}),v&&a.jsxs("div",{className:"animate-fade-in",children:[v.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: "}),v.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:Q.map((I,X)=>a.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:I.type==="added"?"rgba(34,197,94,0.1)":I.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:I.type==="added"?"var(--green)":I.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:I.type==="added"?"3px solid var(--green)":I.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:I.type==="added"?"+":I.type==="removed"?"-":" "}),I.content]},X))}),a.jsx(Ww,{changes:N,selections:C,currentEvals:z,onToggle:d,onSelectAll:x,onDeselectAll:h}),w&&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:p,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:o,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:c,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),a.jsx("button",{onClick:te,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function Yw(n,l){const[s,o]=g.useState([]),[c,f]=g.useState("SKILL.md"),[d,x]=g.useState(null),[h,p]=g.useState(!1),[y,v]=g.useState(null),b=g.useCallback(async()=>{try{const N=await Ne.getSkillFiles(n,l);o(N.files)}catch{o([])}},[n,l]);g.useEffect(()=>{f("SKILL.md"),x(null),v(null),b()},[n,l,b]);const j=g.useCallback(async N=>{if(f(N),N==="SKILL.md"){x(null),v(null);return}p(!0),v(null);try{const C=await Ne.getSkillFile(n,l,N);x(C)}catch(C){v(`Unable to open file: ${C.message}`),x(null)}finally{p(!1)}},[n,l]),k=g.useCallback(()=>{b()},[b]);return{files:s,activeFile:c,secondaryContent:d,loading:h,error:y,selectFile:j,refresh:k,isSkillMd:c==="SKILL.md"}}function Kw(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function Xw(n){const l=[],s=new Map;for(const o of n){const c=o.path.split("/"),d={name:c[c.length-1],path:o.path,type:o.type,size:o.size,children:[]};s.set(o.path,d)}for(const o of n){const c=o.path.split("/");if(c.length===1){const f=s.get(o.path);f&&l.push(f)}else{const f=c.slice(0,-1).join("/"),d=s.get(f),x=s.get(o.path);d&&x&&d.children.push(x)}}return l}function iy({expanded:n}){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:n?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function oy(){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 Qw(){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 Zw(){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 cy({node:n,depth:l,activeFile:s,onSelect:o}){const[c,f]=g.useState(!0),d=n.path===s;return n.type==="dir"?a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>f(!c),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+l*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(iy,{expanded:c}),a.jsx(oy,{}),a.jsxs("span",{children:[n.name,"/"]})]}),c&&n.children.map(x=>a.jsx(cy,{node:x,depth:l+1,activeFile:s,onSelect:o},x.path))]}):a.jsxs("button",{onClick:()=>o(n.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+l*14}px`,paddingTop:2,paddingBottom:2,background:d?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:d?"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(Qw,{}),a.jsx("span",{style:{flex:1},children:n.name}),a.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:Kw(n.size)})]})}function Jw({files:n,activeFile:l,onSelect:s,onRefresh:o}){const[c,f]=g.useState(!1),d=g.useMemo(()=>Xw(n),[n]);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:()=>f(!c),children:[a.jsx(iy,{expanded:c}),a.jsx(oy,{}),a.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l}),a.jsx("button",{onClick:x=>{x.stopPropagation(),o()},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(Zw,{})})]}),c&&a.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:d.length===0?a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):d.map(x=>a.jsx(cy,{node:x,depth:0,activeFile:l,onSelect:s},x.path))})]})}function fo(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function eC(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}}function tC(n){const l=n.toLowerCase();return l.endsWith(".json")?"json":l.endsWith(".md")?"md":"other"}function Ag({content:n}){return a.jsx("textarea",{readOnly:!0,value:n,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 Mg({content:n,fileType:l}){if(l==="json"){const s=eC(n);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:s})}return l==="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:Vo(n)}}):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:n})}function Lg(n){try{return JSON.stringify(JSON.parse(n),null,2).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"([^"\\]|\\.)*"\s*:/g,s=>`<span style="color:#6383ff">${s}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,s=>`<span style="color:#22c55e">${s.slice(0,2)}<span style="color:#22c55e">${s.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(s,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(s,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}function nC({file:n,loading:l,error:s,viewMode:o,plugin:c,skill:f,onSaved:d,onDirtyChange:x}){const[h,p]=g.useState(o),[y,v]=g.useState(!1),[b,j]=g.useState(""),[k,N]=g.useState(!1),[C,w]=g.useState(null),A=o!==h?o:h;g.useEffect(()=>{x==null||x(y)},[y,x]);const _=g.useCallback(()=>{(n==null?void 0:n.content)!=null&&(j(n.content),v(!0))},[n]),H=g.useCallback(()=>{v(!1)},[]),L=g.useCallback(async()=>{if(!(!c||!f||!n)){N(!0);try{await Ne.saveSkillFile(c,f,n.path,b),w("Saved"),v(!1),d==null||d(),setTimeout(()=>w(null),2e3)}catch(D){w(`Save failed: ${D.message}`),setTimeout(()=>w(null),3e3)}finally{N(!1)}}},[c,f,n,b,d]);if(g.useEffect(()=>{if(!y)return;const D=R=>{(R.ctrlKey||R.metaKey)&&R.key==="s"&&(R.preventDefault(),L())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[y,L]),l)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(s)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:s})]})});if(!n)return null;if(n.binary)return a.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",fo(n.size),") — cannot be displayed"]});const $=n.content??"",E=tC(n.path);return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[n.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 ",fo(512*1024)," — ",fo(n.size)," total"]}),a.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(E==="md"||E==="json")&&["raw","split","preview"].map(D=>a.jsx("button",{onClick:()=>p(D),style:{padding:"2px 8px",fontSize:11,background:A===D?"var(--accent-muted)":"none",color:A===D?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:D},D)),a.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[fo(n.size),c&&f&&!n.binary&&!y&&a.jsx("button",{onClick:_,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),y&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:L,disabled:k,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),a.jsx("button",{onClick:H,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),C&&a.jsx("div",{style:{padding:"4px 12px",background:C.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:C.startsWith("Save failed")?"var(--red)":"var(--green)"},children:C}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:y?a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[a.jsx("textarea",{value:b,onChange:D=>j(D.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:L,disabled:k,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),a.jsx("button",{onClick:H,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):A==="split"&&E!=="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(Ag,{content:$})}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:E==="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:Lg($)}}):a.jsx(Mg,{content:$,fileType:E})})]}):A==="preview"&&E!=="other"?E==="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:Lg($)}}):a.jsx(Mg,{content:$,fileType:E}):a.jsx(Ag,{content:$})})]})}function aC({size:n=15}){return a.jsxs("svg",{width:n,height:n,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 rC({size:n=15}){return a.jsxs("svg",{width:n,height:n,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 lC({size:n=15}){return a.jsxs("svg",{width:n,height:n,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 sC({size:n=15}){return a.jsxs("svg",{width:n,height:n,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 jd({size:n=15}){return a.jsx("svg",{width:n,height:n,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 iC(){const{state:n,dispatch:l,saveContent:s,isReadOnly:o}=En(),{plugin:c,skill:f,skillContent:d,isDirty:x,improveTarget:h,aiEditOpen:p}=n,[y,v]=g.useState("split"),[b,j]=g.useState(!1),k=g.useRef(null),[N,C]=g.useState(!1),[w,A]=g.useState(""),[_,H]=g.useState(!1),[L,$]=g.useState(null),[E,D]=g.useState([]),[R,B]=g.useState([]),[V,W]=g.useState(null),te=g.useRef(null),{config:Q}=Rr(),{files:z,activeFile:M,secondaryContent:I,loading:X,error:G,selectFile:ce,refresh:O,isSkillMd:Y}=Yw(c??"",f??""),[se,de]=g.useState(!1),ge=g.useCallback(ve=>{se&&!window.confirm("You have unsaved changes. Discard?")||ce(ve)},[se,ce]);g.useEffect(()=>()=>{var ve;(ve=te.current)==null||ve.abort()},[]);const{metadata:xe,body:we}=Bw(d),ie=xe["allowed-tools"],je=Array.isArray(ie)?ie:typeof ie=="string"?[ie]:[],Oe=xe.name,$e=xe.description,ae=xe.metadata,pe=typeof ae=="object"&&!Array.isArray(ae)?ae:null,fe=xe.version||(pe==null?void 0:pe.version),he=xe.tags||(pe==null?void 0:pe.tags),ye=Array.isArray(he)?he:typeof he=="string"?he.split(",").map(ve=>ve.trim()).filter(Boolean):[],Be=new Set(["name","description","metadata","allowed-tools","version","tags"]),Me=Object.entries(xe).filter(([ve])=>!Be.has(ve)),ue=g.useCallback(async()=>{j(!0),await s(),j(!1)},[s]),De=g.useCallback(ve=>{(ve.ctrlKey||ve.metaKey)&&ve.key==="s"&&(ve.preventDefault(),ve.stopPropagation(),x&&ue()),(ve.ctrlKey||ve.metaKey)&&ve.key==="k"&&(ve.preventDefault(),ve.stopPropagation(),l({type:p?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[x,ue,p,l]),Ie=g.useCallback(async()=>{var Mt,_e;if(!w.trim())return;(Mt=te.current)==null||Mt.abort();const ve=new AbortController;te.current=ve,H(!0),W(null),B([]),$(null),D([]);try{const vt=(Q==null?void 0:Q.provider)||"claude-cli",Qt=(Q==null?void 0:Q.model)||"sonnet",st=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:w,provider:vt,model:Qt}),signal:ve.signal});if(!st.ok||!st.body){let jt=`HTTP ${st.status}`;try{const $n=await st.json();$n.error&&(jt=$n.error)}catch{}throw new Error(jt)}const sr=st.body.getReader(),aa=new TextDecoder;let Nt="",wt="";for(;;){const{done:jt,value:$n}=await sr.read();if(jt)break;Nt+=aa.decode($n,{stream:!0});const ir=Nt.split(`
79
+ `);Nt=ir.pop()||"";for(const Vn of ir)if(Vn.startsWith("event: "))wt=Vn.slice(7).trim();else if(Vn.startsWith("data: ")){try{const Ge=JSON.parse(Vn.slice(6));if(wt==="progress")B(Vt=>[...Vt,{phase:Ge.phase,message:Ge.message,timestamp:Date.now()}]);else if(wt==="done"||wt==="complete"){const Vt=["---"];Ge.name&&Vt.push(`name: ${Ge.name}`),Ge.description&&Vt.push(`description: "${Ge.description.replace(/"/g,'\\"')}"`),Ge.model&&Vt.push(`model: ${Ge.model}`),(_e=Ge.allowedTools)!=null&&_e.trim()&&Vt.push(`allowed-tools: ${Ge.allowedTools.trim()}`),Vt.push("---","",Ge.body||"");const ra=Vt.join(`
80
+ `);$(ra),D(Po(d,ra)),H(!1)}else wt==="error"&&(W(Ge.message||Ge.description||"Generation failed"),H(!1))}catch{}wt=""}}}catch(vt){vt.name!=="AbortError"&&W(vt.message)}finally{H(!1),te.current=null}},[w,Q,d]),Bt=g.useCallback(()=>{L&&l({type:"SET_CONTENT",content:L}),C(!1),$(null),D([]),A(""),B([])},[L,l]),Gt=g.useCallback(()=>{C(!1),$(null),D([]),A(""),B([]),W(null)},[]),lt=g.useCallback(()=>{var ve;N?((ve=te.current)==null||ve.abort(),Gt()):(p&&l({type:"CLOSE_AI_EDIT"}),C(!0))},[N,p,l,Gt]),kt=[{mode:"raw",icon:a.jsx(aC,{}),label:"Editor"},{mode:"split",icon:a.jsx(rC,{}),label:"Split"},{mode:"preview",icon:a.jsx(lC,{}),label:"Preview"}];return a.jsxs("div",{className:"flex flex-col h-full",onKeyDown:De,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:kt.map(({mode:ve,icon:Mt,label:_e})=>a.jsxs("button",{onClick:()=>v(ve),title:_e,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:y===ve?"var(--surface-4)":"transparent",color:y===ve?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:y===ve?600:400,border:"none",cursor:"pointer"},children:[Mt,a.jsx("span",{style:{letterSpacing:"0.01em"},children:_e})]},ve))}),Y?o?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:()=>{p?l({type:"CLOSE_AI_EDIT"}):(N&&Gt(),l({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:p?600:400,border:"none",cursor:"pointer",color:p?"var(--purple)":"var(--text-tertiary)",background:p?"var(--purple-muted)":"transparent"},children:[a.jsx(sC,{size:13}),a.jsx("span",{children:"AI Edit"})]}),a.jsxs("button",{onClick:lt,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:N?600:400,border:"none",cursor:"pointer",color:N?"var(--purple)":"var(--text-tertiary)",background:N?"var(--purple-muted)":"transparent"},children:[a.jsx(jd,{size:13}),a.jsx("span",{children:"Regenerate"})]}),a.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),x&&a.jsx("button",{onClick:()=>l({type:"SET_CONTENT",content:n.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),a.jsx("button",{onClick:ue,disabled:!x||b,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:b?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),c&&f&&a.jsx(Jw,{files:z,activeFile:M,onSelect:ge,onRefresh:O}),!Y&&a.jsx(nC,{file:I,loading:X,error:G,viewMode:y,plugin:c??void 0,skill:f??void 0,onSaved:()=>{ce(M),O()},onDirtyChange:de}),Y&&a.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&a.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:a.jsx("textarea",{ref:k,value:d,onChange:ve=>{o||l({type:"SET_CONTENT",content:ve.target.value})},onKeyDown:De,spellCheck:!1,readOnly:o,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:o?.7:1}})}),y!=="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:[(Oe||fe||$e)&&a.jsxs("div",{style:{marginBottom:20},children:[a.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[Oe&&a.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:Oe}),fe&&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",fe]})]}),$e&&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:$e})]}),ye.length>0&&a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ye.map(ve=>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:ve},ve))}),je.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"}),je.map(ve=>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:ve},ve))]})}),Me.length>0&&a.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:Me.map(([ve,Mt],_e)=>{const vt=Array.isArray(Mt)?Mt.join(", "):typeof Mt=="object"?Object.entries(Mt).map(([Qt,st])=>`${Qt}: ${Array.isArray(st)?st.join(", "):st}`).join(" | "):Mt;return a.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:_e>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:ve}),a.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:vt})]},ve)})}),(Oe||$e||ye.length>0||je.length>0||Me.length>0)&&we&&a.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),we&&a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Vo(we)}})]})})]}),Y&&p&&a.jsx(qw,{}),Y&&N&&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:[!L&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(jd,{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:w,onChange:ve=>A(ve.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:_,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:_?.5:1},onKeyDown:ve=>{ve.key==="Enter"&&(ve.ctrlKey||ve.metaKey)&&w.trim()&&!_&&(ve.preventDefault(),Ie())}})}),a.jsxs("div",{className:"flex items-center gap-2",children:[_?a.jsx("button",{onClick:()=>{var ve;(ve=te.current)==null||ve.abort(),H(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):a.jsx("button",{onClick:Ie,disabled:!w.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),a.jsx("button",{onClick:Gt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),_&&R.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx(Ks,{entries:R,isRunning:!0})}),V&&a.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[V,a.jsx("button",{onClick:Ie,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),L&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(jd,{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:E.map((ve,Mt)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:ve.type==="added"?"var(--green-muted)":ve.type==="removed"?"var(--red-muted)":"transparent",color:ve.type==="added"?"var(--green)":ve.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:ve.type==="added"?"3px solid var(--green)":ve.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ve.type==="added"?"+":ve.type==="removed"?"-":" "}),ve.content]},Mt))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:Bt,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:Gt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),Y&&h!==null&&c&&f&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Uw,{plugin:c,skill:f,skillContent:d,onApplied:ve=>{l({type:"SET_CONTENT",content:ve}),l({type:"CONTENT_SAVED"}),l({type:"CLOSE_IMPROVE"})}})})]})}function gl(n){return n.testType==="integration"?"integration":"unit"}function kl(n){return n>=.8?"var(--green)":n>=.5?"var(--yellow)":"var(--red)"}function uy(n){const l=new Date(n);return l.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function dy(n){return n==null?"--":n>=1e3?`${(n/1e3).toFixed(1)}s`:`${n}ms`}const oC=new Set(["benchmark","comparison","baseline"]);function zg(n,l,s,o){return n.map(({rate:c,idx:f,total:d})=>{const x=o+f/(d-1)*(l-o*2),h=o+(s-o*2)-c*(s-o*2);return`${x},${h}`})}function fy({entries:n}){const l=n.filter(v=>oC.has(v.type)).slice().reverse(),s=l.map((v,b,j)=>({rate:v.pass_rate,idx:b,total:j.length})).filter((v,b)=>{const j=l[b].type;return j==="benchmark"||j==="comparison"}),o=l.flatMap((v,b)=>v.type==="baseline"?[{rate:v.pass_rate,idx:b,total:l.length}]:v.type==="comparison"&&v.baselinePassRate!=null?[{rate:v.baselinePassRate,idx:b,total:l.length}]:[]);if(s.length<2&&o.length<2)return null;const c=80,f=24,d=2,x=s.length>=2?zg(s,c,f,d):[],h=o.length>=2?zg(o,c,f,d):[],p=x[x.length-1],y=h[h.length-1];return a.jsxs("svg",{width:c,height:f,style:{display:"block",flexShrink:0},children:[h.length>0&&a.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),x.length>0&&a.jsx("polyline",{points:x.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&a.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),p&&a.jsx("circle",{cx:parseFloat(p.split(",")[0]),cy:parseFloat(p.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function py(n,l,s){const o=isNaN(l)?0:l,c=[],f=[],d=[];if((n==="PASS"||n==="EFFECTIVE")&&o>=.7){const p=c.length>0?` Met criteria: ${c.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${n} (score ${o.toFixed(2)}): evaluation met expectations.${p}`}}if(n==="FAIL"||n==="DEGRADING"){const p=f.length>0?` Failed criteria: ${f.map(v=>v.criterion).join(", ")}.`:"",y=[...f.map(v=>`Improve "${v.criterion}" (score: ${v.score.toFixed(2)})`),...d.map(v=>`Strengthen "${v.criterion}" (score: ${v.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${n} (score ${o.toFixed(2)}): evaluation did not meet expectations.${p}`,recommendations:y}}if(n==="INEFFECTIVE"){if(o<.2){const y=[...f.map(v=>`Rework "${v.criterion}" — currently at ${v.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${n} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const p=[...f.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push("Consider restructuring your prompt approach"),{explanation:`${n} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:p}}if(n==="MARGINAL"){const p=[...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...f.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push(c.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${n} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:p}}if(n==="EMERGING"){const p=[...f.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push(c.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${n} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:p}}const x=c.length>0?` Passing: ${c.map(p=>p.criterion).join(", ")}.`:"",h=d.length>0?` Needs improvement: ${d.map(p=>p.criterion).join(", ")}.`:"";return{explanation:`${n} (score ${o.toFixed(2)}): mixed results.${x}${h}`}}const my={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function cC(n){return Object.hasOwn(my,n)}function uC(n){return cC(n)?my[n]:n}function dC(){const{state:n}=En(),{plugin:l,skill:s}=n,[o,c]=g.useState([]),[f,d]=g.useState([]),[x,h]=g.useState(!0),[p,y]=g.useState(null),[v,b]=g.useState(new Set),[j,k]=g.useState({}),[N,C]=g.useState(null),[w,A]=g.useState(""),[_,H]=g.useState(!1),[L,$]=g.useState(""),[E,D]=g.useState(""),R=g.useCallback(async()=>{h(!0),y(null);try{const[z,M]=await Promise.all([Ne.getCredentials(l,s),Ne.getParams(l,s)]);c(z.credentials),d(M.params)}catch(z){y(z instanceof Error?z.message:"Failed to load parameters"),c([]),d([])}finally{h(!1)}},[l,s]);g.useEffect(()=>{R()},[R]);const B=g.useCallback(async(z,M)=>{H(!0),y(null);try{await Ne.setCredential(l,s,z,M),C(null),A(""),await R()}catch(I){y(I instanceof Error?I.message:`Failed to save ${z}`)}finally{H(!1)}},[l,s,R]),V=g.useCallback(async()=>{const z=L.trim().toUpperCase(),M=E.trim();if(!(!z||!M)){H(!0),y(null);try{await Ne.setCredential(l,s,z,M),$(""),D(""),await R()}catch(I){y(I instanceof Error?I.message:`Failed to add ${z}`)}finally{H(!1)}}},[l,s,L,E,R]),W=g.useCallback(async z=>{if(v.has(z)){b(M=>{const I=new Set(M);return I.delete(z),I}),k(M=>{const I={...M};return delete I[z],I});return}try{const I=(await Ne.getParamsRevealed(l,s,z)).params.find(X=>X.name===z);I!=null&&I.value&&(k(X=>({...X,[z]:I.value})),b(X=>new Set(X).add(z)))}catch{}},[l,s,v]),te=new Set(o.map(z=>z.name)),Q=[...o.map(z=>{const M=f.find(I=>I.name===z.name);return{name:z.name,status:z.status,maskedValue:(M==null?void 0:M.maskedValue)??""}}),...f.filter(z=>!te.has(z.name)).map(z=>({name:z.name,status:z.status,maskedValue:z.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"}),p&&a.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},role:"alert",children:p}),x&&Q.length===0&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!x&&Q.length===0&&!p&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),Q.map(z=>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:z.name}),a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:z.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:z.status==="ready"?"var(--green)":"var(--red)"},children:z.status}),(z.maskedValue||z.status==="ready")&&a.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[v.has(z.name)?j[z.name]??z.maskedValue:z.maskedValue||"***",a.jsx("button",{onClick:()=>W(z.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${v.has(z.name)?"Hide":"Reveal"} value for ${z.name}`,children:v.has(z.name)?"hide":"show"})]}),N===z.name?a.jsxs("div",{className:"flex gap-1",children:[a.jsx("input",{value:w,onChange:M=>A(M.target.value),onKeyDown:M=>{M.key==="Enter"&&w.trim()&&B(z.name,w)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${z.name}`,autoFocus:!0}),a.jsx("button",{onClick:()=>B(z.name,w),disabled:_||!w.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),a.jsx("button",{onClick:()=>{C(null),A("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):a.jsx("button",{onClick:()=>{C(z.name),A("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},z.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:L,onChange:z=>$(z.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),a.jsx("input",{value:E,onChange:z=>D(z.target.value),onKeyDown:z=>{z.key==="Enter"&&L.trim()&&E.trim()&&V()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),a.jsx("button",{onClick:V,disabled:_||!L.trim()||!E.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:_?"not-allowed":"pointer"},children:"Add"})]})]})]})}function fC(n,l,s){const[o,c]=g.useState(null),[f,d]=g.useState(!1),x=g.useRef("");g.useEffect(()=>{const p=`${n}/${l}/${s}`;x.current!==p&&(x.current=p,d(!0),Ne.getCaseHistory(n,l,s).then(y=>c(y)).catch(()=>c([])).finally(()=>d(!1)))},[n,l,s]);const h=g.useCallback(()=>{d(!0),x.current="",Ne.getCaseHistory(n,l,s).then(p=>c(p)).catch(()=>c([])).finally(()=>d(!1))},[n,l,s]);return{entries:o,loading:f,refetch:h}}function pC(n,l,s){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!s||s.length===0)return o;const f=s.slice(0,10).map(h=>h.assertions.find(p=>p.id===n)).filter(Boolean);if(f.length>=2){const p=f.filter(y=>y.pass).length/f.length;p>=.3&&p<=.7&&(o.flaky=!0)}const d=s.find(h=>h.type==="benchmark"),x=s.find(h=>h.type==="baseline");if(d&&x){const h=d.assertions.find(y=>y.id===n),p=x.assertions.find(y=>y.id===n);h!=null&&h.pass&&(p!=null&&p.pass)&&(o.nonDiscriminating=!0)}if(l&&!l.pass&&s.length>=1){const p=s[0].assertions.find(y=>y.id===n);p!=null&&p.pass&&(o.regression=!0)}return o}function mC(){var X;const{state:n,dispatch:l,saveEvals:s,runCase:o,runAll:c,cancelCase:f,cancelAll:d,generateEvals:x,isReadOnly:h}=En(),{evals:p,evalsError:y,selectedCaseId:v,inlineResults:b,caseRunStates:j,generateEvalsLoading:k,generateEvalsProgress:N,generateEvalsError:C}=n,w=g.useMemo(()=>{for(const G of j.values())if(G.status==="running"||G.status==="queued")return!0;return!1},[j]),[A,_]=g.useState(!1),[H,L]=g.useState("all"),$={skill_name:n.skill,evals:[]},E=p??$,D=E.evals,R=g.useMemo(()=>H==="all"?D:D.filter(G=>gl(G)===H),[H,D]),B=R.find(G=>G.id===v)??null;g.useEffect(()=>{v!==null&&!R.find(G=>G.id===v)&&l({type:"SELECT_CASE",caseId:R.length>0?R[0].id:null})},[R,v,l]);const[V,W]=g.useState([]),te=g.useMemo(()=>D.some(G=>gl(G)==="integration"),[D]);g.useEffect(()=>{te&&Ne.getCredentials(n.plugin,n.skill).then(G=>W(G.credentials)).catch(()=>W([]))},[n.plugin,n.skill,te]);const Q=g.useMemo(()=>new Set(V.filter(G=>G.status==="missing").map(G=>G.name)),[V]),[z,M]=g.useState(!1),I=g.useCallback(G=>{M(!1),x(G?{testType:G}:void 0)},[x]);return!p||D.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:y?"var(--red-muted)":"var(--accent-muted)"},children:y?a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",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:y?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},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:y}),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:()=>_(!0),disabled:h,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:()=>I("unit"),disabled:k||h,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:k?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:()=>M(!z),disabled:k||h,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"})})})]}),z&&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:()=>I("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:G=>{G.currentTarget.style.background="var(--surface-2)"},onMouseLeave:G=>{G.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),k&&N.length>0&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(Ks,{entries:N,isRunning:!0})}),C&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(Ys,{error:C,onRetry:()=>I()})}),A&&a.jsx(Dg,{evals:E,onSave:G=>{s(G),_(!1)},onCancel:()=>_(!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 (",R.length,")"]}),a.jsx("div",{className:"flex items-center gap-1.5",children:w?a.jsx("button",{onClick:d,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel All"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>c("benchmark"),disabled:R.length===0||h,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),a.jsx("button",{onClick:()=>c("comparison"),disabled:R.length===0||h,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(G=>a.jsx("button",{onClick:()=>L(G),style:{padding:"2px 8px",fontSize:10,fontWeight:H===G?600:400,background:H===G?"var(--accent-muted)":"transparent",color:H===G?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:G==="all"?`All (${D.length})`:G==="unit"?`Unit (${D.filter(ce=>gl(ce)==="unit").length})`:`Integration (${D.filter(ce=>gl(ce)==="integration").length})`},G))}),a.jsxs("div",{className:"py-1",children:[R.length===0&&D.length>0&&a.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",H==="all"?"":H+" ","tests yet"]}),R.map(G=>{var se;const ce=b.get(G.id),O=v===G.id,Y=gl(G);return a.jsxs("button",{onClick:()=>l({type:"SELECT_CASE",caseId:G.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:O?"var(--accent-muted)":"transparent",borderLeft:O?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:de=>{O||(de.currentTarget.style.background="var(--surface-2)")},onMouseLeave:de=>{O||(de.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:O?"var(--text-primary)":"var(--text-secondary)"},children:["#",G.id," ",G.name,a.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:Y==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:Y==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:Y==="unit"?"U":"I"}),Y==="integration"&&((se=G.requiredCredentials)==null?void 0:se.some(de=>Q.has(de)))&&a.jsx("span",{title:"Configure credentials to run",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",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(hy,{result:ce})]}),a.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[G.assertions.length," assertion",G.assertions.length!==1?"s":"",(ce==null?void 0:ce.passRate)!=null&&a.jsx(gC,{passRate:ce.passRate})]})]},G.id)})]}),a.jsx("div",{className:"px-3 py-2",children:!h&&a.jsx("button",{onClick:()=>_(!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:G=>{G.currentTarget.style.borderColor="var(--accent)",G.currentTarget.style.color="var(--accent)"},onMouseLeave:G=>{G.currentTarget.style.borderColor="var(--border-default)",G.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(dC,{})})]}),a.jsx("div",{className:"overflow-auto",children:B?a.jsx(hC,{evalCase:B,result:b.get(B.id),evals:p,caseStatus:((X=j.get(B.id))==null?void 0:X.status)??"idle",onSaveEvals:s,onRun:G=>o(G,"benchmark"),onCompare:G=>o(G,"comparison"),onCancel:G=>f(G),onImprove:G=>l({type:"OPEN_IMPROVE",evalId:G})}):a.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),A&&a.jsx(Dg,{evals:E,onSave:G=>{s(G),_(!1)},onCancel:()=>_(!1)})]})}function hC({evalCase:n,result:l,evals:s,caseStatus:o,onSaveEvals:c,onRun:f,onCompare:d,onCancel:x,onImprove:h}){const{state:p,isReadOnly:y}=En(),{plugin:v,skill:b}=p,{entries:j,loading:k}=fC(v,b,n.id),[N,C]=g.useState(!1),[w,A]=g.useState(n.prompt),[_,H]=g.useState(!1),[L,$]=g.useState(n.expected_output);g.useState(()=>{A(n.prompt),$(n.expected_output)});const E=g.useCallback(G=>{c({...s,evals:s.evals.map(ce=>ce.id===G.id?G:ce)})},[s,c]),D=g.useCallback(()=>{E({...n,prompt:w}),C(!1)},[n,w,E]),R=g.useCallback(()=>{E({...n,expected_output:L}),H(!1)},[n,L,E]),B=g.useCallback(()=>{E({...n,assertions:[...n.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[n,E]),V=g.useCallback((G,ce)=>{E({...n,assertions:n.assertions.map(O=>O.id===G?{...O,text:ce}:O)})},[n,E]),W=g.useCallback(G=>{E({...n,assertions:n.assertions.filter(ce=>ce.id!==G)})},[n,E]),te=g.useCallback(()=>{confirm("Delete this test case?")&&c({...s,evals:s.evals.filter(G=>G.id!==n.id)})},[s,n.id,c]),Q=l&&l.assertions.length>0&&l.assertions.every(G=>G.pass),z=l&&l.assertions.some(G=>!G.pass),M=gl(n),I=n.requiredCredentials??[],X=M==="integration"&&I.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:["#",n.id," ",n.name]}),y?a.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:M==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:M==="unit"?"var(--accent)":"var(--orange)"},children:M==="unit"?"Unit":"Integration"}):a.jsx("button",{onClick:()=>{if((M==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:ce,requirements:O,cleanup:Y,...se}=n;E({...se,testType:"unit"})}else E({...n,testType:"integration"})},title:`Click to switch to ${M==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:M==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:M==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:M==="unit"?"Unit":"Integration"}),a.jsx(hy,{result:l})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?a.jsxs("button",{onClick:()=>x(n.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},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:()=>f(n.id),disabled:y,className:"btn btn-primary text-[12px]",children:"Run"}),a.jsx("button",{onClick:()=>d(n.id),disabled:y,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),z&&!y&&o!=="running"&&o!=="queued"&&a.jsx("button",{onClick:()=>h(n.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&a.jsx("button",{onClick:te,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"})]})})]})]}),y&&M==="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 var(--accent-muted)"},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"})]}),Q&&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 var(--green-muted)"},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"})]}),X&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},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:"var(--orange)",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:"var(--orange)"},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:I.map(G=>a.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:G},G))})]}),!y&&M==="integration"&&a.jsx(bC,{evalCase:n,onUpdate:E}),a.jsx(po,{title:"Prompt",children:N?a.jsxs("div",{children:[a.jsx("textarea",{value:w,onChange:G=>A(G.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:D,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{A(n.prompt),C(!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:y?"default":"pointer"},onClick:()=>{y||C(!0)},onMouseEnter:G=>{y||(G.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:G=>{G.currentTarget.style.borderColor="var(--border-subtle)"},children:n.prompt||a.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),a.jsx(po,{title:"Expected Output",children:_?a.jsxs("div",{children:[a.jsx("textarea",{value:L,onChange:G=>$(G.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:R,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{$(n.expected_output),H(!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:y?"default":"pointer"},onClick:()=>{y||H(!0)},onMouseEnter:G=>{y||(G.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:G=>{G.currentTarget.style.borderColor="var(--border-subtle)"},children:n.expected_output||a.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),a.jsx(po,{title:`Assertions (${n.assertions.length})`,action:y?void 0:a.jsx("button",{onClick:B,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:n.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:n.assertions.map(G=>{const ce=l==null?void 0:l.assertions.find(Y=>Y.assertion_id===G.id),O=pC(G.id,ce,j);return a.jsx(xC,{assertion:G,result:ce,badges:O,isReadOnly:y,onUpdate:Y=>V(G.id,Y),onDelete:()=>W(G.id)},G.id)})})}),(l==null?void 0:l.output)&&a.jsx(vC,{output:l.output,durationMs:l.durationMs,tokens:l.tokens}),l&&l.passRate!=null&&l.passRate<.2&&(()=>{const G=py("INEFFECTIVE",l.passRate);return G.recommendations&&G.recommendations.length>0?a.jsx(po,{title:"Recommendations",children:a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},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:"var(--orange)",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:"var(--orange)"},children:"This eval is significantly below expectations"})]}),a.jsx("ul",{className:"space-y-1.5 ml-1",children:G.recommendations.map((ce,O)=>a.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"var(--orange)",fontWeight:600,flexShrink:0},children:"•"}),ce]},O))})]})}):null})(),a.jsx(yC,{evalId:n.id,sharedEntries:j,sharedLoading:k})]},n.id)}function xC({assertion:n,result:l,badges:s,isReadOnly:o,onUpdate:c,onDelete:f}){const[d,x]=g.useState(!1),[h,p]=g.useState(n.text),[y,v]=g.useState(!1),b=()=>{c(h),x(!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:[l?a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:l.pass?"var(--green-muted)":"var(--red-muted)"},children:l.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"}),(s==null?void 0:s.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:n.id}),(s==null?void 0:s.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:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(s==null?void 0:s.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."})]}),d?a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:h,onChange:j=>p(j.target.value),onKeyDown:j=>{j.key==="Enter"&&b(),j.key==="Escape"&&x(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),a.jsx("button",{onClick:b,className:"btn btn-primary text-[11px]",children:"Save"})]}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(p(n.text),x(!0))},children:n.text}),(l==null?void 0:l.reasoning)&&a.jsx("button",{onClick:()=>v(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(l==null?void 0:l.reasoning)&&a.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:l.reasoning})]}),!o&&a.jsx("button",{onClick:f,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:j=>{j.currentTarget.style.color="var(--red)",j.currentTarget.style.opacity="1"},onMouseLeave:j=>{j.currentTarget.style.color="var(--text-tertiary)",j.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 po({title:n,action:l,children:s}){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:n}),l]}),s]})}function hy({result:n}){const[l,s]=g.useState(!1);if(!n||n.status==null)return a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const o=n.status==="pass",c=n.passRate??0,d=py(o?"PASS":"FAIL",c);return a.jsxs("span",{className:"pill text-[10px]",style:{background:o?"var(--green-muted)":"var(--red-muted)",color:o?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),"aria-describedby":l?"verdict-tooltip":void 0,children:[n.passRate!=null?`${Math.round(n.passRate*100)}%`:n.status,l&&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:d.explanation})]})}function gC({passRate:n}){const l=Math.round(n*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:`${l}%`,background:l>=80?"var(--green)":l>=50?"var(--yellow)":"var(--red)"}})})})}function vC({output:n,durationMs:l,tokens:s}){const[o,c]=g.useState(!1);return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:()=>c(!o),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:o?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",l!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",(l/1e3).toFixed(1),"s)"]}),s!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",s," tokens)"]})]}),o&&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:n})]})}function kd(n){return n==="baseline"?"right":n==="comparison"?"full":"left"}function wd({entry:n}){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:uy(n.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:n.model}),a.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:n.type==="benchmark"?"var(--accent-muted)":n.type==="comparison"?"var(--purple-muted)":"var(--orange-muted)",color:n.type==="benchmark"?"var(--accent)":n.type==="comparison"?"var(--purple)":"var(--orange)"},children:n.type}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:kl(n.pass_rate)},children:[Math.round(n.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:[n.durationMs!=null&&a.jsx("span",{children:dy(n.durationMs)}),n.tokens!=null&&a.jsxs("span",{children:[n.tokens>=1e3?`${(n.tokens/1e3).toFixed(1)}k`:n.tokens," tok"]})]}),n.type==="comparison"&&n.baselinePassRate!=null&&(()=>{const l=n.pass_rate-n.baselinePassRate,s=l>.001?"skill":l<-.001?"baseline":"tie",o=l>0?"+":"",c=s==="skill"?"var(--green)":s==="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:l>=0?"var(--green)":"var(--red)"},children:[o,(l*100).toFixed(1),"%"]}),a.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:c},children:s})]})})(),a.jsx("div",{className:"space-y-0.5",children:n.assertions.map(l=>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:l.pass?"var(--green-muted)":"var(--red-muted)"},children:l.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:l.text})]},l.id))})]})}function yC({evalId:n,sharedEntries:l,sharedLoading:s}){const{state:o,dispatch:c}=En(),{plugin:f,skill:d}=o,[x,h]=g.useState(!0),p=l??null,y=s??!1,v=g.useCallback(()=>{h(N=>!N)},[]),b=p?p.slice(0,10):[],j=b.some(N=>{const C=kd(N.type);return C==="left"||C==="full"}),k=b.some(N=>{const C=kd(N.type);return C==="right"||C==="full"});return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:v,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:x?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",p&&p.length>0&&a.jsxs("span",{style:{fontWeight:400},children:["(",p.length," run",p.length!==1?"s":"",")"]})]}),x&&a.jsx("div",{className:"animate-fade-in",children:y?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..."})]}):!p||p.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:[b.length>=2&&a.jsx("div",{className:"mb-2",children:a.jsx(fy,{entries:b})}),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"}),!j&&a.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!k&&a.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),b.map((N,C)=>{const w=kd(N.type);return w==="full"?a.jsx("div",{style:{gridColumn:"1 / -1"},children:a.jsx(wd,{entry:N})},C):w==="left"?a.jsxs(g.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"},children:a.jsx(wd,{entry:N})}),a.jsx("div",{style:{gridColumn:"2"}})]},C):a.jsxs(g.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"}}),a.jsx("div",{style:{gridColumn:"2"},children:a.jsx(wd,{entry:N})})]},C)})]}),a.jsx("button",{onClick:()=>c({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:N=>{N.currentTarget.style.textDecoration="underline"},onMouseLeave:N=>{N.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Dg({evals:n,onSave:l,onCancel:s}){const[o,c]=g.useState(""),[f,d]=g.useState(""),[x,h]=g.useState(""),[p,y]=g.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[v,b]=g.useState("unit"),[j,k]=g.useState(""),[N,C]=g.useState([]),[w,A]=g.useState(""),[_,H]=g.useState(""),L=Math.max(0,...n.evals.map(R=>R.id))+1,$=R=>{b(R),R==="unit"&&(C([]),k(""),A(""),H(""))},E=()=>{const R=j.trim().toUpperCase();R&&!N.includes(R)&&C([...N,R]),k("")},D=()=>{if(!o.trim()||!f.trim())return;const R={id:L,name:o.trim(),prompt:f.trim(),expected_output:x.trim(),files:[],assertions:p.filter(B=>B.text.trim()),...v==="integration"?{testType:"integration",...N.length>0?{requiredCredentials:N}:{},...w||_?{requirements:{...w?{platform:w}:{},..._?{chromeProfile:_}:{}}}:{}}:{}};l({...n,evals:[...n.evals,R]})};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(R=>a.jsx("button",{onClick:()=>$(R),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:v===R?R==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:v===R?R==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:R},R))})]}),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:o,onChange:R=>c(R.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:f,onChange:R=>d(R.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:x,onChange:R=>h(R.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"}),p.map((R,B)=>a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:R.text,onChange:V=>y(p.map((W,te)=>te===B?{...W,text:V.target.value}:W)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),p.length>1&&a.jsx("button",{onClick:()=>y(p.filter((V,W)=>W!==B)),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"})]})})]},R.id)),a.jsx("button",{onClick:()=>y([...p,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),v==="integration"&&a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},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:N.map(R=>a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[R,a.jsx("button",{onClick:()=>C(N.filter(B=>B!==R)),style:{color:"var(--orange)",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"})]})})]},R))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:j,onChange:R=>k(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),E())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),a.jsx("button",{onClick:E,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},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:w,onChange:R=>A(R.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:_,onChange:R=>H(R.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:s,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsx("button",{onClick:D,disabled:!o.trim()||!f.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function bC({evalCase:n,onUpdate:l}){var d,x;const[s,o]=g.useState(""),c=()=>{const h=s.trim().toUpperCase();h&&!(n.requiredCredentials??[]).includes(h)&&l({...n,requiredCredentials:[...n.requiredCredentials??[],h]}),o("")},f=h=>{const p=(n.requiredCredentials??[]).filter(y=>y!==h);l({...n,requiredCredentials:p.length>0?p:void 0})};return a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},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:(n.requiredCredentials??[]).map(h=>a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[h,a.jsx("button",{onClick:()=>f(h),style:{color:"var(--orange)",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"})]})})]},h))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:s,onChange:h=>o(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),c())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),a.jsx("button",{onClick:c,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},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:((d=n.requirements)==null?void 0:d.platform)??"",onChange:h=>l({...n,requirements:{...n.requirements,platform:h.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:((x=n.requirements)==null?void 0:x.chromeProfile)??"",onChange:h=>l({...n,requirements:{...n.requirements,chromeProfile:h.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Cn(n,l){return l==="free"?"Free":l==="subscription"&&n==null?"Subscription":n==null?"N/A":n>=1?`$${n.toFixed(2)}`:n===0?"$0.00":n>=.001?`$${n.toFixed(4)}`:`$${n.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function xy(n,l){return n==null||l==null?"N/A":`${n.toLocaleString("en-US")} in / ${l.toLocaleString("en-US")} out`}function SC(n){return n==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function jC(n,l){let s="";if(l){const c=new Date(l);isNaN(c.getTime())||(s=c.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[n,s].filter(Boolean).join(" · ")}function kC(n,l,s){const o=s===1?"test case":"test cases";if(n===0)return`Your skill performs the same as the baseline across ${s} ${o}`;const c=Math.round(Math.abs(n)*l);if(c===0)return`Your skill performs the same as the baseline across ${s} ${o}`;const f=n>0?"more":"fewer";return`Your skill passes ${c} ${f} assertions across ${s} ${o}`}function _g(n,l){const s=o=>{const c=o/5*100;return isFinite(c)?Math.round(Math.min(100,Math.max(0,c))):0};return{skill:s(n),baseline:s(l)}}function wC(n){return n==="skill"?{text:"Skill wins",isSkill:!0}:n==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function CC(n,l){const s=n+l,o=s*10,c=s*25,f=d=>d>=60?`${Math.round(d/60)}m`:`${d}s`;return`${f(o)}–${f(c)}`}const EC={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function NC(n,l){if(!n)return null;const s=EC[n];if(s==null||s===0)return null;const o=s*l*.5,c=s*l*2;return`${Cn(o)}–${Cn(c)}`}function TC(){const{state:n,runCase:l,runAll:s,cancelCase:o,cancelAll:c,isReadOnly:f}=En(),{evals:d,caseRunStates:x,bulkRunActive:h,latestBenchmark:p,inlineResults:y}=n,{config:v}=Rr(),b=(d==null?void 0:d.evals)??[],j=g.useMemo(()=>{for(const E of x.values())if(E.status==="running"||E.status==="queued")return!0;return!1},[x]),k=b.filter(E=>{const D=x.get(E.id);return D&&(D.status==="complete"||D.status==="error"||D.status==="cancelled")}).length,N=b.filter(E=>{const D=x.get(E.id);return D&&(D.status==="running"||D.status==="queued")}).length,C=g.useRef(null),[w,A]=g.useState(0);g.useEffect(()=>{if(j&&!C.current&&(C.current=Date.now()),!j){C.current=null,A(0);return}const E=setInterval(()=>{C.current&&A(Math.round((Date.now()-C.current)/1e3))},1e3);return()=>clearInterval(E)},[j]);const _=b.reduce((E,D)=>E+D.assertions.length,0),H=b.length+_,L=g.useMemo(()=>CC(b.length,_),[b.length,_]),$=g.useMemo(()=>NC((v==null?void 0:v.provider)??null,H),[v==null?void 0:v.provider,H]);return a.jsxs("div",{className:"p-5",children:[f&&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"}),j&&a.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[N," running"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[j&&a.jsxs("button",{onClick:c,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},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:()=>s("comparison"),disabled:b.length===0||j||f,className:"btn btn-primary text-[12px]",title:"Runs both your skill and the baseline, then compares results side by side",children:"Run A/B Test"}),a.jsx("button",{onClick:()=>s("benchmark"),disabled:b.length===0||j||f,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),a.jsx("button",{onClick:()=>s("baseline"),disabled:b.length===0||j||f,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!j&&b.length>0&&a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:["Est. duration: ",L]}),$&&a.jsxs("span",{children:["Est. cost: ",$]}),!$&&(v==null?void 0:v.provider)&&(v.provider==="claude-cli"||v.provider==="codex-cli")&&a.jsx("span",{children:"Cost: Subscription"}),!$&&(v==null?void 0:v.provider)&&(v.provider==="ollama"||v.provider==="lm-studio"||v.provider==="gemini-cli")&&a.jsx("span",{children:"Cost: Free"})]})]}),j&&b.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: ",k,"/",b.length," cases"]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(k/b.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:`${k/b.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: ",w>=60?`${Math.floor(w/60)}m ${w%60}s`:`${w}s`]}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",L]})]})]}),a.jsx("div",{className:"space-y-3 stagger-children",children:b.map(E=>{const D=y.get(E.id),R=x.get(E.id),B=(R==null?void 0:R.status)??"idle",V=p==null?void 0:p.cases.find(W=>W.eval_id===E.id);return a.jsx(AC,{name:E.name,evalId:E.id,result:D,caseCost:V==null?void 0:V.cost,caseBillingMode:V==null?void 0:V.billingMode,caseInputTokens:V==null?void 0:V.inputTokens,caseOutputTokens:V==null?void 0:V.outputTokens,caseStatus:B,runMode:(R==null?void 0:R.mode)??null,comparisonDetail:V==null?void 0:V.comparisonDetail,isReadOnly:f,onRun:W=>l(W,"benchmark"),onBaseline:W=>l(W,"baseline"),onCompare:W=>l(W,"comparison"),onCancel:W=>o(W)},E.id)})}),!j&&p&&p.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:SC(p.type)}),a.jsx("span",{className:"text-[20px] font-bold",style:{color:(p.overall_pass_rate??0)>=.8?"var(--green)":(p.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:p.overall_pass_rate!=null?`${Math.round(p.overall_pass_rate*100)}%`:"--"})]}),p.totalDurationMs!=null&&a.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(p.totalDurationMs/1e3).toFixed(1),"s",p.model&&` | Model: ${p.model}`,p.totalInputTokens!=null&&p.totalOutputTokens!=null&&` | Tokens: ${xy(p.totalInputTokens,p.totalOutputTokens)}`,p.totalCost!=null&&` | Cost: ${Cn(p.totalCost)}`]}),p.overall_pass_rate>=.9999&&!p.comparison&&a.jsx("button",{onClick:()=>s("comparison"),disabled:b.length===0||f,className:"text-[13px] font-semibold mt-3 w-full rounded-lg transition-opacity duration-150",style:{padding:"10px 0",background:"var(--green)",color:"var(--color-paper)",border:"none",cursor:"pointer",opacity:b.length===0?.5:1},children:"Run Final A/B Comparison"})]}),p.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",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const E=jC(p.model,p.timestamp);return E?a.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:E}):a.jsx("div",{className:"mb-3"})})(),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Og,{label:"Skill",value:p.comparison.skillPassRate,color:"var(--accent)"}),a.jsx(Og,{label:"Baseline",value:p.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),a.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:p.comparison.delta>0?"var(--green)":p.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",p.comparison.delta>0?"+":"",(p.comparison.delta*100).toFixed(1),"%",p.verdict&&` | ${uC(p.verdict)}`]}),(()=>{const E=p.cases.reduce((R,B)=>R+B.assertions.length,0),D=kC(p.comparison.delta,E,p.cases.length);return a.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:D})})()]})]})]})}const RC={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:"var(--purple-muted)",color:"var(--purple)"}};function AC({name:n,evalId:l,result:s,caseCost:o,caseBillingMode:c,caseInputTokens:f,caseOutputTokens:d,caseStatus:x,runMode:h,comparisonDetail:p,isReadOnly:y,onRun:v,onBaseline:b,onCompare:j,onCancel:k}){const[N,C]=g.useState(!1),w=x==="running"||x==="queued",A=x==="complete"||x==="error";return a.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:w?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:w?"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:[x==="running"&&a.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),x==="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:["#",l," ",n]}),h&&(w||A)&&(()=>{const _=RC[h];return _?a.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:_.bg,color:_.color,padding:"1px 6px"},children:_.label}):null})()]}),a.jsxs("div",{className:"flex items-center gap-2",children:[w?a.jsx("button",{onClick:()=>k(l),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>j(l),disabled:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),a.jsx("button",{onClick:()=>v(l),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),a.jsx("button",{onClick:()=>b(l),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),s&&s.status!=null&&a.jsx("span",{className:"pill text-[10px]",style:{background:s.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:s.status==="pass"?"var(--green)":"var(--red)"},children:s.passRate!=null?`${Math.round(s.passRate*100)}%`:s.status}),f!=null&&d!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:xy(f,d)}),o!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Cn(o,c)}),x==="cancelled"&&a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),s&&s.assertions.length>0&&a.jsxs("div",{className:"px-4 pb-3",children:[a.jsx("div",{className:"space-y-1",children:s.assertions.map(_=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{style:{color:_.pass?"var(--green)":"var(--red)"},children:_.pass?"PASS":"FAIL"}),a.jsx("span",{style:{color:"var(--text-secondary)"},children:_.text})]},_.assertion_id))}),s.output&&a.jsx("button",{onClick:()=>C(!N),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:N?"Hide output":"Show output"}),N&&s.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:s.output})]}),p&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:a.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const _=_g(p.skillContentScore,p.baselineContentScore),H=_g(p.skillStructureScore,p.baselineStructureScore),L=wC(p.winner);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",_.skill,"% / Baseline ",_.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",H.skill,"% / Baseline ",H.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsx("span",{style:{color:L.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:L.text})]})})()})})}),s&&s.errorMessage&&a.jsx(MC,{errorMessage:s.errorMessage,classifiedError:s.classifiedError})]})}const Cd={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function MC({errorMessage:n,classifiedError:l}){const[s,o]=g.useState(!1),c=(l==null?void 0:l.title)??"Error",f=l==null?void 0:l.hint,d=l?Cd[l.category]??Cd.unknown:Cd.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 var(--red-muted)"},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsx("span",{style:{fontSize:12},children:d}),a.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:c}),a.jsx("button",{onClick:()=>o(!s),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:s?"Hide details":"Details"})]}),f&&a.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:f}),s&&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:n})]})})}function Og({label:n,value:l,color:s}){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:n}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:s},children:[Math.round(l*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:`${l*100}%`,background:s}})})]})}const Bg={TP:{bg:"var(--green-muted)",text:"var(--green)"},TN:{bg:"var(--green-muted)",text:"var(--green)"},FP:{bg:"var(--red-muted)",text:"var(--red)"},FN:{bg:"var(--red-muted)",text:"var(--red)"}};function LC(){const{state:n,dispatch:l,runActivationTest:s,cancelActivation:o,generateActivationPrompts:c}=En(),{plugin:f,skill:d,activationPrompts:x,activationResults:h,activationSummary:p,activationRunning:y,activationError:v,activationStartedAt:b,activationClassifyingStatus:j,generatingPrompts:k,generatingPromptsError:N,activationHistory:C}=n,[w,A]=g.useState(x),[_,H]=g.useState(null),[L,$]=g.useState(!1);g.useEffect(()=>{x&&x!==w&&A(x)},[x]),g.useEffect(()=>{l({type:"SET_ACTIVATION_PROMPTS",prompts:w})},[w,l]),g.useEffect(()=>{fetch(`/api/skills/${f}/${d}/description`).then(z=>z.json()).then(z=>H(z.rawContent||z.description||null)).catch(()=>H(null))},[f,d]);function E(){s(w)}function D(){c(8)}const R=w.trim().split(`
81
+ `).filter(Boolean).length,B=h.filter(z=>z.classification==="TP"||z.classification==="TN"),V=h.filter(z=>z.classification==="FP"||z.classification==="FN"),W=(_==null?void 0:_.replace(/^---[\s\S]*?---\s*/,"").trim())??null,te=w.trim().length>0,Q=W?Vo(W):"";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:D,disabled:k||!W||y,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:k?"var(--surface-3)":"var(--surface-2)",color:W?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:W?1:.5,cursor:W?"pointer":"not-allowed"},title:W?void 0:"No skill description available",onMouseEnter:z=>{W&&!k&&(z.currentTarget.style.background="var(--surface-3)")},onMouseLeave:z=>{k||(z.currentTarget.style.background="var(--surface-2)")},children:k?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"})}),te?"Regenerate":"Generate"," Test Prompts"]})})})]}),!W&&!y&&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."}),N&&a.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:N}),a.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:w,onChange:z=>A(z.target.value),placeholder:`How do I write a unit test?
82
+ What edge cases should I test?
83
+ +Deploy this to production
84
+ !What's the weather like today?
85
+ !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(mo,{}),a.jsx("span",{children:"No prefix = auto-classify"}),a.jsx(mo,{}),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(mo,{}),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(mo,{}),a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[R," prompt",R!==1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:E,disabled:y||!w.trim(),className:"btn btn-primary",children:y?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",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"]})}),y&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[j||`${h.length} / ${R} prompts tested`,b&&a.jsx(OC,{startedAt:b})]})]})]})]}),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:W?a.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:Q}}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),v&&a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:v}),y&&h.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..."})]}),h.length>0&&a.jsxs("div",{className:"space-y-5",children:[V.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 (",V.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:V.map((z,M)=>a.jsx(Ig,{result:z},`incorrect-${M}`))})]}),B.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 (",B.length,")"]})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:B.map((z,M)=>a.jsx(Ig,{result:z},`correct-${M}`))})]})]}),p&&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"}),p.autoClassifiedCount!=null&&p.autoClassifiedCount>0&&a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[p.autoClassifiedCount," of ",p.total," prompts auto-classified from skill name and tags"]}),a.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[a.jsx(Ed,{label:"Precision",value:p.precision,description:"Of all activations, how many were correct?",detail:`${p.tp} true / ${p.tp+p.fp} total activations`}),a.jsx(Ed,{label:"Recall",value:p.recall,description:"Of expected activations, how many fired?",detail:`${p.tp} activated / ${p.tp+p.fn} expected`}),a.jsx(Ed,{label:"Reliability",value:p.reliability,description:"Overall correct classification rate",detail:`${p.tp+p.tn} correct / ${p.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(ho,{label:"True Positive",abbr:"TP",count:p.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),a.jsx(ho,{label:"False Positive",abbr:"FP",count:p.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),a.jsx(ho,{label:"False Negative",abbr:"FN",count:p.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),a.jsx(ho,{label:"True Negative",abbr:"TN",count:p.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),a.jsx(zC,{history:C,expanded:L,onToggle:()=>$(!L)})]})}function zC({history:n,expanded:l,onToggle:s}){return n===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:l?"1px solid var(--border-subtle)":"none"},onClick:s,children:[a.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",n.length>0&&a.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",n.length," run",n.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:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),l&&a.jsx("div",{className:"px-4 py-3",children:n.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:n.map(o=>a.jsx(DC,{run:o},o.id))})})]})}function DC({run:n}){const l=Math.round(n.summary.reliability*100),s=l>=80?"var(--green)":l>=60?"var(--yellow)":"var(--red)",o=l>=80?"Good":l>=60?"Needs Work":"Poor",c=s;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:_C(n.timestamp)}),a.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:n.model||n.provider}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[n.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:s,fontVariantNumeric:"tabular-nums"},children:[l,"%"]}),a.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:c,background:`color-mix(in srgb, ${c} 10%, transparent)`},children:o})]})]})}function _C(n){const l=Date.now(),s=new Date(n).getTime(),o=Math.floor((l-s)/1e3);if(o<60)return"just now";const c=Math.floor(o/60);if(c<60)return`${c}m ago`;const f=Math.floor(c/60);if(f<24)return`${f}h ago`;const d=Math.floor(f/24);return d<7?`${d}d ago`:new Date(n).toLocaleDateString()}function mo(){return a.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Ig({result:n}){const l=Bg[n.classification]||Bg.FN,s=n.classification==="TP"||n.classification==="TN";return a.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:l.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, ${l.text} 20%, transparent)`},children:s?a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:l.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:l.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:n.prompt})}),a.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[a.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:l.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:n.classification}),a.jsx("span",{style:{color:n.activate?"var(--green)":"var(--text-tertiary)"},children:n.activate?"Activated":"Silent"}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",n.expected==="should_activate"?"activate":"stay silent"]}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[n.confidence," confidence"]}),n.autoClassified&&a.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),n.reasoning&&a.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:n.reasoning})]})]})}function Ed({label:n,value:l,description:s,detail:o}){const c=Math.round(l*100),f=c>=80?"var(--green)":c>=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:f},children:[c,"%"]}),a.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:n}),a.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:s}),a.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function ho({abbr:n,count:l,bg:s,color:o,description:c}){return a.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:s},children:[a.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:l}),a.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:n}),a.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:c})]})}function OC({startedAt:n}){const[l,s]=g.useState(0);return g.useEffect(()=>{const o=setInterval(()=>s(Math.floor((Date.now()-n)/1e3)),1e3);return()=>clearInterval(o)},[n]),a.jsxs("span",{className:"ml-2",children:["(",l,"s)"]})}const Nd={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Hg={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},Xd=600,Qd=180,an=40,Td=Xd-an*2,Za=Qd-an*2,BC=[25,50,75,100];function Ug(n){return new Date(n).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function IC(n){return n==null?"--":`${(n/1e3).toFixed(1)}s`}function HC({entries:n,onPointClick:l}){const[s,o]=g.useState(null),c=g.useMemo(()=>[...n].reverse(),[n]);if(c.length<2)return null;const f=c.length,d=c.map((p,y)=>{const v=an+y/(f-1)*Td,b=p.passRate*100,j=an+Za-b/100*Za;return{x:v,y:j,pct:b,entry:p}}),x=d.map(p=>`${p.x},${p.y}`).join(" "),h=Array.from(new Set(c.map(p=>p.type)));return a.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:f>=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:h.map(p=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Nd[p]??"var(--text-tertiary)"}}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Hg[p]??p})]},p))}),a.jsxs("svg",{width:Xd,height:Qd,viewBox:`0 0 ${Xd} ${Qd}`,style:{display:"block",overflow:"visible"},children:[BC.map(p=>{const y=an+Za-p/100*Za;return a.jsxs("g",{children:[a.jsx("line",{x1:an,y1:y,x2:an+Td,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),a.jsxs("text",{x:an-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[p,"%"]})]},p)}),a.jsx("line",{x1:an,y1:an+Za,x2:an+Td,y2:an+Za,stroke:"var(--border-subtle)",strokeWidth:1}),a.jsx("text",{x:an-8,y:an+Za+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),a.jsx("polyline",{points:x,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),d.map((p,y)=>a.jsx("circle",{cx:p.x,cy:p.y,r:5,fill:Nd[p.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:v=>{v.currentTarget.setAttribute("r","7"),o({x:p.x,y:p.y,entry:p.entry})},onMouseLeave:v=>{v.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>l==null?void 0:l(p.entry)},y)),UC(f).map(p=>a.jsx("text",{x:d[p].x,y:an+Za+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Ug(c[p].timestamp)},p))]}),s&&a.jsxs("div",{style:{position:"absolute",left:s.x,top:s.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:Ug(s.entry.timestamp)}),a.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:s.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:Nd[s.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Hg[s.entry.type]??s.entry.type}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(s.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:IC(s.entry.totalDurationMs)}),a.jsx("span",{children:s.entry.totalTokens!=null?`${s.entry.totalTokens} tokens`:"--"})]})]})]})}function UC(n){if(n<=3)return Array.from({length:n},(o,c)=>c);if(n<=6)return[0,Math.floor(n/2),n-1];if(n<20)return[0,Math.floor(n/3),Math.floor(2*n/3),n-1];const l=Math.ceil(n/10),s=[0];for(let o=l;o<n-1;o+=l)s.push(o);return s.push(n-1),s}const Rs=new Map;let rn=null,Co=null,xo=1e3,As=0;function gy(){if(rn)return;rn=new EventSource("/api/events");const n=l=>s=>{let o={};try{o=s.data?JSON.parse(s.data):{}}catch{}const c=Rs.get(l);if(c)for(const f of c)f(o)};rn.addEventListener("benchmark:complete",n("benchmark:complete")),rn.addEventListener("history:written",n("history:written")),rn.addEventListener("leaderboard:updated",n("leaderboard:updated")),rn.onerror=()=>{rn==null||rn.close(),rn=null,As>0&&(Co=setTimeout(()=>{xo=Math.min(xo*2,3e4),gy()},xo))},rn.onopen=()=>{xo=1e3}}function $C(){Co!=null&&(clearTimeout(Co),Co=null),rn==null||rn.close(),rn=null}function VC(n,l){return Rs.has(n)||Rs.set(n,new Set),Rs.get(n).add(l),As++,gy(),()=>{var s;(s=Rs.get(n))==null||s.delete(l),As--,As<=0&&(As=0,$C())}}function Mo(n,l){const s=g.useRef(l);s.current=l,g.useEffect(()=>VC(n,c=>s.current(c)),[n])}function Lo(n){return n>=.8?"var(--green)":n>=.5?"var(--yellow)":"var(--red)"}function PC(n){return n>=1e3?`${(n/1e3).toFixed(1)}s`:`${Math.round(n)}ms`}function FC({rate:n,label:l}){const s=Math.round(n*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:l}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:Lo(n)},children:[s,"%"]})]}),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:`${s}%`,background:Lo(n)}})})]})})}function GC({points:n}){if(n.length<2)return null;const l=200,s=48,o=4,c=n.length,f=n.map((h,p)=>{const y=o+p/(c-1)*(l-o*2),v=o+(s-o*2)-h.passRate*(s-o*2);return{x:y,y:v}}),d=`M ${f[0].x},${s-o} `+f.map(h=>`L ${h.x},${h.y}`).join(" ")+` L ${f[f.length-1].x},${s-o} Z`,x=f.map((h,p)=>`${p===0?"M":"L"} ${h.x},${h.y}`).join(" ");return a.jsxs("svg",{width:l,height:s,style:{display:"block"},children:[a.jsx("path",{d,fill:"var(--accent-muted)"}),a.jsx("path",{d:x,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),a.jsx("circle",{cx:f[f.length-1].x,cy:f[f.length-1].y,r:3,fill:"var(--accent)"})]})}function WC({plugin:n,skill:l}){const s=`stats/${n}/${l}`,o=g.useCallback(()=>Ne.getStats(n,l),[n,l]),{data:c,loading:f}=Nl(s,o),d=g.useCallback(()=>ln(s),[s]);if(Mo("benchmark:complete",d),Mo("history:written",d),f)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(!c||c.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 x=c.trendPoints.length>0?c.trendPoints[c.trendPoints.length-1].passRate:0,h=c.trendPoints.length>0?c.trendPoints[0].passRate:0,p=x-h,y=c.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:c.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:Lo(x)},children:[Math.round(x*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:p>=0?"var(--green)":"var(--red)"},children:[p>=0?"+":"",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:"Models Tested"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.modelStats.length})]}),c.totalCost!=null&&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 Cost"}),a.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Cn(c.totalCost)})]}),c.costPerRun!=null&&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:"Avg Cost/Run"}),a.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Cn(c.costPerRun)})]})]}),c.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(GC,{points:c.trendPoints})]}),c.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("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),a.jsx("tbody",{children:c.modelStats.map(v=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:v.model}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.runs}),a.jsx("td",{style:{padding:"8px",textAlign:"center"},children:a.jsxs("span",{className:"font-semibold",style:{color:Lo(v.avgPassRate)},children:[Math.round(v.avgPassRate*100),"%"]})}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:PC(v.avgDurationMs)}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.avgCost!=null?Cn(v.avgCost):"N/A"})]},v.model))})]})]}),y.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:y.map(v=>a.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--surface-2)"},onMouseLeave:b=>{b.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:["#",v.evalId]}),a.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:v.evalName}),a.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[v.totalRuns," runs"]})]}),a.jsx(FC,{rate:v.passRate,label:v.text})]},`${v.evalId}:${v.id}`))})]})]})}function qC({plugin:n,skill:l}){const[s,o]=g.useState(null),[c,f]=g.useState(null),[d,x]=g.useState({}),[h,p]=g.useState({});g.useEffect(()=>{Ne.getEvals(n,l).then(o).catch(()=>o(null))},[n,l]);async function y(v){if(c===v){f(null);return}if(f(v),!d[v]){p(b=>({...b,[v]:!0}));try{const b=await Ne.getCaseHistory(n,l,v);x(j=>({...j,[v]:b}))}catch{x(b=>({...b,[v]:[]}))}finally{p(b=>({...b,[v]:!1}))}}}return s?a.jsx("div",{className:"space-y-2 stagger-children",children:s.evals.map(v=>{const b=d[v.id]||[],j=c===v.id,k=h[v.id],N=b.length>0?b[0].pass_rate:null;return a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{onClick:()=>y(v.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:j?"var(--surface-2)":"transparent"},onMouseEnter:C=>{j||(C.currentTarget.style.background="var(--surface-2)")},onMouseLeave:C=>{j||(C.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:j?"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:["#",v.id]}),a.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:v.name}),b.length>=2&&a.jsx(fy,{entries:b}),N!=null&&a.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:kl(N)},children:[Math.round(N*100),"%"]}),b.length>0&&a.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[b.length," runs"]})]}),j&&a.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:k?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..."})]}):b.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:b.map((C,w)=>a.jsxs("div",{className:"p-4",style:{background:w===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:uy(C.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:C.model}),a.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:C.type==="benchmark"?"rgba(99,131,255,0.15)":C.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:C.type==="benchmark"?"#6383ff":C.type==="comparison"?"var(--purple)":"#fb923c"},children:C.type}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:kl(C.pass_rate)},children:[Math.round(C.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:[C.durationMs!=null&&a.jsx("span",{children:dy(C.durationMs)}),C.tokens!=null&&a.jsxs("span",{children:[C.tokens>=1e3?`${(C.tokens/1e3).toFixed(1)}k`:C.tokens," tok"]})]}),a.jsx("div",{className:"space-y-1",children:C.assertions.map(A=>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:A.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:A.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:A.text}),A.reasoning&&a.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:A.reasoning})]})]},A.id))})]},w))})})]},v.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 YC(){const{state:n,dispatch:l}=En(),{plugin:s,skill:o}=n,[c,f]=g.useState("timeline"),[d,x]=g.useState(""),[h,p]=g.useState(""),[y,v]=g.useState(!1),[b,j]=g.useState([]),[k,N]=g.useState(null),[C,w]=g.useState(!1),[A,_]=g.useState(null),[H,L]=g.useState(!1),$=`history/${s}/${o}?model=${d}&type=${h}`,E=g.useCallback(()=>Ne.getHistory(s,o,{model:d||void 0,type:h||void 0}),[s,o,d,h]),{data:D,loading:R}=Nl($,E),B=D??[];g.useEffect(()=>{!D||D.length<2||Ne.compareRuns(s,o,D[0].timestamp,D[1].timestamp).then(z=>{const M=z.regressions.filter(I=>I.change==="regression");l({type:"SET_REGRESSIONS",regressions:M})}).catch(()=>{})},[D,s,o,l]);const V=g.useCallback(()=>ln($),[$]);Mo("history:written",V);const W=g.useCallback(async z=>{if(y){j(M=>M.includes(z)?M.filter(I=>I!==z):M.length>=2?[M[1],z]:[...M,z]);return}L(!0);try{const M=await Ne.getHistoryEntry(s,o,z);_(M)}catch{}finally{L(!1)}},[s,o,y]),te=g.useCallback(async()=>{if(b.length===2){w(!0);try{const z=await Ne.compareRuns(s,o,b[0],b[1]);N(z)}catch{}finally{w(!1)}}},[s,o,b]),Q=[...new Set(B.map(z=>z.model))];return R?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(z=>a.jsx("button",{onClick:()=>f(z),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:c===z?"var(--accent-muted)":"transparent",color:c===z?"var(--accent)":"var(--text-tertiary)"},children:z==="timeline"?"Timeline":z==="per-eval"?"Per Eval":"Statistics"},z))}),c==="timeline"&&a.jsxs("div",{children:[B.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(HC,{entries:B,onPointClick:z=>W(z.timestamp)})}),a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("select",{value:d,onChange:z=>x(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Models"}),Q.map(z=>a.jsx("option",{value:z,children:z},z))]}),a.jsxs("select",{value:h,onChange:z=>p(z.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:()=>{v(!y),j([]),N(null)},className:`btn text-[12px] ${y?"btn-primary":"btn-secondary"}`,children:y?"Exit Compare":"Compare Runs"}),y&&b.length===2&&a.jsx("button",{onClick:te,disabled:C,className:"btn btn-primary text-[12px]",children:C?"Comparing...":"Compare"})]}),a.jsx("div",{className:"space-y-2",children:B.length===0?a.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):B.map(z=>{const M=b.includes(z.timestamp);return a.jsx("button",{onClick:()=>W(z.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:M?"var(--accent-muted)":"var(--surface-1)",border:M?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:I=>{M||(I.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:I=>{M||(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:[y&&a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:M?"var(--accent)":"var(--border-default)",background:M?"var(--accent)":"transparent"},children:M&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",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(z.timestamp).toLocaleString()}),a.jsx("span",{className:"pill text-[9px]",style:{background:z.type==="comparison"?"var(--purple-muted)":z.type==="baseline"?"var(--surface-3)":z.type==="model-compare"?"var(--accent-muted)":z.type==="improve"||z.type==="instruct"?"var(--purple-muted)":z.type==="ai-generate"?"var(--green-muted)":z.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:z.type==="comparison"?"var(--purple)":z.type==="baseline"?"var(--text-tertiary)":z.type==="model-compare"?"var(--accent)":z.type==="improve"||z.type==="instruct"?"var(--purple)":z.type==="ai-generate"?"var(--green)":z.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:z.type==="model-compare"?"model compare":z.type==="improve"?"ai improve":z.type==="instruct"?"ai edit":z.type==="ai-generate"?"ai generate":z.type==="eval-generate"?"eval generate":z.type})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:z.model}),z.totalCost!=null&&z.totalCost>0&&a.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:Cn(z.totalCost)}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:z.passRate>=.8?"var(--green)":z.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(z.passRate*100),"%"]})]})]})},z.timestamp)})}),k&&a.jsx(KC,{result:k}),A&&!y&&a.jsx(XC,{run:A,onClose:()=>_(null)})]}),c==="per-eval"&&a.jsx(qC,{plugin:s,skill:o}),c==="statistics"&&a.jsx(WC,{plugin:s,skill:o})]})}function KC({result:n}){const l=n.regressions.filter(o=>o.change==="regression"),s=n.regressions.filter(o=>o.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(n.runA.timestamp).toLocaleDateString()," vs ",new Date(n.runB.timestamp).toLocaleDateString()]}),(n.runA.totalCost!=null||n.runB.totalCost!=null)&&a.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[a.jsxs("span",{children:["Run A cost: ",Cn(n.runA.totalCost??null)]}),a.jsxs("span",{children:["Run B cost: ",Cn(n.runB.totalCost??null)]}),n.runA.totalCost!=null&&n.runB.totalCost!=null&&a.jsxs("span",{style:{color:n.runB.totalCost<=n.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",Cn(n.runB.totalCost-n.runA.totalCost)]})]}),l.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 (",l.length,")"]}),l.map(o=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",a.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),s.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 (",s.length,")"]}),s.map(o=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",a.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.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:n.caseDiffs.map(o=>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:["#",o.eval_id," ",o.eval_name]}),a.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateA!=null?o.passRateA>=.8?"var(--green)":o.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateA!=null?`${Math.round(o.passRateA*100)}%`:o.statusA}),a.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateB!=null?o.passRateB>=.8?"var(--green)":o.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateB!=null?`${Math.round(o.passRateB*100)}%`:o.statusB})]},o.eval_id))})]})})]})}function XC({run:n,onClose:l}){return(n.type==="improve"||n.type==="instruct")&&n.improve?a.jsx(QC,{run:n,onClose:l}):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(n.timestamp).toLocaleString()]}),a.jsx("button",{onClick:l,className:"btn btn-ghost text-[11px]",children:"Close"})]}),a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",n.model," | Cases: ",n.cases.length," | Pass Rate: ",n.overall_pass_rate!=null?`${Math.round(n.overall_pass_rate*100)}%`:"--",n.totalCost!=null&&n.totalCost>0&&` | Cost: ${Cn(n.totalCost)}`]}),a.jsx("div",{className:"space-y-2",children:n.cases.map(s=>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:["#",s.eval_id," ",s.eval_name]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s.cost!=null&&s.cost>0&&a.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:Cn(s.cost)}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:s.status==="pass"?"var(--green)":"var(--red)"},children:s.pass_rate!=null?`${Math.round(s.pass_rate*100)}%`:s.status})]})]})},s.eval_id))})]})}function QC({run:n,onClose:l}){var f;const s=g.useMemo(()=>n.improve?Po(n.improve.original,n.improve.improved):[],[n.improve]),o=g.useMemo(()=>{const d=s.filter(h=>h.type==="added").length,x=s.filter(h=>h.type==="removed").length;return{added:d,removed:x}},[s]),c=g.useMemo(()=>{let d=0,x=0;return s.map(h=>h.type==="removed"?(d++,{...h,origNum:d,newNum:null}):h.type==="added"?(x++,{...h,origNum:null,newNum:x}):(d++,x++,{...h,origNum:d,newNum:x}))},[s]);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:"var(--purple-muted)"},children:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",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(n.timestamp).toLocaleString()," · ",n.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:["+",o.added]}),a.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),a.jsx("button",{onClick:l,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:d=>{d.currentTarget.style.background="var(--surface-3)"},onMouseLeave:d=>{d.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"})]})})]})]}),((f=n.improve)==null?void 0:f.reasoning)&&a.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--purple-muted)",border:"1px solid var(--purple-muted)",color:"var(--text-secondary)"},children:[a.jsx("span",{className:"font-semibold",style:{color:"var(--purple)"},children:"AI Reasoning: "}),n.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:c.map((d,x)=>a.jsxs("tr",{style:{background:d.type==="added"?"var(--green-muted)":d.type==="removed"?"var(--red-muted)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:d.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:d.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:d.origNum??""}),a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:d.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:d.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:d.newNum??""}),a.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:d.type==="added"?"var(--green)":d.type==="removed"?"var(--red)":"transparent",borderRight:d.type==="added"?"2px solid var(--green)":d.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:d.type==="added"?"+":d.type==="removed"?"-":" "}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:d.type==="added"?"var(--green)":d.type==="removed"?"var(--red)":"var(--text-secondary)"},children:d.content||"​"})]},x))})})})]})}function ZC({plugin:n,skill:l}){const[s,o]=g.useState([]),[c,f]=g.useState([]),[d,x]=g.useState(!0),[h,p]=g.useState(null);g.useEffect(()=>{Ne.getDependencies(n,l).then(v=>{o(v.mcpDependencies),f(v.skillDependencies)}).catch(()=>{}).finally(()=>x(!1))},[n,l]);async function y(v,b){try{await navigator.clipboard.writeText(b),p(v),setTimeout(()=>p(null),2e3)}catch{}}return d?null:s.length===0&&c.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:s.length+c.length})]}),a.jsxs("div",{className:"px-5 py-4",children:[s.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"}),s.map(v=>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:v.server}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.transport})]}),a.jsx("button",{onClick:()=>y(v.server,v.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:h===v.server?"var(--green)":"var(--accent)"},children:h===v.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:v.url}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:v.matchedTools.map(b=>a.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:b},b))})]},v.server))]}),c.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:c.map(v=>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:v.name}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.source==="frontmatter"?"frontmatter":"referenced"})]},v.name))})]})]})]})}function $g({plugin:n,skill:l}){const[s,o]=g.useState([]),[c,f]=g.useState(!0),[d,x]=g.useState(null),[h,p]=g.useState(""),[y,v]=g.useState(!1),[b,j]=g.useState(null),[k,N]=g.useState(""),[C,w]=g.useState(""),[A,_]=g.useState(!1),[H,L]=g.useState(new Set),$=g.useCallback(async()=>{f(!0);try{const[B,V]=await Promise.all([Ne.getCredentials(n,l).catch(()=>({credentials:[]})),Ne.getParams(n,l).catch(()=>({params:[]}))]),W=new Map(V.params.map(z=>[z.name,z])),te=new Set,Q=[];for(const z of B.credentials){te.add(z.name);const M=W.get(z.name);Q.push({name:z.name,status:z.status==="ready"||z.status==="resolved"?"ready":"missing",source:z.source,maskedValue:M==null?void 0:M.maskedValue})}for(const z of V.params)te.has(z.name)||Q.push({name:z.name,status:z.status,maskedValue:z.maskedValue});o(Q)}finally{f(!1)}},[n,l]);g.useEffect(()=>{$()},[$]);const E=g.useCallback(async B=>{if(H.has(B)){L(V=>{const W=new Set(V);return W.delete(B),W}),o(V=>V.map(W=>W.name===B?{...W,revealedValue:void 0}:W));return}try{const W=(await Ne.getParamsRevealed(n,l,B)).params.find(te=>te.name===B);W&&(o(te=>te.map(Q=>Q.name===B?{...Q,revealedValue:W.value}:Q)),L(te=>new Set(te).add(B)))}catch{}},[n,l,H]),D=async(B,V)=>{if(!(!B.trim()||!V.trim())){v(!0),j(null);try{await Ne.setCredential(n,l,B,V),x(null),p(""),L(new Set),$()}catch(W){j(W.message)}finally{v(!1)}}},R=async()=>{if(!(!k.trim()||!C.trim())){v(!0),j(null);try{await Ne.setCredential(n,l,k.trim().toUpperCase(),C),N(""),w(""),_(!1),$()}catch(B){j(B.message)}finally{v(!1)}}};return c?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:()=>_(!A),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),b&&a.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:b}),s.length===0&&!A?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:s.map(B=>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:B.name}),B.maskedValue&&a.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:H.has(B.name)&&B.revealedValue!=null?B.revealedValue:B.maskedValue}),B.maskedValue&&a.jsx("button",{onClick:()=>E(B.name),className:"btn btn-ghost px-1",title:H.has(B.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:H.has(B.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:B.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:B.status==="ready"?"var(--green)":"var(--orange)"},children:B.status==="ready"?"ready":"missing"}),B.source&&a.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:B.source}),d===B.name?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{value:h,onChange:V=>p(V.target.value),onKeyDown:V=>{V.key==="Enter"&&D(B.name,h)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),a.jsx("button",{onClick:()=>D(B.name,h),disabled:y||!h.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),a.jsx("button",{onClick:()=>{x(null),p("")},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:()=>{x(B.name),p("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},B.name))}),A&&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:k,onChange:B=>N(B.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),a.jsx("input",{value:C,onChange:B=>w(B.target.value),onKeyDown:B=>{B.key==="Enter"&&R()},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:()=>{_(!1),N(""),w("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),a.jsx("button",{onClick:R,disabled:y||!k.trim()||!C.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function JC(){const{state:n}=En(),{plugin:l,skill:s}=n,[o,c]=g.useState(null),[f,d]=g.useState(!0);return g.useEffect(()=>{Ne.getDependencies(l,s).then(c).catch(()=>{}).finally(()=>d(!1))},[l,s]),f?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"})]}):o?a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx(ZC,{plugin:l,skill:s}),a.jsx($g,{plugin:l,skill:s})]}):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($g,{plugin:l,skill:s})]})}function vy({data:n}){if(n.length<2)return a.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const l=n.slice(-10),s=80,o=24,c=2,f=s-c*2,d=o-c*2,x=l.length,h=Math.min(...l),y=Math.max(...l)-h||1,v=l.map((k,N)=>{const C=c+N/(x-1)*f,w=c+d-(k-h)/y*d;return`${C.toFixed(1)},${w.toFixed(1)}`}),b=l[l.length-1],j=kl(b);return a.jsxs("svg",{width:s,height:o,viewBox:`0 0 ${s} ${o}`,style:{display:"block"},children:[a.jsx("polyline",{points:v.join(" "),fill:"none",stroke:j,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[k,N]=v[v.length-1].split(",");return a.jsx("circle",{cx:k,cy:N,r:2.5,fill:j})})()]})}function eE(){return a.jsxs("span",{className:"pill",style:{background:"var(--yellow-muted)",color:"var(--yellow)",fontSize:9,fontWeight:700,gap:3},children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"var(--yellow)",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 tE({pct:n}){const l=n>=10?"var(--green)":n>=0?"var(--yellow)":"var(--red)",s=n>=10?"var(--green-muted)":n>=0?"var(--yellow-muted)":"var(--red-muted)",o=n>=0?"+":"";return a.jsxs("span",{className:"pill",style:{background:s,color:l,fontSize:10,fontWeight:600},children:[o,n.toFixed(1),"%"]})}function nE({score:n,rating:l}){const s={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)"}},o=s[l]??s.minimal,c=n>=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:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[c,n.toFixed(1),"% (",l.toUpperCase(),")"]})]})}function aE({warning:n}){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 var(--yellow-muted)"},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:n})]})}function rE({active:n,onChange:l,hasBaseline:s}){return a.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[a.jsx("button",{onClick:()=>l("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:n==="rankings"?"var(--surface-3)":"transparent",color:n==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),a.jsx("button",{onClick:()=>l("amplification"),disabled:!s,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:n==="amplification"?"var(--surface-3)":"transparent",color:s&&n==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:s?1:.5,cursor:s?"pointer":"not-allowed"},title:s?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function lE(n){var o,c,f;if(n.length===0)return[];const l=new Map;for(const d of n)for(const x of d.models){if(x.status==="error")continue;const h=`${x.provider}/${x.model}`;l.has(h)||l.set(h,{provider:x.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const p=l.get(h);p.passRates.push(x.passRate.mean),p.lastRubric=((o=x.rubricScore)==null?void 0:o.mean)??null,p.lastDuration=x.duration.mean,p.lastCost=((c=x.cost)==null?void 0:c.total)??null,p.lastCompositeScore=x.compositeScore,x.baselinePassRate!=null&&(p.lastBaselinePassRate=x.baselinePassRate.mean,p.lastSkillDelta=(f=x.skillDelta)==null?void 0:f.mean,p.lastAmplificationPct=x.amplificationPct,p.hasBaseline=!0)}const s=[];for(const[d,x]of l){const[h,...p]=d.split("/");s.push({rank:0,model:p.join("/"),provider:h,passRate:x.passRates[x.passRates.length-1],rubricScore:x.lastRubric,duration:x.lastDuration,cost:x.lastCost,sparklineData:x.passRates,isBest:!1,baselinePassRate:x.lastBaselinePassRate,skillDelta:x.lastSkillDelta,amplificationPct:x.lastAmplificationPct,compositeScore:x.lastCompositeScore,hasBaseline:x.hasBaseline})}return s.sort((d,x)=>{const h=d.compositeScore??d.passRate;return(x.compositeScore??x.passRate)-h}),s.forEach((d,x)=>{d.rank=x+1}),s.length>0&&(s[0].isBest=!0),s}const yy=(n="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:n,whiteSpace:"nowrap"});function sE({entries:n}){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(l=>a.jsx("th",{style:yy(l==="#"?"center":"left"),children:l},l))})}),a.jsx("tbody",{children:n.map(l=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:s=>{s.currentTarget.style.background="var(--surface-2)"},onMouseLeave:s=>{s.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:l.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:l.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:l.provider}),l.isBest&&a.jsx(eE,{})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:l.passRate>=.7?"var(--green-muted)":l.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:kl(l.passRate),fontSize:11,fontWeight:600},children:[Math.round(l.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:l.rubricScore!=null?l.rubricScore.toFixed(1):"--"}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:l.duration<1e3?`${Math.round(l.duration)}ms`:`${(l.duration/1e3).toFixed(1)}s`}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:l.cost!=null?`$${l.cost.toFixed(4)}`:"N/A"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(vy,{data:l.sparklineData})})]},`${l.provider}/${l.model}`))})]})})}function iE({entries:n}){const l=[...n].filter(s=>s.hasBaseline).sort((s,o)=>(o.amplificationPct??0)-(s.amplificationPct??0));return l.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(s=>a.jsx("th",{style:yy(s==="#"?"center":"left"),children:s},s))})}),a.jsx("tbody",{children:l.map((s,o)=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:c=>{c.currentTarget.style.background="var(--surface-2)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+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:s.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:s.provider})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:s.passRate>=.7?"var(--green-muted)":s.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:kl(s.passRate),fontSize:11,fontWeight:600},children:[Math.round(s.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px"},children:s.baselinePassRate!=null?a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(s.baselinePassRate*100),"%"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:s.skillDelta!=null?a.jsxs("span",{className:"text-[11px] font-medium",style:{color:s.skillDelta>=0?"var(--green)":"var(--red)"},children:[s.skillDelta>=0?"+":"",(s.skillDelta*100).toFixed(1),"pp"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:s.amplificationPct!=null&&isFinite(s.amplificationPct)?a.jsx(tE,{pct:s.amplificationPct}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(vy,{data:s.sparklineData})})]},`${s.provider}/${s.model}`))})]})})}function oE(){const{state:n}=En(),{plugin:l,skill:s}=n,[o,c]=g.useState("rankings"),f=`leaderboard/${l}/${s}`,d=g.useCallback(()=>Ne.getLeaderboard(l,s),[l,s]),{data:x,loading:h}=Nl(f,d),p=(x==null?void 0:x.entries)??[];g.useEffect(()=>{c("rankings")},[l,s]);const y=g.useCallback(()=>ln(f),[f]);Mo("leaderboard:updated",y);const v=g.useMemo(()=>lE(p),[p]),b=v.some(N=>N.hasBaseline),j=p[0],k=j==null?void 0:j.judgeBiasWarning;return h?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"spinner spinner-lg"})}):v.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(rE,{active:o,onChange:c,hasBaseline:b})]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[p.length," sweep",p.length!==1?"s":""," · ",v.length," model",v.length!==1?"s":""]})]}),k&&a.jsx(aE,{warning:k}),o==="rankings"?a.jsx(sE,{entries:v}):a.jsx(iE,{entries:v}),o==="amplification"&&(j==null?void 0:j.skillQualityScore)!=null&&(j==null?void 0:j.skillQualityRating)&&a.jsx(nE,{score:j.skillQualityScore,rating:j.skillQualityRating})]})}const cE=["editor","tests","run","activation","history","leaderboard","deps","versions"];function uE(n){return n!=null&&cE.includes(n)}function dE({hideHeader:n=!1}={}){var b;const{state:l,dispatch:s,saveContent:o,isReadOnly:c}=En(),{state:f,refreshSkills:d,clearSelection:x}=Na(),h=g.useCallback(async()=>{try{await Ne.deleteSkill(l.plugin,l.skill),d(),x()}catch(j){const k=j instanceof Error?j.message:String(j);s({type:"SET_ERROR",error:`Failed to delete skill: ${k}`})}},[l.plugin,l.skill,d,x,s]);g.useEffect(()=>{const k=new URLSearchParams(window.location.search).get("panel");uE(k)&&k!==l.activePanel&&s({type:"SET_PANEL",panel:k})},[]),g.useEffect(()=>{const j=new URLSearchParams(window.location.search);j.set("panel",l.activePanel);const k=`${window.location.pathname}?${j.toString()}${window.location.hash}`;history.replaceState(null,"",k)},[l.activePanel]);const p=g.useCallback(j=>{const k=j.ctrlKey||j.metaKey;if(k&&j.key>="1"&&j.key<="8"){j.preventDefault(),s({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps","versions"][parseInt(j.key)-1]});return}if(k&&j.key==="s"&&!j.shiftKey){j.preventDefault(),l.isDirty&&o();return}},[l.isDirty,o,s]);if(g.useEffect(()=>(window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)),[p]),l.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(l.caseRunStates.values()).some(j=>j.status==="running"||j.status==="queued"),v=((b=f.skills.find(j=>j.skill===l.skill&&j.plugin===l.plugin))==null?void 0:b.updateAvailable)??!1;return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[!n&&a.jsx(kf,{state:l,isReadOnly:c,onDelete:c?void 0:h}),l.error&&a.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx(Ys,{error:Ow(l.error),onDismiss:()=>s({type:"SET_ERROR",error:null})})}),a.jsx(Dw,{activePanel:l.activePanel,onPanelChange:j=>s({type:"SET_PANEL",panel:j}),isDirty:l.isDirty,isRunning:y,hasRegressions:l.regressions.length>0,isActivationRunning:l.activationRunning,hasUpdate:v}),a.jsx(_w,{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:[l.activePanel==="editor"&&a.jsx(iC,{}),l.activePanel==="tests"&&a.jsx(mC,{}),l.activePanel==="run"&&a.jsx(TC,{}),l.activePanel==="activation"&&a.jsx(LC,{}),l.activePanel==="history"&&a.jsx(YC,{}),l.activePanel==="leaderboard"&&a.jsx(oE,{}),l.activePanel==="deps"&&a.jsx(JC,{}),l.activePanel==="versions"&&a.jsx(sy,{})]},l.activePanel)})},`${l.plugin}/${l.skill}`)]})}function fE(n){const l={prompt:n.prompt,provider:n.provider,model:n.model};return n.targetAgents&&n.targetAgents.length>0&&(l.targetAgents=n.targetAgents),l}function Zd(n,l=!0){let s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-");return l&&(s=s.replace(/^-+|-+$/g,"")),s}function pE(n,l,s,o){const f=`.../${n.split("/").slice(-2).join("/")}`;switch(l){case 1:return`${f}/${s}/skills/${o}/SKILL.md`;case 2:return`${f}/plugins/${s}/skills/${o}/SKILL.md`;case 3:return`${f}/skills/${o}/SKILL.md`}}function mE({onCreated:n,resolveAiConfigOverride:l}){const[s,o]=g.useState("ai"),[c,f]=g.useState(null),[d,x]=g.useState(!0),{config:h}=Rr(),[p,y]=g.useState(""),[v,b]=g.useState(3),[j,k]=g.useState(""),[N,C]=g.useState(""),[w,A]=g.useState(""),[_,H]=g.useState(""),[L,$]=g.useState(""),[E,D]=g.useState(""),[R,B]=g.useState("write"),[V,W]=g.useState([]),[te,Q]=g.useState(!1),[z,M]=g.useState(null),[I,X]=g.useState(""),[G,ce]=g.useState(!1),[O,Y]=g.useState(!1),[se,de]=g.useState(null),[ge,xe]=g.useState(null),[we,ie]=g.useState([]),je=g.useRef(null),Oe=g.useRef(null),$e=g.useRef(null),ae=g.useRef(null),[pe,fe]=g.useState(!1),[he,ye]=g.useState(!1);g.useEffect(()=>{Ne.getProjectLayout().then(_e=>{f(_e),b(_e.suggestedLayout);const vt=_e.detectedLayouts.find(Qt=>Qt.layout===_e.suggestedLayout);vt!=null&&vt.existingPlugins.length&&k(vt.existingPlugins[0])}).catch(()=>{}).finally(()=>x(!1))},[]),g.useEffect(()=>{var _e;s==="ai"&&((_e=je.current)==null||_e.focus())},[s]),g.useEffect(()=>()=>{var _e;(_e=Oe.current)==null||_e.abort()},[]);const Be=g.useMemo(()=>{var _e;return c?((_e=c.detectedLayouts.find(vt=>vt.layout===v))==null?void 0:_e.existingPlugins)||[]:[]},[c,v]),Me=j==="__new__"?N:j,ue=c?pE(c.root,v,Me||"{plugin}",p||"{skill}"):"",De=g.useMemo(()=>c?c.detectedLayouts.filter(_e=>_e.layout!==4):[],[c]),Ie=g.useMemo(()=>{if(!c)return null;const _e=c.detectedLayouts.find(st=>st.layout===2&&st.existingPlugins.length>0),vt=c.detectedLayouts.find(st=>st.layout===1&&st.existingPlugins.length>0),Qt=_e||vt;return Qt?{layout:Qt.layout,plugins:Qt.existingPlugins}:null},[c]),Bt=g.useCallback(()=>{if(l)return l();if(!h)return{provider:"claude-cli",model:"sonnet"};const _e=h.provider||"claude-cli",vt=h.model||"sonnet";return{provider:_e,model:vt}},[h,l]),Gt=g.useCallback(()=>{var _e;(_e=Oe.current)==null||_e.abort(),ce(!1)},[]),lt=g.useCallback(()=>{de(null),xe(null)},[]),kt=g.useCallback(async()=>{if(de(null),xe(null),ie([]),$e.current=null,!I.trim()){de("Describe what your skill should do");return}ce(!0);const _e=new AbortController;Oe.current=_e;const{provider:vt,model:Qt}=Bt();try{const st=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(fE({prompt:I.trim(),provider:vt,model:Qt,targetAgents:V})),signal:_e.signal});if(!st.ok||!st.body){let jt=`HTTP ${st.status}`;try{const $n=await st.json();$n.error&&(jt=$n.error)}catch{}throw new Error(jt)}const sr=st.body.getReader(),aa=new TextDecoder;let Nt="",wt="";for(;;){const{done:jt,value:$n}=await sr.read();if(jt)break;Nt+=aa.decode($n,{stream:!0});const ir=Nt.split(`
86
+ `);Nt=ir.pop()||"";for(const Vn of ir)if(Vn.startsWith("event: "))wt=Vn.slice(7).trim();else if(Vn.startsWith("data: ")){try{const Ge=JSON.parse(Vn.slice(6));if(wt==="progress")ie(Vt=>[...Vt,{phase:Ge.phase,message:Ge.message,timestamp:Date.now()}]);else if(wt==="done"||wt==="complete"){const Vt={prompt:I.trim(),provider:Bt().provider,model:Bt().model,reasoning:Ge.reasoning||""};if(y(Ge.name),A(Ge.description),H(Ge.model||""),$(Ge.allowedTools||""),D(Ge.body),Y(!0),$e.current=Vt,o("manual"),Ge.suggestedPlugin&&typeof Ge.suggestedPlugin=="object"&&Ge.suggestedPlugin.plugin){const Tt=Ge.suggestedPlugin;if(((c==null?void 0:c.detectedLayouts.flatMap(Nn=>Nn.existingPlugins))??[]).includes(Tt.plugin))if(k(Tt.plugin),Tt.layout&&(Tt.layout===1||Tt.layout===2))b(Tt.layout);else{const Nn=c==null?void 0:c.detectedLayouts.find(Fo=>Fo.existingPlugins.includes(Tt.plugin));Nn&&(Nn.layout===1||Nn.layout===2)&&b(Nn.layout)}else k("__new__"),C(Tt.plugin)}else v===3&&Ie&&ye(!0);const ra={name:Ge.name,plugin:Me||"",layout:v,description:Ge.description,model:Ge.model||void 0,allowedTools:Ge.allowedTools||void 0,body:Ge.body,aiMeta:Vt};Ne.saveDraft(ra).then(Tt=>{fe(!0),Tt!=null&&Tt.dir&&(ae.current=Tt.dir)}).catch(()=>{})}else wt==="error"&&(de(Ge.message||Ge.description||"Unknown error"),Ge.category&&xe(Ge))}catch{}wt=""}}}catch(st){st.name!=="AbortError"&&de(st.message)}finally{ce(!1),Oe.current=null}},[I,Bt,v,Ie,Me,c,V]),ve=g.useCallback(async()=>{if(M(null),!p.trim()){M("Skill name is required");return}if(!w.trim()){M("Description is required");return}if(v!==3&&!Me.trim()){M("Plugin name is required");return}Q(!0);try{const _e=await Ne.createSkill({name:Zd(p),plugin:Me||"",layout:v,description:w,model:_||void 0,allowedTools:L||void 0,body:E,aiMeta:$e.current||void 0,draftDir:ae.current||void 0});ae.current=null,n(_e.plugin,_e.skill)}catch(_e){M(_e.message)}finally{Q(!1)}},[p,w,v,Me,_,L,E,n]),Mt=g.useCallback(()=>{Ie&&(b(Ie.layout),k(Ie.plugins[0]),ye(!1))},[Ie]);return{mode:s,setMode:o,layout:c,layoutLoading:d,selectedLayout:v,setSelectedLayout:b,creatableLayouts:De,availablePlugins:Be,pathPreview:ue,plugin:j,setPlugin:k,newPlugin:N,setNewPlugin:C,effectivePlugin:Me,name:p,setName:y,description:w,setDescription:A,model:_,setModel:H,allowedTools:L,setAllowedTools:$,body:E,setBody:D,bodyViewMode:R,setBodyViewMode:B,aiPrompt:I,setAiPrompt:X,generating:G,aiGenerated:O,aiError:se,aiClassifiedError:ge,aiProgress:we,promptRef:je,handleGenerate:kt,handleCancelGenerate:Gt,clearAiError:lt,targetAgents:V,setTargetAgents:W,draftSaved:pe,showPluginRecommendation:he,setShowPluginRecommendation:ye,pluginLayoutInfo:Ie,applyPluginRecommendation:Mt,creating:te,error:z,handleCreate:ve}}function by(){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 hE(){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 Sy({node:n,depth:l=0}){var s;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${l*16}px`,color:n.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[n.type==="dir"?a.jsx(by,{}):a.jsx(hE,{}),a.jsxs("span",{children:[n.name,n.type==="dir"?"/":""]})]}),(s=n.children)==null?void 0:s.map(o=>a.jsx(Sy,{node:o,depth:l+1},o.name))]})}function xE(n,l,s){const o=[];l&&o.push({name:"evals.json",type:"file"}),o.push({name:"history",type:"dir"});const c=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:o}];return s&&c.push({name:"draft.json",type:"file"}),{name:n||"{skill}",type:"dir",children:c}}function gE({skillName:n,hasEvals:l,isDraft:s}){const o=xE(n,l,s);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(by,{})}),"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(Sy,{node:o})})]})}const Ja={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Rd({size:n=14,color:l="currentColor"}){return a.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:l,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 vE({onCreated:n,onCancel:l}){const s=mE({onCreated:n});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:()=>s.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:s.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:s.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:s.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(Rd,{size:12}),"AI-Assisted"]})}),a.jsx("button",{onClick:()=>s.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:s.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:s.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:s.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),s.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"})]}),!s.layoutLoading&&s.layout&&s.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(Rd,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),a.jsx("textarea",{ref:s.promptRef,value:s.aiPrompt,onChange:o=>s.setAiPrompt(o.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
87
+
88
+ Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:s.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...Ja,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),s.handleGenerate())}}),a.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),s.generating&&s.aiProgress.length>0&&a.jsx(Ks,{entries:s.aiProgress,isRunning:!0}),s.aiError&&a.jsx("div",{children:s.aiClassifiedError?a.jsx(Ys,{error:s.aiClassifiedError,onRetry:s.handleGenerate,onDismiss:s.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:s.aiError}),a.jsx("button",{onClick:s.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:[s.generating?a.jsx("button",{onClick:s.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:s.handleGenerate,disabled:!s.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:s.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:s.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:s.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[a.jsx(Rd,{size:14}),"Generate"]}),a.jsx("button",{onClick:l,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"}),!s.generating&&a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",a.jsx("button",{onClick:()=>s.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!s.layoutLoading&&s.layout&&s.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"}),s.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:s.creatableLayouts.map(o=>a.jsx("button",{onClick:()=>{s.setSelectedLayout(o.layout),s.setPlugin(o.existingPlugins[0]||""),s.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:s.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:s.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${s.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),s.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:s.plugin,onChange:o=>{s.setPlugin(o.target.value),s.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Ja,children:[s.availablePlugins.map(o=>a.jsx("option",{value:o,children:o},o)),a.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),s.plugin==="__new__"&&a.jsx("input",{type:"text",value:s.newPlugin,onChange:o=>s.setNewPlugin(Zd(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:Ja})]}),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:s.pathPreview})]}),s.showPluginRecommendation&&s.pluginLayoutInfo&&s.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:s.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:s.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:()=>s.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:s.name,onChange:o=>s.setName(Zd(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Ja})]}),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:s.description,onChange:o=>s.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...Ja,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:s.model,onChange:o=>s.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Ja,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:s.allowedTools,onChange:o=>s.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Ja})]})]})]}),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(o=>a.jsxs("button",{onClick:()=>s.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:s.bodyViewMode===o?"var(--surface-4)":"transparent",color:s.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:s.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="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:o==="write"?"Write":"Preview"})]},o))})]}),s.bodyViewMode==="write"?a.jsx("textarea",{value:s.body,onChange:o=>s.setBody(o.target.value),placeholder:`# /my-skill
89
+
90
+ You are an expert at...
91
+ `,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...Ja,minHeight:"150px"}}):s.body.trim()?a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:Vo(s.body)}}):a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},children:a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),a.jsx(gE,{skillName:s.name||"{skill}",hasEvals:!1,isDraft:s.draftSaved}),s.error&&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:s.error}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:s.handleCreate,disabled:s.creating||!s.name||!s.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:s.creating||!s.name||!s.description?"var(--surface-3)":"var(--accent)",color:s.creating||!s.name||!s.description?"var(--text-tertiary)":"#fff",cursor:s.creating||!s.name||!s.description?"not-allowed":"pointer",border:"none"},children:s.creating?"Creating...":"Create Skill"}),a.jsx("button",{onClick:l,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]})]})]})}function yE(){return a.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:a.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[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("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),a.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function Eo({variant:n,message:l,onRetry:s}){const{setMode:o,setSearch:c}=Na(),[f,d]=g.useState(!1);return n==="no-selection"?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[a.jsx("div",{className:"mb-5",children:f?a.jsx(yE,{}):a.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>d(!0),style:{objectFit:"contain"}})}),a.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):n==="no-skills"?a.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children: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("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),a.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",a.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-2)"},children:"--root"})," directory, or create your first skill"]}),a.jsxs("button",{onClick:()=>o("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:x=>{x.currentTarget.style.opacity="0.9"},onMouseLeave:x=>{x.currentTarget.style.opacity="1"},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"})]}),"Create Your First Skill"]})]}):n==="error"?a.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:a.jsxs("div",{className:"px-5 py-4 rounded-lg text-center max-w-sm",style:{background:"var(--red-muted)",border:"1px solid rgba(248,113,113,0.2)"},children:[a.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:l||"Failed to load skill data"}),s&&a.jsx("button",{onClick:s,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):a.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[a.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),a.jsx("button",{onClick:()=>c(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function bE(n,l){const[s,o]=n.split(".").map(Number),[c,f]=l.split(".").map(Number);return c>s?"major":f>o?"minor":"patch"}const SE={major:{bg:"var(--red-muted)",text:"var(--red)"},minor:{bg:"var(--yellow-muted)",text:"var(--yellow)"},patch:{bg:"var(--green-muted)",text:"var(--green)"}};function jE(){const[n,l]=g.useState([]),[s,o]=g.useState(!0),[c,f]=g.useState(new Set),[d,x]=g.useState(new Map),[h,p]=g.useState(!1),[y,v]=g.useState(new Set),[b,j]=g.useState(null),[k,N]=g.useState(null),[C,w]=g.useState(!1),A=g.useCallback(async()=>{o(!0);try{const R=await Ne.getSkillUpdates();l(R.filter(B=>B.updateAvailable))}catch{l([])}finally{o(!1)}},[]);g.useEffect(()=>{A()},[A]);const _=g.useMemo(()=>n.filter(R=>!R.pinned),[n]),H=g.useCallback(R=>{f(B=>{const V=new Set(B);return V.has(R)?V.delete(R):V.add(R),V})},[]),L=g.useCallback(()=>{c.size===_.length?f(new Set):f(new Set(_.map(R=>R.name)))},[c,_]),$=g.useCallback(()=>{const R=[...c];if(!R.length)return;p(!0),x(new Map(R.map(V=>[V,{skill:V,status:"pending"}])));const B=Ne.startBatchUpdate(R);B.addEventListener("progress",V=>{try{const W=JSON.parse(V.data);x(te=>new Map(te).set(W.skill,W))}catch{}}),B.addEventListener("done",V=>{B.close(),p(!1);try{const W=JSON.parse(V.data);j(`Updated ${W.updated??0} skills, ${W.failed??0} failed`),setTimeout(()=>j(null),5e3)}catch{}A()}),B.addEventListener("error",()=>{B.close(),p(!1),j("Batch update failed"),setTimeout(()=>j(null),5e3)})},[c,A]),E=g.useCallback(R=>{R.name.split("/").pop()||R.name;const B=R.name.split("/"),V=B.length>=3?B[B.length-2]:B[0],W=B[B.length-1];v(Q=>new Set(Q).add(R.name));const te=Ne.startSkillUpdate(V,W);te.addEventListener("done",()=>{te.close(),v(Q=>{const z=new Set(Q);return z.delete(R.name),z}),A()}),te.addEventListener("error",()=>{te.close(),v(Q=>{const z=new Set(Q);return z.delete(R.name),z})})},[A]),D=g.useCallback(async R=>{if(!R.latest)return;const B=R.name.split("/"),V=B.length>=3?B[B.length-2]:B[0],W=B[B.length-1];w(!0);try{const te=await Ne.getVersionDiff(V,W,R.installed,R.latest);N({skill:R,diff:te})}catch{N(null)}finally{w(!1)}},[]);return s?a.jsxs("div",{className:"p-6",children:[a.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-16 rounded-lg"}),a.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):n.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16",children:[a.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-4",children:[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("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),a.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),a.jsx("button",{onClick:A,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):a.jsxs("div",{className:"p-6",children:[b&&a.jsx("div",{className:"fixed top-4 right-4 z-50 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:b}),a.jsxs("div",{className:"flex items-center justify-between mb-5",children:[a.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",_.length,")"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:A,className:"btn btn-ghost text-[12px]",disabled:h,children:"Refresh"}),a.jsx("button",{onClick:$,disabled:c.size===0||h,className:"btn btn-primary text-[12px]",children:h?"Updating...":`Update Selected (${c.size})`})]})]}),a.jsx("div",{className:"flex items-center gap-2 mb-3",children:a.jsxs("button",{onClick:L,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:c.size===_.length&&_.length>0?"var(--accent)":"var(--border-default)",background:c.size===_.length&&_.length>0?"var(--accent)":"transparent"},children:c.size===_.length&&_.length>0&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),a.jsx("div",{className:"space-y-2",children:n.map(R=>{const B=R.name.split("/").pop()||R.name,V=R.latest?bE(R.installed,R.latest):"patch",W=SE[V],te=!!R.pinned,Q=y.has(R.name),z=d.get(R.name),M=c.has(R.name);return a.jsx("div",{className:"rounded-lg px-4 py-3 transition-all duration-150",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",opacity:te?.7:1},children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:()=>!te&&H(R.name),disabled:te,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:te?"not-allowed":"pointer"},children:a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:M?"var(--accent)":"var(--border-default)",background:M?"var(--accent)":"transparent",opacity:te?.4:1},children:M&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 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-[13px] font-medium",style:{color:"var(--text-primary)"},children:B}),te&&a.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),a.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:W.bg,color:W.text},children:V})]}),a.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[R.installed," → ",R.latest||"?",te&&` (pinned at ${R.pinnedVersion||R.installed})`]})]}),z&&a.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:z.status==="done"?"var(--green-muted)":z.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:z.status==="done"?"var(--green)":z.status==="error"?"var(--red)":"var(--yellow)"},children:[z.status,z.error&&`: ${z.error}`]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("button",{onClick:()=>D(R),className:"btn btn-ghost text-[11px]",disabled:C,children:"View Changes"}),a.jsx("button",{onClick:()=>E(R),disabled:te||Q||h,title:te?"Pinned — unpin from CLI to update":"",className:`btn ${te?"btn-ghost":"btn-primary"} text-[11px]`,children:Q?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(z==null?void 0:z.status)==="done"?a.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},R.name)})}),k&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>N(null),children:a.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:R=>R.stopPropagation(),children:[a.jsx("div",{className:"mb-2 flex justify-end",children:a.jsx("button",{onClick:()=>N(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),a.jsx(jf,{contentDiff:k.diff.contentDiff,fromLabel:k.diff.from,toLabel:k.diff.to,diffSummary:k.diff.diffSummary,renderContext:"inline"})]})})]})}async function Re(n){return(await Ea(()=>import("./resolve-binary-DIxhrZ6O.js"),__vite__mapDeps([2,3]))).detectBinary(n)}async function kE(n){return(await Ea(()=>import("./_shimNode-D3bBqrAh.js"),[])).existsSync(n)}async function wE(n){return(await Ea(()=>import("./_shimNode-D3bBqrAh.js"),[])).readdirSync(n)}async function CE(...n){return(await Ea(()=>import("./_shimNode-D3bBqrAh.js"),[])).join(...n)}async function EE(){return(await Ea(()=>import("./_shimNode-D3bBqrAh.js"),[])).homedir()}const NE=[{id:"amp",displayName:"Amp",localSkillsDir:".amp/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:()=>Re("amp"),parentCompany:"Sourcegraph",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"cline",displayName:"Cline",localSkillsDir:".cline/skills",globalSkillsDir:"~/.cline/skills",isUniversal:!0,detectInstalled:()=>Re("cline"),parentCompany:"Cline",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"codex",displayName:"Codex CLI",localSkillsDir:".codex/skills",globalSkillsDir:"~/.codex/skills",isUniversal:!0,detectInstalled:()=>Re("codex"),parentCompany:"OpenAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cursor",displayName:"Cursor",localSkillsDir:".cursor/skills",globalSkillsDir:"~/.cursor/skills",isUniversal:!0,detectInstalled:()=>Re("cursor"),parentCompany:"Anysphere",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"gemini-cli",displayName:"Gemini CLI",localSkillsDir:".gemini/skills",globalSkillsDir:"~/.gemini/skills",isUniversal:!0,detectInstalled:()=>Re("gemini"),parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"github-copilot-ext",displayName:"GitHub Copilot (VS Code)",localSkillsDir:".github/copilot/skills",globalSkillsDir:"~/.config/github-copilot/skills",isUniversal:!0,detectInstalled:async()=>{if(!await Re("code"))return!1;const n=await CE(await EE(),".vscode","extensions");if(!await kE(n))return!1;try{return(await wE(n)).some(s=>s.startsWith("github.copilot-"))}catch{return!1}},parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"kimi-cli",displayName:"Kimi CLI",localSkillsDir:".kimi/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:()=>Re("kimi"),parentCompany:"Moonshot AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"opencode",displayName:"OpenCode",localSkillsDir:".opencode/skills",globalSkillsDir:"~/.config/opencode/skills",isUniversal:!0,detectInstalled:()=>Re("opencode"),parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"antigravity",displayName:"Antigravity",localSkillsDir:".agent/skills",globalSkillsDir:"~/.gemini/antigravity/skills",isUniversal:!1,detectInstalled:()=>Re("antigravity"),parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"augment",displayName:"Augment Code",localSkillsDir:".augment/skills",globalSkillsDir:"~/.augment/skills",isUniversal:!1,detectInstalled:()=>Re("augment"),parentCompany:"Augment",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"claude-code",displayName:"Claude Code",localSkillsDir:".claude/skills",globalSkillsDir:"~/.claude/skills",isUniversal:!1,detectInstalled:()=>Re("claude"),parentCompany:"Anthropic",featureSupport:{slashCommands:!0,hooks:!0,mcp:!0,customSystemPrompt:!0},pluginCacheDir:"~/.claude/plugins/cache",pluginMarketplaceDir:"~/.claude/plugins/marketplaces"},{id:"openclaw",displayName:"OpenClaw",localSkillsDir:".openclaw/skills",globalSkillsDir:"~/.openclaw/skills",isUniversal:!1,detectInstalled:()=>Re("openclaw"),parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"replit",displayName:"Replit Agent",localSkillsDir:".replit/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!1,detectInstalled:()=>Re("replit"),parentCompany:"Replit",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"codebuddy",displayName:"CodeBuddy",localSkillsDir:".codebuddy/skills",globalSkillsDir:"~/.codebuddy/skills",isUniversal:!1,detectInstalled:()=>Re("codebuddy"),parentCompany:"CodeBuddy",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"command-code",displayName:"Command Code",localSkillsDir:".commandcode/skills",globalSkillsDir:"~/.commandcode/skills",isUniversal:!1,detectInstalled:()=>Re("command-code"),parentCompany:"Command",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"continue",displayName:"Continue",localSkillsDir:".continue/skills",globalSkillsDir:"~/.continue/skills",isUniversal:!1,detectInstalled:()=>Re("continue"),parentCompany:"Continue",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"crush",displayName:"Crush",localSkillsDir:".crush/skills",globalSkillsDir:"~/.config/crush/skills",isUniversal:!1,detectInstalled:()=>Re("crush"),parentCompany:"Crush",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"droid",displayName:"Droid (Factory)",localSkillsDir:".factory/skills",globalSkillsDir:"~/.factory/skills",isUniversal:!1,detectInstalled:()=>Re("droid"),parentCompany:"Factory",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"goose",displayName:"Goose",localSkillsDir:".goose/skills",globalSkillsDir:"~/.config/goose/skills",isUniversal:!1,detectInstalled:()=>Re("goose"),parentCompany:"Block",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"junie",displayName:"Junie",localSkillsDir:".junie/skills",globalSkillsDir:"~/.junie/skills",isUniversal:!1,detectInstalled:()=>Re("junie"),parentCompany:"JetBrains",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"iflow-cli",displayName:"iFlow CLI",localSkillsDir:".iflow/skills",globalSkillsDir:"~/.iflow/skills",isUniversal:!1,detectInstalled:()=>Re("iflow"),parentCompany:"iFlow",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kilo",displayName:"Kilo Code",localSkillsDir:".kilocode/skills",globalSkillsDir:"~/.kilocode/skills",isUniversal:!1,detectInstalled:()=>Re("kilocode"),parentCompany:"Kilo Code",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kiro-cli",displayName:"Kiro CLI",localSkillsDir:".kiro/skills",globalSkillsDir:"~/.kiro/skills",isUniversal:!1,detectInstalled:()=>Re("kiro"),parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kode",displayName:"Kode",localSkillsDir:".kode/skills",globalSkillsDir:"~/.kode/skills",isUniversal:!1,detectInstalled:()=>Re("kode"),parentCompany:"Kode",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mcpjam",displayName:"MCPJam",localSkillsDir:".mcpjam/skills",globalSkillsDir:"~/.mcpjam/skills",isUniversal:!1,detectInstalled:()=>Re("mcpjam"),parentCompany:"MCPJam",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!1}},{id:"mistral-vibe",displayName:"Mistral Vibe",localSkillsDir:".vibe/skills",globalSkillsDir:"~/.vibe/skills",isUniversal:!1,detectInstalled:()=>Re("vibe"),parentCompany:"Mistral AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mux",displayName:"Mux",localSkillsDir:".mux/skills",globalSkillsDir:"~/.mux/skills",isUniversal:!1,detectInstalled:()=>Re("mux"),parentCompany:"Mux",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"openhands",displayName:"OpenHands",localSkillsDir:".openhands/skills",globalSkillsDir:"~/.openhands/skills",isUniversal:!1,detectInstalled:()=>Re("openhands"),parentCompany:"All Hands AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pi",displayName:"Pi",localSkillsDir:".pi/skills",globalSkillsDir:"~/.pi/agent/skills",isUniversal:!1,detectInstalled:()=>Re("pi"),parentCompany:"Pi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qoder",displayName:"Qoder",localSkillsDir:".qoder/skills",globalSkillsDir:"~/.qoder/skills",isUniversal:!1,detectInstalled:()=>Re("qoder"),parentCompany:"Qoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qwen-code",displayName:"Qwen Code",localSkillsDir:".qwen/skills",globalSkillsDir:"~/.qwen/skills",isUniversal:!1,detectInstalled:()=>Re("qwen-code"),parentCompany:"Alibaba",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"roo",displayName:"Roo Code",localSkillsDir:".roo/skills",globalSkillsDir:"~/.roo/skills",isUniversal:!1,detectInstalled:()=>Re("roo"),parentCompany:"Roo",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae",displayName:"Trae",localSkillsDir:".trae/skills",globalSkillsDir:"~/.trae/skills",isUniversal:!1,detectInstalled:()=>Re("trae"),parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae-cn",displayName:"Trae CN",localSkillsDir:".trae-cn/skills",globalSkillsDir:"~/.trae-cn/skills",isUniversal:!1,detectInstalled:()=>Re("trae-cn"),parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"windsurf",displayName:"Windsurf",localSkillsDir:".windsurf/skills",globalSkillsDir:"~/.codeium/windsurf/skills",isUniversal:!1,detectInstalled:()=>Re("windsurf"),parentCompany:"Codeium",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zencoder",displayName:"ZenCoder",localSkillsDir:".zencoder/skills",globalSkillsDir:"~/.zencoder/skills",isUniversal:!1,detectInstalled:()=>Re("zencoder"),parentCompany:"ZenCoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"neovate",displayName:"Neovate",localSkillsDir:".neovate/skills",globalSkillsDir:"~/.neovate/skills",isUniversal:!1,detectInstalled:()=>Re("neovate"),parentCompany:"Neovate",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pochi",displayName:"Pochi",localSkillsDir:".pochi/skills",globalSkillsDir:"~/.pochi/skills",isUniversal:!1,detectInstalled:()=>Re("pochi"),parentCompany:"Pochi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"adal",displayName:"Adal",localSkillsDir:".adal/skills",globalSkillsDir:"~/.adal/skills",isUniversal:!1,detectInstalled:()=>Re("adal"),parentCompany:"Adal",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cortex",displayName:"Cortex",localSkillsDir:".cortex/skills",globalSkillsDir:"~/.snowflake/cortex/skills",isUniversal:!1,detectInstalled:()=>Re("cortex"),parentCompany:"Cortex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"aider",displayName:"Aider",localSkillsDir:".aider/skills",globalSkillsDir:"~/.aider/skills",isUniversal:!1,detectInstalled:()=>Re("aider"),parentCompany:"Aider",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"tabnine",displayName:"Tabnine Chat",localSkillsDir:".tabnine/skills",globalSkillsDir:"~/.tabnine/skills",isUniversal:!1,detectInstalled:()=>Re("tabnine"),parentCompany:"Tabnine",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"devin",displayName:"Devin",localSkillsDir:".devin/skills",globalSkillsDir:"~/.devin/skills",isUniversal:!1,detectInstalled:()=>Re("devin"),parentCompany:"Cognition",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"bolt-new",displayName:"bolt.new",localSkillsDir:".bolt/skills",globalSkillsDir:"~/.bolt/skills",isUniversal:!1,detectInstalled:()=>Re("bolt"),parentCompany:"StackBlitz",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"v0",displayName:"v0",localSkillsDir:".v0/skills",globalSkillsDir:"~/.v0/skills",isUniversal:!1,detectInstalled:()=>Re("v0"),parentCompany:"Vercel",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"gpt-pilot",displayName:"GPT Pilot",localSkillsDir:".gpt-pilot/skills",globalSkillsDir:"~/.gpt-pilot/skills",isUniversal:!1,detectInstalled:()=>Re("gpt-pilot"),parentCompany:"Pythagora",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"plandex",displayName:"Plandex",localSkillsDir:".plandex/skills",globalSkillsDir:"~/.plandex/skills",isUniversal:!1,detectInstalled:()=>Re("plandex"),parentCompany:"Plandex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"sweep",displayName:"Sweep",localSkillsDir:".sweep/skills",globalSkillsDir:"~/.sweep/skills",isUniversal:!1,detectInstalled:()=>Re("sweep"),parentCompany:"Sweep AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mentat",displayName:"Mentat",localSkillsDir:".mentat/skills",globalSkillsDir:"~/.mentat/skills",isUniversal:!1,detectInstalled:()=>Re("mentat"),parentCompany:"AbanteAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"copilot-cli",displayName:"GitHub Copilot CLI",localSkillsDir:".copilot/skills",globalSkillsDir:"~/.copilot/skills",isUniversal:!1,detectInstalled:()=>Re("copilot"),parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"warp",displayName:"Warp",localSkillsDir:".warp/skills",globalSkillsDir:"~/.warp/skills",isUniversal:!1,detectInstalled:()=>Re("warp"),parentCompany:"Warp",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"amazon-q-cli",displayName:"Amazon Q CLI",localSkillsDir:".amazonq/skills",globalSkillsDir:"~/.aws/amazonq/skills",isUniversal:!1,detectInstalled:()=>Re("q"),parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zed",displayName:"Zed",localSkillsDir:".zed/skills",globalSkillsDir:"~/.config/zed/skills",isUniversal:!1,detectInstalled:()=>Re("zed"),parentCompany:"Zed Industries",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}}],Al={fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px",letterSpacing:.1},Ml={background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},TE={fontFamily:"var(--font-sans)",fontSize:11,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},jy={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},ky={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",wordBreak:"break-all"},Sl={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},RE={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)"},AE={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",overflowWrap:"anywhere",wordBreak:"break-word"},ME={Description:"Add `description:` to the SKILL.md frontmatter to display a value here.",Version:"Add `version:` to the SKILL.md frontmatter to display a value here.",Category:"Add `category:` to the SKILL.md frontmatter to display a value here.",Author:"Add `author:` to the SKILL.md frontmatter to display a value here.",License:"Add `license:` to the SKILL.md frontmatter to display a value here.",Homepage:"Add `homepage:` to the SKILL.md frontmatter to display a value here.",Tags:"Add `tags:` to the SKILL.md frontmatter to display a value here.",Directory:"Filesystem location of this skill — not configurable via SKILL.md.","Entry point":"Add `entry-point:` to the SKILL.md frontmatter to customize; defaults to SKILL.md.","Last modified":"Filesystem mtime — updates automatically on save.","Last benchmark":"Shown after the first benchmark run completes."};function LE(n){if(n==null||!Number.isFinite(n))return"—";if(n<1024)return`${n} B`;const l=n/1024;if(l<1024)return l>=10?`${Math.round(l)} KB`:`${l.toFixed(1).replace(/\.0$/,"")} KB`;const s=l/1024;return s>=10?`${Math.round(s)} MB`:`${s.toFixed(1).replace(/\.0$/,"")} MB`}function wy(n){if(!n)return"—";const l=new Date(n);if(Number.isNaN(l.getTime()))return n;const s=Date.now()-l.getTime(),o=Math.floor(s/1e3);if(o<60)return"just now";const c=Math.floor(o/60);if(c<60)return`${c} min ago`;const f=Math.floor(c/60);if(f<24)return`${f} hr ago`;const d=Math.floor(f/24);if(d<30)return`${d} day${d===1?"":"s"} ago`;const x=Math.floor(d/30);if(x<12)return`${x} month${x===1?"":"s"} ago`;const h=Math.floor(x/12);return`${h} year${h===1?"":"s"} ago`}function zE(n){const l=NE.find(s=>s.id===n);return(l==null?void 0:l.displayName)??n}function wl(n){const l=n?ME[n]:void 0;return a.jsx("span",{style:RE,title:l,children:"—"})}function kn(n,l,s){return a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"130px 1fr",alignItems:"baseline",gap:12,padding:"6px 0"},children:[a.jsx("span",{style:TE,children:n}),a.jsx("span",{style:{minWidth:0},children:l})]},n)}function vl(n,l,s={}){if(l==null||l==="")return kn(n,wl(n));if(s.path)return kn(n,a.jsx("span",{"data-path-value":"true",style:AE,children:l}));const o=s.tabular?Sl:s.mono?ky:jy;return kn(n,a.jsx("span",{style:o,children:l}))}function DE({skill:n,allSkills:l=[],onSelectSkill:s}){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[_E(n),n.origin==="installed"?OE(n):null,BE(n),HE(n),UE(n),VE(n,l,s)]})}function _E(n){const l=n.homepage?a.jsxs("a",{href:n.homepage,target:"_blank",rel:"noopener noreferrer","data-external-link":"homepage",style:{...ky,color:"var(--text-accent)",textDecoration:"none",display:"inline-flex",alignItems:"center",gap:4},onMouseEnter:o=>{o.currentTarget.style.textDecoration="underline"},onMouseLeave:o=>{o.currentTarget.style.textDecoration="none"},children:[a.jsx("span",{children:n.homepage}),a.jsx("span",{"aria-hidden":"true",style:{fontSize:11,color:"var(--text-accent)"},children:"↗"})]}):wl("Homepage"),s=n.tags&&n.tags.length>0?a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:n.tags.map(o=>a.jsx("span",{"data-chip":"tag",style:{fontFamily:"var(--font-sans)",fontSize:11,padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:999,color:"var(--text-secondary)",background:"transparent"},children:o},o))}):wl("Tags");return a.jsxs("section",{style:Ml,"aria-labelledby":"md-frontmatter",children:[a.jsx("h3",{id:"md-frontmatter",style:Al,children:"Frontmatter"}),vl("Description",n.description??null),vl("Version",n.version??null,{tabular:!0}),vl("Category",n.category??null),vl("Author",n.author??null),vl("License",n.license??null),kn("Homepage",l),kn("Tags",s)]},"frontmatter")}function OE(n){const l=n.sourceAgent,s=l?a.jsx("span",{style:jy,"data-agent-id":l,children:zE(l)}):wl("Agent");return a.jsxs("section",{style:Ml,"aria-labelledby":"md-source-agent",children:[a.jsx("h3",{id:"md-source-agent",style:Al,children:"Source agent"}),kn("Agent",s)]},"source-agent")}function BE(n){const l=n.lastModified?a.jsx("span",{style:Sl,title:n.lastModified,children:wy(n.lastModified)}):wl("Last modified"),s=n.entryPoint??"SKILL.md",o=n.dir?`${n.dir.replace(/\/$/,"")}/${s}`:s,c=a.jsx("button",{type:"button","data-entry-chip":"true",title:`Copy ${o}`,"aria-label":`Copy entry-point path ${o} to clipboard`,onClick:()=>IE(o),style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s});return a.jsxs("section",{style:Ml,"aria-labelledby":"md-fs",children:[a.jsx("h3",{id:"md-fs",style:Al,children:"Filesystem"}),vl("Directory",n.dir||null,{path:!0}),kn("Entry point",c),kn("Size",a.jsx("span",{style:Sl,children:LE(n.sizeBytes)})),kn("Last modified",l)]},"filesystem")}function IE(n){var l;try{(l=navigator.clipboard)==null||l.writeText(n)}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:`Copied ${n}`,severity:"info"}}))}function HE(n){const l=n.benchmarkStatus==="pass"?"var(--status-installed)":n.benchmarkStatus==="fail"?"var(--red, #b54444)":"var(--status-own)",s=a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:[a.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:7,height:7,borderRadius:999,background:l}}),n.benchmarkStatus]}),o=n.lastBenchmark?a.jsx("span",{style:Sl,title:n.lastBenchmark,children:wy(n.lastBenchmark)}):wl("Last benchmark");return a.jsxs("section",{style:Ml,"aria-labelledby":"md-bench",children:[a.jsx("h3",{id:"md-bench",style:Al,children:"Benchmark"}),kn("Eval count",a.jsx("span",{style:Sl,children:n.evalCount})),kn("Assertions",a.jsx("span",{style:Sl,children:n.assertionCount})),kn("Status",s),kn("Last benchmark",o)]},"benchmark")}function UE(n){const l=n.mcpDeps??[];return a.jsxs("section",{style:Ml,"aria-labelledby":"md-mcp",children:[a.jsx("h3",{id:"md-mcp",style:Al,children:"MCP dependencies"}),l.length===0?a.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No MCP dependencies"}):a.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:l.map(s=>a.jsxs("li",{"data-mcp-dep":s,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 0",borderBottom:"1px solid var(--border-default)"},children:[a.jsx($E,{}),a.jsx("span",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:s})]},s))})]},"mcp-deps")}function $E(){return a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-secondary)",flexShrink:0},"aria-hidden":"true",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("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"})]})}function VE(n,l,s){const o=n.deps??[];return a.jsxs("section",{style:Ml,"aria-labelledby":"md-skill-deps",children:[a.jsx("h3",{id:"md-skill-deps",style:Al,children:"Skill dependencies"}),o.length===0?a.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No skill dependencies"}):a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:o.map(c=>{const f=PE(c,l),d=f!=null,x={fontFamily:"var(--font-sans)",fontSize:12,padding:"3px 10px",border:"1px solid var(--border-default)",borderRadius:999,color:d?"var(--text-primary)":"var(--text-secondary)",background:"transparent",cursor:d?"pointer":"help"},h=d&&s?()=>s({plugin:f.plugin,skill:f.skill,origin:f.origin}):void 0,p=d&&s?y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),s({plugin:f.plugin,skill:f.skill,origin:f.origin}))}:void 0;return a.jsx("button",{type:"button","data-chip":"skill-dep","data-present":d?"true":"false",title:d?`Open ${c}`:"Not installed",onClick:h,onKeyDown:p,style:x,children:c},c)})})]},"skill-deps")}function PE(n,l){const[s,o]=n.includes("/")?n.split("/"):["",n];for(const c of l)if(s&&c.plugin===s&&c.skill===o||!s&&c.skill===o)return c;return null}const Vg=g.memo(function({message:l,politeness:s="polite",role:o}){const c=o??(s==="assertive"?"alert":"status");return a.jsx("div",{"aria-live":s,"aria-atomic":"true",role:c,"data-testid":"aria-live","data-politeness":s,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0,padding:0,margin:-1},children:l})});function FE({toast:n,onDismiss:l}){const[s,o]=g.useState(!0),c=g.useRef(null);g.useEffect(()=>(c.current=requestAnimationFrame(()=>{c.current=requestAnimationFrame(()=>o(!1))}),()=>{c.current!=null&&cancelAnimationFrame(c.current)}),[]);const f={success:"var(--status-installed)",info:"var(--text-secondary)",error:"var(--color-accent, var(--accent-surface))"};return a.jsxs("div",{role:n.severity==="error"?"alert":"status","data-testid":"toast-item","data-severity":n.severity,style:{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",minWidth:240,maxWidth:360,background:"var(--bg-canvas)",color:"var(--text-primary)",border:"1px solid var(--border-default)",borderLeft:`3px solid ${f[n.severity]}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",fontFamily:"var(--font-sans)",fontSize:12,transform:s?"translateY(8px)":"translateY(0)",opacity:s?0:1,transition:"transform var(--duration-base, 180ms) var(--ease-standard, ease), opacity var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[a.jsx("span",{style:{flex:1,minWidth:0},children:n.message}),n.action&&a.jsx("button",{type:"button",onClick:()=>{n.action.onInvoke(),l(n.id)},style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"3px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:n.action.label}),a.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>l(n.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function GE({toasts:n,onDismiss:l,liveMessage:s,liveAssertiveMessage:o}){return a.jsxs(a.Fragment,{children:[a.jsx(Vg,{politeness:"polite",message:s}),a.jsx(Vg,{politeness:"assertive",message:o}),n.length>0&&a.jsx("div",{"data-testid":"toast-stack",style:{position:"fixed",right:16,bottom:16,display:"flex",flexDirection:"column-reverse",gap:8,zIndex:50,pointerEvents:"none"},children:n.map(c=>a.jsx("div",{style:{pointerEvents:"auto"},children:a.jsx(FE,{toast:c,onDismiss:l})},c.id))})]})}const Cy=g.createContext(null);function wf(){const n=g.useContext(Cy);if(!n)throw new Error("useToast must be used inside <ToastProvider>.");return n}function WE({children:n,maxVisible:l=4,defaultDurationMs:s=4e3}){const[o,c]=g.useState([]),[f,d]=g.useState(""),[x,h]=g.useState(""),p=g.useRef(new Map),y=g.useCallback(C=>{const w=p.current.get(C);w&&(clearTimeout(w),p.current.delete(C)),c(A=>A.filter(_=>_.id!==C))},[]),v=g.useCallback((C,w)=>{if(w<=0)return;const A=setTimeout(()=>{y(C)},w);p.current.set(C,A)},[y]),b=g.useCallback(C=>{const w=C.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,A={id:w,message:C.message,severity:C.severity??"info",durationMs:C.durationMs??s,action:C.action};return c(_=>[..._,A]),A.severity==="error"?h(A.message):d(A.message),v(w,A.durationMs),w},[s,v]),j=g.useCallback(()=>{for(const C of p.current.values())clearTimeout(C);p.current.clear(),c([])},[]);g.useEffect(()=>{function C(w){w.key==="Escape"&&c(A=>{if(A.length===0)return A;const _=A.slice(0,l),H=_[_.length-1],L=p.current.get(H.id);return L&&(clearTimeout(L),p.current.delete(H.id)),A.filter($=>$.id!==H.id)})}return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[l]),g.useEffect(()=>()=>{for(const C of p.current.values())clearTimeout(C);p.current.clear()},[]);const k=o.slice(0,l),N=g.useMemo(()=>({toast:b,dismiss:y,clear:j}),[b,y,j]);return a.jsxs(Cy.Provider,{value:N,children:[n,a.jsx(GE,{toasts:k,onDismiss:y,liveMessage:f,liveAssertiveMessage:x})]})}function qE(n){const{toast:l}=wf(),s=g.useRef(n);s.current=n;const o=g.useCallback(async(...c)=>{const f=s.current,d=f.snapshot();f.apply(...c),f.confirmGraceMs;const x=f.timeoutMs??5e3;let h=!1,p,y=!1;const v=f.commit(...c).then(()=>{h=!0,y=!0},k=>{h=!0,p=k??new Error("Commit failed")}),b=new Promise(k=>{setTimeout(k,x)});if(await Promise.race([v,b]),!h)p=new Error("TIMEOUT");else if(y)return;f.rollback(d);const j=typeof f.failureMessage=="function"?f.failureMessage(p):f.failureMessage??"Couldn't complete that action.";l({message:j,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{o(...c)}}})},[l]);return{run:o}}const Pg=6e4;function YE({skill:n}){const{refreshUpdates:l}=Na(),{toast:s}=wf(),[o,c]=g.useState("idle"),[f,d]=g.useState(null),[x,h]=g.useState(!1),[p,y]=g.useState(null),[v,b]=g.useState(!1),j=g.useRef(null),k=g.useRef(null),N=g.useCallback(()=>new Promise((H,L)=>{if(!n){L(new Error("No skill selected"));return}const $=Ne.startSkillUpdate(n.plugin,n.skill);j.current=$;const E=()=>{k.current&&(clearTimeout(k.current),k.current=null);try{$.close()}catch{}j.current=null};k.current=setTimeout(()=>{E(),L(new Error("TIMEOUT"))},Pg),$.addEventListener("progress",D=>{try{const R=JSON.parse(D.data);typeof(R==null?void 0:R.status)=="string"&&d(R.status)}catch{}}),$.addEventListener("done",()=>{E(),c("done"),d(null),l(),s({message:`Updated ${n.skill}.`,severity:"success",durationMs:4e3}),H()}),$.addEventListener("error",D=>{E();let R="Stream error";try{const B=typeof D.data=="string"?JSON.parse(D.data):null;B!=null&&B.error&&(R=String(B.error))}catch{}L(new Error(R))})}),[n,l,s]),C=qE({snapshot:()=>({status:o}),apply:()=>{c("updating"),d("updating")},commit:()=>N(),rollback:H=>{c(H.status==="updating"?"idle":H.status),d(null)},failureMessage:H=>`Couldn't update ${(n==null?void 0:n.skill)??"skill"} — ${H.message}`,timeoutMs:Pg+1e3});if(g.useEffect(()=>{if(!x||p!=null||!n||!n.latestVersion)return;let H=!1;return b(!0),Ne.getVersionDiff(n.plugin,n.skill,n.currentVersion??"",n.latestVersion).then(L=>{H||y(L)}).catch(()=>{H||y(null)}).finally(()=>{H||b(!1)}),()=>{H=!0}},[x,p,n==null?void 0:n.plugin,n==null?void 0:n.skill,n==null?void 0:n.latestVersion,n==null?void 0:n.currentVersion,n]),g.useEffect(()=>()=>{if(k.current&&clearTimeout(k.current),j.current)try{j.current.close()}catch{}},[]),!n||n.updateAvailable!==!0)return null;const w=n.latestVersion,A=o==="updating"?"Updating…":w?`Update to ${w}`:"Update",_=o==="updating";return a.jsxs("div",{"data-testid":"update-action",style:{display:"flex",flexDirection:"column",gap:6,padding:"12px 16px",borderTop:"1px solid var(--border-default)",borderBottom:"1px solid var(--border-default)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{C.run()},disabled:_,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:_?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:A}),a.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>h(H=>!H),disabled:_||!w,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:12,fontFamily:"var(--font-sans)",cursor:"pointer",textDecoration:"underline"},children:x?"Hide changelog":"Preview changelog"})]}),f&&a.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:f}),x&&w&&a.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[v&&a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!v&&p&&a.jsx(jf,{contentDiff:p.contentDiff,fromLabel:p.from,toLabel:p.to,diffSummary:p.diffSummary??void 0,renderContext:"inline"}),!v&&!p&&a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}function Ad(){const{state:n,setMobileView:l}=Na();return n.isMobile?a.jsxs("button",{onClick:()=>l("list"),className:"flex items-center gap-1.5 px-3 py-2 text-[12px] font-medium",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"none",borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",width:"100%"},children:[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:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function KE(n={}){if(n.selectedSkillInfo!==void 0||n.loadError!==void 0)return XE(n);const{state:l,selectSkill:s,setMode:o,refreshSkills:c}=Na(),[f,d]=g.useState(typeof window<"u"?window.location.hash:"");if(g.useEffect(()=>{const p=()=>d(window.location.hash);return window.addEventListener("hashchange",p),()=>window.removeEventListener("hashchange",p)},[]),f==="#/updates")return a.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[a.jsx(Ad,{}),a.jsx(jE,{})]});if(l.mode==="create")return a.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[a.jsx(Ad,{}),a.jsx(vE,{onCreated:(p,y)=>{o("browse"),c(),s({plugin:p,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!l.selectedSkill)return l.skillsError?a.jsx(Eo,{variant:"error",message:l.skillsError,onRetry:c}):!l.skillsLoading&&l.skills.length===0?a.jsx(Eo,{variant:"no-skills"}):a.jsx(Eo,{variant:"no-selection"});const x=l.selectedSkill,h=l.skills.find(p=>p.plugin===x.plugin&&p.skill===x.skill)??null;return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx(Ad,{}),a.jsx(QE,{skillInfo:h,allSkills:l.skills,onSelectSkill:p=>s(p)})]})}function XE(n){const l=n.selectedSkillInfo??null,s=n.activeDetailTab??"overview";if(l==null)return eN();if(n.loadError)return tN(l,n.loadError);const o=n.allSkills&&n.onSelectSkill?{allSkills:n.allSkills,onSelectSkill:n.onSelectSkill}:void 0;return Ey(l,s,n.onDetailTabChange,o)}function QE({skillInfo:n,allSkills:l,onSelectSkill:s}){const[o,c]=g.useState("overview"),f=g.useMemo(()=>n?Ey(n,o,c,{allSkills:l,onSelectSkill:s}):a.jsx(Eo,{variant:"no-selection"}),[n,o,l,s]);return a.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:f})}const ZE=[{id:"overview",label:"Overview"},{id:"versions",label:"Versions"}];function JE(n,l){return a.jsx("div",{role:"tablist","aria-label":"Detail sections",style:{display:"flex",alignItems:"stretch",gap:4,borderBottom:"1px solid var(--border-default)",padding:"0 16px",background:"var(--bg-canvas)"},children:ZE.map(s=>{const o=s.id===n;return a.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${s.id}`,"aria-controls":`detail-panel-${s.id}`,onClick:()=>l==null?void 0:l(s.id),style:{background:"transparent",border:"none",borderBottom:o?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 4px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:o?500:400,color:o?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer"},children:s.label},s.id)})})}function eN(){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:32,background:"var(--bg-canvas)"},children:[a.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,color:"var(--text-primary)",margin:0,marginBottom:8},children:"Select a skill to view details"}),a.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)",margin:0,maxWidth:420,textAlign:"center"},children:"Choose a skill from the sidebar — its frontmatter, filesystem info, and benchmark status will appear here."})]})}function tN(n,l){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[kf({skill:n}),a.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[a.jsxs("h3",{style:{fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px"},children:["Couldn't load SKILL.md for ",n.skill]}),a.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:l}),a.jsxs("div",{style:{display:"flex",gap:8},children:[a.jsx("button",{type:"button",style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Open in editor"}),a.jsx("button",{type:"button",onClick:()=>{var s;return(s=navigator.clipboard)==null?void 0:s.writeText(n.dir)},style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Copy path"})]})]})]})}function Ey(n,l,s,o){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[a.jsx("div",{style:{padding:16,paddingBottom:12},children:kf({skill:n})}),a.jsx(YE,{skill:n}),JE(l,s),a.jsxs("div",{role:"tabpanel",id:`detail-panel-${l}`,"aria-labelledby":`detail-tab-${l}`,style:{flex:1,minHeight:0,overflow:"auto"},children:[l==="overview"&&a.jsxs(a.Fragment,{children:[DE({skill:n,allSkills:(o==null?void 0:o.allSkills)??[],onSelectSkill:o==null?void 0:o.onSelectSkill}),o!=null&&a.jsx(kg,{plugin:n.plugin,skill:n.skill,origin:n.origin,children:a.jsx("div",{style:{minHeight:520,display:"flex",flexDirection:"column"},children:a.jsx(dE,{hideHeader:!0})})},`${n.plugin}/${n.skill}-workspace`)]}),l==="versions"&&o!=null&&a.jsx(kg,{plugin:n.plugin,skill:n.skill,origin:n.origin,children:a.jsx("div",{style:{padding:16},children:a.jsx(sy,{})})},`${n.plugin}/${n.skill}-versions`),l==="versions"&&o==null&&a.jsx("div",{style:{padding:16,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontSize:13},children:"Select a skill from the sidebar to load its version history."})]})]})}function nN(){const{updateCount:n,state:l,dismissUpdateNotification:s}=Na(),o=n>0&&!l.updateNotificationDismissed;return g.useEffect(()=>{if(!o)return;const c=setTimeout(()=>s(),1e4);return()=>clearTimeout(c)},[o,s]),o?a.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex items-center gap-3 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow)",color:"var(--text-primary)"},children:[a.jsxs("span",{children:[n," update",n===1?"":"s"," available"]}),a.jsx("button",{onClick:()=>{window.location.hash="#/updates"},className:"px-2 py-0.5 rounded text-[12px] font-semibold",style:{background:"var(--yellow)",color:"var(--surface-0)",border:"none",cursor:"pointer"},children:"View Updates"}),a.jsx("button",{onClick:s,className:"text-[14px] leading-none",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px"},"aria-label":"Dismiss",children:"✕"})]}):null}const aN=[{name:J.shortcuts.groupNavigation,items:[{keys:"/",label:J.shortcuts.search},{keys:"j",label:J.shortcuts.moveDown},{keys:"k",label:J.shortcuts.moveUp},{keys:"Enter",label:J.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:J.shortcuts.groupActions,items:[{keys:"⌘K",label:J.shortcuts.openPalette},{keys:"?",label:J.shortcuts.openShortcuts},{keys:"⌘B",label:J.shortcuts.toggleSidebar},{keys:"E",label:J.actions.edit}]},{name:J.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:J.shortcuts.toggleTheme}]}];function rN({open:n,onClose:l,groups:s=aN,title:o=J.shortcuts.title}){const c=g.useRef(null),f=g.useRef(null);return g.useEffect(()=>{var d;if(n)return c.current=document.activeElement??null,(d=f.current)==null||d.focus(),()=>{var x,h;(h=(x=c.current)==null?void 0:x.focus)==null||h.call(x),c.current=null}},[n]),g.useEffect(()=>{if(!n)return;function d(x){var h;if(x.key==="Escape"){x.preventDefault(),l();return}x.key==="Tab"&&(x.preventDefault(),(h=f.current)==null||h.focus())}return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[n,l]),n?a.jsx("div",{role:"presentation","data-testid":"shortcut-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, var(--bg-canvas) 70%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},onClick:d=>{d.target===d.currentTarget&&l()},children:a.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"shortcut-modal-title",style:{width:"min(480px, 92vw)",maxHeight:"80vh",overflow:"auto",background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:8,boxShadow:"0 16px 48px rgba(0,0,0,0.18)",padding:"16px 20px",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[a.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[a.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),a.jsx("button",{ref:f,type:"button","aria-label":"Close",onClick:l,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-secondary)",cursor:"pointer",fontSize:13},children:"Esc"})]}),s.map(d=>a.jsxs("section",{style:{marginBottom:12},children:[a.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:d.name}),a.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:d.items.map(x=>a.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[a.jsx("span",{children:x.label}),a.jsx("kbd",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-secondary)",border:"1px solid var(--border-default)",borderRadius:3,padding:"1px 6px"},children:x.keys})]},`${d.name}:${x.keys}`))})]},d.name))]})}):null}function lN(n){const l=J.actions,s=[{action:"open",label:l.open},{action:"copy-path",label:l.copyPath},{action:"reveal",label:l.revealInEditor},{action:"run-benchmark",label:l.runBenchmark}];if(n.origin==="source")return[...s,{action:"edit",label:l.edit},{action:"duplicate",label:l.duplicate}];const o=[...s];return n.updateAvailable&&o.push({action:"update",label:l.update}),o.push({action:"uninstall",label:l.uninstall}),o}function sN({state:n,onClose:l,onAction:s,itemsOverride:o}){const c=g.useRef(null),f=g.useRef(null),[d,x]=g.useState(0),h=g.useMemo(()=>n.skill?o??lN(n.skill):[],[n.skill,o]),p=g.useMemo(()=>{if(typeof window>"u")return{left:n.x,top:n.y};const v=8,b=220,j=44+h.length*28;let k=n.x,N=n.y;return k+b+v>window.innerWidth&&(k=Math.max(v,n.x-b)),N+j+v>window.innerHeight&&(N=Math.max(v,n.y-j)),{left:k,top:N}},[n.x,n.y,h.length]);g.useEffect(()=>{if(n.open)return f.current=document.activeElement??null,x(0),requestAnimationFrame(()=>{var v;(v=c.current)==null||v.focus()}),()=>{var v,b;(b=(v=f.current)==null?void 0:v.focus)==null||b.call(v),f.current=null}},[n.open]);const y=g.useCallback(()=>{if(!n.skill)return;const v=h[d];!v||v.disabled||(s(v.action,n.skill),l())},[h,d,n.skill,s,l]);return g.useEffect(()=>{if(!n.open)return;function v(j){if(j.key==="Escape"){j.preventDefault(),l();return}if(j.key==="ArrowDown"){j.preventDefault(),x(k=>Math.min(k+1,Math.max(h.length-1,0)));return}if(j.key==="ArrowUp"){j.preventDefault(),x(k=>Math.max(k-1,0));return}if(j.key==="Enter"||j.key===" "){j.preventDefault(),y();return}}function b(j){c.current&&j.target instanceof Node&&(c.current.contains(j.target)||l())}return window.addEventListener("keydown",v,!0),window.addEventListener("mousedown",b,!0),()=>{window.removeEventListener("keydown",v,!0),window.removeEventListener("mousedown",b,!0)}},[n.open,l,h.length,y]),!n.open||!n.skill?null:a.jsx("div",{ref:c,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:p.left,top:p.top,zIndex:70,minWidth:200,padding:4,background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:6,boxShadow:"0 12px 32px rgba(0,0,0,0.16)",fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",outline:"none"},children:h.map((v,b)=>a.jsx("div",{role:"menuitem","aria-disabled":v.disabled||void 0,"data-action":v.action,"data-selected":b===d||void 0,onMouseEnter:()=>x(b),onClick:()=>{v.disabled||(s(v.action,n.skill),l())},style:{padding:"5px 10px",borderRadius:4,cursor:v.disabled?"default":"pointer",opacity:v.disabled?.5:1,background:b===d?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:v.label},v.action))})}const iN={"anthropic-api":{name:J.setupProviders.anthropic.name,description:J.setupProviders.anthropic.description,envVars:J.setupProviders.anthropic.envVars,keyUrl:J.setupProviders.anthropic.keyUrl,learnMoreUrl:J.setupProviders.anthropic.learnMoreUrl},openai:{name:J.setupProviders.openai.name,description:J.setupProviders.openai.description,envVars:J.setupProviders.openai.envVars,keyUrl:J.setupProviders.openai.keyUrl,learnMoreUrl:J.setupProviders.openai.learnMoreUrl},openrouter:{name:J.setupProviders.openrouter.name,description:J.setupProviders.openrouter.description,envVars:J.setupProviders.openrouter.envVars,keyUrl:J.setupProviders.openrouter.keyUrl,learnMoreUrl:J.setupProviders.openrouter.learnMoreUrl},gemini:{name:J.setupProviders.gemini.name,description:J.setupProviders.gemini.description,envVars:J.setupProviders.gemini.envVars,keyUrl:J.setupProviders.gemini.keyUrl,learnMoreUrl:J.setupProviders.gemini.learnMoreUrl},ollama:{name:J.setupProviders.ollama.name,description:J.setupProviders.ollama.description,envVars:J.setupProviders.ollama.envVars,install:[J.setupProviders.ollama.installCmd],start:[J.setupProviders.ollama.startCmd],pullExample:J.setupProviders.ollama.pullExample,learnMoreUrl:J.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:J.setupProviders.lmStudio.name,description:J.setupProviders.lmStudio.description,envVars:J.setupProviders.lmStudio.envVars,install:[J.setupProviders.lmStudio.installCmd],start:[J.setupProviders.lmStudio.startCmd],pullExample:J.setupProviders.lmStudio.pullExample,learnMoreUrl:J.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:J.setupProviders.claudeCode.name,description:J.setupProviders.claudeCode.description,envVars:[],notes:[J.setupProviders.claudeCode.loginHint,J.claudeCodeLabel.compactLabel],learnMoreUrl:J.setupProviders.claudeCode.learnMoreUrl}};function oN(n){return n?iN[n]??null:null}function cN({open:n,providerKey:l,onClose:s}){const o=g.useRef(null);if(g.useEffect(()=>{if(!n)return;const d=x=>{x.key==="Escape"&&(x.preventDefault(),s())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n,s]),g.useEffect(()=>{if(!n)return;const d=o.current;if(!d)return;const x=d.querySelector("button, a[href], [tabindex]:not([tabindex='-1']), input, textarea, select");x==null||x.focus()},[n]),!n||typeof document>"u")return null;const c=oN(l),f=(c==null?void 0:c.name)??J.setupDrawer.fallbackTitle;return Oo.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:s,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),a.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":J.setupDrawer.title(f),style:{position:"fixed",top:0,right:0,bottom:0,width:"480px",maxWidth:"100vw",background:"var(--bg-surface, var(--surface-1))",borderLeft:"1px solid var(--border-default, var(--border-subtle))",boxShadow:"-8px 0 32px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",zIndex:100,fontFamily:"var(--font-sans)",animation:"vskillDrawerIn 200ms cubic-bezier(0.2, 0, 0, 1)"},children:[a.jsx(uN,{title:f,onClose:s}),a.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:c?a.jsx(dN,{content:c}):a.jsx(fN,{})}),a.jsx("style",{children:`@keyframes vskillDrawerIn {
92
+ from { transform: translateX(100%); }
93
+ to { transform: translateX(0); }
94
+ }
95
+ @keyframes vskillDrawerBackdropIn {
96
+ from { opacity: 0; }
97
+ to { opacity: 1; }
98
+ }`})]})]}),document.body)}function uN({title:n,onClose:l}){return a.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 20px",borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:[a.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:18,fontWeight:500,margin:0,color:"var(--text-primary)"},children:J.setupDrawer.title(n)}),a.jsx("button",{type:"button","data-testid":"setup-drawer-close",onClick:l,"aria-label":J.setupDrawer.close,style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:18,padding:4,lineHeight:1},children:"×"})]})}function dN({content:n}){var l,s;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[a.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:"var(--text-primary)",margin:0},children:n.description}),n.notes&&n.notes.length>0&&a.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:n.notes.map(o=>a.jsx("li",{style:{fontSize:13,color:"var(--text-secondary)",padding:"8px 10px",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",borderRadius:4},children:o},o))}),n.envVars.length>0&&a.jsxs("section",{children:[a.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:J.setupDrawer.requiredEnv}),a.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:n.envVars.map(o=>a.jsx("li",{children:a.jsx(pN,{name:o})},o))})]}),n.keyUrl&&a.jsx(mN,{href:n.keyUrl,label:J.setupDrawer.getKey,testId:"setup-drawer-get-key"}),(n.install||n.start||n.pullExample)&&a.jsxs("section",{children:[a.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:J.setupDrawer.installRun}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(l=n.install)==null?void 0:l.map((o,c)=>a.jsx(Md,{code:o},`install-${c}`)),(s=n.start)==null?void 0:s.map((o,c)=>a.jsx(Md,{code:o},`start-${c}`)),n.pullExample&&a.jsx(Md,{code:n.pullExample})]})]}),a.jsx("footer",{style:{marginTop:8},children:a.jsxs("a",{href:n.learnMoreUrl,target:"_blank",rel:"noopener noreferrer","data-testid":"setup-drawer-learn-more",style:{fontSize:12,color:"var(--color-accent, var(--accent-surface))",textDecoration:"none"},children:[J.setupDrawer.learnMore," →"]})})]})}function fN(){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[a.jsx("h3",{style:{margin:0,fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:J.setupDrawer.fallbackTitle}),a.jsx("p",{style:{margin:0,fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:J.setupDrawer.fallbackBody})]})}function pN({name:n}){const l=async()=>{var s;try{await((s=navigator.clipboard)==null?void 0:s.writeText(n))}catch{}};return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",background:"color-mix(in srgb, var(--border-default) 30%, transparent)",borderRadius:4},children:[a.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",flex:1},children:n}),a.jsx("button",{type:"button",onClick:l,"aria-label":`Copy ${n} to clipboard`,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:3,padding:"2px 8px",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer"},children:J.setupDrawer.copy})]})}function Md({code:n}){return a.jsx("pre",{style:{margin:0,padding:"8px 10px",background:"var(--bg-canvas, #111)",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:11.5,lineHeight:1.5,borderRadius:4,border:"1px solid var(--border-default, var(--border-subtle))",overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:n})}function mN({href:n,label:l,testId:s}){return a.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer","data-testid":s,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 12%, transparent)",color:"var(--text-primary)",textDecoration:"none",fontSize:13,fontWeight:500,fontFamily:"var(--font-sans)",width:"fit-content"},children:[l," →"]})}function hN(){const[n,l]=g.useState(!1),[s,o]=g.useState(null),c=g.useRef(null),f=g.useCallback((x,h)=>{var p;c.current=typeof document<"u"?document.activeElement:null,(p=h==null?void 0:h.beforeOpen)==null||p.call(h),o(x),l(!0)},[]),d=g.useCallback(()=>{l(!1);const x=c.current;x&&"focus"in x&&typeof x.focus=="function"&&queueMicrotask(()=>x.focus())},[]);return{open:f,close:d,isOpen:n,providerKey:s}}function xN(n){const l=[],s=[],o=new Set;for(const c of n){if(c.presence==="absent"||c.health==="missing"){s.push({kind:"individual",key:c.id,agent:c});continue}if(c.sharedFolderGroup&&c.sharedFolderGroup.length>1){const f=[...c.sharedFolderGroup].sort().join("+");if(o.has(f))continue;o.add(f);const d=n.filter(x=>c.sharedFolderGroup.includes(x.id));l.push({kind:"aggregate",key:`shared:${f}`,consumers:d,sharedFolderPath:c.sharedFolderPath??"~/.config/agents/skills",combinedCount:d.reduce((x,h)=>x+h.globalCount,0)});continue}l.push({kind:"individual",key:c.id,agent:c})}return{detected:l,notDetected:s}}function gN({agents:n,activeAgentId:l,focusedAgentId:s,onFocusAgent:o,onSwitch:c,onOpenSetup:f,onClose:d}){const x=g.useRef(null);g.useEffect(()=>{const y=v=>{v.key==="Escape"&&(v.preventDefault(),d())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[d]),g.useEffect(()=>{const y=b=>{x.current&&!x.current.contains(b.target)&&d()},v=setTimeout(()=>{document.addEventListener("mousedown",y)},0);return()=>{clearTimeout(v),document.removeEventListener("mousedown",y)}},[d]);const h=g.useMemo(()=>xN(n),[n]),p=n.find(y=>y.id===s)??n.find(y=>y.id===l)??n[0];return typeof document>"u"?null:Oo.createPortal(a.jsxs("div",{ref:x,"data-testid":"agent-scope-picker-popover",role:"dialog","aria-label":J.scopePicker.popoverTitle,style:{position:"fixed",top:96,left:"50%",transform:"translateX(-50%)",width:600,maxWidth:"calc(100vw - 32px)",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,boxShadow:"0 18px 40px rgba(0,0,0,0.25)",overflow:"hidden",zIndex:90,animation:"scopePickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[a.jsxs("div",{style:{display:"flex",height:360,maxHeight:"60vh"},children:[a.jsxs("section",{"data-testid":"agent-scope-picker-agents",style:{width:260,borderRight:"1px solid var(--border-default, var(--border-subtle))",overflowY:"auto",padding:"6px 0"},children:[h.detected.length===0&&h.notDetected.length===0&&a.jsx(Fg,{}),h.detected.map(y=>y.kind==="aggregate"?a.jsx(yN,{row:y,onFocus:()=>{var v;return o(((v=y.consumers[0])==null?void 0:v.id)??l??"")}},y.key):a.jsx(vN,{agent:y.agent,focused:y.agent.id===s,active:y.agent.id===l,onClick:()=>o(y.agent.id)},y.key)),h.notDetected.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-testid":"agent-scope-not-detected-subheading",style:{padding:"10px 14px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-tertiary)"},children:J.scopePicker.notDetectedSubheading}),h.notDetected.map(y=>a.jsx(bN,{agent:y.agent,onSetUp:()=>f(y.agent.id)},y.key))]})]}),a.jsx("section",{"data-testid":"agent-scope-picker-stats",style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:p?a.jsx(SN,{agent:p,activeAgentId:l,onSwitch:()=>c(p.id)}):a.jsx(Fg,{})})]}),a.jsx("style",{children:`@keyframes scopePickerFadeIn {
99
+ from { opacity: 0; transform: translateX(-50%) translateY(2px); }
100
+ to { opacity: 1; transform: translateX(-50%) translateY(0); }
101
+ }`})]}),document.body)}function vN({agent:n,focused:l,active:s,onClick:o}){const c=n.health==="ok"?"var(--color-ok, #22c55e)":n.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return a.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":n.id,"data-active":s?"true":"false",onClick:o,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 14px",background:l?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:c,flexShrink:0}}),a.jsx("span",{style:{flex:1,fontSize:13},children:n.displayName}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[n.installedCount,"·",n.globalCount]})]})}function yN({row:n,onFocus:l}){return a.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:l,style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"100%",padding:"8px 14px",background:"transparent",border:"none",borderTop:"1px dashed var(--border-subtle)",borderBottom:"1px dashed var(--border-subtle)",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:n.sharedFolderPath}),a.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[n.consumers.map(s=>a.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"color-mix(in srgb, var(--color-global) 20%, transparent)",color:"var(--text-primary)"},children:s.id},s.id)),a.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",n.combinedCount," skills"]})]})]})}function bN({agent:n,onSetUp:l}){return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),a.jsx("span",{style:{flex:1},children:n.displayName}),n.isRemoteOnly?a.jsx("span",{"data-testid":`agent-scope-remote-badge-${n.id}`,"aria-label":"Remote-only agent",style:{background:"color-mix(in srgb, var(--text-tertiary) 18%, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:10,padding:"1px 8px",color:"var(--text-secondary)",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Remote"}):a.jsx("button",{type:"button","data-testid":`agent-scope-set-up-${n.id}`,onClick:l,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",fontSize:11,cursor:"pointer"},children:J.scopePicker.setUpCta(n.displayName)})]})}function SN({agent:n,activeAgentId:l,onSwitch:s}){const o=n.id===l,c=n.isRemoteOnly===!0,f=o||c,d=o?"Active":c?"Remote-only":J.scopePicker.switchCta;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:n.displayName}),a.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:c?"Remote service — no local install":kN(n.health)})]}),a.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[a.jsx(Ld,{label:J.scopePicker.statsInstalled,value:String(n.installedCount)}),a.jsx(Ld,{label:J.scopePicker.statsGlobal,value:String(n.globalCount)}),a.jsx(Ld,{label:J.scopePicker.statsLastSync,value:n.lastSync?jN(n.lastSync):"—"})]}),a.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:s,disabled:f,title:c?"This agent has no local CLI to switch to":void 0,style:{alignSelf:"flex-start",padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:f?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:f?"default":"pointer",opacity:f?.5:1},children:d})]})}function Ld({label:n,value:l}){return a.jsxs(a.Fragment,{children:[a.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:n}),a.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:l})]})}function Fg(){return a.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function jN(n){try{const l=new Date(n).getTime(),s=Date.now()-l;if(Number.isNaN(l))return"—";const o=Math.round(s/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.round(o/60);return c<24?`${c}h ago`:`${Math.round(c/24)}d ago`}catch{return"—"}}function kN(n){switch(n){case"ok":return J.scopePicker.statsHealthOk;case"stale":return J.scopePicker.statsHealthStale;case"missing":return J.scopePicker.statsHealthMissing}}function wN(n){const l=new Map;for(const s of n.sharedFolders??[])for(const o of s.consumers)l.set(o,s);return n.agents.map(s=>{const o=l.get(s.id);return{id:s.id,displayName:s.displayName,presence:s.detected?"detected":"absent",installedCount:s.localSkillCount,globalCount:s.globalSkillCount,lastSync:s.lastSync,health:s.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:s.isRemoteOnly}})}function CN({agents:n,activeAgentId:l,onActiveAgentChange:s,onOpenSetup:o}){const[c,f]=g.useState(!1),[d,x]=g.useState(null),h=g.useRef(null),p=g.useMemo(()=>n.find(j=>j.id===l)??n[0]??null,[n,l]),y=g.useMemo(()=>p?p.health==="ok"?"var(--color-ok, #22c55e)":p.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[p]),v=g.useCallback(()=>{var j;f(!1),(j=h.current)==null||j.focus()},[]),b=g.useCallback(j=>{s(j),f(!1)},[s]);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:h,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":c,onClick:()=>f(j=>!j),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),f(!0))},style:{display:"flex",alignItems:"center",gap:10,height:"40px",width:"100%",padding:"0 14px",background:"var(--bg-surface, var(--surface-1))",border:"none",borderBottom:"1px solid var(--border-default, var(--border-subtle))",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,textAlign:"left",position:"sticky",top:0,zIndex:2},children:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),a.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(p==null?void 0:p.displayName)??"Select agent"}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(p==null?void 0:p.installedCount)??0," · ",(p==null?void 0:p.globalCount)??0,")"]}),a.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),c&&a.jsx(gN,{agents:n,activeAgentId:l,focusedAgentId:d??l,onFocusAgent:x,onSwitch:b,onOpenSetup:j=>{o(j),v()},onClose:v})]})}const Ny="vskill-ccode-banner-dismissed",EN=new Set(["claude-cli","claude-code"]);function NN(){try{return sessionStorage.getItem(Ny)==="true"}catch{return!1}}function TN(){try{sessionStorage.setItem(Ny,"true")}catch{}}function RN({activeAgentId:n}){const[l,s]=g.useState(()=>NN()),o=g.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),c=g.useCallback(()=>{TN(),s(!0)},[]);return!n||!EN.has(n)||l?null:a.jsxs("div",{"data-testid":"claude-code-first-use-banner",role:"note","aria-label":"Claude Code subscription info",style:{display:"flex",alignItems:"flex-start",gap:10,padding:"8px 12px",borderBottom:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",lineHeight:1.45},children:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("span",{children:[J.claudeCodeLabel.firstUseBanner," "]}),a.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:J.claudeCodeLabel.learnMore})]}),a.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:c,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function AN(){const[n,l]=g.useState(null),[s,o]=g.useState("loading"),[c,f]=g.useState(null),d=g.useCallback(async()=>{try{const x=await Ne.getAgents();l(x),o("ready"),f(null)}catch(x){o("error"),f(x.message)}},[]);return g.useEffect(()=>{d()},[d]),g.useEffect(()=>{const x=()=>void d();return window.addEventListener("studio:agent-changed",x),()=>window.removeEventListener("studio:agent-changed",x)},[d]),{status:s,response:n,error:c,refresh:()=>void d()}}const go="workspace",MN=["skills","agents"];async function LN(){const n=await fetch("/api/workspace");if(!n.ok)throw new Error(`GET /api/workspace failed: ${n.status}`);return await n.json()}async function zN(n){const l=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n})});if(!l.ok){const s=await l.json().catch(()=>({}));throw new Error(s.error??`POST /api/workspace/active failed: ${l.status}`)}return await l.json()}async function DN(n){const l=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!l.ok){const s=await l.json().catch(()=>({}));throw new Error(s.error??`POST /api/workspace/projects failed: ${l.status}`)}return await l.json()}async function _N(n){const l=await fetch(`/api/workspace/projects/${encodeURIComponent(n)}`,{method:"DELETE"});if(!l.ok){const s=await l.json().catch(()=>({}));throw new Error(s.error??`DELETE /api/workspace/projects/${n} failed: ${l.status}`)}return await l.json()}function zd(){for(const n of MN)ln(n)}function ON(){const{data:n,loading:l,error:s,revalidate:o}=Nl(go,LN),c=n,f=c==null?void 0:c.projects.find(p=>p.id===c.activeProjectId),d=g.useCallback(async p=>{await zN(p),ln(go),zd()},[]),x=g.useCallback(async p=>{await DN(p),ln(go),zd()},[]),h=g.useCallback(async p=>{await _N(p),ln(go),zd()},[]);return{workspace:c,activeProject:f,loading:l,error:s,switchProject:d,addProject:x,removeProject:h,revalidate:o}}function BN({workspace:n,onSwitch:l,onAdd:s,onRemove:o,isPathStale:c}){const[f,d]=g.useState(!1),[x,h]=g.useState(!1),[p,y]=g.useState(""),[v,b]=g.useState(null),[j,k]=g.useState(null),[N,C]=g.useState(null),[w,A]=g.useState(!1),_=g.useRef(null),H=(n==null?void 0:n.projects)??[],L=H.find(R=>R.id===(n==null?void 0:n.activeProjectId));g.useEffect(()=>{if(!f)return;function R(B){_.current&&!_.current.contains(B.target)&&(d(!1),h(!1),b(null))}return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[f]);async function $(){b(null);const R=p.trim();if(!R){b("Paste an absolute path (e.g. /Users/you/projects/my-skill)");return}if(!R.startsWith("/")&&!/^[A-Za-z]:[\\/]/.test(R)){b("Path must be absolute. In Terminal, cd to the folder and run: pwd — then paste the result here.");return}try{await s({path:R}),y(""),h(!1)}catch(B){const V=B instanceof Error?B.message:String(B);/does not exist/i.test(V)?b(`Path not found on disk: ${R}`):/Duplicate/i.test(V)?b("That project is already registered."):b(V)}}async function E(){if(b(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const R=await window.showDirectoryPicker();y(R.name),h(!0)}catch{}else h(!0)}function D(R){if(R.length<=50)return R;const B=R.split("/");return B.length<=4?R:`${B.slice(0,3).join("/")}/…/${B.slice(-2).join("/")}`}return a.jsxs("div",{ref:_,"data-vskill-project-picker":!0,style:{position:"relative",display:"inline-block"},children:[a.jsxs("button",{type:"button",onClick:()=>d(R=>!R),"aria-expanded":f,"aria-haspopup":"menu",title:(L==null?void 0:L.path)??"No project selected",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",border:"1px solid transparent",borderRadius:6,background:f?"var(--surface-2, rgba(0,0,0,0.05))":"transparent",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-primary)",transition:"background-color 120ms ease"},children:[a.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(L==null?void 0:L.colorDot)??"var(--text-tertiary, #999)"}}),a.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L?L.name:"No project"}),a.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary, #999)",marginLeft:2},children:f?"▴":"▾"})]}),f&&a.jsxs("div",{role:"menu","aria-label":"Switch project",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:280,maxWidth:420,width:"max-content",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:8,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 10px 20px -5px rgba(0,0,0,0.12)",overflow:"hidden",zIndex:50,fontFamily:"var(--font-sans)"},children:[H.length===0&&a.jsx("div",{style:{padding:"16px 16px 12px",fontSize:12,color:"var(--text-tertiary)",lineHeight:1.5},children:"No projects registered. Add one to get started."}),H.length>0&&a.jsx("ul",{role:"none",style:{listStyle:"none",margin:0,padding:4,maxHeight:320,overflowY:"auto"},children:H.map(R=>{const B=c?c(R.path):!1,V=R.id===(n==null?void 0:n.activeProjectId),W=j===R.id;return a.jsxs("li",{role:"menuitem","data-stale":B?"true":"false",onMouseEnter:()=>k(R.id),onMouseLeave:()=>k(te=>te===R.id?null:te),onClick:()=>{if(!B){if(V){d(!1);return}C(R)}},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:B?"not-allowed":"pointer",background:W&&!B?"var(--surface-2, rgba(0,0,0,0.04))":V?"var(--surface-1, rgba(0,0,0,0.02))":"transparent",opacity:B?.5:1,transition:"background-color 120ms ease"},children:[a.jsx("span",{"aria-hidden":!0,style:{width:10,height:10,borderRadius:"50%",flexShrink:0,backgroundColor:R.colorDot,boxShadow:V?"0 0 0 2px color-mix(in oklch, currentColor 20%, transparent)":"none"}}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,fontWeight:V?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:R.name}),V&&a.jsx("span",{"aria-label":"Active",style:{fontSize:10,color:"var(--color-action, #2F5B8E)",letterSpacing:"0.05em",textTransform:"uppercase",fontWeight:600},children:"Active"})]}),a.jsx("div",{title:R.path,style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D(R.path)}),B&&a.jsx("div",{style:{fontSize:10,color:"var(--color-own, #b45309)",marginTop:2},children:"Path no longer exists"})]}),a.jsx("button",{type:"button","aria-label":`Remove ${R.name}`,onClick:te=>{te.stopPropagation(),o(R.id)},style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",color:"var(--text-tertiary)",opacity:W?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:te=>{te.currentTarget.style.color="var(--color-error, #b91c1c)",te.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:te=>{te.currentTarget.style.color="var(--text-tertiary)",te.currentTarget.style.backgroundColor="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),a.jsx("path",{d:"M10 11v6"}),a.jsx("path",{d:"M14 11v6"}),a.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})})]},R.id)})}),a.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:x?8:6},children:[!x&&a.jsxs("button",{type:"button",onClick:()=>void E(),className:"vskill-project-add",style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 10px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,color:"var(--color-action, #2F5B8E)",transition:"background-color 120ms ease"},onMouseEnter:R=>{R.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-action, #2F5B8E) 10%, transparent)"},onMouseLeave:R=>{R.currentTarget.style.backgroundColor="transparent"},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add project"]}),x&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx("input",{type:"text",value:p,onChange:R=>y(R.target.value),onKeyDown:R=>{R.key==="Enter"&&$(),R.key==="Escape"&&(h(!1),b(null))},placeholder:"/absolute/path/to/project",autoFocus:!0,style:{width:"100%",padding:"6px 8px",fontFamily:"var(--font-mono)",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),a.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[a.jsx("button",{type:"button",onClick:()=>{h(!1),b(null),y("")},style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Cancel"}),a.jsx("button",{type:"button",onClick:()=>void $(),style:{padding:"4px 10px",fontSize:12,border:"none",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-paper, #fff)",cursor:"pointer",fontWeight:500},children:"Add"})]}),v&&a.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:v})]})]})]}),N&&a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Switch project instructions",style:{position:"fixed",inset:0,zIndex:80,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>C(null),children:[a.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.40)"}}),a.jsxs("div",{onClick:R=>R.stopPropagation(),style:{position:"relative",width:"min(520px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",padding:18,fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[a.jsxs("h2",{style:{margin:0,fontSize:16,fontWeight:600,fontFamily:"var(--font-serif, ui-serif)",marginBottom:8},children:["Switch to ",N.name]}),a.jsx("p",{style:{fontSize:13,color:"var(--text-secondary)",lineHeight:1.5,margin:0,marginBottom:12},children:"Skill Studio's skill scanner reads from the folder it was launched in, so switching projects from the browser isn't possible. Quit this server and relaunch from the target folder:"}),a.jsx("div",{style:{background:"var(--surface-1, #0f0f10)",color:"var(--text-primary)",padding:"10px 12px",borderRadius:6,fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-all",border:"1px solid var(--border-subtle, rgba(255,255,255,0.08))"},children:`cd "${N.path}" && npx vskill@latest studio`}),a.jsxs("div",{style:{display:"flex",gap:8,marginTop:14,justifyContent:"flex-end"},children:[a.jsx("button",{type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(`cd "${N.path}" && npx vskill@latest studio`),A(!0),setTimeout(()=>A(!1),1600)}catch{}},style:{padding:"7px 14px",fontSize:13,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:6,background:"var(--color-action, #2F5B8E)",color:"#ffffff",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.12)"},children:w?"Copied!":"Copy command"}),a.jsx("button",{type:"button",onClick:()=>C(null),style:{padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Close"})]})]})]})]})}function IN(n,l){const s=l.trim().toLowerCase().split(/\s+/).filter(Boolean);return s.length===0?n:n.filter(o=>{const c=`${o.name} ${o.path}`.toLowerCase();return s.every(f=>c.includes(f))})}function HN({open:n,projects:l,onSwitch:s,onClose:o}){const[c,f]=g.useState(""),[d,x]=g.useState(0),h=g.useMemo(()=>IN(l,c),[l,c]);g.useEffect(()=>{n||(f(""),x(0))},[n]),g.useEffect(()=>{d>=h.length&&x(0)},[h.length,d]);const p=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),x(v=>Math.min(v+1,Math.max(h.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),x(v=>Math.max(v-1,0));return}if(y.key==="Enter"){y.preventDefault();const v=h[d];v&&(s(v.id),o())}};return n?a.jsxs("div",{role:"dialog","aria-modal":"true","data-vskill-project-palette":!0,className:"vskill-project-palette fixed inset-0 z-50 flex items-start justify-center pt-24",children:[a.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),a.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[a.jsx("input",{type:"text",autoFocus:!0,value:c,onChange:y=>f(y.target.value),onKeyDown:p,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),a.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[h.length===0&&a.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),h.map((y,v)=>a.jsxs("li",{role:"option","aria-selected":v===d,"data-highlighted":v===d,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",v===d?"bg-muted":""].join(" "),onMouseEnter:()=>x(v),onClick:()=>{s(y.id),o()},children:[a.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),a.jsxs("span",{className:"flex-1",children:[a.jsx("span",{className:"vskill-palette-name",children:y.name}),a.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const Gg=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;function UN({open:n,onClose:l,initialMode:s="standalone",isClaudeCode:o,projectRoot:c,onCreated:f}){const[d,x]=g.useState("destination"),[h,p]=g.useState(s),[y,v]=g.useState(""),[b,j]=g.useState(""),[k,N]=g.useState(""),[C,w]=g.useState([]),[A,_]=g.useState(!1),[H,L]=g.useState(null);if(g.useEffect(()=>{n&&(x("destination"),p(s),v(""),j(""),N(""),L(null))},[n,s]),g.useEffect(()=>{if(!n)return;let z=!0;return fetch("/api/authoring/plugins").then(M=>M.json()).then(M=>{z&&w(M.plugins??[])}).catch(()=>{}),()=>{z=!1}},[n]),g.useEffect(()=>{if(!n)return;function z(M){M.key==="Escape"&&(M.preventDefault(),l())}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[n,l]),!n)return null;const $=C.length>0,E=o&&$,D=o,R=Gg.test(y),B=h==="existing-plugin"?b.length>0:Gg.test(b),V=!A&&R&&(h==="standalone"||B),W=$N(c,h,b,y);async function te(){L(null),_(!0);try{const I=new URLSearchParams;I.set("mode",h),I.set("skillName",y),b&&I.set("pluginName",b);const X=await fetch(`/api/authoring/skill-exists?${I.toString()}`),G=await X.json();if(!X.ok){L(G.error??`Check failed: ${X.status}`);return}if(G.exists){L(`Skill '${y}' already exists${G.path?` at ${G.path}`:""}`);return}}catch(I){L(I instanceof Error?I.message:String(I));return}finally{_(!1)}const z=new URLSearchParams;z.set("mode",h),z.set("skillName",y),k.trim()&&z.set("description",k.trim()),b&&z.set("pluginName",b);const M=`/#/create?${z.toString()}`;typeof window<"u"&&window.location.assign(M),l()}async function Q(){L(null),_(!0);try{const z=await fetch("/api/authoring/create-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:h,skillName:y,description:k.trim()||void 0,pluginName:h==="standalone"?void 0:b})}),M=await z.json();if(!z.ok||!M.ok){L(M.error??`Create failed: ${z.status}`);return}ln("skills"),f==null||f({mode:h,skillName:y,pluginName:M.pluginName??null,skillMdPath:M.skillMdPath}),l()}catch(z){L(z instanceof Error?z.message:String(z))}finally{_(!1)}}return a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Create skill","data-vskill-create-skill-modal":!0,style:{position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},children:[a.jsx("div",{onClick:l,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),a.jsxs("div",{style:{position:"relative",width:"min(560px, 92vw)",maxHeight:"86vh",overflow:"auto",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",fontFamily:"var(--font-sans)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[a.jsx("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",letterSpacing:"0.01em"},children:d==="destination"?"Create a skill":"Name and describe"}),a.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:["Step ",d==="destination"?"1":"2"," of 2"]})]}),d==="destination"&&a.jsxs("div",{style:{padding:14,display:"flex",flexDirection:"column",gap:10},children:[a.jsx(Dd,{title:"Standalone skill",subtitle:"A single skill in this project",description:"Lives at <project>/skills/<name>/SKILL.md. Works with every agent.",icon:"📄",selected:h==="standalone",onClick:()=>p("standalone")}),a.jsx(Dd,{title:"Add to existing plugin",subtitle:E?`${C.length} plugin source${C.length===1?"":"s"} in this project`:o?"No plugin sources in this project yet":"Claude Code only",description:"Appends a skill to an existing <plugin>/.claude-plugin/plugin.json source.",icon:"🧩",disabled:!E,selected:h==="existing-plugin",onClick:()=>E&&p("existing-plugin")}),a.jsx(Dd,{title:"New plugin",subtitle:D?"Bundles one or more skills for distribution":"Claude Code only",description:"Scaffolds <plugin>/.claude-plugin/plugin.json and its first skill.",icon:"📦",disabled:!D,selected:h==="new-plugin",onClick:()=>D&&p("new-plugin")})]}),d==="details"&&a.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[h==="new-plugin"&&a.jsx(vo,{label:"Plugin name",hint:"kebab-case",children:a.jsx("input",{type:"text",value:b,onChange:z=>j(z.target.value.trim()),placeholder:"my-first-plugin",autoFocus:!0,style:yo(!b||B)})}),h==="existing-plugin"&&a.jsx(vo,{label:"Plugin",children:a.jsxs("select",{value:b,onChange:z=>j(z.target.value),style:{...yo(!0),fontFamily:"var(--font-mono)"},children:[a.jsx("option",{value:"",children:"Select a plugin…"}),C.map(z=>a.jsx("option",{value:z.name,children:z.name},z.path))]})}),a.jsx(vo,{label:"Skill name",hint:"kebab-case",children:a.jsx("input",{type:"text",value:y,onChange:z=>v(z.target.value.trim()),placeholder:"my-new-skill",autoFocus:h!=="new-plugin",style:yo(!y||R)})}),a.jsx(vo,{label:"Description",hint:"One short sentence — shown in frontmatter",children:a.jsx("textarea",{value:k,onChange:z=>N(z.target.value),rows:2,placeholder:"Does a thing when Claude needs X",style:{...yo(!0),resize:"vertical",minHeight:52,fontFamily:"var(--font-sans)"}})}),W&&a.jsxs("div",{style:{padding:"8px 10px",fontSize:11,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",background:"var(--surface-1, rgba(0,0,0,0.03))",border:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",borderRadius:4,wordBreak:"break-all"},children:[a.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:2,fontFamily:"var(--font-sans)"},children:"Will create:"}),W.map((z,M)=>a.jsx("div",{children:z},M))]}),H&&a.jsx("div",{style:{fontSize:12,color:"var(--color-error, #b91c1c)",padding:"6px 10px",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:H})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 16px",borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",background:"var(--surface-1, rgba(0,0,0,0.02))"},children:[a.jsx("button",{type:"button",onClick:l,style:_d,children:"Cancel"}),d==="destination"&&a.jsx("button",{type:"button",onClick:()=>x("details"),style:Wg,children:"Continue →"}),d==="details"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>x("destination"),style:_d,children:"← Back"}),a.jsx("button",{type:"button",onClick:()=>void te(),disabled:!V,style:{..._d,opacity:V?1:.5,cursor:V?"pointer":"not-allowed"},title:"Opens the AI generation flow with this destination pre-selected (choose Claude Code, Anthropic API, OpenRouter, or local models)",children:"✨ Generate with AI"}),a.jsx("button",{type:"button",onClick:()=>void Q(),disabled:!V,style:{...Wg,opacity:V?1:.5,cursor:V?"pointer":"not-allowed"},title:"Creates an empty SKILL.md scaffold you can fill in by hand",children:A?"Creating…":"Create empty scaffold"})]})]})]})]})}function Dd({title:n,subtitle:l,description:s,icon:o,selected:c,disabled:f,onClick:d}){return a.jsxs("button",{type:"button",onClick:d,disabled:f,"aria-pressed":c,style:{display:"flex",gap:12,padding:"12px 14px",textAlign:"left",borderRadius:8,border:c?"2px solid var(--color-accent, #2f6f8f)":"1px solid var(--border-default, rgba(0,0,0,0.12))",background:c?"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))":f?"var(--surface-1, rgba(0,0,0,0.02))":"var(--color-paper, #fff)",color:f?"var(--text-tertiary)":"var(--text-primary)",cursor:f?"not-allowed":"pointer",opacity:f?.6:1,fontFamily:"inherit",width:"100%",transition:"border-color 120ms ease, background-color 120ms ease"},children:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:22,lineHeight:1,marginTop:2},children:o}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:14,fontWeight:600,lineHeight:1.3},children:n}),a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:2,textTransform:"uppercase",letterSpacing:"0.04em"},children:l}),a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:6,lineHeight:1.5},children:s})]})]})}function vo({label:n,hint:l,children:s}){return a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[a.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[a.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:n}),l&&a.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:l})]}),s]})}function yo(n){return{width:"100%",padding:"7px 10px",fontSize:13,fontFamily:"var(--font-mono)",border:`1px solid ${n?"var(--border-default, rgba(0,0,0,0.12))":"var(--color-error, #b91c1c)"}`,borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none",boxSizing:"border-box"}}const Wg={padding:"8px 16px",fontSize:13,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:6,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:"pointer",fontFamily:"inherit",boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",letterSpacing:"0.01em"},_d={padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer",fontFamily:"inherit"};function $N(n,l,s,o){const c=o||"<skill-name>",f=s||"<plugin-name>",d=n||"<project>";return l==="standalone"?[`${d}/skills/${c}/SKILL.md`]:l==="existing-plugin"?[`${d}/${f}/skills/${c}/SKILL.md`]:l==="new-plugin"?[`${d}/${f}/.claude-plugin/plugin.json`,`${d}/${f}/skills/${c}/SKILL.md`]:null}function VN({open:n,onClose:l,onInstall:s,installedNames:o}){const[c,f]=g.useState([]),[d,x]=g.useState(null),[h,p]=g.useState(null),[y,v]=g.useState(!1),[b,j]=g.useState(null);return g.useEffect(()=>{n&&(v(!0),j(null),fetch("/api/plugins/marketplaces").then(k=>k.json()).then(k=>{if(k.error)throw new Error(k.error);f(k.marketplaces??[])}).catch(k=>j(k instanceof Error?k.message:String(k))).finally(()=>v(!1)))},[n]),g.useEffect(()=>{if(!d){p(null);return}v(!0),j(null),fetch(`/api/plugins/marketplaces/${encodeURIComponent(d)}`).then(k=>k.json()).then(k=>{if(k.error)throw new Error(k.error);p(k)}).catch(k=>j(k instanceof Error?k.message:String(k))).finally(()=>v(!1))},[d]),g.useEffect(()=>{if(!n)return;function k(N){N.key==="Escape"&&l()}return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[n,l]),n?a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Plugin marketplace","data-vskill-marketplace-drawer":!0,style:{position:"fixed",inset:0,zIndex:80},children:[a.jsx("div",{onClick:l,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.38)"}}),a.jsxs("aside",{style:{position:"absolute",top:0,right:0,bottom:0,width:"min(480px, 94vw)",background:"var(--color-paper, #fff)",borderLeft:"1px solid var(--border-default, rgba(0,0,0,0.12))",boxShadow:"-10px 0 30px -8px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",fontFamily:"var(--font-sans)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[d&&a.jsx("button",{type:"button",onClick:()=>x(null),"aria-label":"Back to marketplaces",style:{border:"none",background:"transparent",fontSize:14,color:"var(--text-secondary)",cursor:"pointer",padding:0},children:"← Back"}),a.jsx("h2",{style:{margin:0,fontSize:15,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",flex:1},children:d?(h==null?void 0:h.name)??d:"Browse plugins"}),a.jsx("button",{type:"button",onClick:l,"aria-label":"Close",style:{border:"none",background:"transparent",fontSize:16,color:"var(--text-secondary)",cursor:"pointer",padding:"4px 6px"},children:"✕"})]}),a.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12},children:[y&&a.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"Loading…"}),b&&a.jsx("div",{style:{padding:10,fontSize:12,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:b}),!d&&!y&&c.length===0&&!b&&a.jsx(PN,{}),!d&&c.map(k=>a.jsxs("button",{type:"button",onClick:()=>x(k.name),style:GN,onMouseEnter:N=>{N.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.04))"},onMouseLeave:N=>{N.currentTarget.style.background="transparent"},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:k.name}),a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.source})]},k.name)),d&&h&&a.jsxs(a.Fragment,{children:[h.description&&a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",padding:"0 6px 12px",lineHeight:1.5},children:h.description}),h.plugins.length===0&&a.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"This marketplace has no plugins catalogued yet."}),h.plugins.map(k=>{const N=o.has(k.name);return a.jsx("div",{style:{padding:"10px 8px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.05))"},children:a.jsxs("div",{style:{display:"flex",alignItems:"start",gap:8},children:[a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",display:"flex",alignItems:"baseline",gap:8},children:[k.name,k.version&&a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)"},children:k.version}),k.category&&a.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"var(--surface-2, rgba(0,0,0,0.05))",color:"var(--text-secondary)"},children:k.category})]}),k.description&&a.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4,lineHeight:1.5},children:k.description})]}),a.jsx("button",{type:"button",disabled:N,onClick:()=>s(k.name,d),style:{flexShrink:0,padding:"5px 12px",fontSize:12,fontWeight:600,border:N?"none":"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:N?"var(--surface-2, rgba(0,0,0,0.05))":"var(--color-action, #2F5B8E)",color:N?"var(--text-tertiary)":"var(--color-action-ink, #FFFFFF)",cursor:N?"default":"pointer",fontFamily:"inherit",boxShadow:N?"none":"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:N?"Installed":"Install"})]})},k.name)})]})]}),!d&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:12},children:a.jsx(FN,{onAdded:()=>{ln("marketplaces"),fetch("/api/plugins/marketplaces").then(k=>k.json()).then(k=>f(k.marketplaces??[]))}})})]})]}):null}function PN(){return a.jsxs("div",{style:{padding:20,fontSize:12,color:"var(--text-tertiary)",lineHeight:1.6},children:["No marketplaces configured yet. Add one below — examples:",a.jsxs("ul",{style:{marginTop:8,paddingLeft:16},children:[a.jsx("li",{children:a.jsx("code",{children:"anthropics/claude-plugins-official"})}),a.jsx("li",{children:a.jsx("code",{children:"openai/codex-plugin-cc"})})]})]})}function FN({onAdded:n}){const[l,s]=g.useState(""),[o,c]=g.useState(!1),[f,d]=g.useState(null);async function x(){const h=l.trim();if(h){c(!0),d(null);try{const p=await fetch("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:h})}),y=await p.json().catch(()=>({}));if(!p.ok||!y.ok){d(y.error??`Add failed (${p.status})`);return}s(""),n()}catch(p){d(p instanceof Error?p.message:String(p))}finally{c(!1)}}}return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx("label",{style:{fontSize:11,color:"var(--text-tertiary)",fontWeight:500},children:"Add marketplace (GitHub owner/repo, URL, or path)"}),a.jsxs("div",{style:{display:"flex",gap:6},children:[a.jsx("input",{type:"text",value:l,onChange:h=>s(h.target.value),onKeyDown:h=>{h.key==="Enter"&&x()},placeholder:"anthropics/claude-plugins-official",disabled:o,style:{flex:1,padding:"6px 8px",fontSize:12,fontFamily:"var(--font-mono)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),a.jsx("button",{type:"button",onClick:()=>void x(),disabled:o||!l.trim(),style:{padding:"6px 14px",fontSize:12,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:o||!l.trim()?"not-allowed":"pointer",opacity:o||!l.trim()?.5:1,boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",fontFamily:"inherit"},children:o?"Adding…":"Add"})]}),f&&a.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:f})]})}const GN={display:"block",width:"100%",textAlign:"left",padding:"10px 12px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"inherit",marginBottom:2},Od=12;function WN({job:n,onDone:l}){const[s,o]=g.useState([]),[c,f]=g.useState("running"),[d,x]=g.useState(!1);if(g.useEffect(()=>{if(!n)return;o([]),f("running"),x(!1);const v=new AbortController;let b=[],j="running";return(async()=>{try{const k=await fetch("/api/plugins/install/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({plugin:n.ref}),signal:v.signal});if(!k.ok||!k.body){f("failed"),l({ok:!1,code:k.status,lines:[`HTTP ${k.status}`]});return}const N=k.body.getReader(),C=new TextDecoder;let w="";for(;;){const{value:A,done:_}=await N.read();if(_)break;w+=C.decode(A,{stream:!0});const H=w.split(/\n\n/);w=H.pop()??"";for(const L of H){const $=L.match(/^data:\s*(.*)$/m);if($)try{const E=JSON.parse($[1]);E.type==="stdout"&&E.line?(b=[...b,E.line].slice(-Od),o(b)):E.type==="stderr"&&E.line?(b=[...b,`⚠ ${E.line}`].slice(-Od),o(b)):E.type==="done"?(j=E.ok?"ok":"failed",f(j),ln("plugins"),ln("skills"),l({ok:E.ok??!1,code:E.code??null,lines:b})):E.type==="error"&&E.error&&(b=[...b,`✘ ${E.error}`].slice(-Od),o(b))}catch{}}}j==="running"&&l({ok:!0,code:0,lines:b})}catch(k){if(k.name==="AbortError")return;f("failed"),l({ok:!1,code:null,lines:[...b,k instanceof Error?k.message:String(k)]})}})(),()=>v.abort()},[n==null?void 0:n.ref]),!n)return null;const h=c==="ok"?"var(--color-installed, #2F6A4A)":c==="failed"?"var(--color-error, #b91c1c)":"var(--color-accent, #2f6f8f)",p=c==="ok"?"✔":c==="failed"?"✘":"…",y=c==="ok"?"Installed":c==="failed"?"Install failed":"Installing";return a.jsxs("div",{role:"status","aria-live":"polite","data-vskill-install-toast":!0,style:{position:"fixed",bottom:16,right:16,width:"min(420px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderLeft:`3px solid ${h}`,borderRadius:6,boxShadow:"0 10px 20px -6px rgba(0,0,0,0.18)",zIndex:90,fontFamily:"var(--font-sans)",overflow:"hidden"},children:[a.jsxs("button",{type:"button",onClick:()=>x(v=>!v),style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"10px 12px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},children:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:16,color:h,width:16,textAlign:"center"},children:c==="running"?a.jsx(qN,{}):p}),a.jsxs("span",{style:{flex:1,minWidth:0},children:[a.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:[y,": ",n.plugin,a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginLeft:4},children:["@",n.marketplace]})]}),!d&&s.length>0&&a.jsx("span",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s[s.length-1]})]}),a.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary)"},children:d?"▾":"▸"})]}),d&&a.jsx("pre",{style:{margin:0,padding:"0 12px 12px",maxHeight:180,overflowY:"auto",fontFamily:"var(--font-mono)",fontSize:10,lineHeight:1.5,color:"var(--text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s.length===0?"Waiting for output…":s.join(`
102
+ `)})]})}function qN(){return a.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:10,height:10,borderRadius:"50%",border:"2px solid var(--color-accent, #2f6f8f)",borderTopColor:"transparent",animation:"vskill-spin 800ms linear infinite"},children:a.jsx("style",{children:"@keyframes vskill-spin { to { transform: rotate(360deg); } }"})})}const Ty="vskill.studio.prefs";function Ry(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function Ay(){const n=Ry();if(!n)return{};try{const l=n.getItem(Ty);if(!l)return{};const s=JSON.parse(l);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch{return{}}}function YN(n,l){const s=Ry();if(s)try{const c={...Ay(),[n]:l};s.setItem(Ty,JSON.stringify(c))}catch{}}function KN(n,l){const o=Ay()[n];return o===void 0?l:o}const qg={open:!1,x:0,y:0,skill:null};function XN(n,l){return{open:!0,x:n.clientX,y:n.clientY,skill:l}}function Cr(n,l="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:n,severity:l}}))}function QN(n,l){var s;switch(n){case"copy-path":try{(s=navigator.clipboard)==null||s.writeText(l.dir)}catch{Cr(J.toasts.permissionDenied,"error");return}Cr(J.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":Cr(J.actions.editPlaceholder,"info");return;case"run-benchmark":Cr(J.toasts.benchmarkQueued,"info");return;case"duplicate":Cr(J.toasts.skillDuplicated,"info");return;case"update":Cr(J.toasts.skillUpdated,"info");return;case"uninstall":Cr(J.actions.editPlaceholder,"info");return;default:return}}const ZN=g.lazy(()=>Ea(()=>import("./CommandPalette-DiPALzlG.js"),__vite__mapDeps([4,1]))),JN=g.lazy(()=>Ea(()=>import("./CreateSkillPage-BMrFELep.js"),__vite__mapDeps([5,1])).then(n=>({default:n.CreateSkillPage})));function eT(){const[n,l]=g.useState(()=>typeof window<"u"&&window.location.hash.startsWith("#/create"));return g.useEffect(()=>{function s(){l(window.location.hash.startsWith("#/create"))}return window.addEventListener("hashchange",s),s(),()=>window.removeEventListener("hashchange",s)},[]),n}function tT(){return a.jsx(QS,{children:a.jsx(YS,{children:a.jsxs(WE,{children:[a.jsx(nT,{}),a.jsx(nN,{})]})})})}function nT(){var Be,Me;const{state:n,selectSkill:l,clearSelection:s,refreshSkills:o,outdatedByOrigin:c}=Na(),{config:f}=Rr(),{mode:d,resolvedTheme:x,setTheme:h}=bv(),{toast:p}=wf(),[y,v]=g.useState(()=>pw()),[b]=g.useState(!0),[j,k]=g.useState(!1),[N,C]=g.useState(!1),[w,A]=g.useState(!1),[_,H]=g.useState("overview"),[L,$]=g.useState(qg),E=g.useCallback((ue,De)=>{$(XN(ue,De))},[]),D=AN(),[R,B]=g.useState(()=>KN("activeAgent",null));g.useEffect(()=>{var ue;!R&&((ue=D.response)!=null&&ue.suggested)&&B(D.response.suggested)},[R,(Be=D.response)==null?void 0:Be.suggested]);const V=g.useCallback(ue=>{B(ue),YN("activeAgent",ue),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:ue}}))},[]),W=g.useMemo(()=>D.response?wN(D.response):[],[D.response]),{workspace:te,switchProject:Q,addProject:z,removeProject:M,activeProject:I}=ON(),[X,G]=g.useState(!1),[ce,O]=g.useState(!1),[Y,se]=g.useState("standalone"),de=g.useCallback((ue="standalone")=>{se(ue),O(!0)},[]);g.useEffect(()=>{function ue(De){if(!(De instanceof CustomEvent))return;const Ie=De.detail;de((Ie==null?void 0:Ie.mode)??"standalone")}return window.addEventListener("studio:request-create-skill",ue),()=>window.removeEventListener("studio:request-create-skill",ue)},[de]);const[ge,xe]=g.useState(!1),[we,ie]=g.useState(null);g.useEffect(()=>{function ue(){xe(!0)}return window.addEventListener("studio:open-marketplace",ue),()=>window.removeEventListener("studio:open-marketplace",ue)},[]);const je=g.useMemo(()=>{const ue=new Set;for(const De of n.skills)De.source==="plugin"&&De.pluginName&&ue.add(De.pluginName);return ue},[n.skills]);Wd([{key:"p",meta:!0,handler:ue=>{var Ie;const De=typeof document<"u"?document.activeElement:null;De&&De.tagName==="INPUT"||((Ie=ue==null?void 0:ue.preventDefault)==null||Ie.call(ue),G(Bt=>!Bt))}}],{enabled:!0});const Oe=hN();g.useEffect(()=>{function ue(De){if(!(De instanceof CustomEvent))return;const Ie=De.detail;Ie!=null&&Ie.provider&&Oe.open(Ie.provider)}return window.addEventListener("studio:open-setup-drawer",ue),()=>window.removeEventListener("studio:open-setup-drawer",ue)},[Oe]);const $e=g.useCallback(()=>{$(qg)},[]);g.useEffect(()=>{function ue(De){if(!(De instanceof CustomEvent))return;const Ie=De.detail;Ie!=null&&Ie.message&&p({message:Ie.message,severity:Ie.severity??"info"})}return window.addEventListener("studio:toast",ue),()=>window.removeEventListener("studio:toast",ue)},[p]),g.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${y}px`)},[y]);const ae=g.useMemo(()=>n.selectedSkill?n.skills.find(ue=>ue.plugin===n.selectedSkill.plugin&&ue.skill===n.selectedSkill.skill)??null:null,[n.skills,n.selectedSkill]),pe=g.useCallback(ue=>{l({plugin:ue.plugin,skill:ue.skill,origin:ue.origin})},[l]),fe=g.useMemo(()=>{if(!n.selectedSkill)return"";const ue=n.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${n.selectedSkill.skill} (${ue})`},[n.selectedSkill]),he=g.useMemo(()=>[{id:"switch-theme",label:J.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>h(d==="light"?"dark":d==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>A(ue=>!ue)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>C(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[d,h,o]);return Wd([{key:"cmd+k",handler:()=>k(ue=>!ue)},{key:"ctrl+k",handler:()=>k(ue=>!ue)},{key:"?",handler:()=>C(ue=>!ue)},{key:"cmd+shift+d",handler:()=>h(x==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>h(x==="light"?"dark":"light")},{key:"cmd+b",handler:()=>A(ue=>!ue)},{key:"ctrl+b",handler:()=>A(ue=>!ue)},{key:"e",handler:()=>p({message:J.actions.editPlaceholder,severity:"info"})}]),eT()?a.jsx(g.Suspense,{fallback:a.jsx("div",{style:{padding:40},children:"Loading…"}),children:a.jsx(JN,{})}):a.jsxs(a.Fragment,{children:[a.jsx(ZS,{sidebarWidth:y,sidebarHidden:w||n.isMobile&&n.mobileView==="detail",banner:a.jsx(xw,{connected:b}),liveMessage:fe,topRail:a.jsx(Qj,{projectName:(f==null?void 0:f.projectName)??null,selected:n.selectedSkill,onOpenPalette:()=>k(!0),onHome:s,onRequestCreateSkill:()=>de("standalone"),projectPickerSlot:te&&te.projects.length>0?a.jsx(BN,{workspace:te,onSwitch:Q,onAdd:z,onRemove:M}):void 0}),sidebar:a.jsx(lw,{skills:n.skills,selectedKey:n.selectedSkill?{plugin:n.selectedSkill.plugin,skill:n.selectedSkill.skill}:null,onSelect:pe,isLoading:n.skillsLoading,error:n.skillsError??null,onRetry:o,onContextMenu:E,outdatedByOrigin:c,activeAgentId:R,topSlot:D.status==="ready"&&W.length>0?a.jsxs(a.Fragment,{children:[a.jsx(CN,{agents:W,activeAgentId:R,onActiveAgentChange:V,onOpenSetup:ue=>Oe.open(ue)}),a.jsx(RN,{activeAgentId:R})]}):null}),resizeHandle:a.jsx(hw,{initialWidth:y??Ds,onChange:v}),main:a.jsx(KE,{selectedSkillInfo:ae,activeDetailTab:_,onDetailTabChange:H,allSkills:n.skills,onSelectSkill:pe}),statusBar:a.jsx(o2,{projectPath:(f==null?void 0:f.root)??null,modelName:(f==null?void 0:f.model)??null,health:f!=null&&f.error?"degraded":"ok",providers:(Me=f==null?void 0:f.providers)==null?void 0:Me.map(ue=>{const De=ue.id;return{id:De,label:ue.label,available:ue.available,kind:De==="ollama"||De==="lm-studio"?"start-service":De==="anthropic"||De==="openrouter"?"api-key":"cli-install"}})})}),a.jsx(rN,{open:N,onClose:()=>C(!1)}),a.jsx(cN,{open:Oe.isOpen,providerKey:Oe.providerKey,onClose:Oe.close}),a.jsx(sN,{state:L,onClose:$e,onAction:(ue,De)=>QN(ue,De)}),j&&a.jsx(g.Suspense,{fallback:null,children:a.jsx(ZN,{open:j,onClose:()=>k(!1),commands:he})}),a.jsx(HN,{open:X,projects:(te==null?void 0:te.projects)??[],onSwitch:ue=>{Q(ue)},onClose:()=>G(!1)}),a.jsx(UN,{open:ce,onClose:()=>O(!1),initialMode:Y,isClaudeCode:R==="claude-code",projectRoot:(I==null?void 0:I.path)??(f==null?void 0:f.projectName)??"",onCreated:ue=>{const De=ue.pluginName??"";o(),setTimeout(()=>{l({plugin:De,skill:ue.skillName,origin:"source"})},500)}}),a.jsx(VN,{open:ge,onClose:()=>xe(!1),installedNames:je,onInstall:(ue,De)=>{ie({plugin:ue,marketplace:De,ref:`${ue}@${De}`}),xe(!1)}}),a.jsx(WN,{job:we,onDone:ue=>{ue.ok&&setTimeout(()=>ie(null),3e3)}})]})}const Yg="vskill.migrations.scope-rename.v1",aT={own:"authoring-project",installed:"available-project",global:"available-personal"},rT=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function lT(n){if(n.getItem(Yg)==="done")return;const l=[];for(let s=0;s<n.length;s++){const o=n.key(s);if(!o)continue;const c=o.match(rT);if(!c)continue;const[,f,d]=c,x=aT[d];if(!x)continue;const h=n.getItem(o);h!==null&&l.push({oldKey:o,newKey:`vskill-sidebar-${f}-${x}-collapsed`,value:h})}for(const{oldKey:s,newKey:o,value:c}of l)n.getItem(o)===null&&n.setItem(o,c),n.removeItem(s);n.setItem(Yg,"done")}if(typeof PerformanceObserver<"u")try{const n=new PerformanceObserver(l=>{for(const s of l.getEntries())if(s.name==="first-contentful-paint"){window.__vskillPaint=s.startTime,n.disconnect();return}});n.observe({type:"paint",buffered:!0})}catch{}if(typeof window<"u"&&window.localStorage)try{lT(window.localStorage)}catch{}Qb.createRoot(document.getElementById("root")).render(a.jsx(g.StrictMode,{children:a.jsx(vS,{children:a.jsx(a2,{children:a.jsx(tT,{})})})}));export{Ys as E,pv as L,Ks as P,Ce as R,gE as S,Rr as a,Ay as b,mE as c,Vo as d,KN as g,a as j,g as r,J as s,Zd as t,z0 as u,YN as w};