import{i as e,n as t}from"./rolldown-runtime-BKYq3fBv.js";import{$n as n,Cr as r,Fr as i,Gn as a,Nn as o,Qn as s,Rr as c,Tr as l,Ut as u,Wt as d,Zn as f,_n as p,ai as m,ar as h,er as g,ir as _,sr as v,ui as y,vn as b,vr as x}from"./vendor-primevue-D50rA9nL.js";import{ot as S,st as C}from"./vendor-other-BnH5nyVX.js";import{i as w,r as T}from"./vendor-vue-BAQ5VIVR.js";import{an as E,dn as D,in as O,un as k}from"./api-z_dXWY_S.js";import{n as A,t as j}from"./Button-DzMg17Os.js";import{n as M,t as N}from"./PanelTemplate-BUPnglF3.js";import{Ji as P,a as F,co as I,o as L,qi as R,so as z}from"./dialogService-Cr3DyAja.js";import{n as B,t as V}from"./serverConfigStore-B1vBO2Ta.js";var H,U,W,G,K=t((()=>{o(),T(),u(),p(),S(),L(),M(),A(),R(),z(),O(),V(),D(),H={class:`flex flex-col gap-2`},U={class:`flex justify-end gap-2`},W={class:`flex items-center justify-between`},G=v({__name:`ServerConfigPanel`,setup(e){let t=I(),o=B(),u=E(),{serverConfigsByCategory:p,serverConfigValues:v,launchArgs:S,commandLineArgs:T,modifiedConfigs:D}=w(o),O=!1,revertChanges=()=>{o.revertChanges()},restartApp=async()=>{O=!0,await k().restartApp()};i(S,async e=>{await t.set(`Comfy.Server.LaunchArgs`,e)}),i(v,async e=>{await t.set(`Comfy.Server.ServerConfigValues`,e)});let{copyToClipboard:A}=P(),copyCommandLineArgs=async()=>{await A(T.value)},{t:M}=C();x(()=>{O||D.value.length!==0&&u.add({severity:`warn`,summary:M(`serverConfig.restartRequiredToastSummary`),detail:M(`serverConfig.restartRequiredToastDetail`),life:1e4})});let translateItem=e=>({...e,name:M(`serverConfigItems.${e.id}.name`,e.name),tooltip:e.tooltip?M(`serverConfigItems.${e.id}.tooltip`,e.tooltip):void 0});return(e,t)=>(r(),s(N,{value:`Server-Config`,class:`server-config-panel`},{header:c(()=>[f(`div`,H,[m(D).length>0?(r(),s(m(b),{key:0,severity:`info`,"pt:text":`w-full`},{default:c(()=>[f(`p`,null,y(e.$t(`serverConfig.modifiedConfigs`)),1),f(`ul`,null,[(r(!0),g(a,null,l(m(D),e=>(r(),g(`li`,{key:e.id},y(e.name)+`: `+y(e.initialValue)+` → `+y(e.value),1))),128))]),f(`div`,U,[h(j,{variant:`secondary`,onClick:revertChanges},{default:c(()=>[_(y(e.$t(`serverConfig.revertChanges`)),1)]),_:1}),h(j,{variant:`destructive`,onClick:restartApp},{default:c(()=>[_(y(e.$t(`serverConfig.restart`)),1)]),_:1})])]),_:1})):n(``,!0),m(T)?(r(),s(m(b),{key:1,severity:`secondary`,"pt:text":`w-full`},{icon:c(()=>t[0]||=[f(`i`,{class:`icon-[lucide--terminal] text-xl font-bold`},null,-1)]),default:c(()=>[f(`div`,W,[f(`p`,null,y(m(T)),1),h(j,{size:`icon`,variant:`muted-textonly`,onClick:copyCommandLineArgs},{default:c(()=>t[1]||=[f(`i`,{class:`pi pi-clipboard`},null,-1)]),_:1})])]),_:1})):n(``,!0)])]),default:c(()=>[(r(!0),g(a,null,l(Object.entries(m(p)),([t,i],o)=>(r(),g(`div`,{key:t},[o>0?(r(),s(m(d),{key:0})):n(``,!0),f(`h3`,null,y(e.$t(`serverConfigCategories.${t}`,t)),1),(r(!0),g(a,null,l(i,e=>(r(),g(`div`,{key:e.name,class:`mb-4`},[h(F,{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}))}})})),q;t((()=>{K(),K(),q=G}))();export{q as default};
//# sourceMappingURL=ServerConfigPanel-DSmzmu8z.js.map