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

function IconAPIComponent(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-API${loadingKls} ${className}`} width={width} height={height} xmlns="http://www.w3.org/2000/svg" fill={useCurrentColor ? 'currentColor' : '#000'} viewBox="0 0 20 20" {...rest} ref={ref}><path d="m15.417 9.167-1.25 1.25-4.583-4.584 1.25-1.25c.625-.625 2.916-1.666 4.583 0 1.667 1.667.625 3.959 0 4.584Z"/><path d="M12.61 2.9c1.06-.16 2.335.034 3.396 1.094 1.06 1.06 1.254 2.337 1.094 3.396-.145.953-.583 1.802-1.009 2.276l-.085.09-1.25 1.25a.833.833 0 0 1-1.178 0L8.994 6.423a.833.833 0 0 1 0-1.179l1.25-1.25c.451-.451 1.35-.94 2.366-1.094Zm2.218 2.273c-.607-.607-1.31-.725-1.97-.625-.702.106-1.262.451-1.436.625l-.66.66 3.405 3.405.66-.66c.174-.174.519-.734.626-1.437.1-.659-.02-1.362-.625-1.968Z"/><path d="M16.91 1.91a.833.833 0 1 1 1.18 1.18l-2.084 2.083a.833.833 0 1 1-1.178-1.179l2.083-2.083ZM4.583 10.833l1.25-1.25 4.583 4.584-1.25 1.25c-.625.625-2.916 1.666-4.583 0-1.667-1.667-.625-3.959 0-4.584Z"/><path d="M5.833 8.75c.221 0 .433.088.59.244l4.583 4.583a.833.833 0 0 1 0 1.179l-1.25 1.25c-.451.451-1.35.94-2.366 1.093-1.06.161-2.335-.033-3.396-1.093-1.06-1.06-1.255-2.337-1.094-3.396.154-1.016.643-1.915 1.094-2.366l1.25-1.25.061-.055a.833.833 0 0 1 .528-.19Zm-.66 2.672c-.174.174-.519.734-.625 1.437-.1.659.018 1.362.625 1.968l.114.109c.58.512 1.236.61 1.854.516.703-.106 1.263-.451 1.437-.625l.66-.66-3.405-3.405-.66.66Z"/><path d="M10.66 11.078a.833.833 0 1 1 1.18 1.178l-1.668 1.666a.833.833 0 0 1-1.178-1.178l1.667-1.666Zm-6.666 3.75a.833.833 0 1 1 1.178 1.178L3.09 18.089a.833.833 0 0 1-1.178-1.178l2.083-2.084Zm3.75-6.668a.833.833 0 1 1 1.179 1.18l-1.667 1.666a.833.833 0 1 1-1.178-1.179l1.666-1.666Z"/></svg>;
}

const IconAPI = React.forwardRef(IconAPIComponent);
export default IconAPI;
