import React, { ForwardedRef, useContext } from 'react';
import { OriginIconProps } from '../type';
import { Context } from '../context';

function IconPinComponent(props: OriginIconProps, ref: ForwardedRef<SVGSVGElement>) {
    const { prefix: prefixFromContext } = useContext(Context);
    const { className = '', prefix: prefixFromProps, width = '1em', height = '1em', useCurrentColor = true, spin, ...rest } = props;

    const prefix = prefixFromProps || prefixFromContext || 'hiagent';
    const loadingKls = spin ? ` ${prefix}-icon-loading` : '';
    return <svg className={`${prefix}-icon ${prefix}-icon-pin${loadingKls} ${className}`} width={width} height={height} xmlns="http://www.w3.org/2000/svg" fill={useCurrentColor ? 'currentColor' : '#000'} viewBox="0 0 16 16" {...rest} ref={ref}><path d="M10.7846 2.12278C9.89943 1.82864 8.92924 2.39214 8.55089 3.24471C8.33804 3.72435 8.33016 4.2158 8.52388 4.79584C7.72686 5.40755 7.22308 5.55656 6.22756 5.55656C4.86703 5.55656 3.97892 5.72065 3.37497 6.32452V6.34322C3.24055 6.47637 3.13384 6.63484 3.06102 6.80947C2.9882 6.9841 2.95071 7.17142 2.95071 7.36062C2.95071 7.54982 2.9882 7.73715 3.06102 7.91177C3.13384 8.0864 3.24055 8.24487 3.37497 8.37803L5.06432 10.0804L2.18579 12.958C1.95049 13.1933 1.93239 13.5878 2.16769 13.8231C2.40359 14.059 2.79999 14.059 3.03529 13.8231L5.92529 10.9335L7.61706 12.6172C7.75037 12.7515 7.90898 12.8582 8.08372 12.931C8.25847 13.0038 8.44589 13.0412 8.63519 13.0412C8.82449 13.0412 9.01192 13.0038 9.18666 12.931C9.36141 12.8582 9.52001 12.7515 9.65333 12.6172H9.67203C10.2766 12.0139 10.4455 11.2393 10.4455 9.77217C10.4455 8.83953 10.6368 8.18136 11.2166 7.48882C11.8461 7.67333 12.3269 7.65402 12.7908 7.43782C13.6267 7.0482 14.1672 6.08803 13.8767 5.2127C13.6354 4.49411 13.2285 3.84233 12.6887 3.31C12.1558 2.77054 11.5036 2.36386 10.7846 2.12278ZM9.73883 3.58592C9.91372 3.3023 10.2778 3.20089 10.5854 3.32897C11.0475 3.52141 11.485 3.83957 11.8223 4.17689C12.1638 4.51791 12.4674 4.91619 12.6677 5.40064C12.801 5.72308 12.698 6.10874 12.3959 6.28331C12.0453 6.48587 11.7461 6.4475 11.3312 6.2292C11.102 6.10794 10.8105 6.15078 10.6271 6.33417C9.52844 7.43211 9.23944 8.4281 9.23944 9.77278C9.23944 10.9431 9.17066 11.3775 8.80503 11.7696C8.70247 11.8806 8.56068 11.8637 8.46596 11.7696L4.22447 7.53104C4.20325 7.51193 4.18601 7.48882 4.17373 7.46303C4.16146 7.43724 4.15439 7.40929 4.15293 7.38077C4.15147 7.35225 4.15566 7.32372 4.16524 7.29681C4.17483 7.26991 4.18962 7.24516 4.20879 7.22398C4.42418 6.96156 4.90384 6.75766 6.22274 6.75826C7.79927 6.75947 8.63731 6.35347 9.67264 5.38282C9.85666 5.19943 9.90191 4.91831 9.78607 4.68605C9.55883 4.23163 9.52401 3.9343 9.73883 3.58592Z"/></svg>;
}

const IconPin = React.forwardRef(IconPinComponent);
export default IconPin;
