/*!
 * KoliBri - The accessible HTML-Standard
 */
import{m as e}from"./component-names-6ca7e863.js";import{n as o,K as t,j as n}from"./prop.validators-64749272.js";import{a as i,L as s}from"./dev.utils-fab45cbc.js";const f=t=>{for(i()&&(n("↓ Search form element start."),s.debug(t));t instanceof HTMLElement&&"FORM"!==t.tagName&&t.tagName!==e.toUpperCase();){try{t=t.parentElement instanceof HTMLElement?t.parentElement:t.parentNode instanceof ShadowRoot?t.parentNode.host:null}catch(e){}i()&&(s.debug(t),n("↑ Search form element finished."))}return t},a=(n={})=>{var a,s;const i=f(n.form);if(i instanceof HTMLElement){const n=new Event("reset",{bubbles:!0,cancelable:!0});if("FORM"===i.tagName)o(n,i),i.dispatchEvent(n);else if(i.tagName===e.toUpperCase()){o(n,t.querySelector("form",i));const e=i;"function"==typeof(null===(a=e._on)||void 0===a?void 0:a.onReset)&&(null===(s=e._on)||void 0===s||s.onReset(n))}}},l=(a={})=>{const s=f(a.form);if(s instanceof HTMLElement){const a=new SubmitEvent("submit",{bubbles:!0,cancelable:!0,submitter:s});if("FORM"===s.tagName)i()&&!1===s.noValidate&&n("If you have not focusable or hidden form fields in your form, you should enable noValidate for your form.",{force:!0}),setTimeout((()=>{"function"==typeof s.requestSubmit?s.requestSubmit():(o(a,s),s.dispatchEvent(a))}));else if(s.tagName===e.toUpperCase()){o(a,t.querySelector("form",s));const e=s;setTimeout((()=>{var t,o;"function"==typeof(null===(t=e._on)||void 0===t?void 0:t.onSubmit)&&(null===(o=e._on)||void 0===o||o.onSubmit(a))}))}}};export{a,l as p};