import{o as e}from"./rolldown-runtime-C_s2cVnS.js";import{a as t,r as n,yt as r}from"./i18n-CsN8OUP9.js";import{t as i}from"./profile-DkxWhVLn.js";import{h as a,m as o,n as s}from"./vendor-react-nmZsNlRz.js";import{a as c}from"./notifications-DLwVuo9_.js";import{t as l}from"./confirm-dialog-BMpZ5fjr.js";var u=s(),d=e(o(),1),f="The skill is archived and can be restored with `hermes curator restore`.";function p(e){c({kind:`success`,message:e.skills.skillArchivedMessage,title:e.skills.skillArchivedTitle})}async function m(e,t){let n=await r(e,t);if(!n.ok)throw Error(n.message||`Archive failed`)}function h(e,t,n){e.catch(e=>{t(),n(e)})}function g(e){let n=(0,u.c)(13),{onApply:r,onClose:i,onFailure:a,onSuccess:o,open:s,profile:c,skillId:g,skillName:_}=e,{t:v}=t(),y;n[0]!==r||n[1]!==a||n[2]!==o||n[3]!==c||n[4]!==g||n[5]!==_||n[6]!==v?(y=()=>{let e=r();h(m(g,c).then(()=>{p(v),o?.()}),e,e=>a?.(e,_))},n[0]=r,n[1]=a,n[2]=o,n[3]=c,n[4]=g,n[5]=_,n[6]=v,n[7]=y):y=n[7];let b=`Archive ${_}?`,x;return n[8]!==i||n[9]!==s||n[10]!==y||n[11]!==b?(x=(0,d.jsx)(l,{confirmLabel:`Archive`,description:f,destructive:!0,dismissOnConfirm:!0,onClose:i,onConfirm:y,open:s,title:b}),n[8]=i,n[9]=s,n[10]=y,n[11]=b,n[12]=x):x=n[12],x}var _=e(a(),1);function v(e){let t=n(i),r=(0,_.useRef)(!0);(0,_.useEffect)(()=>{if(r.current){r.current=!1;return}e()},[t])}export{g as n,h as r,v as t};