import{h as t}from"./p-1d34fb2d.js";import{c as n}from"./p-d85a85a0.js";function e(t){return"checked"in t}function i(t){return"indeterminate"in t}function o(t){return"defaultSelectedIndex"in t}const s=new WeakMap;const r=new WeakSet;function f(t,n){const e="internalFormComponentRegister";let i=false;t.addEventListener(e,(t=>{i=t.composedPath().some((t=>r.has(t)));t.stopPropagation()}),{once:true});n.dispatchEvent(new CustomEvent(e,{bubbles:true,composed:true}));return i}function u(){if(o(this))this.onFormReset();else this.value=this.defaultValue;if(e(this))this.checked=this.defaultChecked;if(i(this))this.indeterminate=this.defaultIndeterminate}function a(t){const{host:s,value:a}=t;const c=n(s,"form");const l=(t.onFormReset||u).bind(t);if(!c||f(c,s))return;c.addEventListener("reset",l);r.add(s);t.formEl=c;t.defaultValue=a;if(e(t))t.defaultChecked=t.checked;if(i(t))t.defaultIndeterminate=t.indeterminate;if(o(t))t.defaultSelectedIndex=t.defaultSelectedIndex}function c(t){const{host:n,formEl:e}=t;const i=s.get(n);if(!e)return;e.removeEventListener("reset",i);s.delete(n);t.formEl=null;r.delete(n)}const l=({component:n,type:o})=>{const{disabled:s,hiddenInput:r,host:f,max:u,maxlength:a,min:c,minlength:l,name:m,pattern:d,readonly:h,required:p,value:b}=n;const x="hidden-form-input";let g=f.querySelector(`input[slot="${x}"]`);if(!g){g=f.ownerDocument.createElement("input");if(m)g.name=m;if(!r)n.hiddenInput=g;g.tabIndex=-1;g.slot=x;g.style.opacity="0";g.style.position="absolute";g.style.zIndex="-1";g.addEventListener("invalid",(t=>t.preventDefault()));g.setAttribute("aria-hidden","true");if(u)g.setAttribute("max",u);if(a)g.setAttribute("maxlength",a);if(c)g.setAttribute("min",c);if(l)g.setAttribute("minlength",l);if(d)g.setAttribute("pattern",d);if(o)g.setAttribute("type",o);if(h)g.readOnly=h;f.appendChild(g)}if(e(n))g.checked=n.checked;if(i(n))g.indeterminate=n.indeterminate;g.disabled=s;g.required=p;g.value=b;return t("slot",{name:x})};export{l as H,a as c,c as d};
//# sourceMappingURL=p-64c96e0e.js.map