import{i as e,n as t}from"./rolldown-runtime-ConPGZeh.js";import{$n as n,G as r,Gn as i,K as a,Lr as o,Mn as s,Mt as c,Nn as l,Qn as u,Sr as d,Xn as f,Yr as p,Zn as m,_n as h,_t as g,er as _,g as v,h as y,ii as b,ir as x,it as S,jn as C,jt as w,li as T,lt as E,or as D,rr as O,rt as k,ut as A,vn as j,vt as M,wr as N,yr as P}from"./vendor-primevue-D1-E3-0M.js";import{at as F,it as I}from"./vendor-other-CT05lTmi.js";import{n as L,t as R}from"./Button-DXEyozJJ.js";import{i as z,n as B,r as V,t as H}from"./PanelTemplate-CURL0L1Z.js";import{Ja as U,ba as W,qa as G,xa as K}from"./dialogService-DIdX_hbW.js";var q,J,Y,X=t((()=>{l(),s(),g(),w(),E(),h(),r(),y(),k(),I(),K(),B(),L(),G(),V(),q={class:`flex justify-end`},J={class:`mb-3 flex gap-2`},Y=D({__name:`ExtensionPanel`,setup(e){let{t}=F(),r=[`all`,`core`,`custom`],s=f(()=>r.map(e=>({label:t(`g.${e}`),value:e}))),l=p(`all`),h=p([]),g=p({global:{value:``,matchMode:C.CONTAINS}}),y=z(),w=U(),E=p({}),D=f(()=>{let e=y.extensions;switch(l.value){case`core`:return e.filter(e=>y.isCoreExtension(e.name));case`custom`:return e.filter(e=>!y.isCoreExtension(e.name));default:return e}});P(()=>{y.extensions.forEach(e=>{E.value[e.name]=y.isExtensionEnabled(e.name)})});let k=f(()=>y.extensions.filter(e=>E.value[e.name]!==y.isExtensionEnabled(e.name))),I=f(()=>k.value.length>0),updateExtensionStatus=async()=>{let e=Object.entries(E.value).filter(([e,t])=>!t).map(([e])=>e);await w.set(`Comfy.Extension.Disabled`,[...y.inactiveDisabledExtensionNames,...e])},enableAllExtensions=async()=>{y.extensions.forEach(e=>{y.isExtensionReadOnly(e.name)||(E.value[e.name]=!0)}),await updateExtensionStatus()},disableAllExtensions=async()=>{y.extensions.forEach(e=>{y.isExtensionReadOnly(e.name)||(E.value[e.name]=!1)}),await updateExtensionStatus()},disableThirdPartyExtensions=async()=>{y.extensions.forEach(e=>{y.isCoreExtension(e.name)||(E.value[e.name]=!1)}),await updateExtensionStatus()},applyChanges=()=>{window.location.reload()},L=p(),B=f(()=>[{label:t(`g.enableSelected`),icon:`pi pi-check`,command:async()=>{h.value.forEach(e=>{y.isExtensionReadOnly(e.name)||(E.value[e.name]=!0)}),await updateExtensionStatus()}},{label:t(`g.disableSelected`),icon:`pi pi-times`,command:async()=>{h.value.forEach(e=>{y.isExtensionReadOnly(e.name)||(E.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:!y.hasThirdPartyExtensions}]);return(e,t)=>(d(),u(H,{value:`Extension`,class:`extension-panel`},{header:o(()=>[x(W,{modelValue:g.value.global.value,"onUpdate:modelValue":t[0]||=e=>g.value.global.value=e,placeholder:e.$t(`g.searchExtensions`)+`...`},null,8,[`modelValue`,`placeholder`]),I.value?(d(),u(b(j),{key:0,severity:`info`,"pt:text":`w-full`,class:`max-h-96 overflow-y-auto`},{default:o(()=>[m(`ul`,null,[(d(!0),_(i,null,N(k.value,e=>(d(),_(`li`,{key:e.name},[m(`span`,null,T(b(y).isExtensionEnabled(e.name)?`[-]`:`[+]`),1),O(` `+T(e.name),1)]))),128))]),m(`div`,q,[x(R,{variant:`destructive`,onClick:applyChanges},{default:o(()=>[O(T(e.$t(`g.reloadToApplyChanges`)),1)]),_:1})])]),_:1})):n(``,!0)]),default:o(()=>[m(`div`,J,[x(b(a),{modelValue:l.value,"onUpdate:modelValue":t[1]||=e=>l.value=e,options:s.value,"option-label":`label`,"option-value":`value`},null,8,[`modelValue`,`options`])]),x(b(A),{selection:h.value,"onUpdate:selection":t[3]||=e=>h.value=e,value:D.value,"striped-rows":``,size:`small`,filters:g.value,"selection-mode":`multiple`,"data-key":`name`},{default:o(()=>[x(b(M),{"selection-mode":`multiple`,frozen:!0,style:{width:`3rem`}}),x(b(M),{header:e.$t(`g.extensionName`),sortable:``,field:`name`},{body:o(t=>[O(T(t.data.name)+` `,1),b(y).isCoreExtension(t.data.name)?(d(),u(b(v),{key:0,value:e.$t(`g.core`)},null,8,[`value`])):(d(),u(b(v),{key:1,value:e.$t(`g.custom`),severity:`info`},null,8,[`value`]))]),_:1},8,[`header`]),x(b(M),{pt:{headerCell:`flex items-center justify-end`,bodyCell:`flex items-center justify-end`}},{header:o(()=>[x(R,{size:`icon`,variant:`muted-textonly`,onClick:t[2]||=e=>L.value?.show(e)},{default:o(()=>t[4]||=[m(`i`,{class:`pi pi-ellipsis-h`},null,-1)]),_:1}),x(b(c),{ref_key:`menu`,ref:L,model:B.value},null,8,[`model`])]),body:o(e=>[x(b(S),{modelValue:E.value[e.data.name],"onUpdate:modelValue":t=>E.value[e.data.name]=t,disabled:b(y).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-CvhB3lYD.js.map