import {} from '../../types/core';
import { isLoopVariable } from '../../types/utils';
/**
 * Serialize a nested key for identifier computation.
 * Handles both string keys and LoopVariable objects.
 */
function serializeNestedKey(key) {
    if (typeof key === 'string') {
        return key;
    }
    // It's a LoopVariable
    if (isLoopVariable(key)) {
        const loopNested = key.nested.join(',');
        return `LoopVar:${key.uid}:${loopNested}`;
    }
    return String(key);
}
/**
 * Get a unique identifier for a variable, using its `uid` and `nested` properties
 *
 * @param variable variable to get the identifier from
 */
export function getUniqueIdentifier(variable, opts = {
    useNested: true,
}) {
    let identifier = variable.uid;
    if (opts.useNested && 'nested' in variable) {
        identifier += variable.nested.map(serializeNestedKey).join(',');
    }
    return identifier;
}
//# sourceMappingURL=hashing.js.map