function _findSubstitutions (value, seen = new Set(), result = new Set()) {
    if (!value || seen.has(value)) {
        return result;
    }

    if (Array.isArray(value)) {
        seen.add(value);

        for (let i = 0, ii = value.length; i < ii; i++) {
            _findSubstitutions(value[i], seen, result);
        }
    }
    else if (typeof value === 'object') {
        seen.add(value);

        for (const key in value) {
            if (Object.hasOwn(value, key)) {
                _findSubstitutions(value[key], seen, result);
            }
        }
    }
    else if (typeof value === 'string') {
        let match;

        while ((match = REGEX_EXTRACT_VARS.exec(value)) !== null) {
            result.add(match[0].slice(2, -2));
        }
    }

    return result;
}
Recursively traverses a variable and detects all instances of variable
replacements within the string of the object.

@private
@param {*} value Any JS variable within which we are trying to discover {{variables}}
@param {Set.<Object>} seen Set of objects traversed before to avoid infinite recursion
@param {Set.<Object>} result Set of variables to accumulate result in the recursive call
@returns {Object} Set of variables