const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
const require_defu = require('../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.cjs');
const require_helpers_load = require('../helpers/load.cjs');
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
let __alloy_js_core = require("@alloy-js/core");
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
let __alloy_js_typescript = require("@alloy-js/typescript");
let __powerlines_plugin_alloy_helpers_refkey = require("@powerlines/plugin-alloy/helpers/refkey");
let __powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
let __powerlines_plugin_alloy_typescript_components_typescript_interface = require("@powerlines/plugin-alloy/typescript/components/typescript-interface");
let __powerlines_plugin_alloy_typescript_components_typescript_object = require("@powerlines/plugin-alloy/typescript/components/typescript-object");

//#region src/components/env.tsx
/**
* Generates the environment configuration typescript definition for the Powerlines project.
*/
function EnvTypeDefinition(props) {
	const [{ defaultValue, reflection }] = (0, __alloy_js_core.splitProps)(props, ["defaultValue", "reflection"]);
	const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
	return [
		(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_typescript_interface.TypeScriptInterface, {
			name: " EnvBase",
			defaultValue,
			reflection,
			"export": true
		}),
		(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
		(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
		(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
			heading: "The environment configuration object with prefixed keys.",
			get children() {
				return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The \`Env\` type extends the \`EnvBase\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.` });
			}
		}),
		(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.TypeDeclaration, {
			name: "Env",
			"export": true,
			get children() {
				return __alloy_js_core.code` {
    [Key in keyof EnvBase as Key ${context.config.env.prefix.map((prefix) => `| \`${prefix.replace(/_$/g, "")}_\${Key}\``).join(" ")}]: EnvBase[Key];
}
`;
			}
		}),
		(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
		(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
	];
}
function ConfigPropertyConditional(props) {
	const [{ context, name }] = (0, __alloy_js_core.splitProps)(props, ["context", "name"]);
	return __alloy_js_core.code`propertyName === "${name}" || propertyName.replace(/^(${context.config.env.prefix.sort((a, b) => a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)).map((prefix) => `${prefix.replace(/_$/, "")}_`).join("|")})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${name.toLowerCase().replace(/[\s\-_]+/g, "")}"`;
}
function ConfigPropertyGet(props) {
	const [{ context, property, index }] = (0, __alloy_js_core.splitProps)(props, [
		"context",
		"property",
		"index"
	]);
	return [index === 0 ? (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
		get condition() {
			return [(0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
				get name() {
					return property.getNameAsString();
				},
				context
			}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
				get when() {
					return (0, __alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
				},
				get children() {
					return [__alloy_js_core.code` || `, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
						get each() {
							return property.getAlias();
						},
						joiner: __alloy_js_core.code` || `,
						children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
							name: alias,
							context
						})
					})];
				}
			})];
		},
		get children() {
			return __alloy_js_core.code`return target["${property.getNameAsString()}"];`;
		}
	}) : (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
		get condition() {
			return [(0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
				get name() {
					return property.getNameAsString();
				},
				context
			}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
				get when() {
					return (0, __alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
				},
				get children() {
					return [__alloy_js_core.code` || `, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
						get each() {
							return property.getAlias();
						},
						joiner: __alloy_js_core.code` || `,
						children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
							name: alias,
							context
						})
					})];
				}
			})];
		},
		get children() {
			return __alloy_js_core.code`return target["${property.getNameAsString()}"];`;
		}
	})];
}
function ConfigPropertySet(props) {
	const [{ context, property, index }] = (0, __alloy_js_core.splitProps)(props, [
		"context",
		"property",
		"index"
	]);
	return [index === 0 ? (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
		get condition() {
			return [(0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
				get name() {
					return property.getNameAsString();
				},
				context
			}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
				get when() {
					return (0, __alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
				},
				get children() {
					return [__alloy_js_core.code` || `, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
						get each() {
							return property.getAlias();
						},
						joiner: __alloy_js_core.code` || `,
						children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
							name: alias,
							context
						})
					})];
				}
			})];
		},
		get children() {
			return __alloy_js_core.code`
    target["${property.getNameAsString()}"] = newValue;
    return true;
`;
		}
	}) : (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
		get condition() {
			return [(0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
				get name() {
					return property.getNameAsString();
				},
				context
			}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
				get when() {
					return (0, __alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
				},
				get children() {
					return [__alloy_js_core.code` || `, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
						get each() {
							return property.getAlias();
						},
						joiner: __alloy_js_core.code` || `,
						children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
							name: alias,
							context
						})
					})];
				}
			})];
		},
		get children() {
			return __alloy_js_core.code`
    target["${property.getNameAsString()}"] = newValue;
    return true;
`;
		}
	})];
}
const createEnvRefkey = (0, __powerlines_plugin_alloy_helpers_refkey.refkey)("createEnv");
const envRefkey = (0, __powerlines_plugin_alloy_helpers_refkey.refkey)("env");
const envSerializerRefkey = (0, __powerlines_plugin_alloy_helpers_refkey.refkey)("EnvSerializer");
/**
* Generates the environment configuration module for the Powerlines project.
*/
function EnvBuiltin(props) {
	const [{ defaultConfig, reflection, children }, rest] = (0, __alloy_js_core.splitProps)(props, [
		"defaultConfig",
		"reflection",
		"children"
	]);
	const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
	const defaultValue = (0, __alloy_js_core.computed)(() => context && require_helpers_load.loadEnvFromContext(context, process.env));
	const envInstance = (0, __alloy_js_core.computed)(() => {
		return new __powerlines_deepkit_vendor_type.ReflectionClass({
			kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
			description: `The initial environment configuration state for the ${(0, __stryke_string_format_title_case.titleCase)(context?.config?.name)} project.`,
			types: []
		}, reflection);
	});
	const reflectionGetProperties = (0, __alloy_js_core.computed)(() => reflection?.getProperties().filter((property) => !property.isIgnored()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
	const reflectionSetProperties = (0, __alloy_js_core.computed)(() => reflection?.getProperties().filter((property) => !property.isIgnored() && !property.isReadonly()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
	return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, __alloy_js_core_jsx_runtime.mergeProps)({
		id: "env",
		description: "The environment configuration module provides an interface to define environment configuration parameters."
	}, rest, {
		get imports() {
			return require_defu.defu({ "@powerlines/deepkit/vendor/type": [
				"stringify",
				"serializer",
				"serializeFunction",
				"deserializeFunction",
				"ReflectionKind",
				"Serializer",
				"TemplateState",
				"Type",
				"TypeProperty",
				"TypePropertySignature"
			] }, rest.imports ?? {});
		},
		get children() {
			return [
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
					get when() {
						return Boolean(reflection);
					},
					get children() {
						return [
							(0, __alloy_js_core_jsx_runtime.createComponent)(EnvTypeDefinition, {
								get defaultValue() {
									return defaultValue.value;
								},
								reflection
							}),
							(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
							(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
						];
					}
				}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_typescript_object.TypescriptObject, {
					name: "initialEnv",
					type: "Partial<EnvBase>",
					defaultValue,
					reflection: envInstance,
					"export": true,
					"const": true,
					doc: "The initial environment configuration object values for the runtime."
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
					heading: "The environment configuration serializer for the Powerlines application.",
					get children() {
						return [
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
						];
					}
				}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ClassDeclaration, {
					refkey: envSerializerRefkey,
					name: "EnvSerializer",
					"extends": "Serializer",
					"export": true,
					get children() {
						return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ClassMethod, {
							name: "constructor",
							"public": true,
							doc: "Initializes a new instance of the `EnvSerializer` class.",
							children: __alloy_js_core.code`
    super("env");

    this.deserializeRegistry.register(
      ReflectionKind.boolean,
      (type: Type, state: TemplateState) => {
        state.addSetter(
          \`typeof \${state.accessor.toString()} !== "boolean" ? \${state.accessor.toString()} === 1 || \${state.accessor.toString()} === "1" || \${state.accessor.toString()}.toLowerCase() === "t" || \${state.accessor.toString()}.toLowerCase() === "true" || \${state.accessor.toString()}.toLowerCase() === "y" || \${state.accessor.toString()}.toLowerCase() === "yes" : \${state.accessor.toString()}\`
        );
      }
    );
`
						});
					}
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
					heading: "A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.",
					get children() {
						return [
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
						];
					}
				}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
					name: "envSerializer",
					"export": false,
					"const": true,
					get initializer() {
						return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.NewExpression, {
							args: [],
							target: "EnvSerializer"
						});
					}
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
					heading: "Serialize a environment configuration object to JSON data objects (not a JSON string).",
					get children() {
						return [
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The resulting JSON object can be stringified using \`JSON.stringify()\`.` }),
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `const json = serializeEnv(env);` }),
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocThrows, { children: `ValidationError when serialization or validation fails.` })
						];
					}
				}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
					name: "serializeEnv",
					"export": true,
					"const": true,
					initializer: "serializeFunction<EnvBase>(envSerializer)"
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
					heading: "Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.",
					get children() {
						return [
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `Types that are already correct will be used as-is.` }),
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `const env = deserializeEnv(json);` }),
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocThrows, { children: `ValidationError when deserialization fails.` })
						];
					}
				}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
					name: "deserializeEnv",
					"export": true,
					"const": true,
					initializer: "deserializeFunction<EnvBase>(envSerializer)"
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
					heading: "Initializes the Powerlines environment configuration module.",
					get children() {
						return [
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
								name: "environmentConfig",
								children: `The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`
							}),
							(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The initialized Powerlines configuration object.` })
						];
					}
				}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
					get when() {
						return Boolean(context?.entryPath);
					},
					get children() {
						return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
							refkey: createEnvRefkey,
							async: false,
							"export": true,
							name: "createEnv",
							parameters: [{
								name: "environmentConfig",
								type: `Partial<Env>`,
								optional: false,
								default: "{}"
							}],
							returnType: "Env",
							get children() {
								return [
									__alloy_js_core.code`
  return new Proxy<Env>(
    deserializeEnv({
      ...initialEnv,
      ...environmentConfig
    }) as Env,
    {
      get: (target: EnvBase, propertyName: string) => { `,
									(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
									(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
										each: reflectionGetProperties,
										children: (property, index) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyGet, {
											index,
											context,
											property
										})
									}),
									__alloy_js_core.code`
            return undefined;
          }, `,
									(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
									(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
									__alloy_js_core.code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,
									(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
									(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
										each: reflectionSetProperties,
										ender: __alloy_js_core.code` else `,
										children: (property, index) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertySet, {
											index,
											context,
											property
										})
									}),
									(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
									__alloy_js_core.code`return false;
      }
    }
  );
