/**
 * ldesign v0.2.2
 * (c) 2022年9月20日 swimly
 * @license MIT
 */

'use strict';

var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
var _createClass = require('@babel/runtime/helpers/createClass');
var _regeneratorRuntime = require('@babel/runtime/regenerator');
var defineProperty28395935 = require('./defineProperty-28395935.js');
var _typeof = require('@babel/runtime/helpers/typeof');
var isArrayB0f0e351 = require('./isArray-b0f0e351.js');
var _isIndex1bf92538 = require('./_isIndex-1bf92538.js');
var isObjectLike2443c6ff = require('./isObjectLike-2443c6ff.js');
var log = require('./log.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
var _classCallCheck__default = /*#__PURE__*/_interopDefaultLegacy(_classCallCheck);
var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);

var isArray$2$1 = isArrayB0f0e351.isArray_1,
    isSymbol$2 = _isIndex1bf92538.isSymbol_1;
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
    reIsPlainProp = /^\w*$/;

function isKey$1(value, object) {
  if (isArray$2$1(value)) {
    return false;
  }

  var type = _typeof__default["default"](value);

  if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol$2(value)) {
    return true;
  }

  return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
}

var _isKey = isKey$1;
var root$1$1 = isObjectLike2443c6ff._root;
var coreJsData$1 = root$1$1["__core-js_shared__"];
var _coreJsData = coreJsData$1;
var coreJsData = _coreJsData;

var maskSrcKey = function () {
  var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  return uid ? "Symbol(src)_1." + uid : "";
}();

function isMasked$1(func) {
  return !!maskSrcKey && maskSrcKey in func;
}

var _isMasked = isMasked$1;
var funcProto$1 = Function.prototype;
var funcToString$1 = funcProto$1.toString;

function toSource$1(func) {
  if (func != null) {
    try {
      return funcToString$1.call(func);
    } catch (e) {}

    try {
      return func + "";
    } catch (e) {}
  }

  return "";
}

var _toSource = toSource$1;
var isFunction = _isIndex1bf92538.isFunction_1,
    isMasked = _isMasked,
    isObject$4 = _isIndex1bf92538.isObject_1,
    toSource$2 = _toSource;
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var funcProto$2 = Function.prototype,
    objectProto$2$1 = Object.prototype;
