import { jsx, jsxs } from 'react/jsx-runtime';
import { pick, DEFAULT_COLORS } from './characterTypes.js';
import { Head } from './shapes/heads.js';
import { Hair } from './shapes/hair.js';
import { Eyes } from './shapes/eyes.js';
import { Nose } from './shapes/noses.js';
import { Mouth } from './shapes/mouths.js';
import { Outfit } from './shapes/outfits.js';
import { Torso } from './shapes/torsos.js';
import { Arm } from './shapes/arms.js';
import { Leg } from './shapes/legs.js';
import { Headwear } from './shapes/headwear.js';

/** Static character body composed from modular SVG shapes. */
const NiceBodyRenderer = ({ character, size }) => {
    var _a;
    const S = Math.max(120, Math.floor((_a = size !== null && size !== void 0 ? size : character.size) !== null && _a !== void 0 ? _a : 180));
    const k = S / 180;
    const skin = pick(character.face.colors, 0, DEFAULT_COLORS.skin);
    const stroke = pick(character.face.colors, 2, DEFAULT_COLORS.stroke);
    const outfitBase = pick(character.outfit.colors, 0, DEFAULT_COLORS.shirt);
    const armColors = [skin, outfitBase, stroke];
    const legColors = [outfitBase, pick(character.outfit.colors, 1, outfitBase), stroke];
    return (jsx("svg", { width: S, height: S, viewBox: `0 0 ${S} ${S}`, role: "img", children: jsxs("g", { transform: `translate(${S / 2} ${S * 0.86})`, children: [jsx(Leg, { colors: legColors, side: -1, variant: "pants", scale: k, transform: "translate(-16 0)" }), jsx(Leg, { colors: legColors, side: 1, variant: "pants", scale: k, transform: "translate(16 0)" }), jsx(Torso, { variant: "vShape", colors: [skin, "var(--anim-transparent, #00000000)", stroke], scale: k }), jsx(Outfit, { variant: character.outfit.variant, colors: character.outfit.colors, scale: k }), jsx(Arm, { colors: armColors, side: -1, variant: "sleeveShort", scale: k, transform: "translate(-40 -8)" }), jsx(Arm, { colors: armColors, side: 1, variant: "sleeveShort", scale: k, transform: "translate(40 -8)" }), jsxs("g", { transform: "translate(0 -84)", children: [jsx(Head, { variant: character.face.variant, colors: character.face.colors, scale: k }), jsx(Hair, { variant: character.hair.variant, colors: character.hair.colors, scale: k }), jsx(Eyes, { variant: character.eyes.variant, colors: character.eyes.colors, scale: k }), jsx(Nose, { variant: character.nose.variant, colors: character.nose.colors, scale: k }), jsx(Mouth, { variant: character.mouth.variant, colors: character.mouth.colors, scale: k }), jsx(Headwear, { variant: character.headwear.variant, colors: character.headwear.colors, scale: k })] })] }) }));
};
/** @deprecated Use NiceBodyRenderer */
const BodyRenderer = NiceBodyRenderer;

export { BodyRenderer, NiceBodyRenderer, NiceBodyRenderer as default };
//# sourceMappingURL=BodyRenderer.js.map
