{
  "version": 3,
  "sources": ["../Source/Dependency/Effect/index.ts", "../Source/Dependency/Effect/Dependency.Effect.ts", "../Source/Dependency/Dependency.Internal.ts", "../Source/Dependency/Dependency.ts"],
  "sourcesContent": ["/**\n * Utilities of the {@link \\@sorrell/utilities/dependency} module that\n * use {@link https://effect.website/docs/ | effect}.\n *\n * @module @sorrell/utilities/dependency/effect\n */\n/**\n * @file      index.ts\n * @author    Gage Sorrell <gage@sorrell.sh>\n * @copyright (c) 2026 Gage Sorrell\n * @license   MIT\n */\nexport * from \"./Dependency.Effect.js\";\n", "/**\n * @file      Dependency.Effect.ts\n * @author    Gage Sorrell <gage@sorrell.sh>\n * @copyright (c) 2026 Gage Sorrell\n * @license   MIT\n */\nimport { Layer, Logger } from \"effect\";\nimport { Code } from \"../Dependency.Internal.ts\";\nimport { IsRuntimeModeProduction } from \"../Dependency.ts\";\n/* eslint-disable jsdoc/require-example */\n/**\n * This patches the default logger so that the statements that are logged by your dependency package\n * do not overwhelm or annoy the consuming developer.\n *\n * {@link IsDependentModeProduction} is used to determine whether to return a no-op\n * (iff `true`), or a function that wraps {@link Console} (iff `false`).\n *\n * @param PackageName - The name of your package.  It is strongly recommended, but not *enforced*,\n * that this is exactly the `name` in your `package.json`.  Statements logged under this\n * {@link Layer.Layer | Layer} are prefixed with `[${ PackageName }]`.\n *\n * @param SuppressLoggerFrequency - When {@link SuppressLoggerFrequency} statements have been logged,\n * a short message is *also* logged, explaining how to suppress output from your package.\n *\n * @param SuppressLogEnvironmentVariable - If specified, this is the environment variable name passed to\n * {@link IsDependentModeProduction} to determine whether the logger will be a no-op.\n *\n * @returns {Layer.Layer} A {@link Layer.Layer | Layer} that provides the {@link DependencyLogger}\n * with the {@link PackageName}.\n */\nexport function CreateDependencyLoggerLayer(PackageName: string, SuppressLoggerFrequency: number = 12, SuppressLogEnvironmentVariable: string | undefined = undefined): Layer.Layer<never, never, never> {\n    const IsProductionMode: boolean = SuppressLogEnvironmentVariable !== undefined\n        ? IsRuntimeModeProduction({ DebugEnvironmentVariable: SuppressLogEnvironmentVariable })\n        : IsRuntimeModeProduction();\n    if (IsProductionMode) {\n        return Layer.empty;\n    }\n    const Prefix: string = `[${PackageName}]`;\n    const LogSuppressionStatement: string = `[${PackageName}] To suppress logs from ${PackageName}, set the env. variable ` +\n        `${Code(\"NODE_ENV\")} to ${Code(\"\\\"production\\\"\")}` + (SuppressLogEnvironmentVariable !== undefined\n        ? `, or set the env. variable ${Code(SuppressLogEnvironmentVariable)} to ` +\n            `${Code(\"\\\"false\\\"\")}.`\n        : \".\");\n    let LoggedStatementCount: number = 0;\n    const PrefixedLogger: Logger.Logger<unknown, void> = Logger.stringLogger.pipe(Logger.map((Line: string) => {\n        LoggedStatementCount++;\n        const PrefixedLine: string = `${Prefix} ${Line}`;\n        if (SuppressLoggerFrequency > 0 &&\n            LoggedStatementCount % SuppressLoggerFrequency === 0) {\n            return `${PrefixedLine}\\n${LogSuppressionStatement}`;\n        }\n        return PrefixedLine;\n    }), Logger.withLeveledConsole);\n    return Logger.replace(Logger.defaultLogger, PrefixedLogger);\n}\n", "/**\n * @file      Dependency.Internal.ts\n * @author    Gage Sorrell <gage@sorrell.sh>\n * @copyright (c) 2026 Gage Sorrell\n * @license   MIT\n */\nimport Chalk from \"chalk\";\n/* eslint-disable-next-line @typescript-eslint/no-unused-vars */\nimport type { IsRuntimeModeProduction } from \"./Dependency.ts\";\nimport type { TRuntimeModeProductionOptions } from \"./Dependency.Types.ts\";\n/**\n * The default value of the `TruthyValues` argument of {@link IsRuntimeModeProduction}.\n */\nconst DefaultTruthyValues: ReadonlyArray<string> = [\n    \"true\",\n    \"1\",\n    \"yes\",\n    \"y\",\n    \"on\"\n] as const;\nexport /**\n        * The default options of {@link IsRuntimeModeProduction}.\n        */ const DefaultOptions: TRuntimeModeProductionOptions<boolean> = {\n    TruthyValues: DefaultTruthyValues,\n    UncertainValue: true\n};\n/* eslint-disable jsdoc/require-example */\n/**\n * Formats a given {@link Message} to look like a code snippet (or path, *etc.*).\n *\n * @param Message - The message to format.\n *\n * @returns {string} The {@link Message}, formatted to look like code (or a path, *etc.*).\n */\nexport function Code(Message: string): string {\n    return Chalk.reset.red(Message);\n}\n/* eslint-enable jsdoc/require-example */\n/* eslint-disable-next-line jsdoc/require-jsdoc */\nexport function NormalizeLogMessage(Message: unknown): ReadonlyArray<unknown> {\n    if (Array.isArray(Message)) {\n        return Message;\n    }\n    return [Message];\n}\n", "/**\n * @file      Dependency.ts\n * @author    Gage Sorrell <gage@sorrell.sh>\n * @copyright (c) 2026 Gage Sorrell\n * @license   MIT\n */\n/* eslint-disable jsdoc/require-example, jsdoc/match-description */\nimport type { DependencyLogger, TRuntimeModeProductionOptions } from \"./Dependency.Types.ts\";\nimport { type InspectOptions, format } from \"node:util\";\nimport { Code } from \"./Dependency.Internal.ts\";\nimport { DefaultOptions } from \"./Dependency.Internal.ts\";\n/**\n * Guess whether the current session is in *production mode* by,\n *\n * 1. If the function did not already return in Step 1, then {@link process.env} is checked for\n * a property with key `\"NODE_ENV\"`.\n *     - If there exists a property with this key, and if `process.env[\"NODE_ENV\"] === \"production\"`\n *       (or similar; see below), then this returns `true`.\n * 2. If the function did not already return in Step 2, then `true` is returned.\n *\n * @note If Step 2 is executed, then this returns `true` when `process.env[\"NODE_ENV\"].toLowerCase()`\n * is any one of,\n * - `\"production\"`\n * - `\"prod\"`\n *\n * @returns {boolean} Whether the current session is likely in *production mode*, or,\n * if unsure, `true` is returned.\n */\nexport function IsRuntimeModeProduction(): boolean;\n/**\n * Guess whether the current session is in *production mode* by,\n *\n * 1. If a {@link DebugEnvironmentVariable} is given, then {@link process.env}\n * is checked for the existence of a property having this key.\n *     - If the property exists and is in {@link TruthyValues}, then this function returns `true`.\n *     - If the property exists but is in {@link TruthyValues}, then this returns `false`.\n * 2. If the function did not already return in Step 1, then {@link process.env} is checked for\n * a property with key `\"NODE_ENV\"`.\n *     - If there exists a property with this key, and if `process.env[\"NODE_ENV\"] === \"production\"`\n *       (or similar; see below), then this returns `true`.\n * 3. If the function did not already return in Step 2, then {@link UncertainValue} is returned.\n * By default, this is `true`, but any value of any type can be used.\n *\n * @template UncertainType - The type of the {@link UncertainValue}.  By default, this is `boolean`.\n *\n * @param Options - The {@link TRuntimeModeProductionOptions} options object.  All properties are optional.\n *\n * @note If Step 2 is executed, then this returns `true` when `process.env[\"NODE_ENV\"].toLowerCase()`\n * is any one of,\n * - `\"production\"`\n * - `\"prod\"`\n *\n * @returns {boolean | typeof UncertainValue} Whether the current session is likely in *production mode*, or,\n * if unsure, the given {@link UncertainValue} is returned (by default, this is `true`).\n */\nexport function IsRuntimeModeProduction<UncertainType = boolean>(Options: TRuntimeModeProductionOptions<UncertainType>): boolean | Exclude<typeof Options.UncertainValue, undefined>;\nexport function IsRuntimeModeProduction<UncertainType = boolean>(Options: TRuntimeModeProductionOptions<UncertainType> = (DefaultOptions as TRuntimeModeProductionOptions<UncertainType>)): boolean | typeof Options.UncertainValue {\n    const { DebugEnvironmentVariable, UncertainValue, TruthyValues } = {\n        ...DefaultOptions,\n        ...Options\n    } as Required<TRuntimeModeProductionOptions<UncertainType>>;\n    if (DebugEnvironmentVariable !== undefined) {\n        if (DebugEnvironmentVariable in process.env) {\n            const IsDebugTruthy: boolean = TruthyValues\n                .map((TruthyWord: string) => TruthyWord.toLowerCase())\n                .includes(DebugEnvironmentVariable.toLowerCase());\n            return IsDebugTruthy;\n        }\n    }\n    const NodeEnvKey: \"NODE_ENV\" = \"NODE_ENV\" as const;\n    if (NodeEnvKey in process.env && typeof process.env[NodeEnvKey] === \"string\") {\n        return [\"production\", \"prod\"].includes(process.env[NodeEnvKey].toLowerCase());\n    }\n    return UncertainValue;\n}\n/**\n * This patches the default logger so that the statements that are logged by your dependency package\n * do not overwhelm or annoy the consuming developer.\n *\n * {@link IsDependentModeProduction} is used to determine whether to return a no-op\n * (iff `true`), or a function that wraps {@link Console} (iff `false`).\n *\n * @param PackageName - The name of your package.  It is strongly recommended, but not *enforced*,\n * that this is exactly the `name` in your `package.json`.  Statements logged under this\n * {@link Layer.Layer | Layer} are prefixed with `[${ PackageName }]`.\n *\n * @param SuppressLoggerFrequency - When {@link SuppressLoggerFrequency} statements have been logged,\n * a short message is *also* logged, explaining how to suppress output from your package.\n *\n * @param SuppressLogEnvironmentVariable - If specified, this is the environment variable name passed to\n * {@link IsDependentModeProduction} to determine whether the logger will be a no-op.\n *\n * @returns {Layer.Layer} A {@link Layer.Layer | Layer} that provides the {@link DependencyLogger}\n * with the {@link PackageName}.\n */\nexport function GetDependencyLogger(PackageName: string, SuppressLoggerFrequency: number = 12, SuppressLogEnvironmentVariable: string | undefined = undefined): DependencyLogger {\n    const IsProductionMode: boolean = SuppressLogEnvironmentVariable !== undefined\n        ? IsRuntimeModeProduction({ DebugEnvironmentVariable: SuppressLogEnvironmentVariable })\n        : IsRuntimeModeProduction();\n    if (IsProductionMode) {\n        return {\n            debug(..._Statements: Array<unknown>): void { },\n            dir(_InObject: unknown, _Options: InspectOptions | undefined): void { },\n            error(..._Statements: Array<unknown>): void { },\n            info(..._Statements: Array<unknown>): void { },\n            log(..._Statements: Array<unknown>): void { },\n            warn(..._Statements: Array<unknown>): void { }\n        } as const;\n    }\n    const Prefix: string = `[${PackageName}]`;\n    const LogSuppressionStatement: string = `[${PackageName}] To suppress logs from ${PackageName}, set the env. variable ` +\n        `${Code(\"NODE_ENV\")} to ${Code(\"\\\"production\\\"\")}` + (SuppressLogEnvironmentVariable !== undefined\n        ? `, or set the env. variable ${Code(SuppressLogEnvironmentVariable)} to ` +\n            `${Code(\"\\\"false\\\"\")}.`\n        : \".\");\n    let LoggedStatementCount: number = 0;\n    function OnStatementLogged(): boolean {\n        LoggedStatementCount++;\n        const Out: boolean = (SuppressLoggerFrequency > 0 &&\n            LoggedStatementCount % SuppressLoggerFrequency === 0);\n        if (Out) {\n            LoggedStatementCount = 0;\n        }\n        return Out;\n    }\n    function PrintLogSuppressionStatement(): void {\n        console.log(LogSuppressionStatement);\n    }\n    function OnStatementLoggedManual(): void {\n        if (OnStatementLogged()) {\n            PrintLogSuppressionStatement();\n        }\n    }\n    function GetFormattedStatements(...Statements: Array<unknown>): ReadonlyArray<string> {\n        return Statements\n            .flatMap((Statement: unknown): Array<string> => {\n            const OutStatement: string = `${Prefix} ${format(Statement)}`;\n            return OnStatementLogged()\n                ? [OutStatement, LogSuppressionStatement]\n                : [OutStatement];\n        });\n    }\n    ;\n    return {\n        debug(...Statements: Array<unknown>): void {\n            console.debug(...GetFormattedStatements(Statements));\n        },\n        dir(InObject: unknown, Options: InspectOptions | undefined): void {\n            console.dir(InObject, Options);\n            OnStatementLoggedManual();\n        },\n        error(...Statements: Array<unknown>): void {\n            console.error(...GetFormattedStatements(Statements));\n        },\n        info(...Statements: Array<unknown>): void {\n            console.info(...GetFormattedStatements(...Statements));\n        },\n        log(...Statements: Array<unknown>): void {\n            console.log(...GetFormattedStatements(...Statements));\n        },\n        warn(...Statements: Array<unknown>): void {\n            console.warn(...GetFormattedStatements(...Statements));\n        }\n    } as const;\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,oBAA8B;;;ACA9B,mBAAkB;AAOlB,IAAM,sBAA6C;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAGW,IAAM,iBAAyD;AAAA,EACtE,cAAc;AAAA,EACd,gBAAgB;AACpB;AASO,SAAS,KAAK,SAAyB;AAC1C,SAAO,aAAAA,QAAM,MAAM,IAAI,OAAO;AAClC;;;AC5BA,uBAA4C;AAgDrC,SAAS,wBAAiD,UAAyD,gBAA0G;AAChO,QAAM,EAAE,0BAA0B,gBAAgB,aAAa,IAAI;AAAA,IAC/D,GAAG;AAAA,IACH,GAAG;AAAA,EACP;AACA,MAAI,6BAA6B,QAAW;AACxC,QAAI,4BAA4B,QAAQ,KAAK;AACzC,YAAM,gBAAyB,aAC1B,IAAI,CAAC,eAAuB,W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