const N = (p, x, u) => {
  var f = " ua-", g = /\s*([-\w ]+)[\s/:]([\d_]+\b(?:[-._/]\w+)*)/, h = /([\w\-.]+[\s/][v]?[\d_]+\b(?:[-._/]\w+)*)/g, k = /\b(?:(blackberry\w*|bb10)|(rim tablet os))(?:\/(\d+\.\d+(?:\.\w+)*))?/, R = /\bsilk-accelerated=true\b/, y = /\bfluidapp\b/, j = /(\bwindows\b|\bmacintosh\b|\blinux\b|\bunix\b)/, E = /(\bandroid\b|\bipad\b|\bipod\b|\bwindows phone\b|\bwpdesktop\b|\bxblwp7\b|\bzunewp7\b|\bwindows ce\b|\bblackberry\w*|\bbb10\b|\brim tablet os\b|\bmeego|\bwebos\b|\bpalm|\bsymbian|\bj2me\b|\bdocomo\b|\bpda\b|\bchtml\b|\bmidp\b|\bcldc\b|\w*?mobile\w*?|\w*?phone\w*?)/, $ = /(\bxbox\b|\bplaystation\b|\bnintendo\s+\w+)/, a = {
    parse: (
      /**
       * @param uaStr {string}
       * @return {Object}
       */
      function(i, l) {
        var e = {};
        if (l && (e.standalone = l), i = ("" + i).toLowerCase(), !i)
          return e;
        for (var o, r, s = i.split(/[()]/), n = 0, b = s.length; n < b; n++)
          if (n % 2) {
            var w = s[n].split(";");
            for (o = 0, r = w.length; o < r; o++)
              if (g.exec(w[o])) {
                var d = RegExp.$1.split(" ").join("_"), m = RegExp.$2;
                (!e[d] || Number.parseFloat(e[d]) < Number.parseFloat(m)) && (e[d] = m);
              }
          } else {
            var c = s[n].match(h);
            if (c)
              for (o = 0, r = c.length; o < r; o++) {
                var t = c[o].split(/[/\s]+/);
                t.length && t[0] !== "mozilla" && (e[t[0].split(" ").join("_")] = t.slice(1).join("-"));
              }
          }
        if (E.exec(i))
          e.mobile = RegExp.$1, k.exec(i) && (delete e[e.mobile], e.blackberry = e.version || RegExp.$3 || RegExp.$2 || RegExp.$1, RegExp.$1 ? e.mobile = "blackberry" : e.version === "0.0.1" && (e.blackberry = "7.1.0.0"));
        else if ($.exec(i)) {
          e.game = RegExp.$1;
          var v = e.game.split(" ").join("_");
          e.version && !e[v] && (e[v] = e.version);
        } else j.exec(i) && (e.desktop = RegExp.$1);
        return e.intel_mac_os_x ? (e.mac_os_x = e.intel_mac_os_x.split("_").join("."), delete e.intel_mac_os_x) : e.cpu_iphone_os ? (e.ios = e.cpu_iphone_os.split("_").join("."), delete e.cpu_iphone_os) : e.cpu_os ? (e.ios = e.cpu_os.split("_").join("."), delete e.cpu_os) : e.mobile === "iphone" && !e.ios && (e.ios = "1"), e.opera && e.version ? (e.opera = e.version, delete e.blackberry) : R.exec(i) ? e.silk_accelerated = !0 : y.exec(i) && (e.fluidapp = e.version), e.edge && (delete e.applewebkit, delete e.safari, delete e.chrome, delete e.android), e.applewebkit ? (e.webkit = e.applewebkit, delete e.applewebkit, e.opr && (e.opera = e.opr, delete e.opr, delete e.chrome), e.safari && (e.chrome || e.crios || e.fxios || e.opera || e.silk || e.fluidapp || e.phantomjs || e.mobile && !e.ios ? (delete e.safari, e.vivaldi && delete e.chrome) : e.version && !e.rim_tablet_os ? e.safari = e.version : e.safari = {
          419: "2.0.4",
          417: "2.0.3",
          416: "2.0.2",
          412: "2.0",
          312: "1.3",
          125: "1.2",
          85: "1.0"
        }[Number.parseInt(e.safari, 10)] || e.safari)) : e.msie || e.trident ? (e.opera || (e.ie = e.msie || e.rv), delete e.msie, delete e.android, e.windows_phone_os ? (e.windows_phone = e.windows_phone_os, delete e.windows_phone_os) : (e.mobile === "wpdesktop" || e.mobile === "xblwp7" || e.mobile === "zunewp7") && (e.mobile = "windows desktop", e.windows_phone = +e.ie < 9 ? "7.0" : +e.ie < 10 ? "7.5" : "8.0", delete e.windows_nt)) : (e.gecko || e.firefox) && (e.gecko = e.rv), e.rv && delete e.rv, e.version && delete e.version, e;
      }
    ),
    format: (
      /**
       * @param ua {Object}
       * @return {string}
       */
      function(i) {
        function l(r, s) {
          r = r.split(".").join("-");
          var n = f + r;
          if (typeof s == "string") {
            s = s.split(" ").join("_").split(".").join("-");
            for (var b = s.indexOf("-"); b > 0; )
              n += f + r + "-" + s.substring(0, b), b = s.indexOf("-", b + 1);
            n += f + r + "-" + s;
          }
          return n;
        }
        var e = "";
        for (var o in i)
          o && i.hasOwnProperty(o) && (e += l(o, i[o]));
        return e;
      }
    ),
    encode: (
      /**
       * Encodes parsed userAgent object as a compact URI-Encoded key-value collection
       * @param ua {Object}
       * @return {string}
       */
      function(i) {
        var l = "";
        for (var e in i)
          e && i.hasOwnProperty(e) && (l && (l += "&"), l += encodeURIComponent(e) + "=" + encodeURIComponent(i[e]));
        return l;
      }
    )
  };
  a.userAgent = a.ua = a.parse(x, u);
  var _ = a.format(a.ua) + " js";
  return p.className ? p.className = p.className.replace(/\bno-js\b/g, "") + _ : p.className = _.substr(1), a;
};
export {
  N as cssua
};
//# sourceMappingURL=cssuseragent.js.map
