
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e01d668f-5eba-5135-b545-3623e4199aa8")}catch(e){}}();
const WORKTREE_TASK_ID_INVALID_MESSAGE = "Invalid task id for worktree path.";
export const KANBAN_RUNTIME_HOME_DIR_NAME = ".cline/kanban";
export const KANBAN_TASK_WORKTREES_HOME_DIR_NAME = ".cline/worktrees";
export const KANBAN_TASK_WORKTREES_DIR_NAME = "worktrees";
export const KANBAN_TASK_WORKTREES_DISPLAY_ROOT = `~/${KANBAN_TASK_WORKTREES_HOME_DIR_NAME}`;
export function normalizeTaskIdForWorktreePath(taskId) {
    const normalized = taskId.trim();
    if (!normalized || normalized.includes("/") || normalized.includes("\\") || normalized.includes("..")) {
        throw new Error(WORKTREE_TASK_ID_INVALID_MESSAGE);
    }
    return normalized;
}
export function getWorkspaceFolderLabelForWorktreePath(repoPath) {
    const trimmed = repoPath.trim().replace(/[\\/]+$/g, "");
    const folder = trimmed.split(/[\\/]/g).filter((segment) => segment.length > 0).at(-1) ?? "workspace";
    const cleaned = [...folder]
        .filter((char) => {
        const code = char.charCodeAt(0);
        return code >= 32 && code !== 127;
    })
        .join("")
        .trim();
    return cleaned || "workspace";
}
export function buildTaskWorktreeDisplayPath(taskId, repoPath) {
    const normalizedTaskId = normalizeTaskIdForWorktreePath(taskId);
    const workspaceLabel = getWorkspaceFolderLabelForWorktreePath(repoPath);
    return `${KANBAN_TASK_WORKTREES_DISPLAY_ROOT}/${normalizedTaskId}/${workspaceLabel}`;
}
//# sourceMappingURL=task-worktree-path.js.map
//# debugId=e01d668f-5eba-5135-b545-3623e4199aa8
