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A,oBAAAW,EACAd,EAAA0C,EAAA1C,EAAAc,EAAAqP,EAAAC,EAAAtP,SACM,GAAAA,aAAAuP,OACNrQ,EAAAA,EAAA4C,QAAA9B,EAAAwP,GACAH,EAAAC,EAAAE,QAEM,CACN,OAAAxP,EAAAX,OAAA,OAAAH,EACA,oBAAAc,EAAA,GACA,QAAAsD,EAAA,EAA0BA,EAAAtD,EAAAX,SAAkBiE,EAAA,CAC5C,MAAAmM,EAAyC,EAAAnM,GACzCpE,EAAA0C,EAAA1C,EAAAuQ,EAAAJ,EAAAC,EAAAG,GACA,MAEA,QAAAnM,EAAA,EAA0BA,EAAAtD,EAAAX,SAAkBiE,EAC5CpE,EAAAA,EAAA4C,QAAmD9B,EAAAsD,GAAAkM,GACnDH,EAAAC,EAAAE,GAIA,CACA,CACA,OAAAtQ,GEgVSwQ,CAAU7B,EAAA3O,EAAAiO,GADnBjO,EAGOyQ,GAAA","sources":["webpack://colors.tsz/./dist/esm/core/support-detect.mjs","webpack://colors.tsz/./dist/esm/core/ansi-codes.mjs","webpack://colors.tsz/./dist/esm/core/ansi-color-map.mjs","webpack://colors.tsz/./dist/esm/core/theme.mjs","webpack://colors.tsz/./dist/esm/ansi-console.mjs","webpack://colors.tsz/./dist/esm/colors.mjs"],"sourcesContent":["/*! Copyright jeffy-g 2025\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @file lib/core/support-detect.ts\n */\n/**\n * @import { Support } from \"./support-detect.mts\";\n * @type {Support}\n */\nexport const _Support = /** @type {any} */ ({\n  DISABLE: 0 /* Support.DISABLE */,\n  BASE: 1 /* Support.BASE */,\n  ANSI256: 2 /* Support.ANSI256 */,\n  ANSI24bits: 3 /* Support.ANSI24bits */,\n});\nexport const isDefined = () => globalThis.COLORS_DEFINED === true;\nexport const setDefined = () => {\n  globalThis.COLORS_DEFINED = true;\n};\n/**\n * Detects ANSI color support level of the current process.\n *\n * Inspects CLI arguments, environment variables, OS and terminal information\n * and returns one of the {@link Support} enum values.\n *\n * @returns {Support} Detected color support level.\n */\nexport const detectSupport = () => {\n  /* First, let's check is browser */ {\n    const g = globalThis;\n    if (typeof g.window === \"object\" && typeof g.window.document === \"object\") {\n      return 3 /* Support.ANSI24bits */;\n    }\n  }\n  const proc = (typeof process === \"object\" && process) || undefined;\n  if (\n    !proc ||\n    !proc.versions ||\n    typeof proc.versions.node !== \"string\"\n  ) {\n    return 3 /* Support.ANSI24bits */;\n  }\n  const env = proc.env || {};\n  {\n    const argv = Array.isArray(proc.argv) ? proc.argv : [];\n    if (argv.length) {\n      if (argv.includes(\"nocolor\") || argv.includes(\"nocolors\")) {\n        return 0 /* Support.DISABLE */;\n      }\n      if (argv.find((arg) => /^fullcolors?$/.test(arg)) || argv.find((arg) => /^truecolors?$/.test(arg)) || argv.includes(\"color24bits\")) {\n        return 3 /* Support.ANSI24bits */;\n      }\n      if (argv.find((arg) => /^(?:websafe|color256)$/.test(arg))) {\n        return 2 /* Support.ANSI256 */;\n      }\n      if (argv.find((arg) => /^(?:colorbase|basecolors)$/.test(arg))) {\n        return 1 /* Support.BASE */;\n      }\n    }\n  }\n  if (proc.platform === \"win32\") {\n    if (env.COLORTERM === \"truecolor\") return 3 /* Support.ANSI24bits */;\n    const nodeVersion = proc.versions.node || \"0.0.0\";\n    const nodeMajor = +nodeVersion.split(\".\")[0] || 0;\n    if (nodeMajor >= 8) return 2 /* Support.ANSI256 */;\n    return 1 /* Support.BASE */;\n  }\n  if (\"CI\" in env) {\n    if ([\"TRAVIS\", \"CIRCLECI\", \"APPVEYOR\", \"GITLAB_CI\"].some((sign) => sign in env) || env.CI_NAME === \"codeship\") {\n      return 1 /* Support.BASE */;\n    }\n    return 0 /* Support.DISABLE */;\n  }\n  if (\"TEAMCITY_VERSION\" in env) {\n    // @ts-expect-error regex.test allows undefined value\n    return +/^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION);\n  }\n  if (\"TERM_PROGRAM\" in env) {\n    const termVersion = +(env.TERM_PROGRAM_VERSION || \"\").split(\".\")[0];\n    switch (env.TERM_PROGRAM) {\n      case \"iTerm.app\":\n        return termVersion >= 3 ? 3 : 2;\n      case \"Hyper\":\n        return 3 /* Support.ANSI24bits */;\n      case \"Apple_Terminal\":\n        return 2 /* Support.ANSI256 */;\n    }\n  }\n  const eTerm = env.TERM;\n  // @ts-expect-error regex.test allows undefined value\n  if (/-256(?:color)?$/i.test(eTerm)) {\n    return 2 /* Support.ANSI256 */;\n  }\n  // @ts-expect-error regex.test allows undefined value\n  if (/^(?:screen|xterm|vt100|rxvt)|color|ansi|cygwin|linux/i.test(eTerm)) {\n    return 2 /* Support.ANSI256 */;\n  }\n  if (\"COLORTERM\" in env || eTerm === \"dumb\") return 1 /* Support.BASE */;\n  return 0 /* Support.DISABLE */;\n};","/*! Copyright jeffy-g 2025\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @file lib/core/ansi-codes.ts\n */\nexport const _codes_base = {\n  reset: 0,\n  bold: 1,\n  dim: 2,\n  italic: 3,\n  underline: 4,\n  inverse: 7,\n  hidden: 8,\n  strikethrough: 9,\n  black: 30,\n  red: 31,\n  green: 32,\n  yellow: 33,\n  blue: 34,\n  magenta: 35,\n  cyan: 36,\n  white: 37,\n  bg_black: 40,\n  bg_red: 41,\n  bg_green: 42,\n  bg_yellow: 43,\n  bg_blue: 44,\n  bg_magenta: 45,\n  bg_cyan: 46,\n  bg_white: 47,\n};\nexport const _codes_advanced = {\n  brightblack: 90,\n  brightred: 91,\n  brightgreen: 92,\n  brightyellow: 93,\n  brightblue: 94,\n  brightmagenta: 95,\n  brightcyan: 96,\n  brightwhite: 97,\n  bg_brightblack: 100,\n  bg_brightred: 101,\n  bg_brightgreen: 102,\n  bg_brightyellow: 103,\n  bg_brightblue: 104,\n  bg_brightmagenta: 105,\n  bg_brightcyan: 106,\n  bg_brightwhite: 107,\n};\nexport const _reset_ctrl = \"\\x1b[0m\";","/*! Copyright jeffy-g 2025\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @file lib/core/ansi-color-map.ts\n */\n/**\n * @import { TColorsBasicMap, TWebColorSafeList } from \"./ansi-color-map.mts\";\n */\n/**\n * Converts a non-negative integer to hexadecimal string (lowercase).\n *\n * + __About 25%__ FASTER! (vs _n2h)\n *\n * @param {number} value - The non-negative integer to convert.\n * @returns {string} The hexadecimal string.\n * @date 2025/11/24 9:37:54\n * @since v1.0.14\n */\nexport const n2h = (value) => {\n  if (value === 0) return \"00\";\n  const HEX_CHARS = \"0123456789abcdef\";\n  let digits = \"\";\n  let n = value;\n  while (n > 0) {\n    digits = HEX_CHARS[n % 16] + digits;\n    n >>>= 4;\n  }\n  return digits.length % 2 ? \"0\" + digits : digits;\n};\n/**\n * hex string map\n *\n * ```\n * ffffff: \"\\u001b[38;5;231m\"\n * ```\n * @type {TColorsBasicMap}\n */\nexport let _color_web_safe_map;\n/**\n * 256 color list\n *\n * + __Actual index__: `index - 16`\n *\n * ```\n * // actual index: (231 - 16)\n * 215: {\n *   \"r\": 255,\n *   \"g\": 255,\n *   \"b\": 255,\n *   \"c\": \"\\u001b[38;5;231m\"\n * }\n * ```\n * @type {TWebColorSafeList[]}\n */\nexport let _color_web_safe_list;\n/**\n * hex string map\n *\n * ```\n * ffffff: \"\\u001b[48;5;231m\"\n * ```\n * @type {TColorsBasicMap}\n */\nexport let _color_bg_web_safe_map;\n/**\n * 256 color list\n *\n * + __Actual index__: `index - 16`\n *\n * ```\n * // actual index: (231 - 16)\n * 215: {\n *   \"r\": 255,\n *   \"g\": 255,\n *   \"b\": 255,\n *   \"c\": \"\\u001b[48;5;231m\"\n * }\n * ```\n * @type {TWebColorSafeList[]}\n */\nexport let _color_bg_web_safe_list;\n/** @type {TColorsBasicMap} */\nexport let _color_gray_map;\n/** @type {TWebColorSafeList[]} */\nexport let _color_gray_list;\n/** @type {TColorsBasicMap} */\nexport let _color_bg_gray_map;\n/** @type {TWebColorSafeList[]} */\nexport let _color_bg_gray_list;\nconst _color_web_safe_map_init = () => {\n  const hexStrA = [\"00\", \"33\", \"66\", \"99\", \"cc\", \"ff\"];\n  const hexNumA = [0, 0x33, 0x66, 0x99, 0xcc, 0xff];\n  _color_web_safe_map = /** @type {TColorsBasicMap} */ ({});\n  _color_web_safe_list = /** @type {TWebColorSafeList[]} */ ([]);\n  _color_bg_web_safe_map = /** @type {TColorsBasicMap} */ ({});\n  _color_bg_web_safe_list = /** @type {TWebColorSafeList[]} */ ([]);\n  _color_gray_map = /** @type {TColorsBasicMap} */ ({});\n  _color_gray_list = /** @type {TWebColorSafeList[]} */ ([]);\n  _color_bg_gray_map = /** @type {TColorsBasicMap} */ ({});\n  _color_bg_gray_list = /** @type {TWebColorSafeList[]} */ ([]);\n  let key = [0, 0, 0];\n  for (let i = 0; i < 216; ++i, ++key[0]) {\n    if (key[0] > 5) {\n      key[0] = 0;\n      key[1]++;\n      if (key[1] > 5) {\n        key[1] = 0;\n        key[2]++;\n      }\n    }\n    const pos = 16 /* EConstans.HEX_BASE */ + i;\n    const hex = hexStrA[key[2]] + hexStrA[key[1]] + hexStrA[key[0]];\n    let c = \"\\u001B[38;5;\" /* EC256bits.colorBits */ + pos + \"m\"; /* EC256bits.colorBitsEndl */\n    _color_web_safe_map[hex] = c;\n    _color_web_safe_list.push({\n      r: hexNumA[key[2]],\n      g: hexNumA[key[1]],\n      b: hexNumA[key[0]],\n      c: c,\n    });\n    c = \"\\u001B[48;5;\" /* EC256bits.colorBitsBg */ + pos + \"m\" /* EC256bits.colorBitsEndl */;\n    _color_bg_web_safe_map[hex] = c;\n    _color_bg_web_safe_list.push({\n      r: hexNumA[key[2]],\n      g: hexNumA[key[1]],\n      b: hexNumA[key[0]],\n      c: c,\n    });\n  }\n  for (let i = 0; i < 24; ++i) {\n    const n = 8 + i * 10;\n    let hex = n2h(n);\n    let grayLevel = 232 /* EConstans.GRAY_CODE_BASE */ + i;\n    let c = \"\\u001B[38;5;\" /* EC256bits.colorBits */ + grayLevel + \"m\"; /* EC256bits.colorBitsEndl */\n    _color_gray_map[hex] = c;\n    _color_gray_list.push({ r: n, g: n, b: n, c: c });\n    c = \"\\u001B[48;5;\" /* EC256bits.colorBitsBg */ + grayLevel + \"m\" /* EC256bits.colorBitsEndl */;\n    _color_bg_gray_map[hex] = c;\n    _color_bg_gray_list.push({ r: n, g: n, b: n, c: c });\n  }\n};\n_color_web_safe_map_init();","/*! Copyright jeffy-g 2025\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @file lib/core/theme.ts\n */\n/**\n * @import { TColorsMap } from \"./ansi-color-map.mts\";\n * @import { ColorizeFn, Painter } from \"./theme.mts\";\n */\n/**\n * @type {TColorsMap}\n */\nconst _default_theme = {\n  verbose: \"white\",\n  info: \"green\",\n  debug: \"blue\",\n  warning: \"yellow\",\n  error: \"red\",\n  custom0: \"white\",\n  custom1: \"white\",\n  custom2: \"white\",\n  custom3: \"white\",\n  custom4: \"white\",\n  custom5: \"white\",\n  custom6: \"white\",\n  custom7: \"white\",\n  custom8: \"white\",\n  custom9: \"white\",\n};\n/**\n * point to __current theme__\n * @type {TColorsMap}\n */\nexport let _theme = _default_theme;\n/** @type {(theme?: TColorsMap | null) => void} */\nexport const setTheme = (theme) => {\n  _theme = theme == null ? _default_theme : theme;\n};\n/** @type {(value: string, search: string, replace: string) => string} */\nconst replace_all = (value, search, replace) => {\n  if (!search) return value;\n  if (value.indexOf(search) === -1) return value;\n  return value.split(search).join(replace);\n};\n/** @type {(paint: Painter[], value: string, colorize: ColorizeFn) => string} */\nexport const applyPaint = (paint, value, colorize) => {\n  for (let i = 0; i < paint.length; ++i) {\n    const item = paint[i];\n    const key = item.key;\n    const cs = item.colors;\n    if (key == null || cs == null || cs.length == 0) continue;\n    if (typeof key === \"string\") {\n      value = replace_all(value, key, colorize(cs, key));\n    } else if (key instanceof RegExp) {\n      value = value.replace(key, (ar) => {\n        return colorize(cs, ar);\n      });\n    } else {\n      if (key.length === 0) return value;\n      if (typeof key[0] === \"string\") {\n        for (let idx = 0; idx < key.length; ++idx) {\n          const k = /** @type {string[]} */ (key)[idx];\n          value = replace_all(value, k, colorize(cs, k));\n        }\n      } else {\n        for (let idx = 0; idx < key.length; ++idx) {\n          value = value.replace(/** @type {RegExp} */ (key[idx]), (ar) => {\n            return colorize(cs, ar);\n          });\n        }\n      }\n    }\n  }\n  return value;\n};","/*! Copyright jeffy-g 2025\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @file lib/ansi-console.ts\n */\nexport const isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n/**\n * @import { T256Rgb, EAnsiColorList } from \"./ansi-console.mts\";\n */\n/** @type {T256Rgb[]} */\nlet web_safe_list = Array(216);\n/** @type {T256Rgb[]} */\nlet gray_list = Array(24);\n/**\n * @param {number} index\n * @returns {T256Rgb | null}\n */\nexport function getRgbFrom256Index(index) {\n  if (index < 16 /* EConstans.HEX_BASE */ || index > 255 /* EConstans.COLOR_256_MAX */) return null;\n  if (index >= 232 /* EConstans.GRAY_CODE_BASE */) {\n    const level = index - 232; /* EConstans.GRAY_CODE_BASE */\n    let rgb = gray_list[level];\n    if (!rgb) {\n      const n = 8 + level * 10;\n      gray_list[level] = rgb = { r: n, g: n, b: n };\n    }\n    return rgb;\n  }\n  const cubeIndex = index - 16; /* EConstans.HEX_BASE */\n  let rgb = web_safe_list[cubeIndex];\n  if (!rgb) {\n    const hexNumA = [0, 0x33, 0x66, 0x99, 0xcc, 0xff];\n    const bIndex = cubeIndex % 6;\n    const gIndex = ((cubeIndex / 6) | 0) % 6;\n    const rIndex = ((cubeIndex / 36) | 0) % 6;\n    web_safe_list[cubeIndex] = rgb = {\n      r: hexNumA[rIndex],\n      g: hexNumA[gIndex],\n      b: hexNumA[bIndex],\n    };\n  }\n  return rgb;\n}\n/**\n * @template {1=} IsBG\n * @template {[IsBG] extends [1] ? \"background\" : \"color\"} Rule\n * @param {EAnsiColorList} color\n * @param {IsBG=} isBg\n * @returns {`${Rule}:${EAnsiColorList};`}\n */\nconst _tc = (color, isBg) => `${/** @type {Rule} */ (isBg ? \"background\" : \"color\")}:${color};`;\n/**\n * more details see - {@link https://en.wikipedia.org/wiki/ANSI_escape_code#Select_Graphic_Rendition_parameters Select Graphic Rendition parameters}\n */\n/** @type {Record<string, string>} */\nconst SGR_TO_CSS_Map = {\n  [0 /* EAnsiFlag.reset */]: \"\",\n  [1 /* EAnsiFlag.bold */]: \"font-weight: bold;\",\n  [2 /* EAnsiFlag.dim */]: \"opacity: 0.6;\",\n  [3 /* EAnsiFlag.italic */]: \"font-style: italic;\",\n  [4 /* EAnsiFlag.underline */]: \"text-decoration:underline;\",\n  [53 /* EAnsiFlag.overline */]: \"text-decoration:overline;\",\n  [7 /* EAnsiFlag.inverse */]: \"filter: invert(1);\",\n  [8 /* EAnsiFlag.hidden */]: \"color: transparent;\",\n  [9 /* EAnsiFlag.strikethrough */]: \"text-decoration:line-through;\",\n  24: \"underline\",\n  29: \"line-through\",\n  55: \"overline\",\n  [30 /* EAnsiFlag.black */]: _tc(/** @type {EAnsiColorList} */(\"#000\")),\n  [31 /* EAnsiFlag.red */]: _tc(/** @type {EAnsiColorList} */(\"#cd3131\")),\n  [32 /* EAnsiFlag.green */]: _tc(/** @type {EAnsiColorList} */(\"#0dbc79\")),\n  [33 /* EAnsiFlag.yellow */]: _tc(/** @type {EAnsiColorList} */(\"#e5e510\")),\n  [34 /* EAnsiFlag.blue */]: _tc(/** @type {EAnsiColorList} */(\"#2472c8\")),\n  [35 /* EAnsiFlag.magenta */]: _tc(/** @type {EAnsiColorList} */(\"#bc3fbc\")),\n  [36 /* EAnsiFlag.cyan */]: _tc(/** @type {EAnsiColorList} */(\"#11a8cd\")),\n  [37 /* EAnsiFlag.white */]: _tc(/** @type {EAnsiColorList} */(\"#e5e5e5\")),\n  [40 /* EAnsiFlag.bg_black */]: _tc(/** @type {EAnsiColorList} */(\"#000\"), 1),\n  [41 /* EAnsiFlag.bg_red */]: _tc(/** @type {EAnsiColorList} */(\"#cd3131\"), 1),\n  [42 /* EAnsiFlag.bg_green */]: _tc(/** @type {EAnsiColorList} */(\"#0dbc79\"), 1),\n  [43 /* EAnsiFlag.bg_yellow */]: _tc(/** @type {EAnsiColorList} */(\"#e5e510\"), 1),\n  [44 /* EAnsiFlag.bg_blue */]: _tc(/** @type {EAnsiColorList} */(\"#2472c8\"), 1),\n  [45 /* EAnsiFlag.bg_magenta */]: _tc(/** @type {EAnsiColorList} */(\"#bc3fbc\"), 1),\n  [46 /* EAnsiFlag.bg_cyan */]: _tc(/** @type {EAnsiColorList} */(\"#11a8cd\"), 1),\n  [47 /* EAnsiFlag.bg_white */]: _tc(/** @type {EAnsiColorList} */(\"#e5e5e5\"), 1),\n  [90 /* EAnsiFlag.brightblack */]: _tc(/** @type {EAnsiColorList} */(\"#666666\")),\n  [91 /* EAnsiFlag.brightred */]: _tc(/** @type {EAnsiColorList} */(\"#f14c4c\")),\n  [92 /* EAnsiFlag.brightgreen */]: _tc(/** @type {EAnsiColorList} */(\"#23d18b\")),\n  [93 /* EAnsiFlag.brightyellow */]: _tc(/** @type {EAnsiColorList} */(\"#f5f543\")),\n  [94 /* EAnsiFlag.brightblue */]: _tc(/** @type {EAnsiColorList} */(\"#3b8eea\")),\n  [95 /* EAnsiFlag.brightmagenta */]: _tc(/** @type {EAnsiColorList} */(\"#d670d6\")),\n  [96 /* EAnsiFlag.brightcyan */]: _tc(/** @type {EAnsiColorList} */(\"#29b8dB\")),\n  [97 /* EAnsiFlag.brightwhite */]: _tc(/** @type {EAnsiColorList} */(\"#ededed\")),\n  [100 /* EAnsiFlag.bg_brightblack */]: _tc(/** @type {EAnsiColorList} */(\"#666666\"), 1),\n  [101 /* EAnsiFlag.bg_brightred */]: _tc(/** @type {EAnsiColorList} */(\"#f14c4c\"), 1),\n  [102 /* EAnsiFlag.bg_brightgreen */]: _tc(/** @type {EAnsiColorList} */(\"#23d18b\"), 1),\n  [103 /* EAnsiFlag.bg_brightyellow */]: _tc(/** @type {EAnsiColorList} */(\"#f5f543\"), 1),\n  [104 /* EAnsiFlag.bg_brightblue */]: _tc(/** @type {EAnsiColorList} */(\"#3b8eea\"), 1),\n  [105 /* EAnsiFlag.bg_brightmagenta */]: _tc(/** @type {EAnsiColorList} */(\"#d670d6\"), 1),\n  [106 /* EAnsiFlag.bg_brightcyan */]: _tc(/** @type {EAnsiColorList} */(\"#29b8dB\"), 1),\n  [107 /* EAnsiFlag.bg_brightwhite */]: _tc(/** @type {EAnsiColorList} */(\"#ededed\"), 1),\n};\n/**\n * @typedef {`color:#${string};`} TCssPropFg\n * @typedef {`background:#${string};`} TCssPropBg\n * @type {Array<TCssPropFg | TCssPropBg>}\n */\nconst SGR_TO_CSS = (() => {\n  const cssPropArry = Array(108);\n  for (const idx in SGR_TO_CSS_Map) {\n    cssPropArry[+idx] = SGR_TO_CSS_Map[idx];\n  }\n  return cssPropArry;\n})();\n/**\n * Removes a CSS rule matching the given token from the state\n * @param {string} token - CSS property name to match (e.g., \"color:\")\n * @param {string[]} cssState - Current CSS state array\n * @param {string=} tdCriteria - For text-decoration, specific value to remove\n * @returns {1 | 0} 1 if modified, 0 otherwise\n */\nconst pargeStyle = (token, cssState, tdCriteria) => {\n  const finded = cssState.findIndex((state) => state.startsWith(token));\n  if (finded === -1) return 0;\n  if (tdCriteria) {\n    const tdValues = cssState[finded]\n      .slice(16, -1)\n      .split(\" \")\n      .filter((rule) => rule !== tdCriteria);\n    if (tdValues.length) {\n      cssState[finded] = `text-decoration:${tdValues.join(\" \")};`;\n      return 1;\n    }\n  }\n  cssState.splice(finded, 1);\n  return 1;\n};\nconst isa = Array.isArray;\n/**\n * Handles SGR reset codes (22-29, 39)\n *\n * @param {string[]} cssState\n * @param {number} code\n * @returns true if the code was a reset code and was handled\n */\nconst handleResetCode = (cssState, code) => {\n  if (code === 0) {\n    cssState.length = 0;\n    return true;\n  }\n  let tokens;\n  let tdCriteria;\n  switch (code) {\n    case 22: {\n      tokens = [\"font-weight:\", \"opacity:\"];\n      break;\n    }\n    case 23: {\n      tokens = \"font-style:\";\n      break;\n    }\n    case 24:\n    case 29:\n    case 55: {\n      tokens = \"text-decoration:\";\n      tdCriteria = SGR_TO_CSS[code];\n      break;\n    }\n    case 27: {\n      tokens = \"filter:\";\n      break;\n    }\n    case 28:\n    case 39: {\n      tokens = \"color:\";\n      break;\n    }\n    case 49: {\n      tokens = \"background:\";\n      break;\n    }\n    default:\n      return false;\n  }\n  /** @type {any} */\n  let isChanged;\n  if (tokens) {\n    if (isa(tokens)) {\n      for (const token of tokens) {\n        isChanged |= pargeStyle(token, cssState);\n      }\n    } else {\n      isChanged |= pargeStyle(tokens, cssState, tdCriteria);\n    }\n  }\n  return !!isChanged;\n};\n/**\n * Updates or adds a CSS rule to the state\n * Handles text-decoration merging and rule replacement\n * @param {string} css - CSS rule to add or update\n * @param {string[]} cssState - Current CSS state array\n */\nconst updateCssState = (css, cssState) => {\n  const comingPropName = css.slice(0, css.indexOf(\":\"));\n  const isTextDecoration = comingPropName === \"text-decoration\";\n  const reTdTest = /^text-decoration/;\n  for (let i = 0, cssStateLen = cssState.length; i < cssStateLen; ) {\n    const _css = cssState[i++];\n    if (isTextDecoration && reTdTest.test(_css)) {\n      const prev = _css.slice(16, -1).trim().split(\" \");\n      const next = css.slice(16, -1).trim();\n      if (!prev.includes(next)) {\n        prev.push(next);\n        cssState[i - 1] = `text-decoration:${prev.join(\" \")};`;\n      }\n      return;\n    } else {\n      const propName = _css.slice(0, _css.indexOf(\":\"));\n      if (comingPropName === propName) {\n        cssState[i - 1] = css;\n        return;\n      }\n    }\n  }\n  cssState.push(css);\n};\n/**\n * Resolves ANSI SGR color codes (truecolor and 256-color) and updates the CSS state.\n *\n * This function interprets ANSI color codes for both truecolor (24-bit, e.g., 38;2;r;g;b or 48;2;r;g;b)\n * and 256-color (e.g., 38;5;idx or 48;5;idx) sequences, and converts them to corresponding CSS rules.\n * The resulting CSS rule is added to or updates the provided cssState array.\n *\n * @param {number} codeOffset - The current offset in the codes array.\n * @param {string[]} codes The array of SGR code strings.\n *   __`CAVEAT:`__ when use code[number] then MUST convert to number\n *   ```\n *   const code = +codes[3];\n *   ```\n * @param {string[]} sgr2css - The lookup table for standard SGR code to CSS string.\n * @param {string[]} cssState - The current CSS state array to be updated.\n * @returns {number} The new offset in the codes array after processing the color code.\n */\nconst resolveAnsiColor = (codeOffset, codes, sgr2css, cssState) => {\n  const code = +codes[codeOffset++];\n  let css = sgr2css[code];\n  if (!css) {\n    const propName = code === 38 ? \"color\" : \"background\";\n    const isRGB = codes[codeOffset++] === \"2\";\n    if (isRGB) {\n      css = `${propName}: rgb(${codes[codeOffset]} ${codes[codeOffset + 1]} ${codes[codeOffset + 2]});`;\n      codeOffset += 3;\n    } else {\n      const color256Index = +codes[codeOffset++];\n      let rgbEntry = getRgbFrom256Index(color256Index);\n      if (rgbEntry) {\n        css = `${propName}: rgb(${rgbEntry.r} ${rgbEntry.g} ${rgbEntry.b});`;\n      } else {\n        const shift = propName === \"background\" ? 10 : 0;\n        const base = color256Index & 8 ? 82 : 30;\n        css = sgr2css[color256Index + base + shift];\n      }\n    }\n  }\n  updateCssState(css, cssState);\n  return codeOffset;\n};\n/** @type {(strs: string[]) => string} */\nconst join = (strs) => {\n  let contents = \"\";\n  const strsLen = strs.length;\n  if (!strsLen) return contents;\n  for (let idx = 0; idx < strsLen; ) contents += strs[idx++];\n  return contents;\n};\n/**\n * Converts ANSI escape sequences to browser console format\n *\n * In Node.js, returns input as-is (ANSI passthrough)\n * In Browser, converts ANSI codes to %c placeholders with CSS\n *\n * @param {string} format - String containing ANSI escape sequences\n * @param {...unknown} comingArgs - Additional arguments (objects, etc.)\n * @returns {[string, args?: unknown[]]} Tuple of [formatted string, CSS args array]\n *\n * @example\n * // Input: \"\\x1b[31mError\\x1b[0m message\"\n * // Output: [\"%cError%c message\", [\"color:red;\", \"\"]]\n * @version latest\n */\nexport function toConsoleArgsFromAnsiNext(format, ...comingArgs) {\n  const sgr2css = SGR_TO_CSS;\n  /** @type {string} */\n  var text;\n  /**\n   * Currently enabled CSS properties\n   * @type {string[]}\n   */\n  let cssState = [];\n  /** __Flags required for adjusting placeholders, rest args, etc.__ */\n  let isStyleApplied = false;\n  let formatLine = \"\";\n  const args = [];\n  const sdifoOc = \"sdifoOc\";\n  const formatLen = format.length;\n  let lastIndex = 0,\n    offset = 0,\n    comingArgsIdx = 0;\n  while (offset < formatLen) {\n    let ch = format[offset++];\n    if (ch === \"\\x1b\" && format[offset] === \"[\") {\n      const matchStart = offset - 1;\n      const codesStart = (offset += 1);\n      while (offset < formatLen && format[offset] !== \"m\") offset++;\n      if (offset >= formatLen) break;\n      if (lastIndex < matchStart) {\n        if (!isStyleApplied) {\n          text = \"%c\" + format.slice(lastIndex, matchStart);\n          args.push(join(cssState));\n          isStyleApplied = true;\n        } else text = format.slice(lastIndex, matchStart);\n        formatLine += text;\n      }\n      const codes = format.slice(codesStart, offset).split(\";\");\n      isStyleApplied = false;\n      for (let idx = 0, codesLen = codes.length; idx < codesLen; ) {\n        if (handleResetCode(cssState, +codes[idx])) {\n          idx++;\n        } else {\n          idx = resolveAnsiColor(idx, codes, sgr2css, cssState);\n        }\n      }\n      lastIndex = ++offset;\n      continue;\n    }\n    if (ch === \"%\") {\n      if (format[offset] === \"%\") {\n        offset += 1;\n        continue;\n      }\n      while (offset < formatLen) {\n        if (((ch = format[offset]) >= \"0\" && ch <= \"9\") || ch === \".\" || ch === \"-\" || ch === \"+\") {\n          offset++;\n        } else {\n          break;\n        }\n      }\n      if (sdifoOc.includes(format[offset])) {\n        const fragment = format.slice(lastIndex, ++offset);\n        if (isStyleApplied) {\n          formatLine += fragment;\n          args.push(comingArgs[comingArgsIdx++]);\n        } else {\n          formatLine += \"%c\" + fragment;\n          args.push(join(cssState), comingArgs[comingArgsIdx++]);\n          isStyleApplied = true;\n        }\n        lastIndex = offset;\n        continue;\n      }\n    }\n  }\n  if (lastIndex < formatLen) {\n    if (!isStyleApplied) {\n      text = \"%c\" + format.slice(lastIndex);\n      args.push(join(cssState));\n    } else text = format.slice(lastIndex);\n    formatLine += text;\n  }\n  return [formatLine, args.concat(comingArgs.slice(comingArgsIdx))];\n}\nconst _log = console.log;\n/**\n * @typedef {(format: string, ...comingArgs: unknown[]) => [string, args?: unknown[]]} TAnsiParser\n * @param {TAnsiParser} parser\n * @returns {Console[\"log\"]}\n */\nconst createAnsiLogger = (parser) => {\n  if (!isBrowser) return _log;\n  return (...argsIn) => {\n    if (!argsIn.length) return _log();\n    let format = argsIn[0];\n    if (typeof format !== \"string\") return _log(...argsIn);\n    /** @type {unknown[]} */\n    let fmtArgs;\n    [format, fmtArgs = []] = parser(format, ...argsIn.slice(1));\n    _log(format, ...fmtArgs);\n  };\n};\n/** @type {Console[\"log\"]} */\nexport const logAnsi = createAnsiLogger(toConsoleArgsFromAnsiNext);","/*! Copyright xerysherry 2018\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * Refactoring by jeffy-g (2025/11).\n */\n/// <reference types=\"node\" preserve=\"true\"/>\n// @ts-ignore this tag for after build source\n/// <reference path=\"../colors.d.ts\" preserve=\"true\"/>\nimport { detectSupport, isDefined, setDefined } from \"./core/support-detect.mjs\";\nexport { _Support as Support } from \"./core/support-detect.mjs\";\nimport { _codes_base, _codes_advanced, _reset_ctrl } from \"./core/ansi-codes.mjs\";\nimport { n2h, _color_web_safe_list, _color_web_safe_map, _color_bg_web_safe_list, _color_bg_web_safe_map, _color_gray_list, _color_gray_map, _color_bg_gray_list, _color_bg_gray_map } from \"./core/ansi-color-map.mjs\";\nimport { _theme, setTheme, applyPaint } from \"./core/theme.mjs\";\nimport { isBrowser } from \"./ansi-console.mjs\";\nexport { logAnsi as log, isBrowser, getRgbFrom256Index, toConsoleArgsFromAnsiNext } from \"./ansi-console.mjs\";\n/**\n * @import { Painter } from \"./core/theme.mts\";\n * @import { TCodesAdvanceKey, TCodesBaseKey } from \"./core/ansi-codes.mts\";\n * @import { TColorsBasicMap, TWebColorSafeList, TColorsMap } from \"./core/ansi-color-map.mts\";\n * @import { Support } from \"./core/support-detect.mts\";\n */\n/**\n * @param {number} level range is __`0 - 25`__, `0` is __black__, and `25` is __white__\n * @param {38 | 48} flag foreground - __38__, backbround - __48__\n */\nconst _get_gray_code = (level, flag) => {\n  if (_enable) {\n    if (_support < 2 /* Support.ANSI256 */) return flag === 48 ? \"\\x1b[48;5;245m\" : \"\\x1b[90m\";\n    if (level <= 0 /* EConstans.GRAY_LEVEL_MIN */)\n      return `\\x1B[${flag};5;0m`;\n    else if (level >= 25 /* EConstans.GRAY_LEVEL_MAX */) return `\\x1B[${flag};5;15m`;\n    return `\\x1B[${flag};5;${level - 1 + 232 /* EConstans.GRAY_CODE_BASE */}m`;\n  }\n  return \"\";\n};\n/**\n * @param {number} idx `0` index base\n * @param {38 | 48} flag foreground - __38__, backbround - __48__\n */\nconst _get_256bits_color_code = (idx, flag) => {\n  if (_support < 2 /* Support.ANSI256 */) return null;\n  if (idx < 0 /* EConstans.COLOR_256_MIN */) idx = 0 /* EConstans.COLOR_256_MIN */;\n  else if (idx > 255 /* EConstans.COLOR_256_MAX */) idx = 255 /* EConstans.COLOR_256_MAX */;\n  return `\\u001B[${flag};5;` + idx + \"m\" /* EC256bits.colorBitsEndl */;\n};\n/**\n * @import {TSafeMapAndGrayListArg} from \"./colors.mts\";\n */\n/** @type {(bg: boolean) => TSafeMapAndGrayListArg} */\nconst _get_safemap_and_graylist_args = (bg) => {\n  /** @type {TSafeMapAndGrayListArg} */\n  let mapListArgs = [bg ? _color_bg_web_safe_map : _color_web_safe_map, bg ? _color_bg_web_safe_list : _color_web_safe_list];\n  if (_more_detail_on_color256) {\n    mapListArgs = [mapListArgs[0], mapListArgs[1], bg ? _color_bg_gray_map : _color_gray_map, bg ? _color_bg_gray_list : _color_gray_list];\n  }\n  return mapListArgs;\n};\n/** @type {(hexcode: string, bg: boolean) => string | null} */\nconst _get_color_by_hex = (hexcode, bg) => {\n  if (_support === 3 /* Support.ANSI24bits */) {\n    let r = +(\"0x\" + hexcode[0] + hexcode[1]);\n    let g = +(\"0x\" + hexcode[2] + hexcode[3]);\n    let b = +(\"0x\" + hexcode[4] + hexcode[5]);\n    return bg ? _get_truecolor_bg(r, g, b) : _get_truecolor(r, g, b);\n  }\n  if (_support < 2 /* Support.ANSI256 */) return null;\n  return _get_web_safe_code_by_hex(hexcode, ..._get_safemap_and_graylist_args(bg));\n};\n/** @type {(r: number, g: number, b: number, bg: boolean) => string | null} */\nconst _get_color_by_rgb = (r, g, b, bg) => {\n  if (_support === 3 /* Support.ANSI24bits */) return bg ? _get_truecolor_bg(r, g, b) : _get_truecolor(r, g, b);\n  if (_support < 2 /* Support.ANSI256 */) return null;\n  return _get_web_safe_code_by_rgb(r, g, b, ..._get_safemap_and_graylist_args(bg));\n};\n/** @type {(hex: string, map: TColorsBasicMap, list: TWebColorSafeList[], map2?: TColorsBasicMap, list2?: TWebColorSafeList[]) => string | null} */\nconst _get_web_safe_code_by_hex = (hex, map, list, map2, list2) => {\n  /** @type {string | null=} */\n  let c = map[hex];\n  if (c) return c;\n  if (map2) {\n    c = map2[hex];\n    if (c) return c;\n  }\n  let r = +(\"0x\" + hex[0] + hex[1]);\n  let g = +(\"0x\" + hex[2] + hex[3]);\n  let b = +(\"0x\" + hex[4] + hex[5]);\n  c = _get_web_safe_code_search(r, g, b, list, list2);\n  if (c) map[hex] = c;\n  return c;\n};\n/** @type {(r: number, g: number, b: number, map: TColorsBasicMap, list: TWebColorSafeList[], map2?: TColorsBasicMap, list2?: TWebColorSafeList[]) => string | null} */\nconst _get_web_safe_code_by_rgb = (r, g, b, map, list, map2, list2) => {\n  let hex = n2h(r) + n2h(g) + n2h(b);\n  /** @type {string | null=} */\n  let c = map[hex];\n  if (c) return c;\n  if (map2) {\n    c = map2[hex];\n    if (c) return c;\n  }\n  c = _get_web_safe_code_search(r, g, b, list, list2);\n  if (c) map[hex] = c;\n  return c;\n};\n/** @type {(r: number, g: number, b: number, list: TWebColorSafeList[], list2?: TWebColorSafeList[]) => string | null} */\nconst _get_web_safe_code_search = (r, g, b, list, list2) => {\n  let m = Number.MAX_VALUE;\n  let c = null;\n  list.forEach((item) => {\n    let v = (item.r - r) * (item.r - r) + (item.g - g) * (item.g - g) + (item.b - b) * (item.b - b);\n    if (v < m) {\n      m = v;\n      c = item.c;\n    }\n  });\n  if (list2) {\n    list2.forEach((item) => {\n      let v = (item.r - r) * (item.r - r) + (item.g - g) * (item.g - g) + (item.b - b) * (item.b - b);\n      if (v < m) {\n        m = v;\n        c = item.c;\n      }\n    });\n  }\n  return c;\n};\n/** @type {(r: number, g: number, b: number) => `\\x1b[38;2;${number};${number};${number}m`} */\nconst _get_truecolor = (r, g, b) => `\\u001b[38;2;${r};${g};${b}m`;\n/** @type {(r: number, g: number, b: number) => `\\x1b[48;2;${number};${number};${number}m`} */\nconst _get_truecolor_bg = (r, g, b) => `\\x1b[48;2;${r};${g};${b}m`;\n/** @type {(color: string) => string | null} */\nconst _get_code = (color) => {\n  if (color.length === 0 || _support < 1 /* Support.BASE */) return null;\n  /** @type {number} */\n  let code = _codes_base[/** @type {TCodesBaseKey} */ (color)];\n  if (code !== void 0) return `\\x1b[${code}m`;\n  code = _codes_advanced[/** @type {TCodesAdvanceKey} */ (color)];\n  if (code !== void 0) return `\\x1b[${code};1m`;\n  color = color.toLowerCase();\n  const c0 = color[0];\n  if (c0 === \"#\") return _get_color_by_hex(color.slice(1), false);\n  else if (c0 === \"g\") return _get_gray_code(+color.slice(1), 38);\n  else if (c0 === \"b\") {\n    if (color[1] === \"#\") return _get_color_by_hex(color.slice(2), true);\n    else if (color[1] === \"g\") return _get_gray_code(+color.slice(2), 48);\n  }\n  return null;\n};\n/**\n * state of __current Support__\n * @type {Support}\n */\nlet _support = 0; /* Support.DISABLE */\n/**\n * state of __current enabling__\n */\nlet _enable = true;\nlet _more_detail_on_color256 = false;\n/**\n * + __`\"\\u001B[0m\"`__.length is **4**\n * @param {string} value\n */\nconst _check_reset_end = (value) => {\n  return value.length >= 4 && value.endsWith(_reset_ctrl);\n};\n/** @type {(x: number, y: number) => `\\x1b[${number};${number}H`} */\nconst _position = (x, y) => `\\x1b[${y};${x}H`;\nconst _strProto = String.prototype;\n/** @type {(key: string, fn: (this: string, ...args: any[]) => string) => void} */\nconst _defineStringProp = (key, fn) => {\n  try {\n    Object.defineProperty(_strProto, key, {\n      get: fn,\n      enumerable: false,\n      configurable: false,\n    });\n  } catch (e) {\n    console.warn(/** @type {Error} */ (e).message);\n  }\n};\n/** @type {(ansiEscape: `\\x1b[${number}m`) => (this: string) => string} */\nconst emitColorsFunction = (ansiEscape) => {\n  return function () {\n    if (!_enable || _support < 1 /* Support.BASE */) return this;\n    const ansiValue = ansiEscape + this;\n    if (_check_reset_end(this)) return ansiValue;\n    else return ansiValue + _reset_ctrl;\n  };\n};\nconst _codes_init = () => {\n  for (const key in _codes_base) {\n    _defineStringProp(key, emitColorsFunction(`\\x1b[${_codes_base[/** @type {TCodesBaseKey} */ (key)]}m`));\n  }\n  for (const key in _codes_advanced) {\n    _defineStringProp(key, emitColorsFunction(`\\x1b[${_codes_advanced[/** @type {TCodesAdvanceKey} */ (key)]}m`));\n  }\n  /** @type {(dis: string, idxOrLevel: number, flag: 38 | 48, fn: (idxOrLevel: number, flag: 38 | 48) => string | null) => string} */\n  const _color_at_256_or_gray_impl = (dis, idxOrLevel, flag, fn) => {\n    if (!_enable) return dis;\n    const code = fn(idxOrLevel, flag);\n    if (!code) return dis;\n    if (_check_reset_end(dis)) return code + dis;\n    else return code + dis + _reset_ctrl;\n  };\n  /** @type {(fn_name: \"color_at_256\" | \"color_bg_at_256\", dis: string, split?: true) => string} */\n  const _colors256_rnd_impl = (fn_name, dis, split) => {\n    const rnd = Math.random;\n    if (split) {\n      let joined = \"\";\n      for (let idx = 0, charsLen = dis.length; idx < charsLen; ) {\n        joined += dis[idx++][fn_name]((rnd() * 256) | 0);\n      }\n      return joined;\n    }\n    return dis[fn_name]((rnd() * 256) | 0);\n  };\n  _strProto.colors256_rnd =\n    /** @type {(this: string, split?: true) => string} */\n    function (split) {\n      if (!_enable) return this;\n      return _colors256_rnd_impl(\"color_at_256\", this, split);\n    };\n  _strProto.colors256_rnd_bg =\n    /** @type {(this: string, split?: true) => string} */\n    function (split) {\n      if (!_enable) return this;\n      return _colors256_rnd_impl(\"color_bg_at_256\", this, split);\n    };\n  _strProto.color_at_256 =\n    /** @type {(this: string, idx: number) => string} */\n    function (idx) {\n      return _color_at_256_or_gray_impl(this, idx, 38, _get_256bits_color_code);\n    };\n  _strProto.color_bg_at_256 =\n    /** @type {(this: string, idx: number) => string} */\n    function (idx) {\n      return _color_at_256_or_gray_impl(this, idx, 48, _get_256bits_color_code);\n    };\n  _strProto.gray =\n    /** @type {(this: string, level: number) => string} */\n    function (level) {\n      return _color_at_256_or_gray_impl(this, level, 38, _get_gray_code);\n    };\n  _strProto.gray_bg =\n    /** @type {(this: string, level: number) => string} */\n    function (level) {\n      return _color_at_256_or_gray_impl(this, level, 48, _get_gray_code);\n    };\n  _strProto.grey = _strProto.gray;\n  _strProto.grey_bg = _strProto.gray_bg;\n  _strProto.colors =\n    /** @type {(this: string, color: string | string[], noreset?: boolean) => string} */\n    function (color, noreset) {\n      return colors(color, this, noreset);\n    };\n  /** @type {(isBg?: boolean) => (this: string, hex: string) => string} */\n  const emit_hex_fn = (isBg = false) =>\n    function (hex) {\n      if (!_enable) return this;\n      const h = hex[0] === \"#\" ? hex.slice(1) : hex;\n      const code = _get_color_by_hex(h, isBg);\n      if (!code) return this;\n      return code + this + _reset_ctrl;\n    };\n  _strProto.hex = emit_hex_fn();\n  _strProto.hex_bg = emit_hex_fn(true);\n  const emit_rgb_fn = (isBg = false) =>\n    /** @type {(this: string, r: number, g: number, b: number) => string} */\n    function (r, g, b) {\n      if (!_enable) return this;\n      const ansiMark = _get_color_by_rgb(r, g, b, isBg);\n      if (!ansiMark) return this;\n      return ansiMark + this + _reset_ctrl;\n    };\n  _strProto.rgb = emit_rgb_fn();\n  _strProto.rgb_bg = emit_rgb_fn(true);\n  _strProto.paint =\n    /** @type {(this: string, pt: Painter[]) => string} */\n    function (pt) {\n      return paint(pt, this);\n    };\n  \"up:A,down:B,right:C,left:D,next_line:E,prev_line:F\".split(\",\").forEach((pair) => {\n    const [method, dir] = pair.split(\":\");\n    // @ts-ignore ignore ts(7015)\n    _strProto[method] =\n      /** @type {(this: string, n?: number) => string} */\n      function (n = 1) {\n        if (!_enable) return this;\n        return `\\x1b[${n}${dir}` + this;\n      };\n  });\n  _strProto.column =\n    /** @type {(this: string, n: number) => string} */\n    function (n) {\n      if (!_enable) return this;\n      return `\\x1b[${n}G` + this;\n    };\n  _strProto.position =\n    /** @type {(this: string, x: number, y: number) => string} */\n    function (x, y) {\n      if (!_enable) return this;\n      return _position(x, y) + this;\n    };\n  /** @type {(pos: string) => (this: string) => string} */\n  const emit_position_fn = (pos) =>\n    function () {\n      if (!_enable) return this;\n      return pos + this;\n    };\n  _defineStringProp(\"load_position\", emit_position_fn(\"\\u001B[u\" /* ECtrlCode.loadPositionCode */));\n  _defineStringProp(\"save_position\", emit_position_fn(\"\\u001B[s\" /* ECtrlCode.savePositionCode */));\n  _defineStringProp(\"clear_screen\", emit_position_fn(\"\\u001B[2J\" /* ECtrlCode.clearScreenCode */));\n  _defineStringProp(\"clear_line\", emit_position_fn(\"\\u001B[K\" /* ECtrlCode.clearLineCode */));\n};\nconst _theme_init = () => {\n  for (const key in _theme) {\n    _defineStringProp(key, function () {\n      if (_enable) {\n        let s = _theme[key];\n        if (!s) return this;\n        return colors(s, this);\n      }\n      return this;\n    });\n  }\n};\nconst _init = () => {\n  _support = detectSupport();\n  if (isDefined()) return;\n  setDefined();\n  _codes_init();\n  _theme_init();\n};\n_init();\n/** @type {(color: string | string[], value: string, noreset?: boolean) => string} */\nexport const colors = (color, value, noreset) => {\n  if (_enable && _support >= 1 /* Support.BASE */) {\n    if (typeof color === \"string\") {\n      let s = _theme[color];\n      if (s) return colors(s, value);\n      var code = _get_code(color);\n      if (!code) return value;\n      if (noreset) return code + value;\n      return code + value + _reset_ctrl;\n    } else {\n      let result = value;\n      for (let i = color.length - 1; i >= 0; --i) {\n        var code = _get_code(color[i]);\n        if (code != null) result = code + result;\n      }\n      if (noreset) return result;\n      return result + _reset_ctrl;\n    }\n  }\n  return value;\n};\n/** @type {(value?: boolean) => void} */\nexport const enable = (value = true) => {\n  _enable = value;\n};\n/** @type {(support?: Support) => Support} */\nexport const support = (support) => {\n  if (typeof support !== \"undefined\") _support = support;\n  return _support;\n};\n/**\n * update theme object\n *\n * @param {TColorsMap} theme new theme\n */\nexport const theme = (theme) => {\n  setTheme(theme);\n};\n/**\n * @param {number} x\n * @param {number} y\n */\nexport const position = (x, y) => {\n  if (isBrowser || !_enable) return;\n  process.stdout.write(_position(x, y));\n};\nexport const save_position = () => {\n  if (isBrowser || !_enable) return;\n  process.stdout.write(\"\\u001B[s\" /* ECtrlCode.savePositionCode */);\n};\nexport const load_position = () => {\n  if (isBrowser || !_enable) return;\n  process.stdout.write(\"\\u001B[u\" /* ECtrlCode.loadPositionCode */);\n};\nexport const clear_screen = () => {\n  if (isBrowser || !_enable) return;\n  process.stdout.write(\"\\u001B[2J\" /* ECtrlCode.clearScreenCode */);\n};\n/**\n * @param {boolean=} show\n */\nexport const show_cursor = (show = true) => {\n  if (isBrowser || !_enable) return;\n  process.stdout.write(show ? \"\\u001B[?25h\" /* ECtrlCode.showCursorCode */ : \"\\u001B[?25l\" /* ECtrlCode.hideCursorCode */);\n};\n/**\n * @param {boolean=} value\n */\nexport const more_detail_on_color256 = (value = true) => {\n  _more_detail_on_color256 = value;\n  return _more_detail_on_color256;\n};\n/** @type {(paint: Painter[], value: string) => string} */\nexport const paint = (paint, value) => {\n  if (!_enable || paint == null || value == null || value.length === 0 || paint.length === 0) return value;\n  return applyPaint(paint, value, colors);\n};\nexport const version = \"1.6.5\";"],"names":["_Support","DISABLE","BASE","ANSI256","ANSI24bits","_codes_base","reset","bold","dim","italic","underline","inverse","hidden","strikethrough","black","red","green","yellow","blue","magenta","cyan","white","bg_black","bg_red","bg_green","bg_yellow","bg_blue","bg_magenta","bg_cyan","bg_white","_codes_advanced","brightblack","brightred","brightgreen","brightyellow","brightblue","brightmagenta","brightcyan","brightwhite","bg_brightblack","bg_brightred","bg_brightgreen","bg_brightyellow","bg_brightblue","bg_brightmagenta","bg_brightcyan","bg_brightwhite","n2h","value","digits","n","length","_color_web_safe_map","_color_web_safe_list","_color_bg_web_safe_map","_color_bg_web_safe_list","_color_gray_map","_color_gray_list","_color_bg_gray_map","_color_bg_gray_list","hexStrA","hexNumA","key","i","pos","hex","c","push","r","g","b","grayLevel","_color_web_safe_map_init","_default_theme","verbose","info","debug","warning","error","custom0","custom1","custom2","custom3","custom4","custom5","custom6","custom7","custom8","custom9","_theme","replace_all","search","replace","indexOf","split","join","isBrowser","window","document","web_safe_list","Array","gray_list","getRgbFrom256Index","index","level","rgb","cubeIndex","bIndex","gIndex","rIndex","_tc","color","isBg","SGR_TO_CSS_Map","SGR_TO_CSS","cssPropArry","idx","pargeStyle","token","cssState","tdCriteria","finded","findIndex","state","startsWith","tdValues","slice","filter","rule","splice","isa","isArray","handleResetCode","code","tokens","isChanged","resolveAnsiColor","codeOffset","codes","sgr2css","css","propName","color256Index","rgbEntry","comingPropName","isTextDecoration","reTdTest","cssStateLen","_css","test","prev","trim","next","includes","updateCssState","strs","contents","strsLen","toConsoleArgsFromAnsiNext","format","comingArgs","text","isStyleApplied","formatLine","args","formatLen","lastIndex","offset","comingArgsIdx","ch","matchStart","codesStart","codesLen","fragment","concat","_log","console","log","logAnsi","parser","argsIn","fmtArgs","_get_gray_code","flag","_enable","_support","_get_256bits_color_code","_get_safemap_and_graylist_args","bg","mapListArgs","_more_detail_on_color256","_get_color_by_hex","hexcode","_get_truecolor_bg","_get_truecolor","_get_web_safe_code_by_hex","map","list","map2","list2","_get_web_safe_code_search","m","Number","MAX_VALUE","forEach","item","v","_get_code","c0","toLowerCase","_check_reset_end","endsWith","_position","x","y","_strProto","String","prototype","_defineStringProp","fn","Object","defineProperty","get","enumerable","configurable","e","warn","message","emitColorsFunction","ansiEscape","this","ansiValue","globalThis","proc","process","undefined","versions","node","env","argv","find","arg","platform","COLORTERM","some","sign","CI_NAME","TEAMCITY_VERSION","termVersion","TERM_PROGRAM_VERSION","TERM_PROGRAM","eTerm","TERM","detectSupport","COLORS_DEFINED","_color_at_256_or_gray_impl","dis","idxOrLevel","_colors256_rnd_impl","fn_name","rnd","Math","random","joined","charsLen","colors256_rnd","colors256_rnd_bg","color_at_256","color_bg_at_256","gray","gray_bg","grey","grey_bg","colors","noreset","emit_hex_fn","h","hex_bg","emit_rgb_fn","ansiMark","_get_web_safe_code_by_rgb","_get_color_by_rgb","rgb_bg","paint","pt","pair","method","dir","column","position","emit_position_fn","_codes_init","s","_theme_init","result","enable","support","theme","setTheme","stdout","write","save_position","load_position","clear_screen","show_cursor","show","more_detail_on_color256","colorize","cs","RegExp","ar","k","applyPaint","version"],"sourceRoot":""}