{"version":3,"file":"HugeiconsIcon.js","sources":["../../src/HugeiconsIcon.tsx"],"sourcesContent":["import { createElement, forwardRef, ForwardRefExoticComponent, RefAttributes, SVGProps } from 'react';\n\nconst defaultAttributes = {\n  xmlns: 'http://www.w3.org/2000/svg',\n  width: 24,\n  height: 24,\n  viewBox: '0 0 24 24',\n  fill: 'none',\n};\n\nexport type IconSvgElement = readonly (readonly [string, { readonly [key: string]: string | number }])[];\n\nexport type SVGAttributes = Partial<SVGProps<SVGSVGElement>>;\ntype ComponentAttributes = RefAttributes<SVGSVGElement> & SVGAttributes;\n\nexport interface HugeiconsProps extends ComponentAttributes {\n  size?: string | number;\n  strokeWidth?: number;\n  absoluteStrokeWidth?: boolean;\n  altIcon?: IconSvgElement;\n  showAlt?: boolean;\n  icon?: IconSvgElement;\n  primaryColor?: string;\n  secondaryColor?: string;\n  disableSecondaryOpacity?: boolean;\n}\n\nexport interface HugeiconsIconProps extends Omit<HugeiconsProps, 'ref' | 'altIcon'> {\n  icon: IconSvgElement;\n  altIcon?: IconSvgElement;\n}\n\nexport type HugeiconsIcon = ForwardRefExoticComponent<HugeiconsProps>;\n\nexport const HugeiconsIcon = forwardRef<SVGSVGElement, HugeiconsIconProps>(\n  (\n    {\n      color = 'currentColor',\n      size = 24,\n      strokeWidth,\n      absoluteStrokeWidth = false,\n      className = '',\n      altIcon,\n      showAlt = false,\n      icon,\n      primaryColor,\n      secondaryColor,\n      disableSecondaryOpacity = false,\n      ...rest\n    },\n    ref,\n  ) => {\n    const calculatedStrokeWidth = strokeWidth !== undefined\n      ? (absoluteStrokeWidth ? (Number(strokeWidth) * 24) / Number(size) : strokeWidth)\n      : undefined;\n\n    const strokeProps: { stroke?: string; strokeWidth?: number } = calculatedStrokeWidth !== undefined ? {\n      strokeWidth: calculatedStrokeWidth,\n      stroke: 'currentColor'\n    } : {};\n\n    const elementProps = {\n      ref,\n      ...defaultAttributes,\n      width: size,\n      height: size,\n      color: primaryColor || color,\n      className,\n      ...strokeProps,\n      ...rest,\n    };\n\n    const currentIcon = (showAlt && altIcon) ? altIcon : icon;\n\n    // Create SVG children with color handling for two-tone icons\n    const svgChildren = [...currentIcon]\n      .sort(([, a], [, b]) => {\n        const hasOpacityA = a.opacity !== undefined;\n        const hasOpacityB = b.opacity !== undefined;\n        return hasOpacityB ? 1 : hasOpacityA ? -1 : 0;\n      })\n      .map(([tag, attrs]) => {\n        const isSecondaryPath = attrs.opacity !== undefined;\n        const pathOpacity = isSecondaryPath && !disableSecondaryOpacity ? attrs.opacity : undefined;\n\n        // Handle both stroke and fill properties based on element type\n        const fillProps = secondaryColor ? {\n          ...(attrs.stroke !== undefined ? {\n            stroke: isSecondaryPath ? secondaryColor : (primaryColor || color)\n          } : {\n            fill: isSecondaryPath ? secondaryColor : (primaryColor || color)\n          })\n        } : {};\n\n        return createElement(tag, { \n          ...attrs,\n          ...strokeProps,\n          ...fillProps,\n          opacity: pathOpacity,\n          key: attrs.key \n        });\n      });\n\n    return createElement(\n      'svg',\n      elementProps,\n      svgChildren\n    );\n  },\n);\n\nHugeiconsIcon.displayName = 'HugeiconsIcon';\n\nexport default HugeiconsIcon; "],"names":[],"mappings":";;AAEA,MAAM,iBAAiB,GAAG;AACxB,IAAA,KAAK,EAAE,4BAA4B;AACnC,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,OAAO,EAAE,WAAW;AACpB,IAAA,IAAI,EAAE,MAAM;CACb,CAAC;MA0BW,aAAa,GAAG,UAAU,CACrC,CACE,EACE,KAAK,GAAG,cAAc,EACtB,IAAI,GAAG,EAAE,EACT,WAAW,EACX,mBAAmB,GAAG,KAAK,EAC3B,SAAS,GAAG,EAAE,EACd,OAAO,EACP,OAAO,GAAG,KAAK,EACf,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,uBAAuB,GAAG,KAAK,EAC/B,GAAG,IAAI,EACR,EACD,GAAG,KACD;AACF,IAAA,MAAM,qBAAqB,GAAG,WAAW,KAAK,S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