import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{r as t}from"./emotion-is-prop-valid.esm.CygBv61C.js";import{c as n}from"./emotion-styled.browser.esm.DmHEQgFq.js";import{v as r}from"./StreamlitMarkdown.CwaSe4JX.js";import{n as i,t as a}from"./styled-components.BnwjjA8j.js";import{t as o}from"./BaseButton.VZZipqV4.js";import{It as s,Kt as c,Xt as l,nn as u,rn as d,tn as f}from"./index.BfkDCGNp.js";import{t as p}from"./iconPosition.DWeCxQ7w.js";var m=e(t(),1),h=(0,m.memo)(function(e){let{disabled:t,element:l,widgetMgr:h,fragmentId:g}=e,{formId:_}=l,v=l.shortcut?l.shortcut:void 0,{formsData:y}=c(s),b=y.formsWithUploads.has(_),x=a.SECONDARY_FORM_SUBMIT;l.type===`primary`?x=a.PRIMARY_FORM_SUBMIT:l.type===`tertiary`&&(x=a.TERTIARY_FORM_SUBMIT);let S=t||b;(0,m.useEffect)(()=>(h.addSubmitButton(_,l),()=>h.removeSubmitButton(_,l)),[h,_,l]);let C=(0,m.useCallback)(()=>{S||h.submitForm(l.formId,g,l)},[S,h,l,g]);return u({shortcut:v,disabled:S,onActivate:C}),n(r,{className:`stFormSubmitButton`,"data-testid":`stFormSubmitButton`,children:n(d,{help:l.help,containerWidth:!0,children:n(o,{kind:x,size:i.SMALL,containerWidth:!0,disabled:S,onClick:C,children:n(f,{icon:l.icon,iconPosition:p(l.iconPosition),label:l.label,shortcut:v})})})})});function g(e){return n(l,{children:n(h,{...e})})}export{g as FormSubmitContent};