var funcToString$2 = funcProto$2.toString;
var hasOwnProperty$2$1 = objectProto$2$1.hasOwnProperty;
var reIsNative = RegExp("^" + funcToString$2.call(hasOwnProperty$2$1).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");

function baseIsNative$1(value) {
  if (!isObject$4(value) || isMasked(value)) {
    return false;
  }

  var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  return pattern.test(toSource$2(value));
}

var _baseIsNative = baseIsNative$1;

function getValue$1(object, key) {
  return object == null ? void 0 : object[key];
}

var _getValue = getValue$1;
var baseIsNative = _baseIsNative,
    getValue = _getValue;

function getNative$2$1(object, key) {
  var value = getValue(object, key);
  return baseIsNative(value) ? value : void 0;
}

var _getNative = getNative$2$1;
var getNative$1$1 = _getNative;
var nativeCreate$4 = getNative$1$1(Object, "create");
var _nativeCreate = nativeCreate$4;
var nativeCreate$3 = _nativeCreate;

function hashClear$1() {
  this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
  this.size = 0;
}

var _hashClear = hashClear$1;

function hashDelete$1(key) {
  var result = this.has(key) && delete this.__data__[key];
  this.size -= result ? 1 : 0;
  return result;
}

var _hashDelete = hashDelete$1;
var nativeCreate$2 = _nativeCreate;
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
var objectProto$1$1 = Object.prototype;
var hasOwnProperty$1$1 = objectProto$1$1.hasOwnProperty;

function hashGet$1(key) {
  var data = this.__data__;

  if (nativeCreate$2) {
    var result = data[key];
    return result === HASH_UNDEFINED$1 ? void 0 : result;
  }

  return hasOwnProperty$1$1.call(data, key) ? data[key] : void 0;
}

var _hashGet = hashGet$1;
var nativeCreate$1 = _nativeCreate;
var objectProto$9 = Object.prototype;
var hasOwnProperty$8 = objectProto$9.hasOwnProperty;

function hashHas$1(key) {
  var data = this.__data__;
  return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$8.call(data, key);
}

var _hashHas = hashHas$1;
var nativeCreate = _nativeCreate;
var HASH_UNDEFINED = "__lodash_hash_undefined__";

function hashSet$1(key, value) {
  var data = this.__data__;
  this.size += this.has(key) ? 0 : 1;
  data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
  return this;
}

var _hashSet = hashSet$1;
var hashClear = _hashClear,
    hashDelete = _hashDelete,
    hashGet = _hashGet,
    hashHas = _hashHas,
    hashSet = _hashSet;

function Hash$1(entries) {
  var index = -1,
      length = entries == null ? 0 : entries.length;
  this.clear();

  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}

Hash$1.prototype.clear = hashClear;
Hash$1.prototype["delete"] = hashDelete;
Hash$1.prototype.get = hashGet;
Hash$1.prototype.has = hashHas;
Hash$1.prototype.set = hashSet;
var _Hash = Hash$1;

function listCacheClear$1() {
  this.__data__ = [];
  this.size = 0;
}

var _listCacheClear = listCacheClear$1;
var eq$1 = _isIndex1bf92538.eq_1;

function assocIndexOf$4(array, key) {
  var length = array.length;

  while (length--) {
    if (eq$1(array[length][0], key)) {
      return length;
    }
  }

  return -1;
}

var _assocIndexOf = assocIndexOf$4;
var assocIndexOf$3 = _assocIndexOf;
var arrayProto = Array.prototype;
var splice = arrayProto.splice;

function listCacheDelete$1(key) {
  var data = this.__data__,
      index = assocIndexOf$3(data, key);

  if (index < 0) {
    return false;
  }

  var lastIndex = data.length - 1;

  if (index == lastIndex) {
    data.pop();
  } else {
    splice.call(data, index, 1);
  }

  --this.size;
  return true;
}

var _listCacheDelete = listCacheDelete$1;
var assocIndexOf$2 = _assocIndexOf;

function listCacheGet$1(key) {
  var data = this.__data__,
      index = assocIndexOf$2(data, key);
  return index < 0 ? void 0 : data[index][1];
}

var _listCacheGet = listCacheGet$1;
var assocIndexOf$1 = _assocIndexOf;

function listCacheHas$1(key) {
  return assocIndexOf$1(this.__data__, key) > -1;
}

var _listCacheHas = listCacheHas$1;
var assocIndexOf = _assocIndexOf;

function listCacheSet$1(key, value) {
  var data = this.__data__,
      index = assocIndexOf(data, key);

  if (index < 0) {
    ++this.size;
    data.push([key, value]);
  } else {
    data[index][1] = value;
  }

  return this;
}

var _listCacheSet = listCacheSet$1;
var listCacheClear = _listCacheClear,
    listCacheDelete = _listCacheDelete,
    listCacheGet = _listCacheGet,
    listCacheHas = _listCacheHas,
    listCacheSet = _listCacheSet;

function ListCache$1$1(entries) {
  var index = -1,
      length = entries == null ? 0 : entries.length;
  this.clear();

  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}

ListCache$1$1.prototype.clear = listCacheClear;
ListCache$1$1.prototype["delete"] = listCacheDelete;
ListCache$1$1.prototype.get = listCacheGet;
ListCache$1$1.prototype.has = listCacheHas;
ListCache$1$1.prototype.set = listCacheSet;
var _ListCache = ListCache$1$1;
var getNative$5 = _getNative,
    root$5 = isObjectLike2443c6ff._root;
var Map$1$1 = getNative$5(root$5, "Map");
var _Map = Map$1$1;
var Hash = _Hash,
    ListCache$3 = _ListCache,
    Map$3 = _Map;

function mapCacheClear$1() {
  this.size = 0;
  this.__data__ = {
    "hash": new Hash(),
    "map": new (Map$3 || ListCache$3)(),
    "string": new Hash()
  };
}

var _mapCacheClear = mapCacheClear$1;

function isKeyable$1(value) {
  var type = _typeof__default["default"](value);

  return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
}

var _isKeyable = isKeyable$1;
var isKeyable = _isKeyable;

function getMapData$4(map, key) {
  var data = map.__data__;
  return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}

var _getMapData = getMapData$4;
var getMapData$3 = _getMapData;

function mapCacheDelete$1(key) {
  var result = getMapData$3(this, key)["delete"](key);
  this.size -= result ? 1 : 0;
  return result;
}

var _mapCacheDelete = mapCacheDelete$1;
var getMapData$2 = _getMapData;

function mapCacheGet$1(key) {
  return getMapData$2(this, key).get(key);
}

var _mapCacheGet = mapCacheGet$1;
var getMapData$1 = _getMapData;

function mapCacheHas$1(key) {
  return getMapData$1(this, key).has(key);
}

var _mapCacheHas = mapCacheHas$1;
var getMapData = _getMapData;

function mapCacheSet$1(key, value) {
  var data = getMapData(this, key),
      size = data.size;
  data.set(key, value);
  this.size += data.size == size ? 0 : 1;
  return this;
}

var _mapCacheSet = mapCacheSet$1;
var mapCacheClear = _mapCacheClear,
    mapCacheDelete = _mapCacheDelete,
    mapCacheGet = _mapCacheGet,
    mapCacheHas = _mapCacheHas,
    mapCacheSet = _mapCacheSet;

function MapCache$1(entries) {
  var index = -1,
      length = entries == null ? 0 : entries.length;
  this.clear();

  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}

MapCache$1.prototype.clear = mapCacheClear;
MapCache$1.prototype["delete"] = mapCacheDelete;
MapCache$1.prototype.get = mapCacheGet;
MapCache$1.prototype.has = mapCacheHas;
MapCache$1.prototype.set = mapCacheSet;
var _MapCache = MapCache$1;
var MapCache$2 = _MapCache;
var FUNC_ERROR_TEXT = "Expected a function";

function memoize$1(func, resolver) {
  if (typeof func != "function" || resolver != null && typeof resolver != "function") {
    throw new TypeError(FUNC_ERROR_TEXT);
  }

  var memoized = function memoized2() {
    var args = arguments,
        key = resolver ? resolver.apply(this, args) : args[0],
        cache = memoized2.cache;

    if (cache.has(key)) {
      return cache.get(key);
    }

    var result = func.apply(this, args);
    memoized2.cache = cache.set(key, result) || cache;
    return result;
  };

  memoized.cache = new (memoize$1.Cache || MapCache$2)();
  return memoized;
}

memoize$1.Cache = MapCache$2;
var memoize_1 = memoize$1;
var memoize = memoize_1;
var MAX_MEMOIZE_SIZE = 500;

function memoizeCapped$1(func) {
  var result = memoize(func, function (key) {
    if (cache.size === MAX_MEMOIZE_SIZE) {
      cache.clear();
    }

    return key;
  });
  var cache = result.cache;
  return result;
}

var _memoizeCapped = memoizeCapped$1;
var memoizeCapped = _memoizeCapped;
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reEscapeChar = /\\(\\)?/g;
var stringToPath$1 = memoizeCapped(function (string) {
  var result = [];

  if (string.charCodeAt(0) === 46) {
    result.push("");
  }

  string.replace(rePropName, function (match, number, quote, subString) {
    result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  });
  return result;
});
var _stringToPath = stringToPath$1;

function arrayMap$1(array, iteratee) {
  var index = -1,
      length = array == null ? 0 : array.length,
      result = Array(length);

  while (++index < length) {
    result[index] = iteratee(array[index], index, array);
  }

  return result;
}

var _arrayMap = arrayMap$1;
var _Symbol2$1 = isObjectLike2443c6ff._Symbol,
    arrayMap$2 = _arrayMap,
    isArray$1$1 = isArrayB0f0e351.isArray_1,
    isSymbol$1 = _isIndex1bf92538.isSymbol_1;
var INFINITY$1 = 1 / 0;
var symbolProto$1 = _Symbol2$1 ? _Symbol2$1.prototype : void 0,
    symbolToString = symbolProto$1 ? symbolProto$1.toString : void 0;

function baseToString$1(value) {
  if (typeof value == "string") {
    return value;
  }

  if (isArray$1$1(value)) {
    return arrayMap$2(value, baseToString$1) + "";
  }

  if (isSymbol$1(value)) {
    return symbolToString ? symbolToString.call(value) : "";
  }

  var result = value + "";
  return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
}

var _baseToString = baseToString$1;
var baseToString = _baseToString;

function toString$1(value) {
  return value == null ? "" : baseToString(value);
}

var toString_1 = toString$1;
var isArray$5 = isArrayB0f0e351.isArray_1,
    isKey = _isKey,
    stringToPath = _stringToPath,
    toString$2 = toString_1;

function castPath$1$1(value, object) {
  if (isArray$5(value)) {
    return value;
  }

  return isKey(value, object) ? [value] : stringToPath(toString$2(value));
}

var _castPath = castPath$1$1;
var isSymbol = _isIndex1bf92538.isSymbol_1;
var INFINITY = 1 / 0;

function toKey$1$1(value) {
  if (typeof value == "string" || isSymbol(value)) {
    return value;
  }

  var result = value + "";
  return result == "0" && 1 / value == -INFINITY ? "-0" : result;
}

var _toKey = toKey$1$1;
var castPath$5 = _castPath,
    toKey$3 = _toKey;

function baseGet$3(object, path) {
  path = castPath$5(path, object);
  var index = 0,
      length = path.length;

  while (object != null && index < length) {
    object = object[toKey$3(path[index++])];
  }

  return index && index == length ? object : void 0;
}

var _baseGet = baseGet$3;

/**
 * LDesignUtility v0.1.1
 * (c) 2022 undefined
 * @license MIT
 */
var getNative$4 = _getNative;

var defineProperty$2 = function () {
  try {
    var func = getNative$4(Object, "defineProperty");
    func({}, "", {});
    return func;
  } catch (e) {}
}();

var _defineProperty = defineProperty$2;
var defineProperty$1 = _defineProperty;

function baseAssignValue$2(object, key, value) {
  if (key == "__proto__" && defineProperty$1) {
    defineProperty$1(object, key, {
      "configurable": true,
      "enumerable": true,
      "value": value,
      "writable": true
    });
  } else {
    object[key] = value;
  }
}

var _baseAssignValue = baseAssignValue$2;
var baseAssignValue$1 = _baseAssignValue,
    eq = _isIndex1bf92538.eq_1;
var objectProto$8 = Object.prototype;
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;

function assignValue$3(object, key, value) {
  var objValue = object[key];

  if (!(hasOwnProperty$6.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
    baseAssignValue$1(object, key, value);
  }
}

var _assignValue = assignValue$3;
var assignValue$2 = _assignValue,
    castPath$4 = _castPath,
    isIndex$2 = _isIndex1bf92538._isIndex,
    isObject$3 = _isIndex1bf92538.isObject_1,
    toKey$2 = _toKey;

function baseSet$1(object, path, value, customizer) {
  if (!isObject$3(object)) {
    return object;
  }

  path = castPath$4(path, object);
  var index = -1,
      length = path.length,
      lastIndex = length - 1,
      nested = object;

  while (nested != null && ++index < length) {
    var key = toKey$2(path[index]),
        newValue = value;

    if (key === "__proto__" || key === "constructor" || key === "prototype") {
      return object;
    }

    if (index != lastIndex) {
      var objValue = nested[key];
      newValue = customizer ? customizer(objValue, key, nested) : void 0;

      if (newValue === void 0) {
        newValue = isObject$3(objValue) ? objValue : isIndex$2(path[index + 1]) ? [] : {};
      }
    }

    assignValue$2(nested, key, newValue);
    nested = nested[key];
  }

  return object;
}

var _baseSet = baseSet$1;
var baseGet$1 = _baseGet,
    baseSet = _baseSet,
    castPath$3 = _castPath;

function basePickBy$1(object, paths, predicate) {
  var index = -1,
      length = paths.length,
      result = {};

  while (++index < length) {
    var path = paths[index],
        value = baseGet$1(object, path);

    if (predicate(value, path)) {
      baseSet(result, castPath$3(path, object), value);
    }
  }

  return result;
}

var _basePickBy = basePickBy$1;

function baseHasIn$1(object, key) {
  return object != null && key in Object(object);
}

var _baseHasIn = baseHasIn$1;
var baseGetTag$3 = isObjectLike2443c6ff._baseGetTag,
    isObjectLike$5 = isObjectLike2443c6ff.isObjectLike_1;
var argsTag$2 = "[object Arguments]";

function baseIsArguments$1(value) {
  return isObjectLike$5(value) && baseGetTag$3(value) == argsTag$2;
}

var _baseIsArguments = baseIsArguments$1;
var baseIsArguments = _baseIsArguments,
    isObjectLike$4 = isObjectLike2443c6ff.isObjectLike_1;
var objectProto$7 = Object.prototype;
var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
var isArguments$3 = baseIsArguments(function () {
  return arguments;
}()) ? baseIsArguments : function (value) {
  return isObjectLike$4(value) && hasOwnProperty$5.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
};
var isArguments_1 = isArguments$3;
var castPath$2 = _castPath,
    isArguments$2 = isArguments_1,
    isArray$4 = isArrayB0f0e351.isArray_1,
    isIndex$1 = _isIndex1bf92538._isIndex,
    isLength$1 = _isIndex1bf92538.isLength_1,
    toKey$1 = _toKey;

function hasPath$1(object, path, hasFunc) {
  path = castPath$2(path, object);
  var index = -1,
      length = path.length,
      result = false;

  while (++index < length) {
    var key = toKey$1(path[index]);

    if (!(result = object != null && hasFunc(object, key))) {
      break;
    }

    object = object[key];
  }

  if (result || ++index != length) {
    return result;
  }

  length = object == null ? 0 : object.length;
  return !!length && isLength$1(length) && isIndex$1(key, length) && (isArray$4(object) || isArguments$2(object));
}

var _hasPath = hasPath$1;
var baseHasIn = _baseHasIn,
    hasPath = _hasPath;

function hasIn$1(object, path) {
  return object != null && hasPath(object, path, baseHasIn);
}

var hasIn_1 = hasIn$1;
var basePickBy = _basePickBy,
    hasIn = hasIn_1;

function basePick$1(object, paths) {
  return basePickBy(object, paths, function (value, path) {
    return hasIn(object, path);
  });
}

var _basePick = basePick$1;

function arrayPush$3(array, values) {
  var index = -1,
      length = values.length,
      offset = array.length;

  while (++index < length) {
    array[offset + index] = values[index];
  }

  return array;
}

var _arrayPush = arrayPush$3;
var Symbol$1 = isObjectLike2443c6ff._Symbol,
    isArguments$1 = isArguments_1,
    isArray$3 = isArrayB0f0e351.isArray_1;
var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;

function isFlattenable$1(value) {
  return isArray$3(value) || isArguments$1(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
}

var _isFlattenable = isFlattenable$1;
var arrayPush$2 = _arrayPush,
    isFlattenable = _isFlattenable;

function baseFlatten$1(array, depth, predicate, isStrict, result) {
  var index = -1,
      length = array.length;
  predicate || (predicate = isFlattenable);
  result || (result = []);

  while (++index < length) {
    var value = array[index];

    if (depth > 0 && predicate(value)) {
      if (depth > 1) {
        baseFlatten$1(value, depth - 1, predicate, isStrict, result);
      } else {
        arrayPush$2(result, value);
      }
    } else if (!isStrict) {
      result[result.length] = value;
    }
  }

  return result;
}

var _baseFlatten = baseFlatten$1;
var baseFlatten = _baseFlatten;

function flatten$1(array) {
  var length = array == null ? 0 : array.length;
  return length ? baseFlatten(array, 1) : [];
}

var flatten_1 = flatten$1;

function apply$1(func, thisArg, args) {
  switch (args.length) {
    case 0:
      return func.call(thisArg);

    case 1:
      return func.call(thisArg, args[0]);

    case 2:
      return func.call(thisArg, args[0], args[1]);

    case 3:
      return func.call(thisArg, args[0], args[1], args[2]);
  }

  return func.apply(thisArg, args);
}

var _apply = apply$1;
var apply = _apply;
var nativeMax = Math.max;

function overRest$1(func, start, transform) {
  start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
  return function () {
    var args = arguments,
        index = -1,
        length = nativeMax(args.length - start, 0),
        array = Array(length);

    while (++index < length) {
      array[index] = args[start + index];
    }

    index = -1;
    var otherArgs = Array(start + 1);

    while (++index < start) {
      otherArgs[index] = args[index];
    }

    otherArgs[start] = transform(array);
    return apply(func, this, otherArgs);
  };
}

var _overRest = overRest$1;

function constant$1(value) {
  return function () {
    return value;
  };
}

var constant_1 = constant$1;

function identity$1(value) {
  return value;
}

var identity_1 = identity$1;
var constant = constant_1,
    defineProperty = _defineProperty,
    identity = identity_1;
var baseSetToString$1 = !defineProperty ? identity : function (func, string) {
  return defineProperty(func, "toString", {
    "configurable": true,
    "enumerable": false,
    "value": constant(string),
    "writable": true
  });
};
var _baseSetToString = baseSetToString$1;
var HOT_COUNT = 800,
    HOT_SPAN = 16;
var nativeNow = Date.now;

function shortOut$1(func) {
  var count = 0,
      lastCalled = 0;
  return function () {
    var stamp = nativeNow(),
        remaining = HOT_SPAN - (stamp - lastCalled);
    lastCalled = stamp;

    if (remaining > 0) {
      if (++count >= HOT_COUNT) {
        return arguments[0];
      }
    } else {
      count = 0;
    }

    return func.apply(void 0, arguments);
  };
}

var _shortOut = shortOut$1;
var baseSetToString = _baseSetToString,
    shortOut = _shortOut;
var setToString$1 = shortOut(baseSetToString);
var _setToString = setToString$1;
var flatten = flatten_1,
    overRest = _overRest,
    setToString = _setToString;

function flatRest$2(func) {
  return setToString(overRest(func, void 0, flatten), func + "");
}

var _flatRest = flatRest$2;
var basePick = _basePick,
    flatRest$1 = _flatRest;
var pick = flatRest$1(function (object, paths) {
  return object == null ? {} : basePick(object, paths);
});
var pick_1 = pick;
var ListCache$2 = _ListCache;

function stackClear$1() {
  this.__data__ = new ListCache$2();
  this.size = 0;
}

var _stackClear = stackClear$1;

function stackDelete$1(key) {
  var data = this.__data__,
      result = data["delete"](key);
  this.size = data.size;
  return result;
}

var _stackDelete = stackDelete$1;

function stackGet$1(key) {
  return this.__data__.get(key);
}

var _stackGet = stackGet$1;

function stackHas$1(key) {
  return this.__data__.has(key);
}

var _stackHas = stackHas$1;
var ListCache$1 = _ListCache,
    Map$1 = _Map,
    MapCache = _MapCache;
var LARGE_ARRAY_SIZE = 200;

function stackSet$1(key, value) {
  var data = this.__data__;

  if (data instanceof ListCache$1) {
    var pairs = data.__data__;

    if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE - 1) {
      pairs.push([key, value]);
      this.size = ++data.size;
      return this;
    }

    data = this.__data__ = new MapCache(pairs);
  }

  data.set(key, value);
  this.size = data.size;
  return this;
}

var _stackSet = stackSet$1;
var ListCache = _ListCache,
    stackClear = _stackClear,
    stackDelete = _stackDelete,
    stackGet = _stackGet,
    stackHas = _stackHas,
    stackSet = _stackSet;

function Stack$1(entries) {
  var data = this.__data__ = new ListCache(entries);
  this.size = data.size;
}

Stack$1.prototype.clear = stackClear;
Stack$1.prototype["delete"] = stackDelete;
Stack$1.prototype.get = stackGet;
Stack$1.prototype.has = stackHas;
Stack$1.prototype.set = stackSet;
var _Stack = Stack$1;

function arrayEach$1(array, iteratee) {
  var index = -1,
      length = array == null ? 0 : array.length;

  while (++index < length) {
    if (iteratee(array[index], index, array) === false) {
      break;
    }
  }

  return array;
}

var _arrayEach = arrayEach$1;
var assignValue$1 = _assignValue,
    baseAssignValue = _baseAssignValue;

function copyObject$5(source, props, object, customizer) {
  var isNew = !object;
  object || (object = {});
  var index = -1,
      length = props.length;

  while (++index < length) {
    var key = props[index];
    var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;

    if (newValue === void 0) {
      newValue = source[key];
    }

    if (isNew) {
      baseAssignValue(object, key, newValue);
    } else {
      assignValue$1(object, key, newValue);
    }
  }

  return object;
}

var _copyObject = copyObject$5;

function baseTimes$1(n, iteratee) {
  var index = -1,
      result = Array(n);

  while (++index < n) {
    result[index] = iteratee(index);
  }

  return result;
}

var _baseTimes = baseTimes$1;
var isBuffer$2 = {
  exports: {}
};

function stubFalse() {
  return false;
}

var stubFalse_1 = stubFalse;

(function (module, exports) {
  var root2 = isObjectLike2443c6ff._root,
      stubFalse2 = stubFalse_1;
  var freeExports = exports && !exports.nodeType && exports;
  var freeModule = freeExports && true && module && !module.nodeType && module;
  var moduleExports = freeModule && freeModule.exports === freeExports;
  var Buffer = moduleExports ? root2.Buffer : void 0;
  var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
  var isBuffer2 = nativeIsBuffer || stubFalse2;
  module.exports = isBuffer2;
})(isBuffer$2, isBuffer$2.exports);

var baseGetTag$2 = isObjectLike2443c6ff._baseGetTag,
    isLength = _isIndex1bf92538.isLength_1,
    isObjectLike$3 = isObjectLike2443c6ff.isObjectLike_1;
var argsTag$1 = "[object Arguments]",
    arrayTag$1 = "[object Array]",
    boolTag$2 = "[object Boolean]",
    dateTag$2 = "[object Date]",
    errorTag$1 = "[object Error]",
    funcTag$1 = "[object Function]",
    mapTag$4 = "[object Map]",
    numberTag$2 = "[object Number]",
    objectTag$3 = "[object Object]",
    regexpTag$2 = "[object RegExp]",
    setTag$4 = "[object Set]",
    stringTag$2 = "[object String]",
    weakMapTag$2 = "[object WeakMap]";
var arrayBufferTag$2 = "[object ArrayBuffer]",
    dataViewTag$3 = "[object DataView]",
    float32Tag$2 = "[object Float32Array]",
    float64Tag$2 = "[object Float64Array]",
    int8Tag$2 = "[object Int8Array]",
    int16Tag$2 = "[object Int16Array]",
    int32Tag$2 = "[object Int32Array]",
    uint8Tag$2 = "[object Uint8Array]",
    uint8ClampedTag$2 = "[object Uint8ClampedArray]",
    uint16Tag$2 = "[object Uint16Array]",
    uint32Tag$2 = "[object Uint32Array]";
var typedArrayTags = {};
typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] = typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$2] = typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] = typedArrayTags[weakMapTag$2] = false;

