Creates a clone of `set`.

@private
@param {Object} set The set to clone.
@param {Function} cloneFunc The function to clone values.
@param {boolean} [isDeep] Specify a deep clone.
@returns {Object} Returns the cloned set.
977239
function cloneSet(set, isDeep, cloneFunc) {
    var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
    return arrayReduce(array, addSetEntry, new set.constructor());
  }
502006
function clone(obj) {
    if (Array.isArray(obj)) {
        return obj.map(clone);
    } else if (typeof obj === 'object') {
        var copy = {};
        Object.keys(obj).forEach(function (key) {
            copy[key] = clone(obj[key]);
        });
        return copy;
    }
    return obj;
}
709945
function cloneObj(obj, exclude) {
  var type = _typeof(obj);

  switch (type) {
    case 'undefined':
    case 'boolean':
    case 'nuber':
    case 'string':
    case 'function':
      return obj;
      break;

    case 'object':
      if (obj === null) {
        // null is object
        return obj;
      }

      var r;

      if (isArray(obj)) {
        r = [];
        var _iteratorNormalCompletion3 = true;
        var _didIteratorError3 = false;
        var _iteratorError3 = undefined;

        try {
          for (var _iterator3 = obj[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
            var item = _step3.value;
            r.push(cloneObj(item, exclude));
          }
        } catch (err) {
          _didIteratorError3 = true;
          _iteratorError3 = err;
        } finally {
          try {
            if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
              _iterator3.return();
            }
          } finally {
            if (_didIteratorError3) {
              throw _iteratorError3;
            }
          }
        }
      } else {
        r = {};

        for (var _i7 = 0, _Object$keys2 = Object.keys(obj); _i7 < _Object$keys2.length; _i7++) {
          var key = _Object$keys2[_i7];

          if (!exclude || isArray(exclude) && !exclude.includes(key) || !exclude(key, obj[key], obj)) {
            r[key] = cloneObj(obj[key], exclude);
          }
        }
      }

      return r;
      break;

    default:
      return obj;
      break;
  }
}
1341408
function _clone(value) {
  if(value && typeof value === 'object') {
    var rval;
    if(_isArray(value)) {
      rval = [];
      for(var i = 0; i < value.length; ++i) {
        rval[i] = _clone(value[i]);
      }
    }
    else {
      rval = {};
      for(var key in value) {
        rval[key] = _clone(value[key]);
      }
    }
    return rval;
  }
  return value;
}
1149574
function cloneNode(n) {
    if (Array.isArray(n)) 
        return n.map(function (n) {
        return cloneNode(n);
    });
    var o = {};
    Object.keys(n).forEach(function (k) {
        o[k] = n[k];
    });
    return o;
}
80097
function clone(obj) {
  if (null == obj || "object" != typeof obj)
    return obj;

  if (obj instanceof Object) {
    var copy = {};
    for (var attr in obj) {
      if (obj.hasOwnProperty(attr)) copy[attr] = clone(obj[attr]);
    }
    return copy;
  }

  throw new Error("Unable to copy obj! Its type isn't supported.");
}
761246
function (original) {
                var clone = {};
                var i, keys = Object.keys(original);

                for (i = 0; i < keys.length; i++) {
                    // copy each property into the clone
                    clone[keys[i]] = original[keys[i]];
                }

                return clone;
            }
638614
function cloneItree(itree, excludeKeys) {
    const clone = {};
    excludeKeys = _.castArray(excludeKeys);
    excludeKeys.push('ref');

    _.each(itree, (v, k) => {
        if (!_.includes(excludeKeys, k)) {
            clone[k] = _.cloneDeep(v);
        }
    });

    return clone;
}
380517
function cloneStateDef(stateDef) {
    stateDef = (stateDef || {});
    return function () {
        var ctx = this;
        return Object.keys(stateDef).reduce((state, k) => {
            var value = stateDef[k];
            state[k] = (typeof value === 'function' ? value.call(ctx) : value);
            return state;
        }, {});
    };
}
763481
function cloneTypedArray$1(typedArray, isDeep) {
  var buffer = isDeep ? cloneArrayBuffer$3(typedArray.buffer) : typedArray.buffer;
  return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
774441
@SuppressWarnings("unchecked")
    protected Set _transform(final Set set) {
        if (set == null) return null;
        if (set instanceof BeanSet) return set;
        return new BeanSet<>(set, this);
    }
197777
function set() {
    function Set() {}
    var ret = new Set();
    var arg, i, len;

    for(i = 0, len = arguments.length; i < len; i++) {
        arg = arguments[i];

        if(arg.constructor.name == 'Set') Object.keys(arg).filter(
            not(prop.bind(undefined, ret))
        ).forEach(addElem.bind(undefined, ret));
        else if(!(arg in ret)) addElem(ret, arg);
    }

    return Object.preventExtensions(ret);
}
1056302
function wrapSet(set){
    return function(context, value){
      set.call( context, value, context.data );
      return value;
    }
  }
125561
function Set(a,_sorted) {
  if (a._Set) return a;
  if (!_sorted) a=sortUnique(a);

  //@returns Boolean. Detect if x is in set.
  //`cmp` is custom compare functions return -1,0,1.
  // function cmp(x,item):Ordering(LT=-1|EQ=0|GT=1);
  a.contains=function (x,cmp) {return !!~bsearch(a,x,cmp)};
  a.indexOf=function (x,cmp) {return bsearch(a,x,cmp)};
  a.toArray=function () {return copyArray(a);};

  /** Union with another Set
  @param {Set|Array} b If b is an array,it will be corrupted by sortUnqiue
  @return {Set} return new Set */
  a.union=function (b) {
    b=Set(b);
    var n=a.length+b.length,c=new a.constructor(n);
    for (var i=0,j=0,k=0;k<n;k++) {//merge
      if (a[i]===b[j]) {c[k]=a[i++];j++;n--;}
      else if (a[i]<b[j]) c[k]=a[i++];
      else c[k]=b[j++];
    }
    c.length=n;
    return Set(c.length===n?c:copyArray(c,n),true);
  };

  a.inspect=a.toArray;
  a._Set=true;
  return a;
}
558856
function clone(target) {
  if (target == null || typeof target !== "object") return target;
  var cloned = target.constructor ? target.constructor() : Object.create(null);
  for (var attr in target) {
    if (target.hasOwnProperty(attr)) {
      cloned[attr] = target[attr];
    }
  }
  return cloned;
}
1059787
function deepClone(o, visited) {
			var clone, id, type = _.util.type(o);
			visited = visited || {};

			switch (type) {
				case 'Object':
					id = _.util.objId(o);
					if (visited[id]) {
						return visited[id];
					}
					clone = {};
					visited[id] = clone;

					for (var key in o) {
						if (o.hasOwnProperty(key)) {
							clone[key] = deepClone(o[key], visited);
						}
					}

					return clone;

				case 'Array':
					id = _.util.objId(o);
					if (visited[id]) {
						return visited[id];
					}
					clone = [];
					visited[id] = clone;

					o.forEach(function (v, i) {
						clone[i] = deepClone(v, visited);
					});

					return clone;

				default:
					return o;
			}
		}
1296504
function setup(settings) {
    if (!settings) {
        return _.cloneDeep(SETTINGS);
    }
    _.merge(SETTINGS, settings);
    return _.cloneDeep(SETTINGS);
}