/*!
 * KoliBri - The accessible HTML-Standard
 */
"use strict";const index=require("./index-cb2ce614.js"),searchFormElement=e=>{for(index.getExperimentalMode()&&(index.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){}index.getExperimentalMode()&&(console.log(e),index.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)index.setEventTarget(e,o),o.dispatchEvent(e);else if("KOL-FORM"===o.tagName){index.setEventTarget(e,index.KoliBriDevHelper.querySelector("form",o));const r=o;"function"==typeof(null===(t=r._on)||void 0===t?void 0:t.onReset)&&(null===(n=r._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)index.setEventTarget(e,o),o.dispatchEvent(e),index.getExperimentalMode()&&!1===o.noValidate&&index.devHint("If you have not focusable or hidden form fields in your form, you should enable noValidate for your form.",{force:!0}),"function"==typeof o.requestSubmit&&o.requestSubmit();else if("KOL-FORM"===o.tagName){index.setEventTarget(e,index.KoliBriDevHelper.querySelector("form",o));const r=o;"function"==typeof(null===(t=r._on)||void 0===t?void 0:t.onSubmit)&&(null===(n=r._on)||void 0===n||n.onSubmit(e))}}};exports.propagateResetEventToForm=propagateResetEventToForm,exports.propagateSubmitEventToForm=propagateSubmitEventToForm;