import { t as ReadResult } from "./read-opened-file-CxgSVMdu.js";

//#region packages/fs-safe/dist/errors.d.ts
type FsSafeErrorCode$1 = "already-exists" | "denied-path" | "device-path" | "hardlink" | "helper-failed" | "helper-unavailable" | "invalid-path" | "insecure-permissions" | "not-empty" | "not-file" | "not-found" | "not-owned" | "not-removable" | "outside-workspace" | "path-alias" | "path-mismatch" | "permission-unverified" | "symlink" | "timeout" | "too-large" | "unsupported-platform";
type FsSafeErrorCategory = "policy" | "operational";
declare class FsSafeError extends Error {
  readonly code: FsSafeErrorCode$1;
  readonly category: FsSafeErrorCategory;
  constructor(code: FsSafeErrorCode$1, message: string, options?: {
    cause?: unknown;
  });
}
//#endregion
//#region packages/fs-safe/dist/absolute-path.d.ts
type AbsolutePathSymlinkPolicy$1 = "reject" | "follow";
type ResolvedAbsolutePath$1 = {
  path: string;
  canonicalPath: string;
};
type ResolvedWritableAbsolutePath$1 = ResolvedAbsolutePath$1 & {
  parentDir: string;
  parentExists: boolean;
};
type EnsureAbsoluteDirectoryOptions$1 = {
  scopeLabel?: string;
  mode?: number;
};
type EnsureAbsoluteDirectoryResult$1 = {
  ok: true;
  path: string;
} | {
  ok: false;
  code: FsSafeErrorCode$1;
  error: FsSafeError;
};
//#endregion
//#region src/infra/fs-safe.d.ts
type FsSafeErrorCode = FsSafeErrorCode$1;
declare function assertAbsolutePathInput(...args: any[]): any;
declare function canonicalPathFromExistingAncestor(...args: any[]): any;
declare function resolveAbsolutePathForRead(...args: any[]): any;
declare function resolveAbsolutePathForWrite(...args: any[]): any;
declare function findExistingAncestor(...args: any[]): any;
type AbsolutePathSymlinkPolicy = AbsolutePathSymlinkPolicy$1;
type EnsureAbsoluteDirectoryOptions = EnsureAbsoluteDirectoryOptions$1;
type EnsureAbsoluteDirectoryResult = EnsureAbsoluteDirectoryResult$1;
type ResolvedAbsolutePath = ResolvedAbsolutePath$1;
type ResolvedWritableAbsolutePath = ResolvedWritableAbsolutePath$1;
declare function readLocalFileFromRoots(rootDirs: string[], relativePath: string, options?: any): Promise<any>;
declare function root(...args: any[]): any;
declare function withTimeout<T = any>(promise: Promise<T> | (() => Promise<T>), ms: number): any;
type ExternalFileWriteOptions = {
  rootDir: string;
  path: string;
  write: (tempPath: string) => Promise<void>;
  fallbackFileName?: string;
  tempPrefix?: string;
};
type ExternalFileWriteResult = {
  path: string;
};
declare function ensureAbsoluteDirectory(dirPath: string, options?: {
  scopeLabel?: string;
  mode?: number;
}): Promise<{
  ok: true;
  path: string;
} | {
  ok: false;
  error: Error;
}>;
/** @deprecated Use root(rootDir).read(relativePath, options). */
declare function readFileWithinRoot(params: {
  rootDir: string;
  relativePath: string;
  rejectHardlinks?: boolean;
  nonBlockingRead?: boolean;
  allowSymlinkTargetWithinRoot?: boolean;
  maxBytes?: number;
}): Promise<ReadResult>;
/** @deprecated Use root(rootDir).write(relativePath, data, options). */
declare function writeFileWithinRoot(params: {
  rootDir: string;
  relativePath: string;
  data: string | Buffer;
  encoding?: BufferEncoding;
  mkdir?: boolean;
}): Promise<void>;
//#endregion
export { root as _, ExternalFileWriteResult as a, ResolvedWritableAbsolutePath as c, ensureAbsoluteDirectory as d, findExistingAncestor as f, resolveAbsolutePathForWrite as g, resolveAbsolutePathForRead as h, ExternalFileWriteOptions as i, assertAbsolutePathInput as l, readLocalFileFromRoots as m, EnsureAbsoluteDirectoryOptions as n, FsSafeErrorCode as o, readFileWithinRoot as p, EnsureAbsoluteDirectoryResult as r, ResolvedAbsolutePath as s, AbsolutePathSymlinkPolicy as t, canonicalPathFromExistingAncestor as u, withTimeout as v, writeFileWithinRoot as y };