// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

// Keep this up-to-date with Deno.build.os
export type OSType =
  | "darwin"
  | "linux"
  | "windows"
  | "freebsd"
  | "netbsd"
  | "aix"
  | "solaris"
  | "illumos";

export const osType: OSType = (() => {
  // deno-lint-ignore no-explicit-any
  const { Deno } = globalThis as any;
  if (typeof Deno?.build?.os === "string") {
    return Deno.build.os;
  }

  // deno-lint-ignore no-explicit-any
  const { navigator } = globalThis as any;
  if (navigator?.appVersion?.includes?.("Win")) {
    return "windows";
  }

  return "linux";
})();

export const isWindows = osType === "windows";

// denoCacheMetadata={"headers":{"content-length":"705","access-control-expose-headers":"*","content-type":"text/typescript","cf-cache-status":"HIT","set-cookie":"__cf_bm=N3smhvNDRTDYPk4L3iV8JAvT.AIdpPbMYVeRK8f9MMY-1785241875.2671487-1.0.1.1-2WnMyNpCoc49IENMZAd35PVxaiJYX_BUoxg.Y0GwZ24o4GrtUTcCQAEOspu54FzI0q5llmmBJq9wa6kfGb0SnnTlZ63eZWDcorz62XaaQdGdcW2P6J_XBt8IwUg3chs2; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","alt-svc":"h3=\":443\"; ma=86400","access-control-allow-origin":"*","cache-control":"public, max-age=31536000, immutable","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=dmH1s%2FSAYVR%2BoVVve8Tnh0hkel5CTExzRSN9i5WsTdD6T7uccCe3gDk5%2Bi4B98bMpSVhwW9QqhLjiQjHiUZf%2BhSdKoAjiCzJWp4WK6d6tcozleVyz1gDM90%3D\"}]}","accept-ranges":"bytes","age":"1291810","cross-origin-resource-policy":"cross-origin","x-jsr-backend":"modules","x-robots-tag":"noindex","etag":"\"f3f87de8f7adb28ce38f25edacc62fbe\"","server":"cloudflare","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","cf-ray":"a223e6586c3c7db6-LAX","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","date":"Tue, 28 Jul 2026 12:31:15 GMT","vary":"Origin","x-content-type-options":"nosniff"},"url":"https://jsr.io/@std/path/0.224.0/_os.ts","time":1785241875}