function baseIsTypedArray$1(value) {
  return isObjectLike$3(value) && isLength(value.length) && !!typedArrayTags[baseGetTag$2(value)];
}

var _baseIsTypedArray = baseIsTypedArray$1;

function baseUnary$3(func) {
  return function (value) {
    return func(value);
  };
}

var _baseUnary = baseUnary$3;
var _nodeUtil = {
  exports: {}
};

(function (module, exports) {
  var freeGlobal = isObjectLike2443c6ff._freeGlobal;
  var freeExports = exports && !exports.nodeType && exports;
  var freeModule = freeExports && true && module && !module.nodeType && module;
  var moduleExports = freeModule && freeModule.exports === freeExports;
  var freeProcess = moduleExports && freeGlobal.process;

  var nodeUtil2 = function () {
    try {
      var types = freeModule && freeModule.require && freeModule.require("util").types;

      if (types) {
        return types;
      }

      return freeProcess && freeProcess.binding && freeProcess.binding("util");
    } catch (e) {}
  }();

  module.exports = nodeUtil2;
})(_nodeUtil, _nodeUtil.exports);

var baseIsTypedArray = _baseIsTypedArray,
    baseUnary$2 = _baseUnary,
    nodeUtil$2 = _nodeUtil.exports;
var nodeIsTypedArray = nodeUtil$2 && nodeUtil$2.isTypedArray;
var isTypedArray$1 = nodeIsTypedArray ? baseUnary$2(nodeIsTypedArray) : baseIsTypedArray;
var isTypedArray_1 = isTypedArray$1;
var baseTimes = _baseTimes,
    isArguments = isArguments_1,
    isArray$2 = isArrayB0f0e351.isArray_1,
    isBuffer$1 = isBuffer$2.exports,
    isIndex = _isIndex1bf92538._isIndex,
    isTypedArray = isTypedArray_1;
var objectProto$6 = Object.prototype;
var hasOwnProperty$4 = objectProto$6.hasOwnProperty;

