/*
 * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import * as React from "react";
import type { SVGIconProps } from "../../svgIconProps";
import { IconSize } from "../../iconTypes";
import { SVGIconContainer } from "../../svgIconContainer";

/** Path data for the 16px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_16 = ["M4.448 9q.146.436.325.795l.012.025a2 2 0 0 0 .185.92c.055.197.143.383.26.55q.107.141.24.26a4 4 0 0 0 .202.441 6 6 0 1 1 6.254-6.933 3 3 0 0 0-.336-.018 3 3 0 0 0-.5 0l-.177.028A5 5 0 0 0 10.584 4H8.829q.09.5.133 1.037A4 4 0 0 0 8.46 5a3.4 3.4 0 0 0-.502.042A10 10 0 0 0 7.812 4H4.188C4.068 4.609 4 5.283 4 6s.068 1.391.188 2h.995a9 9 0 0 0-.083.87 2 2 0 0 0-.079.13zM3.171 8C3.06 7.374 3 6.701 3 6s.06-1.374.17-2H1.417A5 5 0 0 0 1 6c0 .711.148 1.388.416 2zM2 9a5 5 0 0 0 2.086 1.62A6.8 6.8 0 0 1 3.401 9zm2.448-6h3.104a6 6 0 0 0-.325-.795C6.737 1.225 6.246 1 6 1s-.737.225-1.227 1.205q-.179.358-.325.795m4.15 0H10a5 5 0 0 0-2.086-1.62c.273.453.506 1.002.685 1.62M4.087 1.38A5 5 0 0 0 2 3h1.4a6.8 6.8 0 0 1 .685-1.62M13.476 16s.118-.385-.172-1.046c-.228-.533-1.172-.915-2.015-1.257a22 22 0 0 1-.584-.243c-.808-.356-.816-.588-.825-.872q-.002-.062-.007-.128v-.139c.314-.284.573-.669.745-1.115 0 0 .008-.023.008-.03q.06-.15.095-.3c.212-.04.33-.27.377-.485a.94.94 0 0 0 .125-.547c-.024-.307-.15-.453-.29-.515v-.054c0-.392-.04-.961-.11-1.33a2 2 0 0 0-.071-.308 2.3 2.3 0 0 0-.8-1.17C9.558 6.162 9.001 6 8.506 6s-1.052.162-1.445.462A2.3 2.3 0 0 0 6.19 7.93c-.07.369-.11.946-.11 1.338v.046c-.14.062-.274.208-.306.523a1 1 0 0 0 .126.547c.047.215.173.453.393.492.02.083.05.172.078.253l.016.047c0 .008.008.015.008.015v.008c.172.454.44.846.761 1.115l-.004.072-.004.06-.007.105c-.016.287-.028.523-.848.894-.176.078-.37.156-.568.237-.847.345-1.802.735-2.031 1.27C3.41 15.616 3.52 16 3.52 16zm2.503-1.25h-1.413a4 4 0 0 0-.116-.294c-.192-.445-.52-.753-.787-.955a5.3 5.3 0 0 0-.873-.517 21 21 0 0 0-1.122-.483l-.02-.008-.235-.097q.216-.347.366-.731c.089-.087.162-.177.22-.26a2 2 0 0 0 .271-.568c.117-.251.24-.64.199-1.105a2 2 0 0 0-.299-.925 9 9 0 0 0-.116-1.083 3.4 3.4 0 0 0-.104-.45 3.5 3.5 0 0 0-.661-1.246A2 2 0 0 1 11.63 6c.432 0 .92.141 1.264.404.33.256.584.612.7 1.023.028.087.049.182.062.27.062.322.097.82.097 1.164v.047c.123.053.233.181.254.45a.8.8 0 0 1-.11.478c-.041.189-.144.391-.33.425a2 2 0 0 1-.082.262c0 .007-.007.027-.007.027-.151.39-.378.727-.653.976v.121q.005.057.006.111v.002c.008.247.015.451.722.762.158.07.332.14.51.213.739.299 1.565.634 1.764 1.1.254.579.151.915.151.915"] as readonly string[];

/** Path data for the 20px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_20 = ["M8 0C3.58 0 0 3.58 0 8a8 8 0 0 0 5.856 7.71q.097-.086.19-.156c.278-.209.595-.383.896-.53.358-.174.81-.358 1.193-.515.206-.084.393-.16.534-.223a4 4 0 0 0 .203-.095 4 4 0 0 1-.305-.45C8.382 13.911 8.19 14 8 14c-.67 0-1.36-1.1-1.73-3h1.252c.047-.296.153-.571.323-.797l.01-.203H6.12C6.05 9.39 6 8.73 6 8s.05-1.39.12-2h3.76l.037.344a3.8 3.8 0 0 1 .979-.295L10.89 6h2.76q.04.116.076.233l.118-.04A3.6 3.6 0 0 1 14.998 6c.247 0 .51.028.772.086A8 8 0 0 0 8 0m5.17 5h-2.44c-.21-1.11-.51-2.03-.91-2.69 1.43.46 2.61 1.43 3.35 2.69M8 2c.67 0 1.36 1.1 1.73 3H6.27C6.64 3.1 7.33 2 8 2m-1.82.31c-.4.66-.71 1.58-.91 2.69H2.83a6.03 6.03 0 0 1 3.35-2.69M2 8c0-.7.13-1.37.35-2h2.76C5.04 6.62 5 7.28 5 8s.04 1.38.11 2H2.35C2.13 9.37 2 8.7 2 8m.83 3h2.44c.21 1.11.51 2.03.91 2.69A6.03 6.03 0 0 1 2.83 11m11.087 4.209c.21.094.444.19.685.288.912.374 1.927.789 2.188 1.355.31.722.186 1.148.186 1.148H6.026s-.13-.426.186-1.148c.256-.584 1.305-1.011 2.234-1.39.22-.088.432-.175.626-.26.909-.4.923-.662.94-.978l.008-.115.003-.072q.004-.037.004-.073a3.1 3.1 0 0 1-.839-1.237l-.007-.007-.003-.01-.003-.01a2 2 0 0 1-.11-.337c-.234-.042-.372-.296-.426-.537a1.05 1.05 0 0 1-.138-.598c.034-.35.179-.509.337-.57v-.056c0-.44.034-1.065.117-1.478q.021-.177.075-.343a2.5 2.5 0 0 1 .887-1.28c.426-.33 1.038-.501 1.58-.501.544 0 1.155.172 1.588.502a2.5 2.5 0 0 1 .963 1.622c.075.413.117 1.045.117 1.478v.062c.15.062.288.22.323.564.02.268-.083.502-.138.598-.048.234-.185.488-.42.537a3 3 0 0 1-.116.364 3.1 3.1 0 0 1-.818 1.224q-.002.084.007.158.006.072.007.14c.011.311.02.57.907.96m1.059-.639c-.24-.098-.455-.186-.65-.274l-.007-.003a4 4 0 0 1-.194-.091c.224-.288.41-.609.554-.946l.001-.002.013-.033q.028-.065.052-.13l.011-.027.016-.04c.105-.092.19-.19.256-.284a1.9 1.9 0 0 0 .265-.562c.105-.227.225-.593.192-1.027l-.001-.011-.002-.011a1.86 1.86 0 0 0-.325-.91 10 10 0 0 0-.12-1.246 3 3 0 0 0-.106-.474l-.001-.007a3.54 3.54 0 0 0-.763-1.353c.27-.092.56-.139.83-.139.495 0 1.05.156 1.444.456a2.27 2.27 0 0 1 .875 1.475c.069.375.106.95.106 1.344v.056c.138.056.263.2.294.513a1 1 0 0 1-.125.543c-.044.213-.169.444-.381.488-.025.1-.056.206-.094.3a2.8 2.8 0 0 1-.756 1.144q-.002.076.006.144.006.065.007.127c.01.283.018.518.824.873.192.086.404.172.623.262.83.34 1.752.717 1.99 1.231.28.657.168 1.044.168 1.044h-2.081a4 4 0 0 0-.188-.542l-.005-.013-.006-.012c-.183-.397-.491-.681-.76-.88a5.6 5.6 0 0 0-.896-.522 17 17 0 0 0-.916-.4z"] as readonly string[];

export const ThirdParty: React.FC<SVGIconProps> = React.forwardRef<any, SVGIconProps>((props, ref) => {
    const isLarge = (props.size ?? IconSize.STANDARD) >= IconSize.LARGE;
    const paths = isLarge ? PATHS_20 : PATHS_16;
    return (
        <SVGIconContainer iconName="third-party" ref={ref} {...props}>
            {paths.map((d, i) => (
                <path key={i} d={d} fillRule="evenodd" />
            ))}
        </SVGIconContainer>
    );
});
ThirdParty.displayName = `Blueprint6.Icon.ThirdParty`;
export default ThirdParty;
