//#region src/dashboard/getWidgetLayout.ts
const getW = (w) => {
	if (typeof w === "object") return {
		w: w.default,
		minW: w.min,
		maxW: w.max
	};
	if (typeof w === "number") return { w };
	return { w: 2 };
};
const getH = (h) => {
	if (typeof h === "object") return {
		h: h.default,
		minH: h.min,
		maxH: h.max
	};
	if (typeof h === "number") return { h };
	return { h: 2 };
};
/**
* Get a default layout for widgets of a type
*/
function getWidgetLayout(getWidget, widgetType) {
	const { w, h } = (getWidget && getWidget(widgetType)?.layout) ?? {};
	const layout = {
		...getW(w),
		...getH(h)
	};
	const wResizable = "minW" in layout || "maxW" in layout;
	const hResizable = "minH" in layout || "maxH" in layout;
	layout.isResizable = wResizable || hResizable;
	return layout;
}
//#endregion
export { getWidgetLayout as default };

//# sourceMappingURL=getWidgetLayout.mjs.map