import { useShellStore } from "../../stores/shellStore.mjs";
import { c } from "react-compiler-runtime";
import React, { Children, useEffect } from "react";
import { createTeleporter } from "react-teleporter";
//#region src/utilities/utilityBar/SubHeaderAction.jsx
const SubHeaderActions = createTeleporter({ multiSources: true });
/**
* @param {any} props
*/
function SubHeaderActionsTarget(props) {
	const $ = c(2);
	let t0;
	if ($[0] !== props) {
		t0 = /* @__PURE__ */ React.createElement(SubHeaderActions.Target, props);
		$[0] = props;
		$[1] = t0;
	} else t0 = $[1];
	return t0;
}
/**
* Places a button in the App SubHeader
*/
const SubHeaderAction = (props) => {
	const $ = c(6);
	const { children } = props;
	const setSubHeaderActionHasChildren = useShellStore(_temp);
	const hasChildren = Children.count(children) > 0;
	let t0;
	let t1;
	if ($[0] !== hasChildren || $[1] !== setSubHeaderActionHasChildren) {
		t0 = () => {
			setSubHeaderActionHasChildren(hasChildren);
		};
		t1 = [hasChildren, setSubHeaderActionHasChildren];
		$[0] = hasChildren;
		$[1] = setSubHeaderActionHasChildren;
		$[2] = t0;
		$[3] = t1;
	} else {
		t0 = $[2];
		t1 = $[3];
	}
	useEffect(t0, t1);
	let t2;
	if ($[4] !== children) {
		t2 = /* @__PURE__ */ React.createElement(SubHeaderActions.Source, null, children);
		$[4] = children;
		$[5] = t2;
	} else t2 = $[5];
	return t2;
};
function _temp(state) {
	return state.setSubHeaderActionHasChildren;
}
//#endregion
export { SubHeaderAction, SubHeaderActionsTarget };

//# sourceMappingURL=SubHeaderAction.mjs.map