import { useReadMetaData } from "../hooks/useReadMetaData.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { Box, Grid } from "@material-ui/core";
import { MuiVegaLite } from "@material-vega/material-ui";
//#region src/componentSystems/pageRenderer/wrappers/BarChartWrapper.jsx
const BarChartWrapper = (props) => {
	const $ = c(21);
	const { propsComponent } = props;
	const { id, columnSize, values, xfield, yfield } = useReadMetaData(propsComponent);
	const t0 = columnSize?.xs;
	const t1 = columnSize?.sm;
	const t2 = columnSize?.md;
	let t3;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = {
			width: "100%",
			minWidth: "100%"
		};
		$[0] = t3;
	} else t3 = $[0];
	let t4;
	if ($[1] !== values) {
		t4 = { values };
		$[1] = values;
		$[2] = t4;
	} else t4 = $[2];
	let t5;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = { ticks: false };
		$[3] = t5;
	} else t5 = $[3];
	let t6;
	if ($[4] !== xfield) {
		t6 = {
			field: xfield,
			type: "nominal",
			axis: t5,
			band: .5
		};
		$[4] = xfield;
		$[5] = t6;
	} else t6 = $[5];
	let t7;
	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = { format: "p" };
		$[6] = t7;
	} else t7 = $[6];
	let t8;
	if ($[7] !== yfield) {
		t8 = {
			field: yfield,
			type: "quantitative",
			axis: t7
		};
		$[7] = yfield;
		$[8] = t8;
	} else t8 = $[8];
	let t9;
	if ($[9] !== t6 || $[10] !== t8) {
		t9 = {
			x: t6,
			y: t8
		};
		$[9] = t6;
		$[10] = t8;
		$[11] = t9;
	} else t9 = $[11];
	let t10;
	if ($[12] !== t4 || $[13] !== t9) {
		t10 = /* @__PURE__ */ React.createElement(Box, {
			mt: 2,
			clone: true,
			overflow: "hidden",
			sx: t3
		}, /* @__PURE__ */ React.createElement(MuiVegaLite, {
			variant: "verticalBarChart",
			color: "secondary",
			background: "paper",
			autoResize: true,
			actions: false,
			spec: {
				$schema: "https://vega.github.io/schema/vega-lite/v4.json",
				width: "container",
				data: t4,
				mark: "bar",
				encoding: t9
			}
		}));
		$[12] = t4;
		$[13] = t9;
		$[14] = t10;
	} else t10 = $[14];
	let t11;
	if ($[15] !== id || $[16] !== t0 || $[17] !== t1 || $[18] !== t10 || $[19] !== t2) {
		t11 = /* @__PURE__ */ React.createElement(Grid, {
			item: true,
			xs: t0,
			sm: t1,
			md: t2,
			key: id
		}, t10);
		$[15] = id;
		$[16] = t0;
		$[17] = t1;
		$[18] = t10;
		$[19] = t2;
		$[20] = t11;
	} else t11 = $[20];
	return t11;
};
//#endregion
export { BarChartWrapper };

//# sourceMappingURL=BarChartWrapper.mjs.map