import{_ as F}from"./nbadge-hx8q1ml8.js";import{_ as j}from"./ncode-block.vue-dt6krs6h.js";import{_ as A}from"./ncheckbox.vue-ny9mboxw.js";import{p as L,at as W,au as X,n as Y,s as q,x as E,A as G,_ as K,B as Z,av as z,K as H,X as J,Y as O,aw as Q,as as ee}from"./ebt3cj6n.js";import{p as te,f as V,U as p,W as _,Y as ae,u as s,a8 as $,Z as w,F as B,a3 as o,P as ne,a2 as u,X as g,a9 as c,q as se}from"./vendor/json-editor-vue-kcahofzr.js";const oe={key:0},le={p4:"",flex:"~ col gap-1"},re={class:"text-lg font-medium leading-6"},ue={flex:"~ gap-3",mt2:"","justify-end":""},_e=te({__name:"NpmVersionCheck",props:{packageName:{},options:{},showVersion:{type:Boolean,default:!0}},setup(l){const a=l,t=L(),{info:n,update:i,state:v,processId:y,restart:m}=W(a.packageName,a.options),k=V(!0),N=V(!0),U=X(),x=Y(),D=q();async function C(){const r=await i(async e=>x.start(e));E("npm:update",{packageName:a.packageName,oldVersion:n.value?.current}),r&&N.value&&U.value.push({id:r,message:`${a.packageName} has been updated. Do you want to restart the Nuxt server now?`}),r&&k.value&&(D.value=r,t.push("/modules/terminals"))}return(r,e)=>{const b=F,S=j,h=A,T=G,P=K,I=Z;return p(),_(B,null,[ae(r.$slots,"default",{id:s(y),info:s(n),update:C,state:s(v),restart:s(m)},()=>[s(n)&&r.showVersion?(p(),_("code",oe,$(`v${s(n).current}`),1)):w("",!0),s(n)?.latest?(p(),_(B,{key:1},[s(n).needsUpdate?(p(),_("button",{key:0,onClick:e[0]||(e[0]=f=>C())},[o(b,{n:"green",title:"updates available",textContent:"updates available"})])):(p(),ne(b,{key:1,n:"gray",title:"latest",textContent:"latest"}))],64)):w("",!0)]),o(s(x),null,{default:u(({resolve:f,args:R})=>[o(I,{"model-value":!0,onClose:d=>f(!1)},{default:u(()=>[g("div",le,[g("h3",re," Update "+$(a.packageName)+"? ",1),e[8]||(e[8]=g("p",{op50:""}," The following command will be executed in your terminal: ",-1)),o(S,{code:R[0],lang:"bash",my3:"",px4:"",py2:"",border:"~ base rounded",lines:!1},null,8,["code"]),o(h,{modelValue:k.value,"onUpdate:modelValue":e[1]||(e[1]=d=>k.value=d),n:"primary"},{default:u(()=>e[3]||(e[3]=[c(" Navigate to terminal ")])),_:1},8,["modelValue"]),o(h,{modelValue:N.value,"onUpdate:modelValue":e[2]||(e[2]=d=>N.value=d),n:"primary"},{default:u(()=>e[4]||(e[4]=[c(" Restart Nuxt server after update ")])),_:1},8,["modelValue"]),g("div",ue,[o(T,{n:"sm amber","flex-auto":"",icon:"i-carbon-data-backup"},{default:u(()=>e[5]||(e[5]=[c(" Please make sure to backup your project first. ")])),_:1}),o(P,{onClick:d=>f(!1)},{default:u(()=>e[6]||(e[6]=[c(" Cancel ")])),_:2},1032,["onClick"]),o(P,{n:"solid primary",onClick:d=>f(!0)},{default:u(()=>e[7]||(e[7]=[c(" Update ")])),_:2},1032,["onClick"])])])]),_:2},1032,["onClose"])]),_:1})],64)}}}),M=["pages","meta","components","imports","nuxt-config-schema","@nuxt/devtools","@nuxt/telemetry"];function ie(){return ee("getModulesList",async()=>(await $fetch("https://api.nuxt.com/modules?version=3")).modules.filter(a=>!M.includes(a.npm)&&a.compatibility.nuxt.includes(">=3")))}function ge(){return z("installed-modules",()=>{const l=H(),a=ie();return se(()=>(l.value?._installedModules||[]).map(t=>{if(!t.entryPath)return;const n=!!(t.entryPath&&J(t.entryPath)),i=t.meta?.name?t.meta?.name:t.entryPath?n?O(t.entryPath):l.value?.rootDir?Q(t.entryPath,l.value?.rootDir).path:void 0:void 0,v=!!l.value?.modules?.includes(i),y=a.value?.find(m=>m.npm===i)||a.value?.find(m=>m.name===i);return{name:i,isPackageModule:n,isUninstallable:v,info:y,...t}}).filter(t=>t&&(!t.name||!M.includes(t.name))))})}export{_e as _,ie as a,ge as u};
