{"version":3,"file":"path.mjs","names":[],"sources":["../../src/utils/path.ts"],"sourcesContent":["/**\n * Extract directory from path (should also work with windows paths)\n *\n * @param path the path to extract the directory from\n * @returns the directory path\n */\nexport function getDirFromFilePath(path: string) {\n  return path.substring(0, Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\\\')))\n}\n\n/**\n * Combine multiple uri parts into a single uri taking into account slashes.\n *\n * @param parts the parts to combine\n * @returns the combined url\n */\nexport function joinUriParts(base: string, parts: string[]) {\n  if (parts.length === 0) return base\n\n  // take base without trailing /\n  let combined = base.trim()\n  combined = base.endsWith('/') ? base.slice(0, base.length - 1) : base\n\n  for (const part of parts) {\n    // Remove leading and trailing /\n    let strippedPart = part.trim()\n    strippedPart = strippedPart.startsWith('/') ? strippedPart.slice(1) : strippedPart\n    strippedPart = strippedPart.endsWith('/') ? strippedPart.slice(0, strippedPart.length - 1) : strippedPart\n\n    // Don't want to add if empty\n    if (strippedPart === '') continue\n\n    combined += `/${strippedPart}`\n  }\n\n  return combined\n}\n"],"mappings":";;;;;;;;;AAMA,SAAgB,mBAAmB,MAAc;AAC/C,QAAO,KAAK,UAAU,GAAG,KAAK,IAAI,KAAK,YAAY,IAAI,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC;;;;;;;;AASnF,SAAgB,aAAa,MAAc,OAAiB;AAC1D,KAAI,MAAM,WAAW,EAAG,QAAO;CAG/B,IAAI,WAAW,KAAK,MAAM;AAC1B,YAAW,KAAK,SAAS,IAAI,GAAG,KAAK,MAAM,GAAG,KAAK,SAAS,EAAE,GAAG;AAEjE,MAAK,MAAM,QAAQ,OAAO;EAExB,IAAI,eAAe,KAAK,MAAM;AAC9B,iBAAe,aAAa,WAAW,IAAI,GAAG,aAAa,MAAM,EAAE,GAAG;AACtE,iBAAe,aAAa,SAAS,IAAI,GAAG,aAAa,MAAM,GAAG,aAAa,SAAS,EAAE,GAAG;AAG7F,MAAI,iBAAiB,GAAI;AAEzB,cAAY,IAAI;;AAGlB,QAAO"}