import{q as i}from"./factory-BR3bc_RM.js";function c(t,n){const{type:e="HTMLInputElement",property:r="value"}=n,o=i(t)[e].prototype;return Object.getOwnPropertyDescriptor(o,r)??{}}function a(t){if(t.localName==="input")return"HTMLInputElement";if(t.localName==="textarea")return"HTMLTextAreaElement";if(t.localName==="select")return"HTMLSelectElement"}function f(t,n,e="value"){if(!t)return;const r=a(t);r&&c(t,{type:r,property:e}).set?.call(t,n),t.setAttribute(e,n)}function v(t,n){const{value:e,bubbles:r=!0}=n;if(!t)return;const o=i(t);if(!(t instanceof o.HTMLInputElement))return;f(t,`${e}`);const s=new o.Event("input",{bubbles:r});t.dispatchEvent(E(s))}function l(t){return t.matches("textarea, input, select, button")}function p(t,n){if(!t)return;const e=l(t)?t.form:t.closest("form"),r=o=>{o.defaultPrevented||n()};return e?.addEventListener("reset",r,{passive:!0}),()=>e?.removeEventListener("reset",r)}function d(t,n){const e=t?.closest("fieldset");if(!e)return;n(e.disabled);const r=i(e),o=new r.MutationObserver(()=>n(e.disabled));return o.observe(e,{attributes:!0,attributeFilter:["disabled"]}),()=>o.disconnect()}function g(t,n){if(!t)return;const{onFieldsetDisabledChange:e,onFormReset:r}=n,o=[p(t,r),d(t,e)];return()=>o.forEach(s=>s?.())}var u=Symbol.for("zag.changeEvent");function m(t){return Object.prototype.hasOwnProperty.call(t,u)}function E(t){return m(t)||Object.defineProperty(t,u,{value:!0}),t}export{v as d,f as s,g as t};
