import{I as y}from"./iconify-p99pbjf9.js";import{d as T,ah as R,aa as U,g as m,A as p,B as c,C as n,j as i,an as x,_ as u,P as e,ax as w,aw as _,as as B,J as t,O as v,aC as M,r as k,a as b}from"./index-DOFLUERq.js";import{_ as D}from"./_plugin-vue_export-helper-DlAUqK2U.js";const I={class:"package-toolbar"},V={class:"package-resources"},F={class:"summary-stats"},A={key:0,class:"modules-section"},O={class:"item-list"},S={key:1,class:"pagetypes-section"},$={class:"item-list"},E={key:2,class:"releases-section"},G={class:"item-list"},J=T({__name:"package_toolbar",props:{context:{}},setup(a){const l=a,C=R(),d=U(),f=k(!1),g=k(!1),s=k({}),P=()=>{const r=l.context.record.name;C.warning({title:l.context.t("Uninstall Package"),content:l.context.t("Are you sure you want to uninstall this package? This will remove all associated modules and pagetypes. This action cannot be undone."),positiveText:l.context.t("Uninstall"),negativeText:l.context.t("Cancel"),onPositiveClick:async()=>{await N(r)}})},N=async r=>{try{f.value=!0,(await b.post(`/jingrow/uninstall-extension/${r}`,{})).data.success?(d.success(l.context.t("Package '{0}' uninstalled successfully").replace("{0}",r)),l.context.router.push("/app/package")):d.error(l.context.t("Failed to uninstall package"))}catch(o){console.error("Uninstall package error:",o),d.error(o.response?.data?.message||l.context.t("Failed to uninstall package"))}finally{f.value=!1}},j=async()=>{try{const r=l.context.record.name,o=await b.post("/jingrow/get-package-dependencies",{package_name:r});o.data.message.status==="success"?(s.value=o.data.message,g.value=!0):d.error(o.data.message.message)}catch(r){console.error("Get package resources error:",r),d.error(r.response?.data?.message||l.context.t("Failed to get package resources"))}};return(r,o)=>(m(),p("div",I,[c(i(_),null,{default:n(()=>[c(i(x),{type:"error",onClick:P,disabled:a.context.loading,class:"uninstall-btn"},{icon:n(()=>[c(i(w),null,{default:n(()=>[c(i(y),{icon:"tabler:trash"})]),_:1})]),default:n(()=>[u(" "+e(a.context.t("Uninstall Package")),1)]),_:1},8,["disabled"]),c(i(x),{type:"default",onClick:j,disabled:a.context.loading},{icon:n(()=>[c(i(w),null,{default:n(()=>[c(i(y),{icon:"tabler:info-circle"})]),_:1})]),default:n(()=>[u(" "+e(a.context.t("Package Resources")),1)]),_:1},8,["disabled"])]),_:1}),c(i(M),{show:g.value,"onUpdate:show":o[1]||(o[1]=h=>g.value=h)},{default:n(()=>[c(i(B),{style:{width:"500px"},title:a.context.t("Package Resources")},{footer:n(()=>[c(i(_),{justify:"end"},{default:n(()=>[c(i(x),{onClick:o[0]||(o[0]=h=>g.value=!1)},{default:n(()=>[u(e(a.context.t("OK")),1)]),_:1})]),_:1})]),default:n(()=>[t("div",V,[t("h4",null,e(a.context.t("Package"))+": "+e(s.value.package_name),1),t("div",F,[t("p",null,[t("strong",null,e(a.context.t("Modules"))+":",1),u(" "+e(s.value.summary?.modules_count||0),1)]),t("p",null,[t("strong",null,e(a.context.t("PageTypes"))+":",1),u(" "+e(s.value.summary?.pagetypes_count||0),1)]),t("p",null,[t("strong",null,e(a.context.t("Releases"))+":",1),u(" "+e(s.value.summary?.releases_count||0),1)])]),s.value.modules&&s.value.modules.length>0?(m(),p("div",A,[t("h5",null,e(a.context.t("Modules"))+":",1),t("div",O,e(s.value.modules.join(", ")),1)])):v("",!0),s.value.pagetypes&&s.value.pagetypes.length>0?(m(),p("div",S,[t("h5",null,e(a.context.t("PageTypes"))+":",1),t("div",$,e(s.value.pagetypes.join(", ")),1)])):v("",!0),s.value.releases&&s.value.releases.length>0?(m(),p("div",E,[t("h5",null,e(a.context.t("Releases"))+":",1),t("div",G,e(s.value.releases.join(", ")),1)])):v("",!0)])]),_:1},8,["title"])]),_:1},8,["show"])]))}}),H=D(J,[["__scopeId","data-v-e05679a6"]]);export{H as default};
