import React__default from 'react';
import classnames from 'classnames';

var styles = {"base":"j4h-0Mxa5gk-","spinning":"vNKBQk0oak4-"};

var fontSizes = {"extravagant":"_1CXlSTO0w8g-","jumbo":"v5TK2OwNTaI-","largest":"CcGPmsMUVfg-","larger":"ETyC5vbbImA-","large":"ejYSlnHYn2U-","base":"e9lFMke1PNs-","small":"MiITdlbzofc-","smaller":"hs1hcOgrK1s-","spinning":"wbsSTlLw-cA-"};

var fontWeights = {"regular":"xFJ-FmjV3BE-","medium":"lY4vnCuusH8-","semiBold":"Ed96FZ8bmYo-","bold":"-bqxOwZMSDo-","extraBold":"l5JkUWFite8-","black":"HvKryt1SNY8-","spinning":"dPnxB36JG4c-"};

var textCases = {"uppercase":"S3PyGdaGxok-","lowercase":"lVlhmM5z9HI-","capitalize":"l9xfdEljFWk-","none":"WYUkes21iUI-","spinning":"Ecloe7K6Yu8-"};

var textColors = {"blue":"xNqFL54SrGc-","grey":"_9XmiMJWBidk-","greyBlueDark":"YH-Ui-YO87Y-","greyBlue":"toTsY437NnI-","green":"kLSKP1vv9b4-","red":"dGbLHIIa2tg-","yellow":"iDhXEr90lmw-","yellowDark":"Zd6zWN667b8-","lightBlue":"Ow1VL-p-XhU-","white":"tjk-wmwQD90-","heading":"chgZm2n2hOE-","text":"_8oFzBDE3jjc-","textSecondary":"_11dDD6Bevzg-","textReverse":"p5ApkSwZjq0-","textReverseSecondary":"_9B7y2Rolgi0-","inactive":"KcLyzgXTFOg-","inactiveSurface":"NVEczc1ccSM-","inactiveOnSurface":"NzaurLF4evU-","critical":"ccJADkeLhqU-","criticalSurface":"tGUW6TarfTI-","criticalOnSurface":"EZFKvApYUj0-","warning":"BRfXcULzta0-","warningSurface":"TX1xRvUTyok-","warningOnSurface":"gqCfjcHeyCM-","informative":"R8k7IbtgzXw-","informativeSurface":"dZSsqXLWAtw-","informativeOnSurface":"WoGRj2nogwI-","success":"cL8YC7STZfE-","successSurface":"zxUNOjTz9Lo-","successOnSurface":"lTHVY-6IKCk-","interactive":"_5NTP-4BzjTg-","interactiveHover":"tpbvo9fRR-8-","interactiveSubtle":"_-6PZfT3dO50-","interactiveSubtleHover":"tCL7-y7NKnY-","destructive":"wwJus4JU5-4-","destructiveHover":"Rvl8jGKrctM-","disabled":"W4Fsewoz1sg-","disabledSecondary":"_3rSuYq9be8I-","request":"aY3San0Gck0-","requestSurface":"xXX19zFoC24-","requestOnSurface":"mEIRK0sLVbA-","quote":"_-7CeSb2DQ7M-","quoteSurface":"Eb9Q6w4B2D0-","quoteOnSurface":"_47qR8-iD3lc-","job":"uCsWd-HbMDM-","jobSurface":"irItG41tQ1w-","jobOnSurface":"_9IHQ5tL6Exw-","visit":"_1y0GOpU3H4Y-","visitSurface":"_2g40AOBv0x0-","visitOnSurface":"_9UQelzX7Fhg-","task":"z-Ho8kjzWZI-","taskSurface":"p30GI6A0yLM-","taskOnSurface":"_6--pR0XX5vo-","event":"e8Y0-dOgpfU-","eventSurface":"lCLmy5Qcc9g-","eventOnSurface":"RNQy-epp3kE-","invoice":"VWLmf5fDD1w-","invoiceSurface":"_7TbmvrX-5Ew-","invoiceOnSurface":"zBkhaAkBx9k-","payments":"mMBOrDRKDtA-","paymentsSurface":"HyBFi4GZ6Bk-","paymentsOnSurface":"_3RdwgIvvnZo-","client":"AF5NaNenMJw-","icon":"gqwEwru23Xk-","brand":"_1O41QsHJDwo-","spinning":"_3aHK4rm4pXU-"};

var emphasis = {"italic":"ws2Y0LqNNfk-","highlight":"kw63z71hYYU-","spinning":"ki-I8aPAhmA-"};

var truncate = {"textTruncate":"bvnCrlndVHs-","spinning":"kdOkoNCczRo-"};

var alignment = {"start":"r5lyOVfBlMI-","center":"w1MIwv35jXA-","end":"oOJPwUQFllQ-","spinning":"geH1XNdqO8M-"};

var fontFamilies = {"base":"V9SSKxs15xE-","display":"dvw7zxC9s9g-","spinning":"NBpK9JnmLJ4-"};

var underlineStyles = {"basicUnderline":"qp8E5e4q-so-","spinning":"F-Ybr7sJi6Q-"};

function Typography({ id, children, element: Tag = "p", size, align, fontWeight = "regular", textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, UNSAFE_className, UNSAFE_style, }) {
    const shouldTruncateText = numberOfLines && numberOfLines > 0;
    const className = classnames(styles.base, fontWeights[fontWeight], size && fontSizes[size], textCase && textCases[textCase], textColor && textColors[textColor], emphasisType && emphasis[emphasisType], fontFamily && fontFamilies[fontFamily], shouldTruncateText && truncate.textTruncate, underline && underlineStyles.basicUnderline, Object.assign({}, (align && { [alignment[align]]: align !== `start` })), UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.textStyle);
    const truncateStyles = shouldTruncateText
        ? {
            WebkitLineClamp: numberOfLines,
            WebkitBoxOrient: "vertical",
        }
        : {};
    const underlineInlineStyles = computeUnderlineStyles(underline, textColor);
    return (React__default.createElement(Tag, { id: id, className: className, style: Object.assign(Object.assign(Object.assign({}, truncateStyles), underlineInlineStyles), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.textStyle) }, children));
}
function computeUnderlineStyles(underline, textColor) {
    if (!underline) {
        return {};
    }
    const [underlineStyle, underlineColor] = underline.split(" ");
    const underlineInlineStyles = {
        textDecorationStyle: underlineStyle,
    };
    if (underlineColor) {
        underlineInlineStyles.textDecorationColor = `var(--${underlineColor})`;
    }
    else if (textColor) {
        underlineInlineStyles.textDecorationColor = textColors[textColor];
    }
    return underlineInlineStyles;
}

export { Typography as T };
