import"./DsnmJJEf.js";import{o as ie}from"./vrwecVo1.js";import{p as ne,f as le,a as x,b as de,j as s,g as e,c as A,h as g,k as S,s as i,d as t,r,t as y}from"./Dyk1ealw.js";import{d as pe,s as c,a as z}from"./DEEYSJdk.js";import{i as h}from"./cYAxD0tk.js";import{g as ve}from"./BO15n2H3.js";import{f as ue,h as ce}from"./BpXDH4nZ.js";import{M as me,f as ge}from"./B7RJIoXj.js";import{c as fe}from"./DfqTMdwm.js";import{d as _e}from"./DgXO3YQ1.js";import{a as be,i as v}from"./CVq-Ik9t.js";import{D as xe}from"./BG_D_W2D.js";import{a as Y}from"./g3Sy0QlV.js";import{F as he}from"./CeyUrHoy.js";import{t as M}from"./CDBVw774.js";import{L as Ae}from"./BkBShXgg.js";var Ee=A('<button type="button" class="inline-flex h-8 items-center gap-1.5 rounded-md bg-purple-600 px-3 text-[0.75rem] font-semibold text-white shadow-sm transition-colors hover:bg-purple-700 disabled:opacity-60 dark:bg-purple-500 dark:hover:bg-purple-600"><!> </button>'),Ge=A('<div class="relative mt-2 text-[0.6875rem] italic text-muted-foreground"> </div>'),Te=A('<div class="px-4 pt-3"><div class="relative overflow-hidden rounded-lg border border-purple-500/30 bg-gradient-to-br from-purple-500/10 via-purple-500/5 to-transparent p-3 shadow-sm"><div class="absolute -right-4 -top-4 h-20 w-20 rounded-full bg-purple-500/10 blur-2xl"></div> <div class="relative flex flex-wrap items-center gap-x-4 gap-y-2"><div class="min-w-0 flex-1"><div class="flex items-center gap-2 text-[0.8125rem] font-semibold text-purple-600 dark:text-purple-400"><!> </div> <div class="mt-1 flex items-center gap-1.5 text-[0.75rem] text-muted-foreground"><span class="tabular-nums"> </span> <!> <span class="font-semibold tabular-nums text-purple-600 dark:text-purple-400"> </span></div></div> <div class="flex flex-wrap items-center gap-2"><!> <button type="button" class="inline-flex h-8 items-center gap-1.5 rounded-md border border-purple-500/30 px-3 text-[0.75rem] font-medium text-purple-600 transition-colors hover:bg-purple-500/10 dark:text-purple-400"><!> </button></div></div> <!></div></div>'),we=A("<!> <!>",1);function We(O,k){ne(k,!0);const B=S(()=>fe("gpm"));let n=g(null),f=g(!1),E=g(!1),_=g(""),G=g(!1);async function T(){try{const a=await ve();s(n,a.grav,!0)}catch{s(n,null)}}async function F(){const a=e(n)?.available??"";if(!await _e.confirm({title:"Upgrade Grav core?",message:`This will upgrade Grav from v${e(n)?.current??""} to v${a}. The site may be briefly unavailable during the upgrade.`,confirmLabel:v.t("ADMIN_NEXT.SYSTEM_HEALTH_WIDGET.UPGRADE_GRAV")}))return;s(f,!0);const m=M.loading(`Upgrading Grav to v${a}…`);try{const l=await ce();M.success(v.t("ADMIN_NEXT.TOASTS.GRAV_UPGRADED",{version:l.new_version}),{id:m}),await T(),k.onUpgraded?.()}catch(l){M.error(`Grav upgrade failed: ${l instanceof Error?l.message:String(l)}`,{id:m})}finally{s(f,!1)}}async function j(){s(G,!0),s(_,""),s(E,!0);try{s(_,ge(await ue()),!0)}catch{s(_,"*Changelog not available.*")}finally{s(G,!1)}}ie(()=>{T();const a=be.subscribe("gpm:*",()=>T());return()=>{a()}});var U=we(),H=le(U);{var K=a=>{var u=Te(),m=t(u),l=i(t(m),2),w=t(l),D=t(w),R=t(D);Y(R,{size:14});var J=i(R);r(D);var C=i(D,2),I=t(C),Q=t(I);r(I);var P=i(I,2);xe(P,{name:"arrow-forward",size:11,class:"text-purple-500"});var V=i(P,2),Z=t(V);r(V),r(C),r(w);var X=i(w,2),$=t(X);{var ee=d=>{var o=Ee(),b=t(o);{var L=p=>{Ae(p,{size:12,class:"animate-spin"})},oe=p=>{Y(p,{size:12})};h(b,p=>{e(f)?p(L):p(oe,-1)})}var se=i(b);r(o),y(p=>{o.disabled=e(f),c(se,` ${p??""}`)},[()=>v.t("ADMIN_NEXT.SYSTEM_HEALTH_WIDGET.UPGRADE_GRAV")]),z("click",o,F),x(d,o)};h($,d=>{e(n).is_symlink||d(ee)})}var N=i($,2),W=t(N);he(W,{size:12});var ae=i(W);r(N),r(X),r(l);var te=i(l,2);{var re=d=>{var o=Ge(),b=t(o,!0);r(o),y(L=>c(b,L),[()=>v.t("ADMIN_NEXT.SYSTEM_HEALTH_WIDGET.GRAV_IS_INSTALLED_VIA_SYMLINK_UPGRADE")]),x(d,o)};h(te,d=>{e(n).is_symlink&&d(re)})}r(m),r(u),y((d,o)=>{c(J,` ${d??""}`),c(Q,`v${e(n).current??""}`),c(Z,`v${e(n).available??""}`),c(ae,` ${o??""}`)},[()=>v.t("ADMIN_NEXT.SYSTEM_HEALTH_WIDGET.GRAV_UPDATE_AVAILABLE"),()=>v.t("ADMIN_NEXT.PLUGINS.CHANGELOG")]),z("click",N,j),x(a,u)};h(H,a=>{e(B)&&e(n)?.updatable&&a(K)})}var q=i(H,2);{let a=S(()=>v.t("ADMIN_NEXT.PLUGINS.CHANGELOG")),u=S(()=>e(G)?"Loading...":e(_));me(q,{get open(){return e(E)},get title(){return e(a)},get content(){return e(u)},onclose:()=>{s(E,!1)}})}x(O,U),de()}pe(["click"]);export{We as G};
