/**
 * Utility functions for template manipulation
 *
 * Path format with multi-section support:
 * - "s0" for section 0
 * - "s0.0" for group 0 in section 0
 * - "s0.0.1" for field 1 in group 0 in section 0
 * - "s0.0.1.2" for field 2 in nested group at s0.0.1
 */
import type { Section, FieldConfig, TreeNode, FormSetData } from '../types.js';
/**
 * Deep clone an object
 */
export declare function deep_clone<T>(obj: T): T;
/**
 * Check if data is FormSetData (multi-section format)
 */
export declare function is_form_set_data(data: unknown): data is FormSetData;
/**
 * Convert Section or FormSetData to FormSetData (normalize to multi-section)
 */
export declare function normalize_to_form_set_data(data: Section | FormSetData): FormSetData;
/**
 * Get groups array from Section
 */
export declare function get_fields(section: Section): FieldConfig[];
/**
 * Set fields array on Section (uses groups)
 */
export declare function set_fields(section: Section, fields: FieldConfig[]): Section;
/**
 * Check if a path is a section-only path (e.g., "s0", "s1")
 */
export declare function is_section_path(path: string): boolean;
/**
 * Parse a path string into section index and field indices
 * New format: "s0.1.2" -> { section_index: 0, field_indices: [1, 2] }
 * For section paths: "s0" -> { section_index: 0, field_indices: [] }
 */
export interface ParsedPath {
    section_index: number;
    field_indices: number[];
}
export declare function parse_path(path: string): ParsedPath;
/**
 * Build a path string from section index and field indices
 */
export declare function build_path(section_index: number, field_indices?: number[]): string;
/**
 * Get section by index from sections array
 */
export declare function get_section_by_index(sections: Section[], index: number): Section | null;
/**
 * Get a field by path from sections array
 */
export declare function get_field_by_path(sections: Section[], path: string): FieldConfig | null;
/**
 * Update a field at a given path
 */
export declare function update_field_at_path(sections: Section[], path: string, updates: Partial<FieldConfig>): Section[];
/**
 * Update a section at a given index
 */
export declare function update_section_at_index(sections: Section[], section_index: number, updates: Partial<Section>): Section[];
/**
 * Add a field at a given path
 * If parent_path is null, cannot add (must specify at least a section)
 * If parent_path is a section path (e.g., "s0"), adds to that section's groups
 * If parent_path is a group path (e.g., "s0.0"), adds to that group's fields
 */
export declare function add_field_at_path(sections: Section[], parent_path: string | null, field: FieldConfig, position?: number): Section[];
/**
 * Add a new section
 */
export declare function add_section(sections: Section[], section: Section, position?: number): Section[];
/**
 * Delete a section at a given index
 */
export declare function delete_section_at_index(sections: Section[], section_index: number): Section[];
/**
 * Delete a field at a given path
 */
export declare function delete_field_at_path(sections: Section[], path: string): Section[];
/**
 * Duplicate a field at a given path
 */
export declare function duplicate_field_at_path(sections: Section[], path: string, new_id_suffix?: string): Section[];
/**
 * Move a field from one path to another
 */
export declare function move_field(sections: Section[], from_path: string, to_path: string, position: 'before' | 'after' | 'inside'): Section[];
/**
 * Move a section from one index to another
 */
export declare function move_section(sections: Section[], from_index: number, to_index: number): Section[];
/**
 * Build tree nodes from sections array
 */
export declare function build_tree_nodes(sections: Section[]): TreeNode[];
/**
 * Get all field IDs from sections array (for dependency validation)
 */
export declare function get_all_field_ids(sections: Section[]): string[];
/**
 * Find a field by ID (returns path)
 */
export declare function find_field_path_by_id(sections: Section[], id: string): string | null;
/**
 * Generate a unique field ID
 */
export declare function generate_field_id(sections: Section[], base?: string): string;
/**
 * Get template name from first section
 * @deprecated Use sections[0].section_name directly
 */
export declare function get_template_name(sections: Section[]): string;
/**
 * Set template name on first section
 * @deprecated Use update_section_at_index directly
 */
export declare function set_template_name(sections: Section[], name: string): Section[];
//# sourceMappingURL=template_utils.d.ts.map