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.DgiZKHgf.js";import{n as i,t as a}from"./styled-components.BfB5_lgd.js";import{t as o}from"./BaseButton.CtdrcmcQ.js";import{Kt as s,Yt as c,en as l,nn as u,qt as d,tn as f}from"./index.D3kRk1xg.js";import{t as p}from"./iconPosition.DWeCxQ7w.js";var m=e(t(),1),h=(0,m.memo)(function(e){let{disabled:t,element:s,widgetMgr:h,fragmentId:g}=e,{formId:_}=s,v=s.shortcut?s.shortcut:void 0,{formsData:y}=d(c),b=y.formsWithUploads.has(_),x=a.SECONDARY_FORM_SUBMIT;s.type===`primary`?x=a.PRIMARY_FORM_SUBMIT:s.type===`tertiary`&&(x=a.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 f({shortcut:v,disabled:S,onActivate:C}),n(r,{className:`stFormSubmitButton`,"data-testid":`stFormSubmitButton`,children:n(u,{help:s.help,containerWidth:!0,children:n(o,{kind:x,size:i.SMALL,containerWidth:!0,disabled:S,onClick:C,children:n(l,{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};