{"version":3,"file":"color.mjs","names":[],"sources":["../../../src/message/parser/color.ts"],"sourcesContent":["import type { Color } from \"../color\";\nimport { ParseError } from \"./parse-error\";\n\nconst rgbColorRegex = /^#([\\dA-F]{2})([\\dA-F]{2})([\\dA-F]{2})$/i;\n\nexport function parseColor(colorSource: string): Color {\n  const match = rgbColorRegex.exec(colorSource);\n  if (match == null) {\n    throw new ParseError(\n      `Malformed color value \"${colorSource}\", must be in format #AABBCC`,\n    );\n  }\n\n  const r = Number.parseInt(match[1]!, 16);\n  const g = Number.parseInt(match[2]!, 16);\n  const b = Number.parseInt(match[3]!, 16);\n\n  return { r, g, b };\n}\n"],"mappings":";;AAGA,MAAM,gBAAgB;AAEtB,SAAgB,WAAW,aAA4B;CACrD,MAAM,QAAQ,cAAc,KAAK,YAAY;AAC7C,KAAI,SAAS,KACX,OAAM,IAAI,WACR,0BAA0B,YAAY,8BACvC;AAOH,QAAO;EAAE,GAJC,OAAO,SAAS,MAAM,IAAK,GAAG;EAI5B,GAHF,OAAO,SAAS,MAAM,IAAK,GAAG;EAGzB,GAFL,OAAO,SAAS,MAAM,IAAK,GAAG;EAEtB"}