import{r as e}from"./rolldown-runtime-DIIn1E2Q.js";import{$ as t,ct as n}from"./vendor-primevue-DOcVZxnt.js";import"./vendor-firebase-yTFzdAQf.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-CvBSzfTV.js";import"./vendor-other-ZVm7XS8K.js";import"./useFeatureFlags-CMK9o9Rw.js";import{Et as y}from"./api-OgmjiUkn.js";import"./colorUtil-C9tyO6rZ.js";import{n as b}from"./vendor-i18n-B2MApQxA.js";import"./i18n-S80A-Sy1.js";import"./vendor-reka-ui-EFkcZtPy.js";import{t as x}from"./Button-C-kbn1lh.js";import{Bn as S,a as C}from"./dialogService-Dp405gae.js";import"./systemStatsStore-BAnEcJS2.js";import"./useErrorHandling-DfKSzlg9.js";import"./dialogStore-BDXSs8Ic.js";import"./userStore-C5cqCkur.js";import{t as w}from"./useCopyToClipboard-_eFTtqIy.js";import"./vendor-tiptap-BZCaYoPl.js";import{t as T}from"./envUtil-gQ8GyeM3.js";import"./vendor-markdown-Gcn_JH9N.js";import"./markdownRendererUtil-BD0lrBqH.js";import"./useExternalLink-CZSEXO8Q.js";import{t as E}from"./serverConfigStore-Bq4sKxue.js";var D={class:`server-config-panel flex flex-col gap-2`},O={class:`flex justify-end gap-2`},k={class:`flex items-center justify-between`},A=c({__name:`ServerConfigPanel`,setup(e){let c=C(),A=E(),j=y(),{serverConfigsByCategory:M,serverConfigValues:N,launchArgs:P,commandLineArgs:F,modifiedConfigs:I}=g(A),L=!1,revertChanges=()=>{A.revertChanges()},restartApp=async()=>{L=!0,await T().restartApp()};v(P,async e=>{await c.set(`Comfy.Server.LaunchArgs`,e)}),v(N,async e=>{await c.set(`Comfy.Server.ServerConfigValues`,e)});let{copyToClipboard:R}=w(),copyCommandLineArgs=async()=>{await R(F.value)},{t:z}=b();d(()=>{L||I.value.length!==0&&j.add({severity:`warn`,summary:z(`serverConfig.restartRequiredToastSummary`),detail:z(`serverConfig.restartRequiredToastDetail`),life:1e4})});let translateItem=e=>({...e,name:z(`serverConfigItems.${e.id}.name`,e.name),tooltip:e.tooltip?z(`serverConfigItems.${e.id}.tooltip`,e.tooltip):void 0});return(e,c)=>(f(),m(`div`,D,[o(I).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(I),e=>(f(),m(`li`,{key:e.id},u(e.name)+`: `+u(e.initialValue)+` → `+u(e.value),1))),128))]),s(`div`,O,[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(F)?(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`,k,[s(`p`,null,u(o(F)),1),a(x,{size:`icon`,variant:`muted-textonly`,"aria-label":e.$t(`g.copyToClipboard`),onClick:copyCommandLineArgs},{default:p(()=>c[1]||=[s(`i`,{class:`pi pi-clipboard`},null,-1)]),_:1},8,[`aria-label`])])]),_:1})):r(``,!0),(f(!0),m(l,null,_(Object.entries(o(M)),([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(S,{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))]))}});export{A as default};
//# sourceMappingURL=ServerConfigPanel-DuZQcpTD.js.map