import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{r as t}from"./emotion-is-prop-valid.esm.CygBv61C.js";import{i as n}from"./emotion-styled.browser.esm.C7ab1lZK.js";import{i as r}from"./Tooltip.DJg7muty.js";import{n as i,t as a}from"./styled-components.BQZommyC.js";import{t as o}from"./BaseButton.CD99a2NM.js";import{t as s}from"./BaseButtonTooltip.9ZCtkLEj.js";import{i as c,t as l}from"./DynamicButtonLabel.BZWdvyzO.js";import{r as u,t as d}from"./FormsContext.Crp0Ptrs.js";import{t as f}from"./useRequiredContext.F4hG38Ff.js";import{t as p}from"./iconPosition.C4GDw890.js";var m=e(t(),1),h=(0,m.memo)(function(e){let{disabled:t,element:u,widgetMgr:h,fragmentId:g}=e,{formId:_}=u,v=u.shortcut?u.shortcut:void 0,{formsData:y}=f(d),b=y.formsWithUploads.has(_),x=a.SECONDARY_FORM_SUBMIT;u.type===`primary`?x=a.PRIMARY_FORM_SUBMIT:u.type===`tertiary`&&(x=a.TERTIARY_FORM_SUBMIT);let S=t||b;(0,m.useEffect)(()=>(h.addSubmitButton(_,u),()=>h.removeSubmitButton(_,u)),[h,_,u]);let C=(0,m.useCallback)(()=>{S||h.submitForm(u.formId,g,u)},[S,h,u,g]);return c({shortcut:v,disabled:S,onActivate:C}),n(r,{className:`stFormSubmitButton`,"data-testid":`stFormSubmitButton`,children:n(s,{help:u.help,containerWidth:!0,children:n(o,{kind:x,size:i.SMALL,containerWidth:!0,disabled:S,onClick:C,children:n(l,{icon:u.icon,iconPosition:p(u.iconPosition),label:u.label,shortcut:v})})})})});function g(e){return n(u,{children:n(h,{...e})})}export{g as FormSubmitContent};