/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

'use strict';

var defineProperty838e4192 = require('./defineProperty-838e4192.js');
var get5e1abd10 = require('./get-5e1abd10.js');
var isSymbolA38a5184 = require('./isSymbol-a38a5184.js');
var _isIndex52887d1e = require('./_isIndex-52887d1e.js');
var isFunction91acade7 = require('./isFunction-91acade7.js');
var isObjectLikeC22c7e3b = require('./isObjectLike-c22c7e3b.js');
var isArrayCd7357b9 = require('./isArray-cd7357b9.js');
var log = require('./log.js');

var getNative$4 = get5e1abd10._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 = isSymbolA38a5184.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 = get5e1abd10._castPath,
  isIndex$2 = _isIndex52887d1e._isIndex,
  isObject$3 = isFunction91acade7.isObject_1,
  toKey$2 = get5e1abd10._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 = get5e1abd10._baseGet,
  baseSet = _baseSet,
  castPath$3 = get5e1abd10._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 = isObjectLikeC22c7e3b._baseGetTag,
  isObjectLike$5 = isObjectLikeC22c7e3b.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 = isObjectLikeC22c7e3b.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 = get5e1abd10._castPath,
  isArguments$2 = isArguments_1,
  isArray$4 = isArrayCd7357b9.isArray_1,
  isIndex$1 = _isIndex52887d1e._isIndex,
  isLength$1 = _isIndex52887d1e.isLength_1,
  toKey$1 = get5e1abd10._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 = isObjectLikeC22c7e3b._Symbol,
  isArguments$1 = isArguments_1,
  isArray$3 = isArrayCd7357b9.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 = get5e1abd10._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 = get5e1abd10._ListCache,
  Map$1 = get5e1abd10._Map,
  MapCache = get5e1abd10._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 = get5e1abd10._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 = isObjectLikeC22c7e3b._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 = isObjectLikeC22c7e3b._baseGetTag,
  isLength = _isIndex52887d1e.isLength_1,
  isObjectLike$3 = isObjectLikeC22c7e3b.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 = isObjectLikeC22c7e3b._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 = isArrayCd7357b9.isArray_1,
  isBuffer$1 = isBuffer$2.exports,
  isIndex = _isIndex52887d1e._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 = _isIndex52887d1e.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 = isFunction91acade7.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 = _isIndex52887d1e.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 = isObjectLikeC22c7e3b._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 = isArrayCd7357b9.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 = get5e1abd10._getNative,
  root$4 = isObjectLikeC22c7e3b._root;
var DataView$1 = getNative$3(root$4, "DataView");
var _DataView = DataView$1;
var getNative$2 = get5e1abd10._getNative,
  root$3 = isObjectLikeC22c7e3b._root;
var Promise$2 = getNative$2(root$3, "Promise");
var _Promise = Promise$2;
var getNative$1 = get5e1abd10._getNative,
  root$2 = isObjectLikeC22c7e3b._root;
var Set$1 = getNative$1(root$2, "Set");
var _Set = Set$1;
var getNative = get5e1abd10._getNative,
  root$1 = isObjectLikeC22c7e3b._root;
var WeakMap$1 = getNative(root$1, "WeakMap");
var _WeakMap = WeakMap$1;
var DataView = _DataView,
  Map$2 = get5e1abd10._Map,
  Promise$1 = _Promise,
  Set = _Set,
  WeakMap = _WeakMap,
  baseGetTag$1 = isObjectLikeC22c7e3b._baseGetTag,
  toSource = get5e1abd10._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 = isObjectLikeC22c7e3b._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 Symbol = isObjectLikeC22c7e3b._Symbol;
var symbolProto = Symbol ? Symbol.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 = isFunction91acade7.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 = isObjectLikeC22c7e3b.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 = isObjectLikeC22c7e3b.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 = isArrayCd7357b9.isArray_1,
  isBuffer = isBuffer$2.exports,
  isMap = isMap_1,
  isObject = isFunction91acade7.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 = get5e1abd10._baseGet,
  baseSlice = _isIndex52887d1e._baseSlice;
