/*!
 * KoliBri - The accessible HTML-Standard
 */
import{m as e}from"./component-names-d278f819.js";import{q as o,K as t,j as n}from"./prop.validators-9feb1d92.js";import{a as i,L as f}from"./dev.utils-fab45cbc.js";const s=t=>{for(i()&&(n("↓ Search form element start."),f.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()&&(f.debug(t),n("↑ Search form element finished."))}return t},a=(n={})=>{var a,i;const r=s(n.form);if(r instanceof HTMLElement){const n=new Event("reset",{bubbles:!0,cancelable:!0});if("FORM"===r.tagName)o(n,r),r.dispatchEvent(n);else if(r.tagName===e.toUpperCase()){o(n,t.querySelector("form",r));const e=r;"function"==typeof(null===(a=e._on)||void 0===a?void 0:a.onReset)&&(null===(i=e._on)||void 0===i||i.onReset(n))}}},l=(a={})=>{const r=s(a.form);if(r instanceof HTMLElement){const a=new SubmitEvent("submit",{bubbles:!0,cancelable:!0,submitter:r});if("FORM"===r.tagName)i()&&!1===r.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 r.requestSubmit?r.requestSubmit():(o(a,r),r.dispatchEvent(a))}));else if(r.tagName===e.toUpperCase()){o(a,t.querySelector("form",r));const e=r;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};