import{r as e}from"./rolldown-runtime-DCMCV6zW.js";import{F as t,x as n}from"./vendor-primevue-7po8Zk9v.js";import{$ as r,A as i,Bt as a,D as o,E as s,F as c,Ft as l,L as u,Lt as d,O as f,P as p,bt as m,gt as h,ht as g,it as _,k as v,l as y}from"./vendor-vue-core-D3IvUUeM.js";import{t as b}from"./types-0oh-UGWL.js";import{n as x}from"./vendor-i18n-CsAN_zFP.js";import{t as S}from"./Button-mG8zDgxj.js";import{U as C,V as w,Yt as T,a as E,br as D,q as O,r as k}from"./dialogService-BC0EXJA5.js";import{t as A}from"./_plugin-vue_export-helper-CTPoQIH5.js";import{t as j}from"./graphHasMissingNodes-DWqOQwhR.js";var M=[`aria-label`],N=1,P=A(u({__name:`BatchCountEdit`,setup(e){let{batchCount:n}=y(T()),a=k(),o=s(()=>a.get(`Comfy.QueueButton.BatchCountLimit`)),handleClick=e=>{let t;if(e){let e=n.value-1;t=Math.min(e*2,o.value)}else{let e=n.value+1;t=Math.floor(e/2)}n.value=t};return(e,a)=>{let s=_(`tooltip`);return h((r(),i(`div`,{class:`batch-count`,"aria-label":e.$t(`menu.batchCount`)},[c(l(t),{modelValue:l(n),"onUpdate:modelValue":a[0]||=e=>m(n)?n.value=e:null,class:`w-14`,min:N,max:o.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,M)),[[s,{value:e.$t(`menu.batchCount`),showDelay:600},void 0,{bottom:!0}]])}}}),[[`__scopeId`,`data-v-19217ad4`]]),F={class:`queue-button-group flex`},I=A(u({__name:`ComfyQueueButton`,setup(e){let t=O(),{mode:u,batchCount:m}=y(T()),k=C(),A=s(()=>j(E.rootGraph,k.nodeDefsByName)),{t:M}=x(),N=s(()=>{let e={disabled:{key:`disabled`,label:M(`menu.run`),tooltip:M(`menu.disabledTooltip`),command:()=>{u.value=`disabled`}},change:{key:`change`,label:`${M(`menu.run`)} (${M(`menu.onChange`)})`,tooltip:M(`menu.onChangeTooltip`),command:()=>{w()?.trackUiButtonClicked({button_id:`queue_mode_option_run_on_change_selected`}),u.value=`change`}}};return b||(e.instant={key:`instant`,label:`${M(`menu.run`)} (${M(`menu.instant`)})`,tooltip:M(`menu.instantTooltip`),command:()=>{w()?.trackUiButtonClicked({button_id:`queue_mode_option_run_instant_selected`}),u.value=`instant`}}),e}),I=s(()=>N.value[u.value]||N.value.disabled),L=s(()=>Object.values(N.value)),R=s(()=>A.value?`icon-[lucide--triangle-alert]`:t.shiftDown?`icon-[lucide--list-start]`:u.value===`disabled`?`icon-[lucide--play]`:u.value===`instant`?`icon-[lucide--fast-forward]`:u.value===`change`?`icon-[lucide--step-forward]`:`icon-[lucide--play]`),z=s(()=>A.value?M(`menu.runWorkflowDisabled`):t.shiftDown?M(`menu.runWorkflowFront`):M(`menu.runWorkflow`)),B=D(),queuePrompt=async e=>{let t=`shiftKey`in e&&e.shiftKey?`Comfy.QueuePromptFront`:`Comfy.QueuePrompt`;m.value>1&&w()?.trackUiButtonClicked({button_id:`queue_run_multiple_batches_submitted`}),await B.execute(t,{metadata:{subscribe_to_run:!1,trigger_source:`button`}})};return(e,t)=>{let s=_(`tooltip`);return r(),i(`div`,F,[h((r(),f(l(n),{class:`comfyui-queue-button`,label:String(I.value?.label??``),severity:`primary`,size:`small`,model:L.value,"data-testid":`queue-button`,onClick:queuePrompt},{icon:g(()=>[o(`i`,{class:d(R.value)},null,2)]),item:g(({item:e})=>[h((r(),f(S,{variant:e.key===l(u)?`primary`:`secondary`,size:`sm`,class:`w-full justify-start`},{default:g(()=>[e.icon?(r(),i(`i`,{key:0,class:d(e.icon)},null,2)):v(``,!0),p(` `+a(String(e.label??``)),1)]),_:2},1032,[`variant`])),[[s,{value:e.tooltip,showDelay:600}]])]),_:1},8,[`label`,`model`])),[[s,{value:z.value,showDelay:600},void 0,{bottom:!0}]]),c(P)])}}}),[[`__scopeId`,`data-v-214102f7`]]);export{I as t};
//# sourceMappingURL=ComfyQueueButton-Cdk-jy75.js.map