import{_ as F}from"./nbadge-dq7969id.js";import{_ as W}from"./ncode-block.vue-fq4nv817.js";import{_ as j}from"./ncheckbox.vue-hmuefhp8.js";import{m as L,as as A,at as E,k as G,o as Q,s as X,x as q,f as z,y as H,au as J,I as K,W as O,X as Y,av as Z,ar as ee}from"./kul02k0k.js";import{k as te,b as P,Q as p,S as v,V as ae,u as n,a5 as $,W as w,F as M,a0 as o,M as se,$ as u,U as _,a6 as c,l as ne}from"./vendor/json-editor-vue-kmaz80fw.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":""},ve=te({__name:"NpmVersionCheck",props:{packageName:{},options:{},showVersion:{type:Boolean,default:!0}},setup(l){const a=l,t=L(),{info:s,update:i,state:g,processId:y,restart:m}=A(a.packageName,a.options),k=P(!0),N=P(!0),U=E(),x=G(),D=Q();async function C(){const r=await i(async e=>x.start(e));X("npm:update",{packageName:a.packageName,oldVersion:s.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=W,h=j,I=q,V=z,T=H;return p(),v(M,null,[ae(r.$slots,"default",{id:n(y),info:n(s),update:C,state:n(g),restart:n(m)},()=>[n(s)&&r.showVersion?(p(),v("code",oe,$(`v${n(s).current}`),1)):w("",!0),n(s)?.latest?(p(),v(M,{key:1},[n(s).needsUpdate?(p(),v("button",{key:0,onClick:e[0]||(e[0]=f=>C())},[o(b,{n:"green",title:"updates available",textContent:"updates available"})])):(p(),se(b,{key:1,n:"gray",title:"latest",textContent:"latest"}))],64)):w("",!0)]),o(n(x),null,{default:u(({resolve:f,args:R})=>[o(T,{"model-value":!0,onClose:d=>f(!1)},{default:u(()=>[_("div",le,[_("h3",re," Update "+$(a.packageName)+"? ",1),e[8]||(e[8]=_("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"]),_("div",ue,[o(I,{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(V,{onClick:d=>f(!1)},{default:u(()=>e[6]||(e[6]=[c(" Cancel ")])),_:2},1032,["onClick"]),o(V,{n:"solid primary",onClick:d=>f(!0)},{default:u(()=>e[7]||(e[7]=[c(" Update ")])),_:2},1032,["onClick"])])])]),_:2},1032,["onClose"])]),_:1})],64)}}}),B=["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=>!B.includes(a.npm)&&a.compatibility.nuxt.includes(">=3")))}function _e(){return J("installed-modules",()=>{const l=K(),a=ie();return ne(()=>(l.value?._installedModules||[]).map(t=>{if(!t.entryPath)return;const s=!!(t.entryPath&&O(t.entryPath)),i=t.meta?.name?t.meta?.name:t.entryPath?s?Y(t.entryPath):l.value?.rootDir?Z(t.entryPath,l.value?.rootDir).path:void 0:void 0,g=!!l.value?.modules?.includes(i),y=a.value?.find(m=>m.npm===i)||a.value?.find(m=>m.name===i);return{name:i,isPackageModule:s,isUninstallable:g,info:y,...t}}).filter(t=>t&&(!t.name||!B.includes(t.name))))})}export{ve as _,ie as a,_e as u};