function arrayLikeKeys$2(value, inherited) {
  var isArr = isArray$2(value),
      isArg = !isArr && isArguments(value),
      isBuff = !isArr && !isArg && isBuffer$1(value),
      isType = !isArr && !isArg && !isBuff && isTypedArray(value),
      skipIndexes = isArr || isArg || isBuff || isType,
      result = skipIndexes ? baseTimes(value.length, String) : [],
      length = result.length;

  for (var key in value) {
    if ((inherited || hasOwnProperty$4.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
      result.push(key);
    }
  }

  return result;
}

var _arrayLikeKeys = arrayLikeKeys$2;
var objectProto$5 = Object.prototype;

function isPrototype$3(value) {
  var Ctor = value && value.constructor,
      proto = typeof Ctor == "function" && Ctor.prototype || objectProto$5;
  return value === proto;
}

var _isPrototype = isPrototype$3;

function overArg$2(func, transform) {
  return function (arg) {
    return func(transform(arg));
  };
}

var _overArg = overArg$2;
var overArg$1 = _overArg;
var nativeKeys$1 = overArg$1(Object.keys, Object);
var _nativeKeys = nativeKeys$1;
var isPrototype$2 = _isPrototype,
    nativeKeys = _nativeKeys;
var objectProto$4 = Object.prototype;
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;

function baseKeys$1(object) {
  if (!isPrototype$2(object)) {
    return nativeKeys(object);
  }

  var result = [];

  for (var key in Object(object)) {
    if (hasOwnProperty$3.call(object, key) && key != "constructor") {
      result.push(key);
    }
  }

  return result;
}

var _baseKeys = baseKeys$1;
var arrayLikeKeys$1 = _arrayLikeKeys,
    baseKeys = _baseKeys,
    isArrayLike$1 = _isIndex1bf92538.isArrayLike_1;

function keys$3(object) {
  return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys(object);
}

var keys_1 = keys$3;
var copyObject$4 = _copyObject,
    keys$2 = keys_1;

function baseAssign$1(object, source) {
  return object && copyObject$4(source, keys$2(source), object);
}

var _baseAssign = baseAssign$1;

function nativeKeysIn$1(object) {
  var result = [];

  if (object != null) {
    for (var key in Object(object)) {
      result.push(key);
    }
  }

  return result;
}

var _nativeKeysIn = nativeKeysIn$1;
var isObject$2 = _isIndex1bf92538.isObject_1,
    isPrototype$1 = _isPrototype,
    nativeKeysIn = _nativeKeysIn;
var objectProto$3 = Object.prototype;
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;

function baseKeysIn$1(object) {
  if (!isObject$2(object)) {
    return nativeKeysIn(object);
  }

  var isProto = isPrototype$1(object),
      result = [];

  for (var key in object) {
    if (!(key == "constructor" && (isProto || !hasOwnProperty$2.call(object, key)))) {
      result.push(key);
    }
  }

  return result;
}

var _baseKeysIn = baseKeysIn$1;
var arrayLikeKeys = _arrayLikeKeys,
    baseKeysIn = _baseKeysIn,
    isArrayLike = _isIndex1bf92538.isArrayLike_1;

function keysIn$3(object) {
  return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
}

var keysIn_1 = keysIn$3;
var copyObject$3 = _copyObject,
    keysIn$2 = keysIn_1;

function baseAssignIn$1(object, source) {
  return object && copyObject$3(source, keysIn$2(source), object);
}

var _baseAssignIn = baseAssignIn$1;
var _cloneBuffer = {
  exports: {}
};

(function (module, exports) {
  var root2 = isObjectLike2443c6ff._root;
  var freeExports = exports && !exports.nodeType && exports;
  var freeModule = freeExports && true && module && !module.nodeType && module;
  var moduleExports = freeModule && freeModule.exports === freeExports;
  var Buffer = moduleExports ? root2.Buffer : void 0,
      allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;

  function cloneBuffer2(buffer, isDeep) {
    if (isDeep) {
      return buffer.slice();
    }

    var length = buffer.length,
        result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
    buffer.copy(result);
    return result;
  }

  module.exports = cloneBuffer2;
})(_cloneBuffer, _cloneBuffer.exports);

function copyArray$1(source, array) {
  var index = -1,
      length = source.length;
  array || (array = Array(length));

  while (++index < length) {
    array[index] = source[index];
  }

  return array;
}

var _copyArray = copyArray$1;

function arrayFilter$1(array, predicate) {
  var index = -1,
      length = array == null ? 0 : array.length,
      resIndex = 0,
      result = [];

  while (++index < length) {
    var value = array[index];

    if (predicate(value, index, array)) {
      result[resIndex++] = value;
    }
  }

  return result;
}

var _arrayFilter = arrayFilter$1;

function stubArray$2() {
  return [];
}

var stubArray_1 = stubArray$2;
var arrayFilter = _arrayFilter,
    stubArray$1 = stubArray_1;
var objectProto$2 = Object.prototype;
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
var getSymbols$3 = !nativeGetSymbols$1 ? stubArray$1 : function (object) {
  if (object == null) {
    return [];
  }

  object = Object(object);
  return arrayFilter(nativeGetSymbols$1(object), function (symbol) {
    return propertyIsEnumerable.call(object, symbol);
  });
};
var _getSymbols = getSymbols$3;
var copyObject$2 = _copyObject,
    getSymbols$2 = _getSymbols;

function copySymbols$1(source, object) {
  return copyObject$2(source, getSymbols$2(source), object);
}

var _copySymbols = copySymbols$1;
var overArg = _overArg;
var getPrototype$3 = overArg(Object.getPrototypeOf, Object);
var _getPrototype = getPrototype$3;
var arrayPush$1 = _arrayPush,
    getPrototype$2 = _getPrototype,
    getSymbols$1 = _getSymbols,
    stubArray = stubArray_1;
var nativeGetSymbols = Object.getOwnPropertySymbols;
var getSymbolsIn$2 = !nativeGetSymbols ? stubArray : function (object) {
  var result = [];

  while (object) {
    arrayPush$1(result, getSymbols$1(object));
    object = getPrototype$2(object);
  }

  return result;
};
var _getSymbolsIn = getSymbolsIn$2;
var copyObject$1 = _copyObject,
    getSymbolsIn$1 = _getSymbolsIn;

function copySymbolsIn$1(source, object) {
  return copyObject$1(source, getSymbolsIn$1(source), object);
}

var _copySymbolsIn = copySymbolsIn$1;
var arrayPush = _arrayPush,
    isArray$1 = isArrayB0f0e351.isArray_1;

function baseGetAllKeys$2(object, keysFunc, symbolsFunc) {
  var result = keysFunc(object);
  return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
}

var _baseGetAllKeys = baseGetAllKeys$2;
var baseGetAllKeys$1 = _baseGetAllKeys,
    getSymbols = _getSymbols,
    keys$1 = keys_1;

function getAllKeys$1(object) {
  return baseGetAllKeys$1(object, keys$1, getSymbols);
}

var _getAllKeys = getAllKeys$1;
var baseGetAllKeys = _baseGetAllKeys,
    getSymbolsIn = _getSymbolsIn,
    keysIn$1 = keysIn_1;

function getAllKeysIn$2(object) {
  return baseGetAllKeys(object, keysIn$1, getSymbolsIn);
}

var _getAllKeysIn = getAllKeysIn$2;
var getNative$3 = _getNative,
    root$4 = isObjectLike2443c6ff._root;
var DataView$1 = getNative$3(root$4, "DataView");
var _DataView = DataView$1;
var getNative$2 = _getNative,
    root$3 = isObjectLike2443c6ff._root;
var Promise$2 = getNative$2(root$3, "Promise");
var _Promise = Promise$2;
var getNative$1 = _getNative,
    root$2 = isObjectLike2443c6ff._root;
var Set$1 = getNative$1(root$2, "Set");
var _Set = Set$1;
var getNative = _getNative,
    root$1 = isObjectLike2443c6ff._root;
var WeakMap$1 = getNative(root$1, "WeakMap");
var _WeakMap = WeakMap$1;
var DataView = _DataView,
    Map$2 = _Map,
    Promise$1 = _Promise,
    Set = _Set,
    WeakMap = _WeakMap,
    baseGetTag$1 = isObjectLike2443c6ff._baseGetTag,
    toSource = _toSource;
var mapTag$3 = "[object Map]",
    objectTag$2 = "[object Object]",
    promiseTag = "[object Promise]",
    setTag$3 = "[object Set]",
    weakMapTag$1 = "[object WeakMap]";
var dataViewTag$2 = "[object DataView]";
var dataViewCtorString = toSource(DataView),
    mapCtorString = toSource(Map$2),
    promiseCtorString = toSource(Promise$1),
    setCtorString = toSource(Set),
    weakMapCtorString = toSource(WeakMap);
var getTag$3 = baseGetTag$1;

if (DataView && getTag$3(new DataView(new ArrayBuffer(1))) != dataViewTag$2 || Map$2 && getTag$3(new Map$2()) != mapTag$3 || Promise$1 && getTag$3(Promise$1.resolve()) != promiseTag || Set && getTag$3(new Set()) != setTag$3 || WeakMap && getTag$3(new WeakMap()) != weakMapTag$1) {
  getTag$3 = function getTag2(value) {
    var result = baseGetTag$1(value),
        Ctor = result == objectTag$2 ? value.constructor : void 0,
        ctorString = Ctor ? toSource(Ctor) : "";

    if (ctorString) {
      switch (ctorString) {
        case dataViewCtorString:
          return dataViewTag$2;

        case mapCtorString:
          return mapTag$3;

        case promiseCtorString:
          return promiseTag;

        case setCtorString:
          return setTag$3;

        case weakMapCtorString:
          return weakMapTag$1;
      }
    }

    return result;
  };
}

var _getTag = getTag$3;
var objectProto$1 = Object.prototype;
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;

function initCloneArray$1(array) {
  var length = array.length,
      result = new array.constructor(length);

  if (length && typeof array[0] == "string" && hasOwnProperty$1.call(array, "index")) {
    result.index = array.index;
    result.input = array.input;
  }

  return result;
}

var _initCloneArray = initCloneArray$1;
var root = isObjectLike2443c6ff._root;
var Uint8Array$1 = root.Uint8Array;
var _Uint8Array = Uint8Array$1;
var Uint8Array = _Uint8Array;

function cloneArrayBuffer$3(arrayBuffer) {
  var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  return result;
}

var _cloneArrayBuffer = cloneArrayBuffer$3;
var cloneArrayBuffer$2 = _cloneArrayBuffer;

function cloneDataView$1(dataView, isDeep) {
  var buffer = isDeep ? cloneArrayBuffer$2(dataView.buffer) : dataView.buffer;
  return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}

var _cloneDataView = cloneDataView$1;
var reFlags = /\w*$/;

function cloneRegExp$1(regexp) {
  var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  result.lastIndex = regexp.lastIndex;
  return result;
}

var _cloneRegExp = cloneRegExp$1;
var _Symbol2 = isObjectLike2443c6ff._Symbol;
var symbolProto = _Symbol2 ? _Symbol2.prototype : void 0,
    symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;

function cloneSymbol$1(symbol) {
  return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
}

var _cloneSymbol = cloneSymbol$1;
var cloneArrayBuffer$1 = _cloneArrayBuffer;

function cloneTypedArray$1(typedArray, isDeep) {
  var buffer = isDeep ? cloneArrayBuffer$1(typedArray.buffer) : typedArray.buffer;
  return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}

var _cloneTypedArray = cloneTypedArray$1;
var cloneArrayBuffer = _cloneArrayBuffer,
    cloneDataView = _cloneDataView,
    cloneRegExp = _cloneRegExp,
    cloneSymbol = _cloneSymbol,
    cloneTypedArray = _cloneTypedArray;
var boolTag$1 = "[object Boolean]",
    dateTag$1 = "[object Date]",
    mapTag$2 = "[object Map]",
    numberTag$1 = "[object Number]",
    regexpTag$1 = "[object RegExp]",
    setTag$2 = "[object Set]",
    stringTag$1 = "[object String]",
    symbolTag$1 = "[object Symbol]";
var arrayBufferTag$1 = "[object ArrayBuffer]",
    dataViewTag$1 = "[object DataView]",
    float32Tag$1 = "[object Float32Array]",
    float64Tag$1 = "[object Float64Array]",
    int8Tag$1 = "[object Int8Array]",
    int16Tag$1 = "[object Int16Array]",
    int32Tag$1 = "[object Int32Array]",
    uint8Tag$1 = "[object Uint8Array]",
    uint8ClampedTag$1 = "[object Uint8ClampedArray]",
    uint16Tag$1 = "[object Uint16Array]",
    uint32Tag$1 = "[object Uint32Array]";

function initCloneByTag$1(object, tag, isDeep) {
  var Ctor = object.constructor;

  switch (tag) {
    case arrayBufferTag$1:
      return cloneArrayBuffer(object);

    case boolTag$1:
    case dateTag$1:
      return new Ctor(+object);

    case dataViewTag$1:
      return cloneDataView(object, isDeep);

    case float32Tag$1:
    case float64Tag$1:
    case int8Tag$1:
    case int16Tag$1:
    case int32Tag$1:
    case uint8Tag$1:
    case uint8ClampedTag$1:
    case uint16Tag$1:
    case uint32Tag$1:
      return cloneTypedArray(object, isDeep);

    case mapTag$2:
      return new Ctor();

    case numberTag$1:
    case stringTag$1:
      return new Ctor(object);

    case regexpTag$1:
      return cloneRegExp(object);

    case setTag$2:
      return new Ctor();

    case symbolTag$1:
      return cloneSymbol(object);
  }
}

var _initCloneByTag = initCloneByTag$1;
var isObject$1 = _isIndex1bf92538.isObject_1;
var objectCreate = Object.create;

var baseCreate$1 = function () {
  function object() {}

  return function (proto) {
    if (!isObject$1(proto)) {
      return {};
    }

    if (objectCreate) {
      return objectCreate(proto);
    }

    object.prototype = proto;
    var result = new object();
    object.prototype = void 0;
    return result;
  };
}();

var _baseCreate = baseCreate$1;
var baseCreate = _baseCreate,
    getPrototype$1 = _getPrototype,
    isPrototype = _isPrototype;

function initCloneObject$1(object) {
  return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype$1(object)) : {};
}

