import { __assign } from "tslib";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import cx from 'classnames';
import getTextPosition from './position';
var DEFAULT_WIDTH = 19;
var DEFAULT_HEIGHT = 23;
var DEFAULT_SIZE = 40;
export default function YouzanIcon(_a) {
    var size = _a.size, text = _a.text, textPosition = _a.textPosition, colorPreset = _a.colorPreset, _b = _a.textSize, textSize = _b === void 0 ? 14 : _b;
    size = size || DEFAULT_SIZE;
    return (_jsxs("div", __assign({ className: cx('zent-loading-icon-and-text', 'zent-loading-icon-and-text--youzan', "zent-loading-color-preset--" + colorPreset, getTextPosition(textPosition)), "data-zv": 'v10.0.12' }, { children: [_jsx("div", __assign({ className: "zent-loading-icon zent-loading-icon-youzan", style: { height: size, width: size }, "data-zv": 'v10.0.12' }, { children: _jsx(YouzanSvg, { size: size }, void 0) }), void 0), text && (_jsx("div", __assign({ className: "zent-loading-icon-text", style: { fontSize: textSize + "px" }, "data-zv": 'v10.0.12' }, { children: text }), void 0))] }), void 0));
}
function YouzanSvg(_a) {
    var size = _a.size;
    return (_jsx("svg", __assign({ width: scaleSvgSize(size, DEFAULT_WIDTH), height: scaleSvgSize(size, DEFAULT_HEIGHT), viewBox: "0 0 " + DEFAULT_WIDTH + " " + DEFAULT_HEIGHT, xmlns: "http://www.w3.org/2000/svg", className: "zent-loading-icon-youzan-svg", "data-zv": 'v10.0.12' }, { children: _jsx("path", { d: "M4.649 22.4V11.573c3.245-.966 4.18-10.27 4.18-10.27.084-.621.64-1.204 1.252-1.3l-.21.033C11.495-.22 12.71.92 12.583 2.58l-.337 4.43c-.046.613.404 1.051 1.006.98l4.005-.482c1.216-.146 1.97.714 1.682 1.92 0 0-.135.403-.21 1.111-.073.708.312.96.23 1.986-.08 1.027-.411 1.154-.479 1.944s.174.888.122 1.628c-.068.955-.434 1.205-.508 1.66-.074.457.01.779.01.779.081.904-.55 1.753-1.435 1.898L4.649 22.4zM3.568 11.801v10.776l-2.5.409C.478 23.082 0 22.67 0 22.064v-8.762c0-.454.357-.89.797-.972 0 0 1.64-.307 2.77-.529z", fillRule: "evenodd", "data-zv": 'v10.0.12' }, void 0) }), void 0));
}
function scaleSvgSize(size, value) {
    return (size / DEFAULT_SIZE) * value;
}
