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