/*
 * 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 = ["M2.79 4.61c-.13.17-.29.3-.48.41-.18.11-.39.18-.62.23-.23.04-.46.07-.71.07v1.03h1.74V12h1.26V4h-.94c-.04.23-.12.44-.25.61m4.37 5.31c.18-.14.37-.28.58-.42l.63-.45c.21-.16.41-.33.61-.51s.37-.38.52-.59.28-.45.37-.7.13-.54.13-.85c0-.25-.04-.52-.12-.8-.07-.29-.2-.55-.39-.79a2.2 2.2 0 0 0-.73-.6c-.29-.15-.66-.23-1.11-.23-.41 0-.77.08-1.08.23-.31.16-.58.37-.79.64-.22.27-.38.59-.49.96s-.16.77-.16 1.2h1.19c.01-.27.03-.53.08-.77.04-.24.11-.45.21-.62.09-.18.22-.32.38-.42s.35-.15.59-.15c.26 0 .47.05.63.14.15.09.28.21.37.35q.135.21.18.45c.03.16.05.31.05.45-.01.31-.08.58-.22.82-.14.23-.32.45-.53.65-.22.21-.46.39-.71.57q-.39.27-.75.54c-.5.36-.89.78-1.17 1.27S5 11.35 4.99 12h5v-1.15H6.43c.05-.17.14-.33.27-.49.13-.15.29-.29.46-.44m8.5-1.56c-.23-.35-.54-.57-.95-.65v-.02c.34-.13.6-.34.76-.63q.24-.435.24-1.02c0-.34-.06-.64-.19-.9s-.3-.47-.51-.64-.45-.3-.72-.38c-.27-.09-.54-.13-.82-.13-.36 0-.68.07-.96.2s-.53.32-.72.55c-.2.23-.36.51-.47.83s-.18.66-.19 1.04h1.15c-.01-.2.01-.39.06-.58s.12-.36.22-.51.22-.27.37-.36.32-.13.53-.13c.32 0 .59.1.79.3.21.2.31.46.31.79 0 .23-.05.43-.14.59s-.21.29-.35.38c-.15.09-.32.16-.51.19-.19.04-.38.05-.57.04v.93c.23-.01.45 0 .67.02s.42.08.59.17c.18.09.32.23.43.4.11.18.16.41.16.71q0 .66-.39 1.02c-.26.24-.58.36-.97.36-.45 0-.79-.16-1.02-.47s-.33-.7-.32-1.17H11c.01.4.06.77.17 1.1s.26.61.47.85c.21.23.46.42.77.54.31.13.67.19 1.08.19.34 0 .66-.05.96-.16s.57-.27.8-.47.41-.45.55-.74c.13-.27.2-.6.2-.97 0-.5-.11-.92-.34-1.27"] as readonly string[];

/** Path data for the 20px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_20 = ["M2.39 5.75c-.17.21-.38.39-.63.52s-.52.23-.83.29c-.3.05-.61.08-.93.08v1.24h2.49V15h1.49V4.98H2.73c-.05.31-.17.57-.34.77m17.2 4.71c-.27-.44-.65-.71-1.14-.82v-.02c.42-.16.72-.43.92-.79s.29-.79.29-1.27c0-.42-.08-.8-.23-1.12-.15-.33-.36-.59-.62-.8q-.39-.315-.87-.48c-.32-.11-.65-.16-.98-.16-.43 0-.82.08-1.16.25q-.51.24-.87.69c-.24.29-.43.64-.57 1.04s-.22.83-.23 1.3h1.39c-.01-.25.02-.49.07-.72.06-.23.14-.44.26-.63q.18-.285.45-.45c.18-.11.39-.17.63-.17.39 0 .71.12.96.37s.37.58.37.99c0 .29-.05.54-.16.74s-.25.36-.43.47-.38.19-.61.24-.46.06-.68.05v1.17q.42-.015.81.03c.26.03.5.1.71.21s.38.28.51.5.2.52.2.89c0 .55-.16.97-.47 1.27q-.465.45-1.17.45c-.55 0-.95-.19-1.23-.58-.27-.39-.4-.88-.38-1.46h-1.39q.015.75.21 1.38c.13.41.32.77.57 1.06s.56.52.93.68.8.24 1.3.24c.41 0 .79-.07 1.16-.21s.69-.33.96-.58c.28-.25.5-.56.66-.92a3 3 0 0 0 .24-1.23c0-.64-.14-1.17-.41-1.61M8.58 12.41c.21-.18.45-.36.7-.53.25-.18.5-.36.75-.56s.49-.41.73-.63c.23-.22.44-.47.63-.74.18-.27.33-.56.44-.88s.16-.67.16-1.07c0-.32-.05-.65-.14-1s-.25-.68-.47-.97c-.22-.3-.51-.55-.87-.74-.36-.2-.81-.29-1.35-.29-.49 0-.93.1-1.3.29-.37.18-.69.44-.95.78-.26.33-.45.73-.58 1.2-.13.46-.2.96-.2 1.5h1.43c.01-.35.04-.67.09-.97s.14-.56.25-.78.26-.39.45-.52.43-.19.71-.19q.465 0 .75.18c.19.12.34.26.45.43s.18.36.22.56q.06.3.06.57c-.01.38-.1.72-.26 1.02-.15.3-.37.57-.63.83-.26.25-.54.49-.85.71s-.61.45-.89.68c-.6.45-1.06.98-1.41 1.58-.35.61-.52 1.32-.53 2.13h6.01v-1.43H7.69c.06-.21.17-.42.33-.61s.34-.38.56-.55"] as readonly string[];

export const Numerical: 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="numerical" ref={ref} {...props}>
            {paths.map((d, i) => (
                <path key={i} d={d} fillRule="evenodd" />
            ))}
        </SVGIconContainer>
    );
});
Numerical.displayName = `Blueprint6.Icon.Numerical`;
export default Numerical;
