import { CodeMetaJson } from "../sources/codemeta-json.js";
import { NodePackageJsonData } from "../sources/node-package-json.js";

//#region src/lib/utilities/template-helpers.d.ts
declare namespace template_helpers_d_exports {
  export { REPLACEMENTS, collectArrayField, collectField, dependencyNames, ensureArray, firstOf, hasDependencyWithId, isAuthoredBy, isOnGithubAccountOf, isValidUrl, mixedStringsToArray, nonEmpty, splitCommaSeparated, stripNamespace, stripUndefined, toAlias, toBasicLicense, toBasicLicenses, toBasicNames, toDelimitedString, toLocalUrl, toMarkdownLink, toMb, toStatus, toStatusLegacy, usesPnpm };
}
/**
 * Extract the first element from a `OneOrMany` value.
 *
 * Metadata sources may return a single record or an array of records. This
 * helper normalizes access so you can safely retrieve the first record
 * regardless of cardinality.
 */
declare function firstOf<T>(value: T | T[] | undefined): T | undefined;
/**
 * Wrap a value in an array if it isn't one already.
 * Returns an empty array for `undefined` or `null`.
 */
declare function ensureArray<T>(value: null | T | T[] | undefined): T[];
/**
 * Collect values from all records in a `OneOrMany<SourceRecord<D>>` source.
 * Runs the accessor on each record's `.data` and returns all non-undefined results.
 *
 * Useful for extracting a specific field from sources that may contain multiple records
 * (e.g. multiple Cargo.toml files in a workspace).
 */
declare function collectField<T extends {
  data: unknown;
}, R>(source: T | T[] | undefined, accessor: (data: T['data']) => R | undefined): R[];
/**
 * Collect and flatten array values from all records in a `OneOrMany<SourceRecord<D>>` source.
 * Runs the accessor on each record's `.data` and flattens the resulting arrays.
 */
declare function collectArrayField<T extends {
  data: unknown;
}, R>(source: T | T[] | undefined, accessor: (data: T['data']) => R[] | undefined): R[];
/**
 * Return the array if non-empty, otherwise undefined.
 * Useful for converting empty collection results to undefined before `stripUndefined`.
 */
declare function nonEmpty<T>(array: T[]): T[] | undefined;
/**
 * Split a string on commas, trimming each part and filtering out empty strings.
 * Returns an empty array for `undefined` or empty input.
 */
declare function splitCommaSeparated(value: string | undefined): string[];
/**
 * Join an array of strings with a delimiter, filtering out undefined values.
 */
declare function toDelimitedString(source: Array<string | undefined> | string | string[] | undefined, delimiter?: string): string | undefined;
/**
 * Convert a URL or path to a markdown link using its basename as the label.
 */
declare function toMarkdownLink(value: string | undefined): string | undefined;
/**
 * Convert bytes to megabytes (rounded).
 * (MB, not MiB.)
 */
declare function toMb(bytes: unknown): number | undefined;
/**
 * Strip the namespace or directory prefix from a package name or path.
 */
declare function stripNamespace(value: string): string;
/**
 * Convert a package name to a human-friendly alias using title case
 * and brand-name corrections.
 */
declare function toAlias(value: string | undefined): string | undefined;
declare const REPLACEMENTS: Map<string, string>;
/**
 * Takes any value and extracts all strings from it.
 * Returns string[] if any strings were found, or undefined otherwise.
 * Optionally performs case-insensitive string replacement with `replacements`.
 */
declare function mixedStringsToArray(value: unknown, replacements?: Map<string, string>): string[] | undefined;
/**
 * Convert a filename or relative path to a local `file://` URL rooted at `repoPath`.
 */
declare function toLocalUrl(value: string | undefined, repoPath: string | undefined): string | undefined;
/**
 * Recursively removes `undefined` values and empty objects from an object.
 * Only recurses into plain objects and arrays. Non-plain objects (like Date)
 * are preserved as-is.
 * Array elements that are `undefined` are also removed.
 * Returns `undefined` if the entire input becomes empty after stripping.
 */
declare function stripUndefined<T>(value: T): T;
/**
 * Strip the SPDX license URL prefix, returning just the license identifier.
 */
declare function toBasicLicense(source: string | undefined): string | undefined;
/**
 * Normalize one or more license values to plain SPDX identifiers, stripping URL prefixes.
 */
declare function toBasicLicenses(...sources: Array<string | string[] | undefined>): string[] | undefined;
type CodeMetaPersonOrOrg = NonNullable<CodeMetaJson['author']>[number];
/**
 * Extract display names from an array of `CodeMetaPersonOrOrg`.
 */
declare function toBasicNames(source: CodeMetaPersonOrOrg[] | undefined): string[] | undefined;
/**
 * Check id a project uses a specific dependency
 */
declare function hasDependencyWithId(id: string, codemeta: CodeMetaJson): boolean;
/**
 * Simple list of all dependencies
 */
declare function dependencyNames(codemeta: CodeMetaJson, filter?: 'all' | 'dev' | 'prod'): string[] | undefined;
/**
 * Check if the project uses pnpm as its package manager.
 */
declare function usesPnpm(packageJson: NodePackageJsonData): boolean;
/**
 * True if project was authored by specific person(s).
 */
declare function isAuthoredBy(codemetaAuthorName?: CodeMetaPersonOrOrg | CodeMetaPersonOrOrg[], expectedAuthorName?: string | string[]): boolean | undefined;
/**
 * True if project is on a specific GitHub account(s).
 */
declare function isOnGithubAccountOf(codeRepository?: string, githubUserName?: string | string[]): boolean | undefined;
/**
 * Legacy heuristic project status based on authorship and GitHub account.
 */
declare function toStatusLegacy(codeRepository?: string, codemetaAuthorName?: CodeMetaPersonOrOrg | CodeMetaPersonOrOrg[], authorName?: string | string[], githubUserName?: string | string[]): /** It's a fork on GitHub */('fork' /** I am original author, local or on github */ | 'source' /** Someone else's local code */ | 'unmaintained') | undefined;
/**
 * Heuristic project status based on authorship and GitHub account.
 */
declare function toStatus(codeRepository?: string, codemetaAuthorName?: CodeMetaPersonOrOrg | CodeMetaPersonOrOrg[], codemetaContributorOrMaintainerName?: CodeMetaPersonOrOrg | CodeMetaPersonOrOrg[], isGitHubFork?: boolean, myAuthorName?: string | string[], myGithubUserName?: string | string[]): 'author' /** I wrote the repo */ | 'maintainer' /** I contribute or help maintain it */ | 'observer' /** I look at this repo */ | 'unknown' /** It's unclear */;
/**
 * True if valid url
 */
declare function isValidUrl(value: string): boolean;
//#endregion
export { template_helpers_d_exports };