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

function IconKitComponent(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-kit${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 fillRule="evenodd" d="M9.728 2c.728 0 1.318.59 1.318 1.318v.763h1.11c1.11 0 2.012.901 2.012 2.012v5.896a2.012 2.012 0 0 1-2.012 2.012H3.832c-1.111 0-2.012-.9-2.012-2.012V6.093c0-1.111.901-2.012 2.012-2.012h1.11v-.763C4.942 2.591 5.532 2 6.26 2h3.468ZM3.07 11.99c0 .42.342.762.763.762h8.324a.763.763 0 0 0 .763-.763V8.104H10.7v1.804a.625.625 0 0 1-1.25 0V8.104H6.539v1.804a.625.625 0 0 1-1.25 0V8.104H3.07v3.885Zm.763-6.66a.763.763 0 0 0-.763.763v.763h9.85v-.763a.763.763 0 0 0-.763-.763H3.832ZM6.26 3.25a.07.07 0 0 0-.07.07v.762h3.608v-.763a.07.07 0 0 0-.07-.069H6.26Z" clipRule="evenodd"/></svg>;
}

const IconKit = React.forwardRef(IconKitComponent);
export default IconKit;
