import{x as o,bE as s,r as d}from"./index-D3uELfdo.js";class a{manageFormClearListener(t,e,i){o(this.formClearListener)&&this.lastWidgetMgr===t&&this.lastFormId===e||(this.disconnect(),s(e)&&(this.formClearListener=t.addFormClearedListener(e,i),this.lastWidgetMgr=t,this.lastFormId=e))}disconnect(){this.formClearListener?.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function l({element:r,widgetMgr:t,onFormCleared:e}){d.useEffect(()=>{if(!t||!s(r.formId))return;const i=t.addFormClearedListener(r.formId,e);return()=>{i.disconnect()}},[r,t,e])}export{a as d,l as m};
