import{r as e}from"./rolldown-runtime-DIIn1E2Q.js";import{N as t,b as n}from"./vendor-primevue-DyvCA8Nd.js";import{A as r,D as i,F as a,Ht as o,I as s,Lt as c,O as l,R as u,St as d,_t as f,at as p,et as m,j as h,k as g,l as _,vt as v,zt as y}from"./vendor-vue-core-IZuWV8u3.js";import{t as b}from"./types-Bc3W4AWd.js";import{n as x}from"./vendor-i18n-NwyZMF0q.js";import{t as S}from"./telemetry-B10ff63e.js";import{t as C}from"./Button-uSZXZovG.js";import{Sr as w,X as T,fn as E,hn as D,i as O,o as k,pn as A,tr as j}from"./dialogService-J-k0CeI4.js";import{t as M}from"./_plugin-vue_export-helper-D8rLfeal.js";import{t as N}from"./graphHasMissingNodes-DXT0tyh9.js";var P=[`aria-label`],F=1,I=M(u({__name:`BatchCountEdit`,setup(e){let{batchCount:n}=_(D()),r=O(),a=i(()=>r.get(`Comfy.QueueButton.BatchCountLimit`)),handleClick=e=>{let t;if(e){let e=n.value-1;t=Math.min(e*2,a.value)}else{let e=n.value+1;t=Math.floor(e/2)}n.value=t};return(e,r)=>{let i=p(`tooltip`);return v((m(),h(`div`,{class:`batch-count`,"aria-label":e.$t(`menu.batchCount`)},[s(c(t),{modelValue:c(n),"onUpdate:modelValue":r[0]||=e=>d(n)?n.value=e:null,class:`w-14`,min:F,max:a.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)),[[i,{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=T(),{mode:u,batchCount:d}=_(D()),O=j(),M=i(()=>N(k.rootGraph,O.nodeDefsByName)),{t:P}=x(),F=i(()=>E(u.value)?`instant-idle`:u.value),R=i(()=>{let e={disabled:{key:`disabled`,label:P(`menu.run`),tooltip:P(`menu.disabledTooltip`),command:()=>{u.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`}),u.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`}),u.value=`instant-idle`}}),e}),z=i(()=>R.value[F.value]||R.value.disabled),B=i(()=>Object.values(R.value)),V=i(()=>A(u.value)),H=i(()=>V.value?P(`menu.stopRunInstant`):String(z.value?.label??``)),U=i(()=>V.value?`danger`:`primary`),W=i(()=>V.value?`icon-[lucide--square]`:M.value?`icon-[lucide--triangle-alert]`:t.shiftDown?`icon-[lucide--list-start]`:u.value===`disabled`?`icon-[lucide--play]`:E(u.value)?`icon-[lucide--fast-forward]`:u.value===`change`?`icon-[lucide--step-forward]`:`icon-[lucide--play]`),G=i(()=>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){u.value=`instant-idle`;return}let t=`shiftKey`in e&&e.shiftKey?`Comfy.QueuePromptFront`:`Comfy.QueuePrompt`;E(u.value)&&(u.value=`instant-running`),d.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 i=p(`tooltip`);return m(),h(`div`,L,[v((m(),g(c(n),{class:`comfyui-queue-button`,label:H.value,severity:U.value,size:`small`,model:B.value,"data-testid":`queue-button`,onClick:queuePrompt},{icon:f(()=>[l(`i`,{class:y(W.value)},null,2)]),item:f(({item:e})=>[v((m(),g(C,{variant:e.key===F.value?`primary`:`secondary`,size:`sm`,class:`w-full justify-start`},{default:f(()=>[e.icon?(m(),h(`i`,{key:0,class:y(e.icon)},null,2)):r(``,!0),a(` `+o(String(e.label??``)),1)]),_:2},1032,[`variant`])),[[i,{value:e.tooltip,showDelay:600}]])]),_:1},8,[`label`,`severity`,`model`])),[[i,{value:G.value,showDelay:600},void 0,{bottom:!0}]]),s(I)])}}}),[[`__scopeId`,`data-v-93190861`]]);export{R as t};
//# sourceMappingURL=ComfyQueueButton-DLTOLV5u.js.map