/*
 * 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 = ["M8 16c4.41 0 8-3.582 8-8.005S12.41 0 8 0c-.94 0-1.86.16-2.74.48-.52.19-.79.76-.6 1.281s.76.79 1.28.6a6.007 6.007 0 0 1 8.05 5.644 6.007 6.007 0 0 1-8.05 5.643.997.997 0 0 0-1.28.6 1 1 0 0 0 .6 1.282c.88.32 1.8.47 2.74.47m3.71-8.705c.18.18.29.43.29.71s-.11.53-.29.71l-3 3.002a1.003 1.003 0 0 1-1.71-.71c0-.28.11-.53.3-.71l1.29-1.291H1c-.55 0-1-.45-1-1.001s.45-1 1-1h7.59l-1.3-1.291a1.003 1.003 0 0 1 1.42-1.42z"] as readonly string[];

/** Path data for the 20px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_20 = ["M20 10c0 5.51-4.49 10-10 10-1.17 0-2.32-.2-3.42-.6a1 1 0 0 1-.6-1.28c.19-.52.76-.79 1.28-.6.88.32 1.8.48 2.74.48 4.41 0 8-3.59 8-8s-3.59-8-8-8c-.94 0-1.86.16-2.74.48a1 1 0 0 1-1.28-.6A1 1 0 0 1 6.58.6C7.68.2 8.83 0 10 0c5.51 0 10 4.49 10 10m-4.29-.71-4-4a1.003 1.003 0 0 0-1.42 1.42L12.59 9H1a1 1 0 0 0 0 2h11.59l-2.29 2.29c-.19.18-.3.43-.3.71a1.003 1.003 0 0 0 1.71.71l4-4c.18-.18.29-.43.29-.71s-.11-.53-.29-.71"] as readonly string[];

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