function parent$1(object, path) {
  return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
}
var _parent = parent$1;
var castPath$1 = get5e1abd10._castPath,
  last = last_1,
  parent = _parent,
  toKey = get5e1abd10._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 = isObjectLikeC22c7e3b._baseGetTag,
  getPrototype = _getPrototype,
  isObjectLike = isObjectLikeC22c7e3b.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 = get5e1abd10._arrayMap,
  baseClone = _baseClone,
  baseUnset = _baseUnset,
  castPath = get5e1abd10._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) {
      defineProperty838e4192._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() {
      return node.getLevel();
    },
    getIndex() {
      return node.getIndex();
    },
    isFirst() {
      return node.isFirst();
    },
    isLast() {
      return node.isLast();
    },
    isLeaf() {
      return node.isLeaf();
    },
    insertBefore(newData) {
      return node.insertBefore(newData);
    },
    insertAfter(newData) {
      return node.insertAfter(newData);
    },
    appendData(data) {
      return node.append(data);
    },
    getPath() {
      var nodes = node.getPath();
      return nodes.map(item => item.getModel());
    },
    getParent() {
      var _node$parent;
      return (_node$parent = node.parent) === null || _node$parent === void 0 ? void 0 : _node$parent.getModel();
    },
    getParents() {
      var nodes = node.getParents();
      return nodes.map(item => item.getModel());
    },
    getRoot() {
      var root2 = node.getRoot();
      return root2 === null || root2 === void 0 ? void 0 : root2.getModel();
    },
    getSiblings() {
      var nodes = node.getSiblings();
      return nodes.map(item => item.getModel());
    },
    getChildren(deep) {
      var childrenModel = false;
      var {
        children
      } = node;
      if (Array.isArray(children)) {
        if (children.length > 0) {
          if (deep) {
            var nodes = node.walk();
            nodes.shift();
            childrenModel = nodes.map(item => item.getModel());
          } else {
            childrenModel = children.map(item => item.getModel());
          }
        } else {
          childrenModel = false;
        }
      } else if (typeof children === "boolean") {
        childrenModel = children;
      }
      return childrenModel;
    },
    remove(value) {
      if (!value) {
        node.remove();
        return;
      }
      var {
        tree
      } = node;
      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(pnode => pnode.value);
      if (!parentValues.includes(node.value)) {
        log.log.warnOnce("Tree", "`".concat(value, "` is not a childNode of current node"));
        return;
      }
      targetNode.remove();
    },
    setData(data) {
      var _data = omit_1(data, ["children", "value", "label"]);
      var {
        keys: keys2
      } = node.tree.config;
      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);
}

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 = get5e1abd10.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) {
      defineProperty838e4192._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;
var defaultStatus = {
  expandMutex: false,
  activable: false,
  checkable: false,
  disabled: false,
  draggable: false,
  loading: false
};
class TreeNode {
  constructor(tree, data, parent) {
    defineProperty838e4192._defineProperty(this, "tree", void 0);
    defineProperty838e4192._defineProperty(this, "value", void 0);
    defineProperty838e4192._defineProperty(this, "label", void 0);
    defineProperty838e4192._defineProperty(this, "data", void 0);
    defineProperty838e4192._defineProperty(this, "parent", void 0);
    defineProperty838e4192._defineProperty(this, "children", void 0);
    defineProperty838e4192._defineProperty(this, "model", void 0);
    defineProperty838e4192._defineProperty(this, "vmIsLeaf", void 0);
    defineProperty838e4192._defineProperty(this, "vmIsFirst", void 0);
    defineProperty838e4192._defineProperty(this, "vmIsLast", void 0);
    defineProperty838e4192._defineProperty(this, "vmIsRest", void 0);
    defineProperty838e4192._defineProperty(this, "vmIsLocked", void 0);
    defineProperty838e4192._defineProperty(this, "expanded", void 0);
    defineProperty838e4192._defineProperty(this, "expandMutex", void 0);
    defineProperty838e4192._defineProperty(this, "actived", void 0);
    defineProperty838e4192._defineProperty(this, "activable", void 0);
    defineProperty838e4192._defineProperty(this, "checkable", void 0);
    defineProperty838e4192._defineProperty(this, "vmCheckable", void 0);
    defineProperty838e4192._defineProperty(this, "checked", void 0);
    defineProperty838e4192._defineProperty(this, "indeterminate", void 0);
    defineProperty838e4192._defineProperty(this, "disabled", void 0);
    defineProperty838e4192._defineProperty(this, "draggable", void 0);
    defineProperty838e4192._defineProperty(this, "visible", void 0);
    defineProperty838e4192._defineProperty(this, "level", void 0);
    defineProperty838e4192._defineProperty(this, "loading", void 0);
    this.data = data;
    this.tree = tree;
    var config = tree.config || {};
    var prefix = config.prefix || "t";
    var keys = get5e1abd10.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();
  }
  initChecked() {
    var {
      tree,
      value,
      parent
    } = this;
    var {
      checkStrictly
    } = tree.config;
    var {
      checked
    } = this;
    checked = parent === null || parent === void 0 ? void 0 : parent.isChecked();
    if (checked && !checkStrictly) tree.checkedMap.set(value, true);
    this.checked = checked;
  }
  initExpanded() {
    var {
      tree
    } = this;
    var {
      expanded
    } = this;
    var {
      config
    } = tree;
    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;
  }
  initActived() {
    var {
      tree,
      actived
    } = this;
    if (actived) tree.activedMap.set(this.value, true);
  }
  append(data) {
    var list = [];
    if (!Array.isArray(data)) list.push(data);else list.push(...data);
    if (list.length <= 0) return;
    if (!Array.isArray(this.children)) this.children = [];
    var {
      children,
      tree
    } = this;
    list.forEach(item => {
      var node = null;
      if (item instanceof TreeNode) {
        node = item;
        node.appendTo(this.tree, this);
      } else {
        node = new TreeNode(this.tree, item, this);
        children.push(node);
      }
    });
    tree.reflow(this);
    this.updateRelated();
  }
  appendTo(tree, parent, index) {
    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.includes(this);
    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(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(item => item.walk()).flat();
    updateNodes.forEach(node => {
      node.update();
      node.updateChecked();
    });
    tree.reflow();
  }
  insert(item, index) {
    var {
      tree,
      parent
    } = this;
    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(sibling => {
        sibling.update();
      });
    }
    tree.reflow();
  }
  insertBefore(newData) {
    var index = this.getIndex();
    this.insert(newData, index);
  }
  insertAfter(newData) {
    var index = this.getIndex();
    this.insert(newData, index + 1);
  }
  remove() {
    var {
      tree
    } = this;
    var nodes = this.walk();
    var siblings = this.getSiblings();
    var index = this.getIndex();
    if (Array.isArray(siblings)) siblings.splice(index, 1);
    nodes.forEach(node => {
      node.clean();
    });
    siblings.forEach(node => {
      node.update();
    });
    this.updateParents();
    tree.reflow();
  }
  clean() {
    var {
      tree,
      value
    } = this;
    tree.activedMap.delete(value);
    tree.checkedMap.delete(value);
    tree.expandedMap.delete(value);
    tree.nodeMap.delete(value);
  }
  loadChildren() {
    var _this = this;
    return _asyncToGenerator(function* () {
      var config = get5e1abd10.get_1(_this, "tree.config") || {};
      if (_this.children === true && !_this.loading) {
        if (typeof config.load === "function") {
          _this.loading = true;
          _this.update();
          var list = [];
          list = yield config.load(_this);
          _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();
        }
      }
    })();
  }
  set(item) {
    var {
      tree
    } = this;
    var keys = Object.keys(item);
    keys.forEach(key => {
      if (hasOwnProperty.call(defaultStatus, key) || key === "label") this[key] = item[key];
    });
    tree.updated(this);
  }
  getParent() {
    return this.parent;
  }
  getParents() {
    var parents = [];
    var node = this.parent;
    while (node) {
      parents.push(node);
      node = node.parent;
    }
    return parents;
  }
  getSiblings() {
    var {
      parent,
      tree
    } = this;
    var list = [];
    if (parent) {
      if (Array.isArray(parent.children)) list = parent.children;
    } else if (tree) {
      list = tree.children;
    }
    return list;
  }
  getRoot() {
    var parents = this.getParents();
    return parents[parents.length - 1] || null;
  }
  getIndex() {
    var list = this.getSiblings();
    return list.indexOf(this);
  }
  getPath() {
    var nodes = this.getParents();
    nodes.unshift(this);
    return nodes.reverse();
  }
  getLevel() {
    var parents = this.getParents();
    return parents.length;
  }
  isRest() {
    var {
      config,
      filterMap
    } = this.tree;
    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;
  }
  isVisible() {
    var {
      nodeMap
    } = this.tree;
    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(node => node.isExpanded());
      visible = expandVisible && filterVisible;
    } else {
      visible = false;
    }
    return visible;
  }
  isDisabled() {
    if (this.vmIsLocked) return true;
    var treeDisabled = get5e1abd10.get_1(this, "tree.config.disabled");
    return !!(treeDisabled || this.disabled);
  }
  isDraggable() {
    return !!(get5e1abd10.get_1(this, "tree.config.draggable") || this.draggable);
  }
  isExpandMutex() {
    return !!(get5e1abd10.get_1(this, "tree.config.expandMutex") || this.expandMutex);
  }
  isActivable() {
    return !!(get5e1abd10.get_1(this, "tree.config.activable") || this.activable);
  }
  isCheckable() {
    return !!(get5e1abd10.get_1(this, "tree.config.checkable") || this.checkable);
  }
  isActived(map) {
    var {
      tree,
      value
    } = this;
    var activedMap = map || tree.activedMap;
    return !!(tree.nodeMap.get(value) && activedMap.get(value));
  }
  isExpanded(map) {
    var {
      tree,
      value,
      vmIsLocked
    } = this;
    if (vmIsLocked) return true;
    var expandedMap = map || tree.expandedMap;
    return !!(tree.nodeMap.get(value) && expandedMap.get(value));
  }
  isChecked(map) {
    var {
      children,
      tree
    } = this;
    var {
      checkStrictly
    } = tree.config;
    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(node => {
          var childIsChecked = node.isChecked(checkedMap);
          return childIsChecked;
        });
      } else if (!checkStrictly) {
        var parents = this.getParents();
        checked = parents.some(node => checkedMap.get(node.value));
      }
    }
    return !!checked;
  }
  isIndeterminate() {
    var {
      children,
      tree
    } = this;
    var {
      checkStrictly
    } = tree.config;
    if (checkStrictly) return false;
    var indeterminate = false;
    if (Array.isArray(children)) {
      var childChecked = null;
      indeterminate = children.some(node => {
        if (node.isIndeterminate()) {
          return true;
        }
        if (childChecked === null) childChecked = node.isChecked();
        if (childChecked !== node.isChecked()) {
          return true;
        }
        return false;
      });
    }
    return indeterminate;
  }
  isFirst() {
    var siblings = this.getSiblings();
    return siblings[0] === this;
  }
  isLast() {
    var siblings = this.getSiblings();
    return siblings[siblings.length - 1] === this;
  }
  isLeaf() {
    var isLeaf = false;
    if (Array.isArray(this.children)) isLeaf = this.children.length <= 0;else isLeaf = !this.children;
    return isLeaf;
  }
  lock(lockState) {
    this.vmIsLocked = lockState;
    this.expanded = this.isExpanded();
    this.visible = this.isVisible();
  }
  afterExpanded() {
    this.update();
    if (this.expanded && this.children === true) this.loadChildren();
  }
  toggleExpanded() {
    return this.setExpanded(!this.isExpanded());
  }
  setExpanded(expanded, opts) {
    var {
      tree
    } = this;
    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 (get5e1abd10.get_1(tree, "config.expandParent")) {
        this.getParents().forEach(node => {
          shouldExpandNodes.push(node);
        });
      }
      shouldExpandNodes.forEach(node => {
        var _tree$config;
        var isExpandMutex = false;
        if (node.parent) isExpandMutex = node.parent.isExpandMutex();else 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(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);
  }
  toggleActived() {
    return this.setActived(!this.isActived());
  }
  setActived(actived, opts) {
    var {
      tree
    } = this;
    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);
  }
  toggleChecked() {
    return this.setChecked(!this.isChecked());
  }
  setChecked(checked, opts) {
    var {
      tree
    } = this;
    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(node => {
          if (checked) map.set(node.value, true);else map.delete(node.value);
        });
        var parents = this.getParents();
        parents.forEach(node => {
          map.delete(node.value);
        });
      }
    }
    if (options.directly) {
      if (config.checkStrictly) {
        this.updateChecked();
      } else {
        var relatedNodes = tree.getRelatedNodes([this.value]);
        relatedNodes.forEach(node => {
          node.updateChecked();
        });
      }
    }
    return tree.getChecked(map);
  }
  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);
  }
  updateChecked(isFromValueChange) {
    var {
      tree
    } = this;
    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);
    }
  }
  updateChildren() {
    var {
      children
    } = this;
    if (Array.isArray(children)) {
      children.forEach(node => {
        node.update();
        node.updateChecked();
        node.updateChildren();
      });
    }
  }
  updateParents() {
    var {
      parent
    } = this;
    if (parent) {
      parent.update();
      parent.updateChecked();
      parent.updateParents();
    }
  }
  updateRelated() {
    var {
      tree
    } = this;
    var relatedNodes = tree.getRelatedNodes([this.value]);
    relatedNodes.forEach(node => {
      node.update();
      node.updateChecked();
    });
    tree.reflow();
  }
  walk() {
    var {
      children
    } = this;
    var list = [];
    list.push(this);
    if (Array.isArray(children) && children.length > 0) {
      children.forEach(node => {
        list = list.concat(node.walk());
      });
    }
    return list;
  }
  getModel() {
    var {
      model
    } = this;
    if (!model) {
      model = createNodeModel(this);
      this.model = model;
    }
    updateNodeModel(model, this);
    return model;
  }
}

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