const hasOwnProperty = Object.prototype.hasOwnProperty; /* Really simple clone utility. Only copies plain arrays, objects, and Dates. Transfers everything else as-is. Wanted to use a third-party lib, but none did exactly this. */ export function deepCopy(input) { if (Array.isArray(input)) { return input.map(deepCopy); } else if (input instanceof Date) { return new Date(input.valueOf()); } else if (typeof input === 'object' && input) { // non-null object return mapHash(input, deepCopy); } else { // everything else (null, function, etc) return input; } } export function mapHash(input, func) { const output = {}; for (const key in input) { if (hasOwnProperty.call(input, key)) { output[key] = func(input[key], key); } } return output; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib2JqLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vbGliL3NyYy91dGlscy9vYmoudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsTUFBTSxjQUFjLEdBQUcsTUFBTSxDQUFDLFNBQVMsQ0FBQyxjQUFjLENBQUM7QUFFdkQ7OztFQUdFO0FBQ0YsTUFBTSxVQUFVLFFBQVEsQ0FBQyxLQUFVO0lBRWpDLElBQUksS0FBSyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsRUFBRTtRQUN4QixPQUFPLEtBQUssQ0FBQyxHQUFHLENBQUMsUUFBUSxDQUFDLENBQUM7S0FFNUI7U0FBTSxJQUFJLEtBQUssWUFBWSxJQUFJLEVBQUU7UUFDaEMsT0FBTyxJQUFJLElBQUksQ0FBQyxLQUFLLENBQUMsT0FBTyxFQUFFLENBQUMsQ0FBQztLQUVsQztTQUFNLElBQUksT0FBTyxLQUFLLEtBQUssUUFBUSxJQUFJLEtBQUssRUFBRSxFQUFFLGtCQUFrQjtRQUNqRSxPQUFPLE9BQU8sQ0FBQyxLQUFLLEVBQUUsUUFBUSxDQUFDLENBQUM7S0FFakM7U0FBTSxFQUFFLHdDQUF3QztRQUMvQyxPQUFPLEtBQUssQ0FBQztLQUNkO0FBQ0gsQ0FBQztBQUdELE1BQU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