var _initCloneObject = initCloneObject$1;
var getTag$2 = _getTag,
    isObjectLike$2 = isObjectLike2443c6ff.isObjectLike_1;
var mapTag$1 = "[object Map]";

function baseIsMap$1(value) {
  return isObjectLike$2(value) && getTag$2(value) == mapTag$1;
}

var _baseIsMap = baseIsMap$1;
var baseIsMap = _baseIsMap,
    baseUnary$1 = _baseUnary,
    nodeUtil$1 = _nodeUtil.exports;
var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
var isMap$1 = nodeIsMap ? baseUnary$1(nodeIsMap) : baseIsMap;
var isMap_1 = isMap$1;
var getTag$1 = _getTag,
    isObjectLike$1 = isObjectLike2443c6ff.isObjectLike_1;
var setTag$1 = "[object Set]";

function baseIsSet$1(value) {
  return isObjectLike$1(value) && getTag$1(value) == setTag$1;
}

var _baseIsSet = baseIsSet$1;
var baseIsSet = _baseIsSet,
    baseUnary = _baseUnary,
    nodeUtil = _nodeUtil.exports;
var nodeIsSet = nodeUtil && nodeUtil.isSet;
var isSet$1 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
var isSet_1 = isSet$1;
var Stack = _Stack,
    arrayEach = _arrayEach,
    assignValue = _assignValue,
    baseAssign = _baseAssign,
    baseAssignIn = _baseAssignIn,
    cloneBuffer = _cloneBuffer.exports,
    copyArray = _copyArray,
    copySymbols = _copySymbols,
    copySymbolsIn = _copySymbolsIn,
    getAllKeys = _getAllKeys,
    getAllKeysIn$1 = _getAllKeysIn,
    getTag = _getTag,
    initCloneArray = _initCloneArray,
    initCloneByTag = _initCloneByTag,
    initCloneObject = _initCloneObject,
    isArray = isArrayB0f0e351.isArray_1,
    isBuffer = isBuffer$2.exports,
    isMap = isMap_1,
    isObject = _isIndex1bf92538.isObject_1,
    isSet = isSet_1,
    keys = keys_1,
    keysIn = keysIn_1;
var CLONE_DEEP_FLAG$1 = 1,
    CLONE_FLAT_FLAG$1 = 2,
    CLONE_SYMBOLS_FLAG$1 = 4;
var argsTag = "[object Arguments]",
    arrayTag = "[object Array]",
    boolTag = "[object Boolean]",
    dateTag = "[object Date]",
    errorTag = "[object Error]",
    funcTag = "[object Function]",
    genTag = "[object GeneratorFunction]",
    mapTag = "[object Map]",
    numberTag = "[object Number]",
    objectTag$1 = "[object Object]",
    regexpTag = "[object RegExp]",
    setTag = "[object Set]",
    stringTag = "[object String]",
    symbolTag = "[object Symbol]",
    weakMapTag = "[object WeakMap]";
var arrayBufferTag = "[object ArrayBuffer]",
    dataViewTag = "[object DataView]",
    float32Tag = "[object Float32Array]",
    float64Tag = "[object Float64Array]",
    int8Tag = "[object Int8Array]",
    int16Tag = "[object Int16Array]",
    int32Tag = "[object Int32Array]",
    uint8Tag = "[object Uint8Array]",
    uint8ClampedTag = "[object Uint8ClampedArray]",
    uint16Tag = "[object Uint16Array]",
    uint32Tag = "[object Uint32Array]";
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag$1] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;

function baseClone$1(value, bitmask, customizer, key, object, stack) {
  var result,
      isDeep = bitmask & CLONE_DEEP_FLAG$1,
      isFlat = bitmask & CLONE_FLAT_FLAG$1,
      isFull = bitmask & CLONE_SYMBOLS_FLAG$1;

  if (customizer) {
    result = object ? customizer(value, key, object, stack) : customizer(value);
  }

  if (result !== void 0) {
    return result;
  }

  if (!isObject(value)) {
    return value;
  }

  var isArr = isArray(value);

  if (isArr) {
    result = initCloneArray(value);

    if (!isDeep) {
      return copyArray(value, result);
    }
  } else {
    var tag = getTag(value),
        isFunc = tag == funcTag || tag == genTag;

    if (isBuffer(value)) {
      return cloneBuffer(value, isDeep);
    }

    if (tag == objectTag$1 || tag == argsTag || isFunc && !object) {
      result = isFlat || isFunc ? {} : initCloneObject(value);

      if (!isDeep) {
        return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
      }
    } else {
      if (!cloneableTags[tag]) {
        return object ? value : {};
      }

      result = initCloneByTag(value, tag, isDeep);
    }
  }

  stack || (stack = new Stack());
  var stacked = stack.get(value);

  if (stacked) {
    return stacked;
  }

  stack.set(value, result);

  if (isSet(value)) {
    value.forEach(function (subValue) {
      result.add(baseClone$1(subValue, bitmask, customizer, subValue, value, stack));
    });
  } else if (isMap(value)) {
    value.forEach(function (subValue, key2) {
      result.set(key2, baseClone$1(subValue, bitmask, customizer, key2, value, stack));
    });
  }

  var keysFunc = isFull ? isFlat ? getAllKeysIn$1 : getAllKeys : isFlat ? keysIn : keys;
  var props = isArr ? void 0 : keysFunc(value);
  arrayEach(props || value, function (subValue, key2) {
    if (props) {
      key2 = subValue;
      subValue = value[key2];
    }

    assignValue(result, key2, baseClone$1(subValue, bitmask, customizer, key2, value, stack));
  });
  return result;
}

var _baseClone = baseClone$1;

function last$1(array) {
  var length = array == null ? 0 : array.length;
  return length ? array[length - 1] : void 0;
}

var last_1 = last$1;
var baseGet$2 = _baseGet,
    baseSlice = _isIndex1bf92538._baseSlice;

function parent$1(object, path) {
  return path.length < 2 ? object : baseGet$2(object, baseSlice(path, 0, -1));
}

var _parent = parent$1;
var castPath$1 = _castPath,
    last = last_1,
    parent = _parent,
    toKey = _toKey;

function baseUnset$1(object, path) {
  path = castPath$1(path, object);
  object = parent(object, path);
  return object == null || delete object[toKey(last(path))];
}

