"use client";
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
const require_use_environment_context = require("../../providers/environment/use-environment-context.cjs");
const require_use_locale_context = require("../../providers/locale/use-locale-context.cjs");
const require_use_field_context = require("../field/use-field-context.cjs");
let _zag_js_switch = require("@zag-js/switch");
_zag_js_switch = require_runtime.__toESM(_zag_js_switch, 1);
let react = require("react");
let _zag_js_react = require("@zag-js/react");
//#region src/components/switch/use-switch.ts
var useSwitch = (props) => {
	const id = (0, react.useId)();
	const { getRootNode } = require_use_environment_context.useEnvironmentContext();
	const { dir } = require_use_locale_context.useLocaleContext();
	const field = require_use_field_context.useFieldContext();
	const machineProps = {
		id,
		ids: {
			label: field?.ids.label,
			hiddenInput: field?.ids.control
		},
		dir,
		disabled: field?.disabled,
		readOnly: field?.readOnly,
		invalid: field?.invalid,
		required: field?.required,
		getRootNode,
		...props
	};
	const service = (0, _zag_js_react.useMachine)(_zag_js_switch.machine, machineProps);
	return _zag_js_switch.connect(service, _zag_js_react.normalizeProps);
};
//#endregion
exports.useSwitch = useSwitch;
