import"./DsnmJJEf.js";import{o as ie}from"./D9fbApi8.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"./qex-fw8l.js";import{d as pe,s as c,a as z}from"./vzbhwc8t.js";import{i as h}from"./BnUrxEZg.js";import{g as ve}from"./CYp6jSq7.js";import{g as ue,u as ce}from"./CFsq82PF.js";import{M as me,f as ge}from"./OooFuQxA.js";import{c as fe}from"./pW8WuSdk.js";import{d as _e}from"./DvTzB33f.js";import{a as be,i as v}from"./dc0o8kHW.js";import{D as xe}from"./DugRw7A1.js";import{C as Y}from"./DhUXsTAu.js";import{F as he}from"./CMWooxU3.js";import{t as M}from"./HL7kq492.js";import{L as Ae}from"./BnIIe8z2.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),C=t(D);Y(C,{size:14});var J=i(C);r(D);var R=i(D,2),I=t(R),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(R),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};
