import{o as e}from"./chunk.DuxOD-Sk.js";import{r as t}from"./emotion-is-prop-valid.esm.DV_OErv-.js";import{c as n}from"./emotion-styled.browser.esm.CEYoudG7.js";import"./loglevel.H4SN4KQm.js";import"./isLength.Dot76Eow.js";import"./getColors.Llt-1DRT.js";import"./protobuf.GnXEZo24.js";import{It as r,Lt as i,Rt as a,_t as o,at as s,ft as c,ht as l,st as u,vt as d}from"./src.CIyydb94.js";import"./utils.C1Nidt8_.js";import"./utils.VFl7c69J.js";import"./ErrorElement.K-kvHExv.js";import"./v4.C6ecLp5d.js";import"./utils.B6lSy2ZF.js";import"./UriUtil.BJr0dLQG.js";import"./useCopyToClipboard.CUBg6ZxJ.js";import"./useWindowDimensionsContext.jnKliU5K.js";import{t as f}from"./useRequiredContext.DJN6Ryqz.js";import"./katex.min.DyoqhKgf.js";import{t as p}from"./iconPosition.DZs5QWnP.js";var m=e(t(),1);function h(e){let{disabled:t,element:s,widgetMgr:h,fragmentId:g}=e,{formId:_}=s,v=s.shortcut?s.shortcut:void 0,{formsData:y}=f(u),b=y.formsWithUploads.has(_),x=i.SECONDARY_FORM_SUBMIT;s.type===`primary`?x=i.PRIMARY_FORM_SUBMIT:s.type===`tertiary`&&(x=i.TERTIARY_FORM_SUBMIT);let S=t||b;(0,m.useEffect)(()=>(h.addSubmitButton(_,s),()=>h.removeSubmitButton(_,s)),[h,_,s]);let C=(0,m.useCallback)(()=>{S||h.submitForm(s.formId,g,s)},[S,h,s,g]);return l({shortcut:v,disabled:S,onActivate:C}),n(d,{className:`stFormSubmitButton`,"data-testid":`stFormSubmitButton`,children:n(o,{help:s.help,containerWidth:!0,children:n(r,{kind:x,size:a.SMALL,containerWidth:!0,disabled:S,onClick:C,children:n(c,{icon:s.icon,iconPosition:p(s.iconPosition),label:s.label,shortcut:v})})})})}function g(e){return n(s,{children:n(h,{...e})})}export{g as FormSubmitContent};