1/**
2 * Copyright (c) 650 Industries.
3 * Copyright (c) Meta Platforms, Inc. and affiliates.
4 *
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8import React from 'react';
9import { StyleSheet, Text, View } from 'react-native';
10import { LogBoxMessage } from '../UI/LogBoxMessage';
11import * as LogBoxStyle from '../UI/LogBoxStyle';
12const SHOW_MORE_MESSAGE_LENGTH = 300;
13function ShowMoreButton({ message, collapsed, onPress, }) {
14    if (message.content.length < SHOW_MORE_MESSAGE_LENGTH || !collapsed) {
15        return null;
16    }
17    return (React.createElement(Text, { style: styles.collapse, onPress: onPress }, "... See More"));
18}
19export function LogBoxInspectorMessageHeader(props) {
20    return (React.createElement(View, { style: styles.body },
21        React.createElement(View, { style: styles.heading },
22            React.createElement(Text, { style: [styles.headingText, styles[props.level]] }, props.title)),
23        React.createElement(Text, { style: styles.bodyText },
24            React.createElement(LogBoxMessage, { maxLength: props.collapsed ? SHOW_MORE_MESSAGE_LENGTH : Infinity, message: props.message, style: styles.messageText }),
25            React.createElement(ShowMoreButton, { ...props }))));
26}
27const styles = StyleSheet.create({
28    body: {
29        backgroundColor: LogBoxStyle.getBackgroundColor(1),
30        boxShadow: `0 2px 0 2px #00000080`,
31    },
32    bodyText: {
33        color: LogBoxStyle.getTextColor(1),
34        fontSize: 14,
35        includeFontPadding: false,
36        lineHeight: 20,
37        fontWeight: '500',
38        paddingHorizontal: 12,
39        paddingBottom: 10,
40    },
41    heading: {
42        alignItems: 'center',
43        flexDirection: 'row',
44        paddingHorizontal: 12,
45        marginTop: 10,
46        marginBottom: 5,
47    },
48    headingText: {
49        flex: 1,
50        fontSize: 20,
51        fontWeight: '600',
52        includeFontPadding: false,
53        lineHeight: 28,
54    },
55    warn: {
56        color: LogBoxStyle.getWarningColor(1),
57    },
58    error: {
59        color: LogBoxStyle.getErrorColor(1),
60    },
61    fatal: {
62        color: LogBoxStyle.getFatalColor(1),
63    },
64    syntax: {
65        color: LogBoxStyle.getFatalColor(1),
66    },
67    static: {
68        color: LogBoxStyle.getFatalColor(1),
69    },
70    messageText: {
71        color: LogBoxStyle.getTextColor(0.6),
72    },
73    collapse: {
74        color: LogBoxStyle.getTextColor(0.7),
75        fontSize: 14,
76        fontWeight: '300',
77        lineHeight: 12,
78    },
79    button: {
80        paddingVertical: 5,
81        paddingHorizontal: 10,
82        borderRadius: 3,
83    },
84});
85//# sourceMappingURL=LogBoxInspectorMessageHeader.js.map