{"version":3,"file":"index.cjs","names":[],"sources":["../../src/utils/dispatch-sequential.ts","../../src/utils/logger.ts"],"sourcesContent":["/**\n * Executes a function for each item in an iterable, sequentially.\n *\n * Uses a sync fast-path: iterates synchronously until the first Promise is\n * encountered, then switches to async for the remainder. If no item produces\n * a Promise, the entire call stays synchronous with zero async overhead.\n *\n * @param items - The iterable to iterate over.\n * @param fn - The function to call for each item. May return void or a Promise.\n * @returns void if all calls were synchronous, or a Promise if any were async.\n */\nexport function dispatchSequential<T>(\n  items: Iterable<T>,\n  fn: (item: T) => void | Promise<void>\n): void | Promise<void> {\n  const iterator = items[Symbol.iterator]();\n\n  for (let next = iterator.next(); !next.done; next = iterator.next()) {\n    const result = fn(next.value);\n\n    if (result instanceof Promise) {\n      return continueAsync(iterator, fn, result);\n    }\n  }\n}\n\nasync function continueAsync<T>(\n  iterator: Iterator<T>,\n  fn: (item: T) => void | Promise<void>,\n  pending: Promise<void>\n): Promise<void> {\n  await pending;\n\n  for (let next = iterator.next(); !next.done; next = iterator.next()) {\n    const result = fn(next.value);\n\n    if (result instanceof Promise) {\n      await result;\n    }\n  }\n}\n","/**\n * Logger interface for debug and diagnostic output.\n * Supports multiple log levels for controlling verbosity.\n * Implementations can target different outputs (console, file, remote, etc.).\n */\nexport interface ILogger {\n  /**\n   * Logs a message with a specified severity level.\n   * @param level - The severity level of the message.\n   * @param message - The primary message content.\n   * @param args - Additional arguments to include in the log output.\n   */\n  log(level: LogLevel, message: any, ...args: any[]): void;\n\n  /**\n   * Logs detailed diagnostic information.\n   * Typically the lowest level, most verbose output.\n   * @param message - The message to log.\n   * @param args - Additional data.\n   */\n  trace(message: any, ...args: any[]): void;\n\n  /**\n   * Logs debug-level information.\n   * Useful during development and troubleshooting.\n   * @param message - The message to log.\n   * @param args - Additional data.\n   */\n  debug(message: any, ...args: any[]): void;\n\n  /**\n   * Logs warning-level messages.\n   * Indicates potentially problematic conditions.\n   * @param message - The message to log.\n   * @param args - Additional data.\n   */\n  warn(message: any, ...args: any[]): void;\n\n  /**\n   * Logs error-level messages.\n   * Indicates error conditions that may require attention.\n   * @param message - The message to log.\n   * @param args - Additional data.\n   */\n  error(message: any, ...args: any[]): void;\n}\n\n/**\n * Logging severity levels in increasing order.\n */\nexport enum LogLevel {\n  /**\n   * Most detailed, diagnostic-level logging.\n   */\n  trace,\n\n  /**\n   * Development and debugging information.\n   */\n  debug,\n\n  /**\n   * Warning-level conditions.\n   */\n  warn,\n\n  /**\n   * Error-level conditions.\n   */\n  error\n}\n\n/**\n * Configuration options for logger instances.\n */\nexport interface ILoggerOptions {\n  /**\n   * Enables/disables each log level.\n   * If a level is disabled, log calls at that level are ignored.\n   */\n  enabled: Map<LogLevel, boolean>;\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,mBACd,OACA,IACsB;CACtB,MAAM,WAAW,MAAM,OAAO,UAAU;CAExC,KAAK,IAAI,OAAO,SAAS,KAAK,GAAG,CAAC,KAAK,MAAM,OAAO,SAAS,KAAK,GAAG;EACnE,MAAM,SAAS,GAAG,KAAK,KAAK;EAE5B,IAAI,kBAAkB,SACpB,OAAO,cAAc,UAAU,IAAI,MAAM;CAE7C;AACF;AAEA,eAAe,cACb,UACA,IACA,SACe;CACf,MAAM;CAEN,KAAK,IAAI,OAAO,SAAS,KAAK,GAAG,CAAC,KAAK,MAAM,OAAO,SAAS,KAAK,GAAG;EACnE,MAAM,SAAS,GAAG,KAAK,KAAK;EAE5B,IAAI,kBAAkB,SACpB,MAAM;CAEV;AACF;;;;;;ACUA,IAAY,WAAL,yBAAA,UAAA;;;;CAIL,SAAA,SAAA,WAAA,KAAA;;;;CAKA,SAAA,SAAA,WAAA,KAAA;;;;CAKA,SAAA,SAAA,UAAA,KAAA;;;;CAKA,SAAA,SAAA,WAAA,KAAA;;AACF,EAAA,CAAA,CAAA"}