`
								];
							}
						});
					}
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
					heading: "The environment configuration object.",
					get children() {
						return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This object provides access to the environment configuration parameters in the application runtime.` });
					}
				}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
					refkey: envRefkey,
					name: "env",
					type: "Env",
					"export": true,
					"const": true,
					get initializer() {
						return [__alloy_js_core.code`createEnv(${defaultConfig || "{}"} as Partial<Env>);`];
					}
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
					"export": true,
					"const": true,
					name: "isCI",
					doc: "Detect if the application is running in a continuous integration (CI) environment.",
					initializer: __alloy_js_core.code`Boolean(
          env.CI ||
          env.RUN_ID ||
          env.AGOLA_GIT_REF ||
          env.AC_APPCIRCLE ||
          env.APPVEYOR ||
          env.CODEBUILD ||
          env.TF_BUILD ||
          env.bamboo_planKey ||
          env.BITBUCKET_COMMIT ||
          env.BITRISE_IO ||
          env.BUDDY_WORKSPACE_ID ||
          env.BUILDKITE ||
          env.CIRCLECI ||
          env.CIRRUS_CI ||
          env.CF_BUILD_ID ||
          env.CM_BUILD_ID ||
          env.CI_NAME ||
          env.DRONE ||
          env.DSARI ||
          env.EARTHLY_CI ||
          env.EAS_BUILD ||
          env.GERRIT_PROJECT ||
          env.GITEA_ACTIONS ||
          env.GITHUB_ACTIONS ||
          env.GITLAB_CI ||
          env.GOCD ||
          env.BUILDER_OUTPUT ||
          env.HARNESS_BUILD_ID ||
          env.JENKINS_URL ||
          env.LAYERCI ||
          env.MAGNUM ||
          env.NETLIFY ||
          env.NEVERCODE ||
          env.PROW_JOB_ID ||
          env.RELEASE_BUILD_ID ||
          env.RENDER ||
          env.SAILCI ||
          env.HUDSON ||
          env.SCREWDRIVER ||
          env.SEMAPHORE ||
          env.SOURCEHUT ||
          env.STRIDER ||
          env.TASK_ID ||
          env.RUN_ID ||
          env.TEAMCITY_VERSION ||
          env.TRAVIS ||
          env.VELA ||
          env.NOW_BUILDER ||
          env.APPCENTER_BUILD_ID ||
          env.CI_XCODE_PROJECT ||
          env.XCS || false
        );
        `
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
					heading: "Detect the \\`mode\\` of the current runtime environment.",
					get children() {
						return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: __alloy_js_core.code`The \`mode\` is determined by the \`MODE\` environment variable, or falls back to the \`NEXT_PUBLIC_VERCEL_ENV\`, \`NODE_ENV\`, or defaults to \`production\`. While the value can potentially be any string, it is generally recommended to only allow a value in the following list:
          - \`production\`
          - \`test\`
          - \`development\`
          ` });
					}
				}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
					"export": true,
					"const": true,
					name: "mode",
					initializer: __alloy_js_core.code`String(env.MODE) || "production"; `
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
					"export": true,
					"const": true,
					name: "isProduction",
					doc: "Detect if the application is running in `\"production\"` mode",
					initializer: __alloy_js_core.code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
					"export": true,
					"const": true,
					name: "isTest",
					doc: "Detect if the application is running in `\"test\"` mode",
					initializer: __alloy_js_core.code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
					"export": true,
					"const": true,
					name: "isDevelopment",
					doc: "Detect if the application is running in `\"development\"` mode",
					initializer: __alloy_js_core.code`["dev", "development"].includes(mode.toLowerCase()); `
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
					"export": true,
					"const": true,
					name: "isDebug",
					doc: "Detect if the application is currently being debugged",
					initializer: __alloy_js_core.code`Boolean(isDevelopment && env.DEBUG); `
				}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
				(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
					get when() {
						return Boolean(children);
					},
					children
				})
			];
		}
	}));
}

//#endregion
exports.EnvBuiltin = EnvBuiltin;
exports.EnvTypeDefinition = EnvTypeDefinition;