import r from"../../_virtual/_node_os.mjs";import t from"../../_virtual/_node_tty.mjs";import{__require as o}from"../has-flag/index.mjs";var e,n;function i(){if(n)return e;n=1;const i=r,s=t,l=o(),{env:u}=process;let c;function R(r){return 0!==r&&{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function a(r,t){if(0===c)return 0;if(l("color=16m")||l("color=full")||l("color=truecolor"))return 3;if(l("color=256"))return 2;if(r&&!t&&void 0===c)return 0;const o=c||0;if("dumb"===u.TERM)return o;if("win32"===process.platform){const r=i.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in u)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in u)||"codeship"===u.CI_NAME?1:o;if("TEAMCITY_VERSION"in u)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(u.TEAMCITY_VERSION)?1:0;if("truecolor"===u.COLORTERM)return 3;if("TERM_PROGRAM"in u){const r=parseInt((u.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(u.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(u.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(u.TERM)||"COLORTERM"in u?1:o}return l("no-color")||l("no-colors")||l("color=false")||l("color=never")?c=0:(l("color")||l("colors")||l("color=true")||l("color=always"))&&(c=1),"FORCE_COLOR"in u&&(c="true"===u.FORCE_COLOR?1:"false"===u.FORCE_COLOR?0:0===u.FORCE_COLOR.length?1:Math.min(parseInt(u.FORCE_COLOR,10),3)),e={supportsColor:function(r){return R(a(r,r&&r.isTTY))},stdout:R(a(!0,s.isatty(1))),stderr:R(a(!0,s.isatty(2)))}}export{i as __require};