{"version":3,"names":["getIconObject","src","isIcon","undefined","active","inactive","getSVGIconObject","isSVGIcon","isNullOrUndefined","data","toBeDetermined","isNullOrUndefinedOrEmpty","_a","_b"],"sources":["src/components/core/interfaces/Icon.ts"],"sourcesContent":["import { isNullOrUndefined, isNullOrUndefinedOrEmpty } from 'utils/collection';\n\n/**\n * An interface for an icon object\n */\nexport interface IconObject {\n active: string;\n inactive: string;\n}\n\n/**\n * An interface for an svg icon object\n */\nexport interface SvgIconObject {\n active: SVGIconData;\n inactive: SVGIconData;\n}\n\n/**\n * An interface for an SVG image\n */\nexport interface SVGIconData {\n /* the path data for the SVG image */\n data: string;\n\n /* the height of the image */\n height: number;\n\n /* the width of the image */\n width: number;\n}\n\n/**\n * Describes an icon type.\n * @docs\n * @global\n */\nexport type Icon = IconObject | string;\n\n/**\n * Describes an icon type.\n * @docs\n * @global\n */\nexport type SVGIcon = SvgIconObject | SVGIconData;\n\n/**\n * Given an icon object or string (src), this function will return the full object that describes an icon type.\n * That way we can \"combine\" the two possible inputs (string or obj) and work with objects as a result.\n * @param {Icon} src The icon type\n * @returns {IconObject} The icon object\n */\nexport const getIconObject = (src: Icon): IconObject => {\n if (!isIcon(src)) {\n return undefined;\n }\n if (typeof src === 'string') {\n return {\n active: src,\n inactive: src,\n };\n }\n\n return src;\n};\n\n/**\n * Given a single svg icon object or an active-inactive combination, this function will return a full combination.\n * @param {SVGIcon} src The icon type\n * @returns {SvgIconObject} The icon object\n */\nexport const getSVGIconObject = (src: SVGIcon): SvgIconObject => {\n if (!isSVGIcon(src)) {\n return undefined;\n }\n if (!isNullOrUndefined((src as SVGIconData)?.data)) {\n return {\n active: src as SVGIconData,\n inactive: src as SVGIconData,\n };\n }\n return src as SvgIconObject;\n};\n\n/**\n * Determines if value is of type Icon (Type Guard)\n * @param {Icon | SVGIcon} toBeDetermined The value to check\n * @returns {boolean} True if value is of type \"Icon\". False otherwise\n */\nexport const isIcon = (toBeDetermined: Icon | SVGIcon): toBeDetermined is Icon => {\n if (\n !isNullOrUndefinedOrEmpty(toBeDetermined as string) ||\n (!isNullOrUndefinedOrEmpty((toBeDetermined as IconObject)?.active) && !isNullOrUndefinedOrEmpty((toBeDetermined as IconObject)?.inactive))\n ) {\n return true;\n }\n return false;\n};\n\n/**\n * Determines if value is of type SVGIcon (Type Guard)\n * @param {Icon | SVGIcon} toBeDetermined The value to check\n * @returns {boolean} True if value is of type \"SVGIcon\". False otherwise\n */\nexport const isSVGIcon = (toBeDetermined: Icon | SVGIcon): toBeDetermined is SVGIcon => {\n if (\n !isNullOrUndefinedOrEmpty((toBeDetermined as SVGIconData)?.data) ||\n (!isNullOrUndefinedOrEmpty((toBeDetermined as SvgIconObject)?.active?.data) &&\n !isNullOrUndefinedOrEmpty((toBeDetermined as SvgIconObject)?.inactive?.data))\n ) {\n return true;\n }\n return false;\n};\n"],"mappings":"4CAoDaA,EAAiBC,IAC5B,IAAKC,EAAOD,GAAM,CAChB,OAAOE,S,CAET,UAAWF,IAAQ,SAAU,CAC3B,MAAO,CACLG,OAAQH,EACRI,SAAUJ,E,CAId,OAAOA,CAAG,E,MAQCK,EAAoBL,IAC/B,IAAKM,EAAUN,GAAM,CACnB,OAAOE,S,CAET,IAAKK,EAAmBP,IAAmB,MAAnBA,SAAG,SAAHA,EAAqBQ,MAAO,CAClD,MAAO,CACLL,OAAQH,EACRI,SAAUJ,E,CAGd,OAAOA,CAAoB,EAQtB,MAAMC,EAAUQ,IACrB,IACGC,EAAyBD,KACxBC,EAA0BD,IAA6B,MAA7BA,SAAc,SAAdA,EAA+BN,UAAYO,EAA0BD,IAA6B,MAA7BA,SAAc,SAAdA,EAA+BL,UAChI,CACA,OAAO,I,CAET,OAAO,KAAK,EAQP,MAAME,EAAaG,I,QACxB,IACGC,EAA0BD,IAA8B,MAA9BA,SAAc,SAAdA,EAAgCD,QACzDE,GAAyBC,EAACF,IAAgC,MAAhCA,SAAc,SAAdA,EAAkCN,UAAM,MAAAQ,SAAA,SAAAA,EAAEH,QACnEE,GAAyBE,EAACH,IAAgC,MAAhCA,SAAc,SAAdA,EAAkCL,YAAQ,MAAAQ,SAAA,SAAAA,EAAEJ,MACzE,CACA,OAAO,I,CAET,OAAO,KAAK,S","ignoreList":[]}