var D=Object.defineProperty;var i=(C,u)=>D(C,"name",{value:u,configurable:!0});import{v as F,ad as I,ae as h,w as $,L,o as q,s as K,af as P}from"./vendor-primevue-B6rcS73U.js";import{u as Z}from"./vendor-vue-CXt3ZZQ3.js";import{Z as G,e as H,_ as k,S as J,dp as Q}from"./index-2-qFLlQP.js";import{bx as W,E as c,r as p,o as X,j as y,d as m,k as r,e as f,z as o,by as l,A as g,u as E,q as Y,c as S,F as ee,y as ae}from"./vendor-other-CSX7WseZ.js";import"./vendor-xterm-CWYFmgbN.js";import"./vendor-three-BKWXAgVe.js";import"./vendor-tiptap-BkFTmTb3.js";const ne={class:"flex justify-end"},se={class:"mb-3 flex gap-2"},ce=W({__name:"ExtensionPanel",setup(C){const{t:u}=Z(),_=["all","core","custom"],N=c(()=>_.map(e=>({label:u(`g.${e}`),value:e}))),x=p("all"),v=p([]),b=p({global:{value:"",matchMode:P.CONTAINS}}),a=G(),T=H(),t=p({}),A=c(()=>{const e=a.extensions;switch(x.value){case"core":return e.filter(s=>a.isCoreExtension(s.name));case"custom":return e.filter(s=>!a.isCoreExtension(s.name));default:return e}});X(()=>{a.extensions.forEach(e=>{t.value[e.name]=a.isExtensionEnabled(e.name)})});const w=c(()=>a.extensions.filter(e=>t.value[e.name]!==a.isExtensionEnabled(e.name))),O=c(()=>w.value.length>0),d=i(async()=>{const e=Object.entries(t.value).filter(([s,n])=>!n).map(([s])=>s);await T.set("Comfy.Extension.Disabled",[...a.inactiveDisabledExtensionNames,...e])},"updateExtensionStatus"),j=i(async()=>{a.extensions.forEach(e=>{a.isExtensionReadOnly(e.name)||(t.value[e.name]=!0)}),await d()},"enableAllExtensions"),B=i(async()=>{a.extensions.forEach(e=>{a.isExtensionReadOnly(e.name)||(t.value[e.name]=!1)}),await d()},"disableAllExtensions"),M=i(async()=>{a.extensions.forEach(e=>{a.isCoreExtension(e.name)||(t.value[e.name]=!1)}),await d()},"disableThirdPartyExtensions"),R=i(()=>{window.location.reload()},"applyChanges"),V=p(),U=c(()=>[{label:u("g.enableSelected"),icon:"pi pi-check",command:i(async()=>{v.value.forEach(e=>{a.isExtensionReadOnly(e.name)||(t.value[e.name]=!0)}),await d()},"command")},{label:u("g.disableSelected"),icon:"pi pi-times",command:i(async()=>{v.value.forEach(e=>{a.isExtensionReadOnly(e.name)||(t.value[e.name]=!1)}),await d()},"command")},{separator:!0},{label:u("g.enableAll"),icon:"pi pi-check",command:j},{label:u("g.disableAll"),icon:"pi pi-times",command:B},{label:u("g.disableThirdParty"),icon:"pi pi-times",command:M,disabled:!a.hasThirdPartyExtensions}]);return(e,s)=>(m(),y(Q,{value:"Extension",class:"extension-panel"},{header:r(()=>[o(J,{modelValue:b.value.global.value,"onUpdate:modelValue":s[0]||(s[0]=n=>b.value.global.value=n),placeholder:e.$t("g.searchExtensions")+"..."},null,8,["modelValue","placeholder"]),O.value?(m(),y(l(K),{key:0,severity:"info","pt:text":"w-full",class:"max-h-96 overflow-y-auto"},{default:r(()=>[f("ul",null,[(m(!0),S(ee,null,ae(w.value,n=>(m(),S("li",{key:n.name},[f("span",null,E(l(a).isExtensionEnabled(n.name)?"[-]":"[+]"),1),g(" "+E(n.name),1)]))),128))]),f("div",ne,[o(k,{variant:"destructive",onClick:R},{default:r(()=>[g(E(e.$t("g.reloadToApplyChanges")),1)]),_:1})])]),_:1})):Y("",!0)]),default:r(()=>[f("div",se,[o(l(F),{modelValue:x.value,"onUpdate:modelValue":s[1]||(s[1]=n=>x.value=n),options:N.value,"option-label":"label","option-value":"value"},null,8,["modelValue","options"])]),o(l(I),{selection:v.value,"onUpdate:selection":s[3]||(s[3]=n=>v.value=n),value:A.value,"striped-rows":"",size:"small",filters:b.value,"selection-mode":"multiple","data-key":"name"},{default:r(()=>[o(l(h),{"selection-mode":"multiple",frozen:!0,style:{width:"3rem"}}),o(l(h),{header:e.$t("g.extensionName"),sortable:"",field:"name"},{body:r(n=>[g(E(n.data.name)+" ",1),l(a).isCoreExtension(n.data.name)?(m(),y(l($),{key:0,value:e.$t("g.core")},null,8,["value"])):(m(),y(l($),{key:1,value:e.$t("g.custom"),severity:"info"},null,8,["value"]))]),_:1},8,["header"]),o(l(h),{pt:{headerCell:"flex items-center justify-end",bodyCell:"flex items-center justify-end"}},{header:r(()=>[o(k,{size:"icon",variant:"muted-textonly",onClick:s[2]||(s[2]=n=>V.value?.show(n))},{default:r(()=>s[4]||(s[4]=[f("i",{class:"pi pi-ellipsis-h"},null,-1)])),_:1}),o(l(q),{ref_key:"menu",ref:V,model:U.value},null,8,["model"])]),body:r(n=>[o(l(L),{modelValue:t.value[n.data.name],"onUpdate:modelValue":i(z=>t.value[n.data.name]=z,"onUpdate:modelValue"),disabled:l(a).isExtensionReadOnly(n.data.name),onChange:d},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:1})]),_:1},8,["selection","value","filters"])]),_:1}))}});export{ce as default};
//# sourceMappingURL=ExtensionPanel-DYw7d35v.js.map
