import { Typography as Typography$1 } from "../../dataDisplay/typography/Typography.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { IconButton, makeStyles } from "@material-ui/core";
import { useTranslation } from "react-i18next";
import FirstPageIcon from "@material-ui/icons/esm/FirstPage";
import NavigateBeforeIcon from "@material-ui/icons/esm/NavigateBefore";
import NavigateNextIcon from "@material-ui/icons/esm/NavigateNext";
import LastPageIcon from "@material-ui/icons/esm/LastPage";
import ZoomInIcon from "@material-ui/icons/esm/ZoomIn";
import ZoomOutIcon from "@material-ui/icons/esm/ZoomOut";
import CloudDownloadOutlinedIcon from "@material-ui/icons/esm/CloudDownloadOutlined";
import HighlightOffOutlinedIcon from "@material-ui/icons/esm/HighlightOffOutlined";
//#region src/UI/fileViewer/pdfViewer/ControlPanel.tsx
const useStyles = makeStyles((theme) => ({
	controlPanel: {
		fontSize: "16px",
		backgroundColor: theme.palette.background.paper,
		borderRadius: "5px",
		width: "fit-content",
		padding: theme.spacing(1),
		margin: "8px auto",
		display: "flex",
		alignItems: "center",
		justifyContent: "space-between",
		gap: "10px"
	},
	pageActions: {
		display: "flex",
		alignItems: "center",
		justifyContent: "space-between",
		gap: "10px"
	},
	pageNumber: {
		display: "flex",
		gap: 5,
		minWidth: "125px"
	}
}));
const ControlPanel = (props) => {
	const $ = c(94);
	const { pageNumber, numPages, setPageNumber, scale, setScale, file, closePDF, onClickDownload } = props;
	const isFirstPage = pageNumber === 1;
	const isLastPage = pageNumber === numPages;
	const { t } = useTranslation();
	const classes = useStyles();
	let t0;
	if ($[0] !== isFirstPage || $[1] !== setPageNumber) {
		t0 = () => {
			if (!isFirstPage) setPageNumber(1);
		};
		$[0] = isFirstPage;
		$[1] = setPageNumber;
		$[2] = t0;
	} else t0 = $[2];
	const goToFirstPage = t0;
	let t1;
	if ($[3] !== isFirstPage || $[4] !== pageNumber || $[5] !== setPageNumber) {
		t1 = () => {
			if (!isFirstPage) setPageNumber(pageNumber - 1);
		};
		$[3] = isFirstPage;
		$[4] = pageNumber;
		$[5] = setPageNumber;
		$[6] = t1;
	} else t1 = $[6];
	const goToPreviousPage = t1;
	let t2;
	if ($[7] !== isLastPage || $[8] !== pageNumber || $[9] !== setPageNumber) {
		t2 = () => {
			if (!isLastPage) setPageNumber(pageNumber + 1);
		};
		$[7] = isLastPage;
		$[8] = pageNumber;
		$[9] = setPageNumber;
		$[10] = t2;
	} else t2 = $[10];
	const goToNextPage = t2;
	let t3;
	if ($[11] !== isLastPage || $[12] !== numPages || $[13] !== setPageNumber) {
		t3 = () => {
			if (!isLastPage) setPageNumber(numPages);
		};
		$[11] = isLastPage;
		$[12] = numPages;
		$[13] = setPageNumber;
		$[14] = t3;
	} else t3 = $[14];
	const goToLastPage = t3;
	let t4;
	if ($[15] !== setPageNumber) {
		t4 = (e) => {
			const { value } = e.target;
			setPageNumber(Number(value));
		};
		$[15] = setPageNumber;
		$[16] = t4;
	} else t4 = $[16];
	const onPageChange = t4;
	const isMinZoom = scale < .6;
	const isMaxZoom = scale >= 2;
	let t5;
	if ($[17] !== isMinZoom || $[18] !== scale || $[19] !== setScale) {
		t5 = () => {
			if (!isMinZoom) setScale(scale - .1);
		};
		$[17] = isMinZoom;
		$[18] = scale;
		$[19] = setScale;
		$[20] = t5;
	} else t5 = $[20];
	const zoomOut = t5;
	let t6;
	if ($[21] !== isMaxZoom || $[22] !== scale || $[23] !== setScale) {
		t6 = () => {
			if (!isMaxZoom) setScale(scale + .1);
		};
		$[21] = isMaxZoom;
		$[22] = scale;
		$[23] = setScale;
		$[24] = t6;
	} else t6 = $[24];
	const zoomIn = t6;
	const t7 = classes.controlPanel;
	const t8 = classes.pageActions;
	let t9;
	if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = /* @__PURE__ */ React.createElement(FirstPageIcon, null);
		$[25] = t9;
	} else t9 = $[25];
	let t10;
	if ($[26] !== goToFirstPage || $[27] !== isFirstPage) {
		t10 = /* @__PURE__ */ React.createElement(IconButton, {
			size: "small",
			onClick: goToFirstPage,
			disabled: isFirstPage
		}, t9);
		$[26] = goToFirstPage;
		$[27] = isFirstPage;
		$[28] = t10;
	} else t10 = $[28];
	let t11;
	if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
		t11 = /* @__PURE__ */ React.createElement(NavigateBeforeIcon, null);
		$[29] = t11;
	} else t11 = $[29];
	let t12;
	if ($[30] !== goToPreviousPage || $[31] !== isFirstPage) {
		t12 = /* @__PURE__ */ React.createElement(IconButton, {
			size: "small",
			onClick: goToPreviousPage,
			disabled: isFirstPage
		}, t11);
		$[30] = goToPreviousPage;
		$[31] = isFirstPage;
		$[32] = t12;
	} else t12 = $[32];
	const t13 = classes.pageNumber;
	let t14;
	if ($[33] !== t) {
		t14 = t("Page");
		$[33] = t;
		$[34] = t14;
	} else t14 = $[34];
	let t15;
	if ($[35] !== t14) {
		t15 = /* @__PURE__ */ React.createElement(Typography$1, null, t14, " ");
		$[35] = t14;
		$[36] = t15;
	} else t15 = $[36];
	const t16 = numPages || 1;
	let t17;
	if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
		t17 = {
			padding: 0,
			paddingLeft: 1,
			margin: 0,
			textAlign: "end"
		};
		$[37] = t17;
	} else t17 = $[37];
	let t18;
	if ($[38] !== onPageChange || $[39] !== pageNumber || $[40] !== t16) {
		t18 = /* @__PURE__ */ React.createElement("input", {
			name: "pageNumber",
			type: "number",
			min: 1,
			max: t16,
			style: t17,
			value: pageNumber,
			onChange: onPageChange
		});
		$[38] = onPageChange;
		$[39] = pageNumber;
		$[40] = t16;
		$[41] = t18;
	} else t18 = $[41];
	let t19;
	if ($[42] !== numPages) {
		t19 = /* @__PURE__ */ React.createElement(Typography$1, null, "of ", numPages);
		$[42] = numPages;
		$[43] = t19;
	} else t19 = $[43];
	let t20;
	if ($[44] !== classes.pageNumber || $[45] !== t15 || $[46] !== t18 || $[47] !== t19) {
		t20 = /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: t13 }, t15, t18, " ", t19));
		$[44] = classes.pageNumber;
		$[45] = t15;
		$[46] = t18;
		$[47] = t19;
		$[48] = t20;
	} else t20 = $[48];
	let t21;
	if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
		t21 = /* @__PURE__ */ React.createElement(NavigateNextIcon, null);
		$[49] = t21;
	} else t21 = $[49];
	let t22;
	if ($[50] !== goToNextPage || $[51] !== isLastPage) {
		t22 = /* @__PURE__ */ React.createElement(IconButton, {
			size: "small",
			onClick: goToNextPage,
			disabled: isLastPage
		}, t21);
		$[50] = goToNextPage;
		$[51] = isLastPage;
		$[52] = t22;
	} else t22 = $[52];
	let t23;
	if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
		t23 = /* @__PURE__ */ React.createElement(LastPageIcon, null);
		$[53] = t23;
	} else t23 = $[53];
	let t24;
	if ($[54] !== goToLastPage || $[55] !== isLastPage) {
		t24 = /* @__PURE__ */ React.createElement(IconButton, {
			size: "small",
			onClick: goToLastPage,
			disabled: isLastPage
		}, t23);
		$[54] = goToLastPage;
		$[55] = isLastPage;
		$[56] = t24;
	} else t24 = $[56];
	let t25;
	if ($[57] !== classes.pageActions || $[58] !== t10 || $[59] !== t12 || $[60] !== t20 || $[61] !== t22 || $[62] !== t24) {
		t25 = /* @__PURE__ */ React.createElement("div", { className: t8 }, t10, t12, t20, t22, t24);
		$[57] = classes.pageActions;
		$[58] = t10;
		$[59] = t12;
		$[60] = t20;
		$[61] = t22;
		$[62] = t24;
		$[63] = t25;
	} else t25 = $[63];
	const t26 = classes.pageActions;
	let t27;
	if ($[64] === Symbol.for("react.memo_cache_sentinel")) {
		t27 = /* @__PURE__ */ React.createElement(ZoomOutIcon, null);
		$[64] = t27;
	} else t27 = $[64];
	let t28;
	if ($[65] !== isMinZoom || $[66] !== zoomOut) {
		t28 = /* @__PURE__ */ React.createElement(IconButton, {
			size: "small",
			onClick: zoomOut,
			disabled: isMinZoom
		}, t27);
		$[65] = isMinZoom;
		$[66] = zoomOut;
		$[67] = t28;
	} else t28 = $[67];
	const t29 = scale * 100;
	let t30;
	if ($[68] !== t29) {
		t30 = t29.toFixed();
		$[68] = t29;
		$[69] = t30;
	} else t30 = $[69];
	let t31;
	if ($[70] !== t30) {
		t31 = /* @__PURE__ */ React.createElement(Typography$1, null, t30, "%");
		$[70] = t30;
		$[71] = t31;
	} else t31 = $[71];
	let t32;
	if ($[72] === Symbol.for("react.memo_cache_sentinel")) {
		t32 = /* @__PURE__ */ React.createElement(ZoomInIcon, null);
		$[72] = t32;
	} else t32 = $[72];
	let t33;
	if ($[73] !== isMaxZoom || $[74] !== zoomIn) {
		t33 = /* @__PURE__ */ React.createElement(IconButton, {
			size: "small",
			onClick: zoomIn,
			disabled: isMaxZoom
		}, t32);
		$[73] = isMaxZoom;
		$[74] = zoomIn;
		$[75] = t33;
	} else t33 = $[75];
	let t34;
	if ($[76] !== classes.pageActions || $[77] !== t28 || $[78] !== t31 || $[79] !== t33) {
		t34 = /* @__PURE__ */ React.createElement("div", { className: t26 }, t28, t31, t33);
		$[76] = classes.pageActions;
		$[77] = t28;
		$[78] = t31;
		$[79] = t33;
		$[80] = t34;
	} else t34 = $[80];
	let t35;
	if ($[81] === Symbol.for("react.memo_cache_sentinel")) {
		t35 = /* @__PURE__ */ React.createElement(CloudDownloadOutlinedIcon, null);
		$[81] = t35;
	} else t35 = $[81];
	let t36;
	if ($[82] !== file || $[83] !== onClickDownload) {
		t36 = /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(IconButton, {
			href: file,
			size: "small",
			onClick: onClickDownload
		}, t35));
		$[82] = file;
		$[83] = onClickDownload;
		$[84] = t36;
	} else t36 = $[84];
	let t37;
	if ($[85] === Symbol.for("react.memo_cache_sentinel")) {
		t37 = /* @__PURE__ */ React.createElement(HighlightOffOutlinedIcon, null);
		$[85] = t37;
	} else t37 = $[85];
	let t38;
	if ($[86] !== closePDF) {
		t38 = /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(IconButton, {
			size: "small",
			onClick: closePDF
		}, t37));
		$[86] = closePDF;
		$[87] = t38;
	} else t38 = $[87];
	let t39;
	if ($[88] !== classes.controlPanel || $[89] !== t25 || $[90] !== t34 || $[91] !== t36 || $[92] !== t38) {
		t39 = /* @__PURE__ */ React.createElement("div", { className: t7 }, t25, t34, t36, t38);
		$[88] = classes.controlPanel;
		$[89] = t25;
		$[90] = t34;
		$[91] = t36;
		$[92] = t38;
		$[93] = t39;
	} else t39 = $[93];
	return t39;
};
//#endregion
export { ControlPanel as default };

//# sourceMappingURL=ControlPanel.mjs.map