import {FormattedMessage, intlShape, defineMessages} from 'react-intl';
import PropTypes from 'prop-types';
import React from 'react';
import Box from '../box/box.jsx';
import PlayButton from '../../containers/play-button.jsx';
import styles from './library-item.css';
import classNames from 'classnames';
import bluetoothIconURL from './bluetooth.svg';
import internetConnectionIconURL from './internet-connection.svg';
import favoritedFilledUrl from './favorite/filled.svg';
import favoritedOutlineUrl from './favorite/outline.svg';
import deleteFilledUrl from './delete/filled.svg';
import downloadFilled from './download/filled.svg';
const getURLOrigin = (url) => {
let urlObj;
try {
urlObj = new URL(url);
} catch {
// not a valid URL
return String(url);
}
return urlObj.origin;
};
const getMSFormatted = (ms) => {
return (ms / 1000).toFixed(2);
};
/* eslint-disable react/prefer-stateless-function */
class LibraryItemComponent extends React.PureComponent {
render() {
return this.props.featured ? (
{this.props.disabled ? (
) : null}
{(this.props.insetIconURL && !this.props.customInsetColor) ? (
) : null}
{(this.props.insetIconURL && this.props.customInsetColor) ? (
) : null}
{(this.props.favoritable && !this.props.deletable) ? (
) : null}
{this.props.deletable && (
)}
{this.props.name}
{this.props.description}
{this.props.custom && (
<>
{this.props.extensionId.startsWith("data:") ? (
{this.props._unsandboxed ?
(
) : (
)}
) : (
)}
{this.props.extensionId.startsWith("data:") ? (
) : (
{getURLOrigin(this.props.extensionId)}
)}
>
)}
{
this.props.bluetoothRequired ||
this.props.internetConnectionRequired ||
this.props.collaborator ||
this.props.extDeveloper ||
this.props.twDeveloper ||
this.props.eventSubmittor ||
this.props.credits
? (
{this.props.bluetoothRequired || this.props.internetConnectionRequired ? (
{this.props.bluetoothRequired ? (

) : null}
{this.props.internetConnectionRequired ? (

) : null}
) : null}
{this.props.collaborator ? (
{this.props.collaborator}
) : null}
{this.props.twDeveloper ? (
Originally for TurboWarp by
{this.props.twDeveloper}
) : null}
{this.props.extDeveloper ? (
Created by
{this.props.extDeveloper}
) : null}
{this.props.eventSubmittor ? (
Event Submission by
{this.props.eventSubmittor}
) : null}
{this.props.credits ? (
Credits
{this.props.credits}
) : null}
) : null}
) : (