import"./rolldown-runtime-DIIn1E2Q.js";import{A as e,E as t,R as n,U as r,V as i,Z as a,ht as o,st as s}from"./vendor-primevue-CSt9JbQD.js";import"./vendor-firebase-D7u00oy9.js";import{A as c,D as l,F as u,I as d,O as f,R as p,Rt as m,S as h,Ut as g,Z as _,_t as v,et as y,j as b,k as x,kt as S,nt as C}from"./vendor-vue-core-DO0afONr.js";import"./vendor-other-Bo3xiN_p.js";import"./useFeatureFlags-Bq93lbLe.js";import"./api-Bzi--8-2.js";import"./vendor-markdown-Da9QPS2x.js";import"./colorUtil-Bc1n5Dsf.js";import{n as w}from"./vendor-i18n-JbyM4Qz7.js";import"./i18n-xfNY32Ho.js";import"./vendor-reka-ui-D1HCh14_.js";import{t as T}from"./Button-DcKkUh7N.js";import{Yi as E,i as D}from"./dialogService-B4eN_yjE.js";import{t as O}from"./extensionStore-BKzl_b6L.js";import"./userStore-COx1oLYZ.js";import"./useErrorHandling-BvGYTWYe.js";import"./useExternalLink-Dz8tO2Wt.js";import"./vendor-tiptap-DU4sLNDM.js";import"./markdownRendererUtil-BmSNgBXi.js";import"./Popover-DBaEFrTX.js";var k={class:`extension-panel flex flex-col gap-2`},A={class:`flex justify-end`},j={class:`mb-3 flex gap-2`},M=p({__name:`ExtensionPanel`,setup(p){let{t:M}=w(),N=[`all`,`core`,`custom`],P=l(()=>N.map(e=>({label:M(`g.${e}`),value:e}))),F=S(`all`),I=S([]),L=S({global:{value:``,matchMode:o.CONTAINS}}),R=O(),z=D(),B=S({}),V=l(()=>{let e=R.extensions;switch(F.value){case`core`:return e.filter(e=>R.isCoreExtension(e.name));case`custom`:return e.filter(e=>!R.isCoreExtension(e.name));default:return e}});_(()=>{R.extensions.forEach(e=>{B.value[e.name]=R.isExtensionEnabled(e.name)})});let H=l(()=>R.extensions.filter(e=>B.value[e.name]!==R.isExtensionEnabled(e.name))),U=l(()=>H.value.length>0),updateExtensionStatus=async()=>{let e=Object.entries(B.value).filter(([e,t])=>!t).map(([e])=>e);await z.set(`Comfy.Extension.Disabled`,[...R.inactiveDisabledExtensionNames,...e])},enableAllExtensions=async()=>{R.extensions.forEach(e=>{R.isExtensionReadOnly(e.name)||(B.value[e.name]=!0)}),await updateExtensionStatus()},disableAllExtensions=async()=>{R.extensions.forEach(e=>{R.isExtensionReadOnly(e.name)||(B.value[e.name]=!1)}),await updateExtensionStatus()},disableThirdPartyExtensions=async()=>{R.extensions.forEach(e=>{R.isCoreExtension(e.name)||(B.value[e.name]=!1)}),await updateExtensionStatus()},applyChanges=()=>{window.location.reload()},W=S(),G=l(()=>[{label:M(`g.enableSelected`),icon:`pi pi-check`,command:async()=>{I.value.forEach(e=>{R.isExtensionReadOnly(e.name)||(B.value[e.name]=!0)}),await updateExtensionStatus()}},{label:M(`g.disableSelected`),icon:`pi pi-times`,command:async()=>{I.value.forEach(e=>{R.isExtensionReadOnly(e.name)||(B.value[e.name]=!1)}),await updateExtensionStatus()}},{separator:!0},{label:M(`g.enableAll`),icon:`pi pi-check`,command:enableAllExtensions},{label:M(`g.disableAll`),icon:`pi pi-times`,command:disableAllExtensions},{label:M(`g.disableThirdParty`),icon:`pi pi-times`,command:disableThirdPartyExtensions,disabled:!R.hasThirdPartyExtensions}]);return(o,l)=>(y(),b(`div`,k,[d(E,{modelValue:L.value.global.value,"onUpdate:modelValue":l[0]||=e=>L.value.global.value=e,placeholder:o.$t(`g.searchPlaceholder`,{subject:o.$t(`g.extensions`)})},null,8,[`modelValue`,`placeholder`]),U.value?(y(),x(m(s),{key:0,severity:`info`,"pt:text":`w-full`,class:`max-h-96 overflow-y-auto`},{default:v(()=>[f(`ul`,null,[(y(!0),b(h,null,C(H.value,e=>(y(),b(`li`,{key:e.name},[f(`span`,null,g(m(R).isExtensionEnabled(e.name)?`[-]`:`[+]`),1),u(` `+g(e.name),1)]))),128))]),f(`div`,A,[d(T,{variant:`destructive`,onClick:applyChanges},{default:v(()=>[u(g(o.$t(`g.reloadToApplyChanges`)),1)]),_:1})])]),_:1})):c(``,!0),f(`div`,j,[d(m(i),{modelValue:F.value,"onUpdate:modelValue":l[1]||=e=>F.value=e,options:P.value,"option-label":`label`,"option-value":`value`},null,8,[`modelValue`,`options`])]),d(m(t),{selection:I.value,"onUpdate:selection":l[3]||=e=>I.value=e,value:V.value,"striped-rows":``,size:`small`,filters:L.value,"selection-mode":`multiple`,"data-key":`name`},{default:v(()=>[d(m(e),{"selection-mode":`multiple`,frozen:!0,style:{width:`3rem`}}),d(m(e),{header:o.$t(`g.extensionName`),sortable:``,field:`name`},{body:v(e=>[u(g(e.data.name)+` `,1),m(R).isCoreExtension(e.data.name)?(y(),x(m(n),{key:0,value:o.$t(`g.core`)},null,8,[`value`])):(y(),x(m(n),{key:1,value:o.$t(`g.custom`),severity:`info`},null,8,[`value`]))]),_:1},8,[`header`]),d(m(e),{pt:{headerCell:`flex items-center justify-end`,bodyCell:`flex items-center justify-end`}},{header:v(()=>[d(T,{size:`icon`,variant:`muted-textonly`,onClick:l[2]||=e=>W.value?.show(e)},{default:v(()=>l[4]||=[f(`i`,{class:`pi pi-ellipsis-h`},null,-1)]),_:1}),d(m(r),{ref_key:`menu`,ref:W,model:G.value},null,8,[`model`])]),body:v(e=>[d(m(a),{modelValue:B.value[e.data.name],"onUpdate:modelValue":t=>B.value[e.data.name]=t,disabled:m(R).isExtensionReadOnly(e.data.name),onChange:updateExtensionStatus},null,8,[`modelValue`,`onUpdate:modelValue`,`disabled`])]),_:1})]),_:1},8,[`selection`,`value`,`filters`])]))}});export{M as default};
//# sourceMappingURL=ExtensionPanel-OsuXepzg.js.map