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

/**
 * LDesignUtility v0.2.1
 * (c) 2022 undefined
 * @license MIT
 */

function getIEVersion() {
  var {
    userAgent
  } = navigator;
  var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1;
  var isIE11 = userAgent.indexOf("Trident") > -1 && userAgent.indexOf("rv:11.0") > -1;

  if (isIE) {
    var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
    var match = userAgent.match(reIE);
    if (!match) return -1;
    var fIEVersion = parseFloat(match[1]);
    return fIEVersion < 7 ? 6 : fIEVersion;
  }

  if (isIE11) {
    return 11;
  }

  return Number.MAX_SAFE_INTEGER;
}

function getUnicodeLength(str) {
  return [...(str !== null && str !== void 0 ? str : "")].length;
}

function limitUnicodeMaxLength(str, maxLength) {
  return [...(str !== null && str !== void 0 ? str : "")].slice(0, maxLength).join("");
}

var DOM_STYLE_PROPS = ["padding-top", "padding-bottom", "padding-left", "padding-right", "font-family", "font-weight", "font-size", "font-variant", "text-rendering", "text-transform", "width", "text-indent", "border-width", "box-sizing", "line-height", "letter-spacing"];

function calculateNodeSize(targetElement) {
  var style = window.getComputedStyle(targetElement);
  var boxSizing = style.getPropertyValue("box-sizing") || style.getPropertyValue("-moz-box-sizing") || style.getPropertyValue("-webkit-box-sizing");
  var paddingSize = parseFloat(style.getPropertyValue("padding-bottom")) + parseFloat(style.getPropertyValue("padding-top"));
  var borderSize = parseFloat(style.getPropertyValue("border-bottom-width")) + parseFloat(style.getPropertyValue("border-top-width"));
  var sizingStyle = DOM_STYLE_PROPS.map(name => "".concat(name, ":").concat(style.getPropertyValue(name))).join(";");
  return {
    paddingSize,
    borderSize,
    boxSizing,
    sizingStyle
  };
}

export { getUnicodeLength as a, calculateNodeSize as c, getIEVersion as g, limitUnicodeMaxLength as l };
//# sourceMappingURL=dep-d640115b.js.map
