/*
 * 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 10a1 1 0 1 1 0 2h-.585l2.292 2.293a1 1 0 0 1-1.32 1.497l-.094-.083L12 13.415V14a1 1 0 1 1-2 0l.003-3.075.012-.1.012-.059.033-.108.034-.081.052-.098.067-.096.08-.09a1 1 0 0 1 .112-.097l.11-.071.143-.065.076-.024.091-.02.116-.014zM6.036 6.136l-3.45 3.45-.117.127a2 2 0 0 0 2.818 2.818l.127-.117 3.45-3.449a4 4 0 0 1-.885 3.704l-.15.16-1 1A4 4 0 0 1 1.02 8.33l.15-.16 1-1a4 4 0 0 1 3.865-1.035m4.671-1.843a1 1 0 0 1 .083 1.32l-.083.094-5 5a1 1 0 0 1-1.497-1.32l.083-.094 5-5a1 1 0 0 1 1.414 0m3.121-3.121a4 4 0 0 1 .151 5.497l-.15.16-1 1a4 4 0 0 1-3.864 1.036l3.45-3.45.116-.128a2 2 0 0 0-2.818-2.818l-.127.117-3.45 3.45A4 4 0 0 1 7.02 2.33l.15-.16 1-1a4 4 0 0 1 5.657 0"] as readonly string[];

/** Path data for the 20px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_20 = ["m18.387 19.79-.094-.083L14 15.415V18a1 1 0 0 1-2 0l.003-5.075.017-.126.03-.111.044-.111.052-.098.067-.096.08-.09a1 1 0 0 1 .112-.097l.11-.071.114-.054.105-.035.15-.03L13 12h5a1 1 0 1 1 0 2h-2.585l4.292 4.293a1 1 0 0 1-1.32 1.497M7.036 9.136l-4.45 4.45-.117.127a2 2 0 0 0 2.818 2.818l.127-.117 4.45-4.449a4 4 0 0 1-.885 3.704l-.15.16-2 2A4 4 0 0 1 1.02 12.33l.15-.16 2-2a4 4 0 0 1 3.865-1.035m6.671-3.843a1 1 0 0 1 .083 1.32l-.083.094-7 7a1 1 0 0 1-1.497-1.32l.083-.094 7-7a1 1 0 0 1 1.414 0m4.121-4.121a4 4 0 0 1 .151 5.497l-.15.16-2 2a4 4 0 0 1-3.864 1.036l4.45-4.45.116-.128a2 2 0 0 0-2.818-2.818l-.127.117-4.45 4.45a4 4 0 0 1 .885-3.705l.15-.16 2-2a4 4 0 0 1 5.657 0"] as readonly string[];

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