1// SPDX-License-Identifier: GPL-2.0-only
2// Copyright (c) 2026-present FERS Contributors (see AUTHORS.md).
4import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
18} from '@mui/material';
19import { useState } from 'react';
20import catch2License from '../../../../THIRD_PARTY_LICENSES/catch2-LICENSE.txt?raw';
21import geoLibLicense from '../../../../THIRD_PARTY_LICENSES/GeographicLib-LICENSE.txt?raw';
22import highFiveLicense from '../../../../THIRD_PARTY_LICENSES/HighFive-LICENSE.txt?raw';
23import jsLicenses from '../../../../THIRD_PARTY_LICENSES/js-licenses.txt?raw';
24import hdf5License from '../../../../THIRD_PARTY_LICENSES/libhdf5-LICENSE.txt?raw';
25import libxml2License from '../../../../THIRD_PARTY_LICENSES/libxml2-LICENSE.txt?raw';
26import nlohmannLicense from '../../../../THIRD_PARTY_LICENSES/nlohmann-json-LICENSE.txt?raw';
27import rustLicenses from '../../../../THIRD_PARTY_LICENSES/rust-licenses.html?raw';
29interface LicensesDialogProps {
35 { name: 'Catch2', content: catch2License },
36 { name: 'GeographicLib', content: geoLibLicense },
37 { name: 'HDF5', content: hdf5License },
38 { name: 'HighFive', content: highFiveLicense },
39 { name: 'libxml2', content: libxml2License },
40 { name: 'nlohmann/json', content: nlohmannLicense },
43const licensePreStyle: React.CSSProperties = {
45 whiteSpace: 'pre-wrap',
46 wordBreak: 'break-word',
50export default function LicensesDialog({ open, onClose }: LicensesDialogProps) {
51 const [tab, setTab] = useState(0);
59 PaperProps={{ sx: { height: '80vh' } }}
61 <DialogTitle>Third-Party Licenses</DialogTitle>
65 flexDirection: 'column',
72 onChange={(_e, v: number) => setTab(v)}
73 sx={{ borderBottom: 1, borderColor: 'divider', px: 2 }}
75 <Tab label="JavaScript" />
80 <Box sx={{ flex: 1, overflow: 'auto', p: 1 }}>
81 <pre style={licensePreStyle}>{jsLicenses}</pre>
85 <Box sx={{ flex: 1, overflow: 'hidden' }}>
93 sandbox="allow-same-origin"
94 title="Rust third-party licenses"
99 <Box sx={{ flex: 1, overflow: 'auto' }}>
100 {cppLibraries.map(({ name, content }) => (
108 expandIcon={<ExpandMoreIcon />}
110 <Typography variant="body2">
115 <pre style={licensePreStyle}>{content}</pre>
123 <Button onClick={onClose}>Close</Button>