{"version":3,"file":"getInputForm.mjs","sources":[""],"sourcesContent":["import { getDocument } from \"ssr-window\";\n\n/**\n * Получает форму, к которой относится поле ввода или селект\n * @param input{HTMLInputElement|HTMLTextAreaElement|HTMLSelectElement} поле ввода\n * @returns {HTMLElement|null} Возвращает связанную форму через атрибут `form` или ближайший родительский `<form>`.\n * @example\n * import { getInputForm } from \"@delement/ui/utils\";\n *\n * const input = document.querySelector(\"input[name='email']\") as HTMLInputElement;\n * const form = getInputForm(input);\n */\nexport const getInputForm = (input: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement): HTMLFormElement | null => {\n  return input.hasAttribute(\"form\") ? getDocument().getElementById(input.getAttribute(\"form\")) : input.closest(\"form\");\n};\n"],"names":["getInputForm","input","hasAttribute","getDocument","getElementById","getAttribute","closest"],"mappings":";;;;;;;;;;GAYO,MAAMA,aAAgBC,OACpBA,MAAMC,aAAa,QAAUC,cAAcC,eAAeH,MAAMI,aAAa,SAAWJ,MAAMK,QAAQ"}