text: 
        import {createRequire as __cjsCompatRequire} from 'module';
        const require = __cjsCompatRequire(import.meta.url);
        const __ESM_IMPORT_META_URL__ = import.meta.url;
      
  var __defProp = Object.defineProperty;
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  var __hasOwnProp = Object.prototype.hasOwnProperty;
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  var __spreadValues = (a, b) => {
    for (var prop in b || (b = {}))
      if (__hasOwnProp.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    if (__getOwnPropSymbols)
      for (var prop of __getOwnPropSymbols(b)) {
        if (__propIsEnum.call(b, prop))
          __defNormalProp(a, prop, b[prop]);
      }
    return a;
  };
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
    get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
  }) : x)(function(x) {
    if (typeof require !== "undefined")
      return require.apply(this, arguments);
    throw new Error('Dynamic require of "' + x + '" is not supported');
  });
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/logging/src/logger.mjs
  var LogLevel;
  (function(LogLevel2) {
    LogLevel2[LogLevel2["debug"] = 0] = "debug";
    LogLevel2[LogLevel2["info"] = 1] = "info";
    LogLevel2[LogLevel2["warn"] = 2] = "warn";
    LogLevel2[LogLevel2["error"] = 3] = "error";
  })(LogLevel || (LogLevel = {}));
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/logging/src/console_logger.mjs
  var RESET = "[0m";
  var RED = "[31m";
  var YELLOW = "[33m";
  var BLUE = "[36m";
  var DEBUG = `${BLUE}Debug:${RESET}`;
  var WARN = `${YELLOW}Warning:${RESET}`;
  var ERROR = `${RED}Error:${RESET}`;
  var ConsoleLogger = class {
    constructor(level) {
      this.level = level;
    }
    debug(...args) {
      if (this.level <= LogLevel.debug)
        console.debug(DEBUG, ...args);
    }
    info(...args) {
      if (this.level <= LogLevel.info)
        console.info(...args);
    }
    warn(...args) {
      if (this.level <= LogLevel.warn)
        console.warn(WARN, ...args);
    }
    error(...args) {
      if (this.level <= LogLevel.error)
        console.error(ERROR, ...args);
    }
  };
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/file_system/src/compiler_host.mjs
  import {
    EOL
  } from "os";
  import ts from "typescript";
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/file_system/src/invalid_file_system.mjs
  var InvalidFileSystem = class {
    exists(path) {
      throw makeError();
    }
    readFile(path) {
      throw makeError();
    }
    readFileBuffer(path) {
      throw makeError();
    }
    writeFile(path, data, exclusive) {
      throw makeError();
    }
    removeFile(path) {
      throw makeError();
    }
    symlink(target, path) {
      throw makeError();
    }
    readdir(path) {
      throw makeError();
    }
    lstat(path) {
      throw makeError();
    }
    stat(path) {
      throw makeError();
    }
    pwd() {
      throw makeError();
    }
    chdir(path) {
      throw makeError();
    }
    extname(path) {
      throw makeError();
    }
    copyFile(from, to) {
      throw makeError();
    }
    moveFile(from, to) {
      throw makeError();
    }
    ensureDir(path) {
      throw makeError();
    }
    removeDeep(path) {
      throw makeError();
    }
    isCaseSensitive() {
      throw makeError();
    }
    resolve(...paths) {
      throw makeError();
    }
    dirname(file) {
      throw makeError();
    }
    join(basePath, ...paths) {
      throw makeError();
    }
    isRoot(path) {
      throw makeError();
    }
    isRooted(path) {
      throw makeError();
    }
    relative(from, to) {
      throw makeError();
    }
    basename(filePath, extension) {
      throw makeError();
    }
    realpath(filePath) {
      throw makeError();
    }
    getDefaultLibLocation() {
      throw makeError();
    }
    normalize(path) {
      throw makeError();
    }
  };
  function makeError() {
    return new Error("FileSystem has not been configured. Please call `setFileSystem()` before calling this method.");
  }
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/file_system/src/util.mjs
  var TS_DTS_JS_EXTENSION = /(?:\.d)?\.ts$|\.js$/;
  function normalizeSeparators(path) {
    return path.replace(/\\/g, "/");
  }
  function stripExtension(path) {
    return path.replace(TS_DTS_JS_EXTENSION, "");
  }
  function getSourceFileOrError(program, fileName) {
    const sf = program.getSourceFile(fileName);
    if (sf === void 0) {
      throw new Error(`Program does not contain "${fileName}" - available files are ${program.getSourceFiles().map((sf2) => sf2.fileName).join(", ")}`);
    }
    return sf;
  }
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/file_system/src/helpers.mjs
  var fs = new InvalidFileSystem();
  function getFileSystem() {
    return fs;
  }
  function setFileSystem(fileSystem) {
    fs = fileSystem;
  }
  function absoluteFrom(path) {
    if (!fs.isRooted(path)) {
      throw new Error(`Internal Error: absoluteFrom(${path}): path is not absolute`);
    }
    return fs.resolve(path);
  }
  var ABSOLUTE_PATH = Symbol("AbsolutePath");
  function absoluteFromSourceFile(sf) {
    const sfWithPatch = sf;
    if (sfWithPatch[ABSOLUTE_PATH] === void 0) {
      sfWithPatch[ABSOLUTE_PATH] = fs.resolve(sfWithPatch.fileName);
    }
    return sfWithPatch[ABSOLUTE_PATH];
  }
  function relativeFrom(path) {
    const normalized = normalizeSeparators(path);
    if (fs.isRooted(normalized)) {
      throw new Error(`Internal Error: relativeFrom(${path}): path is not relative`);
    }
    return normalized;
  }
  function dirname(file) {
    return fs.dirname(file);
  }
  function join(basePath, ...paths) {
    return fs.join(basePath, ...paths);
  }
  function resolve(basePath, ...paths) {
    return fs.resolve(basePath, ...paths);
  }
  function isRoot(path) {
    return fs.isRoot(path);
  }
  function isRooted(path) {
    return fs.isRooted(path);
  }
  function relative(from, to) {
    return fs.relative(from, to);
  }
  function basename(filePath, extension) {
    return fs.basename(filePath, extension);
  }
  function isLocalRelativePath(relativePath) {
    return !isRooted(relativePath) && !relativePath.startsWith("..");
  }
  function toRelativeImport(relativePath) {
    return isLocalRelativePath(relativePath) ? `./${relativePath}` : relativePath;
  }
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/file_system/src/compiler_host.mjs
  var NgtscCompilerHost = class {
    constructor(fs3, options = {}) {
      this.fs = fs3;
      this.options = options;
    }
    getSourceFile(fileName, languageVersion) {
      const text = this.readFile(fileName);
      return text !== void 0 ? ts.createSourceFile(fileName, text, languageVersion, true) : void 0;
    }
    getDefaultLibFileName(options) {
      return this.fs.join(this.getDefaultLibLocation(), ts.getDefaultLibFileName(options));
    }
    getDefaultLibLocation() {
      return this.fs.getDefaultLibLocation();
    }
    writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles) {
      const path = absoluteFrom(fileName);
      this.fs.ensureDir(this.fs.dirname(path));
      this.fs.writeFile(path, data);
    }
    getCurrentDirectory() {
      return this.fs.pwd();
    }
    getCanonicalFileName(fileName) {
      return this.useCaseSensitiveFileNames() ? fileName : fileName.toLowerCase();
    }
    useCaseSensitiveFileNames() {
      return this.fs.isCaseSensitive();
    }
    getNewLine() {
      switch (this.options.newLine) {
        case ts.NewLineKind.CarriageReturnLineFeed:
          return "\r\n";
        case ts.NewLineKind.LineFeed:
          return "\n";
        default:
          return EOL;
      }
    }
    fileExists(fileName) {
      const absPath = this.fs.resolve(fileName);
      return this.fs.exists(absPath) && this.fs.stat(absPath).isFile();
    }
    readFile(fileName) {
      const absPath = this.fs.resolve(fileName);
      if (!this.fileExists(absPath)) {
        return void 0;
      }
      return this.fs.readFile(absPath);
    }
  };
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/file_system/src/logical.mjs
  var LogicalProjectPath = {
    relativePathBetween: function(from, to) {
      const relativePath = relative(dirname(resolve(from)), resolve(to));
      return toRelativeImport(relativePath);
    }
  };
  var LogicalFileSystem = class {
    constructor(rootDirs, compilerHost) {
      this.compilerHost = compilerHost;
      this.cache = new Map();
      this.rootDirs = rootDirs.concat([]).sort((a, b) => b.length - a.length);
      this.canonicalRootDirs = this.rootDirs.map((dir) => this.compilerHost.getCanonicalFileName(dir));
    }
    logicalPathOfSf(sf) {
      return this.logicalPathOfFile(absoluteFrom(sf.fileName));
    }
    logicalPathOfFile(physicalFile) {
      const canonicalFilePath = this.compilerHost.getCanonicalFileName(physicalFile);
      if (!this.cache.has(canonicalFilePath)) {
        let logicalFile = null;
        for (let i = 0; i < this.rootDirs.length; i++) {
          const rootDir = this.rootDirs[i];
          const canonicalRootDir = this.canonicalRootDirs[i];
          if (isWithinBasePath(canonicalRootDir, canonicalFilePath)) {
            logicalFile = this.createLogicalProjectPath(physicalFile, rootDir);
            if (logicalFile.indexOf("/node_modules/") !== -1) {
              logicalFile = null;
            } else {
              break;
            }
          }
        }
        this.cache.set(canonicalFilePath, logicalFile);
      }
      return this.cache.get(canonicalFilePath);
    }
    createLogicalProjectPath(file, rootDir) {
      const logicalPath = stripExtension(file.substr(rootDir.length));
      return logicalPath.startsWith("/") ? logicalPath : "/" + logicalPath;
    }
  };
  function isWithinBasePath(base, path) {
    return isLocalRelativePath(relative(base, path));
  }
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/file_system/src/node_js_file_system.mjs
  import {
    copyFileSync,
    existsSync,
    lstatSync,
    mkdirSync,
    readFileSync,
    readdirSync,
    realpathSync,
    renameSync,
    rmdirSync,
    statSync,
    symlinkSync,
    unlinkSync,
    writeFileSync
  } from "fs";
  import module from "module";
  import {
    basename as basename2,
    dirname as dirname2,
    extname,
    isAbsolute,
    join as join2,
    relative as relative2,
    resolve as resolve2
  } from "path";
  import { fileURLToPath } from "url";
  var NodeJSPathManipulation = class {
    pwd() {
      return this.normalize(process.cwd());
    }
    chdir(dir) {
      process.chdir(dir);
    }
    resolve(...paths) {
      return this.normalize(resolve2(...paths));
    }
    dirname(file) {
      return this.normalize(dirname2(file));
    }
    join(basePath, ...paths) {
      return this.normalize(join2(basePath, ...paths));
    }
    isRoot(path) {
      return this.dirname(path) === this.normalize(path);
    }
    isRooted(path) {
      return isAbsolute(path);
    }
    relative(from, to) {
      return this.normalize(relative2(from, to));
    }
    basename(filePath, extension) {
      return basename2(filePath, extension);
    }
    extname(path) {
      return extname(path);
    }
    normalize(path) {
      return path.replace(/\\/g, "/");
    }
  };
  var isCommonJS = typeof __filename !== "undefined";
  var currentFileUrl = isCommonJS ? null : __ESM_IMPORT_META_URL__;
  var currentFileName = isCommonJS ? __filename : fileURLToPath(currentFileUrl);
  var NodeJSReadonlyFileSystem = class extends NodeJSPathManipulation {
    constructor() {
      super(...arguments);
      this._caseSensitive = void 0;
    }
    isCaseSensitive() {
      if (this._caseSensitive === void 0) {
        this._caseSensitive = !existsSync(this.normalize(toggleCase(currentFileName)));
      }
      return this._caseSensitive;
    }
    exists(path) {
      return existsSync(path);
    }
    readFile(path) {
      return readFileSync(path, "utf8");
    }
    readFileBuffer(path) {
      return readFileSync(path);
    }
    readdir(path) {
      return readdirSync(path);
    }
    lstat(path) {
      return lstatSync(path);
    }
    stat(path) {
      return statSync(path);
    }
    realpath(path) {
      return this.resolve(realpathSync(path));
    }
    getDefaultLibLocation() {
      const requireFn = isCommonJS ? __require : module.createRequire(currentFileUrl);
      return this.resolve(requireFn.resolve("typescript"), "..");
    }
  };
  var NodeJSFileSystem = class extends NodeJSReadonlyFileSystem {
    writeFile(path, data, exclusive = false) {
      writeFileSync(path, data, exclusive ? { flag: "wx" } : void 0);
    }
    removeFile(path) {
      unlinkSync(path);
    }
    symlink(target, path) {
      symlinkSync(target, path);
    }
    copyFile(from, to) {
      copyFileSync(from, to);
    }
    moveFile(from, to) {
      renameSync(from, to);
    }
    ensureDir(path) {
      const parents = [];
      while (!this.isRoot(path) && !this.exists(path)) {
        parents.push(path);
        path = this.dirname(path);
      }
      while (parents.length) {
        this.safeMkdir(parents.pop());
      }
    }
    removeDeep(path) {
      rmdirSync(path, { recursive: true });
    }
    safeMkdir(path) {
      try {
        mkdirSync(path);
      } catch (err) {
        if (!this.exists(path) || !this.stat(path).isDirectory()) {
          throw err;
        }
      }
    }
  };
  function toggleCase(str) {
    return str.replace(/\w/g, (ch) => ch.toUpperCase() === ch ? ch.toLowerCase() : ch.toUpperCase());
  }
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/sourcemaps/src/content_origin.mjs
  var ContentOrigin;
  (function(ContentOrigin2) {
    ContentOrigin2[ContentOrigin2["Provided"] = 0] = "Provided";
    ContentOrigin2[ContentOrigin2["Inline"] = 1] = "Inline";
    ContentOrigin2[ContentOrigin2["FileSystem"] = 2] = "FileSystem";
  })(ContentOrigin || (ContentOrigin = {}));
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/sourcemaps/src/source_file.mjs
  import mapHelpers from "convert-source-map";
  import { decode, encode } from "sourcemap-codec";
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/sourcemaps/src/segment_marker.mjs
  function compareSegments(a, b) {
    return a.position - b.position;
  }
  function offsetSegment(startOfLinePositions, marker, offset) {
    if (offset === 0) {
      return marker;
    }
    let line = marker.line;
    const position = marker.position + offset;
    while (line < startOfLinePositions.length - 1 && startOfLinePositions[line + 1] <= position) {
      line++;
    }
    while (line > 0 && startOfLinePositions[line] > position) {
      line--;
    }
    const column = position - startOfLinePositions[line];
    return { line, column, position, next: void 0 };
  }
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/sourcemaps/src/source_file.mjs
  function removeSourceMapComments(contents) {
    return mapHelpers.removeMapFileComments(mapHelpers.removeComments(contents)).replace(/\n\n$/, "\n");
  }
  var SourceFile = class {
    constructor(sourcePath, contents, rawMap, sources, fs3) {
      this.sourcePath = sourcePath;
      this.contents = contents;
      this.rawMap = rawMap;
      this.sources = sources;
      this.fs = fs3;
      this.contents = removeSourceMapComments(contents);
      this.startOfLinePositions = computeStartOfLinePositions(this.contents);
      this.flattenedMappings = this.flattenMappings();
    }
    renderFlattenedSourceMap() {
      const sources = new IndexedMap();
      const names = new IndexedSet();
      const mappings = [];
      const sourcePathDir = this.fs.dirname(this.sourcePath);
      const relativeSourcePathCache = new Cache((input) => this.fs.relative(sourcePathDir, input));
      for (const mapping of this.flattenedMappings) {
        const sourceIndex = sources.set(relativeSourcePathCache.get(mapping.originalSource.sourcePath), mapping.originalSource.contents);
        const mappingArray = [
          mapping.generatedSegment.column,
          sourceIndex,
          mapping.originalSegment.line,
          mapping.originalSegment.column
        ];
        if (mapping.name !== void 0) {
          const nameIndex = names.add(mapping.name);
          mappingArray.push(nameIndex);
        }
        const line = mapping.generatedSegment.line;
        while (line >= mappings.length) {
          mappings.push([]);
        }
        mappings[line].push(mappingArray);
      }
      const sourceMap = {
        version: 3,
        file: this.fs.relative(sourcePathDir, this.sourcePath),
        sources: sources.keys,
        names: names.values,
        mappings: encode(mappings),
        sourcesContent: sources.values
      };
      return sourceMap;
    }
    getOriginalLocation(line, column) {
      if (this.flattenedMappings.length === 0) {
        return null;
      }
      let position;
      if (line < this.startOfLinePositions.length) {
        position = this.startOfLinePositions[line] + column;
      } else {
        position = this.contents.length;
      }
      const locationSegment = { line, column, position, next: void 0 };
      let mappingIndex = findLastMappingIndexBefore(this.flattenedMappings, locationSegment, false, 0);
      if (mappingIndex < 0) {
        mappingIndex = 0;
      }
      const { originalSegment, originalSource, generatedSegment } = this.flattenedMappings[mappingIndex];
      const offset = locationSegment.position - generatedSegment.position;
      const offsetOriginalSegment = offsetSegment(originalSource.startOfLinePositions, originalSegment, offset);
      return {
        file: originalSource.sourcePath,
        line: offsetOriginalSegment.line,
        column: offsetOriginalSegment.column
      };
    }
    flattenMappings() {
      const mappings = parseMappings(this.rawMap && this.rawMap.map, this.sources, this.startOfLinePositions);
      ensureOriginalSegmentLinks(mappings);
      const flattenedMappings = [];
      for (let mappingIndex = 0; mappingIndex < mappings.length; mappingIndex++) {
        const aToBmapping = mappings[mappingIndex];
        const bSource = aToBmapping.originalSource;
        if (bSource.flattenedMappings.length === 0) {
          flattenedMappings.push(aToBmapping);
          continue;
        }
        const incomingStart = aToBmapping.originalSegment;
        const incomingEnd = incomingStart.next;
        let outgoingStartIndex = findLastMappingIndexBefore(bSource.flattenedMappings, incomingStart, false, 0);
        if (outgoingStartIndex < 0) {
          outgoingStartIndex = 0;
        }
        const outgoingEndIndex = incomingEnd !== void 0 ? findLastMappingIndexBefore(bSource.flattenedMappings, incomingEnd, true, outgoingStartIndex) : bSource.flattenedMappings.length - 1;
        for (let bToCmappingIndex = outgoingStartIndex; bToCmappingIndex <= outgoingEndIndex; bToCmappingIndex++) {
          const bToCmapping = bSource.flattenedMappings[bToCmappingIndex];
          flattenedMappings.push(mergeMappings(this, aToBmapping, bToCmapping));
        }
      }
      return flattenedMappings;
    }
  };
  function findLastMappingIndexBefore(mappings, marker, exclusive, lowerIndex) {
    let upperIndex = mappings.length - 1;
    const test = exclusive ? -1 : 0;
    if (compareSegments(mappings[lowerIndex].generatedSegment, marker) > test) {
      return -1;
    }
    let matchingIndex = -1;
    while (lowerIndex <= upperIndex) {
      const index = upperIndex + lowerIndex >> 1;
      if (compareSegments(mappings[index].generatedSegment, marker) <= test) {
        matchingIndex = index;
        lowerIndex = index + 1;
      } else {
        upperIndex = index - 1;
      }
    }
    return matchingIndex;
  }
  function mergeMappings(generatedSource, ab, bc) {
    const name = bc.name || ab.name;
    const diff = compareSegments(bc.generatedSegment, ab.originalSegment);
    if (diff > 0) {
      return {
        name,
        generatedSegment: offsetSegment(generatedSource.startOfLinePositions, ab.generatedSegment, diff),
        originalSource: bc.originalSource,
        originalSegment: bc.originalSegment
      };
    } else {
      return {
        name,
        generatedSegment: ab.generatedSegment,
        originalSource: bc.originalSource,
        originalSegment: offsetSegment(bc.originalSource.startOfLinePositions, bc.originalSegment, -diff)
      };
    }
  }
  function parseMappings(rawMap, sources, generatedSourceStartOfLinePositions) {
    if (rawMap === null) {
      return [];
    }
    const rawMappings = decode(rawMap.mappings);
    if (rawMappings === null) {
      return [];
    }
    const mappings = [];
    for (let generatedLine = 0; generatedLine < rawMappings.length; generatedLine++) {
      const generatedLineMappings = rawMappings[generatedLine];
      for (const rawMapping of generatedLineMappings) {
        if (rawMapping.length >= 4) {
          const originalSource = sources[rawMapping[1]];
          if (originalSource === null || originalSource === void 0) {
            continue;
          }
          const generatedColumn = rawMapping[0];
          const name = rawMapping.length === 5 ? rawMap.names[rawMapping[4]] : void 0;
          const line = rawMapping[2];
          const column = rawMapping[3];
          const generatedSegment = {
            line: generatedLine,
            column: generatedColumn,
            position: generatedSourceStartOfLinePositions[generatedLine] + generatedColumn,
            next: void 0
          };
          const originalSegment = {
            line,
            column,
            position: originalSource.startOfLinePositions[line] + column,
            next: void 0
          };
          mappings.push({ name, generatedSegment, originalSegment, originalSource });
        }
      }
    }
    return mappings;
  }
  function extractOriginalSegments(mappings) {
    const originalSegments = new Map();
    for (const mapping of mappings) {
      const originalSource = mapping.originalSource;
      if (!originalSegments.has(originalSource)) {
        originalSegments.set(originalSource, []);
      }
      const segments = originalSegments.get(originalSource);
      segments.push(mapping.originalSegment);
    }
    originalSegments.forEach((segmentMarkers) => segmentMarkers.sort(compareSegments));
    return originalSegments;
  }
  function ensureOriginalSegmentLinks(mappings) {
    const segmentsBySource = extractOriginalSegments(mappings);
    segmentsBySource.forEach((markers) => {
      for (let i = 0; i < markers.length - 1; i++) {
        markers[i].next = markers[i + 1];
      }
    });
  }
  function computeStartOfLinePositions(str) {
    const NEWLINE_MARKER_OFFSET = 1;
    const lineLengths = computeLineLengths(str);
    const startPositions = [0];
    for (let i = 0; i < lineLengths.length - 1; i++) {
      startPositions.push(startPositions[i] + lineLengths[i] + NEWLINE_MARKER_OFFSET);
    }
    return startPositions;
  }
  function computeLineLengths(str) {
    return str.split(/\n/).map((s) => s.length);
  }
  var IndexedMap = class {
    constructor() {
      this.map = new Map();
      this.keys = [];
      this.values = [];
    }
    set(key, value) {
      if (this.map.has(key)) {
        return this.map.get(key);
      }
      const index = this.values.push(value) - 1;
      this.keys.push(key);
      this.map.set(key, index);
      return index;
    }
  };
  var IndexedSet = class {
    constructor() {
      this.map = new Map();
      this.values = [];
    }
    add(value) {
      if (this.map.has(value)) {
        return this.map.get(value);
      }
      const index = this.values.push(value) - 1;
      this.map.set(value, index);
      return index;
    }
  };
  var Cache = class {
    constructor(computeFn) {
      this.computeFn = computeFn;
      this.map = new Map();
    }
    get(input) {
      if (!this.map.has(input)) {
        this.map.set(input, this.computeFn(input));
      }
      return this.map.get(input);
    }
  };
  
  // bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/sourcemaps/src/source_file_loader.mjs
  import mapHelpers2 from "convert-source-map";
  var SCHEME_MATCHER = /^([a-z][a-z0-9.-]*):\/\//i;
  var SourceFileLoader = class {
    constructor(fs3, logger, schemeMap) {
      this.fs = fs3;
      this.logger = logger;
      this.schemeMap = schemeMap;
      this.currentPaths = [];
    }
    loadSourceFile(sourcePath, contents = null, mapAndPath = null) {
      const contentsOrigin = contents !== null ? ContentOrigin.Provided : ContentOrigin.FileSystem;
      const sourceMapInfo = mapAndPath && __spreadValues({ origin: ContentOrigin.Provided }, mapAndPath);
      return this.loadSourceFileInternal(sourcePath, contents, contentsOrigin, sourceMapInfo);
    }
    loadSourceFileInternal(sourcePath, contents, sourceOrigin, sourceMapInfo) {
      const previousPaths = this.currentPaths.slice();
      try {
        if (contents === null) {
          if (!this.fs.exists(sourcePath)) {
            return null;
          }
          contents = this.readSourceFile(sourcePath);
        }
        if (sourceMapInfo === null) {
          sourceMapInfo = this.loadSourceMap(sourcePath, contents, sourceOrigin);
        }
        let sources = [];
        if (sourceMapInfo !== null) {
          const basePath = sourceMapInfo.mapPath || sourcePath;
          sources = this.processSources(basePath, sourceMapInfo);
        }
        return new SourceFile(sourcePath, contents, sourceMapInfo, sources, this.fs);
      } catch (e) {
        this.logger.warn(`Unable to fully load ${sourcePath} for source-map flattening: ${e.message}`);
        return null;
      } finally {
        this.currentPaths = previousPaths;
      }
    }
    loadSourceMap(sourcePath, sourceContents, sourceOrigin) {
      const lastLine = this.getLastNonEmptyLine(sourceContents);
      const inline = mapHelpers2.commentRegex.exec(lastLine);
      if (inline !== null) {
        return {
          map: mapHelpers2.fromComment(inline.pop()).sourcemap,
          mapPath: null,
          origin: ContentOrigin.Inline
        };
      }
      if (sourceOrigin === ContentOrigin.Inline) {
        return null;
      }
      const external = mapHelpers2.mapFileCommentRegex.exec(lastLine);
      if (external) {
        try {
          const fileName = external[1] || external[2];
          const externalMapPath = this.fs.resolve(this.fs.dirname(sourcePath), fileName);
          return {
            map: this.readRawSourceMap(externalMapPath),
            mapPath: externalMapPath,
            origin: ContentOrigin.FileSystem
          };
        } catch (e) {
          this.logger.warn(`Unable to fully load ${sourcePath} for source-map flattening: ${e.message}`);
          return null;
        }
      }
      const impliedMapPath = this.fs.resolve(sourcePath + ".map");
      if (this.fs.exists(impliedMapPath)) {
        return {
          map: this.readRawSourceMap(impliedMapPath),
          mapPath: impliedMapPath,
          origin: ContentOrigin.FileSystem
        };
      }
      return null;
    }
    processSources(basePath, { map, origin: sourceMapOrigin }) {
      const sourceRoot = this.fs.resolve(this.fs.dirname(basePath), this.replaceSchemeWithPath(map.sourceRoot || ""));
      return map.sources.map((source, index) => {
        const path = this.fs.resolve(sourceRoot, this.replaceSchemeWithPath(source));
        const content = map.sourcesContent && map.sourcesContent[index] || null;
        const sourceOrigin = content !== null && sourceMapOrigin !== ContentOrigin.Provided ? ContentOrigin.Inline : ContentOrigin.FileSystem;
        return this.loadSourceFileInternal(path, content, sourceOrigin, null);
      });
    }
    readSourceFile(sourcePath) {
      this.trackPath(sourcePath);
      return this.fs.readFile(sourcePath);
    }
    readRawSourceMap(mapPath) {
      this.trackPath(mapPath);
      return JSON.parse(this.fs.readFile(mapPath));
    }
    trackPath(path) {
      if (this.currentPaths.includes(path)) {
        throw new Error(`Circular source file mapping dependency: ${this.currentPaths.join(" -> ")} -> ${path}`);
      }
      this.currentPaths.push(path);
    }
    getLastNonEmptyLine(contents) {
      let trailingWhitespaceIndex = contents.length - 1;
      while (trailingWhitespaceIndex > 0 && (contents[trailingWhitespaceIndex] === "\n" || contents[trailingWhitespaceIndex] === "\r")) {
        trailingWhitespaceIndex--;
      }
      let lastRealLineIndex = contents.lastIndexOf("\n", trailingWhitespaceIndex - 1);
      if (lastRealLineIndex === -1) {
        lastRealLineIndex = 0;
      }
      return contents.substr(lastRealLineIndex + 1);
    }
    replaceSchemeWithPath(path) {
      return path.replace(SCHEME_MATCHER, (_, scheme) => this.schemeMap[scheme.toLowerCase()] || "");
    }
  };
  export {
    ConsoleLogger,
    LogLevel,
    LogicalFileSystem,
    LogicalProjectPath,
    NgtscCompilerHost,
    NodeJSFileSystem,
    SourceFile,
    SourceFileLoader,
    absoluteFrom,
    absoluteFromSourceFile,
    basename,
    dirname,
    getFileSystem,
    getSourceFileOrError,
    isLocalRelativePath,
    isRoot,
    isRooted,
    join,
    relative,
    relativeFrom,
    resolve,
    setFileSystem,
    toRelativeImport
  };
  /**
   * @license
   * Copyright Google LLC All Rights Reserved.
   *
   * Use of this source code is governed by an MIT-style license that can be
   * found in the LICENSE file at https://angular.io/license
   */
  //# sourceMappingURL=localize.js.map
  