import { createChangeEvent, createFocusEvent } from "./utils/formEvents.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { UdpFluentFileInput } from "udp-react-stencil-component-library";
//#region src/UI/fluent-web-components/UdpFileInput.tsx
const UdpFileInput = (t0) => {
	const $ = c(28);
	let error;
	let helperText;
	let hint;
	let name;
	let onBlur;
	let onChange;
	let onFocus;
	let props;
	let value;
	if ($[0] !== t0) {
		({onChange, onBlur, onFocus, name, value, error, helperText, hint, ...props} = t0);
		$[0] = t0;
		$[1] = error;
		$[2] = helperText;
		$[3] = hint;
		$[4] = name;
		$[5] = onBlur;
		$[6] = onChange;
		$[7] = onFocus;
		$[8] = props;
		$[9] = value;
	} else {
		error = $[1];
		helperText = $[2];
		hint = $[3];
		name = $[4];
		onBlur = $[5];
		onChange = $[6];
		onFocus = $[7];
		props = $[8];
		value = $[9];
	}
	let t1;
	if ($[10] !== name || $[11] !== onChange) {
		t1 = (e) => {
			onChange?.(createChangeEvent(e.detail, name, "file-input"));
		};
		$[10] = name;
		$[11] = onChange;
		$[12] = t1;
	} else t1 = $[12];
	const handleValueChanged = t1;
	let t2;
	if ($[13] !== name || $[14] !== onBlur) {
		t2 = () => {
			onBlur?.(createFocusEvent("blur", name));
		};
		$[13] = name;
		$[14] = onBlur;
		$[15] = t2;
	} else t2 = $[15];
	const handleBlur = t2;
	let t3;
	if ($[16] !== name || $[17] !== onFocus) {
		t3 = () => {
			onFocus?.(createFocusEvent("focus", name));
		};
		$[16] = name;
		$[17] = onFocus;
		$[18] = t3;
	} else t3 = $[18];
	const handleFocus = t3;
	const hintStr = typeof hint === "string" ? hint : void 0;
	let normalizedError;
	let normalizedHint;
	if (typeof error === "string") {
		normalizedError = error;
		normalizedHint = hintStr;
	} else if (typeof error === "boolean") {
		normalizedError = error ? helperText || "" : void 0;
		normalizedHint = !error ? helperText || hintStr : hintStr;
	} else normalizedHint = hintStr ?? helperText;
	let t4;
	if ($[19] !== handleBlur || $[20] !== handleFocus || $[21] !== handleValueChanged || $[22] !== name || $[23] !== normalizedError || $[24] !== normalizedHint || $[25] !== props || $[26] !== value) {
		t4 = /* @__PURE__ */ React.createElement(UdpFluentFileInput, {
			...props,
			name,
			value,
			error: normalizedError,
			hint: normalizedHint,
			onValueChanged: handleValueChanged,
			onInputBlur: handleBlur,
			onInputFocus: handleFocus
		});
		$[19] = handleBlur;
		$[20] = handleFocus;
		$[21] = handleValueChanged;
		$[22] = name;
		$[23] = normalizedError;
		$[24] = normalizedHint;
		$[25] = props;
		$[26] = value;
		$[27] = t4;
	} else t4 = $[27];
	return t4;
};
//#endregion
export { UdpFileInput };

//# sourceMappingURL=UdpFileInput.mjs.map