import{o as e}from"./rolldown-runtime.C0FnF6B9.js";import{r as t}from"./emotion-is-prop-valid.esm.CuYlOKOk.js";import{n,t as r}from"./types.cZoyy9Y-.js";import{n as i}from"./FormClearHelper.G2WY61Ig.js";var a=e(t(),1),o=({widgetMgr:e,id:t,formId:o,key:s,defaultValue:c})=>{(0,a.useEffect)(()=>{let i=e.getElementState(t,s);r(i)&&n(c)&&e.setElementState(t,s,c)},[e,t,s,c]);let[l,u]=(0,a.useState)(e.getElementState(t,s)??c),d=(0,a.useCallback)(n=>{e.setElementState(t,s,n),u(n)},[e,t,s]),f=(0,a.useMemo)(()=>({formId:o||``}),[o]),p=(0,a.useCallback)(()=>d(c),[c,d]);return i({element:f,widgetMgr:e,onFormCleared:p}),[l,d]};export{o as t};