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

import type { GlobOptions } from "./_common/glob_to_reg_exp.ts";
import { isWindows } from "./_os.ts";
import { normalizeGlob as posixNormalizeGlob } from "./posix/normalize_glob.ts";
import {
  normalizeGlob as windowsNormalizeGlob,
} from "./windows/normalize_glob.ts";

export type { GlobOptions };

/** Like normalize(), but doesn't collapse "**\/.." when `globstar` is true. */
export function normalizeGlob(
  glob: string,
  options: GlobOptions = {},
): string {
  return isWindows
    ? windowsNormalizeGlob(glob, options)
    : posixNormalizeGlob(glob, options);
}

// denoCacheMetadata={"headers":{"nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","content-length":"689","x-content-type-options":"nosniff","alt-svc":"h3=\":443\"; ma=86400","x-robots-tag":"noindex","age":"4208791","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';","server":"cloudflare","x-jsr-backend":"modules","access-control-allow-origin":"*","access-control-expose-headers":"*","cache-control":"public, max-age=31536000, immutable","cf-cache-status":"HIT","set-cookie":"__cf_bm=QZgrLMOae5QQ3rmqfjQxYDnJR75pPK5pGSBWx.2d4gA-1785241875.1533213-1.0.1.1-RgvzliQX3YfHe3SeBY1_Y0NXA9IcAqwVegwx3qWHcfio.J3OUrcvw.komeM0edj9NpxtI_Z8gCLbBhoB3o_CU4eaYnqclRGKaFmPSNpwF.G1hbGewvY2cNmX6Bsa2ezu; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","accept-ranges":"bytes","date":"Tue, 28 Jul 2026 12:31:15 GMT","content-type":"text/typescript","cf-ray":"a223e657ba4a7db6-LAX","etag":"\"8ea81a573f6d02862a04d81d673166fe\"","vary":"Origin","cross-origin-resource-policy":"cross-origin","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=h58Z3r31V2zKYQdmGV9loK%2BZdeAR9JdGJ64zrLns8aXMmXyAQbmC9bWyWYXKgYP2gFePCuCLhtS62CwYujILCeUkYWyijIrmZq%2FxPPBKI6M7kT2H%2Fx5%2B2Tk%3D\"}]}"},"url":"https://jsr.io/@std/path/0.224.0/normalize_glob.ts","time":1785241875}