"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ig_utilities_1 = require("@intelligentgraphics/ig.utilities");
exports.evaluateTemplate = function (rawTemplate, config) {
    var template = ig_utilities_1.Obj.deepClone(rawTemplate);
    var evaluateStringValues = function (obj) {
        for (var key in obj) {
            var value = obj[key];
            if (value === null || value === undefined) {
                continue;
            }
            if (typeof value === "string" &&
                value.indexOf("{") === 0 &&
                value.lastIndexOf("}") === value.length - 1) {
                obj[key] = ig_utilities_1.evalWithScope(value.substring(1, value.length - 1), config);
                continue;
            }
            if (typeof value === "object") {
                evaluateStringValues(value);
            }
        }
    };
    evaluateStringValues(template);
    return template;
};