var _baseUnset = baseUnset$1;
var baseGetTag = isObjectLike2443c6ff._baseGetTag,
    getPrototype = _getPrototype,
    isObjectLike = isObjectLike2443c6ff.isObjectLike_1;
var objectTag = "[object Object]";
var funcProto = Function.prototype,
    objectProto = Object.prototype;
var funcToString = funcProto.toString;
var hasOwnProperty$7 = objectProto.hasOwnProperty;
var objectCtorString = funcToString.call(Object);

function isPlainObject$1(value) {
  if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
    return false;
  }

  var proto = getPrototype(value);

  if (proto === null) {
    return true;
  }

  var Ctor = hasOwnProperty$7.call(proto, "constructor") && proto.constructor;
  return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
}

var isPlainObject_1 = isPlainObject$1;
var isPlainObject = isPlainObject_1;

function customOmitClone$1(value) {
  return isPlainObject(value) ? void 0 : value;
}

var _customOmitClone = customOmitClone$1;
var arrayMap = _arrayMap,
    baseClone = _baseClone,
    baseUnset = _baseUnset,
    castPath = _castPath,
    copyObject = _copyObject,
    customOmitClone = _customOmitClone,
    flatRest = _flatRest,
    getAllKeysIn = _getAllKeysIn;
var CLONE_DEEP_FLAG = 1,
    CLONE_FLAT_FLAG = 2,
    CLONE_SYMBOLS_FLAG = 4;
var omit = flatRest(function (object, paths) {
  var result = {};

  if (object == null) {
    return result;
  }

  var isDeep = false;
  paths = arrayMap(paths, function (path) {
    path = castPath(path, object);
    isDeep || (isDeep = path.length > 1);
    return path;
  });
  copyObject(object, getAllKeysIn(object), result);

  if (isDeep) {
    result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  }

  var length = paths.length;

  while (length--) {
    baseUnset(result, paths[length]);
  }

  return result;
});
var omit_1 = omit;

function ownKeys$1(object, enumerableOnly) {
  var keys2 = Object.keys(object);

  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object);
    enumerableOnly && (symbols = symbols.filter(function (sym) {
      return Object.getOwnPropertyDescriptor(object, sym).enumerable;
    })), keys2.push.apply(keys2, symbols);
  }

  return keys2;
}

function _objectSpread$1(target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = null != arguments[i] ? arguments[i] : {};
    i % 2 ? ownKeys$1(Object(source), true).forEach(function (key) {
      defineProperty28395935._defineProperty(target, key, source[key]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
      Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
    });
  }

  return target;
}

function getExposedProps(node) {
  var props = pick_1(node, ["value", "label", "data", "actived", "expanded", "checked", "indeterminate", "loading"]);
  return props;
}

function createNodeModel(node) {
  var props = getExposedProps(node);

  var model = _objectSpread$1(_objectSpread$1({}, props), {}, {
    getLevel: function getLevel() {
      return node.getLevel();
    },
    getIndex: function getIndex() {
      return node.getIndex();
    },
    isFirst: function isFirst() {
      return node.isFirst();
    },
    isLast: function isLast() {
      return node.isLast();
    },
    isLeaf: function isLeaf() {
      return node.isLeaf();
    },
    insertBefore: function insertBefore(newData) {
      return node.insertBefore(newData);
    },
    insertAfter: function insertAfter(newData) {
      return node.insertAfter(newData);
    },
    appendData: function appendData(data) {
      return node.append(data);
    },
    getPath: function getPath() {
      var nodes = node.getPath();
      return nodes.map(function (item) {
        return item.getModel();
      });
    },
    getParent: function getParent() {
      var _node$parent;

      return (_node$parent = node.parent) === null || _node$parent === void 0 ? void 0 : _node$parent.getModel();
    },
    getParents: function getParents() {
      var nodes = node.getParents();
      return nodes.map(function (item) {
        return item.getModel();
      });
    },
    getRoot: function getRoot() {
      var root2 = node.getRoot();
      return root2 === null || root2 === void 0 ? void 0 : root2.getModel();
    },
    getSiblings: function getSiblings() {
      var nodes = node.getSiblings();
      return nodes.map(function (item) {
        return item.getModel();
      });
    },
    getChildren: function getChildren(deep) {
      var childrenModel = false;
      var children = node.children;

      if (Array.isArray(children)) {
        if (children.length > 0) {
          if (deep) {
            var nodes = node.walk();
            nodes.shift();
            childrenModel = nodes.map(function (item) {
              return item.getModel();
            });
          } else {
            childrenModel = children.map(function (item) {
              return item.getModel();
            });
          }
        } else {
          childrenModel = false;
        }
      } else if (typeof children === "boolean") {
        childrenModel = children;
      }

      return childrenModel;
    },
    remove: function remove(value) {
      if (!value) {
        node.remove();
        return;
      }

      var tree = node.tree;
      var targetNode = tree.getNode(value);

      if (!targetNode) {
        log.log.warnOnce("Tree", "`".concat(value, "` is not exist"));
        return;
      }

      var parents = targetNode.getParents();
      var parentValues = parents.map(function (pnode) {
        return pnode.value;
      });

      if (parentValues.indexOf(node.value) < 0) {
        log.log.warnOnce("Tree", "`".concat(value, "` is not a childNode of current node"));
        return;
      }

      targetNode.remove();
    },
    setData: function setData(data) {
      var _data = omit_1(data, ["children", "value", "label"]);

      var keys2 = node.tree.config.keys;
      var dataValue = data[(keys2 === null || keys2 === void 0 ? void 0 : keys2.value) || "value"];
      var dataLabel = data[(keys2 === null || keys2 === void 0 ? void 0 : keys2.label) || "label"];
      if (dataValue !== void 0) _data.value = dataValue;
      if (dataLabel !== void 0) _data.label = dataLabel;
      Object.assign(node.data, _data);
      Object.assign(node, _data);
    }
  });

  return model;
}

function updateNodeModel(model, node) {
  var props = getExposedProps(node);
  Object.assign(model, props);
}

/**
 * LDesignUtility v0.1.1
 * (c) 2022 undefined
 * @license MIT
 */
var baseGet = _baseGet;

function get(object, path, defaultValue) {
  var result = object == null ? void 0 : baseGet(object, path);
  return result === void 0 ? defaultValue : result;
}

var get_1 = get;

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  try {
    var info = gen[key](arg);
    var value = info.value;
  } catch (error) {
    reject(error);
    return;
  }

  if (info.done) {
    resolve(value);
  } else {
    Promise.resolve(value).then(_next, _throw);
  }
}

function _asyncToGenerator(fn) {
  return function () {
    var self = this,
        args = arguments;
    return new Promise(function (resolve, reject) {
      var gen = fn.apply(self, args);

      function _next(value) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
      }

      function _throw(err) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
      }

      _next(void 0);
    });
  };
}

var toString = toString_1;
var idCounter = 0;

function uniqueId(prefix) {
  var id = ++idCounter;
  return toString(prefix) + id;
}

var uniqueId_1 = uniqueId;

function isNil(value) {
  return value == null;
}

var isNil_1 = isNil;

function ownKeys(object, enumerableOnly) {
  var keys = Object.keys(object);

  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object);
    enumerableOnly && (symbols = symbols.filter(function (sym) {
      return Object.getOwnPropertyDescriptor(object, sym).enumerable;
    })), keys.push.apply(keys, symbols);
  }

  return keys;
}

function _objectSpread(target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = null != arguments[i] ? arguments[i] : {};
    i % 2 ? ownKeys(Object(source), true).forEach(function (key) {
      defineProperty28395935._defineProperty(target, key, source[key]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
      Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
    });
  }

  return target;
}

var hasOwnProperty = Object.prototype.hasOwnProperty;
var defaultStatus = {
  expandMutex: false,
  activable: false,
  checkable: false,
  disabled: false,
  draggable: false,
  loading: false
};

