import{i as e,n as t}from"./rolldown-runtime-BKYq3fBv.js";import{$n as n,Cr as r,G as i,Gn as a,K as o,Mn as s,Mt as c,Nn as l,Qn as u,Rr as d,Tr as f,Xn as p,Xr as m,Zn as h,_n as g,_t as _,ai as v,ar as y,br as b,er as x,g as S,h as C,ir as w,it as T,jn as E,jt as D,lt as O,rt as k,sr as A,ui as j,ut as M,vn as N,vt as P}from"./vendor-primevue-D50rA9nL.js";import{ot as F,st as I}from"./vendor-other-BnH5nyVX.js";import{n as L,t as R}from"./Button-DzMg17Os.js";import{i as z,n as B,r as V,t as H}from"./PanelTemplate-BUPnglF3.js";import{Ea as U,Ta as W,co as G,so as K}from"./dialogService-Cr3DyAja.js";var q,J,Y,X=t((()=>{l(),s(),_(),D(),O(),g(),i(),C(),k(),F(),U(),B(),L(),K(),V(),q={class:`flex justify-end`},J={class:`mb-3 flex gap-2`},Y=A({__name:`ExtensionPanel`,setup(e){let{t}=I(),i=[`all`,`core`,`custom`],s=p(()=>i.map(e=>({label:t(`g.${e}`),value:e}))),l=m(`all`),g=m([]),_=m({global:{value:``,matchMode:E.CONTAINS}}),C=z(),D=G(),O=m({}),k=p(()=>{let e=C.extensions;switch(l.value){case`core`:return e.filter(e=>C.isCoreExtension(e.name));case`custom`:return e.filter(e=>!C.isCoreExtension(e.name));default:return e}});b(()=>{C.extensions.forEach(e=>{O.value[e.name]=C.isExtensionEnabled(e.name)})});let A=p(()=>C.extensions.filter(e=>O.value[e.name]!==C.isExtensionEnabled(e.name))),F=p(()=>A.value.length>0),updateExtensionStatus=async()=>{let e=Object.entries(O.value).filter(([e,t])=>!t).map(([e])=>e);await D.set(`Comfy.Extension.Disabled`,[...C.inactiveDisabledExtensionNames,...e])},enableAllExtensions=async()=>{C.extensions.forEach(e=>{C.isExtensionReadOnly(e.name)||(O.value[e.name]=!0)}),await updateExtensionStatus()},disableAllExtensions=async()=>{C.extensions.forEach(e=>{C.isExtensionReadOnly(e.name)||(O.value[e.name]=!1)}),await updateExtensionStatus()},disableThirdPartyExtensions=async()=>{C.extensions.forEach(e=>{C.isCoreExtension(e.name)||(O.value[e.name]=!1)}),await updateExtensionStatus()},applyChanges=()=>{window.location.reload()},L=m(),B=p(()=>[{label:t(`g.enableSelected`),icon:`pi pi-check`,command:async()=>{g.value.forEach(e=>{C.isExtensionReadOnly(e.name)||(O.value[e.name]=!0)}),await updateExtensionStatus()}},{label:t(`g.disableSelected`),icon:`pi pi-times`,command:async()=>{g.value.forEach(e=>{C.isExtensionReadOnly(e.name)||(O.value[e.name]=!1)}),await updateExtensionStatus()}},{separator:!0},{label:t(`g.enableAll`),icon:`pi pi-check`,command:enableAllExtensions},{label:t(`g.disableAll`),icon:`pi pi-times`,command:disableAllExtensions},{label:t(`g.disableThirdParty`),icon:`pi pi-times`,command:disableThirdPartyExtensions,disabled:!C.hasThirdPartyExtensions}]);return(e,t)=>(r(),u(H,{value:`Extension`,class:`extension-panel`},{header:d(()=>[y(W,{modelValue:_.value.global.value,"onUpdate:modelValue":t[0]||=e=>_.value.global.value=e,placeholder:e.$t(`g.searchExtensions`)+`...`},null,8,[`modelValue`,`placeholder`]),F.value?(r(),u(v(N),{key:0,severity:`info`,"pt:text":`w-full`,class:`max-h-96 overflow-y-auto`},{default:d(()=>[h(`ul`,null,[(r(!0),x(a,null,f(A.value,e=>(r(),x(`li`,{key:e.name},[h(`span`,null,j(v(C).isExtensionEnabled(e.name)?`[-]`:`[+]`),1),w(` `+j(e.name),1)]))),128))]),h(`div`,q,[y(R,{variant:`destructive`,onClick:applyChanges},{default:d(()=>[w(j(e.$t(`g.reloadToApplyChanges`)),1)]),_:1})])]),_:1})):n(``,!0)]),default:d(()=>[h(`div`,J,[y(v(o),{modelValue:l.value,"onUpdate:modelValue":t[1]||=e=>l.value=e,options:s.value,"option-label":`label`,"option-value":`value`},null,8,[`modelValue`,`options`])]),y(v(M),{selection:g.value,"onUpdate:selection":t[3]||=e=>g.value=e,value:k.value,"striped-rows":``,size:`small`,filters:_.value,"selection-mode":`multiple`,"data-key":`name`},{default:d(()=>[y(v(P),{"selection-mode":`multiple`,frozen:!0,style:{width:`3rem`}}),y(v(P),{header:e.$t(`g.extensionName`),sortable:``,field:`name`},{body:d(t=>[w(j(t.data.name)+` `,1),v(C).isCoreExtension(t.data.name)?(r(),u(v(S),{key:0,value:e.$t(`g.core`)},null,8,[`value`])):(r(),u(v(S),{key:1,value:e.$t(`g.custom`),severity:`info`},null,8,[`value`]))]),_:1},8,[`header`]),y(v(P),{pt:{headerCell:`flex items-center justify-end`,bodyCell:`flex items-center justify-end`}},{header:d(()=>[y(R,{size:`icon`,variant:`muted-textonly`,onClick:t[2]||=e=>L.value?.show(e)},{default:d(()=>t[4]||=[h(`i`,{class:`pi pi-ellipsis-h`},null,-1)]),_:1}),y(v(c),{ref_key:`menu`,ref:L,model:B.value},null,8,[`model`])]),body:d(e=>[y(v(T),{modelValue:O.value[e.data.name],"onUpdate:modelValue":t=>O.value[e.data.name]=t,disabled:v(C).isExtensionReadOnly(e.data.name),onChange:updateExtensionStatus},null,8,[`modelValue`,`onUpdate:modelValue`,`disabled`])]),_:1})]),_:1},8,[`selection`,`value`,`filters`])]),_:1}))}})})),Z;t((()=>{X(),X(),Z=Y}))();export{Z as default};
//# sourceMappingURL=ExtensionPanel-qXgqxjpa.js.map