/*
 * 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 = ["M14 2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zM8 5.848c0-.693-.875-.943-1.257-.427l-.07.113L5.5 7.882 4.326 5.534l-.07-.113C3.877 4.905 3 5.155 3 5.848V10.5a.5.5 0 0 0 1 0V7.118l.605 1.211a1 1 0 0 0 1.79 0L7 7.12v3.38a.5.5 0 0 0 1 0zM11.5 5a.5.5 0 0 0-.5.5v3.793l-.646-.647-.079-.064a.5.5 0 0 0-.693.693l.064.079 1.43 1.43a.6.6 0 0 0 .848 0l1.43-1.43a.5.5 0 1 0-.707-.708L12 9.293V5.5a.5.5 0 0 0-.5-.5"] as readonly string[];

/** Path data for the 20px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_20 = ["M18 2a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm-8 4.818c0-1.043-1.303-1.484-1.943-.707l-.06.08L6.5 8.34 5.003 6.19l-.06-.079C4.303 5.334 3 5.775 3 6.818V13a1 1 0 1 0 2 0V9.687l.269.386.12.15a1.5 1.5 0 0 0 2.342-.15L8 9.687V13a1 1 0 1 0 2 0zM14 6a1 1 0 0 0-1 1v3.236l-.731-.877-.07-.075a1.001 1.001 0 0 0-1.53 1.275l.062.082 2.347 2.815.084.089a1 1 0 0 0 1.671.007q.045-.045.089-.096l2.347-2.815.061-.082a1.001 1.001 0 0 0-1.53-1.275l-.069.075-.731.877V7a1 1 0 0 0-1-1"] as readonly string[];

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