import { AmbientList } from "../../../../UI/dataDisplay/AmbientList.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { FileImageIcon, PDFIcon, WordDocumentIcon } from "@fluentui/react-icons";
//#region src/udp/pages/UdpTransactionsPage/components/AttachmentTransactionAttachmentList.jsx
const AttachmentTransactionAttachmentList = (props) => {
	const $ = c(9);
	const { attachments, setSelectedAttachment } = props;
	let t0;
	if ($[0] !== attachments) {
		t0 = attachments.map(_temp);
		$[0] = attachments;
		$[1] = t0;
	} else t0 = $[1];
	const formattedAttachments = t0;
	const getFileIcon = _temp2;
	let t1;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = {
			primaryText: "attachmentName",
			secondaryText: "description"
		};
		$[2] = t1;
	} else t1 = $[2];
	let t2;
	if ($[3] !== setSelectedAttachment) {
		t2 = (item_0) => {
			setSelectedAttachment(item_0);
		};
		$[3] = setSelectedAttachment;
		$[4] = t2;
	} else t2 = $[4];
	let t3;
	if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = (item_1) => getFileIcon(item_1);
		$[5] = t3;
	} else t3 = $[5];
	let t4;
	if ($[6] !== formattedAttachments || $[7] !== t2) {
		t4 = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(AmbientList, {
			data: formattedAttachments,
			useAvatar: false,
			fieldConfig: t1,
			onItemClick: t2,
			getItemIcon: t3,
			listHeight: "calc(100vh - 105px)",
			maxHeight: "calc(100vh - 105px)"
		}));
		$[6] = formattedAttachments;
		$[7] = t2;
		$[8] = t4;
	} else t4 = $[8];
	return t4;
};
function _temp(attachment) {
	return {
		attachmentName: attachment.fileName,
		extension: attachment.extension,
		transactionAttachmentId: attachment.transactionAttachmentId
	};
}
function _temp2(item) {
	if (item.attachmentName.includes(".pdf")) return PDFIcon;
	else if (item.attachmentName.includes(".docx")) return WordDocumentIcon;
	else if (item.attachmentName.includes(".")) return FileImageIcon;
}
//#endregion
export { AttachmentTransactionAttachmentList as default };

//# sourceMappingURL=AttachmentTransactionAttachmentList.mjs.map