var v = `
  min-height:0 !important;
  max-height:none !important;
  height:0 !important;
  visibility:hidden !important;
  overflow:hidden !important;
  position:absolute !important;
  z-index:-1000 !important;
  top:0 !important;
  right:0 !important;
  pointer-events: none !important;
`, c = ["letter-spacing", "line-height", "padding-top", "padding-bottom", "font-family", "font-weight", "font-size", "font-variant", "text-rendering", "text-transform", "width", "text-indent", "padding-left", "padding-right", "border-width", "box-sizing", "word-break", "white-space"], b = {}, e;
function z(i) {
  var p = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, r = i.getAttribute("id") || i.getAttribute("data-reactid") || i.getAttribute("name");
  if (p && b[r])
    return b[r];
  var t = window.getComputedStyle(i), d = t.getPropertyValue("box-sizing") || t.getPropertyValue("-moz-box-sizing") || t.getPropertyValue("-webkit-box-sizing"), l = parseFloat(t.getPropertyValue("padding-bottom")) + parseFloat(t.getPropertyValue("padding-top")), u = parseFloat(t.getPropertyValue("border-bottom-width")) + parseFloat(t.getPropertyValue("border-top-width")), g = c.map(function(n) {
    return "".concat(n, ":").concat(t.getPropertyValue(n));
  }).join(";"), s = {
    sizingStyle: g,
    paddingSize: l,
    borderSize: u,
    boxSizing: d
  };
  return p && r && (b[r] = s), s;
}
function S(i) {
  var p = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, t = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
  e || (e = document.createElement("textarea"), e.setAttribute("tab-index", "-1"), e.setAttribute("aria-hidden", "true"), document.body.appendChild(e)), i.getAttribute("wrap") ? e.setAttribute("wrap", i.getAttribute("wrap")) : e.removeAttribute("wrap");
  var d = z(i, p), l = d.paddingSize, u = d.borderSize, g = d.boxSizing, s = d.sizingStyle;
  e.setAttribute("style", "".concat(s, ";").concat(v)), e.value = i.value || i.placeholder || "";
  var n = void 0, o = void 0, h, a = e.scrollHeight;
  if (g === "border-box" ? a += u : g === "content-box" && (a -= l), r !== null || t !== null) {
    e.value = " ";
    var f = e.scrollHeight - l;
    r !== null && (n = f * r, g === "border-box" && (n = n + l + u), a = Math.max(n, a)), t !== null && (o = f * t, g === "border-box" && (o = o + l + u), h = a > o ? "" : "hidden", a = Math.min(o, a));
  }
  var m = {
    height: a,
    overflowY: h,
    resize: "none"
  };
  return n && (m.minHeight = n), o && (m.maxHeight = o), m;
}
export {
  z as calculateNodeStyling,
  S as default
};