var TreeNode = /*#__PURE__*/function () {
  function TreeNode(tree, data, parent) {
    _classCallCheck__default["default"](this, TreeNode);

    defineProperty28395935._defineProperty(this, "tree", void 0);

    defineProperty28395935._defineProperty(this, "value", void 0);

    defineProperty28395935._defineProperty(this, "label", void 0);

    defineProperty28395935._defineProperty(this, "data", void 0);

    defineProperty28395935._defineProperty(this, "parent", void 0);

    defineProperty28395935._defineProperty(this, "children", void 0);

    defineProperty28395935._defineProperty(this, "model", void 0);

    defineProperty28395935._defineProperty(this, "vmIsLeaf", void 0);

    defineProperty28395935._defineProperty(this, "vmIsFirst", void 0);

    defineProperty28395935._defineProperty(this, "vmIsLast", void 0);

    defineProperty28395935._defineProperty(this, "vmIsRest", void 0);

    defineProperty28395935._defineProperty(this, "vmIsLocked", void 0);

    defineProperty28395935._defineProperty(this, "expanded", void 0);

    defineProperty28395935._defineProperty(this, "expandMutex", void 0);

    defineProperty28395935._defineProperty(this, "actived", void 0);

    defineProperty28395935._defineProperty(this, "activable", void 0);

    defineProperty28395935._defineProperty(this, "checkable", void 0);

    defineProperty28395935._defineProperty(this, "vmCheckable", void 0);

    defineProperty28395935._defineProperty(this, "checked", void 0);

    defineProperty28395935._defineProperty(this, "indeterminate", void 0);

    defineProperty28395935._defineProperty(this, "disabled", void 0);

    defineProperty28395935._defineProperty(this, "draggable", void 0);

    defineProperty28395935._defineProperty(this, "visible", void 0);

    defineProperty28395935._defineProperty(this, "level", void 0);

    defineProperty28395935._defineProperty(this, "loading", void 0);

    this.data = data;
    this.tree = tree;
    var config = tree.config || {};
    var prefix = config.prefix || "t";
    var keys = get_1(tree, "config.keys") || {};
    var propChildren = keys.children || "children";
    var propLabel = keys.label || "label";
    var propValue = keys.value || "value";
    this.model = null;
    this.children = null;
    this.vmCheckable = false;
    this.vmIsLeaf = false;
    this.vmIsFirst = false;
    this.vmIsLast = false;
    this.vmIsRest = true;
    this.vmIsLocked = false;

    var spec = _objectSpread(_objectSpread({}, defaultStatus), {}, {
      actived: false,
      expanded: false,
      checked: false
    }, data);

    var children = spec[propChildren];
    this.set(spec);
    this.label = spec[propLabel] || "";
    this.value = isNil_1(spec[propValue]) ? uniqueId_1(prefix) : spec[propValue];
    this.tree.nodeMap.set(this.value, this);

    if (parent && parent instanceof TreeNode) {
      this.parent = parent;
    } else {
      this.parent = null;
    }

    if (children === true) {
      this.children = children;
    }

    this.level = 0;
    this.visible = true;
    this.actived = spec.actived;
    this.initActived();
    this.expanded = spec.expanded;
    this.initExpanded();
    this.checked = spec.checked;
    this.initChecked();
    this.update();
    tree.reflow(this);

    if (Array.isArray(children)) {
      this.append(children);
    } else if (children === true && !config.lazy) {
      this.loadChildren();
    }

    this.checked = false;
    this.indeterminate = false;
    this.updateChecked();
  }

  _createClass__default["default"](TreeNode, [{
    key: "initChecked",
    value: function initChecked() {
      var tree = this.tree,
          value = this.value,
          parent = this.parent;
      var checkStrictly = tree.config.checkStrictly;
      var checked = this.checked;
      checked = parent === null || parent === void 0 ? void 0 : parent.isChecked();

      if (checked && !checkStrictly) {
        tree.checkedMap.set(value, true);
      }

      this.checked = checked;
    }
  }, {
    key: "initExpanded",
    value: function initExpanded() {
      var tree = this.tree;
      var expanded = this.expanded;
      var config = tree.config;

      if (typeof config.expandLevel === "number" && this.getLevel() < config.expandLevel) {
        tree.expandedMap.set(this.value, true);
        expanded = true;
      }

      if (config.expandAll) {
        expanded = true;
      }

      if (this.children === true && config.lazy) {
        expanded = false;
      }

      if (expanded) {
        tree.expandedMap.set(this.value, true);
      } else {
        tree.expandedMap["delete"](this.value);
      }

      this.expanded = expanded;
    }
  }, {
    key: "initActived",
    value: function initActived() {
      var tree = this.tree,
          actived = this.actived;

      if (actived) {
        tree.activedMap.set(this.value, true);
      }
    }
  }, {
    key: "append",
    value: function append(data) {
      var _this2 = this;

      var list = [];

      if (!Array.isArray(data)) {
        list.push(data);
      } else {
        list.push.apply(list, _toConsumableArray__default["default"](data));
      }

      if (list.length <= 0) {
        return;
      }

      if (!Array.isArray(this.children)) {
        this.children = [];
      }

      var children = this.children,
          tree = this.tree;
      list.forEach(function (item) {
        var node = null;

        if (item instanceof TreeNode) {
          node = item;
          node.appendTo(_this2.tree, _this2);
        } else {
          node = new TreeNode(_this2.tree, item, _this2);
          children.push(node);
        }
      });
      tree.reflow(this);
      this.updateRelated();
    }
  }, {
    key: "appendTo",
    value: function appendTo(tree, parent, index) {
      var _this3 = this;

      var parentNode = parent;
      var targetIndex = -1;

      if (typeof index === "number") {
        targetIndex = index;
      }

      var targetParents = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.getParents()) || [];
      var includeCurrent = targetParents.some(function (pnode) {
        return pnode === _this3;
      });

      if (includeCurrent) {
        throw new Error("\u65E0\u6CD5\u5C06\u7236\u8282\u70B9\u63D2\u5165\u5230\u5B50\u8282\u70B9");
      }

      if (Array.isArray(parentNode === null || parentNode === void 0 ? void 0 : parentNode.children)) {
        var targetPosNode = parentNode === null || parentNode === void 0 ? void 0 : parentNode.children[targetIndex];

        if (targetPosNode && targetPosNode === this) {
          return;
        }
      }

      var siblings = null;

      if (parentNode instanceof TreeNode) {
        if (!Array.isArray(parentNode === null || parentNode === void 0 ? void 0 : parentNode.children)) {
          parentNode.children = [];
        }

        siblings = parent.children;
      } else {
        siblings = tree.children;
      }

      if (!Array.isArray(siblings)) {
        throw new Error("\u65E0\u6CD5\u63D2\u5165\u5230\u76EE\u6807\u4F4D\u7F6E\uFF0C\u53EF\u63D2\u5165\u7684\u8282\u70B9\u5217\u8868\u4E0D\u5B58\u5728");
      }

      var prevLength = siblings.length;
      var prevIndex = this.getIndex();
      this.remove();

      if (typeof index === "number") {
        var targetIndex2 = index;

        if (parentNode === this.parent) {
          var curLength = siblings.length;

          if (curLength < prevLength && prevIndex <= targetIndex2) {
            targetIndex2 -= 1;
          }
        }

        siblings.splice(targetIndex2, 0, this);
      } else {
        siblings.push(this);
      }

      this.parent = parentNode;
      var nodes = this.walk();
      nodes.forEach(function (item) {
        var node = item;
        node.tree = tree;
        tree.nodeMap.set(node.value, node);

        if (node.expanded) {
          tree.expandedMap.set(node.value, true);
        }
      });
      var updateNodes = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.walk()) || tree.children.map(function (item) {
        return item.walk();
      }).flat();
      updateNodes.forEach(function (node) {
        node.update();
        node.updateChecked();
      });
      tree.reflow();
    }
  }, {
    key: "insert",
    value: function insert(item, index) {
      var tree = this.tree,
          parent = this.parent;
      var siblings = this.getSiblings();
      var node = null;

      if (item instanceof TreeNode) {
        node = item;
        node.appendTo(tree, parent, index);
      } else if (item) {
        node = new TreeNode(tree, item, parent);

        if (typeof index === "number") {
          siblings.splice(index, 0, node);
        }

        siblings.forEach(function (sibling) {
          sibling.update();
        });
      }

      tree.reflow();
    }
  }, {
    key: "insertBefore",
    value: function insertBefore(newData) {
      var index = this.getIndex();
      this.insert(newData, index);
    }
  }, {
    key: "insertAfter",
    value: function insertAfter(newData) {
      var index = this.getIndex();
      this.insert(newData, index + 1);
    }
  }, {
    key: "remove",
    value: function remove() {
      var tree = this.tree;
      var nodes = this.walk();
      var siblings = this.getSiblings();
      var index = this.getIndex();

      if (Array.isArray(siblings)) {
        siblings.splice(index, 1);
      }

      nodes.forEach(function (node) {
        node.clean();
      });
      siblings.forEach(function (node) {
        node.update();
      });
      this.updateParents();
      tree.reflow();
    }
  }, {
    key: "clean",
    value: function clean() {
      var tree = this.tree,
          value = this.value;
      tree.activedMap["delete"](value);
      tree.checkedMap["delete"](value);
      tree.expandedMap["delete"](value);
      tree.nodeMap["delete"](value);
    }
  }, {
    key: "loadChildren",
    value: function loadChildren() {
      var _this = this;

      return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
        var config, list;
        return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                config = get_1(_this, "tree.config") || {};

                if (!(_this.children === true && !_this.loading)) {
                  _context.next = 13;
                  break;
                }

                if (!(typeof config.load === "function")) {
                  _context.next = 13;
                  break;
                }

                _this.loading = true;

                _this.update();

                list = [];
                _context.next = 8;
                return config.load(_this);

              case 8:
                list = _context.sent;

                _this.tree.emit("load", {
                  node: _this,
                  data: list
                });

                _this.loading = false;

                if (Array.isArray(list) && list.length > 0) {
                  _this.append(list);
                } else {
                  _this.children = false;
                }

                _this.update();

              case 13:
              case "end":
                return _context.stop();
            }
          }
        }, _callee);
      }))();
    }
  }, {
    key: "set",
    value: function set(item) {
      var _this4 = this;

      var tree = this.tree;
      var keys = Object.keys(item);
      keys.forEach(function (key) {
        if (hasOwnProperty.call(defaultStatus, key) || key === "label") {
          _this4[key] = item[key];
        }
      });
      tree.updated(this);
    }
  }, {
    key: "getParent",
    value: function getParent() {
      return this.parent;
    }
  }, {
    key: "getParents",
    value: function getParents() {
      var parents = [];
      var node = this.parent;

      while (node) {
        parents.push(node);
        node = node.parent;
      }

      return parents;
    }
  }, {
    key: "getSiblings",
    value: function getSiblings() {
      var parent = this.parent,
          tree = this.tree;
      var list = [];

      if (parent) {
        if (Array.isArray(parent.children)) {
          list = parent.children;
        }
      } else if (tree) {
        list = tree.children;
      }

      return list;
    }
  }, {
    key: "getRoot",
    value: function getRoot() {
      var parents = this.getParents();
      return parents[parents.length - 1] || null;
    }
  }, {
    key: "getIndex",
    value: function getIndex() {
      var list = this.getSiblings();
      return list.indexOf(this);
    }
  }, {
    key: "getPath",
    value: function getPath() {
      var nodes = this.getParents();
      nodes.unshift(this);
      return nodes.reverse();
    }
  }, {
    key: "getLevel",
    value: function getLevel() {
      var parents = this.getParents();
      return parents.length;
    }
  }, {
    key: "isRest",
    value: function isRest() {
      var _this$tree = this.tree,
          config = _this$tree.config,
          filterMap = _this$tree.filterMap;
      var rest = true;

      if (typeof config.filter === "function") {
        var nodeModel = this.getModel();
        rest = config.filter(nodeModel);
      }

      if (rest) {
        filterMap.set(this.value, true);
      } else if (filterMap.get(this.value)) {
        filterMap["delete"](this.value);
      }

      return rest;
    }
  }, {
    key: "isVisible",
    value: function isVisible() {
      var nodeMap = this.tree.nodeMap;
      var visible = true;

      if (this.vmIsLocked) {
        return true;
      }

      if (nodeMap.get(this.value)) {
        var filterVisible = this.isRest();
        var expandVisible = true;
        var parents = this.getParents();

        if (parents.length > 0) {
          expandVisible = parents.every(function (node) {
            return node.isExpanded();
          });
        }

        visible = expandVisible && filterVisible;
      } else {
        visible = false;
      }

      return visible;
    }
  }, {
    key: "isDisabled",
    value: function isDisabled() {
      if (this.vmIsLocked) return true;
      var treeDisabled = get_1(this, "tree.config.disabled");
      return !!(treeDisabled || this.disabled);
    }
  }, {
    key: "isDraggable",
    value: function isDraggable() {
      return !!(get_1(this, "tree.config.draggable") || this.draggable);
    }
  }, {
    key: "isExpandMutex",
    value: function isExpandMutex() {
      return !!(get_1(this, "tree.config.expandMutex") || this.expandMutex);
    }
  }, {
    key: "isActivable",
    value: function isActivable() {
      return !!(get_1(this, "tree.config.activable") || this.activable);
    }
  }, {
    key: "isCheckable",
    value: function isCheckable() {
      return !!(get_1(this, "tree.config.checkable") || this.checkable);
    }
  }, {
    key: "isActived",
    value: function isActived(map) {
      var tree = this.tree,
          value = this.value;
      var activedMap = map || tree.activedMap;
      return !!(tree.nodeMap.get(value) && activedMap.get(value));
    }
  }, {
    key: "isExpanded",
    value: function isExpanded(map) {
      var tree = this.tree,
          value = this.value,
          vmIsLocked = this.vmIsLocked;
      if (vmIsLocked) return true;
      var expandedMap = map || tree.expandedMap;
      return !!(tree.nodeMap.get(value) && expandedMap.get(value));
    }
  }, {
    key: "isChecked",
    value: function isChecked(map) {
      var children = this.children,
          tree = this.tree;
      var checkStrictly = tree.config.checkStrictly;
      var checked = false;
      var checkedMap = map || tree.checkedMap;

      if (tree.nodeMap.get(this.value)) {
        if (checkedMap.get(this.value)) {
          checked = true;
        } else if (Array.isArray(children) && children.length > 0 && !checkStrictly) {
          checked = children.every(function (node) {
            var childIsChecked = node.isChecked(checkedMap);
            return childIsChecked;
          });
        } else if (!checkStrictly) {
          var parents = this.getParents();
          checked = parents.some(function (node) {
            return checkedMap.get(node.value);
          });
        }
      }

      return !!checked;
    }
  }, {
    key: "isIndeterminate",
    value: function isIndeterminate() {
      var children = this.children,
          tree = this.tree;
      var checkStrictly = tree.config.checkStrictly;

      if (checkStrictly) {
        return false;
      }

      var indeterminate = false;

      if (Array.isArray(children)) {
        var childChecked = null;
        indeterminate = children.some(function (node) {
          if (node.isIndeterminate()) {
            return true;
          }

          if (childChecked === null) {
            childChecked = node.isChecked();
          }

          if (childChecked !== node.isChecked()) {
            return true;
          }

          return false;
        });
      }

      return indeterminate;
    }
  }, {
    key: "isFirst",
    value: function isFirst() {
      var siblings = this.getSiblings();
      return siblings[0] === this;
    }
  }, {
    key: "isLast",
    value: function isLast() {
      var siblings = this.getSiblings();
      return siblings[siblings.length - 1] === this;
    }
  }, {
    key: "isLeaf",
    value: function isLeaf() {
      var isLeaf = false;

      if (Array.isArray(this.children)) {
        isLeaf = this.children.length <= 0;
      } else {
        isLeaf = !this.children;
      }

      return isLeaf;
    }
  }, {
    key: "lock",
    value: function lock(lockState) {
      this.vmIsLocked = lockState;
      this.expanded = this.isExpanded();
      this.visible = this.isVisible();
    }
  }, {
    key: "afterExpanded",
    value: function afterExpanded() {
      this.update();

      if (this.expanded && this.children === true) {
        this.loadChildren();
      }
    }
  }, {
    key: "toggleExpanded",
    value: function toggleExpanded() {
      return this.setExpanded(!this.isExpanded());
    }
  }, {
    key: "setExpanded",
    value: function setExpanded(expanded, opts) {
      var tree = this.tree;

      var options = _objectSpread({
        directly: false
      }, opts);

      var map = tree.expandedMap;

      if (!options.directly) {
        map = new Map(tree.expandedMap);
      }

      if (expanded) {
        var shouldExpandNodes = [];
        shouldExpandNodes.push(this);

        if (get_1(tree, "config.expandParent")) {
          this.getParents().forEach(function (node) {
            shouldExpandNodes.push(node);
          });
        }

        shouldExpandNodes.forEach(function (node) {
          var isExpandMutex = false;

          if (node.parent) {
            isExpandMutex = node.parent.isExpandMutex();
          } else {
            var _tree$config;

            isExpandMutex = tree === null || tree === void 0 ? void 0 : (_tree$config = tree.config) === null || _tree$config === void 0 ? void 0 : _tree$config.expandMutex;
          }

          if (isExpandMutex) {
            var siblings = node.getSiblings();
            siblings.forEach(function (snode) {
              map["delete"](snode.value);
            });
          }

          map.set(node.value, true);
        });
      } else {
        map["delete"](this.value);
      }

      if (options.directly) {
        this.afterExpanded();
        this.update();
        this.updateChildren();
      }

      return tree.getExpanded(map);
    }
  }, {
    key: "toggleActived",
    value: function toggleActived() {
      return this.setActived(!this.isActived());
    }
  }, {
    key: "setActived",
    value: function setActived(actived, opts) {
      var tree = this.tree;

      var options = _objectSpread({
        directly: false
      }, opts);

      var config = tree.config || {};
      var map = tree.activedMap;

      if (!options.directly) {
        map = new Map(tree.activedMap);
      }

      if (this.isActivable()) {
        if (actived) {
          if (!config.activeMultiple) {
            map.clear();
          }

          map.set(this.value, true);
        } else {
          map["delete"](this.value);
        }
      }

      if (options.directly) {
        this.update();
      }

      return tree.getActived(map);
    }
  }, {
    key: "toggleChecked",
    value: function toggleChecked() {
      return this.setChecked(!this.isChecked());
    }
  }, {
    key: "setChecked",
    value: function setChecked(checked, opts) {
      var tree = this.tree;
      var config = tree.config || {};

      var options = _objectSpread({
        directly: false
      }, opts);

      var map = tree.checkedMap;

      if (!options.directly) {
        map = new Map(tree.checkedMap);
      }

      if (this.isCheckable() && checked !== this.isChecked()) {
        if (config.checkStrictly) {
          if (checked) {
            map.set(this.value, true);
          } else {
            map["delete"](this.value);
          }
        } else {
          var children = this.walk();
          children.forEach(function (node) {
            if (checked) {
              map.set(node.value, true);
            } else {
              map["delete"](node.value);
            }
          });
          var parents = this.getParents();
          parents.forEach(function (node) {
            map["delete"](node.value);
          });
        }
      }

      if (options.directly) {
        if (config.checkStrictly) {
          this.updateChecked();
        } else {
          var relatedNodes = tree.getRelatedNodes([this.value]);
          relatedNodes.forEach(function (node) {
            node.updateChecked();
          });
        }
      }

      return tree.getChecked(map);
    }
  }, {
    key: "update",
    value: function update() {
      this.level = this.getLevel();
      this.actived = this.isActived();
      this.expanded = this.isExpanded();
      this.vmCheckable = this.isCheckable();
      this.visible = this.isVisible();
      this.vmIsRest = this.isRest();
      this.vmIsFirst = this.isFirst();
      this.vmIsLast = this.isLast();
      this.vmIsLeaf = this.isLeaf();
      this.tree.updated(this);
    }
  }, {
    key: "updateChecked",
    value: function updateChecked(isFromValueChange) {
      var tree = this.tree;
      this.vmCheckable = this.isCheckable();

      if (this.vmCheckable && (!this.disabled || isFromValueChange)) {
        this.checked = this.isChecked();

        if (this.checked) {
          tree.checkedMap.set(this.value, true);
        }

        this.indeterminate = this.isIndeterminate();
        tree.updated(this);
      }
    }
  }, {
    key: "updateChildren",
    value: function updateChildren() {
      var children = this.children;

      if (Array.isArray(children)) {
        children.forEach(function (node) {
          node.update();
          node.updateChecked();
          node.updateChildren();
        });
      }
    }
  }, {
    key: "updateParents",
    value: function updateParents() {
      var parent = this.parent;

      if (parent) {
        parent.update();
        parent.updateChecked();
        parent.updateParents();
      }
    }
  }, {
    key: "updateRelated",
    value: function updateRelated() {
      var tree = this.tree;
      var relatedNodes = tree.getRelatedNodes([this.value]);
      relatedNodes.forEach(function (node) {
        node.update();
        node.updateChecked();
      });
      tree.reflow();
    }
  }, {
    key: "walk",
    value: function walk() {
      var children = this.children;
      var list = [];
      list.push(this);

      if (Array.isArray(children) && children.length > 0) {
        children.forEach(function (node) {
          list = list.concat(node.walk());
        });
      }

      return list;
    }
  }, {
    key: "getModel",
    value: function getModel() {
      var model = this.model;

      if (!model) {
        model = createNodeModel(this);
        this.model = model;
      }

      updateNodeModel(model, this);
      return model;
    }
  }]);

  return TreeNode;
}();

exports.TreeNode = TreeNode;
exports._MapCache = _MapCache;
exports._arrayMap = _arrayMap;
exports._baseFlatten = _baseFlatten;
exports._baseUnary = _baseUnary;
exports._overRest = _overRest;
exports._setToString = _setToString;
exports.identity_1 = identity_1;
exports.isPlainObject_1 = isPlainObject_1;
exports.toString_1 = toString_1;
//# sourceMappingURL=tree-node.js.map
