/*!
 * KoliBri - The accessible HTML-Standard
 */
import{a9 as setEventTarget,K as KoliBriDevHelper,a0 as getExperimentalMode,h as devHint}from"./index-c3ae175d.js";const searchFormElement=e=>{for(getExperimentalMode()&&(devHint("↓ Search form element start."),console.log(e));e instanceof HTMLElement&&"FORM"!==e.tagName&&"KOL-FORM"!==e.tagName;){try{e=e.parentElement instanceof HTMLElement?e.parentElement:e.parentNode instanceof ShadowRoot?e.parentNode.host:null}catch(e){}getExperimentalMode()&&(console.log(e),devHint("↑ Search form element finished."))}return e},propagateResetEventToForm=(e={})=>{var t,n;const o=searchFormElement(e.form);if(o instanceof HTMLElement){const e=new Event("reset",{bubbles:!0,cancelable:!0});if("FORM"===o.tagName)setEventTarget(e,o),o.dispatchEvent(e);else if("KOL-FORM"===o.tagName){setEventTarget(e,KoliBriDevHelper.querySelector("form",o));const a=o;"function"==typeof(null===(t=a._on)||void 0===t?void 0:t.onReset)&&(null===(n=a._on)||void 0===n||n.onReset(e))}}},propagateSubmitEventToForm=(e={})=>{var t,n;const o=searchFormElement(e.form);if(o instanceof HTMLElement){const e=new SubmitEvent("submit",{bubbles:!0,cancelable:!0,submitter:o});if("FORM"===o.tagName)setEventTarget(e,o),o.dispatchEvent(e),o.submit();else if("KOL-FORM"===o.tagName){setEventTarget(e,KoliBriDevHelper.querySelector("form",o));const a=o;"function"==typeof(null===(t=a._on)||void 0===t?void 0:t.onSubmit)&&(null===(n=a._on)||void 0===n||n.onSubmit(e))}}};export{propagateResetEventToForm as a,propagateSubmitEventToForm as p};