import{o as e}from"./rolldown-runtime.C0FnF6B9.js";import{r as t}from"./emotion-is-prop-valid.esm.CuYlOKOk.js";import{n}from"./types.cZoyy9Y-.js";import{it as r}from"./utils.Bid3C9ZE.js";var i=e(t(),1),a=class{manageFormClearListener(e,t,i){n(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),r(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){this.formClearListener?.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}};function o({element:e,widgetMgr:t,onFormCleared:n}){(0,i.useEffect)(()=>{if(!t||!r(e.formId))return;let i=t.addFormClearedListener(e.formId,n);return()=>{i.disconnect()}},[e,t,n])}export{o as n,a as t};