import{r as e}from"./rolldown-runtime-DCMCV6zW.js";import{X as t,lt as n}from"./vendor-primevue-DxVRNMbC.js";import"./vendor-firebase-CdLSXhbt.js";import{A as r,F as i,I as a,It as o,O as s,R as c,S as l,Vt as u,Y as d,et as f,gt as p,j as m,k as h,l as g,nt as _,pt as v}from"./vendor-vue-core-X6q-rGJs.js";import"./vendor-other-CyG3qq8S.js";import"./useFeatureFlags-CxRWjdi1.js";import{Tt as y}from"./api-DQLKc1Xa.js";import"./vendor-markdown-Cola12Wc.js";import"./colorUtil-Cth7eqhK.js";import{n as b}from"./vendor-i18n-B5g6Drzm.js";import"./i18n-DjV_9lZM.js";import"./vendor-reka-ui-CHPbCe4i.js";import{t as x}from"./Button-C7dWyQyS.js";import{i as S}from"./dialogService-Cqui0UMO.js";import"./systemStatsStore-D9aNY5gT.js";import"./useErrorHandling-BFB8eSj5.js";import"./dialogStore-CXD5Bcfy.js";import{t as C}from"./useCopyToClipboard-C74olorb.js";import"./vendor-tiptap-BXSIIPYY.js";import{t as w}from"./envUtil-CcEF5ALS.js";import"./markdownRendererUtil-Bm7Umh6C.js";import"./useExternalLink-Cc30SNi3.js";import{t as T}from"./PanelTemplate-NIaSENoZ.js";import{t as E}from"./FormItem-CM7vaqpa.js";import{t as D}from"./serverConfigStore-CauSPgcD.js";var O={class:`flex flex-col gap-2`},k={class:`flex justify-end gap-2`},A={class:`flex items-center justify-between`},j=c({__name:`ServerConfigPanel`,setup(e){let c=S(),j=D(),M=y(),{serverConfigsByCategory:N,serverConfigValues:P,launchArgs:F,commandLineArgs:I,modifiedConfigs:L}=g(j),R=!1,revertChanges=()=>{j.revertChanges()},restartApp=async()=>{R=!0,await w().restartApp()};v(F,async e=>{await c.set(`Comfy.Server.LaunchArgs`,e)}),v(P,async e=>{await c.set(`Comfy.Server.ServerConfigValues`,e)});let{copyToClipboard:z}=C(),copyCommandLineArgs=async()=>{await z(I.value)},{t:B}=b();d(()=>{R||L.value.length!==0&&M.add({severity:`warn`,summary:B(`serverConfig.restartRequiredToastSummary`),detail:B(`serverConfig.restartRequiredToastDetail`),life:1e4})});let translateItem=e=>({...e,name:B(`serverConfigItems.${e.id}.name`,e.name),tooltip:e.tooltip?B(`serverConfigItems.${e.id}.tooltip`,e.tooltip):void 0});return(e,c)=>(f(),h(T,{value:`Server-Config`,class:`server-config-panel`},{header:p(()=>[s(`div`,O,[o(L).length>0?(f(),h(o(n),{key:0,severity:`info`,"pt:text":`w-full`},{default:p(()=>[s(`p`,null,u(e.$t(`serverConfig.modifiedConfigs`)),1),s(`ul`,null,[(f(!0),m(l,null,_(o(L),e=>(f(),m(`li`,{key:e.id},u(e.name)+`: `+u(e.initialValue)+` → `+u(e.value),1))),128))]),s(`div`,k,[a(x,{variant:`secondary`,onClick:revertChanges},{default:p(()=>[i(u(e.$t(`serverConfig.revertChanges`)),1)]),_:1}),a(x,{variant:`destructive`,onClick:restartApp},{default:p(()=>[i(u(e.$t(`serverConfig.restart`)),1)]),_:1})])]),_:1})):r(``,!0),o(I)?(f(),h(o(n),{key:1,severity:`secondary`,"pt:text":`w-full`},{icon:p(()=>c[0]||=[s(`i`,{class:`icon-[lucide--terminal] text-xl font-bold`},null,-1)]),default:p(()=>[s(`div`,A,[s(`p`,null,u(o(I)),1),a(x,{size:`icon`,variant:`muted-textonly`,onClick:copyCommandLineArgs},{default:p(()=>c[1]||=[s(`i`,{class:`pi pi-clipboard`},null,-1)]),_:1})])]),_:1})):r(``,!0)])]),default:p(()=>[(f(!0),m(l,null,_(Object.entries(o(N)),([n,i],c)=>(f(),m(`div`,{key:n},[c>0?(f(),h(o(t),{key:0})):r(``,!0),s(`h3`,null,u(e.$t(`serverConfigCategories.${n}`,n)),1),(f(!0),m(l,null,_(i,e=>(f(),m(`div`,{key:e.name,class:`mb-4`},[a(E,{id:e.id,"form-value":e.value,"onUpdate:formValue":t=>e.value=t,item:translateItem(e),"label-class":{"text-highlight":e.initialValue!==e.value}},null,8,[`id`,`form-value`,`onUpdate:formValue`,`item`,`label-class`])]))),128))]))),128))]),_:1}))}});export{j as default};
//# sourceMappingURL=ServerConfigPanel-D2ejI1Q0.js.map