import{r as e}from"./rolldown-runtime-DIIn1E2Q.js";import{M as t,b as n}from"./vendor-primevue-DGevbYGF.js";import{A as r,Bt as i,Ct as a,D as o,F as s,I as c,O as l,R as u,Rt as d,Ut as f,_t as p,at as m,et as h,j as g,k as _,l as v,vt as y}from"./vendor-vue-core-BdhYaYlO.js";import{t as b}from"./types-Bc3W4AWd.js";import{n as x}from"./vendor-i18n-JubCsGQ_.js";import{t as S}from"./telemetry-B10ff63e.js";import{t as C}from"./Button-DHxPjNdi.js";import{$r as w,R as T,U as E,i as D,in as O,nn as k,o as A,tn as j}from"./dialogService-CwVeD8j9.js";import{t as M}from"./_plugin-vue_export-helper-BwIhnXfq.js";import{t as N}from"./graphHasMissingNodes-CxKKWHmb.js";var P=[`aria-label`],F=1,I=M(u({__name:`BatchCountEdit`,setup(e){let{batchCount:n}=v(O()),r=D(),i=o(()=>r.get(`Comfy.QueueButton.BatchCountLimit`)),handleClick=e=>{let t;if(e){let e=n.value-1;t=Math.min(e*2,i.value)}else{let e=n.value+1;t=Math.floor(e/2)}n.value=t};return(e,r)=>{let o=m(`tooltip`);return y((h(),g(`div`,{class:`batch-count`,"aria-label":e.$t(`menu.batchCount`)},[c(d(t),{modelValue:d(n),"onUpdate:modelValue":r[0]||=e=>a(n)?n.value=e:null,class:`w-14`,min:F,max:i.value,fluid:``,"show-buttons":``,pt:{incrementButton:{class:`w-6`,onmousedown:()=>{handleClick(!0)}},decrementButton:{class:`w-6`,onmousedown:()=>{handleClick(!1)}}}},null,8,[`modelValue`,`max`,`pt`])],8,P)),[[o,{value:e.$t(`menu.batchCount`),showDelay:600},void 0,{bottom:!0}]])}}}),[[`__scopeId`,`data-v-19217ad4`]]),L={class:`queue-button-group flex`},R=M(u({__name:`ComfyQueueButton`,setup(e){let t=E(),{mode:a,batchCount:u}=v(O()),D=T(),M=o(()=>N(A.rootGraph,D.nodeDefsByName)),{t:P}=x(),F=o(()=>j(a.value)?`instant-idle`:a.value),R=o(()=>{let e={disabled:{key:`disabled`,label:P(`menu.run`),tooltip:P(`menu.disabledTooltip`),command:()=>{a.value=`disabled`}},change:{key:`change`,label:`${P(`menu.run`)} (${P(`menu.onChange`)})`,tooltip:P(`menu.onChangeTooltip`),command:()=>{S()?.trackUiButtonClicked({button_id:`queue_mode_option_run_on_change_selected`}),a.value=`change`}}};return b||(e[`instant-idle`]={key:`instant-idle`,label:`${P(`menu.run`)} (${P(`menu.instant`)})`,tooltip:P(`menu.instantTooltip`),command:()=>{S()?.trackUiButtonClicked({button_id:`queue_mode_option_run_instant_selected`}),a.value=`instant-idle`}}),e}),z=o(()=>R.value[F.value]||R.value.disabled),B=o(()=>Object.values(R.value)),V=o(()=>k(a.value)),H=o(()=>V.value?P(`menu.stopRunInstant`):String(z.value?.label??``)),U=o(()=>V.value?`danger`:`primary`),W=o(()=>V.value?`icon-[lucide--square]`:M.value?`icon-[lucide--triangle-alert]`:t.shiftDown?`icon-[lucide--list-start]`:a.value===`disabled`?`icon-[lucide--play]`:j(a.value)?`icon-[lucide--fast-forward]`:a.value===`change`?`icon-[lucide--step-forward]`:`icon-[lucide--play]`),G=o(()=>V.value?P(`menu.stopRunInstantTooltip`):M.value?P(`menu.runWorkflowDisabled`):t.shiftDown?P(`menu.runWorkflowFront`):P(`menu.runWorkflow`)),K=w(),queuePrompt=async e=>{if(V.value){a.value=`instant-idle`;return}let t=`shiftKey`in e&&e.shiftKey?`Comfy.QueuePromptFront`:`Comfy.QueuePrompt`;j(a.value)&&(a.value=`instant-running`),u.value>1&&S()?.trackUiButtonClicked({button_id:`queue_run_multiple_batches_submitted`}),await K.execute(t,{metadata:{subscribe_to_run:!1,trigger_source:`button`}})};return(e,t)=>{let a=m(`tooltip`);return h(),g(`div`,L,[y((h(),_(d(n),{class:`comfyui-queue-button`,label:H.value,severity:U.value,size:`small`,model:B.value,"data-testid":`queue-button`,onClick:queuePrompt},{icon:p(()=>[l(`i`,{class:i(W.value)},null,2)]),item:p(({item:e})=>[y((h(),_(C,{variant:e.key===F.value?`primary`:`secondary`,size:`sm`,class:`w-full justify-start`},{default:p(()=>[e.icon?(h(),g(`i`,{key:0,class:i(e.icon)},null,2)):r(``,!0),s(` `+f(String(e.label??``)),1)]),_:2},1032,[`variant`])),[[a,{value:e.tooltip,showDelay:600}]])]),_:1},8,[`label`,`severity`,`model`])),[[a,{value:G.value,showDelay:600},void 0,{bottom:!0}]]),c(I)])}}}),[[`__scopeId`,`data-v-93190861`]]);export{R as t};
//# sourceMappingURL=ComfyQueueButton-D1QC1zmv.js.map