import { rgbToHex, rgbToCIELab, rgbToHsl, rgbToXyz, xyzToCIELab, hslToRgb, hexToRgb } from '@vibrant/color';
import chromaJS from 'chroma-js';
import chalk from 'chalk';
import { highlight as highlight$1 } from 'cli-highlight';
import figlet from 'figlet';
import ansiAlign from 'ansi-align';
import columnify from 'columnify';
import { Options } from 'boxen';
import { TableUserConfig } from 'table/dist/src/types/api';
import * as fs from 'fs';
import { globby, globbyStream } from 'globby';
import { writeFile as writeFile$1, readFile as readFile$1 } from 'node:fs/promises';
import { LocalStorage } from 'node-localstorage';
import * as o from 'open';
import * as zod_to_json_schema from 'zod-to-json-schema';
import { Options as Options$1 } from 'zod-to-json-schema';
import { ZodType, z, ZodError } from 'zod';
import { zerialize, dezerialize } from 'zodex';
import { toZod } from 'tozod';
import { compile, Options as Options$3 } from 'json-schema-to-typescript-lite';
import { Options as Options$2 } from 'json-schema-to-zod';
import { Config } from 'ts-json-schema-generator';
import { npmRunPathEnv } from 'npm-run-path';
import { hideBin as hideBin$1 } from 'yargs/helpers';
import { Argv } from 'yargs';
import Enquirer from 'enquirer';
import * as p from '@clack/prompts';
import * as consola from 'consola';
import ora from 'ora';
import { matcher } from 'matcher';
import { markedTerminal } from 'marked-terminal';
import * as _schemastore_package from '@schemastore/package';
import { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package';
export { createWriteStream } from 'node:fs';
export { fileURLToPath } from 'node:url';
export { default as process } from 'node:process';
export { default as terminalSize } from 'terminal-size';
export { default as stringWidth } from 'string-width';
import { deepmergeCustom } from 'deepmerge-ts';
export { deepmerge, deepmergeCustom } from 'deepmerge-ts';
import { Options as Options$4 } from 'csv-parse';
import { Options as Options$5 } from 'csv-stringify';
import { parse, stringify } from 'svgson';
import { Root } from 'mdast';
import { makeBadge, Format } from 'badge-maker';

type Color$1 = typeof chalk;
type HighlightOpts = Parameters<typeof highlight$1>[1];
type Fonts = figlet.Fonts;
type GradientColors = string[] | {
    color: string;
    pos: number;
}[];
type GradientOpts = {
    /**
       The gradient can be generated using RGB or HSV interpolation. HSV usually produces brighter colors. Interpolation can be set to rgb for RGB interpolation, orhsv for HSV interpolation.
       Defaults to rgb. Case insentitive.
     */
    interpolation?: 'rgb' | 'hsv';
    /**
       Used only in the case of HSV interpolation.
       Because hue can be considered as a circle, there are two ways to go from a color to another color.
       HsvSpin can be either short or long, depending on if you want to take the shortest or the longest way between two colors.
       Defaults to short. Case insensitive.
     */
    hsvSpin?: 'short' | 'long';
};

declare const chroma: typeof chromaJS;
declare const colorConversion: {
    rgb2hex: typeof rgbToHex;
    rgb2CIELab: typeof rgbToCIELab;
    rgb2sl: typeof rgbToHsl;
    rgb2xyz: typeof rgbToXyz;
    xyz2CIELab: typeof xyzToCIELab;
    hslToRgb: typeof hslToRgb;
    hex2rgb: typeof hexToRgb;
};
/**
 * Highlights the given code using CLI highlighting.
 * @param   {string}        code            - The code to highlight.
 * @param   {HighlightOpts} [opts]          - Optional options for highlighting.
 * @param   {string}        [opts.language] - The language of the code to highlight. Defaults to 'auto'.
 * @param   {string}        [opts.theme]    - The theme to use for highlighting. Defaults to 'github'.
 * @returns {string}                        - The highlighted code.
 * @example
 * const code = `
 * function greet(name) {
 *     return 'Hello, ' + name + '!';
 * }
 * console.log(greet('World'));
 * `;
 *
 * const highlightedCode = highlight(code, { language: 'javascript' });
 * console.log(highlightedCode);
 */
declare const highlight: (code: string, opts?: HighlightOpts) => string;
/**
 * Provides colors for terminal output.
 * @type {object}
 * @example
 * console.log(color.green('This text is green'));
 */
declare const color: Color$1;
/**
 * Generates a gradient string with the specified colors.
 * @param   {string}         txt    - The text to apply the gradient to.
 * @param   {GradientColors} colors - An array of color names or hex values.
 * @param   {GradientOpts}   [opts] - Custom opts.
 * @returns {string}                - The text with the applied gradient.
 * @example
 * // Example usage:
 * const gradientText = gradient('Gradient Text', ['red', 'yellow', 'green']);
 * console.log(gradientText);
 */
declare const gradient: (txt: string, colors: GradientColors, opts?: GradientOpts) => string;

/**
 * Unicode symbols with fallbacks for older terminals.
 * @see https://github.com/sindresorhus/figures/blob/main/index.js
 * @example
 * console.log(
 *   icon.warning,
 *   icon.cross,
 *   icon.arrowDown,
 *   icon.bullet
 * )
 */
declare const icon: {
    readonly tick: string;
    readonly info: string;
    readonly warning: string;
    readonly cross: string;
    readonly square: string;
    readonly squareSmall: string;
    readonly squareSmallFilled: string;
    readonly squareDarkShade: string;
    readonly squareMediumShade: string;
    readonly squareLightShade: string;
    readonly squareTop: string;
    readonly squareBottom: string;
    readonly squareLeft: string;
    readonly squareRight: string;
    readonly squareCenter: string;
    readonly circle: string;
    readonly circleFilled: string;
    readonly circleDotted: string;
    readonly circleDouble: string;
    readonly circleCircle: string;
    readonly circleCross: string;
    readonly circlePipe: string;
    readonly circleQuestionMark: string;
    readonly radioOn: string;
    readonly radioOff: string;
    readonly checkboxOn: string;
    readonly checkboxOff: string;
    readonly checkboxCircleOn: string;
    readonly checkboxCircleOff: string;
    readonly questionMarkPrefix: string;
    readonly bullet: string;
    readonly dot: string;
    readonly ellipsis: string;
    readonly pointer: string;
    readonly pointerSmall: string;
    readonly triangleUp: string;
    readonly triangleUpSmall: string;
    readonly triangleUpOutline: string;
    readonly triangleDown: string;
    readonly triangleDownSmall: string;
    readonly triangleLeft: string;
    readonly triangleLeftSmall: string;
    readonly triangleRight: string;
    readonly triangleRightSmall: string;
    readonly lozenge: string;
    readonly lozengeOutline: string;
    readonly home: string;
    readonly hamburger: string;
    readonly smiley: string;
    readonly mustache: string;
    readonly heart: string;
    readonly star: string;
    readonly play: string;
    readonly musicNote: string;
    readonly musicNoteBeamed: string;
    readonly nodejs: string;
    readonly arrowUp: string;
    readonly arrowDown: string;
    readonly arrowLeft: string;
    readonly arrowRight: string;
    readonly arrowLeftRight: string;
    readonly arrowUpDown: string;
    readonly almostEqual: string;
    readonly notEqual: string;
    readonly lessOrEqual: string;
    readonly greaterOrEqual: string;
    readonly identical: string;
    readonly infinity: string;
    readonly subscriptZero: string;
    readonly subscriptOne: string;
    readonly subscriptTwo: string;
    readonly subscriptThree: string;
    readonly subscriptFour: string;
    readonly subscriptFive: string;
    readonly subscriptSix: string;
    readonly subscriptSeven: string;
    readonly subscriptEight: string;
    readonly subscriptNine: string;
    readonly oneHalf: string;
    readonly oneThird: string;
    readonly oneQuarter: string;
    readonly oneFifth: string;
    readonly oneSixth: string;
    readonly oneSeventh: string;
    readonly oneEighth: string;
    readonly oneNinth: string;
    readonly oneTenth: string;
    readonly twoThirds: string;
    readonly twoFifths: string;
    readonly threeQuarters: string;
    readonly threeFifths: string;
    readonly threeEighths: string;
    readonly fourFifths: string;
    readonly fiveSixths: string;
    readonly fiveEighths: string;
    readonly sevenEighth: string;
    readonly line: string;
    readonly lineBold: string;
    readonly lineDouble: string;
    readonly lineDashed0: string;
    readonly lineDashed1: string;
    readonly lineDashed2: string;
    readonly lineDashed3: string;
    readonly lineDashed4: string;
    readonly lineDashed5: string;
    readonly lineDashed6: string;
    readonly lineDashed7: string;
    readonly lineDashed8: string;
    readonly lineDashed9: string;
    readonly lineDashed10: string;
    readonly lineDashed11: string;
    readonly lineDashed12: string;
    readonly lineDashed13: string;
    readonly lineDashed14: string;
    readonly lineDashed15: string;
    readonly lineVertical: string;
    readonly lineVerticalBold: string;
    readonly lineVerticalDouble: string;
    readonly lineVerticalDashed0: string;
    readonly lineVerticalDashed1: string;
    readonly lineVerticalDashed2: string;
    readonly lineVerticalDashed3: string;
    readonly lineVerticalDashed4: string;
    readonly lineVerticalDashed5: string;
    readonly lineVerticalDashed6: string;
    readonly lineVerticalDashed7: string;
    readonly lineVerticalDashed8: string;
    readonly lineVerticalDashed9: string;
    readonly lineVerticalDashed10: string;
    readonly lineVerticalDashed11: string;
    readonly lineDownLeft: string;
    readonly lineDownLeftArc: string;
    readonly lineDownBoldLeftBold: string;
    readonly lineDownBoldLeft: string;
    readonly lineDownLeftBold: string;
    readonly lineDownDoubleLeftDouble: string;
    readonly lineDownDoubleLeft: string;
    readonly lineDownLeftDouble: string;
    readonly lineDownRight: string;
    readonly lineDownRightArc: string;
    readonly lineDownBoldRightBold: string;
    readonly lineDownBoldRight: string;
    readonly lineDownRightBold: string;
    readonly lineDownDoubleRightDouble: string;
    readonly lineDownDoubleRight: string;
    readonly lineDownRightDouble: string;
    readonly lineUpLeft: string;
    readonly lineUpLeftArc: string;
    readonly lineUpBoldLeftBold: string;
    readonly lineUpBoldLeft: string;
    readonly lineUpLeftBold: string;
    readonly lineUpDoubleLeftDouble: string;
    readonly lineUpDoubleLeft: string;
    readonly lineUpLeftDouble: string;
    readonly lineUpRight: string;
    readonly lineUpRightArc: string;
    readonly lineUpBoldRightBold: string;
    readonly lineUpBoldRight: string;
    readonly lineUpRightBold: string;
    readonly lineUpDoubleRightDouble: string;
    readonly lineUpDoubleRight: string;
    readonly lineUpRightDouble: string;
    readonly lineUpDownLeft: string;
    readonly lineUpBoldDownBoldLeftBold: string;
    readonly lineUpBoldDownBoldLeft: string;
    readonly lineUpDownLeftBold: string;
    readonly lineUpBoldDownLeftBold: string;
    readonly lineUpDownBoldLeftBold: string;
    readonly lineUpDownBoldLeft: string;
    readonly lineUpBoldDownLeft: string;
    readonly lineUpDoubleDownDoubleLeftDouble: string;
    readonly lineUpDoubleDownDoubleLeft: string;
    readonly lineUpDownLeftDouble: string;
    readonly lineUpDownRight: string;
    readonly lineUpBoldDownBoldRightBold: string;
    readonly lineUpBoldDownBoldRight: string;
    readonly lineUpDownRightBold: string;
    readonly lineUpBoldDownRightBold: string;
    readonly lineUpDownBoldRightBold: string;
    readonly lineUpDownBoldRight: string;
    readonly lineUpBoldDownRight: string;
    readonly lineUpDoubleDownDoubleRightDouble: string;
    readonly lineUpDoubleDownDoubleRight: string;
    readonly lineUpDownRightDouble: string;
    readonly lineDownLeftRight: string;
    readonly lineDownBoldLeftBoldRightBold: string;
    readonly lineDownLeftBoldRightBold: string;
    readonly lineDownBoldLeftRight: string;
    readonly lineDownBoldLeftBoldRight: string;
    readonly lineDownBoldLeftRightBold: string;
    readonly lineDownLeftRightBold: string;
    readonly lineDownLeftBoldRight: string;
    readonly lineDownDoubleLeftDoubleRightDouble: string;
    readonly lineDownDoubleLeftRight: string;
    readonly lineDownLeftDoubleRightDouble: string;
    readonly lineUpLeftRight: string;
    readonly lineUpBoldLeftBoldRightBold: string;
    readonly lineUpLeftBoldRightBold: string;
    readonly lineUpBoldLeftRight: string;
    readonly lineUpBoldLeftBoldRight: string;
    readonly lineUpBoldLeftRightBold: string;
    readonly lineUpLeftRightBold: string;
    readonly lineUpLeftBoldRight: string;
    readonly lineUpDoubleLeftDoubleRightDouble: string;
    readonly lineUpDoubleLeftRight: string;
    readonly lineUpLeftDoubleRightDouble: string;
    readonly lineUpDownLeftRight: string;
    readonly lineUpBoldDownBoldLeftBoldRightBold: string;
    readonly lineUpDownBoldLeftBoldRightBold: string;
    readonly lineUpBoldDownLeftBoldRightBold: string;
    readonly lineUpBoldDownBoldLeftRightBold: string;
    readonly lineUpBoldDownBoldLeftBoldRight: string;
    readonly lineUpBoldDownLeftRight: string;
    readonly lineUpDownBoldLeftRight: string;
    readonly lineUpDownLeftBoldRight: string;
    readonly lineUpDownLeftRightBold: string;
    readonly lineUpBoldDownBoldLeftRight: string;
    readonly lineUpDownLeftBoldRightBold: string;
    readonly lineUpBoldDownLeftBoldRight: string;
    readonly lineUpBoldDownLeftRightBold: string;
    readonly lineUpDownBoldLeftBoldRight: string;
    readonly lineUpDownBoldLeftRightBold: string;
    readonly lineUpDoubleDownDoubleLeftDoubleRightDouble: string;
    readonly lineUpDoubleDownDoubleLeftRight: string;
    readonly lineUpDownLeftDoubleRightDouble: string;
    readonly lineCross: string;
    readonly lineBackslash: string;
    readonly lineSlash: string;
};
/**
 * Generates ASCII art text using the specified font.
 * @param   {string} txt    - The text to render as ASCII art.
 * @param   {Fonts}  [font] - The font to use for rendering. Defaults to 'Standard'.
 * @returns {string}        - The ASCII art text.
 * @example
 * const asciiText = asciiFont('Hello, World!', '3-D');
 * console.log(asciiText);
 */
declare const asciiFont: (txt: string, font?: Fonts) => string;
/**
 * Creates a clickable hyperlink in the terminal, if supported.
 * If terminal doesn't support clickable links, returns the URL string.
 * @param   {string} text - The text to display as the link.
 * @param   {string} url  - The URL to link to.
 * @returns {string}      - The clickable hyperlink or URL string.
 * @example
 * const linkedText = link('Visit Clippo docs', 'https://clippo.pigeonposse.com');
 * console.log(linkedText);
 */
declare const link: (text: string, url: string) => string;
/**
 * Aligns text in the terminal.
 */
declare const align: typeof ansiAlign;

type TableData = unknown[][];
type TableOpts = TableUserConfig;
type BoxOpts = Options;
type ColumnOpts = columnify.GlobalOptions;
type ColumnData = Record<string, unknown> | Record<string, unknown>[];
/**
 * Generates a text-based table from the provided data array.
 * @param   {TableData} data      - The data to display in the table.
 * @param   {TableOpts} [options] - Optional configuration options for the table.
 * @returns {string}              - The text-based table.
 * @see https://www.npmjs.com/package/table
 * @example
 * const data = [
 *     ['Name', 'Age', 'Country'],
 *     ['John', 30, 'USA'],
 *     ['Alice', 25, 'UK'],
 *     ['Bob', 35, 'Canada'],
 * ];
 * const tableText = table(data);
 * console.log(tableText);
 */
declare const table: (data: TableData, options?: TableOpts) => string;
/**
 * Creates a styled box around the provided text.
 * @param   {string}  text      - The text to display inside the box.
 * @param   {BoxOpts} [options] - Optional configuration options for the box.
 * @returns {string}            - The text with the styled box around it.
 * @see https://www.npmjs.com/package/boxen
 * @example
 * const boxedText = box('This is a boxed text', { padding: 1 });
 * console.log(boxedText);
 */
declare const box: (text: string, options?: BoxOpts) => string;
/**
 * Formats data into aligned columns for better readability.
 * @param   {ColumnData} data      - The data to format into columns.
 * @param   {ColumnOpts} [options] - Optional configuration options for column formatting.
 * @returns {string}               - The text with the data formatted into columns.
 * @see https://www.npmjs.com/package/columnify
 * @example
 * // data for columns
 * const data = [
 *     {
 *         name: 'mod1',
 *         description: 'some description which happens to be far larger than the max',
 *         version: '0.0.1',
 *     },
 *     {
 *         name: 'module-two',
 *         description: 'another description larger than the max',
 *         version: '0.2.0',
 *     }
 * ];
 *
 * // set columns with custom config
 * const columnText = columns(data, {
 *     showHeaders: false,
 *     minWidth: 20,
 *     config: {
 *         description: {
 *             maxWidth: 30
 *         }
 *     }
 * });
 *
 * // print columns
 * console.log(columnText);
 */
declare const columns: <Data extends ColumnData>(data: Data, options?: ColumnOpts) => string;

type LineAlign = 'left' | 'center' | 'right';
type TitleAlign = `${LineAlign}` | `top-${LineAlign}` | `bottom-${LineAlign}`;
type Color = NonNullable<Parameters<typeof box>[1]>['borderColor'];
type LineProps = {
    title?: string;
    lineChar?: string;
    lineColor?: Color;
    lineDim?: boolean;
    align?: LineAlign;
    titleAlign?: TitleAlign;
    width?: number;
};
/**
 * Generates a line with a title and customizable alignment for both the title and line.
 * @param {LineProps} props - Options object
 * @returns {string} Formatted line
 * @throws {Error} If `width` is not between 1 and 100
 */
declare const line: (props?: LineProps) => string;

declare const resolvePath: (...paths: string[]) => string;
declare const relativePath: (from: string, to: string) => string;
declare const getExtName: (path: string) => string;
declare const getDirName: (path: string) => string;
declare const getBaseName: (path: string, suffix?: string) => string;
declare const isAbsolutePath: (path: string) => boolean;
declare const normalizePath: (path: string) => string;

declare const writeFile: typeof writeFile$1;
/**
 * Find files and directories using glob patterns.
 * @example const paths = await getPaths(['*', '!src']);
 * console.log(paths);
 * //=> ['pigeon', 'rainbow']
 */
declare const getPaths: typeof globby;
/**
 * Find files and directories using glob patterns.
 * @example
 * for await (const path of getPathsStream('*.tmp')) {
 *    console.log(paths);
 * }
 */
declare const getPathsStream: typeof globbyStream;
/**
 * Checks if two file paths are equal after normalization.
 * Normalization ensures that differences like trailing slashes or redundant path segments are ignored.
 *
 * ---
 * @param {string} path1 - The first file path to compare.
 * @param {string} path2 - The second file path to compare.
 * @returns {boolean} `true` if the paths are equal, `false` otherwise.
 */
declare const arePathsEqual: (path1: string, path2: string) => boolean;
/**
 * Check if a string is a valid path.
 * @example
 * isPath('..') // true
 * isPath('foo bar') // false
 * isPath('C:\\') // true
 * isPath('foo\\bar') // true
 * isPath('foo/bar') // true
 * isPath('foo bar/baz') // false
 * @param {string} str - The string to test.
 * @returns {boolean} True if the string is a valid path.
 */
declare const isPath: (str: string) => boolean;
/**
 * Creates a directory if it does not exist.
 * @param {string} path - Path to the directory to create.
 * @returns {Promise<void>} - A promise that resolves when the directory has been created.
 * @example
 * await ensureDir('./path/to/directory')
 */
declare const ensureDir: (path: string) => Promise<void>;
/**
 * Reads the contents of a directory.
 * @param   {string}           path - Path to the directory to read.
 * @returns {Promise<import('node:fs').Dirent[]>} - A promise that resolves to an array of {@link https://nodejs.org/api/fs.html#class-fs-dirent | fs.Dirent} objects.
 * @example
 * const dirItems = await readDir('./path/to/directory')
 */
declare const readDir: (path: string) => Promise<fs.Dirent[]>;
/**
 * Gets the file names in a directory and filters them by extension.
 * @param   {object}            props            - Function props.
 * @param   {string}            props.path       - Path to the directory.
 * @param   {string[]}          props.extensions - Array of extensions to filter by, e.g., ['.md', '.txt'].
 * @returns {Promise<string[]>}                  - A promise that resolves with an array of file names without extensions.
 */
declare function getFilteredFileNames({ path, extensions, }: {
    path: string;
    extensions: string[];
}): Promise<string[]>;
/**
 * Gets the current directory.
 * @param   {string} [path] - An optional path to resolve the directory from.
 * @returns {string}        - The current directory.
 * @example getCurrentDir()
 */
declare const getCurrentDir: (path?: string) => string;
/**
 * Joins path segments.
 * @param   {...string} paths - Path segments to join.
 * @returns {string}          - The joined path.
 * @example joinPath('user', 'pigeonposse')
 */
declare function joinPath(...paths: string[]): string;
/**
 * Resolves path segments into an absolute path.
 * @param   {...string} paths - Path segments to resolve.
 * @returns {string}          - The resolved absolute path.
 */
declare const getAbsolutePath: (...paths: string[]) => string;
/**
 * Validates and resolves a path with home directory replacement.
 * @param   {string} path - The path to validate and resolve.
 * @returns {string}      - The validated and resolved absolute path.
 * @example
 * import { validateHomeDir } from '@dovenv/utils'
 *
 * const path = validateHomeDir('~/Documents')
 *
 * console.log(path) // returns: /users/{username}/Documents
 *
 * const path = validateHomeDir('/Home')
 *
 * console.log(path) // returns same: /Home
 */
declare function validateHomeDir(path: string): string;
/**
 * Reads the content of a file at the specified path.
 * @param   {string}                   path - The path of the file to read.
 * @returns {Promise<string | Buffer>}      - A promise that resolves to the content of the file as a string or buffer.
 * @throws {Error} If an error occurs while reading the file.
 * @example import { readFile } from '@dovenv/utils'
 *
 * try {
 *   const content = await readFile('./example.txt');
 *   console.log(content);
 * } catch (error) {
 *   console.error('Error reading file:', error);
 * }
 */
declare const readFile: typeof readFile$1;
/**
 * Removes a directory and its contents if it exists.
 * @param {string} path - The path of the directory to remove.
 * @throws {Error} If an error occurs while removing the directory.
 * @example import { removeDir } from '@dovenv/utils'
 *
 * try {
 *   await removeDir('./my/path')
 * } catch (e) {
 *   console.log(e)
 * }
 */
declare function removeDir(path: string): Promise<void>;
/**
 * Removes a directory and its contents if it exists.
 * @param {string} path - The path of the directory to remove.
 * @throws {Error} If an error occurs while removing the directory.
 * @example import { removeDirIfExist } from '@dovenv/utils'
 *
 * await removeDirIfExist('./my/path')
 */
declare function removeDirIfExist(path: string): Promise<void>;
/**
 * Removes a file or directory if it exists.
 * @param {string} path - The path of the file or directory to remove.
 * @throws {Error} If an error occurs while removing the file or directory.
 * @example
 * try {
 *   await removePathIfExist('./my/path')
 * } catch (e) {
 *   console.log(e)
 * }
 */
declare function removePathIfExist(path: string): Promise<void>;
/**
 * Removes a file if it exists.
 * @param {string} path - The path of the file to remove.
 * @throws {Error} If an error occurs while removing the file.
 * @example
 * try {
 *   await removeFile('./my/path')
 * } catch (e) {
 *   console.log(e)
 * }
 */
declare function removeFileIfExist(path: string): Promise<void>;
/**
 * Removes a file.
 * @param {string} path - The path of the file to remove.
 * @throws {Error} If an error occurs while removing the file.
 * @example
 * try {
 *   await removeFile('./my/path')
 * } catch (e) {
 *   console.log(e)
 * }
 */
declare function removeFile(path: string): Promise<void>;
/**
 * Checks if the given path points to a directory.
 * @param   {string}           path - The path to check.
 * @returns {Promise<boolean>}      - A promise that resolves to true if the path points to a directory, otherwise false.
 * @example import { isDirectory } from '@dovenv/utils'
 *
 * const isDir = await isDirectory('./my/path')
 */
declare function isDirectory(path: string): Promise<boolean>;
/**
 * Creates a directory at the specified path.
 * @param {string} path - The path of the directory to create.
 * @throws {Error} If an error occurs while creating the directory.
 * @example import { createDir } from '@dovenv/utils'
 * await createDir('./my/dir')
 */
declare function createDir(path: string): Promise<void>;
/**
 * Checks if a directory exists at the specified path.
 * @param   {string}           path - The path to check.
 * @returns {Promise<boolean>}      - A promise that resolves to true if a directory exists at the specified path, otherwise false.
 * @example import { existsDir } from '@dovenv/utils'
 * const exist = await existsDir('./my/dir')
 */
declare function existsDir(path: string): Promise<boolean>;
/**
 * Checks if a file exists at the specified path.
 * @param   {string}           path - The path to the file.
 * @returns {Promise<boolean>}      - A promise that resolves to true if the file exists, otherwise false.
 * @throws {Error} If an error occurs while checking the existence of the file.
 * @example import { existsFile } from '@dovenv/utils'
 *
 * const existPKG = await existsFile('./package.json')
 */
declare function existsFile(path: string): Promise<boolean>;
/**
 * Writes content to a file at the specified path.
 * @param {string}          path    - The path of the file to write to.
 * @param {string | Buffer} content - The content to write to the file.
 * @throws {Error} If an error occurs while writing to the file.
 * @example import { writeFileContent } from '@dovenv/utils'
 *
 * await writeFileContent('./greetFile.txt', 'Hello')
 */
declare function writeFileContent(path: string, content: string | Buffer): Promise<void>;
/**
 * Checks if a file or directory exists at the specified path.
 * @param   {string}           path - The path to check.
 * @returns {Promise<boolean>}      - A promise that resolves to true if a file or directory exists at the specified path, otherwise false.
 * @throws {Error} If an error occurs while checking the existence of the path.
 * @example import { existsPath } from '@dovenv/utils'
 *
 * const existPKG = await existsPath('./package.json')
 */
declare function existsPath(path: string): Promise<boolean>;
/**
 * Copy a file from input path to output path.
 * @param   {{input: string, output: string}} options - Options object with input and output paths.
 * @returns {Promise<void>}                                - Resolves when the file has been copied.
 * @throws {Error} If there is an error copying the file.
 * @example import { copyFile } from '@dovenv/utils'
 *
 * const copyResult = await copyFile({
 *   input : '/path/to/source.txt',
 *   output: '/path/to/destination.txt',
 * })
 */
declare const copyFile: ({ input, output, }: {
    input: string;
    output: string;
}) => Promise<void>;
/**
 * Copy a directory from input path to output path.
 * @param   {{input: string, output: string}} options - Options object with input and output paths.
 * @returns {Promise<void>}                                - Resolves when the directory has been copied.
 * @throws {Error} If there is an error copying the directory.
 * @example
 *
 * const copyResult = await copyDir({
 *   input : '/path/to/sourceDir',
 *   output: '/path/to/destinationDir',
 * })
 */
declare const copyDir: ({ input, output, }: {
    input: string;
    output: string;
}) => Promise<void>;
/**
 * Creates a symbolic link from the input path to the output path.
 * @param   {{input: string, output: string}} options - Options object with input and output paths.
 * @returns {Promise<void>}                                - Resolves when the symbolic link has been created.
 * @throws {Error} If there is an error creating the symbolic link.
 * @example import { createSymlink } from '@dovenv/utils'
 *
 * const symlinkResult = await createSymlink({
 *   input : '/path/to/source',
 *   output: '/path/to/destination',
 * })
 */
declare const createSymlink: ({ input, output, }: {
    input: string;
    output: string;
}) => Promise<void>;

/**
 * Creates a new instance of LocalStorage with the specified location.
 * @param   {string}       location - The location where the local storage data will be stored.
 * @returns {LocalStorage}          - A new instance of LocalStorage.
 * @example import { localStorage } from "@dovenv/utils"
 *
 * // Creates a local storage instance in the './myStorage' directory
 * const storage = localStorage('./myStorage');
 * // Sets an item in the local storage
 * storage.setItem('key', 'value');
 * // Retrieves the value of the item from the local storage
 * const value = storage.getItem('key');
 */
declare function localStorage(location: string): LocalStorage;

/**
 * Opens a system file or URL.
 * @param {string} target - The file path or URL to open.
 * @example import { open } from "@dovenv/utils"
 *
 * // Opens the image in the default image viewer.
 * await open('pigeon.png', {wait: true});
 */
declare const open: typeof o.default;
/**
 * Open an app. Cross-platform.
 * @param {string} name - The app you want to open. Can be either builtin supported apps names or other name supported in platform.
 * @example import { openApp } from "@dovenv/utils"
 *
 * // Open Xcode
 * await openApp('xcode');
 */
declare const openApp: typeof o.openApp;

/**
 * Resolves the directory path of a specified module entry.
 * @param {object} opts - An object with options for resolving the module path.
 * @param {string} opts.id - The module entry name to resolve, such as a package name.
 * @param {string[]} opts.path - Optional additional path segments to join with the resolved module directory.
 * @param {string} opts.from - The path to resolve the module from. Defaults to the current working directory.
 * @returns {string} - The resolved directory path of the module.
 * @throws {Error} If the module cannot be found in the lookup paths.
 * @example
 *
 * const moduleDir = await getModulePath({ id: '@dovenv/utils' })
 * console.log(moduleDir) // returns: {workspace}/node_modules/@dovenv/utils
 *
 * const moduleFile = await getModulePath({ id: '@dovenv/utils', path: ['dist','main.mjs'] })
 * console.log(moduleFile) // returns: {workspace}/node_modules/@dovenv/utils/index.js
 */
declare const getModulePath: ({ from, id, path, }: {
    /**
     * The path to resolve the module from.
     * @default process.cwd()
     */
    from?: string;
    /** The module entry name to resolve, such as a package name*/
    id: string;
    /** Optional additional path segments to join with the resolved module directory. */
    path?: string[];
}) => Promise<string>;

declare const getFileText: (path: string) => Promise<string>;
/**
 * Fetch content from a URL to string.
 * @param   {string}          url - URL of the resource.
 * @returns {Promise<string>}     - The fetched content.
 * @throws {Error} If there is an error fetching content from the URL.
 * @example import { fetch2string } from '@dovenv/utils'
 *
 * const imageData = await fetch2string('https://source.unsplash.com/random')
 * console.log(imageData)
 */
declare function fetch2string(url: string): Promise<string>;
/**
 * Retrieves a string from either a file specified by path or a URL.
 * Supports fetching remote content via URLs and reading local files.
 * @param   {string}          input - Path to a file or URL of the resource.
 * @returns {Promise<string>}       - The string retrieved from the file or URL.
 * @throws {Error} If there is an error fetching data or parsing the string.
 * @example import { getStringFrom } from "@dovenv/utils"
 *
 * const stringFromYamlUrl = await getStringFrom( 'https://raw.githubusercontent.com/pigeonposse/super8/main/.pigeonposse.yml' )
 * const stringFromJSON = await getStringFrom('/my/file.json')
 *
 * console.log( stringFromYamlUrl, stringFromJSON )
 */
declare const getStringFrom: (input: string) => Promise<string>;
/**
 *
 * Fetches all strings from a given patterns (URLs or paths).
 * @param   {string[]} patterns - An array of strings with URLs or paths.
 * @returns {Promise<object[]>} - The fetched content.
 * @throws {Error} If there is an error fetching content from the URLs or paths.
 * @example import { getStringsFrom } from '@dovenv/utils'
 *
 * const patterns = [
 *   'https://pigeonposse.com', // fetches and returns content as a string
 *   './docs/*.md',             // reads files matching the pattern and returns content as strings
 *   'Just a simple string'     // returns the same string as provided
 * ];
 *
 * const data = await getStringsFrom(patterns);
 * console.log(data);
 */
declare const getStringsFrom: (patterns: string[]) => Promise<({
    type: "path";
    path: string;
    id: string;
    content: string;
} | {
    type: "url";
    path: string;
    id: string;
    content: string;
} | {
    type: "text";
    id: string;
    content: string;
    path?: undefined;
})[]>;

/**
 * Creates a caching mechanism for storing and retrieving values.
 * @param   {object} params             - Parameters for configuring the cache.
 * @param   {string} params.id          - Unique identifier for the cache.
 * @param   {object} params.values      - Initial values to cache.
 * @param   {string} params.projectName - Name of the project to use for configuration.
 * @param {string } [params.cwd]        - The current working directory. Defaults to process.
 * @returns {object}                    - An object with methods to interact with the cache.
 * @throws {Error} If the cache value is unexpected or not found.
 * @example import { cache } from "@dovenv/utils"
 *
 * const { get, set } = await cache({
 *   projectName: 'myApp',
 *   id: 'userSettings',
 *   values: {
 *      theme: 'dark',
 *      language: 'en'
 *   },
 * });
 *
 * // Set a new value in the cache
 * set({ theme: 'light' });
 *
 * // Retrieve a value from the cache
 * const theme = get('theme');
 * console.log(theme); // Output: 'light'
 *
 * // Retrieve all cached values
 * const allValues = get();
 * console.log(allValues); // Output: { theme: 'light', language: 'en' }
 *
 * // Handle unexpected cache value
 * try {
 *   const nonExistentValue = get('nonExistent');
 * } catch (error) {
 *   console.error('Error:', error.message); // Output: Cache value is unexpected: nonExistent
 * }
 */
declare const cache: <Values extends Record<string, unknown>>({ id, values, projectName, cwd, }: {
    /**
     * Project name for search cache.
     * You can reuse the same cache for multiple instances.
     */
    projectName: string;
    /**
     * Identifier for the values.
     */
    id: string;
    /**
     * Cache Default Values.
     */
    values: Values;
    /**
     * Directory to save cache file.
     * Default: System default user config directory.
     * You most likely don't need this. Please don't use it unless you really have to.
     */
    cwd?: string;
}) => Promise<{
    /**
     * The default values for the cache.
     */
    defaultValues: Values;
    /**
     * Retrieve a value from the cache.
     * @example
     * const theme = get('theme');
     * console.log(theme); // Output: 'light'
     */
    get: <ID extends ((keyof Values) | undefined) = undefined>(v?: ID) => ID extends (keyof Values) ? Values[ID] : Values;
    /**
     * Updates the cache with the provided values.
     *
     * Merges the existing cached values with the new partial values and updates the cache.
     */
    set: (obj: Partial<Values>) => void;
    /**
     * Resets the cache to its default values.
     * @example
     * reset();
     */
    reset: () => void;
    /**
     * The path to the cache file.
     */
    path: string;
}>;

/**
 * Returns the path to the operating system's temporary directory.
 * @returns {string} The path to the operating system's temporary directory.
 */
declare const getTempDir: () => string;
/**
 * Determines the operating system.
 * @returns {'windows' | 'macos' | 'linux' | 'unknown'} - The operating system. Possible values are 'linux', 'macos', or 'windows'.
 */
declare const getPlatform: () => Promise<"windows" | "macos" | "linux" | "unknown">;
/**
 * Returns the operating system CPU architecture.
 * @returns {'arm64' | 'x64' | 'unknown'} - The operating system CPU architecture.
 */
declare function getArch(): 'arm64' | 'x64' | 'unknown';

type DecompresFileOptions = {
    input: string;
    output: string;
    newName?: string;
    remove?: boolean;
};
type ZipDirOptions = {
    input: string;
    output: string;
    onDone?: (n: string) => void;
    onError?: (n: string, err: Error) => void;
};
type ZipFileOptions = {
    input: string;
    output: string;
    name?: string;
    onDone?: (n: string) => void;
    onError?: (n: string, err: Error) => void;
};
/**
 * Decompresses an archive file (zip, tar, tgz) to a specified output directory.
 * @param {object}  options           - The options object.
 * @param {string}  options.input     - The path to the input compressed file.
 * @param {string}  options.output    - The directory where the file should be decompressed.
 * @param {string}  [options.newName] - The new name for the decompressed file or directory.
 * @param {boolean} [options.remove]  - Whether to remove the original compressed file after decompression.
 * @example decompressFile( {
  input   : resolve(  'downloads', 'example-file.zip' ), // Path to the compressed file
  output  : resolve(  'decompressed' ), // Directory where the file should be decompressed
  newName : 'renamed-decompressed-file', // New name for the decompressed file or directory (optional)
  remove  : true, // Remove the original compressed file after decompression
  } )
 */
declare function decompressFile({ input, output, newName, remove, }: DecompresFileOptions): Promise<void>;
/**
 * Zips the specified file and saves it to the output directory.
 * @param {ZipFileOptions} options - An object with properties.
 * @param {string} options.input - The path to the file to be zipped.
 * @param {string} options.output - The directory where the zip file should be saved.
 * @param {string} [options.name] - The desired name for the zip file. If not provided, the original file name with `.zip` appended will be used.
 * @param {Function} [options.onDone] - A callback to be called after the zip file is created. Takes a single argument of the zip file name.
 * @param {Function} [options.onError] - A callback to be called if an error occurs during the zipping process. Takes two arguments: the zip file name, and the error.
 * @returns {Promise<void>}
 */
declare const zipFile: ({ input, output, name, onDone, onError, }: ZipFileOptions) => Promise<void>;
/**
 * Zips the files in the specified source directory and saves them to the output directory.
 * @param {ZipDirOptions} options - An object with properties.
 * @param {string} options.input - The path to the source directory containing files to zip.
 * @param {string} options.output - The path to the output directory where zip files will be saved.
 * @param {Function} [options.onDone] - A function to be called after each zip file is created. Takes a string argument of the created zip file name.
 * @param {Function} [options.onError] - A function to be called if an error occurs. Takes two arguments: the zip file name, and the error.
 * @returns {Promise<void>}
 */
declare const zipFilesInDirectory: ({ input, output, onDone, onError, }: ZipDirOptions) => Promise<void>;

type GetCharsAndWordsFromPathsOptions = {
    input: string[];
    opts?: Parameters<typeof getPaths>[1];
};
type GetCharsAndWordsFromUrlOptions = {
    input: string[];
};
type GetCharsAndWordsFromContentOptions = {
    input: string[];
};
type GetCharsAndWordsFromOptions = {
    paths?: GetCharsAndWordsFromPathsOptions['input'];
    url?: GetCharsAndWordsFromUrlOptions['input'];
    content?: GetCharsAndWordsFromContentOptions['input'];
    opts?: {
        paths?: GetCharsAndWordsFromPathsOptions['opts'];
    };
};
type GetCharsAndWordsFromResponse = {
    chars: number;
    words: number;
};
/**
 * Gets the total number of characters and words in all files matching the given glob pattern.
 * @param {GetCharsAndWordsFromPathsOptions} param0 - An object containing the input glob pattern and options.
 * @returns {Promise<{ files: number, chars: number, words: number }>} - An object with properties for the number of files, the total number of characters, and the total number of words.
 * @throws {Error} If there is an error while reading the files.
 */
declare const getCountFromPaths: ({ input, opts, }: GetCharsAndWordsFromPathsOptions) => Promise<{
    files: number;
    chars: number;
    words: number;
}>;
/**
 * Gets the total number of characters and words in all files matching the given glob pattern.
 * @param {GetCharsAndWordsFromPathsOptions} param0 - An object containing the input glob pattern and options.
 * @returns {Promise<GetCharsAndWordsFromResponse>} - An object with the total number of characters and words.
 * @throws {Error} If an error occurs while reading the files.
 * @example const result = await getCharsAndWordsFromPaths({ input: ['*.md'] });
 * console.log(result.chars); // Total characters
 * console.log(result.words); // Total words
 */
declare const getCharsAndWordsFromPaths: ({ input, opts, }: GetCharsAndWordsFromPathsOptions) => Promise<GetCharsAndWordsFromResponse>;
/**
 * Gets the total number of characters and words from the given URLs.
 * @param {GetCharsAndWordsFromPathsOptions} param0 - An object containing the input URLs.
 * @returns {Promise<GetCharsAndWordsFromResponse>} - An object with the total number of characters and words.
 * @throws {Error} If an error occurs while fetching the URLs.
 * @example const result = await getCharsAndWordsFromUrl({ input: ['https://example.com'] });
 * console.log(result.chars); // Total characters
 * console.log(result.words); // Total words
 */
declare const getCharsAndWordsFromUrl: ({ input }: GetCharsAndWordsFromPathsOptions) => Promise<GetCharsAndWordsFromResponse>;
/**
 * Calculates the total number of characters and words from a list of string content.
 * @param {GetCharsAndWordsFromContentOptions} param0 - An object containing the input strings to analyze.
 * @returns {Promise<GetCharsAndWordsFromResponse>} - An object with the total number of characters and words.
 * @example
 * const result = await getCharsAndWordsFromContent({ input: ['Hello world!', 'This is a test.'] });
 * console.log(result.chars); // Total characters
 * console.log(result.words); // Total words
 */
declare const getCharsAndWordsFromContent: ({ input }: GetCharsAndWordsFromContentOptions) => Promise<GetCharsAndWordsFromResponse>;
/**
 * Gets the total number of characters and words from various sources: glob pattern, URL, or string content.
 * @param {object} options - Options for processing content.
 * @param {string[]} [options.paths] - Glob pattern to search for files.
 * @param {string} [options.url] - URL to fetch content from.
 * @param {string} [options.content] - Direct string content to analyze.
 * @param {GetCharsAndWordsFromOptions['opts']}[options.opts] - Additional options for processing content.
 * @returns {Promise<{ chars: number, words: number }>} - Total characters and words in the content.
 * @throws {Error} If an error occurs while processing.
 * @example
 * const result = await getCharsAndWordsFrom({ pattern: ['*.md'] });
 * console.log(result.chars); // Total characters
 * console.log(result.words); // Total words
 *
 * const resultFromUrl = await getCharsAndWordsFrom({ url: 'https://example.com/file.txt' });
 * console.log(resultFromUrl);
 *
 * const resultFromContent = await getCharsAndWordsFrom({ content: 'Direct string content' });
 * console.log(resultFromContent);
 */
declare const getCharsAndWordsFrom: ({ paths, url, content, opts, }: GetCharsAndWordsFromOptions) => Promise<{
    chars: number;
    words: number;
    paths: {
        chars: number;
        words: number;
    };
    url: {
        chars: number;
        words: number;
    };
    content: {
        chars: number;
        words: number;
    };
}>;

/**
 * Any Array type
 * Same as `any[]` type. Used only for prevent ts errors
 */
type AnyArray = any[];
/**
 * Any type
 * Same as `any` type. Used only for prevent ts errors
 */
type Any = any;
/**
 * Values of Object
 */
type ObjectValues<Values> = Values[keyof Values];
/**
 * Keys of Object
 */
type ObjectKeys<Values> = keyof Values;
/**
 * DeepPartial
 */
type DeepPartial<T> = T extends object ? {
    [P in keyof T]?: DeepPartial<T[P]>;
} : T;
/**
 * Prettify your type for better readability
 */
type Prettify<T> = {
    [K in keyof T]: T[K];
} & {};
/**
 * NonUndefined
 * @description Exclude undefined from set `A`
 * @example
 *   // Expect: "string | null"
 *   SymmetricDifference<string | null | undefined>;
 */
type NonUndefined<A> = A extends undefined ? never : A;
/**
 * FunctionKeys
 * @description Get union type of keys that are functions in object type `T`
 * @example
 *  type MixedProps = {name: string; setName: (name: string) => void; someKeys?: string; someFn?: (...args: any) => any;};
 *
 *   // Expect: "setName | someFn"
 *   type Keys = FunctionKeys<MixedProps>;
 */
type FunctionKeys<T extends object> = {
    [K in keyof T]-?: NonUndefined<T[K]> extends Function ? K : never;
}[keyof T];
/**
 * NonFunctionKeys
 * @description Get union type of keys that are non-functions in object type `T`
 * @example
 *   type MixedProps = {name: string; setName: (name: string) => void; someKeys?: string; someFn?: (...args: any) => any;};
 *
 *   // Expect: "name | someKey"
 *   type Keys = NonFunctionKeys<MixedProps>;
 */
type NonFunctionKeys<T extends object> = {
    [K in keyof T]-?: NonUndefined<T[K]> extends Function ? never : K;
}[keyof T];
/**
 * AssertEqual
 * @description Checks if two types `T` and `U` are equal.
 * @example
 *   type Test = AssertEqual<string, string>; // Expected: true
 *   type TestFail = AssertEqual<string, number>; // Expected: false
 */
type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends (<V>() => V extends U ? 1 : 2) ? true : false;
/**
 * ExpectEqual
 * @description Returns the type `T` if `T` and `U` are equal; otherwise, returns `never`.
 * @example
 *   type Test = ExpectEqual<string, string>; // Expected: string
 *   type TestFail = ExpectEqual<string, number>; // Expected: never
 */
type ExpectEqual<T, U> = AssertEqual<T, U> extends true ? T : never;

/**
 * DeepNonNullable
 * @description NonNullable that works for deeply nested structure
 * @example
 *   type NestedProps = {
 *     first?: null | {
 *       second?: null | {
 *         name?: string | null |
 *         undefined;
 *       };
 *     };
 *   };
 *   type RequiredNestedProps = DeepNonNullable<NestedProps>;
 *   // Expect: {
 *   //   first: {
 *   //     second: {
 *   //       name: string;
 *   //     };
 *   //   };
 *   // }
 */
type DeepNonNullable<T> = Prettify<_DeepNonNullable<T>>;
type _DeepNonNullable<T> = T extends (...args: AnyArray) => Any ? T : T extends AnyArray ? Prettify<Array<_DeepNonNullable<NonNullable<T[number]>>>> : T extends object ? Prettify<{
    [P in keyof T]-?: _DeepNonNullable<NonNullable<T[P]>>;
}> : Prettify<NonNullable<T>>;

type ReturnAwaitedType<T extends (...args: Any) => Any> = Awaited<ReturnType<T>>;

/**
 * DeepRequired
 * @description Required that works for deeply nested structure
 * @example
 *   type NestedProps = {
 *     first?: {
 *       second?: {
 *         name?: string;
 *       };
 *     };
 *   };
 *   type RequiredNestedProps = DeepRequired<NestedProps>
 *   // Expect: {
 *   //   first: {
 *   //     second: {
 *   //       name: string;
 *   //     };
 *   //   };
 *   // }
 */
type DeepRequired<T> = Prettify<_DeepRequired<T>>;
type _DeepRequired<T> = T extends (...args: AnyArray) => Any ? T : T extends AnyArray ? Prettify<_DeepRequiredArray<T[number]>> : T extends object ? Prettify<_DeepRequiredObject<T>> : T;
type _DeepRequiredArray<T> = Array<_DeepRequired<NonUndefined<T>>>;
type _DeepRequiredObject<T> = {
    [P in keyof T]-?: _DeepRequired<NonUndefined<T[P]>>;
};

type PackageJSON = JSONSchemaForNPMPackageJsonFiles;

type SetDirTreeStyleParams = {
    /** Name of the file or folder */
    name: string;
    /** Indentation level */
    indent: number;
    /** Whether it is the last item in the current level */
    isLast: boolean;
    /** Whether it is the first item in the current level */
    isFirst: boolean;
    /** Whether it is a folder */
    isFolder: boolean;
};
type SetDirTree = {
    structure: object;
    name?: string;
    style?: (opts: SetDirTreeStyleParams) => string;
};
type SharedStructure = {
    /**
     * The maximum number of directories to traverse.
     */
    max?: number;
    /**
     * The order to traverse the directories.
     * @default 'atoz'
     */
    sort?: 'atoz' | 'ztoa';
};
type DirStructureParams = SharedStructure & {
    /**
     * The root path of the directory to read.
     */
    input: string;
};
type PathsStructureParams = SharedStructure & {
    /**
     * The input paths to process.
     */
    input: string[];
    /**
     * Additional options for the pattern.
     */
    patternOpts?: Parameters<typeof getPaths>[1];
};
type PathTreeOpts = Prettify<Omit<SetDirTree, 'structure'> & DirStructureParams>;
type PatternTreeOpts = Prettify<Omit<SetDirTree, 'structure'> & PathsStructureParams>;

/**
 * Returns a string representing the content of an object as a directory structure.
 * @param {object} opts An object with options for generating the directory structure string.
 * @param {object} opts.structure - An object representing the directory structure.
 * @param {string} [opts.name] - The name of the root directory. If provided, it will be printed as the first line.
 * @param {Function} [opts.style] - A function that returns a string representing an item (folder or file).
 *                                   Receives an object with properties: name, indent, isLast, isFirst, isFolder.
 * @returns {string} A string representing the content of `structure` as a directory structure.
 *
 * ---
 * @example
 *
 * const result = setDirTree({
 *   structure: {
 *   src: {
 *     components: {
 *       "Button.js": null,
 *       "Header.js": null
 *     },
 *     utils: {
 *       "helpers.js": null
 *     },
 *     "index.js": null
 *   },
 *   "package.json": null
 *   },
 *   name: "my-project",
 * });
 *
 * console.log(result);
 */
declare const setDirTree: (opts: SetDirTree) => string;

/**
 * Generates a string representing the directory structure of a given path.
 * @param {object} props - Function props.
 * @param {string} props.input - The root path of the directory to read.
 * @returns {Promise<string>} The directory structure as a string.
 */
declare const getDirTree: (props: PathTreeOpts) => Promise<string>;
declare const getPathsStructure: (props: PathsStructureParams) => Promise<object>;
declare const getPathsTree: (props: PatternTreeOpts) => Promise<string>;

/**
 * ****************************************************************************
 * TYPES
 * ****************************************************************************
 */
/** Validate type (zod type wrappper) */
type Validate = typeof z;
type ValidateAnyType = ZodType<any, any, any>;
type ValidateErrorType = ZodError;
type ValidateInfer<O extends ValidateAnyType> = z.infer<O>;
type ValidateType<T> = ZodType<T>;
type ToObjectValidate<T extends object> = toZod<T>;
type ToValidate<T> = z.ZodType<T, Any, Any>;
/**
 * Creates a validation schema function for a given TypeScript type.
 * @template Type - The expected TypeScript type for the validation schema.
 * @param {(v: Validate) => ValidateType<Type>} schemaFn - A function that defines the validation schema.
 * @returns {(v: Validate) => ValidateType<Type>} - A function that returns the validation schema.
 * @example
 * import {validate} from '@dovenv/utils' // validate = Zod  wrapper
 * type User = { name: string}
 * const schemaFn = createValidateSchemaFn<User>((v) => v.object({ name: v.string().min(3) }));
 * const userSchema = schemaFn(validate);
 */
declare const createValidateSchemaFn: <Type>(schemaFn: (v: Validate) => ValidateType<Type>) => (v: Validate) => ValidateType<Type>;
/**
 * Creates and immediately returns a validation schema for a given TypeScript type.
 * @template Type - The expected TypeScript type for the validation schema.
 * @param {(v: Validate) => ValidateType<Type>} schemaFn - A function that defines the validation schema.
 * @returns {ValidateType<Type>} - The resulting validation schema.
 * @example
 * type User = { name: string}
 * const userSchema = createValidateSchema<User>((v) => v.object({ name: v.string().min(3) }));
 */
declare const createValidateSchema: <Type>(schemaFn: (v: Validate) => ValidateType<Type>) => ValidateType<Type>;
/**
 * Converts a validation error into a pretty string.
 * @param {unknown} error - The error to convert.
 * @returns {string} A pretty string representing the error.
 */
declare const formatValidationError: (error: unknown) => string;
/**
 * Validate error class.
 * The validation functions are a wrapper of `zod` functions.
 * @see https://zod.dev/
 */
declare const ValidateError: typeof z.ZodError;
/**
 * Create schema validation from js.
 * The validation functions are a wrapper of `zod` functions.
 * @see https://zod.dev/
 */
declare const validate: typeof z;
/**
 * Serializes and simplifies types into a JSON format
 * @see https://www.npmjs.com/package/zodex?activeTab=readme
 */
declare const serializeValidation: typeof zerialize;
/**
 * Deserializes
 * @see https://www.npmjs.com/package/zodex?activeTab=readme
 */
declare const deserializeValidation: typeof dezerialize;
/**
 * Utility class for data validation.
 * Most of the validation functions are a wrapper of `zod` functions.
 * @see https://zod.dev/
 */
declare class Validation {
    Error: typeof z.ZodError;
    schema: typeof z;
    formatError: (error: unknown) => string;
    serialize: typeof zerialize;
    deserialize: typeof dezerialize;
    /**
     * Create a union of literal types from an array of strings.
     * @param {string[]}values The values of the union.
     * @returns {z.ZodUnion} A union of literal types.
     * @example
     * const myUnion = createLiteralUnion( ['one', 'two', 'three'] )
     * // myUnion is a union of 'one', 'two', 'three'
     */
    createLiteralUnion<T extends string>(values: T[]): z.ZodUnion<[z.ZodLiteral<T>, ...z.ZodLiteral<T>[]]>;
}

type SchemaObject = Parameters<typeof compile>[0] | object;
type Ts2Schema = {
    config: Config;
};
type Zod2schema = {
    /**
     * The JSON Schema object to convert to a TypeScript type.
     * It can be directly passed as an object or as the first parameter of the `compile` function.
     */
    schema: ValidateAnyType;
    /**
     * Options for convert process
     */
    opts?: Options$1;
};
type Schema2zod = {
    /**
     * The JSON Schema object to convert to a TypeScript type.
     * It can be directly passed as an object or as the first parameter of the `compile` function.
     */
    schema: SchemaObject;
    /**
     * Options for convert process
     */
    opts?: Options$2;
};
type Schema2tsProps = {
    /**
     * The name of the TypeScript type to be generated.
     * This will appear as the interface or type name in the output.
     */
    name: string;
    /**
     * The JSON Schema object to convert to a TypeScript type.
     * It can be directly passed as an object or as the first parameter of the `compile` function.
     */
    schema: SchemaObject;
    /**
     * Optional compilation options to customize the output TypeScript type.
     * These options are passed to the `json-schema-to-typescript` library.
     */
    opts?: Options$3;
};
type Schema2typeProps = Pick<Schema2tsProps, 'schema'> & {
    /**
     * Remove all `?` from the generated type
     * @default false
     */
    required?: boolean;
    /**
     * Remove all `[k: string]: unknown` from the generated type
     * @default false
     */
    noUnknownObject?: boolean;
};

/**
 * Converts a zod schema to a JSON schema.
 * @param {Zod2schema} params - Options.
 * @returns {Promise<string>} The JSON schema.
 * @example
 * const jsonSchema = await zod2schema({
 *   schema: z.object({
 *     foo: z.string(),
 *   }),
 *   opts: {
 *     // zodToJsonSchema options
 *   },
 * })
 */
declare const zod2schema: (params: Zod2schema) => Promise<zod_to_json_schema.JsonSchema7Type & {
    $schema?: string | undefined;
    definitions?: {
        [key: string]: zod_to_json_schema.JsonSchema7Type;
    } | undefined;
}>;
/**
 * JSON schema to zod type
 * @param {Schema2zod} params - Options.
 * @returns {Promise<string>} - zodtype in string
 * @example
 * const zodSchema = await schema2zod({
 *   schema: {
 *     type: "object",
 *     ...
 *   }
 * })
 *
 * console.log(zodSchema)
 */
declare const schema2zod: (params: Schema2zod) => Promise<string>;
/**
 * Parses a JSON schema string into an object.
 * @template R - The type of the object to be returned.
 * @param {string} schema - The JSON schema string to parse.
 * @returns {R} - The parsed object.
 * @throws {SyntaxError} - If the input string is not a valid JSON.
 * @example
 * const obj = schema2object<{ foo: string }>('{"foo": "bar"}');
 * console.log(obj.foo); // Output: "bar"
 */
declare const schema2object: <R extends object>(schema: string) => R;
/**
 * Converts a TypeScript type to a JSON schema.
 * @param {Ts2Schema} params - Options.
 * @returns {Promise<object>} The JSON schema.
 * @example
 * const jsonSchema = await ts2schema({
 *   config: {
 *     path: 'path/to/MyType.ts',
 *     type: 'MyType',
 *   },
 * })
 *
 * console.log(jsonSchema)
 */
declare const ts2schema: (params: Ts2Schema) => Promise<SchemaObject>;
/**
 * JSON schema to typescript type string
 *
 * Useful, for example, to display a schema in a readable way for the user.
 * @param {Schema2tsProps} params - Options.
 * @returns {Promise<string>}
 * ---
 * @example
 * const tsString = await schema2ts({
 *   name: 'MySchemaType',
 *   schema: {
 *     type: "object",
 *     ...
 *   }
 * })
 *
 * console.log(tsString)
 */
declare const schema2ts: (params: Schema2tsProps) => Promise<string>;
/**
 * Converts a JSON schema to a TypeScript type string.
 * @param {Schema2typeProps} params - Options for conversion.
 * @param {object} params.schema - The JSON schema to convert.
 * @param {boolean} [params.required] - If true, removes optional marking from fields.
 * @param {boolean} [params.noUnknownObject] - If true, removes unknown object indexing from the result.
 * @returns {Promise<string>} - The TypeScript type string representation of the schema.
 * ---
 * @example
 * const typeString = await schema2type({
 *   schema: {
 *     type: "object",
 *     ...
 *   },
 *   required: true,
 *   noUnknownObject: false
 * });
 *
 * console.log(typeString);
 */
declare const schema2type: (params: Schema2typeProps) => Promise<string>;
/**
 * Validate a data from a schema.
 *
 * This function accepts both `data` and `schema` as required parameters, which can either be
 * an object or a string. If a string is provided, it may represent a file path or a URL, and
 * the format can be one of the following: JSON, YAML, TOML, JS, INI, CSV, or XML.
 * @param {string | object} data - The data to be validated. It can be a string representing a file path or URL,
 *                                  or an object containing the data to validate.
 * @param {string | object} schema - The schema against which the data will be validated. It can be a string
 *                                   representing a file path or URL, or an object representing the schema.
 * @returns {Promise<object>} - The validated JSON data.
 * @throws {ValidateSchemaError} - If the schema is invalid or the data does not conform to the schema.
 * @example import { validateSchema } from '@dovenv/utils'
 *
 * try {
 *   const validData = await validateSchema(
 *     '../../package.json',
 *     'https://json.schemastore.org/package.json'
 *   );
 *   console.log(validData);
 * } catch (error) {
 *     console.error('Validation failed:', error.message);
 * }
 */
declare const validateSchema: (data: string | object, schema: string | object) => Promise<object>;

/**
 * @see https://www.npmjs.com/package/browser-or-node
 */
declare const isBrowser: boolean;
declare const isNode: boolean;
declare const isWebWorker: boolean;
declare const isJsDom: boolean;
declare const isDeno: boolean;
declare const isBun: boolean;

declare const stdType: {
    readonly stdout: "stdout";
    readonly stderr: "stderr";
    readonly stdin: "stdin";
};
declare const consoleType: {
    readonly log: "log";
    readonly info: "info";
    readonly error: "error";
    readonly warn: "warn";
    readonly trace: "trace";
};

type StdType = ObjectValues<typeof stdType>;
type ConsoleType = ObjectValues<typeof consoleType>;
type onStdOpts = {
    /**
     * Function to transform the output before replacing it.
     * @example
     * const fn = ( { data, type } ) => {
     *    return type === 'stderr' ? data.toUpperCase() : data
     * }
     */
    fn: (opts: {
        data: string;
        type: StdType;
    }) => string;
    /**
     * processs object to replace output in.
     * @default process
     */
    process?: NodeJS.Process;
    /**
     * Type of stream to replace output in.
     * @default 'stdout'
     */
    type?: Prettify<StdType[] | StdType>;
};
type ReplaceStdOpts = Prettify<Omit<onStdOpts, 'fn'> & {
    /**
     * Params object containing key-value pairs where each key is a string to be replaced by its corresponding value in the output.
     * @example {
     *   'error': 'warning'
     * }
     */
    params: Record<string, string>;
    /**
     * Function to transform the output before replacing it.
     * @example
     * const transform = ( { data, type } ) => {
     *    return type === 'stderr' ? data.toUpperCase() : data
     * }
     */
    transform?: onStdOpts['fn'];
}>;
type onConsoleOpts = {
    /**
     * Function to transform the output before replacing it.
     * @example
     * const fn = ( { data, type } ) => {
     *    return type === 'error' ? data.toUpperCase() : data
     * }
     */
    fn: (opts: {
        data: string;
        type: ConsoleType;
    }) => string;
    /**
     * Type of stream to replace output in.
     * @default 'log'
     */
    type?: Prettify<ConsoleType[] | ConsoleType>;
};
type ReplaceConsoleOpts = Prettify<Omit<onConsoleOpts, 'fn'> & {
    /**
     * Params object containing key-value pairs where each key is a string to be replaced by its corresponding value in the output.
     * @example {
     *   'error': 'warning'
     * }
     */
    params: Record<string, string>;
    /**
     * Function to transform the output before replacing it.
     * @example
     * const transform = ( { data, type } ) => {
     *    return type === 'warm' ? data.toUpperCase() : data
     * }
     */
    transform?: onConsoleOpts['fn'];
}>;

/**
 * Replaces the output of `stdout` or `stderr` streams with a custom transformation function.
 * @param {onStdOpts} opts - Options for customizing the stream transformation.
 * @returns {object} A Object with `start` and `stop` methods.
 * @example
 * import { onStd } from '@dovenv/utils'
 * const secretOut = onStd({
 *   type : 'stdout',
 *   fn : ( { data } ) => data.replace( /secret/g, '***' ),,
 * });
 *
 * secretOut.start();
 * // my code
 * secretOut.stop();
 */
declare const onStd: (opts: onStdOpts) => {
    start: () => void;
    stop: () => void;
};
/**
 * Replaces output in the specified stream (stdout, stderr, or stdin) by substituting
 * values based on the provided parameters.
 *
 * This function overrides the write method of the specified stream to replace occurrences
 * of specified strings in the output with replacement strings. It supports custom process
 * objects and stream types.
 *
 * ---
 * @param {ReplaceStdOpts} opts - The options for replacing output.
 * @param {ReplaceStdOpts['params']} opts.params - An object containing key-value pairs
 *                                               where each key is a string to be replaced by its corresponding value in the output.
 * @param {ReplaceStdOpts['proceso']} [opts.process] - An optional Node.js process object. Defaults to the global process.
 * @param {ReplaceStdOpts['type']} [opts.type] - The type of stream to replace output for. Defaults to 'stdout'.
 * @returns {object} A Object with `start` and `stop` methods.
 * @example
 * import { replaceConsole } from '@dovenv/utils'
 * const versionOut = replaceStd({
 *   params: {
 *     'v1.3.4': 'v2.1.9'
 *   },
 *   type: ['stderr']
 * });
 *
 * versionOut.start();
 * // my code
 * versionOut.stop();
 */
declare const replaceStd: (opts: ReplaceStdOpts) => {
    start: () => void;
    stop: () => void;
};

/**
 * Intercepts console methods and applies a transformation function to all arguments.
 *
 * Useful for replacing certain values in console output, such as API keys or other sensitive information.
 * @param {onConsoleOpts} opts - Options for the console interceptor.
 * @returns {object} A Object with `start` and `stop` methods.
 * @example
 * import { onConsole } from '@dovenv/utils'
 * const secretOut = onConsole({
 *   type : ['log', 'warn'],
 *   fn : ( { data } ) => data.replace( /secret/g, '***' ),,
 * });
 *
 * secretOut.start();
 * // my code
 * secretOut.stop();
 */
declare const onConsole: (opts: onConsoleOpts) => {
    start: () => void;
    stop: () => void;
};
/**
 * Replaces values in console output using a set of parameters.
 * @param {ReplaceConsoleOpts} opts - Options for the console output replacer.
 * @returns {object} A Object with `start` and `stop` methods.
 * @example
 * import { replaceConsole } from '@dovenv/utils'
 * const versionOut = replaceConsole({
 *   params: {
 *     'v1.3.4': 'v2.1.9'
 *   },
 *   type: ['stderr']
 * });
 *
 * versionOut.start();
 * // mys code
 * versionOut.stop();
 */
declare const replaceConsole: (opts: ReplaceConsoleOpts) => {
    start: () => void;
    stop: () => void;
};

/**
 * Checks if the environment is a development environment.
 * @returns {boolean} True if the environment is a development environment.
 */
declare const isDev: () => boolean;
/**
 * Suppresses deprecation warnings in the process.
 *
 * This function sets the `process.noDeprecation` property to `true`,
 *
 * Note: This is not recommended for production environments, as it might
 * hide useful deprecation warnings that should be addressed.
 */
declare const rmDeprecationAlerts: () => void;
/**
 * Show/hide deprecation warnings in the process.
 *
 * This function sets the `process.noDeprecation` property to `true` | `false`
 * Note: This is not recommended for production environments, as it might
 * hide useful deprecation warnings that should be addressed.
 * @returns {object} An object with `show` and `hide` methods.
 * @example
 * const { show, hide } = deprecatedAlerts()
 * hide()
 * // my code
 * show()
 */
declare const deprecatedAlerts: () => {
    show: () => void;
    hide: () => void;
};
/**
 * Registers an event listener that will be called when the Node.js process exits.
 * @param {NodeJS.ExitListener} cb - The callback to be called when the process exits.
 */
declare const onExit: (cb: NodeJS.ExitListener) => void;
/**
 * Registers an event listener that will be called when the user sends an
 * interrupt signal (e.g., pressing Ctrl+C in the terminal).
 * @param {NodeJS.ExitListener} cb - The callback to be called when the user
 * sends an interrupt signal.
 */
declare const onCancel: (cb: NodeJS.ExitListener) => void;
/**
 * Terminates the Node.js process with exit code 130.
 *
 * This function is typically used to gracefully handle process termination,
 * such as when the user sends an interrupt signal (e.g., pressing Ctrl+C in the terminal).
 */
declare const cancel: () => never;

declare const getLocalPkgPath: (packageName: string) => string | undefined;
declare class RunLocalNodeBinError extends Error {
}
declare const getLocalNodeBinPath: ({ name, opts, }: {
    name: string;
    opts?: Parameters<typeof npmRunPathEnv>[0];
}) => Promise<string | undefined>;
/**
 * Runs a local Node binary in the current project.
 *
 * It uses the `PATH` and `npm-run-path` to locate the binary in the project's `node_modules/.bin`.
 * @param   {object}  options - Options object.
 * @param   {string}  options.name - Name of the bin to run.
 * @param   {string[]} options.args - Args to pass to the bin.
 * @param   {object}  [options.opts] - Options object.
 * @returns {Promise<number>} - Resolves with the exit code of the bin.
 * @throws  {Error} - If the bin exits with a non-zero code.
 */
declare const runLocalNodeBin: ({ name, args, opts, }: {
    name: string;
    args?: string[];
    opts?: Parameters<typeof npmRunPathEnv>[0];
}) => Promise<number>;
/**
 * Executes a command in the shell and waits for it to finish.
 * @param {string} cmd - The command to execute.
 * @returns {Promise<void>} - A promise that resolves when the command finishes successfully.
 * @throws {Error} - Throws an error if the command fails.
 */
declare const exec: (cmd: string) => Promise<void>;
/**
 * Executes a command in a child process and captures its output.
 * @param {string} cmd - The command to execute.
 * @returns {Promise<{ stdout: string; stderr: string }>} - A promise that resolves with the output of the command.
 * @throws {Error} - Throws an error if the command fails, along with its stdout and stderr.
 */
declare const execChild: (cmd: string) => Promise<{
    stdout: string;
    stderr: string;
}>;
type Log = {
    debug: (data: unknown) => void;
    info: (data: unknown) => void;
    success: (data: unknown) => void;
    warn: (data: unknown) => void;
    error: (data: unknown) => void;
    box: (data: string) => void;
};
type ExecProcessParams = {
    name: string;
    on: (context: {
        log: Log;
    }) => Promise<void>;
    onError?: (context: {
        log: Log;
        error: unknown;
    }) => Promise<void>;
    onExit?: (context: {
        log: Log;
    }) => Promise<void>;
    onSuccess?: (context: {
        log: Log;
    }) => Promise<void>;
};
/**
 * Executes a process with logging and error handling.
 * @param   {object}        options             - Options for the process execution.
 * @param   {string}        options.name        - The name of the process, used in logs.
 * @param   {Function}      options.on          - The main function to execute the process. Receives an object with the `log` utility.
 * @param   {Function}      [options.onError]   - On success function.
 * @param   {Function}      [options.onSuccess] - Optional exit handling function for graceful exits. Receives an object with `log`.
 * @param   {Function}      [options.onExit]    - Optional exit handling function for graceful exits. Receives an object with `log`.
 * @returns {Promise<void>}                     - Resolves when the process execution completes.
 * @example
 * const onProcess = async ({ log }) => {
 *     log.info('Starting the process...');
 *     // Your process logic here
 *     log.success('Process completed successfully.');
 * };
 *
 * const onError = async ({ log, error }) => {
 *     log.error('An error occurred:', error);
 * };
 *
 * execProcess({
 *     name: 'MyProcess',
 *     on: onProcess,
 *     onError,
 * });
 */
declare const execProcess: (options: ExecProcessParams) => Promise<void>;
/**
 * Executes a command and captures its output.
 * @param {string} command - The command to execute, including any arguments.
 * @returns {Promise<string>} A promise that resolves with the captured output (stdout).
 * @throws Will reject with an error if the command fails.
 * @example
 * const [error, output] = await catchExecOutput('dovenv --help')
 * if (error) {
 *   console.error(error);
 * } else {
 *   await writeFile('dovenvHelp.txt', output)
 * }
 */
declare const catchExecOutput: <Res = string>(command: string) => Promise<[Error] | [undefined, Res]>;
/**
 * Execute a module from a given path.
 * @param {object} params - Parameters for module execution.
 * @param {string} params.module - The module to execute.
 * @param {string[]} [params.args] - The arguments to pass to the module.
 * @returns {Promise<void>} A promise that resolves when the module has finished executing.
 * @throws Will reject with an error if the module fails to execute.
 * @example
 *
 * // Execute the `bin/index.mjs` file in the `@dovenv/utils` module
 * await execModulePath({
 *   module: {
 * 	  id: 'dovenv',
 * 	  path: ['dist','cli.mjs'],
 *   },
 *   args: ['--help']
 * })
 */
declare const execModulePath: ({ module, args, }: {
    module: Parameters<typeof getModulePath>[0];
    args?: string[];
}) => Promise<void>;
/**
 * Execute a module from a given path and capture its output.
 * @param {object} params - Parameters for module execution.
 * @param {string} params.module - The module to execute.
 * @param {string[]} [params.args] - The arguments to pass to the module.
 * @returns {Promise<{ stdout: string; stderr: string }>} A promise that resolves with the captured output.
 * @throws Will reject with an error if the module fails to execute.
 * @example
 *
 * // Execute the `bin/index.mjs` file in the `dovenv` module and capture its output
 * const { stdout, stderr } = await execModulePathWithOutput({
 *   module: {
 * 	  id: 'dovenv',
 * 	  path: ['dist','cli.mjs'],
 *   },
 *   args: ['--help']
 * })
 * console.log('Output:', stdout)
 */
declare const execModulePathWithOutput: ({ module, args, }: {
    module: Parameters<typeof getModulePath>[0];
    args?: string[];
}) => Promise<{
    stdout: string;
    stderr: string;
}>;
declare const existsLocalBin: (binName: string) => Promise<boolean>;
declare const existsLocalBins: <Bin extends string>(binaries: Bin[]) => Promise<{ [key in Bin]: boolean; }>;

/**
 * Checks if a flag exists and the value matches one of the given values.
 * @param {string} v - The key of the flag to check.
 * @param {Record<string, string>} values - An object with values to check against the value of the flag.
 * @returns {string | undefined} The value of the flag if it exists and matches one of the given values, or undefined.
 */
declare const getChoiceFlagValue: <VALUES>(v: string, values: Record<string, VALUES>) => VALUES | undefined;
/**
 * Gets the value of a flag passed to the process.
 * @param {string} key - The key of the flag to get the value of.
 * @returns {string | undefined} The value of the flag if it exists, or undefined.
 */
declare const getStringFlagValue: (key: string) => string | undefined;
/**
 * Gets the values of a flag passed to the process.
 * @param {string} key - The key of the flag to get the values of.
 * @returns {string[] | undefined} The values of the flag if it exists, or undefined.
 * The values are returned as an array. If the flag appears multiple times, their values are concatenated.
 * The flag can appear in two formats:
 * - `--key=value1,value2,...` - The values are separated by commas.
 * - `--key value1 value2 ...` - The values follow the flag in separate arguments.
 */
declare const getArrayFlagValue: (key: string) => string[] | undefined;
/**
 * Checks if a boolean flag exists in the process arguments.
 * @param {string} v - The boolean flag to check for existence.
 * @returns {boolean} True if the flag exists, false otherwise.
 */
declare const getBooleanFlagValue: (v: string) => boolean;
/**
 * Checks if a specific command exists in the process arguments.
 * @param {string} v - The command to check for existence.
 * @returns {boolean} True if the command exists in the process arguments; otherwise, false.
 */
declare const getCmd: (v: string) => boolean;
/**
 * Checks if there are additional command-line options provided.
 * @returns {boolean} True if there are more than two arguments in the process.argv array, indicating the presence of options; otherwise, false.
 */
declare const existsOptions: () => boolean;

/**
 * Hides the first two arguments from the process.argv array.
 * @returns {string[]} Array of arguments without the first two elements.
 * @example
 * import { hideBin } from '@dovenv/utils'
 * const args = hideBin( process.argv ) // removes the uneeded arguments
 * console.log( args )
 */
declare const hideBin: typeof hideBin$1;
/**
 * Create a cli interface.
 * @param   {{argv: string[], fn: (cli: Argv) => Promise<Argv>}} options - Options object with argv and a function to setup the cli.
 * @returns {Promise<Argv>}                                                  - Resolves with the cli interface.
 * @example
 * import { createCli, hideBin } from '@dovenv/utils'
 * const args = hideBin( process.argv ) // removes the uneeded arguments
 * const cli = await createCli({
 *   args : args,
 *   fn   : async cli => {
 *
 *     cli.command( 'build', 'Run the build process', async () => {
 *       // ...
 *     } ).command( 'dev', 'Run the dev server', async () => {
 *       // ...
 *     } ).command( 'preview', 'Run the preview server', async () => {
 *       // ...
 *     } ).demandCommand( 1, 'You need to specify a command (build, dev, or preview)' )
 *
 *     return cli
 *
 *   },
 * } )
 */
declare const createCli: ({ args, fn, }: {
    args: string[];
    fn: <Cli extends Argv>(cli: Cli) => Promise<Cli>;
}) => Promise<Argv<{}>>;

type AnimateProps = {
    frames: string[];
    interval?: number;
    clear?: boolean;
};

/**
 * Creates an animation function that can be started and stopped.
 * @param {object} [options] - Options for the animation.
 * @param {string[]} [options.frames] - Frames of the animation.
 * @param {number} [options.interval] - Interval in milliseconds between frames.
 * @param {boolean} [options.clear] - Whether to clear the screen after stopping the animation.
 * @returns {object} - Object containing `start` and `stop` functions.
 */
declare const animate: ({ frames, interval, clear, }: AnimateProps) => {
    start: () => void;
    stop: () => void;
};

/**
 * Prompt for number type.
 * @param   {NumberParams}             opts - NumberOptions.
 * @returns {Promise<string | symbol>}      - Promise resolving the answer.
 * @example
 * const age = await number({
 *   message: 'What is your age?',
 *   errorText: 'failed',
 * });
 * console.log(age)
 */
declare function number(opts: NumberParams): Promise<string | symbol>;

type PromptParams = Parameters<typeof Enquirer.prompt>[0];

declare const promptLineMethods: {
    readonly message: "message";
    readonly info: "info";
    readonly success: "success";
    readonly step: "step";
    readonly warn: "warn";
    readonly warning: "warning";
    readonly error: "error";
};
type PromptLineMethod = typeof promptLineMethods[keyof typeof promptLineMethods];
/**
 * NUMBER.
 *
 */
type NumberParams = p.TextOptions & {
    placeholder?: number;
    defaultValue?: number;
    errorText?: string;
};
/**
 * Parameters of the `table` function from the `@dovenv/utils` module.
 *
 * [See module](https://clippo.pigeonposse.com/guide/utils/style#table).
 */
type TableParams = Parameters<typeof table>;
/**
 * Parameters of the `columns` function from the `@dovenv/utils` module.
 *
 * [See module](https://clippo.pigeonposse.com/guide/utils/styles#columns).
 */
type ColumnsParams = Parameters<typeof columns>;
/**
 * Parameters of the `box` function from the `@dovenv/utils` module.
 *
 * [See module](https://clippo.pigeonposse.com/guide/utils/styles#box).
 */
type BoxParams = Parameters<typeof box>;
/**
 * Props for canceling a prompt line, including functions from various modules.
 */
type PromptLineCancelProps = typeof p & {
    number: typeof number;
    table: (opts: {
        value: TableParams[0];
        opts?: TableParams[1];
        type?: PromptLineMethod;
    }) => void;
    box: (opts: {
        value: BoxParams[0];
        opts?: BoxParams[1];
        type?: PromptLineMethod;
    }) => void;
    columns: (opts: {
        value: ColumnsParams[0];
        opts?: ColumnsParams[1];
        type?: PromptLineMethod;
    }) => void;
};
/**
 * Props for executing a prompt line, extending `PromptLineCancelProps` with typePrompt.
 */
type PromptLineExecProps = PromptLineCancelProps & {
    typePrompt: <T>(props: PromptParams) => Promise<T>;
};
/**
 * Parameters for configuring a prompt line.
 */
type PromptLineParams<T> = {
    intro?: string;
    outro?: string;
    list: (prompt: PromptLineExecProps) => p.PromptGroup<T> | Promise<p.PromptGroup<T>>;
    onCancel?: (prompt: PromptLineCancelProps) => Promise<void>;
};

declare const promptLineCore: typeof p;
declare const promptLineEnquirer: (props: PromptParams, onCancel?: () => void) => Promise<unknown>;
declare const promptLine: {
    columns: (opts: {
        value: ColumnsParams[0];
        opts?: ColumnsParams[1];
        type?: PromptLineMethod;
    }) => void;
    table: (opts: {
        value: TableParams[0];
        opts?: TableParams[1];
        type?: PromptLineMethod;
    }) => void;
    box: (opts: {
        value: BoxParams[0];
        opts?: BoxParams[1];
        type?: PromptLineMethod;
    }) => void;
    number: typeof number;
    isCancel: typeof p.isCancel;
    updateSettings: typeof p.updateSettings;
    cancel: (message?: string) => void;
    confirm: (opts: p.ConfirmOptions) => Promise<boolean | symbol>;
    group: <T>(prompts: p.PromptGroup<T>, opts?: p.PromptGroupOptions<T> | undefined) => Promise<{ [P in keyof p.PromptGroupAwaitedReturn<T>]: p.PromptGroupAwaitedReturn<T>[P]; }>;
    groupMultiselect: <Value>(opts: p.GroupMultiSelectOptions<Value>) => Promise<symbol | Value[]>;
    intro: (title?: string) => void;
    log: {
        message: (message?: string, { symbol }?: p.LogMessageOptions) => void;
        info: (message: string) => void;
        success: (message: string) => void;
        step: (message: string) => void;
        warn: (message: string) => void;
        warning: (message: string) => void;
        error: (message: string) => void;
    };
    multiselect: <Value>(opts: p.MultiSelectOptions<Value>) => Promise<symbol | Value[]>;
    note: (message?: string, title?: string) => void;
    outro: (message?: string) => void;
    password: (opts: p.PasswordOptions) => Promise<string | symbol>;
    select: <Value>(opts: p.SelectOptions<Value>) => Promise<symbol | Value>;
    selectKey: <Value extends string>(opts: p.SelectOptions<Value>) => Promise<symbol | Value>;
    spinner: ({ indicator }?: p.SpinnerOptions) => {
        start: (msg?: string) => void;
        stop: (msg?: string, code?: number) => void;
        message: (msg?: string) => void;
    };
    stream: {
        message: (iterable: Iterable<string> | AsyncIterable<string>, { symbol }?: p.LogMessageOptions) => Promise<void>;
        info: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
        success: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
        step: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
        warn: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
        warning: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
        error: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
    };
    tasks: (tasks: p.Task[]) => Promise<void>;
    text: (opts: p.TextOptions) => Promise<string | symbol>;
};
/**
 *
 * Define a group of prompts to be displayed and return a results of objects within the group.
 * @param   {PromptLineParams} params - PromptLine options .
 * @returns {Promise<*>}              - Object with answers.
 * @example
 * import { promptLineGroup } from "@dovenv/utils"
 *
 * const answers = await promptLineGroup({
 *     intro: 'Dovenv init',
 *     outro: 'Succesfully finished 🌈',
 *     onCancel: p => {
 *         p.cancel('canceled 💔')
 *         process.exit(0)
 *     },
 *     list: async p => ({
 *        name: () => p.text({
 *            message: 'What is your organization?',
 *            placeholder: 'PigeonPosse',
 *            defaultValue: 'PigeonPosse',
 *        }),
 *        age: () => p.number({
 *            message: 'What is your age?',
 *        }),
 *     })
 * })
 *
 * console.log(answers.name, answers.age)
 */
declare function promptLineGroup<T>(params: PromptLineParams<T>): Promise<{ [P in keyof p.PromptGroupAwaitedReturn<T>]: p.PromptGroupAwaitedReturn<T>[P]; }>;

/**
 * Ask questions to user with prompt function.
 * @param   {PromptParams} props - PromptOptions.
 * @returns {Promise<*>}         - Promise resolving to answers.
 * @example
 *
 * const answers = await promptGroup([
 *   {
 *     type: 'toggle',
 *     name: 'ready',
 *     message: 'Are you ready?',
 *     enabled: 'Yep',
 *     disabled: 'Nope',
 *   },
 *   {
 *     type: 'number',
 *     name: 'age',
 *     message: 'What is your age',
 *   },
 * ]);
 * console.log(answers.ready, answers.age)
 * @see https://www.npmjs.com/package/enquirer
 */
declare function promptGroup(props: PromptParams): Promise<object>;

declare const logger: consola.ConsolaInstance;
declare const spinner: typeof ora;

/**
 * Creates a performance tracker to measure elapsed time.
 * @returns {object} An object containing methods to stop and retrieve the elapsed time.
 * @property {Function} stop - Returns the elapsed time in seconds as a fixed-point number.
 * @property {Function} prettyStop - Returns the elapsed time formatted as a human-readable string.
 */
declare const performance: () => {
    /**
     * Calculates and returns the elapsed time in seconds.
     * @returns {number} Elapsed time in seconds as a floating-point number.
     */
    stop: () => number;
    /**
     * Formats and returns the elapsed time as a human-readable string.
     * @returns {string} Elapsed time formatted in milliseconds, seconds, or minutes.
     */
    prettyStop: () => string;
};
/**
 * Waits for the given number of milliseconds before resolving.
 * @param {number} ms - The number of milliseconds to wait.
 * @returns {Promise<void>} - A promise that resolves when the delay has finished.
 * @example
 * await delay( 1000 ); // waits 1 second
 */
declare const delay: (ms: number) => Promise<unknown>;
/**
 * Gets the current date and time as an object containing separate fields for year, month, day, hours, minutes, and seconds.
 * @returns {{ year: string; month: string; day: string; hours: string; minutes: string; seconds: string }} - An object representing the current date and time.
 */
declare const getCurrentDateTime: () => {
    year: string;
    month: string;
    day: string;
    hours: string;
    minutes: string;
    seconds: string;
};
/**
 * Gets the current date and time in ISO 8601 format as a string.
 * @returns {string} - The current date and time as an ISO 8601 string.
 */
declare const getCurrentDateTimeString: () => string;

/**
 * Downloads a directory from GitHub.
 * @param {string} args - An object containing the URL of the GitHub repo directory and the path to the output directory.
 * @param {string} args.input - The URL of the GitHub repo directory.
 * @param {string} args.output - The path to the output directory.
 * @param {string} [args.token] - The GitHub token for authentication.
 * @returns {Promise<void>}
 * @example
 *
 * await downloadGitHubPath({
 * 	input  : 'https://github.com/pigeonposse/backan/tree/main/docs',
 * 	output : './docs',
 * })
 */
declare const downloadGitHubPath: (args: {
    input: string;
    output: string;
    token?: string;
}) => Promise<void>;

/**
 * Checks if the user is authenticated to GitHub using the GitHub CLI.
 * @returns {boolean} True if the user is authenticated, false otherwise.
 */
declare const isGitHubAuthenticated: () => boolean;
/**
 * Downloads a GitHub release asset using the GitHub CLI and optionally renames the final file.
 * @param {object} options               - The options object.
 * @param {string} options.user          - The GitHub username.
 * @param {string} options.repo          - The GitHub project/repository name.
 * @param {string} options.outputPath    - The directory where the file should be saved.
 * @param {string} options.filename      - The name of the file to download.
 * @param {string} [options.version]     - The release version or 'latest' for the latest release.
 * @param {string} [options.newFilename] - The new name for the file after download (if applicable).
 */
declare const downloadGitHubRelease: ({ user, repo, outputPath, filename, newFilename, version, }: {
    user: string;
    repo: string;
    outputPath: string;
    filename: string;
    version?: string;
    newFilename?: string;
}) => Promise<void>;

type ParamFn = (arg: string) => Promise<string>;
type ParamsValue = string | number | Record<string, unknown> | unknown[] | unknown;
type Params = Record<string, ParamsValue>;
type Props = {
    /** Content to be replaced */
    content: string;
    /**
     * Parameters
     * @example
     * const params = {
     *     name: 'Antonio',
     *     lastName : 'Resines'
     * }
     */
    params: Params;
    /**
     * Transform parameters insde placeholders.
     * @example
     * const transform = async ( param: string ) => {
     *     if ( param === 'url' ) return 'https://pigeonposse.com',
     *     else if ( param === 'http://pigeonposse.com' ) return 'https://pigeonposse.com'
     *     return param
     * }
     */
    transform?: ParamFn;
    /** Options */
    opts?: {
        /**
         * Throw an error if a placeholder is not found.
         * @default false
         */
        throw?: boolean;
        /**
         * Throw an error if a parameter is not found.
         * @default
         * {
         *   prefix : '{{',
         *   suffix : '}}',
         * }
         */
        mark?: {
            prefix: string;
            suffix: string;
        };
    };
};
/**
 * Replace placeholders in a string with their corresponding values.
 *
 * The function takes a string with placeholders, an object with parameter values,
 * and an optional custom parameter function.
 *
 * The function returns a Promise that resolves to the string with all placeholders
 * replaced.
 * @param {Props} props - Props for the function.
 * @param {Props['content']} props.content - The string with placeholders.
 * @param {Props['params']} props.params - An object with parameter values.
 * @param {Props['transform']} [props.transform] - An optional custom parameter function.
 * @param {Props['opts']} [props.opts] - Options to customize the behavior of the function.
 * @returns {Promise<string>} - A Promise that resolves to the string with all placeholders replaced.
 */
declare const replacePlaceholders: (props: Props) => Promise<string>;

/**
 * Gets the total number of characters and words in a given string.
 * @param {string} text - The string to analyze.
 * @returns {{ chars: number, words: number }} - An object containing the total number of characters and words.
 * @example
 * const result = getCharsAndWords("Hello world!");
 * console.log(result.chars); // 12
 * console.log(result.words); // 2
 */
declare const getCharsAndWords: (text: string) => {
    chars: number;
    words: number;
};

/**
 * Indents a given string by prefixing each line with a given prefix
 * (default is two spaces).
 * @param {string} v - The string to indent.
 * @param {string} [prefix] - The prefix to prepend to each line (default is two spaces).
 * @returns {string} - The indented string.
 */
declare const indent: (v: string, prefix?: string) => string;
/**
 * Capitalizes the first letter of a word.
 * @param {string} s - The word to capitalize.
 * @returns {string} - The capitalized word.
 */
declare const capitalize: (s: string) => string;
declare const getMatch: typeof matcher;
declare const getStringType: (value: string) => "text" | "url" | "path";
/**
 * Joins the given URL parts into a single string.
 * @param {string[]} parts - The URL parts to join.
 * @returns {string} - The joined URL string.
 */
declare const joinUrl: (...parts: string[]) => string;
/**
 * Converts an object to a JSON string.
 * @param {unknown} data - The data to convert to a string.
 * @returns {string} - The JSON string representation of the data.
 */
declare const object2string: (data: unknown) => string;

type CommonObj = Record<string, unknown> | Record<string, unknown>[] | unknown[];

type CommonCSV = CommonObj;
declare const getObjectFromCSVFile: <Res extends CommonCSV = CommonCSV>(path: string) => Promise<Res>;
declare const getObjectFromCSVContent: <Res extends CommonCSV = CommonCSV>(content: string, options?: Options$4) => Promise<Res>;
declare const csv: {
    deserialize: <Res extends CommonCSV = CommonObj>(content: string, options?: Options$4) => Promise<Res>;
    serialize: <I extends CommonCSV>(obj: I, options?: Options$5) => Promise<string>;
};

declare const getObjectFromINIFile: <Res extends CommonObj = CommonObj>(path: string) => Promise<Res>;
declare const getObjectFromINIContent: <Res extends CommonObj = CommonObj>(content: string) => Promise<Res>;
declare const ini: {
    deserialize: <Res extends CommonObj = CommonObj>(content: string) => Promise<Res>;
    serialize: <I extends CommonObj>(obj: I) => Promise<string>;
};

/**
 * Get object from a JavaScript file.
 * @param   {string}                     path - Path to the JavaScript file.
 * @param   {string}                     part - The part of the module to import. Defaults to 'default'.
 * @returns {Promise<object | object[]>}      - The imported object.
 * @throws {Error} If there is an error importing the module.
 * @example import { getObjectFromJSFile } from "@dovenv/utils"
 *
 * const content = await getObjectFromJSFile('/my/file.js')
 * const part = await getObjectFromJSFile('/my/fs.js', 'path')
 * console.log(content, part)
 */
declare const getObjectFromJSFile: <Res extends CommonObj = CommonObj>(path: string, part?: string) => Promise<Res>;
declare const getObjectFromJSContent: <Res extends CommonObj = CommonObj>(content: string, part?: string) => Promise<Res>;

/**
 * Get object from a JSON file.
 * @param   {string}                     path - Path to the JSON file.
 * @returns {Promise<object | object[]>}      - The parsed JSON object.
 * @throws {Error} If there is an error reading the JSON file.
 * @example import { getObjectFromJSONFile } from "@dovenv/utils"
 *
 * const object = await getObjectFromJSONFile('/my/file.json')
 * console.log( object )
 */
declare const getObjectFromJSONFile: <Res extends CommonObj = CommonObj>(path: string) => Promise<Res>;
declare const getObjectFromJSONContent: <Res extends CommonObj = CommonObj>(content: string) => Promise<Res>;
declare const json: {
    deserialize: <Res extends CommonObj = CommonObj>(content: string) => Promise<Res>;
    serialize: (content: object) => string;
    parser: <Res extends CommonObj = CommonObj>(content: string) => Promise<Res>;
    stringify: (content: object) => string;
};

declare const svg: {
    deserialize: typeof parse;
    serialize: typeof stringify;
};

/**
 * Get object from a TOML file.
 * @param   {string}                     path - Path to the JSON file.
 * @returns {Promise<object | object[]>}      - The parsed JSON object.
 * @throws {Error} If there is an error reading the JSON file.
 * @example import { getObjectFromTOMLFile } from "@dovenv/utils"
 *
 * const objectFromTOML = await getObjectFromTOMLFile('/my/file.toml')
 * console.log(objectFromTOML)
 */
declare const getObjectFromTOMLFile: <Res extends CommonObj = CommonObj>(path: string) => Promise<Res>;
declare const getObjectFromTOMLContent: <Res extends CommonObj = CommonObj>(content: string) => Promise<Res>;
declare const toml: {
    deserialize: <Res extends CommonObj = CommonObj>(content: string) => Promise<Res>;
    serialize: (content: object) => string;
};

/**
 * Fetches and parses an XML file into a JavaScript object.
 * @template Res - The expected return type of the parsed object.
 * @param {string} path - The file path of the XML file to be read and parsed.
 * @returns {Promise<Res>} - A promise that resolves to the parsed XML as an object.
 * @throws {Error} If there is an error reading or parsing the XML file.
 */
declare const getObjectFromXMLFile: <Res extends CommonObj = CommonObj>(path: string) => Promise<Res>;
/**
 * Parses an XML content string into a JavaScript object.
 * @template Res - The expected return type of the parsed object.
 * @param {string} content - The XML content string to be parsed.
 * @returns {Promise<Res>} - A promise that resolves to the parsed XML as an object.
 * @throws {Error} If there is an error parsing the XML content.
 */
declare const getObjectFromXMLContent: <Res extends CommonObj = CommonObj>(content: string) => Promise<Res>;
declare const xml: {
    deserialize: <Res extends CommonObj = CommonObj>(content: string) => Promise<Res>;
    serialize: <I extends CommonObj = CommonObj>(obj: I) => Promise<any>;
};

/**
 * Get object from a YAML file.
 * @param   {string}                     path - Path to the JSON file.
 * @returns {Promise<object | object[]>}      - The parsed JSON object.
 * @throws {Error} If there is an error reading the JSON file.
 * @example import { getObjectFromYAMLFile } from "@dovenv/utils"
 *
 * const object = await getObjectFromYAMLFile('/my/file.yaml')
 * console.log( object )
 */
declare const getObjectFromYAMLFile: <Res extends CommonObj = CommonObj>(path: string) => Promise<Res>;
declare const getObjectFromYAMLContent: <Res extends CommonObj = CommonObj>(content: string) => Promise<Res>;
declare const yaml: {
    deserialize: <Res extends CommonObj = CommonObj>(content: string) => Promise<Res>;
    serialize: (content: object) => string;
};

/**
 * Creates a function to merge multiple configuration objects into a single configuration.
 * @template Config - The type of the configuration objects.
 * @param {object} [opts] - Optional merge options for `deepmergeCustom`.
 * @returns {Function} A function that accepts multiple configuration objects or arrays of configuration objects
 * and returns a single merged configuration object.
 * @example
 * const mergeConfig = createMergeDataFn<{ foo: string; bar: string }>()
 * const config1 = { foo: 'bar' }
 * const config2 = { bar: 'foo' }
 * const merged = mergeConfig( config1, config2 )
 * // or
 * const merged = mergeConfig( [ config1, config2 ] )
 * console.log( merged )
 */
declare const createMergeDataFn: <Config>(opts?: Parameters<typeof deepmergeCustom<Config>>[0]) => (...config: (Config | Config[])[]) => Config;

/**
 * Retrieve an object from a file specified by path.
 * Supports JSON, YAML, TOML, JS, INI, CSV, or XML formats.
 * @param   {string}          path - Path to the file.
 * @returns {Promise<object>}      - The object retrieved from the file.
 * @throws {Error} If the file does not exist, or if the data is not an object.
 * @example import { getObjectFromFile } from "@dovenv/utils"
 *
 * const objectFromJSON = await getObjectFromFile('/my/file.json')
 * const objectFromYAML = await getObjectFromFile('/my/file.yaml')
 * const objectFromTOML = await getObjectFromFile('/my/file.toml')
 * const objectFromINI = await getObjectFromFile('/my/file.ini')
 * console.log(
 *   objectFromJSON,
 *   objectFromYAML,
 *   objectFromTOML,
 *   objectFromINI
 * )
 */
declare const getObjectFromFile: <Res extends CommonObj = CommonObj>(path: string) => Promise<Res>;
/**
 * Retrieve an object from a file without checking if is correct file extension.
 * Supports JSON, YAML, TOML, JS, INI, CSV, or XML formats.
 * @param   {string}          path - Path to the file.
 * @returns {Promise<object>}      - The object retrieved from the file.
 * @throws {Error} If there is an error reading the file or if the data is not an object.
 * @example import { getObjectFromNonCheckFile } from "@dovenv/utils"
 *
 * const objectFromFile = await getObjectFromNonCheckFile('/my/file') // without extension
 * console.log(objectFromFile)
 */
declare const getObjectFromNonCheckFile: <Res extends CommonObj = CommonObj>(path: string) => Promise<Res>;
/**
 * Retrieve an object from a file specified by path and filename.
 * Supports JSON, YAML, TOML, JS, INI, CSV, or XML formats.
 * @param   {string}                       path     - Path to the directory containing the file.
 * @param   {string}                       filename - Name of the file (without extension).
 * @returns { Promise<object | undefined>}          - The object retrieved from the file.
 * @throws {Error} If the file does not exist, or if the data is not an object.
 * @example import { getObjectFromPath } from "@dovenv/utils"
 *
 * const content = await getObjectFromPath('/my/directory', 'my-file-name')
 * console.log( content )
 */
declare const getObjectFromPath: <Res extends CommonObj = CommonObj>(path: string, filename: string) => Promise<Res>;
/**
 * Get object from JSON, YAML, TOML, JS, INI, CSV, or XML string.
 * @param   {string}          data - The string to parse.
 * @returns {object}                   - The parsed object.
 * @throws {Error} If the data is not a valid object.
 * @example import { getObjectFromContent } from "@dovenv/utils"
 *
 * const jsonContent  = '{"name": "super8"}'
 * const yamlContent  = 'name: super8'
 * const tomlContent  = 'name = "super8"'
 * const object1      = await getObjectFromContent( jsonContent )
 * const object2      = await getObjectFromContent( yamlContent )
 * const object3      = await getObjectFromContent( tomlContent )
 *
 * console.log( object1, object2, object3 )
 */
declare const getObjectFromContent: <Res extends CommonObj = CommonObj>(data: string) => Promise<Res>;
/**
 * Retrieve an object from a URL.
 * Supports JSON, YAML, and TOML formats.
 * @param   {string}          url - URL of the resource.
 * @returns {Promise<object>}     - The object retrieved from the URL.
 * @throws {Error} If there is an error fetching data from the URL or parsing the object.
 * @example import { getObjectFromUrl } from "@dovenv/utils"
 *
 * // from YAML url
 * const objectFromYamlUrl = await getObjectFromUrl( 'https://raw.githubusercontent.com/pigeonposse/super8/main/.pigeonposse.yml' )
 * // from JSON url
 * const objectFromJsonUrl = await getObjectFromUrl( 'https://raw.githubusercontent.com/pigeonposse/clippo/main/package.json')
 *
 * console.log( objectFromYamlUrl, objectFromJsonUrl )
 */
declare const getObjectFromUrl: <Res extends CommonObj = CommonObj>(url: string) => Promise<Res>;
/**
 * Retrieve an object from either a file specified by path or a URL.
 * Supports JSON, YAML, and TOML formats.
 * @param   {string}          input - Path to a file or URL of the resource.
 * @returns {Promise<object>}       - The object retrieved from the file or URL.
 * @throws {Error} If there is an error fetching data or parsing the object.
 * @example import { getObjectFrom } from "@dovenv/utils"
 *
 * const objectFromYamlUrl = await getObjectFrom( 'https://raw.githubusercontent.com/pigeonposse/super8/main/.pigeonposse.yml' )
 * const objectFromJSON = await getObjectFrom('/my/file.json')
 *
 * console.log( objectFromYamlUrl, objectFromJSON )
 */
declare const getObjectFrom: <Res extends CommonObj = CommonObj>(input: string) => Promise<Res>;

type MdLink = {
    name: string;
    URL: string;
    imgURL?: string;
};
/**
 * Creates a Markdown link or image from a name and URL.
 * @param {string} name - The name of the link.
 * @param {string} URL - The URL of the link.
 * @param {string} [imgURL] - The URL of an image of the link. If 'img', the function will return an image link.
 * @returns {string} - The constructed Markdown link or image.
 */
declare const createMdLink: ({ name, URL, imgURL, }: MdLink) => string;
/**
 * Constructs Markdown links or images from an array of links.
 * @param {Array<MdLink>} links - The links to construct.
 * @returns {string} - The constructed Markdown string.
 */
declare const createMdLinks: (links: Array<MdLink>) => string;
/**
 * Cheate shields.io SVGs.
 * @see https://www.npmjs.com/package/badge-maker
 */
declare const createBadgeSVG: typeof makeBadge;
type BadgeURL = {
    path: string;
    color?: string;
    style?: Format['style'];
    host?: string;
    label?: string;
    labelColor?: string;
    logo?: string;
    logoColor?: string;
    logoSize?: string;
};
/**
 * Create shields.io URL
 * @see https://shields.io/badges/
 * @example
 * const badgeURL = createBadgeURL({path: 'badge/any_text-you_like-blue'})
 */
declare const createBadgeURL: (params: BadgeURL) => string;

type MarkdownObject = Root;
declare const deserialize: (str: string) => MarkdownObject;
declare const serialize: (obj: MarkdownObject) => string;

declare const parser_deserialize: typeof deserialize;
declare const parser_serialize: typeof serialize;
declare namespace parser {
  export { parser_deserialize as deserialize, parser_serialize as serialize };
}

/**
 * Retrieves the Markdown content from a given path or URL or string.
 *
 * - If the input is a path, reads the file content.
 * - If the input is a URL, fetches the content.
 * - If the input is a string, returns it directly.
 * ---
 * @param {string} path - The path or URL to retrieve the Markdown content from.
 * @returns {Promise<string>} - A promise that resolves to the Markdown content as a string.
 */
declare const getMD: (path: string) => Promise<string>;
/**
 * Retrieves the HTML content from a given path or URL or string.
 *
 * - If the input is a path, reads the file content.
 * - If the input is a URL, fetches the content.
 * - If the input is a string, returns it directly.
 * ---
 * @param {string} path - The path or URL to retrieve the HTML content from.
 * @returns {Promise<string>} - A promise that resolves to the HTML content as a string.
 */
declare const getHTML: (path: string) => Promise<string>;
/**
 * Converts Markdown input to HTML.
 *
 * - If the input is a path, reads the file and converts its content.
 * - If the input is a URL, fetches the content and converts it.
 * - if the input is a string, converts it directly.
 * ---
 * @param {string} input - The Markdown input to convert.
 * @returns {string} - The converted HTML string.
 */
declare const md2html: (input: string) => Promise<string>;
type Md2TerminalOpts = {
    /**
     * Optional Used to override default styling.
     * @see https://github.com/mikaelbr/marked-terminal?tab=readme-ov-file#options
     */
    renderer?: Parameters<typeof markedTerminal>[0];
    /**
     * Options passed into cli-highlight. See readme there to see what options to pass.
     * @see https://github.com/felixfbecker/cli-highlight
     */
    highlight?: Parameters<typeof markedTerminal>[1];
};
/**
 * Converts a Markdown input to a terminal formatted string.
 *
 * - If the input is a path, reads the file and converts its content.
 * - If the input is a URL, fetches the content and converts it.
 * - if the input is a string, converts it directly.
 * ---
 * @param {string} input - The Markdown string, path or URL to convert.
 * @param {Md2TerminalOpts} opts - Options
 * @returns {Promise<string>} - The converted string.
 */
declare const md2terminal: (input: string, opts?: Md2TerminalOpts) => Promise<string>;
/**
 * Converts HTML to Markdown.
 *
 * - If the input is a path, reads the file and converts its content.
 * - If the input is a URL, fetches the content and converts it.
 * - if the input is a string, converts it directly.
 * ---
 * @param {string} input - The HTML input to convert.
 * @returns {Promise<string>} - The converted Markdown as a string.
 */
declare const html2md: (input: string) => Promise<string>;
/**
 * Converts HTML to a formatted string suitable for the terminal.
 *
 * - If the input is a path, reads the file and converts its content.
 * - If the input is a URL, fetches the content and converts it.
 * - if the input is a string, converts it directly.
 * ---
 * @param {string} input - The HTML input to convert.
 * @returns {Promise<string>} - The formatted string.
 */
declare const html2terminal: (input: string) => Promise<string>;
declare const incrementMdHeaders: (content: string) => string;
/**
 * Parses the given Markdown string and returns an array of objects containing
 * the title, level and anchor for each header found.
 *
 * - If the input is a path, reads the file input.
 * - If the input is a URL, fetches the content.
 * - if the input is a string, gets it directly.
 * ---
 * @param {string} input - The Markdown input to parse.
 * @returns {Promise<object[]>} - An array of objects with the following properties:
 *   - `level`: The header level (1-6).
 *   - `title`: The header title.
 *   - `anchor`: The header anchor.
 */
declare const getMDToc: (input: string) => Promise<{
    level: number;
    title: string;
    anchor: string;
}[]>;
type MdTocStringOpts = {
    /**
     * The Markdown content to be used for generating the Table of Contents.
     * This can be a string of Markdown content, a file, or a URL.
     * @example
     * const markdown = '# Header 1\n## Header 2\n';
     */
    input: string;
    /**
     * The title for the Table of Contents. If not provided, the default value is 'Table of Contents'.
     * @default undefined
     */
    title?: string;
    /**
     * If set to `true`, headers of level 1 (`#`) will be removed from the Table of Contents.
     * @default false
     */
    removeH1?: boolean;
    /**
     * The maximum heading level to include in the Table of Contents.
     * If not provided, the TOC will include all heading levels.
     * @default 6
     */
    maxHeadingLevel?: number;
};
/**
 * Creates a Markdown index from the given Markdown string.
 *
 * - If the input is a path, reads the file input.
 * - If the input is a URL, fetches the content.
 * - if the input is a string, gets it directly.
 * ---
 * @param {string} opts - Options
 * @param {string} opts.input - The Markdown input to create an index from.
 * @param {string} [opts.title] - The title of the index.
 * @param {boolean} [opts.removeH1] - If set to `true`, headers of level 1 (`#`) will be removed.
 * @param {number} [opts.maxHeadingLevel] - The maximum heading level to include in the Table of Contents.
 * @returns {Promise<string>} - The generated Markdown index as a string.
 */
declare const geMDTocString: (opts: MdTocStringOpts) => Promise<string>;

/**
 * Catches errors from a promise and returns a tuple indicating success or failure.
 * @template T - The type of the resolved value of the promise.
 * @param {Promise<T>} promise - The promise to handle errors for.
 * @returns {Promise<[undefined, T] | [Error]>} A promise that resolves to a tuple.
 *          The tuple contains either `[undefined, T]` if the promise is resolved successfully,
 *          or `[Error]` if an error occurs.
 */
declare const catchError: <T>(promise: Promise<T>) => Promise<[undefined, T] | [Error]>;
/**
 * A generic error class that extends the native `Error` class to include
 * additional contextual data.
 *
 * This class is useful for creating strongly-typed errors in TypeScript, allowing
 * you to provide structured data along with the error message for improved error handling.
 *
 * ---
 * @template M - The type of the error message. Defaults to `string`.
 * @template D - The type of the additional data associated with the error. Defaults to `undefined`.
 * @example
 * // Basic usage with a string message
 *
 * const error = new TypedError('Something went wrong');
 * console.error(error.message); // "Something went wrong"
 * @example
 * // Usage with additional data
 *
 * const error = new TypedError('Validation failed', { field: 'email', reason: 'invalid' });
 * console.error(error.message); // "Validation failed"
 * console.error(error.data); // { field: 'email', reason: 'invalid' }
 * @example
 * // Usage in a try-catch block
 *
 * try {
 *   throw new TypedError('Database connection failed', { host: 'localhost', port: 5432 });
 * } catch (err) {
 *   if (err instanceof TypedError) {
 *     console.error(`Error: ${err.message}`);
 *     console.error('Error Data:', err.data);
 *   }
 * }
 * @example
 * // Custom error class With TypeScript and specific data type
 *
 * const ERRORS = ['unexpected', 'validation', 'database'] as const;
 * class AppError extends TypedError<typeof ERRORS[number], { user: string }> {}
 *
 * const successError = new AppError( 'validation', { user: 'username' } );
 * const failError = new AppError( 'not-exist', { user: 'username' } );  // Must be fail because message not exist
 * const failError2 = new AppError( 'unexpected', { key: 'username' } ); // Must be fail because data not match
 */
declare class TypedError<M extends string = string, D = undefined> extends Error {
    data: D | undefined;
    constructor(message: M, data?: D);
}

type QRcodeOpts = {
    small: boolean;
};

/**
 * Generates a QR code string.
 * @param   {string}          input        - The input string to generate the QR code from.
 * @param   {QRcodeOpts}      [opts]       - Optional options for generating the QR code.
 * @param   {boolean}         [opts.small] - Indicates whether to generate a small QR code. Default is false.
 * @returns {Promise<string>}              - A promise that resolves with the generated QR code string.
 * @example
 * import { qrcode } from "@dovenv/utils"
 * try {
 *   const qrString = await qrcode('https://clippo.pigeonposse.com');
 *   console.log(qrString);
 * } catch (error) {
 *   console.error('Error generating QR code:', error);
 * }
 */
declare const qrcode: (input: string, opts?: QRcodeOpts) => Promise<string>;

type Opts = {
    version: number | string;
};
declare const getPKG: (packageName: string, opts?: Opts) => Promise<_schemastore_package.JSONSchemaForNPMPackageJsonFiles>;
declare const getPKGVersion: (packageName: string) => Promise<string | undefined>;

type MediaInput = URL | string | Buffer;

declare const getMediaInput: (input: MediaInput) => Promise<Buffer>;

/**
 * Extracts a color palette from a PNG image using pngjs.
 * @param {MediaInput} input - The image file path or buffer.
 * @param {number} colorCount - Number of colors to extract.
 * @returns {Promise<string[]>} - Array of HEX color codes.
 */
declare const getMediaPalette: (input: MediaInput, colorCount?: number) => Promise<string[]>;

export { type Any, type AnyArray, type AssertEqual, type BoxOpts, type BoxParams, type ColumnData, type ColumnOpts, type ColumnsParams, type DeepNonNullable, type DeepPartial, type DeepRequired, type ExpectEqual, type Fonts, type FunctionKeys, type GradientColors, type GradientOpts, type HighlightOpts, type MediaInput, type NonFunctionKeys, type NonUndefined, type NumberParams, type ObjectKeys, type ObjectValues, type PackageJSON, type Prettify, type PromptLineCancelProps, type PromptLineMethod, type PromptLineParams, type PromptParams, type QRcodeOpts, type ReturnAwaitedType, RunLocalNodeBinError, type TableData, type TableOpts, type TableParams, type ToObjectValidate, type ToValidate, TypedError, type Validate, type ValidateAnyType, ValidateError, type ValidateErrorType, type ValidateInfer, type ValidateType, Validation, align, animate, arePathsEqual, asciiFont, box, cache, cancel, capitalize, catchError, catchExecOutput, chroma, color, colorConversion, columns, copyDir, copyFile, createBadgeSVG, createBadgeURL, createCli, createDir, createMdLink, createMdLinks, createMergeDataFn, createSymlink, createValidateSchema, createValidateSchemaFn, csv, decompressFile, delay, deprecatedAlerts, deserializeValidation, downloadGitHubPath, downloadGitHubRelease, ensureDir, exec, execChild, execModulePath, execModulePathWithOutput, execProcess, existsDir, existsFile, existsLocalBin, existsLocalBins, existsOptions, existsPath, fetch2string, formatValidationError, geMDTocString, getAbsolutePath, getArch, getArrayFlagValue, getBaseName, getBooleanFlagValue, getCharsAndWords, getCharsAndWordsFrom, getCharsAndWordsFromContent, getCharsAndWordsFromPaths, getCharsAndWordsFromUrl, getChoiceFlagValue, getCmd, getCountFromPaths, getCurrentDateTime, getCurrentDateTimeString, getCurrentDir, getDirName, getDirTree, getExtName, getFileText, getFilteredFileNames, getHTML, getLocalNodeBinPath, getLocalPkgPath, getMD, getMDToc, getMatch, getMediaInput, getMediaPalette, getModulePath, getObjectFrom, getObjectFromCSVContent, getObjectFromCSVFile, getObjectFromContent, getObjectFromFile, getObjectFromINIContent, getObjectFromINIFile, getObjectFromJSContent, getObjectFromJSFile, getObjectFromJSONContent, getObjectFromJSONFile, getObjectFromNonCheckFile, getObjectFromPath, getObjectFromTOMLContent, getObjectFromTOMLFile, getObjectFromUrl, getObjectFromXMLContent, getObjectFromXMLFile, getObjectFromYAMLContent, getObjectFromYAMLFile, getPKG, getPKGVersion, getPaths, getPathsStream, getPathsStructure, getPathsTree, getPlatform, getStringFlagValue, getStringFrom, getStringType, getStringsFrom, getTempDir, gradient, hideBin, highlight, html2md, html2terminal, icon, incrementMdHeaders, indent, ini, isAbsolutePath, isBrowser, isBun, isDeno, isDev, isDirectory, isGitHubAuthenticated, isJsDom, isNode, isPath, isWebWorker, joinPath, joinUrl, json, line, link, localStorage, logger, parser as md, md2html, md2terminal, normalizePath, object2string, onCancel, onConsole, onExit, onStd, open, openApp, performance, promptGroup, promptLine, promptLineCore, promptLineEnquirer, promptLineGroup, promptLineMethods, qrcode, readDir, readFile, relativePath, removeDir, removeDirIfExist, removeFile, removeFileIfExist, removePathIfExist, replaceConsole, replacePlaceholders, replaceStd, resolvePath, rmDeprecationAlerts, runLocalNodeBin, schema2object, schema2ts, schema2type, schema2zod, serializeValidation, setDirTree, spinner, svg, table, toml, ts2schema, validate, validateHomeDir, validateSchema, writeFile, writeFileContent, xml, yaml, zipFile, zipFilesInDirectory, zod2schema };
