import{o as e}from"./rolldown-runtime.C0FnF6B9.js";import{r as t}from"./emotion-is-prop-valid.esm.CuYlOKOk.js";import{i as n}from"./emotion-styled.browser.esm.Dj5rZcu_.js";import{i as r}from"./Tooltip.bbzhtE2V.js";import{n as i,t as a}from"./styled-components.CMq9oZJa.js";import{t as o}from"./BaseButton.DiyA9nY7.js";import{t as s}from"./useRequiredContext.DBsQavvD.js";import{G as c,J as l,K as u,O as d,V as f,q as p}from"./index.ByR4Z2EF.js";import{t as m}from"./iconPosition.BjGBOrz5.js";var h=e(t(),1),g=(0,h.memo)(function(e){let{disabled:t,element:f,widgetMgr:g,fragmentId:_}=e,{formId:v}=f,y=f.shortcut?f.shortcut:void 0,b=c(f.wrap),x=!b&&!f.help,{formsData:S}=s(d),C=S.formsWithUploads.has(v),w=a.SECONDARY_FORM_SUBMIT;f.type===`primary`?w=a.PRIMARY_FORM_SUBMIT:f.type===`tertiary`&&(w=a.TERTIARY_FORM_SUBMIT);let T=t||C;(0,h.useEffect)(()=>(g.addSubmitButton(v,f),()=>g.removeSubmitButton(v,f)),[g,v,f]);let E=(0,h.useCallback)(()=>{T||g.submitForm(f.formId,_,f)},[T,g,f,_]);return p({shortcut:y,disabled:T,onActivate:E}),n(r,{className:`stFormSubmitButton`,"data-testid":`stFormSubmitButton`,children:n(l,{help:f.help,containerWidth:!0,children:n(o,{kind:w,size:i.SMALL,containerWidth:!0,disabled:T,onClick:E,children:n(u,{icon:f.icon,iconPosition:m(f.iconPosition),label:f.label,shortcut:y,wrap:b,addTitleTooltip:x})})})})});function _(e){return n(f,{children:n(g,{...e})})}export{_ as FormSubmitContent};