var J = Object.defineProperty;
var k = (i, e, r) => e in i ? J(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r;
var R = (i, e, r) => k(i, typeof e != "symbol" ? e + "" : e, r);
const r_queryInfo = (i, e) => i("openApi/adv/getAdvertisement", e), taConfig = {
  dev: {
    appId: "30dc981f6368458e8d1814581fbfebee",
    serverUrl: "https://talogshushu.postar.cn"
  },
  test: {
    appId: "30dc981f6368458e8d1814581fbfebee",
    serverUrl: "https://talogshushu.postar.cn"
  },
  uat: {
    appId: "30dc981f6368458e8d1814581fbfebee",
    serverUrl: "https://talogshushu.postar.cn"
  },
  prod: {
    appId: "28d05c6cecaf45cbb9eb6867633e478b",
    serverUrl: "https://talogshushu.postar.cn"
  }
}, servicePath = {
  dev: "http://jghwucyshtgjcbrnxgwe.gtxygroup.com/testterpay/",
  test: "https://jghwucyshtgjcbrnxgwe.gtxygroup.com/syncpromotecs/",
  uat: "https://mktcldxylmyxrhgwzsc.postar.cn/",
  prod: "https://mktcldxylmyxrhgw.postar.cn/"
}, rsaKey = {
  public: "-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2D5Z2SOgofxIp1r4Mhgf5AvN1orm9bPWySpGqnyJgvxLFvp/DbokhYZP9NqYnLvPeilVamIaxJUzw/u2hvQUQ1bPL6TKGAEce9cDfowb+ud90OKYeKnVOm3xMOKu5KaONNMHCa4VCwxS7+ykaGqQ8sm2Kj5WBk2eGzAV30BJ0YQIDAQAB-----END PUBLIC KEY-----",
  private: "-----BEGIN RSA PRIVATE KEY-----MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKBGm6KY2IuHRb+AqJvQtrsaXbFRAfzI6idcaj+0xiHU7T/FHoTjBP/bhIJ2iZiwIJuSHclaLeIGUT12Bzn/TUPMZy+vuATE00BaMYDVXxr/e0dkgZXPwYBL48an9fLx2YtTqaerYCy7KQvtbnyG+7eo9Z9nV/+Hm+KECq3VKdf7AgMBAAECgYBXQ/qLflMxLTcBvOiQ5gQIPaPT3rqJS0+KnNvQ0fmrBAclWIt0aTMYqAovCqGCfCtU6SrErhAbZ7smDrSClIoZSoYkLYdc9aStiyVxmoUQziDHCqd14q62itHyxF2fpmoc3BtOqqCLGDf78w+yP9vuCBhnyCYC47O383tFuVCfcQJBAMsrzYeub9fgUN095Q5UvkyGo0E/XGH9VQM4jtYoLn4yE2JLlqCzi/tAuu8pc1QY/CgMnEsRjmkC2UPg8ca83ekCQQDJ83TIgDKm9ZEu8hi19CXvtArtgzSDa9DvLFuueYxgli0xQNU+l9a+uSFBVmGRT/RcDYI0wzH7Dyfyrdym7yRDAkEAjbyJLdarf9alkzLS0SSdfZWP3rztHg81d4HFY/G0PaWBkFlbQ9D+HtIRlzc7lbe4cdgaUOR2jRvHpmsPQK4RwQJAMQX1cnqUUS1JehDw6LKExwR4pqF0DPcOOBEXjGobJpMuE0e+vDwVuCSuqvKyKpkzI2lwEyjTKDPMqb+E0c05iwJAHryFkEaQ+OZIGizE7nCx9ertNsrPtIHxoi7gzusxk0kfcbDfO+Ck4/zDCaBPUTJwDq8c8lg3PtNV3ezly1+tkQ==-----END RSA PRIVATE KEY-----"
};
var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
function int2char(i) {
  return BI_RM.charAt(i);
}
function op_and(i, e) {
  return i & e;
}
function op_or(i, e) {
  return i | e;
}
function op_xor(i, e) {
  return i ^ e;
}
function op_andnot(i, e) {
  return i & ~e;
}
function lbit(i) {
  if (i == 0)
    return -1;
  var e = 0;
  return i & 65535 || (i >>= 16, e += 16), i & 255 || (i >>= 8, e += 8), i & 15 || (i >>= 4, e += 4), i & 3 || (i >>= 2, e += 2), i & 1 || ++e, e;
}
function cbit(i) {
  for (var e = 0; i != 0; )
    i &= i - 1, ++e;
  return e;
}
var b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", b64pad = "=";
function hex2b64(i) {
  var e, r, n = "";
  for (e = 0; e + 3 <= i.length; e += 3)
    r = parseInt(i.substring(e, e + 3), 16), n += b64map.charAt(r >> 6) + b64map.charAt(r & 63);
  for (e + 1 == i.length ? (r = parseInt(i.substring(e, e + 1), 16), n += b64map.charAt(r << 2)) : e + 2 == i.length && (r = parseInt(i.substring(e, e + 2), 16), n += b64map.charAt(r >> 2) + b64map.charAt((r & 3) << 4)); (n.length & 3) > 0; )
    n += b64pad;
  return n;
}
function b64tohex(i) {
  var e = "", r, n = 0, s = 0;
  for (r = 0; r < i.length && i.charAt(r) != b64pad; ++r) {
    var o = b64map.indexOf(i.charAt(r));
    o < 0 || (n == 0 ? (e += int2char(o >> 2), s = o & 3, n = 1) : n == 1 ? (e += int2char(s << 2 | o >> 4), s = o & 15, n = 2) : n == 2 ? (e += int2char(s), e += int2char(o >> 2), s = o & 3, n = 3) : (e += int2char(s << 2 | o >> 4), e += int2char(o & 15), n = 0));
  }
  return n == 1 && (e += int2char(s << 2)), e;
}
var decoder$1, Hex = {
  decode: function(i) {
    var e;
    if (decoder$1 === void 0) {
      var r = "0123456789ABCDEF", n = ` \f
\r	 \u2028\u2029`;
      for (decoder$1 = {}, e = 0; e < 16; ++e)
        decoder$1[r.charAt(e)] = e;
      for (r = r.toLowerCase(), e = 10; e < 16; ++e)
        decoder$1[r.charAt(e)] = e;
      for (e = 0; e < n.length; ++e)
        decoder$1[n.charAt(e)] = -1;
    }
    var s = [], o = 0, a = 0;
    for (e = 0; e < i.length; ++e) {
      var u = i.charAt(e);
      if (u == "=")
        break;
      if (u = decoder$1[u], u != -1) {
        if (u === void 0)
          throw new Error("Illegal character at offset " + e);
        o |= u, ++a >= 2 ? (s[s.length] = o, o = 0, a = 0) : o <<= 4;
      }
    }
    if (a)
      throw new Error("Hex encoding incomplete: 4 bits missing");
    return s;
  }
}, decoder, Base64 = {
  decode: function(i) {
    var e;
    if (decoder === void 0) {
      var r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", n = `= \f
\r	 \u2028\u2029`;
      for (decoder = /* @__PURE__ */ Object.create(null), e = 0; e < 64; ++e)
        decoder[r.charAt(e)] = e;
      for (decoder["-"] = 62, decoder._ = 63, e = 0; e < n.length; ++e)
        decoder[n.charAt(e)] = -1;
    }
    var s = [], o = 0, a = 0;
    for (e = 0; e < i.length; ++e) {
      var u = i.charAt(e);
      if (u == "=")
        break;
      if (u = decoder[u], u != -1) {
        if (u === void 0)
          throw new Error("Illegal character at offset " + e);
        o |= u, ++a >= 4 ? (s[s.length] = o >> 16, s[s.length] = o >> 8 & 255, s[s.length] = o & 255, o = 0, a = 0) : o <<= 6;
      }
    }
    switch (a) {
      case 1:
        throw new Error("Base64 encoding incomplete: at least 2 bits missing");
      case 2:
        s[s.length] = o >> 10;
        break;
      case 3:
        s[s.length] = o >> 16, s[s.length] = o >> 8 & 255;
        break;
    }
    return s;
  },
  re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
  unarmor: function(i) {
    var e = Base64.re.exec(i);
    if (e)
      if (e[1])
        i = e[1];
      else if (e[2])
        i = e[2];
      else
        throw new Error("RegExp out of sync");
    return Base64.decode(i);
  }
}, max = 1e13, Int10 = (
  /** @class */
  function() {
    function i(e) {
      this.buf = [+e || 0];
    }
    return i.prototype.mulAdd = function(e, r) {
      var n = this.buf, s = n.length, o, a;
      for (o = 0; o < s; ++o)
        a = n[o] * e + r, a < max ? r = 0 : (r = 0 | a / max, a -= r * max), n[o] = a;
      r > 0 && (n[o] = r);
    }, i.prototype.sub = function(e) {
      var r = this.buf, n = r.length, s, o;
      for (s = 0; s < n; ++s)
        o = r[s] - e, o < 0 ? (o += max, e = 1) : e = 0, r[s] = o;
      for (; r[r.length - 1] === 0; )
        r.pop();
    }, i.prototype.toString = function(e) {
      if ((e || 10) != 10)
        throw new Error("only base 10 is supported");
      for (var r = this.buf, n = r[r.length - 1].toString(), s = r.length - 2; s >= 0; --s)
        n += (max + r[s]).toString().substring(1);
      return n;
    }, i.prototype.valueOf = function() {
      for (var e = this.buf, r = 0, n = e.length - 1; n >= 0; --n)
        r = r * max + e[n];
      return r;
    }, i.prototype.simplify = function() {
      var e = this.buf;
      return e.length == 1 ? e[0] : this;
    }, i;
  }()
), ellipsis = "…", reTimeS = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, reTimeL = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
function stringCut(i, e) {
  return i.length > e && (i = i.substring(0, e) + ellipsis), i;
}
var Stream = (
  /** @class */
  function() {
    function i(e, r) {
      this.hexDigits = "0123456789ABCDEF", e instanceof i ? (this.enc = e.enc, this.pos = e.pos) : (this.enc = e, this.pos = r);
    }
    return i.prototype.get = function(e) {
      if (e === void 0 && (e = this.pos++), e >= this.enc.length)
        throw new Error("Requesting byte offset ".concat(e, " on a stream of length ").concat(this.enc.length));
      return typeof this.enc == "string" ? this.enc.charCodeAt(e) : this.enc[e];
    }, i.prototype.hexByte = function(e) {
      return this.hexDigits.charAt(e >> 4 & 15) + this.hexDigits.charAt(e & 15);
    }, i.prototype.hexDump = function(e, r, n) {
      for (var s = "", o = e; o < r; ++o)
        if (s += this.hexByte(this.get(o)), n !== !0)
          switch (o & 15) {
            case 7:
              s += "  ";
              break;
            case 15:
              s += `
`;
              break;
            default:
              s += " ";
          }
      return s;
    }, i.prototype.isASCII = function(e, r) {
      for (var n = e; n < r; ++n) {
        var s = this.get(n);
        if (s < 32 || s > 176)
          return !1;
      }
      return !0;
    }, i.prototype.parseStringISO = function(e, r) {
      for (var n = "", s = e; s < r; ++s)
        n += String.fromCharCode(this.get(s));
      return n;
    }, i.prototype.parseStringUTF = function(e, r) {
      for (var n = "", s = e; s < r; ) {
        var o = this.get(s++);
        o < 128 ? n += String.fromCharCode(o) : o > 191 && o < 224 ? n += String.fromCharCode((o & 31) << 6 | this.get(s++) & 63) : n += String.fromCharCode((o & 15) << 12 | (this.get(s++) & 63) << 6 | this.get(s++) & 63);
      }
      return n;
    }, i.prototype.parseStringBMP = function(e, r) {
      for (var n = "", s, o, a = e; a < r; )
        s = this.get(a++), o = this.get(a++), n += String.fromCharCode(s << 8 | o);
      return n;
    }, i.prototype.parseTime = function(e, r, n) {
      var s = this.parseStringISO(e, r), o = (n ? reTimeS : reTimeL).exec(s);
      return o ? (n && (o[1] = +o[1], o[1] += +o[1] < 70 ? 2e3 : 1900), s = o[1] + "-" + o[2] + "-" + o[3] + " " + o[4], o[5] && (s += ":" + o[5], o[6] && (s += ":" + o[6], o[7] && (s += "." + o[7]))), o[8] && (s += " UTC", o[8] != "Z" && (s += o[8], o[9] && (s += ":" + o[9]))), s) : "Unrecognized time: " + s;
    }, i.prototype.parseInteger = function(e, r) {
      for (var n = this.get(e), s = n > 127, o = s ? 255 : 0, a, u = ""; n == o && ++e < r; )
        n = this.get(e);
      if (a = r - e, a === 0)
        return s ? -1 : 0;
      if (a > 4) {
        for (u = n, a <<= 3; !((+u ^ o) & 128); )
          u = +u << 1, --a;
        u = "(" + a + ` bit)
`;
      }
      s && (n = n - 256);
      for (var l = new Int10(n), p = e + 1; p < r; ++p)
        l.mulAdd(256, this.get(p));
      return u + l.toString();
    }, i.prototype.parseBitString = function(e, r, n) {
      for (var s = this.get(e), o = (r - e - 1 << 3) - s, a = "(" + o + ` bit)
`, u = "", l = e + 1; l < r; ++l) {
        for (var p = this.get(l), g = l == r - 1 ? s : 0, d = 7; d >= g; --d)
          u += p >> d & 1 ? "1" : "0";
        if (u.length > n)
          return a + stringCut(u, n);
      }
      return a + u;
    }, i.prototype.parseOctetString = function(e, r, n) {
      if (this.isASCII(e, r))
        return stringCut(this.parseStringISO(e, r), n);
      var s = r - e, o = "(" + s + ` byte)
`;
      n /= 2, s > n && (r = e + n);
      for (var a = e; a < r; ++a)
        o += this.hexByte(this.get(a));
      return s > n && (o += ellipsis), o;
    }, i.prototype.parseOID = function(e, r, n) {
      for (var s = "", o = new Int10(), a = 0, u = e; u < r; ++u) {
        var l = this.get(u);
        if (o.mulAdd(128, l & 127), a += 7, !(l & 128)) {
          if (s === "")
            if (o = o.simplify(), o instanceof Int10)
              o.sub(80), s = "2." + o.toString();
            else {
              var p = o < 80 ? o < 40 ? 0 : 1 : 2;
              s = p + "." + (o - p * 40);
            }
          else
            s += "." + o.toString();
          if (s.length > n)
            return stringCut(s, n);
          o = new Int10(), a = 0;
        }
      }
      return a > 0 && (s += ".incomplete"), s;
    }, i;
  }()
), ASN1 = (
  /** @class */
  function() {
    function i(e, r, n, s, o) {
      if (!(s instanceof ASN1Tag))
        throw new Error("Invalid tag value.");
      this.stream = e, this.header = r, this.length = n, this.tag = s, this.sub = o;
    }
    return i.prototype.typeName = function() {
      switch (this.tag.tagClass) {
        case 0:
          switch (this.tag.tagNumber) {
            case 0:
              return "EOC";
            case 1:
              return "BOOLEAN";
            case 2:
              return "INTEGER";
            case 3:
              return "BIT_STRING";
            case 4:
              return "OCTET_STRING";
            case 5:
              return "NULL";
            case 6:
              return "OBJECT_IDENTIFIER";
            case 7:
              return "ObjectDescriptor";
            case 8:
              return "EXTERNAL";
            case 9:
              return "REAL";
            case 10:
              return "ENUMERATED";
            case 11:
              return "EMBEDDED_PDV";
            case 12:
              return "UTF8String";
            case 16:
              return "SEQUENCE";
            case 17:
              return "SET";
            case 18:
              return "NumericString";
            case 19:
              return "PrintableString";
            // ASCII subset
            case 20:
              return "TeletexString";
            // aka T61String
            case 21:
              return "VideotexString";
            case 22:
              return "IA5String";
            // ASCII
            case 23:
              return "UTCTime";
            case 24:
              return "GeneralizedTime";
            case 25:
              return "GraphicString";
            case 26:
              return "VisibleString";
            // ASCII subset
            case 27:
              return "GeneralString";
            case 28:
              return "UniversalString";
            case 30:
              return "BMPString";
          }
          return "Universal_" + this.tag.tagNumber.toString();
        case 1:
          return "Application_" + this.tag.tagNumber.toString();
        case 2:
          return "[" + this.tag.tagNumber.toString() + "]";
        // Context
        case 3:
          return "Private_" + this.tag.tagNumber.toString();
      }
    }, i.prototype.content = function(e) {
      if (this.tag === void 0)
        return null;
      e === void 0 && (e = 1 / 0);
      var r = this.posContent(), n = Math.abs(this.length);
      if (!this.tag.isUniversal())
        return this.sub !== null ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(r, r + n, e);
      switch (this.tag.tagNumber) {
        case 1:
          return this.stream.get(r) === 0 ? "false" : "true";
        case 2:
          return this.stream.parseInteger(r, r + n);
        case 3:
          return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(r, r + n, e);
        case 4:
          return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(r, r + n, e);
        // case 0x05: // NULL
        case 6:
          return this.stream.parseOID(r, r + n, e);
        // case 0x07: // ObjectDescriptor
        // case 0x08: // EXTERNAL
        // case 0x09: // REAL
        // case 0x0A: // ENUMERATED
        // case 0x0B: // EMBEDDED_PDV
        case 16:
        // SEQUENCE
        case 17:
          return this.sub !== null ? "(" + this.sub.length + " elem)" : "(no elem)";
        case 12:
          return stringCut(this.stream.parseStringUTF(r, r + n), e);
        case 18:
        // NumericString
        case 19:
        // PrintableString
        case 20:
        // TeletexString
        case 21:
        // VideotexString
        case 22:
        // IA5String
        // case 0x19: // GraphicString
        case 26:
          return stringCut(this.stream.parseStringISO(r, r + n), e);
        case 30:
          return stringCut(this.stream.parseStringBMP(r, r + n), e);
        case 23:
        // UTCTime
        case 24:
          return this.stream.parseTime(r, r + n, this.tag.tagNumber == 23);
      }
      return null;
    }, i.prototype.toString = function() {
      return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (this.sub === null ? "null" : this.sub.length) + "]";
    }, i.prototype.toPrettyString = function(e) {
      e === void 0 && (e = "");
      var r = e + this.typeName() + " @" + this.stream.pos;
      if (this.length >= 0 && (r += "+"), r += this.length, this.tag.tagConstructed ? r += " (constructed)" : this.tag.isUniversal() && (this.tag.tagNumber == 3 || this.tag.tagNumber == 4) && this.sub !== null && (r += " (encapsulates)"), r += `
`, this.sub !== null) {
        e += "  ";
        for (var n = 0, s = this.sub.length; n < s; ++n)
          r += this.sub[n].toPrettyString(e);
      }
      return r;
    }, i.prototype.posStart = function() {
      return this.stream.pos;
    }, i.prototype.posContent = function() {
      return this.stream.pos + this.header;
    }, i.prototype.posEnd = function() {
      return this.stream.pos + this.header + Math.abs(this.length);
    }, i.prototype.toHexString = function() {
      return this.stream.hexDump(this.posStart(), this.posEnd(), !0);
    }, i.decodeLength = function(e) {
      var r = e.get(), n = r & 127;
      if (n == r)
        return n;
      if (n > 6)
        throw new Error("Length over 48 bits not supported at position " + (e.pos - 1));
      if (n === 0)
        return null;
      r = 0;
      for (var s = 0; s < n; ++s)
        r = r * 256 + e.get();
      return r;
    }, i.prototype.getHexStringValue = function() {
      var e = this.toHexString(), r = this.header * 2, n = this.length * 2;
      return e.substr(r, n);
    }, i.decode = function(e) {
      var r;
      e instanceof Stream ? r = e : r = new Stream(e, 0);
      var n = new Stream(r), s = new ASN1Tag(r), o = i.decodeLength(r), a = r.pos, u = a - n.pos, l = null, p = function() {
        var d = [];
        if (o !== null) {
          for (var v = a + o; r.pos < v; )
            d[d.length] = i.decode(r);
          if (r.pos != v)
            throw new Error("Content size is not correct for container starting at offset " + a);
        } else
          try {
            for (; ; ) {
              var y = i.decode(r);
              if (y.tag.isEOC())
                break;
              d[d.length] = y;
            }
            o = a - r.pos;
          } catch (S) {
            throw new Error("Exception while decoding undefined length content: " + S);
          }
        return d;
      };
      if (s.tagConstructed)
        l = p();
      else if (s.isUniversal() && (s.tagNumber == 3 || s.tagNumber == 4))
        try {
          if (s.tagNumber == 3 && r.get() != 0)
            throw new Error("BIT STRINGs with unused bits cannot encapsulate.");
          l = p();
          for (var g = 0; g < l.length; ++g)
            if (l[g].tag.isEOC())
              throw new Error("EOC is not supposed to be actual content.");
        } catch {
          l = null;
        }
      if (l === null) {
        if (o === null)
          throw new Error("We can't skip over an invalid tag with undefined length at offset " + a);
        r.pos = a + Math.abs(o);
      }
      return new i(n, u, o, s, l);
    }, i;
  }()
), ASN1Tag = (
  /** @class */
  function() {
    function i(e) {
      var r = e.get();
      if (this.tagClass = r >> 6, this.tagConstructed = (r & 32) !== 0, this.tagNumber = r & 31, this.tagNumber == 31) {
        var n = new Int10();
        do
          r = e.get(), n.mulAdd(128, r & 127);
        while (r & 128);
        this.tagNumber = n.simplify();
      }
    }
    return i.prototype.isUniversal = function() {
      return this.tagClass === 0;
    }, i.prototype.isEOC = function() {
      return this.tagClass === 0 && this.tagNumber === 0;
    }, i;
  }()
), dbits, canary = 244837814094590, j_lm = (canary & 16777215) == 15715070, lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], lplim = (1 << 26) / lowprimes[lowprimes.length - 1], BigInteger = (
  /** @class */
  function() {
    function i(e, r, n) {
      e != null && (typeof e == "number" ? this.fromNumber(e, r, n) : r == null && typeof e != "string" ? this.fromString(e, 256) : this.fromString(e, r));
    }
    return i.prototype.toString = function(e) {
      if (this.s < 0)
        return "-" + this.negate().toString(e);
      var r;
      if (e == 16)
        r = 4;
      else if (e == 8)
        r = 3;
      else if (e == 2)
        r = 1;
      else if (e == 32)
        r = 5;
      else if (e == 4)
        r = 2;
      else
        return this.toRadix(e);
      var n = (1 << r) - 1, s, o = !1, a = "", u = this.t, l = this.DB - u * this.DB % r;
      if (u-- > 0)
        for (l < this.DB && (s = this[u] >> l) > 0 && (o = !0, a = int2char(s)); u >= 0; )
          l < r ? (s = (this[u] & (1 << l) - 1) << r - l, s |= this[--u] >> (l += this.DB - r)) : (s = this[u] >> (l -= r) & n, l <= 0 && (l += this.DB, --u)), s > 0 && (o = !0), o && (a += int2char(s));
      return o ? a : "0";
    }, i.prototype.negate = function() {
      var e = nbi();
      return i.ZERO.subTo(this, e), e;
    }, i.prototype.abs = function() {
      return this.s < 0 ? this.negate() : this;
    }, i.prototype.compareTo = function(e) {
      var r = this.s - e.s;
      if (r != 0)
        return r;
      var n = this.t;
      if (r = n - e.t, r != 0)
        return this.s < 0 ? -r : r;
      for (; --n >= 0; )
        if ((r = this[n] - e[n]) != 0)
          return r;
      return 0;
    }, i.prototype.bitLength = function() {
      return this.t <= 0 ? 0 : this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);
    }, i.prototype.mod = function(e) {
      var r = nbi();
      return this.abs().divRemTo(e, null, r), this.s < 0 && r.compareTo(i.ZERO) > 0 && e.subTo(r, r), r;
    }, i.prototype.modPowInt = function(e, r) {
      var n;
      return e < 256 || r.isEven() ? n = new Classic(r) : n = new Montgomery(r), this.exp(e, n);
    }, i.prototype.clone = function() {
      var e = nbi();
      return this.copyTo(e), e;
    }, i.prototype.intValue = function() {
      if (this.s < 0) {
        if (this.t == 1)
          return this[0] - this.DV;
        if (this.t == 0)
          return -1;
      } else {
        if (this.t == 1)
          return this[0];
        if (this.t == 0)
          return 0;
      }
      return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
    }, i.prototype.byteValue = function() {
      return this.t == 0 ? this.s : this[0] << 24 >> 24;
    }, i.prototype.shortValue = function() {
      return this.t == 0 ? this.s : this[0] << 16 >> 16;
    }, i.prototype.signum = function() {
      return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1;
    }, i.prototype.toByteArray = function() {
      var e = this.t, r = [];
      r[0] = this.s;
      var n = this.DB - e * this.DB % 8, s, o = 0;
      if (e-- > 0)
        for (n < this.DB && (s = this[e] >> n) != (this.s & this.DM) >> n && (r[o++] = s | this.s << this.DB - n); e >= 0; )
          n < 8 ? (s = (this[e] & (1 << n) - 1) << 8 - n, s |= this[--e] >> (n += this.DB - 8)) : (s = this[e] >> (n -= 8) & 255, n <= 0 && (n += this.DB, --e)), s & 128 && (s |= -256), o == 0 && (this.s & 128) != (s & 128) && ++o, (o > 0 || s != this.s) && (r[o++] = s);
      return r;
    }, i.prototype.equals = function(e) {
      return this.compareTo(e) == 0;
    }, i.prototype.min = function(e) {
      return this.compareTo(e) < 0 ? this : e;
    }, i.prototype.max = function(e) {
      return this.compareTo(e) > 0 ? this : e;
    }, i.prototype.and = function(e) {
      var r = nbi();
      return this.bitwiseTo(e, op_and, r), r;
    }, i.prototype.or = function(e) {
      var r = nbi();
      return this.bitwiseTo(e, op_or, r), r;
    }, i.prototype.xor = function(e) {
      var r = nbi();
      return this.bitwiseTo(e, op_xor, r), r;
    }, i.prototype.andNot = function(e) {
      var r = nbi();
      return this.bitwiseTo(e, op_andnot, r), r;
    }, i.prototype.not = function() {
      for (var e = nbi(), r = 0; r < this.t; ++r)
        e[r] = this.DM & ~this[r];
      return e.t = this.t, e.s = ~this.s, e;
    }, i.prototype.shiftLeft = function(e) {
      var r = nbi();
      return e < 0 ? this.rShiftTo(-e, r) : this.lShiftTo(e, r), r;
    }, i.prototype.shiftRight = function(e) {
      var r = nbi();
      return e < 0 ? this.lShiftTo(-e, r) : this.rShiftTo(e, r), r;
    }, i.prototype.getLowestSetBit = function() {
      for (var e = 0; e < this.t; ++e)
        if (this[e] != 0)
          return e * this.DB + lbit(this[e]);
      return this.s < 0 ? this.t * this.DB : -1;
    }, i.prototype.bitCount = function() {
      for (var e = 0, r = this.s & this.DM, n = 0; n < this.t; ++n)
        e += cbit(this[n] ^ r);
      return e;
    }, i.prototype.testBit = function(e) {
      var r = Math.floor(e / this.DB);
      return r >= this.t ? this.s != 0 : (this[r] & 1 << e % this.DB) != 0;
    }, i.prototype.setBit = function(e) {
      return this.changeBit(e, op_or);
    }, i.prototype.clearBit = function(e) {
      return this.changeBit(e, op_andnot);
    }, i.prototype.flipBit = function(e) {
      return this.changeBit(e, op_xor);
    }, i.prototype.add = function(e) {
      var r = nbi();
      return this.addTo(e, r), r;
    }, i.prototype.subtract = function(e) {
      var r = nbi();
      return this.subTo(e, r), r;
    }, i.prototype.multiply = function(e) {
      var r = nbi();
      return this.multiplyTo(e, r), r;
    }, i.prototype.divide = function(e) {
      var r = nbi();
      return this.divRemTo(e, r, null), r;
    }, i.prototype.remainder = function(e) {
      var r = nbi();
      return this.divRemTo(e, null, r), r;
    }, i.prototype.divideAndRemainder = function(e) {
      var r = nbi(), n = nbi();
      return this.divRemTo(e, r, n), [r, n];
    }, i.prototype.modPow = function(e, r) {
      var n = e.bitLength(), s, o = nbv(1), a;
      if (n <= 0)
        return o;
      n < 18 ? s = 1 : n < 48 ? s = 3 : n < 144 ? s = 4 : n < 768 ? s = 5 : s = 6, n < 8 ? a = new Classic(r) : r.isEven() ? a = new Barrett(r) : a = new Montgomery(r);
      var u = [], l = 3, p = s - 1, g = (1 << s) - 1;
      if (u[1] = a.convert(this), s > 1) {
        var d = nbi();
        for (a.sqrTo(u[1], d); l <= g; )
          u[l] = nbi(), a.mulTo(d, u[l - 2], u[l]), l += 2;
      }
      var v = e.t - 1, y, S = !0, b = nbi(), w;
      for (n = nbits(e[v]) - 1; v >= 0; ) {
        for (n >= p ? y = e[v] >> n - p & g : (y = (e[v] & (1 << n + 1) - 1) << p - n, v > 0 && (y |= e[v - 1] >> this.DB + n - p)), l = s; !(y & 1); )
          y >>= 1, --l;
        if ((n -= l) < 0 && (n += this.DB, --v), S)
          u[y].copyTo(o), S = !1;
        else {
          for (; l > 1; )
            a.sqrTo(o, b), a.sqrTo(b, o), l -= 2;
          l > 0 ? a.sqrTo(o, b) : (w = o, o = b, b = w), a.mulTo(b, u[y], o);
        }
        for (; v >= 0 && !(e[v] & 1 << n); )
          a.sqrTo(o, b), w = o, o = b, b = w, --n < 0 && (n = this.DB - 1, --v);
      }
      return a.revert(o);
    }, i.prototype.modInverse = function(e) {
      var r = e.isEven();
      if (this.isEven() && r || e.signum() == 0)
        return i.ZERO;
      for (var n = e.clone(), s = this.clone(), o = nbv(1), a = nbv(0), u = nbv(0), l = nbv(1); n.signum() != 0; ) {
        for (; n.isEven(); )
          n.rShiftTo(1, n), r ? ((!o.isEven() || !a.isEven()) && (o.addTo(this, o), a.subTo(e, a)), o.rShiftTo(1, o)) : a.isEven() || a.subTo(e, a), a.rShiftTo(1, a);
        for (; s.isEven(); )
          s.rShiftTo(1, s), r ? ((!u.isEven() || !l.isEven()) && (u.addTo(this, u), l.subTo(e, l)), u.rShiftTo(1, u)) : l.isEven() || l.subTo(e, l), l.rShiftTo(1, l);
        n.compareTo(s) >= 0 ? (n.subTo(s, n), r && o.subTo(u, o), a.subTo(l, a)) : (s.subTo(n, s), r && u.subTo(o, u), l.subTo(a, l));
      }
      if (s.compareTo(i.ONE) != 0)
        return i.ZERO;
      if (l.compareTo(e) >= 0)
        return l.subtract(e);
      if (l.signum() < 0)
        l.addTo(e, l);
      else
        return l;
      return l.signum() < 0 ? l.add(e) : l;
    }, i.prototype.pow = function(e) {
      return this.exp(e, new NullExp());
    }, i.prototype.gcd = function(e) {
      var r = this.s < 0 ? this.negate() : this.clone(), n = e.s < 0 ? e.negate() : e.clone();
      if (r.compareTo(n) < 0) {
        var s = r;
        r = n, n = s;
      }
      var o = r.getLowestSetBit(), a = n.getLowestSetBit();
      if (a < 0)
        return r;
      for (o < a && (a = o), a > 0 && (r.rShiftTo(a, r), n.rShiftTo(a, n)); r.signum() > 0; )
        (o = r.getLowestSetBit()) > 0 && r.rShiftTo(o, r), (o = n.getLowestSetBit()) > 0 && n.rShiftTo(o, n), r.compareTo(n) >= 0 ? (r.subTo(n, r), r.rShiftTo(1, r)) : (n.subTo(r, n), n.rShiftTo(1, n));
      return a > 0 && n.lShiftTo(a, n), n;
    }, i.prototype.isProbablePrime = function(e) {
      var r, n = this.abs();
      if (n.t == 1 && n[0] <= lowprimes[lowprimes.length - 1]) {
        for (r = 0; r < lowprimes.length; ++r)
          if (n[0] == lowprimes[r])
            return !0;
        return !1;
      }
      if (n.isEven())
        return !1;
      for (r = 1; r < lowprimes.length; ) {
        for (var s = lowprimes[r], o = r + 1; o < lowprimes.length && s < lplim; )
          s *= lowprimes[o++];
        for (s = n.modInt(s); r < o; )
          if (s % lowprimes[r++] == 0)
            return !1;
      }
      return n.millerRabin(e);
    }, i.prototype.copyTo = function(e) {
      for (var r = this.t - 1; r >= 0; --r)
        e[r] = this[r];
      e.t = this.t, e.s = this.s;
    }, i.prototype.fromInt = function(e) {
      this.t = 1, this.s = e < 0 ? -1 : 0, e > 0 ? this[0] = e : e < -1 ? this[0] = e + this.DV : this.t = 0;
    }, i.prototype.fromString = function(e, r) {
      var n;
      if (r == 16)
        n = 4;
      else if (r == 8)
        n = 3;
      else if (r == 256)
        n = 8;
      else if (r == 2)
        n = 1;
      else if (r == 32)
        n = 5;
      else if (r == 4)
        n = 2;
      else {
        this.fromRadix(e, r);
        return;
      }
      this.t = 0, this.s = 0;
      for (var s = e.length, o = !1, a = 0; --s >= 0; ) {
        var u = n == 8 ? +e[s] & 255 : intAt(e, s);
        if (u < 0) {
          e.charAt(s) == "-" && (o = !0);
          continue;
        }
        o = !1, a == 0 ? this[this.t++] = u : a + n > this.DB ? (this[this.t - 1] |= (u & (1 << this.DB - a) - 1) << a, this[this.t++] = u >> this.DB - a) : this[this.t - 1] |= u << a, a += n, a >= this.DB && (a -= this.DB);
      }
      n == 8 && +e[0] & 128 && (this.s = -1, a > 0 && (this[this.t - 1] |= (1 << this.DB - a) - 1 << a)), this.clamp(), o && i.ZERO.subTo(this, this);
    }, i.prototype.clamp = function() {
      for (var e = this.s & this.DM; this.t > 0 && this[this.t - 1] == e; )
        --this.t;
    }, i.prototype.dlShiftTo = function(e, r) {
      var n;
      for (n = this.t - 1; n >= 0; --n)
        r[n + e] = this[n];
      for (n = e - 1; n >= 0; --n)
        r[n] = 0;
      r.t = this.t + e, r.s = this.s;
    }, i.prototype.drShiftTo = function(e, r) {
      for (var n = e; n < this.t; ++n)
        r[n - e] = this[n];
      r.t = Math.max(this.t - e, 0), r.s = this.s;
    }, i.prototype.lShiftTo = function(e, r) {
      for (var n = e % this.DB, s = this.DB - n, o = (1 << s) - 1, a = Math.floor(e / this.DB), u = this.s << n & this.DM, l = this.t - 1; l >= 0; --l)
        r[l + a + 1] = this[l] >> s | u, u = (this[l] & o) << n;
      for (var l = a - 1; l >= 0; --l)
        r[l] = 0;
      r[a] = u, r.t = this.t + a + 1, r.s = this.s, r.clamp();
    }, i.prototype.rShiftTo = function(e, r) {
      r.s = this.s;
      var n = Math.floor(e / this.DB);
      if (n >= this.t) {
        r.t = 0;
        return;
      }
      var s = e % this.DB, o = this.DB - s, a = (1 << s) - 1;
      r[0] = this[n] >> s;
      for (var u = n + 1; u < this.t; ++u)
        r[u - n - 1] |= (this[u] & a) << o, r[u - n] = this[u] >> s;
      s > 0 && (r[this.t - n - 1] |= (this.s & a) << o), r.t = this.t - n, r.clamp();
    }, i.prototype.subTo = function(e, r) {
      for (var n = 0, s = 0, o = Math.min(e.t, this.t); n < o; )
        s += this[n] - e[n], r[n++] = s & this.DM, s >>= this.DB;
      if (e.t < this.t) {
        for (s -= e.s; n < this.t; )
          s += this[n], r[n++] = s & this.DM, s >>= this.DB;
        s += this.s;
      } else {
        for (s += this.s; n < e.t; )
          s -= e[n], r[n++] = s & this.DM, s >>= this.DB;
        s -= e.s;
      }
      r.s = s < 0 ? -1 : 0, s < -1 ? r[n++] = this.DV + s : s > 0 && (r[n++] = s), r.t = n, r.clamp();
    }, i.prototype.multiplyTo = function(e, r) {
      var n = this.abs(), s = e.abs(), o = n.t;
      for (r.t = o + s.t; --o >= 0; )
        r[o] = 0;
      for (o = 0; o < s.t; ++o)
        r[o + n.t] = n.am(0, s[o], r, o, 0, n.t);
      r.s = 0, r.clamp(), this.s != e.s && i.ZERO.subTo(r, r);
    }, i.prototype.squareTo = function(e) {
      for (var r = this.abs(), n = e.t = 2 * r.t; --n >= 0; )
        e[n] = 0;
      for (n = 0; n < r.t - 1; ++n) {
        var s = r.am(n, r[n], e, 2 * n, 0, 1);
        (e[n + r.t] += r.am(n + 1, 2 * r[n], e, 2 * n + 1, s, r.t - n - 1)) >= r.DV && (e[n + r.t] -= r.DV, e[n + r.t + 1] = 1);
      }
      e.t > 0 && (e[e.t - 1] += r.am(n, r[n], e, 2 * n, 0, 1)), e.s = 0, e.clamp();
    }, i.prototype.divRemTo = function(e, r, n) {
      var s = e.abs();
      if (!(s.t <= 0)) {
        var o = this.abs();
        if (o.t < s.t) {
          r != null && r.fromInt(0), n != null && this.copyTo(n);
          return;
        }
        n == null && (n = nbi());
        var a = nbi(), u = this.s, l = e.s, p = this.DB - nbits(s[s.t - 1]);
        p > 0 ? (s.lShiftTo(p, a), o.lShiftTo(p, n)) : (s.copyTo(a), o.copyTo(n));
        var g = a.t, d = a[g - 1];
        if (d != 0) {
          var v = d * (1 << this.F1) + (g > 1 ? a[g - 2] >> this.F2 : 0), y = this.FV / v, S = (1 << this.F1) / v, b = 1 << this.F2, w = n.t, A = w - g, x = r ?? nbi();
          for (a.dlShiftTo(A, x), n.compareTo(x) >= 0 && (n[n.t++] = 1, n.subTo(x, n)), i.ONE.dlShiftTo(g, x), x.subTo(a, a); a.t < g; )
            a[a.t++] = 0;
          for (; --A >= 0; ) {
            var I = n[--w] == d ? this.DM : Math.floor(n[w] * y + (n[w - 1] + b) * S);
            if ((n[w] += a.am(0, I, n, A, 0, g)) < I)
              for (a.dlShiftTo(A, x), n.subTo(x, n); n[w] < --I; )
                n.subTo(x, n);
          }
          r != null && (n.drShiftTo(g, r), u != l && i.ZERO.subTo(r, r)), n.t = g, n.clamp(), p > 0 && n.rShiftTo(p, n), u < 0 && i.ZERO.subTo(n, n);
        }
      }
    }, i.prototype.invDigit = function() {
      if (this.t < 1)
        return 0;
      var e = this[0];
      if (!(e & 1))
        return 0;
      var r = e & 3;
      return r = r * (2 - (e & 15) * r) & 15, r = r * (2 - (e & 255) * r) & 255, r = r * (2 - ((e & 65535) * r & 65535)) & 65535, r = r * (2 - e * r % this.DV) % this.DV, r > 0 ? this.DV - r : -r;
    }, i.prototype.isEven = function() {
      return (this.t > 0 ? this[0] & 1 : this.s) == 0;
    }, i.prototype.exp = function(e, r) {
      if (e > 4294967295 || e < 1)
        return i.ONE;
      var n = nbi(), s = nbi(), o = r.convert(this), a = nbits(e) - 1;
      for (o.copyTo(n); --a >= 0; )
        if (r.sqrTo(n, s), (e & 1 << a) > 0)
          r.mulTo(s, o, n);
        else {
          var u = n;
          n = s, s = u;
        }
      return r.revert(n);
    }, i.prototype.chunkSize = function(e) {
      return Math.floor(Math.LN2 * this.DB / Math.log(e));
    }, i.prototype.toRadix = function(e) {
      if (e == null && (e = 10), this.signum() == 0 || e < 2 || e > 36)
        return "0";
      var r = this.chunkSize(e), n = Math.pow(e, r), s = nbv(n), o = nbi(), a = nbi(), u = "";
      for (this.divRemTo(s, o, a); o.signum() > 0; )
        u = (n + a.intValue()).toString(e).substr(1) + u, o.divRemTo(s, o, a);
      return a.intValue().toString(e) + u;
    }, i.prototype.fromRadix = function(e, r) {
      this.fromInt(0), r == null && (r = 10);
      for (var n = this.chunkSize(r), s = Math.pow(r, n), o = !1, a = 0, u = 0, l = 0; l < e.length; ++l) {
        var p = intAt(e, l);
        if (p < 0) {
          e.charAt(l) == "-" && this.signum() == 0 && (o = !0);
          continue;
        }
        u = r * u + p, ++a >= n && (this.dMultiply(s), this.dAddOffset(u, 0), a = 0, u = 0);
      }
      a > 0 && (this.dMultiply(Math.pow(r, a)), this.dAddOffset(u, 0)), o && i.ZERO.subTo(this, this);
    }, i.prototype.fromNumber = function(e, r, n) {
      if (typeof r == "number")
        if (e < 2)
          this.fromInt(1);
        else
          for (this.fromNumber(e, n), this.testBit(e - 1) || this.bitwiseTo(i.ONE.shiftLeft(e - 1), op_or, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(r); )
            this.dAddOffset(2, 0), this.bitLength() > e && this.subTo(i.ONE.shiftLeft(e - 1), this);
      else {
        var s = [], o = e & 7;
        s.length = (e >> 3) + 1, r.nextBytes(s), o > 0 ? s[0] &= (1 << o) - 1 : s[0] = 0, this.fromString(s, 256);
      }
    }, i.prototype.bitwiseTo = function(e, r, n) {
      var s, o, a = Math.min(e.t, this.t);
      for (s = 0; s < a; ++s)
        n[s] = r(this[s], e[s]);
      if (e.t < this.t) {
        for (o = e.s & this.DM, s = a; s < this.t; ++s)
          n[s] = r(this[s], o);
        n.t = this.t;
      } else {
        for (o = this.s & this.DM, s = a; s < e.t; ++s)
          n[s] = r(o, e[s]);
        n.t = e.t;
      }
      n.s = r(this.s, e.s), n.clamp();
    }, i.prototype.changeBit = function(e, r) {
      var n = i.ONE.shiftLeft(e);
      return this.bitwiseTo(n, r, n), n;
    }, i.prototype.addTo = function(e, r) {
      for (var n = 0, s = 0, o = Math.min(e.t, this.t); n < o; )
        s += this[n] + e[n], r[n++] = s & this.DM, s >>= this.DB;
      if (e.t < this.t) {
        for (s += e.s; n < this.t; )
          s += this[n], r[n++] = s & this.DM, s >>= this.DB;
        s += this.s;
      } else {
        for (s += this.s; n < e.t; )
          s += e[n], r[n++] = s & this.DM, s >>= this.DB;
        s += e.s;
      }
      r.s = s < 0 ? -1 : 0, s > 0 ? r[n++] = s : s < -1 && (r[n++] = this.DV + s), r.t = n, r.clamp();
    }, i.prototype.dMultiply = function(e) {
      this[this.t] = this.am(0, e - 1, this, 0, 0, this.t), ++this.t, this.clamp();
    }, i.prototype.dAddOffset = function(e, r) {
      if (e != 0) {
        for (; this.t <= r; )
          this[this.t++] = 0;
        for (this[r] += e; this[r] >= this.DV; )
          this[r] -= this.DV, ++r >= this.t && (this[this.t++] = 0), ++this[r];
      }
    }, i.prototype.multiplyLowerTo = function(e, r, n) {
      var s = Math.min(this.t + e.t, r);
      for (n.s = 0, n.t = s; s > 0; )
        n[--s] = 0;
      for (var o = n.t - this.t; s < o; ++s)
        n[s + this.t] = this.am(0, e[s], n, s, 0, this.t);
      for (var o = Math.min(e.t, r); s < o; ++s)
        this.am(0, e[s], n, s, 0, r - s);
      n.clamp();
    }, i.prototype.multiplyUpperTo = function(e, r, n) {
      --r;
      var s = n.t = this.t + e.t - r;
      for (n.s = 0; --s >= 0; )
        n[s] = 0;
      for (s = Math.max(r - this.t, 0); s < e.t; ++s)
        n[this.t + s - r] = this.am(r - s, e[s], n, 0, 0, this.t + s - r);
      n.clamp(), n.drShiftTo(1, n);
    }, i.prototype.modInt = function(e) {
      if (e <= 0)
        return 0;
      var r = this.DV % e, n = this.s < 0 ? e - 1 : 0;
      if (this.t > 0)
        if (r == 0)
          n = this[0] % e;
        else
          for (var s = this.t - 1; s >= 0; --s)
            n = (r * n + this[s]) % e;
      return n;
    }, i.prototype.millerRabin = function(e) {
      var r = this.subtract(i.ONE), n = r.getLowestSetBit();
      if (n <= 0)
        return !1;
      var s = r.shiftRight(n);
      e = e + 1 >> 1, e > lowprimes.length && (e = lowprimes.length);
      for (var o = nbi(), a = 0; a < e; ++a) {
        o.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);
        var u = o.modPow(s, this);
        if (u.compareTo(i.ONE) != 0 && u.compareTo(r) != 0) {
          for (var l = 1; l++ < n && u.compareTo(r) != 0; )
            if (u = u.modPowInt(2, this), u.compareTo(i.ONE) == 0)
              return !1;
          if (u.compareTo(r) != 0)
            return !1;
        }
      }
      return !0;
    }, i.prototype.square = function() {
      var e = nbi();
      return this.squareTo(e), e;
    }, i.prototype.gcda = function(e, r) {
      var n = this.s < 0 ? this.negate() : this.clone(), s = e.s < 0 ? e.negate() : e.clone();
      if (n.compareTo(s) < 0) {
        var o = n;
        n = s, s = o;
      }
      var a = n.getLowestSetBit(), u = s.getLowestSetBit();
      if (u < 0) {
        r(n);
        return;
      }
      a < u && (u = a), u > 0 && (n.rShiftTo(u, n), s.rShiftTo(u, s));
      var l = function() {
        (a = n.getLowestSetBit()) > 0 && n.rShiftTo(a, n), (a = s.getLowestSetBit()) > 0 && s.rShiftTo(a, s), n.compareTo(s) >= 0 ? (n.subTo(s, n), n.rShiftTo(1, n)) : (s.subTo(n, s), s.rShiftTo(1, s)), n.signum() > 0 ? setTimeout(l, 0) : (u > 0 && s.lShiftTo(u, s), setTimeout(function() {
          r(s);
        }, 0));
      };
      setTimeout(l, 10);
    }, i.prototype.fromNumberAsync = function(e, r, n, s) {
      if (typeof r == "number")
        if (e < 2)
          this.fromInt(1);
        else {
          this.fromNumber(e, n), this.testBit(e - 1) || this.bitwiseTo(i.ONE.shiftLeft(e - 1), op_or, this), this.isEven() && this.dAddOffset(1, 0);
          var o = this, a = function() {
            o.dAddOffset(2, 0), o.bitLength() > e && o.subTo(i.ONE.shiftLeft(e - 1), o), o.isProbablePrime(r) ? setTimeout(function() {
              s();
            }, 0) : setTimeout(a, 0);
          };
          setTimeout(a, 0);
        }
      else {
        var u = [], l = e & 7;
        u.length = (e >> 3) + 1, r.nextBytes(u), l > 0 ? u[0] &= (1 << l) - 1 : u[0] = 0, this.fromString(u, 256);
      }
    }, i;
  }()
), NullExp = (
  /** @class */
  function() {
    function i() {
    }
    return i.prototype.convert = function(e) {
      return e;
    }, i.prototype.revert = function(e) {
      return e;
    }, i.prototype.mulTo = function(e, r, n) {
      e.multiplyTo(r, n);
    }, i.prototype.sqrTo = function(e, r) {
      e.squareTo(r);
    }, i;
  }()
), Classic = (
  /** @class */
  function() {
    function i(e) {
      this.m = e;
    }
    return i.prototype.convert = function(e) {
      return e.s < 0 || e.compareTo(this.m) >= 0 ? e.mod(this.m) : e;
    }, i.prototype.revert = function(e) {
      return e;
    }, i.prototype.reduce = function(e) {
      e.divRemTo(this.m, null, e);
    }, i.prototype.mulTo = function(e, r, n) {
      e.multiplyTo(r, n), this.reduce(n);
    }, i.prototype.sqrTo = function(e, r) {
      e.squareTo(r), this.reduce(r);
    }, i;
  }()
), Montgomery = (
  /** @class */
  function() {
    function i(e) {
      this.m = e, this.mp = e.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << e.DB - 15) - 1, this.mt2 = 2 * e.t;
    }
    return i.prototype.convert = function(e) {
      var r = nbi();
      return e.abs().dlShiftTo(this.m.t, r), r.divRemTo(this.m, null, r), e.s < 0 && r.compareTo(BigInteger.ZERO) > 0 && this.m.subTo(r, r), r;
    }, i.prototype.revert = function(e) {
      var r = nbi();
      return e.copyTo(r), this.reduce(r), r;
    }, i.prototype.reduce = function(e) {
      for (; e.t <= this.mt2; )
        e[e.t++] = 0;
      for (var r = 0; r < this.m.t; ++r) {
        var n = e[r] & 32767, s = n * this.mpl + ((n * this.mph + (e[r] >> 15) * this.mpl & this.um) << 15) & e.DM;
        for (n = r + this.m.t, e[n] += this.m.am(0, s, e, r, 0, this.m.t); e[n] >= e.DV; )
          e[n] -= e.DV, e[++n]++;
      }
      e.clamp(), e.drShiftTo(this.m.t, e), e.compareTo(this.m) >= 0 && e.subTo(this.m, e);
    }, i.prototype.mulTo = function(e, r, n) {
      e.multiplyTo(r, n), this.reduce(n);
    }, i.prototype.sqrTo = function(e, r) {
      e.squareTo(r), this.reduce(r);
    }, i;
  }()
), Barrett = (
  /** @class */
  function() {
    function i(e) {
      this.m = e, this.r2 = nbi(), this.q3 = nbi(), BigInteger.ONE.dlShiftTo(2 * e.t, this.r2), this.mu = this.r2.divide(e);
    }
    return i.prototype.convert = function(e) {
      if (e.s < 0 || e.t > 2 * this.m.t)
        return e.mod(this.m);
      if (e.compareTo(this.m) < 0)
        return e;
      var r = nbi();
      return e.copyTo(r), this.reduce(r), r;
    }, i.prototype.revert = function(e) {
      return e;
    }, i.prototype.reduce = function(e) {
      for (e.drShiftTo(this.m.t - 1, this.r2), e.t > this.m.t + 1 && (e.t = this.m.t + 1, e.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); e.compareTo(this.r2) < 0; )
        e.dAddOffset(1, this.m.t + 1);
      for (e.subTo(this.r2, e); e.compareTo(this.m) >= 0; )
        e.subTo(this.m, e);
    }, i.prototype.mulTo = function(e, r, n) {
      e.multiplyTo(r, n), this.reduce(n);
    }, i.prototype.sqrTo = function(e, r) {
      e.squareTo(r), this.reduce(r);
    }, i;
  }()
);
function nbi() {
  return new BigInteger(null);
}
function parseBigInt(i, e) {
  return new BigInteger(i, e);
}
var inBrowser = typeof navigator < "u";
inBrowser && j_lm && navigator.appName == "Microsoft Internet Explorer" ? (BigInteger.prototype.am = function(e, r, n, s, o, a) {
  for (var u = r & 32767, l = r >> 15; --a >= 0; ) {
    var p = this[e] & 32767, g = this[e++] >> 15, d = l * p + g * u;
    p = u * p + ((d & 32767) << 15) + n[s] + (o & 1073741823), o = (p >>> 30) + (d >>> 15) + l * g + (o >>> 30), n[s++] = p & 1073741823;
  }
  return o;
}, dbits = 30) : inBrowser && j_lm && navigator.appName != "Netscape" ? (BigInteger.prototype.am = function(e, r, n, s, o, a) {
  for (; --a >= 0; ) {
    var u = r * this[e++] + n[s] + o;
    o = Math.floor(u / 67108864), n[s++] = u & 67108863;
  }
  return o;
}, dbits = 26) : (BigInteger.prototype.am = function(e, r, n, s, o, a) {
  for (var u = r & 16383, l = r >> 14; --a >= 0; ) {
    var p = this[e] & 16383, g = this[e++] >> 14, d = l * p + g * u;
    p = u * p + ((d & 16383) << 14) + n[s] + o, o = (p >> 28) + (d >> 14) + l * g, n[s++] = p & 268435455;
  }
  return o;
}, dbits = 28);
BigInteger.prototype.DB = dbits;
BigInteger.prototype.DM = (1 << dbits) - 1;
BigInteger.prototype.DV = 1 << dbits;
var BI_FP = 52;
BigInteger.prototype.FV = Math.pow(2, BI_FP);
BigInteger.prototype.F1 = BI_FP - dbits;
BigInteger.prototype.F2 = 2 * dbits - BI_FP;
var BI_RC = [], rr, vv;
rr = 48;
for (vv = 0; vv <= 9; ++vv)
  BI_RC[rr++] = vv;
rr = 97;
for (vv = 10; vv < 36; ++vv)
  BI_RC[rr++] = vv;
rr = 65;
for (vv = 10; vv < 36; ++vv)
  BI_RC[rr++] = vv;
function intAt(i, e) {
  var r = BI_RC[i.charCodeAt(e)];
  return r ?? -1;
}
function nbv(i) {
  var e = nbi();
  return e.fromInt(i), e;
}
function nbits(i) {
  var e = 1, r;
  return (r = i >>> 16) != 0 && (i = r, e += 16), (r = i >> 8) != 0 && (i = r, e += 8), (r = i >> 4) != 0 && (i = r, e += 4), (r = i >> 2) != 0 && (i = r, e += 2), (r = i >> 1) != 0 && (i = r, e += 1), e;
}
BigInteger.ZERO = nbv(0);
BigInteger.ONE = nbv(1);
var Arcfour = (
  /** @class */
  function() {
    function i() {
      this.i = 0, this.j = 0, this.S = [];
    }
    return i.prototype.init = function(e) {
      var r, n, s;
      for (r = 0; r < 256; ++r)
        this.S[r] = r;
      for (n = 0, r = 0; r < 256; ++r)
        n = n + this.S[r] + e[r % e.length] & 255, s = this.S[r], this.S[r] = this.S[n], this.S[n] = s;
      this.i = 0, this.j = 0;
    }, i.prototype.next = function() {
      var e;
      return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, e = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = e, this.S[e + this.S[this.i] & 255];
    }, i;
  }()
);
function prng_newstate() {
  return new Arcfour();
}
var rng_psize = 256, rng_state, rng_pool = null, rng_pptr;
if (rng_pool == null) {
  rng_pool = [], rng_pptr = 0;
  var t = void 0;
  if (typeof window < "u" && window.crypto && window.crypto.getRandomValues) {
    var z = new Uint32Array(256);
    for (window.crypto.getRandomValues(z), t = 0; t < z.length; ++t)
      rng_pool[rng_pptr++] = z[t] & 255;
  }
  var count = 0, onMouseMoveListener_1 = function(i) {
    if (count = count || 0, count >= 256 || rng_pptr >= rng_psize) {
      window.removeEventListener ? window.removeEventListener("mousemove", onMouseMoveListener_1, !1) : window.detachEvent && window.detachEvent("onmousemove", onMouseMoveListener_1);
      return;
    }
    try {
      var e = i.x + i.y;
      rng_pool[rng_pptr++] = e & 255, count += 1;
    } catch {
    }
  };
  typeof window < "u" && (window.addEventListener ? window.addEventListener("mousemove", onMouseMoveListener_1, !1) : window.attachEvent && window.attachEvent("onmousemove", onMouseMoveListener_1));
}
function rng_get_byte() {
  if (rng_state == null) {
    for (rng_state = prng_newstate(); rng_pptr < rng_psize; ) {
      var i = Math.floor(65536 * Math.random());
      rng_pool[rng_pptr++] = i & 255;
    }
    for (rng_state.init(rng_pool), rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)
      rng_pool[rng_pptr] = 0;
    rng_pptr = 0;
  }
  return rng_state.next();
}
var SecureRandom = (
  /** @class */
  function() {
    function i() {
    }
    return i.prototype.nextBytes = function(e) {
      for (var r = 0; r < e.length; ++r)
        e[r] = rng_get_byte();
    }, i;
  }()
);
function pkcs1pad1(i, e) {
  if (e < i.length + 22)
    return console.error("Message too long for RSA"), null;
  for (var r = e - i.length - 6, n = "", s = 0; s < r; s += 2)
    n += "ff";
  var o = "0001" + n + "00" + i;
  return parseBigInt(o, 16);
}
function pkcs1pad2(i, e) {
  if (e < i.length + 11)
    return console.error("Message too long for RSA"), null;
  for (var r = [], n = i.length - 1; n >= 0 && e > 0; ) {
    var s = i.charCodeAt(n--);
    s < 128 ? r[--e] = s : s > 127 && s < 2048 ? (r[--e] = s & 63 | 128, r[--e] = s >> 6 | 192) : (r[--e] = s & 63 | 128, r[--e] = s >> 6 & 63 | 128, r[--e] = s >> 12 | 224);
  }
  r[--e] = 0;
  for (var o = new SecureRandom(), a = []; e > 2; ) {
    for (a[0] = 0; a[0] == 0; )
      o.nextBytes(a);
    r[--e] = a[0];
  }
  return r[--e] = 2, r[--e] = 0, new BigInteger(r);
}
var RSAKey = (
  /** @class */
  function() {
    function i() {
      this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
    }
    return i.prototype.doPublic = function(e) {
      return e.modPowInt(this.e, this.n);
    }, i.prototype.doPrivate = function(e) {
      if (this.p == null || this.q == null)
        return e.modPow(this.d, this.n);
      for (var r = e.mod(this.p).modPow(this.dmp1, this.p), n = e.mod(this.q).modPow(this.dmq1, this.q); r.compareTo(n) < 0; )
        r = r.add(this.p);
      return r.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n);
    }, i.prototype.setPublic = function(e, r) {
      e != null && r != null && e.length > 0 && r.length > 0 ? (this.n = parseBigInt(e, 16), this.e = parseInt(r, 16)) : console.error("Invalid RSA public key");
    }, i.prototype.encrypt = function(e) {
      var r = this.n.bitLength() + 7 >> 3, n = pkcs1pad2(e, r);
      if (n == null)
        return null;
      var s = this.doPublic(n);
      if (s == null)
        return null;
      for (var o = s.toString(16), a = o.length, u = 0; u < r * 2 - a; u++)
        o = "0" + o;
      return o;
    }, i.prototype.setPrivate = function(e, r, n) {
      e != null && r != null && e.length > 0 && r.length > 0 ? (this.n = parseBigInt(e, 16), this.e = parseInt(r, 16), this.d = parseBigInt(n, 16)) : console.error("Invalid RSA private key");
    }, i.prototype.setPrivateEx = function(e, r, n, s, o, a, u, l) {
      e != null && r != null && e.length > 0 && r.length > 0 ? (this.n = parseBigInt(e, 16), this.e = parseInt(r, 16), this.d = parseBigInt(n, 16), this.p = parseBigInt(s, 16), this.q = parseBigInt(o, 16), this.dmp1 = parseBigInt(a, 16), this.dmq1 = parseBigInt(u, 16), this.coeff = parseBigInt(l, 16)) : console.error("Invalid RSA private key");
    }, i.prototype.generate = function(e, r) {
      var n = new SecureRandom(), s = e >> 1;
      this.e = parseInt(r, 16);
      for (var o = new BigInteger(r, 16); ; ) {
        for (; this.p = new BigInteger(e - s, 1, n), !(this.p.subtract(BigInteger.ONE).gcd(o).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)); )
          ;
        for (; this.q = new BigInteger(s, 1, n), !(this.q.subtract(BigInteger.ONE).gcd(o).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)); )
          ;
        if (this.p.compareTo(this.q) <= 0) {
          var a = this.p;
          this.p = this.q, this.q = a;
        }
        var u = this.p.subtract(BigInteger.ONE), l = this.q.subtract(BigInteger.ONE), p = u.multiply(l);
        if (p.gcd(o).compareTo(BigInteger.ONE) == 0) {
          this.n = this.p.multiply(this.q), this.d = o.modInverse(p), this.dmp1 = this.d.mod(u), this.dmq1 = this.d.mod(l), this.coeff = this.q.modInverse(this.p);
          break;
        }
      }
    }, i.prototype.decrypt = function(e) {
      var r = parseBigInt(e, 16), n = this.doPrivate(r);
      return n == null ? null : pkcs1unpad2(n, this.n.bitLength() + 7 >> 3);
    }, i.prototype.generateAsync = function(e, r, n) {
      var s = new SecureRandom(), o = e >> 1;
      this.e = parseInt(r, 16);
      var a = new BigInteger(r, 16), u = this, l = function() {
        var p = function() {
          if (u.p.compareTo(u.q) <= 0) {
            var v = u.p;
            u.p = u.q, u.q = v;
          }
          var y = u.p.subtract(BigInteger.ONE), S = u.q.subtract(BigInteger.ONE), b = y.multiply(S);
          b.gcd(a).compareTo(BigInteger.ONE) == 0 ? (u.n = u.p.multiply(u.q), u.d = a.modInverse(b), u.dmp1 = u.d.mod(y), u.dmq1 = u.d.mod(S), u.coeff = u.q.modInverse(u.p), setTimeout(function() {
            n();
          }, 0)) : setTimeout(l, 0);
        }, g = function() {
          u.q = nbi(), u.q.fromNumberAsync(o, 1, s, function() {
            u.q.subtract(BigInteger.ONE).gcda(a, function(v) {
              v.compareTo(BigInteger.ONE) == 0 && u.q.isProbablePrime(10) ? setTimeout(p, 0) : setTimeout(g, 0);
            });
          });
        }, d = function() {
          u.p = nbi(), u.p.fromNumberAsync(e - o, 1, s, function() {
            u.p.subtract(BigInteger.ONE).gcda(a, function(v) {
              v.compareTo(BigInteger.ONE) == 0 && u.p.isProbablePrime(10) ? setTimeout(g, 0) : setTimeout(d, 0);
            });
          });
        };
        setTimeout(d, 0);
      };
      setTimeout(l, 0);
    }, i.prototype.sign = function(e, r, n) {
      var s = getDigestHeader(n), o = s + r(e).toString(), a = pkcs1pad1(o, this.n.bitLength() / 4);
      if (a == null)
        return null;
      var u = this.doPrivate(a);
      if (u == null)
        return null;
      var l = u.toString(16);
      return l.length & 1 ? "0" + l : l;
    }, i.prototype.verify = function(e, r, n) {
      var s = parseBigInt(r, 16), o = this.doPublic(s);
      if (o == null)
        return null;
      var a = o.toString(16).replace(/^1f+00/, ""), u = removeDigestHeader(a);
      return u == n(e).toString();
    }, i;
  }()
);
function pkcs1unpad2(i, e) {
  for (var r = i.toByteArray(), n = 0; n < r.length && r[n] == 0; )
    ++n;
  if (r.length - n != e - 1 || r[n] != 2)
    return null;
  for (++n; r[n] != 0; )
    if (++n >= r.length)
      return null;
  for (var s = ""; ++n < r.length; ) {
    var o = r[n] & 255;
    o < 128 ? s += String.fromCharCode(o) : o > 191 && o < 224 ? (s += String.fromCharCode((o & 31) << 6 | r[n + 1] & 63), ++n) : (s += String.fromCharCode((o & 15) << 12 | (r[n + 1] & 63) << 6 | r[n + 2] & 63), n += 2);
  }
  return s;
}
var DIGEST_HEADERS = {
  md2: "3020300c06082a864886f70d020205000410",
  md5: "3020300c06082a864886f70d020505000410",
  sha1: "3021300906052b0e03021a05000414",
  sha224: "302d300d06096086480165030402040500041c",
  sha256: "3031300d060960864801650304020105000420",
  sha384: "3041300d060960864801650304020205000430",
  sha512: "3051300d060960864801650304020305000440",
  ripemd160: "3021300906052b2403020105000414"
};
function getDigestHeader(i) {
  return DIGEST_HEADERS[i] || "";
}
function removeDigestHeader(i) {
  for (var e in DIGEST_HEADERS)
    if (DIGEST_HEADERS.hasOwnProperty(e)) {
      var r = DIGEST_HEADERS[e], n = r.length;
      if (i.substr(0, n) == r)
        return i.substr(n);
    }
  return i;
}
/*!
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 2.9.0
*/
var YAHOO = {};
YAHOO.lang = {
  /**
   * Utility to set up the prototype, constructor and superclass properties to
   * support an inheritance strategy that can chain constructors and methods.
   * Static members will not be inherited.
   *
   * @method extend
   * @static
   * @param {Function} subc   the object to modify
   * @param {Function} superc the object to inherit
   * @param {Object} overrides  additional properties/methods to add to the
   *                              subclass prototype.  These will override the
   *                              matching items obtained from the superclass
   *                              if present.
   */
  extend: function(i, e, r) {
    if (!e || !i)
      throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");
    var n = function() {
    };
    if (n.prototype = e.prototype, i.prototype = new n(), i.prototype.constructor = i, i.superclass = e.prototype, e.prototype.constructor == Object.prototype.constructor && (e.prototype.constructor = e), r) {
      var s;
      for (s in r)
        i.prototype[s] = r[s];
      var o = function() {
      }, a = ["toString", "valueOf"];
      try {
        /MSIE/.test(navigator.userAgent) && (o = function(u, l) {
          for (s = 0; s < a.length; s = s + 1) {
            var p = a[s], g = l[p];
            typeof g == "function" && g != Object.prototype[p] && (u[p] = g);
          }
        });
      } catch {
      }
      o(i.prototype, r);
    }
  }
};
/**
 * @fileOverview
 * @name asn1-1.0.js
 * @author Kenji Urushima kenji.urushima@gmail.com
 * @version asn1 1.0.13 (2017-Jun-02)
 * @since jsrsasign 2.1
 * @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
 */
var KJUR = {};
(typeof KJUR.asn1 > "u" || !KJUR.asn1) && (KJUR.asn1 = {});
KJUR.asn1.ASN1Util = new function() {
  this.integerToByteHex = function(i) {
    var e = i.toString(16);
    return e.length % 2 == 1 && (e = "0" + e), e;
  }, this.bigIntToMinTwosComplementsHex = function(i) {
    var e = i.toString(16);
    if (e.substr(0, 1) != "-")
      e.length % 2 == 1 ? e = "0" + e : e.match(/^[0-7]/) || (e = "00" + e);
    else {
      var r = e.substr(1), n = r.length;
      n % 2 == 1 ? n += 1 : e.match(/^[0-7]/) || (n += 2);
      for (var s = "", o = 0; o < n; o++)
        s += "f";
      var a = new BigInteger(s, 16), u = a.xor(i).add(BigInteger.ONE);
      e = u.toString(16).replace(/^-/, "");
    }
    return e;
  }, this.getPEMStringFromHex = function(i, e) {
    return hextopem(i, e);
  }, this.newObject = function(i) {
    var e = KJUR, r = e.asn1, n = r.DERBoolean, s = r.DERInteger, o = r.DERBitString, a = r.DEROctetString, u = r.DERNull, l = r.DERObjectIdentifier, p = r.DEREnumerated, g = r.DERUTF8String, d = r.DERNumericString, v = r.DERPrintableString, y = r.DERTeletexString, S = r.DERIA5String, b = r.DERUTCTime, w = r.DERGeneralizedTime, A = r.DERSequence, x = r.DERSet, I = r.DERTaggedObject, U = r.ASN1Util.newObject, K = Object.keys(i);
    if (K.length != 1)
      throw "key of param shall be only one.";
    var m = K[0];
    if (":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + m + ":") == -1)
      throw "undefined key: " + m;
    if (m == "bool")
      return new n(i[m]);
    if (m == "int")
      return new s(i[m]);
    if (m == "bitstr")
      return new o(i[m]);
    if (m == "octstr")
      return new a(i[m]);
    if (m == "null")
      return new u(i[m]);
    if (m == "oid")
      return new l(i[m]);
    if (m == "enum")
      return new p(i[m]);
    if (m == "utf8str")
      return new g(i[m]);
    if (m == "numstr")
      return new d(i[m]);
    if (m == "prnstr")
      return new v(i[m]);
    if (m == "telstr")
      return new y(i[m]);
    if (m == "ia5str")
      return new S(i[m]);
    if (m == "utctime")
      return new b(i[m]);
    if (m == "gentime")
      return new w(i[m]);
    if (m == "seq") {
      for (var D = i[m], O = [], B = 0; B < D.length; B++) {
        var C = U(D[B]);
        O.push(C);
      }
      return new A({ array: O });
    }
    if (m == "set") {
      for (var D = i[m], O = [], B = 0; B < D.length; B++) {
        var C = U(D[B]);
        O.push(C);
      }
      return new x({ array: O });
    }
    if (m == "tag") {
      var T = i[m];
      if (Object.prototype.toString.call(T) === "[object Array]" && T.length == 3) {
        var N = U(T[2]);
        return new I({
          tag: T[0],
          explicit: T[1],
          obj: N
        });
      } else {
        var P = {};
        if (T.explicit !== void 0 && (P.explicit = T.explicit), T.tag !== void 0 && (P.tag = T.tag), T.obj === void 0)
          throw "obj shall be specified for 'tag'.";
        return P.obj = U(T.obj), new I(P);
      }
    }
  }, this.jsonToASN1HEX = function(i) {
    var e = this.newObject(i);
    return e.getEncodedHex();
  };
}();
KJUR.asn1.ASN1Util.oidHexToInt = function(i) {
  for (var s = "", e = parseInt(i.substr(0, 2), 16), r = Math.floor(e / 40), n = e % 40, s = r + "." + n, o = "", a = 2; a < i.length; a += 2) {
    var u = parseInt(i.substr(a, 2), 16), l = ("00000000" + u.toString(2)).slice(-8);
    if (o = o + l.substr(1, 7), l.substr(0, 1) == "0") {
      var p = new BigInteger(o, 2);
      s = s + "." + p.toString(10), o = "";
    }
  }
  return s;
};
KJUR.asn1.ASN1Util.oidIntToHex = function(i) {
  var e = function(u) {
    var l = u.toString(16);
    return l.length == 1 && (l = "0" + l), l;
  }, r = function(u) {
    var l = "", p = new BigInteger(u, 10), g = p.toString(2), d = 7 - g.length % 7;
    d == 7 && (d = 0);
    for (var v = "", y = 0; y < d; y++)
      v += "0";
    g = v + g;
    for (var y = 0; y < g.length - 1; y += 7) {
      var S = g.substr(y, 7);
      y != g.length - 7 && (S = "1" + S), l += e(parseInt(S, 2));
    }
    return l;
  };
  if (!i.match(/^[0-9.]+$/))
    throw "malformed oid string: " + i;
  var n = "", s = i.split("."), o = parseInt(s[0]) * 40 + parseInt(s[1]);
  n += e(o), s.splice(0, 2);
  for (var a = 0; a < s.length; a++)
    n += r(s[a]);
  return n;
};
KJUR.asn1.ASN1Object = function() {
  var i = "";
  this.getLengthHexFromValue = function() {
    if (typeof this.hV > "u" || this.hV == null)
      throw "this.hV is null or undefined.";
    if (this.hV.length % 2 == 1)
      throw "value hex must be even length: n=" + i.length + ",v=" + this.hV;
    var e = this.hV.length / 2, r = e.toString(16);
    if (r.length % 2 == 1 && (r = "0" + r), e < 128)
      return r;
    var n = r.length / 2;
    if (n > 15)
      throw "ASN.1 length too long to represent by 8x: n = " + e.toString(16);
    var s = 128 + n;
    return s.toString(16) + r;
  }, this.getEncodedHex = function() {
    return (this.hTLV == null || this.isModified) && (this.hV = this.getFreshValueHex(), this.hL = this.getLengthHexFromValue(), this.hTLV = this.hT + this.hL + this.hV, this.isModified = !1), this.hTLV;
  }, this.getValueHex = function() {
    return this.getEncodedHex(), this.hV;
  }, this.getFreshValueHex = function() {
    return "";
  };
};
KJUR.asn1.DERAbstractString = function(i) {
  KJUR.asn1.DERAbstractString.superclass.constructor.call(this), this.getString = function() {
    return this.s;
  }, this.setString = function(e) {
    this.hTLV = null, this.isModified = !0, this.s = e, this.hV = stohex(this.s);
  }, this.setStringHex = function(e) {
    this.hTLV = null, this.isModified = !0, this.s = null, this.hV = e;
  }, this.getFreshValueHex = function() {
    return this.hV;
  }, typeof i < "u" && (typeof i == "string" ? this.setString(i) : typeof i.str < "u" ? this.setString(i.str) : typeof i.hex < "u" && this.setStringHex(i.hex));
};
YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);
KJUR.asn1.DERAbstractTime = function(i) {
  KJUR.asn1.DERAbstractTime.superclass.constructor.call(this), this.localDateToUTC = function(e) {
    utc = e.getTime() + e.getTimezoneOffset() * 6e4;
    var r = new Date(utc);
    return r;
  }, this.formatDate = function(e, r, n) {
    var s = this.zeroPadding, o = this.localDateToUTC(e), a = String(o.getFullYear());
    r == "utc" && (a = a.substr(2, 2));
    var u = s(String(o.getMonth() + 1), 2), l = s(String(o.getDate()), 2), p = s(String(o.getHours()), 2), g = s(String(o.getMinutes()), 2), d = s(String(o.getSeconds()), 2), v = a + u + l + p + g + d;
    if (n === !0) {
      var y = o.getMilliseconds();
      if (y != 0) {
        var S = s(String(y), 3);
        S = S.replace(/[0]+$/, ""), v = v + "." + S;
      }
    }
    return v + "Z";
  }, this.zeroPadding = function(e, r) {
    return e.length >= r ? e : new Array(r - e.length + 1).join("0") + e;
  }, this.getString = function() {
    return this.s;
  }, this.setString = function(e) {
    this.hTLV = null, this.isModified = !0, this.s = e, this.hV = stohex(e);
  }, this.setByDateValue = function(e, r, n, s, o, a) {
    var u = new Date(Date.UTC(e, r - 1, n, s, o, a, 0));
    this.setByDate(u);
  }, this.getFreshValueHex = function() {
    return this.hV;
  };
};
YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);
KJUR.asn1.DERAbstractStructured = function(i) {
  KJUR.asn1.DERAbstractString.superclass.constructor.call(this), this.setByASN1ObjectArray = function(e) {
    this.hTLV = null, this.isModified = !0, this.asn1Array = e;
  }, this.appendASN1Object = function(e) {
    this.hTLV = null, this.isModified = !0, this.asn1Array.push(e);
  }, this.asn1Array = new Array(), typeof i < "u" && typeof i.array < "u" && (this.asn1Array = i.array);
};
YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);
KJUR.asn1.DERBoolean = function() {
  KJUR.asn1.DERBoolean.superclass.constructor.call(this), this.hT = "01", this.hTLV = "0101ff";
};
YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);
KJUR.asn1.DERInteger = function(i) {
  KJUR.asn1.DERInteger.superclass.constructor.call(this), this.hT = "02", this.setByBigInteger = function(e) {
    this.hTLV = null, this.isModified = !0, this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e);
  }, this.setByInteger = function(e) {
    var r = new BigInteger(String(e), 10);
    this.setByBigInteger(r);
  }, this.setValueHex = function(e) {
    this.hV = e;
  }, this.getFreshValueHex = function() {
    return this.hV;
  }, typeof i < "u" && (typeof i.bigint < "u" ? this.setByBigInteger(i.bigint) : typeof i.int < "u" ? this.setByInteger(i.int) : typeof i == "number" ? this.setByInteger(i) : typeof i.hex < "u" && this.setValueHex(i.hex));
};
YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);
KJUR.asn1.DERBitString = function(i) {
  if (i !== void 0 && typeof i.obj < "u") {
    var e = KJUR.asn1.ASN1Util.newObject(i.obj);
    i.hex = "00" + e.getEncodedHex();
  }
  KJUR.asn1.DERBitString.superclass.constructor.call(this), this.hT = "03", this.setHexValueIncludingUnusedBits = function(r) {
    this.hTLV = null, this.isModified = !0, this.hV = r;
  }, this.setUnusedBitsAndHexValue = function(r, n) {
    if (r < 0 || 7 < r)
      throw "unused bits shall be from 0 to 7: u = " + r;
    var s = "0" + r;
    this.hTLV = null, this.isModified = !0, this.hV = s + n;
  }, this.setByBinaryString = function(r) {
    r = r.replace(/0+$/, "");
    var n = 8 - r.length % 8;
    n == 8 && (n = 0);
    for (var s = 0; s <= n; s++)
      r += "0";
    for (var o = "", s = 0; s < r.length - 1; s += 8) {
      var a = r.substr(s, 8), u = parseInt(a, 2).toString(16);
      u.length == 1 && (u = "0" + u), o += u;
    }
    this.hTLV = null, this.isModified = !0, this.hV = "0" + n + o;
  }, this.setByBooleanArray = function(r) {
    for (var n = "", s = 0; s < r.length; s++)
      r[s] == !0 ? n += "1" : n += "0";
    this.setByBinaryString(n);
  }, this.newFalseArray = function(r) {
    for (var n = new Array(r), s = 0; s < r; s++)
      n[s] = !1;
    return n;
  }, this.getFreshValueHex = function() {
    return this.hV;
  }, typeof i < "u" && (typeof i == "string" && i.toLowerCase().match(/^[0-9a-f]+$/) ? this.setHexValueIncludingUnusedBits(i) : typeof i.hex < "u" ? this.setHexValueIncludingUnusedBits(i.hex) : typeof i.bin < "u" ? this.setByBinaryString(i.bin) : typeof i.array < "u" && this.setByBooleanArray(i.array));
};
YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);
KJUR.asn1.DEROctetString = function(i) {
  if (i !== void 0 && typeof i.obj < "u") {
    var e = KJUR.asn1.ASN1Util.newObject(i.obj);
    i.hex = e.getEncodedHex();
  }
  KJUR.asn1.DEROctetString.superclass.constructor.call(this, i), this.hT = "04";
};
YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERNull = function() {
  KJUR.asn1.DERNull.superclass.constructor.call(this), this.hT = "05", this.hTLV = "0500";
};
YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);
KJUR.asn1.DERObjectIdentifier = function(i) {
  var e = function(n) {
    var s = n.toString(16);
    return s.length == 1 && (s = "0" + s), s;
  }, r = function(n) {
    var s = "", o = new BigInteger(n, 10), a = o.toString(2), u = 7 - a.length % 7;
    u == 7 && (u = 0);
    for (var l = "", p = 0; p < u; p++)
      l += "0";
    a = l + a;
    for (var p = 0; p < a.length - 1; p += 7) {
      var g = a.substr(p, 7);
      p != a.length - 7 && (g = "1" + g), s += e(parseInt(g, 2));
    }
    return s;
  };
  KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this), this.hT = "06", this.setValueHex = function(n) {
    this.hTLV = null, this.isModified = !0, this.s = null, this.hV = n;
  }, this.setValueOidString = function(n) {
    if (!n.match(/^[0-9.]+$/))
      throw "malformed oid string: " + n;
    var s = "", o = n.split("."), a = parseInt(o[0]) * 40 + parseInt(o[1]);
    s += e(a), o.splice(0, 2);
    for (var u = 0; u < o.length; u++)
      s += r(o[u]);
    this.hTLV = null, this.isModified = !0, this.s = null, this.hV = s;
  }, this.setValueName = function(n) {
    var s = KJUR.asn1.x509.OID.name2oid(n);
    if (s !== "")
      this.setValueOidString(s);
    else
      throw "DERObjectIdentifier oidName undefined: " + n;
  }, this.getFreshValueHex = function() {
    return this.hV;
  }, i !== void 0 && (typeof i == "string" ? i.match(/^[0-2].[0-9.]+$/) ? this.setValueOidString(i) : this.setValueName(i) : i.oid !== void 0 ? this.setValueOidString(i.oid) : i.hex !== void 0 ? this.setValueHex(i.hex) : i.name !== void 0 && this.setValueName(i.name));
};
YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);
KJUR.asn1.DEREnumerated = function(i) {
  KJUR.asn1.DEREnumerated.superclass.constructor.call(this), this.hT = "0a", this.setByBigInteger = function(e) {
    this.hTLV = null, this.isModified = !0, this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e);
  }, this.setByInteger = function(e) {
    var r = new BigInteger(String(e), 10);
    this.setByBigInteger(r);
  }, this.setValueHex = function(e) {
    this.hV = e;
  }, this.getFreshValueHex = function() {
    return this.hV;
  }, typeof i < "u" && (typeof i.int < "u" ? this.setByInteger(i.int) : typeof i == "number" ? this.setByInteger(i) : typeof i.hex < "u" && this.setValueHex(i.hex));
};
YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object);
KJUR.asn1.DERUTF8String = function(i) {
  KJUR.asn1.DERUTF8String.superclass.constructor.call(this, i), this.hT = "0c";
};
YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERNumericString = function(i) {
  KJUR.asn1.DERNumericString.superclass.constructor.call(this, i), this.hT = "12";
};
YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERPrintableString = function(i) {
  KJUR.asn1.DERPrintableString.superclass.constructor.call(this, i), this.hT = "13";
};
YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERTeletexString = function(i) {
  KJUR.asn1.DERTeletexString.superclass.constructor.call(this, i), this.hT = "14";
};
YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERIA5String = function(i) {
  KJUR.asn1.DERIA5String.superclass.constructor.call(this, i), this.hT = "16";
};
YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERUTCTime = function(i) {
  KJUR.asn1.DERUTCTime.superclass.constructor.call(this, i), this.hT = "17", this.setByDate = function(e) {
    this.hTLV = null, this.isModified = !0, this.date = e, this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s);
  }, this.getFreshValueHex = function() {
    return typeof this.date > "u" && typeof this.s > "u" && (this.date = /* @__PURE__ */ new Date(), this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s)), this.hV;
  }, i !== void 0 && (i.str !== void 0 ? this.setString(i.str) : typeof i == "string" && i.match(/^[0-9]{12}Z$/) ? this.setString(i) : i.hex !== void 0 ? this.setStringHex(i.hex) : i.date !== void 0 && this.setByDate(i.date));
};
YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);
KJUR.asn1.DERGeneralizedTime = function(i) {
  KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, i), this.hT = "18", this.withMillis = !1, this.setByDate = function(e) {
    this.hTLV = null, this.isModified = !0, this.date = e, this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s);
  }, this.getFreshValueHex = function() {
    return this.date === void 0 && this.s === void 0 && (this.date = /* @__PURE__ */ new Date(), this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s)), this.hV;
  }, i !== void 0 && (i.str !== void 0 ? this.setString(i.str) : typeof i == "string" && i.match(/^[0-9]{14}Z$/) ? this.setString(i) : i.hex !== void 0 ? this.setStringHex(i.hex) : i.date !== void 0 && this.setByDate(i.date), i.millis === !0 && (this.withMillis = !0));
};
YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);
KJUR.asn1.DERSequence = function(i) {
  KJUR.asn1.DERSequence.superclass.constructor.call(this, i), this.hT = "30", this.getFreshValueHex = function() {
    for (var e = "", r = 0; r < this.asn1Array.length; r++) {
      var n = this.asn1Array[r];
      e += n.getEncodedHex();
    }
    return this.hV = e, this.hV;
  };
};
YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);
KJUR.asn1.DERSet = function(i) {
  KJUR.asn1.DERSet.superclass.constructor.call(this, i), this.hT = "31", this.sortFlag = !0, this.getFreshValueHex = function() {
    for (var e = new Array(), r = 0; r < this.asn1Array.length; r++) {
      var n = this.asn1Array[r];
      e.push(n.getEncodedHex());
    }
    return this.sortFlag == !0 && e.sort(), this.hV = e.join(""), this.hV;
  }, typeof i < "u" && typeof i.sortflag < "u" && i.sortflag == !1 && (this.sortFlag = !1);
};
YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);
KJUR.asn1.DERTaggedObject = function(i) {
  KJUR.asn1.DERTaggedObject.superclass.constructor.call(this), this.hT = "a0", this.hV = "", this.isExplicit = !0, this.asn1Object = null, this.setASN1Object = function(e, r, n) {
    this.hT = r, this.isExplicit = e, this.asn1Object = n, this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(), this.hTLV = null, this.isModified = !0) : (this.hV = null, this.hTLV = n.getEncodedHex(), this.hTLV = this.hTLV.replace(/^../, r), this.isModified = !1);
  }, this.getFreshValueHex = function() {
    return this.hV;
  }, typeof i < "u" && (typeof i.tag < "u" && (this.hT = i.tag), typeof i.explicit < "u" && (this.isExplicit = i.explicit), typeof i.obj < "u" && (this.asn1Object = i.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)));
};
YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);
var __extends = /* @__PURE__ */ function() {
  var i = function(e, r) {
    return i = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, s) {
      n.__proto__ = s;
    } || function(n, s) {
      for (var o in s) Object.prototype.hasOwnProperty.call(s, o) && (n[o] = s[o]);
    }, i(e, r);
  };
  return function(e, r) {
    if (typeof r != "function" && r !== null)
      throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
    i(e, r);
    function n() {
      this.constructor = e;
    }
    e.prototype = r === null ? Object.create(r) : (n.prototype = r.prototype, new n());
  };
}(), JSEncryptRSAKey = (
  /** @class */
  function(i) {
    __extends(e, i);
    function e(r) {
      var n = i.call(this) || this;
      return r && (typeof r == "string" ? n.parseKey(r) : (e.hasPrivateKeyProperty(r) || e.hasPublicKeyProperty(r)) && n.parsePropertiesFrom(r)), n;
    }
    return e.prototype.parseKey = function(r) {
      try {
        var n = 0, s = 0, o = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/, a = o.test(r) ? Hex.decode(r) : Base64.unarmor(r), u = ASN1.decode(a);
        if (u.sub.length === 3 && (u = u.sub[2].sub[0]), u.sub.length === 9) {
          n = u.sub[1].getHexStringValue(), this.n = parseBigInt(n, 16), s = u.sub[2].getHexStringValue(), this.e = parseInt(s, 16);
          var l = u.sub[3].getHexStringValue();
          this.d = parseBigInt(l, 16);
          var p = u.sub[4].getHexStringValue();
          this.p = parseBigInt(p, 16);
          var g = u.sub[5].getHexStringValue();
          this.q = parseBigInt(g, 16);
          var d = u.sub[6].getHexStringValue();
          this.dmp1 = parseBigInt(d, 16);
          var v = u.sub[7].getHexStringValue();
          this.dmq1 = parseBigInt(v, 16);
          var y = u.sub[8].getHexStringValue();
          this.coeff = parseBigInt(y, 16);
        } else if (u.sub.length === 2)
          if (u.sub[0].sub) {
            var S = u.sub[1], b = S.sub[0];
            n = b.sub[0].getHexStringValue(), this.n = parseBigInt(n, 16), s = b.sub[1].getHexStringValue(), this.e = parseInt(s, 16);
          } else
            n = u.sub[0].getHexStringValue(), this.n = parseBigInt(n, 16), s = u.sub[1].getHexStringValue(), this.e = parseInt(s, 16);
        else
          return !1;
        return !0;
      } catch {
        return !1;
      }
    }, e.prototype.getPrivateBaseKey = function() {
      var r = {
        array: [
          new KJUR.asn1.DERInteger({ int: 0 }),
          new KJUR.asn1.DERInteger({ bigint: this.n }),
          new KJUR.asn1.DERInteger({ int: this.e }),
          new KJUR.asn1.DERInteger({ bigint: this.d }),
          new KJUR.asn1.DERInteger({ bigint: this.p }),
          new KJUR.asn1.DERInteger({ bigint: this.q }),
          new KJUR.asn1.DERInteger({ bigint: this.dmp1 }),
          new KJUR.asn1.DERInteger({ bigint: this.dmq1 }),
          new KJUR.asn1.DERInteger({ bigint: this.coeff })
        ]
      }, n = new KJUR.asn1.DERSequence(r);
      return n.getEncodedHex();
    }, e.prototype.getPrivateBaseKeyB64 = function() {
      return hex2b64(this.getPrivateBaseKey());
    }, e.prototype.getPublicBaseKey = function() {
      var r = new KJUR.asn1.DERSequence({
        array: [
          new KJUR.asn1.DERObjectIdentifier({ oid: "1.2.840.113549.1.1.1" }),
          new KJUR.asn1.DERNull()
        ]
      }), n = new KJUR.asn1.DERSequence({
        array: [
          new KJUR.asn1.DERInteger({ bigint: this.n }),
          new KJUR.asn1.DERInteger({ int: this.e })
        ]
      }), s = new KJUR.asn1.DERBitString({
        hex: "00" + n.getEncodedHex()
      }), o = new KJUR.asn1.DERSequence({
        array: [r, s]
      });
      return o.getEncodedHex();
    }, e.prototype.getPublicBaseKeyB64 = function() {
      return hex2b64(this.getPublicBaseKey());
    }, e.wordwrap = function(r, n) {
      if (n = n || 64, !r)
        return r;
      var s = "(.{1," + n + `})( +|$
?)|(.{1,` + n + "})";
      return r.match(RegExp(s, "g")).join(`
`);
    }, e.prototype.getPrivateKey = function() {
      var r = `-----BEGIN RSA PRIVATE KEY-----
`;
      return r += e.wordwrap(this.getPrivateBaseKeyB64()) + `
`, r += "-----END RSA PRIVATE KEY-----", r;
    }, e.prototype.getPublicKey = function() {
      var r = `-----BEGIN PUBLIC KEY-----
`;
      return r += e.wordwrap(this.getPublicBaseKeyB64()) + `
`, r += "-----END PUBLIC KEY-----", r;
    }, e.hasPublicKeyProperty = function(r) {
      return r = r || {}, r.hasOwnProperty("n") && r.hasOwnProperty("e");
    }, e.hasPrivateKeyProperty = function(r) {
      return r = r || {}, r.hasOwnProperty("n") && r.hasOwnProperty("e") && r.hasOwnProperty("d") && r.hasOwnProperty("p") && r.hasOwnProperty("q") && r.hasOwnProperty("dmp1") && r.hasOwnProperty("dmq1") && r.hasOwnProperty("coeff");
    }, e.prototype.parsePropertiesFrom = function(r) {
      this.n = r.n, this.e = r.e, r.hasOwnProperty("d") && (this.d = r.d, this.p = r.p, this.q = r.q, this.dmp1 = r.dmp1, this.dmq1 = r.dmq1, this.coeff = r.coeff);
    }, e;
  }(RSAKey)
), _a, version = typeof process < "u" ? (_a = process.env) === null || _a === void 0 ? void 0 : _a.npm_package_version : void 0, JSEncrypt$1 = (
  /** @class */
  function() {
    function i(e) {
      e === void 0 && (e = {}), e = e || {}, this.default_key_size = e.default_key_size ? parseInt(e.default_key_size, 10) : 1024, this.default_public_exponent = e.default_public_exponent || "010001", this.log = e.log || !1, this.key = null;
    }
    return i.prototype.setKey = function(e) {
      this.log && this.key && console.warn("A key was already set, overriding existing."), this.key = new JSEncryptRSAKey(e);
    }, i.prototype.setPrivateKey = function(e) {
      this.setKey(e);
    }, i.prototype.setPublicKey = function(e) {
      this.setKey(e);
    }, i.prototype.decrypt = function(e) {
      try {
        return this.getKey().decrypt(b64tohex(e));
      } catch {
        return !1;
      }
    }, i.prototype.encrypt = function(e) {
      try {
        return hex2b64(this.getKey().encrypt(e));
      } catch {
        return !1;
      }
    }, i.prototype.sign = function(e, r, n) {
      try {
        return hex2b64(this.getKey().sign(e, r, n));
      } catch {
        return !1;
      }
    }, i.prototype.verify = function(e, r, n) {
      try {
        return this.getKey().verify(e, b64tohex(r), n);
      } catch {
        return !1;
      }
    }, i.prototype.getKey = function(e) {
      if (!this.key) {
        if (this.key = new JSEncryptRSAKey(), e && {}.toString.call(e) === "[object Function]") {
          this.key.generateAsync(this.default_key_size, this.default_public_exponent, e);
          return;
        }
        this.key.generate(this.default_key_size, this.default_public_exponent);
      }
      return this.key;
    }, i.prototype.getPrivateKey = function() {
      return this.getKey().getPrivateKey();
    }, i.prototype.getPrivateKeyB64 = function() {
      return this.getKey().getPrivateBaseKeyB64();
    }, i.prototype.getPublicKey = function() {
      return this.getKey().getPublicKey();
    }, i.prototype.getPublicKeyB64 = function() {
      return this.getKey().getPublicBaseKeyB64();
    }, i.version = version, i;
  }()
);
const MAX_ENCRYPT_BLOCK = 117, MAX_DECRYPT_BLOCK = 128;
function bytesToBase64(i) {
  {
    let e = "";
    for (let n = 0; n < i.length; n++)
      e += String.fromCharCode(i[n]);
    const r = new Uint8Array(i).buffer;
    return wx.arrayBufferToBase64(r);
  }
}
function concatBytes(i) {
  let e = 0;
  for (const s of i)
    e += s.length;
  const r = new Uint8Array(e);
  let n = 0;
  for (const s of i)
    r.set(s, n), n += s.length;
  return r;
}
function utf8Encode(i) {
  for (var e = [], r = 0; r < i.length; r++) {
    var n = i.charCodeAt(r);
    n < 128 ? e.push(n) : n < 2048 ? e.push(192 | n >> 6, 128 | n & 63) : (n < 55296 || n >= 57344) && e.push(
      224 | n >> 12,
      128 | n >> 6 & 63,
      128 | n & 63
    );
  }
  return new Uint8Array(e);
}
function wxToBase64(i) {
  const e = wx.base64ToArrayBuffer(i);
  return new Uint8Array(e);
}
function h5ToBase64(i) {
  const e = atob(i), r = new Uint8Array(e.length);
  for (let n = 0; n < e.length; n++)
    r[n] = e.charCodeAt(n);
  return r;
}
function arrayBufferToBase64(i) {
  const e = new Uint8Array(i);
  let r = "";
  for (let n = 0; n < e.byteLength; n++)
    r += String.fromCharCode(e[n]);
  return btoa(r);
}
function encrypt(i, e) {
  const r = new JSEncrypt$1();
  r.setPublicKey(e);
  const s = utf8Encode(i).buffer;
  let o = null;
  o = wx.arrayBufferToBase64(s);
  const a = utf8Encode(o);
  let u = [], l = 0, p = 0;
  for (; l < a.length; ) {
    const v = Math.min(
      MAX_ENCRYPT_BLOCK,
      a.length - l
    ), y = a.slice(l, l + v);
    let S = "";
    for (let w = 0; w < y.length; w++)
      S += String.fromCharCode(y[w]);
    const b = r.encrypt(S);
    if (!b)
      throw new Error("分段加密失败");
    try {
      let w = null;
      w = wxToBase64(b), u.push(w);
    } catch (w) {
      throw console.error("Base64解码错误:", w), w;
    }
    p++, l = p * MAX_ENCRYPT_BLOCK;
  }
  const g = concatBytes(u);
  return bytesToBase64(g);
}
function base64ToArrayBuffer(i) {
  for (i = i.replace(/[\s\r\n]+/g, ""); i.length % 4; )
    i += "=";
  const e = atob(i), r = e.length, n = new Uint8Array(r);
  for (let s = 0; s < r; s++)
    n[s] = e.charCodeAt(s);
  return n;
}
function decodeUTF8(i) {
  let e = "", r = 0;
  for (; r < i.length; ) {
    const n = i[r++];
    if (n < 128)
      e += String.fromCharCode(n);
    else if (n >= 192 && n < 224) {
      const s = i[r++] & 63;
      e += String.fromCharCode((n & 31) << 6 | s);
    } else if (n >= 224 && n < 240) {
      const s = i[r++] & 63, o = i[r++] & 63;
      e += String.fromCharCode((n & 15) << 12 | s << 6 | o);
    } else
      e += "�";
  }
  return e;
}
function decrypt(i) {
  if (!i)
    return console.error("Decrypt error: Input string is null or undefined"), "";
  let e = null;
  e = wx.base64ToArrayBuffer(i);
  try {
    const r = new JSEncrypt$1();
    r.setPrivateKey(rsaKey.private);
    let n = [], s = 0, o = 0;
    for (; s < e.byteLength; ) {
      const u = Math.min(
        MAX_DECRYPT_BLOCK,
        e.byteLength - s
      ), l = e.slice(s, s + u);
      let p = null;
      p = wx.arrayBufferToBase64(l);
      const g = r.decrypt(p);
      g ? n.push(g) : console.error(`块 ${o + 1} 解密失败`), o++, s = o * MAX_DECRYPT_BLOCK;
    }
    const a = n.join("");
    if (a) {
      let u = null;
      u = wx.base64ToArrayBuffer(a);
      let l = "";
      {
        const p = new Uint8Array(u);
        l = decodeUTF8(p);
      }
      return l;
    } else
      throw new Error("解密结果为空");
  } catch (r) {
    throw console.error("RSA解密过程失败:", r), r;
  }
}
const c = new Int32Array(4), E = class E {
  constructor() {
    R(this, "_dataLength", 0);
    R(this, "_bufferLength", 0);
    R(this, "_state", new Int32Array(4));
    R(this, "_buffer", new ArrayBuffer(68));
    R(this, "_buffer8");
    R(this, "_buffer32");
    this._buffer8 = new Uint8Array(this._buffer, 0, 68), this._buffer32 = new Uint32Array(this._buffer, 0, 17), this.start();
  }
  static hashStr(e, r = !1) {
    return this.onePassHasher.start().appendStr(e).end(r);
  }
  static hashAsciiStr(e, r = !1) {
    return this.onePassHasher.start().appendAsciiStr(e).end(r);
  }
  static _hex(e) {
    const r = E.hexChars, n = E.hexOut;
    let s, o, a, u;
    for (u = 0; u < 4; u += 1)
      for (o = u * 8, s = e[u], a = 0; a < 8; a += 2)
        n[o + 1 + a] = r.charAt(s & 15), s >>>= 4, n[o + 0 + a] = r.charAt(s & 15), s >>>= 4;
    return n.join("");
  }
  static _md5cycle(e, r) {
    let n = e[0], s = e[1], o = e[2], a = e[3];
    n += (s & o | ~s & a) + r[0] - 680876936 | 0, n = (n << 7 | n >>> 25) + s | 0, a += (n & s | ~n & o) + r[1] - 389564586 | 0, a = (a << 12 | a >>> 20) + n | 0, o += (a & n | ~a & s) + r[2] + 606105819 | 0, o = (o << 17 | o >>> 15) + a | 0, s += (o & a | ~o & n) + r[3] - 1044525330 | 0, s = (s << 22 | s >>> 10) + o | 0, n += (s & o | ~s & a) + r[4] - 176418897 | 0, n = (n << 7 | n >>> 25) + s | 0, a += (n & s | ~n & o) + r[5] + 1200080426 | 0, a = (a << 12 | a >>> 20) + n | 0, o += (a & n | ~a & s) + r[6] - 1473231341 | 0, o = (o << 17 | o >>> 15) + a | 0, s += (o & a | ~o & n) + r[7] - 45705983 | 0, s = (s << 22 | s >>> 10) + o | 0, n += (s & o | ~s & a) + r[8] + 1770035416 | 0, n = (n << 7 | n >>> 25) + s | 0, a += (n & s | ~n & o) + r[9] - 1958414417 | 0, a = (a << 12 | a >>> 20) + n | 0, o += (a & n | ~a & s) + r[10] - 42063 | 0, o = (o << 17 | o >>> 15) + a | 0, s += (o & a | ~o & n) + r[11] - 1990404162 | 0, s = (s << 22 | s >>> 10) + o | 0, n += (s & o | ~s & a) + r[12] + 1804603682 | 0, n = (n << 7 | n >>> 25) + s | 0, a += (n & s | ~n & o) + r[13] - 40341101 | 0, a = (a << 12 | a >>> 20) + n | 0, o += (a & n | ~a & s) + r[14] - 1502002290 | 0, o = (o << 17 | o >>> 15) + a | 0, s += (o & a | ~o & n) + r[15] + 1236535329 | 0, s = (s << 22 | s >>> 10) + o | 0, n += (s & a | o & ~a) + r[1] - 165796510 | 0, n = (n << 5 | n >>> 27) + s | 0, a += (n & o | s & ~o) + r[6] - 1069501632 | 0, a = (a << 9 | a >>> 23) + n | 0, o += (a & s | n & ~s) + r[11] + 643717713 | 0, o = (o << 14 | o >>> 18) + a | 0, s += (o & n | a & ~n) + r[0] - 373897302 | 0, s = (s << 20 | s >>> 12) + o | 0, n += (s & a | o & ~a) + r[5] - 701558691 | 0, n = (n << 5 | n >>> 27) + s | 0, a += (n & o | s & ~o) + r[10] + 38016083 | 0, a = (a << 9 | a >>> 23) + n | 0, o += (a & s | n & ~s) + r[15] - 660478335 | 0, o = (o << 14 | o >>> 18) + a | 0, s += (o & n | a & ~n) + r[4] - 405537848 | 0, s = (s << 20 | s >>> 12) + o | 0, n += (s & a | o & ~a) + r[9] + 568446438 | 0, n = (n << 5 | n >>> 27) + s | 0, a += (n & o | s & ~o) + r[14] - 1019803690 | 0, a = (a << 9 | a >>> 23) + n | 0, o += (a & s | n & ~s) + r[3] - 187363961 | 0, o = (o << 14 | o >>> 18) + a | 0, s += (o & n | a & ~n) + r[8] + 1163531501 | 0, s = (s << 20 | s >>> 12) + o | 0, n += (s & a | o & ~a) + r[13] - 1444681467 | 0, n = (n << 5 | n >>> 27) + s | 0, a += (n & o | s & ~o) + r[2] - 51403784 | 0, a = (a << 9 | a >>> 23) + n | 0, o += (a & s | n & ~s) + r[7] + 1735328473 | 0, o = (o << 14 | o >>> 18) + a | 0, s += (o & n | a & ~n) + r[12] - 1926607734 | 0, s = (s << 20 | s >>> 12) + o | 0, n += (s ^ o ^ a) + r[5] - 378558 | 0, n = (n << 4 | n >>> 28) + s | 0, a += (n ^ s ^ o) + r[8] - 2022574463 | 0, a = (a << 11 | a >>> 21) + n | 0, o += (a ^ n ^ s) + r[11] + 1839030562 | 0, o = (o << 16 | o >>> 16) + a | 0, s += (o ^ a ^ n) + r[14] - 35309556 | 0, s = (s << 23 | s >>> 9) + o | 0, n += (s ^ o ^ a) + r[1] - 1530992060 | 0, n = (n << 4 | n >>> 28) + s | 0, a += (n ^ s ^ o) + r[4] + 1272893353 | 0, a = (a << 11 | a >>> 21) + n | 0, o += (a ^ n ^ s) + r[7] - 155497632 | 0, o = (o << 16 | o >>> 16) + a | 0, s += (o ^ a ^ n) + r[10] - 1094730640 | 0, s = (s << 23 | s >>> 9) + o | 0, n += (s ^ o ^ a) + r[13] + 681279174 | 0, n = (n << 4 | n >>> 28) + s | 0, a += (n ^ s ^ o) + r[0] - 358537222 | 0, a = (a << 11 | a >>> 21) + n | 0, o += (a ^ n ^ s) + r[3] - 722521979 | 0, o = (o << 16 | o >>> 16) + a | 0, s += (o ^ a ^ n) + r[6] + 76029189 | 0, s = (s << 23 | s >>> 9) + o | 0, n += (s ^ o ^ a) + r[9] - 640364487 | 0, n = (n << 4 | n >>> 28) + s | 0, a += (n ^ s ^ o) + r[12] - 421815835 | 0, a = (a << 11 | a >>> 21) + n | 0, o += (a ^ n ^ s) + r[15] + 530742520 | 0, o = (o << 16 | o >>> 16) + a | 0, s += (o ^ a ^ n) + r[2] - 995338651 | 0, s = (s << 23 | s >>> 9) + o | 0, n += (o ^ (s | ~a)) + r[0] - 198630844 | 0, n = (n << 6 | n >>> 26) + s | 0, a += (s ^ (n | ~o)) + r[7] + 1126891415 | 0, a = (a << 10 | a >>> 22) + n | 0, o += (n ^ (a | ~s)) + r[14] - 1416354905 | 0, o = (o << 15 | o >>> 17) + a | 0, s += (a ^ (o | ~n)) + r[5] - 57434055 | 0, s = (s << 21 | s >>> 11) + o | 0, n += (o ^ (s | ~a)) + r[12] + 1700485571 | 0, n = (n << 6 | n >>> 26) + s | 0, a += (s ^ (n | ~o)) + r[3] - 1894986606 | 0, a = (a << 10 | a >>> 22) + n | 0, o += (n ^ (a | ~s)) + r[10] - 1051523 | 0, o = (o << 15 | o >>> 17) + a | 0, s += (a ^ (o | ~n)) + r[1] - 2054922799 | 0, s = (s << 21 | s >>> 11) + o | 0, n += (o ^ (s | ~a)) + r[8] + 1873313359 | 0, n = (n << 6 | n >>> 26) + s | 0, a += (s ^ (n | ~o)) + r[15] - 30611744 | 0, a = (a << 10 | a >>> 22) + n | 0, o += (n ^ (a | ~s)) + r[6] - 1560198380 | 0, o = (o << 15 | o >>> 17) + a | 0, s += (a ^ (o | ~n)) + r[13] + 1309151649 | 0, s = (s << 21 | s >>> 11) + o | 0, n += (o ^ (s | ~a)) + r[4] - 145523070 | 0, n = (n << 6 | n >>> 26) + s | 0, a += (s ^ (n | ~o)) + r[11] - 1120210379 | 0, a = (a << 10 | a >>> 22) + n | 0, o += (n ^ (a | ~s)) + r[2] + 718787259 | 0, o = (o << 15 | o >>> 17) + a | 0, s += (a ^ (o | ~n)) + r[9] - 343485551 | 0, s = (s << 21 | s >>> 11) + o | 0, e[0] = n + e[0] | 0, e[1] = s + e[1] | 0, e[2] = o + e[2] | 0, e[3] = a + e[3] | 0;
  }
  /**
   * Initialise buffer to be hashed
   */
  start() {
    return this._dataLength = 0, this._bufferLength = 0, this._state.set(E.stateIdentity), this;
  }
  // Char to code point to to array conversion:
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt
  // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown
  /**
   * Append a UTF-8 string to the hash buffer
   * @param str String to append
   */
  appendStr(e) {
    const r = this._buffer8, n = this._buffer32;
    let s = this._bufferLength, o, a;
    for (a = 0; a < e.length; a += 1) {
      if (o = e.charCodeAt(a), o < 128)
        r[s++] = o;
      else if (o < 2048)
        r[s++] = (o >>> 6) + 192, r[s++] = o & 63 | 128;
      else if (o < 55296 || o > 56319)
        r[s++] = (o >>> 12) + 224, r[s++] = o >>> 6 & 63 | 128, r[s++] = o & 63 | 128;
      else {
        if (o = (o - 55296) * 1024 + (e.charCodeAt(++a) - 56320) + 65536, o > 1114111)
          throw new Error(
            "Unicode standard supports code points up to U+10FFFF"
          );
        r[s++] = (o >>> 18) + 240, r[s++] = o >>> 12 & 63 | 128, r[s++] = o >>> 6 & 63 | 128, r[s++] = o & 63 | 128;
      }
      s >= 64 && (this._dataLength += 64, E._md5cycle(this._state, n), s -= 64, n[0] = n[16]);
    }
    return this._bufferLength = s, this;
  }
  /**
   * Append an ASCII string to the hash buffer
   * @param str String to append
   */
  appendAsciiStr(e) {
    const r = this._buffer8, n = this._buffer32;
    let s = this._bufferLength, o, a = 0;
    for (; ; ) {
      for (o = Math.min(e.length - a, 64 - s); o--; )
        r[s++] = e.charCodeAt(a++);
      if (s < 64)
        break;
      this._dataLength += 64, E._md5cycle(this._state, n), s = 0;
    }
    return this._bufferLength = s, this;
  }
  /**
   * Append a byte array to the hash buffer
   * @param input array to append
   */
  appendByteArray(e) {
    const r = this._buffer8, n = this._buffer32;
    let s = this._bufferLength, o, a = 0;
    for (; ; ) {
      for (o = Math.min(e.length - a, 64 - s); o--; )
        r[s++] = e[a++];
      if (s < 64)
        break;
      this._dataLength += 64, E._md5cycle(this._state, n), s = 0;
    }
    return this._bufferLength = s, this;
  }
  /**
   * Get the state of the hash buffer
   */
  getState() {
    const e = this._state;
    return {
      buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)),
      buflen: this._bufferLength,
      length: this._dataLength,
      state: [e[0], e[1], e[2], e[3]]
    };
  }
  /**
   * Override the current state of the hash buffer
   * @param state New hash buffer state
   */
  setState(e) {
    const r = e.buffer, n = e.state, s = this._state;
    let o;
    for (this._dataLength = e.length, this._bufferLength = e.buflen, s[0] = n[0], s[1] = n[1], s[2] = n[2], s[3] = n[3], o = 0; o < r.length; o += 1)
      this._buffer8[o] = r.charCodeAt(o);
  }
  /**
   * Hash the current state of the hash buffer and return the result
   * @param raw Whether to return the value as an `Int32Array`
   */
  end(e = !1) {
    const r = this._bufferLength, n = this._buffer8, s = this._buffer32, o = (r >> 2) + 1;
    this._dataLength += r;
    const a = this._dataLength * 8;
    if (n[r] = 128, n[r + 1] = n[r + 2] = n[r + 3] = 0, s.set(E.buffer32Identity.subarray(o), o), r > 55 && (E._md5cycle(this._state, s), s.set(E.buffer32Identity)), a <= 4294967295)
      s[14] = a;
    else {
      const u = a.toString(16).match(/(.*?)(.{0,8})$/);
      if (u === null) return e ? c : "";
      const l = parseInt(u[2], 16), p = parseInt(u[1], 16) || 0;
      s[14] = l, s[15] = p;
    }
    return E._md5cycle(this._state, s), e ? this._state : E._hex(this._state);
  }
};
// Private Static Variables
R(E, "stateIdentity", new Int32Array([
  1732584193,
  -271733879,
  -1732584194,
  271733878
])), R(E, "buffer32Identity", new Int32Array([
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0
])), R(E, "hexChars", "0123456789abcdef"), R(E, "hexOut", []), // Permanent instance is to use for one-call hashing
R(E, "onePassHasher", new E());
let h = E;
if (h.hashStr("hello") !== "5d41402abc4b2a76b9719d911017c592")
  throw new Error("Md5 self test failed.");
function handleParams(i) {
  const e = Date.now().toString(), r = generateNonceStr(), n = {
    ...i,
    timestamp: e,
    nonceStr: r
  }, s = sortParams(n), o = h.hashStr(s).toString().toLowerCase();
  return JSON.stringify({
    timestamp: e,
    data: n,
    nonceStr: r,
    sign: o
  });
}
function generateNonceStr() {
  const i = "abcdefghijklmnopqrstuvwxyz0123456789";
  let e = "";
  for (let r = 0; r < 16; r++)
    e += i.charAt(Math.floor(Math.random() * i.length));
  return e;
}
function sortParams(i) {
  const e = Object.keys(i).sort();
  let r = "";
  return e.forEach((n) => {
    n !== "sign" && (r += `${n}=${i[n]}&`);
  }), r.slice(0, -1);
}
function encryptRequestData(i, e) {
  const r = handleParams(i);
  return encrypt(r, e);
}
function decryptResponseData(i) {
  try {
    if (!i)
      return console.error("Encrypted data is null or undefined"), { error: "加密数据为空" };
    let e = i;
    if (typeof i != "string")
      if (i.data)
        e = i.data;
      else if (i.response && i.response.data)
        e = i.response.data;
      else
        return console.error(
          "Cannot extract encrypted data from response",
          i
        ), { error: "无法从响应中提取加密数据" };
    if (typeof e != "string")
      return console.error("Data to decrypt is not a string:", e), { error: "解密数据不是字符串" };
    const r = decrypt(e);
    try {
      return JSON.parse(r);
    } catch (n) {
      return console.error("Response data JSON parse error:", n), {
        error: "JSON解析失败",
        rawData: r
      };
    }
  } catch (e) {
    return console.error("Response data decrypt error:", e), {
      error: "解密响应数据失败",
      message: e instanceof Error ? e.message : String(e)
    };
  }
}
const requestInterceptor = (i) => i, responseInterceptor = (i) => {
  wx.hideLoading();
  const e = decryptResponseData(i.data);
  return e.code === "000000" ? e : Promise.reject(e);
}, request = (i) => (i = requestInterceptor(i), new Promise((e, r) => {
  wx.request({
    ...i,
    success: (n) => {
      e(responseInterceptor(n));
    },
    fail: (n) => {
      wx.hideLoading(), r(n);
    }
  });
})), post = (i, e, r) => request({
  url: i,
  method: "post",
  data: e,
  ...r
}), createWxRequest = (i) => {
  const e = servicePath[i];
  return {
    post: (r, n, s) => post(e + r, n, s)
  };
};
function _typeof(i) {
  return (_typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
    return typeof e;
  } : function(e) {
    return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
  })(i);
}
function _classCallCheck(i, e) {
  if (!(i instanceof e)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(i, e) {
  for (var r = 0; r < e.length; r++) {
    var n = e[r];
    n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(i, n.key, n);
  }
}
function _createClass(i, e, r) {
  return e && _defineProperties(i.prototype, e), r && _defineProperties(i, r), i;
}
(typeof JSON > "u" ? "undefined" : _typeof(JSON)) !== "object" && (JSON = {}), function() {
  var rx_one = /^[\],:{}\s]*$/, rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, rx_four = /(?:^|:|,)(?:\s*\[)+/g, rx_escapable = /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta, rep;
  function f(i) {
    return i < 10 ? "0" + i : i;
  }
  function this_value() {
    return this.valueOf();
  }
  function quote(i) {
    return rx_escapable.lastIndex = 0, rx_escapable.test(i) ? '"' + i.replace(rx_escapable, function(e) {
      var r = meta[e];
      return typeof r == "string" ? r : "\\u" + ("0000" + e.charCodeAt(0).toString(16)).slice(-4);
    }) + '"' : '"' + i + '"';
  }
  function str(i, e) {
    var r, n, s, o, a, u = gap, l = e[i];
    switch (l && _typeof(l) === "object" && typeof l.toJSON == "function" && (l = l.toJSON(i)), _typeof(l = typeof rep == "function" ? rep.call(e, i, l) : l)) {
      case "string":
        return quote(l);
      case "number":
        return isFinite(l) ? String(l) : "null";
      case "boolean":
      case "null":
        return String(l);
      case "object":
        if (!l) return "null";
        if (gap += indent, a = [], Object.prototype.toString.apply(l) === "[object Array]") {
          for (o = l.length, r = 0; r < o; r += 1) a[r] = str(r, l) || "null";
          s = a.length === 0 ? "[]" : gap ? `[
` + gap + a.join(`,
` + gap) + `
` + u + "]" : "[" + a.join(",") + "]";
        } else {
          if (rep && _typeof(rep) === "object") for (o = rep.length, r = 0; r < o; r += 1) typeof rep[r] == "string" && (s = str(n = rep[r], l)) && a.push(quote(n) + (gap ? ": " : ":") + s);
          else for (n in l) Object.prototype.hasOwnProperty.call(l, n) && (s = str(n, l)) && a.push(quote(n) + (gap ? ": " : ":") + s);
          s = a.length === 0 ? "{}" : gap ? `{
` + gap + a.join(`,
` + gap) + `
` + u + "}" : "{" + a.join(",") + "}";
        }
        return gap = u, s;
    }
  }
  typeof Date.prototype.toJSON != "function" && (Date.prototype.toJSON = function() {
    return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null;
  }, Boolean.prototype.toJSON = this_value, Number.prototype.toJSON = this_value, String.prototype.toJSON = this_value), typeof JSON.stringify != "function" && (meta = { "\b": "\\b", "	": "\\t", "\n": "\\n", "\f": "\\f", "\r": "\\r", '"': '\\"', "\\": "\\\\" }, JSON.stringify = function(i, e, r) {
    var n;
    if (indent = gap = "", typeof r == "number") for (n = 0; n < r; n += 1) indent += " ";
    else typeof r == "string" && (indent = r);
    if (!(rep = e) || typeof e == "function" || _typeof(e) === "object" && typeof e.length == "number") return str("", { "": i });
    throw new Error("JSON.stringify");
  }), typeof JSON.parse != "function" && (JSON.parse = function(text, reviver) {
    var j;
    function walk(i, e) {
      var r, n, s = i[e];
      if (s && _typeof(s) === "object") for (r in s) Object.prototype.hasOwnProperty.call(s, r) && ((n = walk(s, r)) !== void 0 ? s[r] = n : delete s[r]);
      return reviver.call(i, e, s);
    }
    if (text = String(text), rx_dangerous.lastIndex = 0, rx_dangerous.test(text) && (text = text.replace(rx_dangerous, function(i) {
      return "\\u" + ("0000" + i.charCodeAt(0).toString(16)).slice(-4);
    })), rx_one.test(text.replace(rx_two, "@").replace(rx_three, "]").replace(rx_four, ""))) return j = eval("(" + text + ")"), typeof reviver == "function" ? walk({ "": j }, "") : j;
    throw new SyntaxError("JSON.parse");
  });
}();
var Config = { LIB_VERSION: "2.0.4" }, MAX_REFERRER_STRING_LENGTH = 200, ArrayProto = Array.prototype, ObjProto = Object.prototype, slice = ArrayProto.slice, toString = ObjProto.toString, hasOwnProperty = ObjProto.hasOwnProperty, nativeForEach = ArrayProto.forEach, breaker = {}, utmTypes = ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"], _ = { each: function(i, e, r) {
  if (i !== null) {
    if (nativeForEach && i.forEach === nativeForEach) i.forEach(e, r);
    else if (i.length === +i.length) {
      for (var n = 0, s = i.length; n < s; n++) if (n in i && e.call(r, i[n], n, i) === breaker) return;
    } else for (var o in i) if (hasOwnProperty.call(i, o) && e.call(r, i[o], o, i) === breaker) return;
  }
}, extend: function(i) {
  return _.each(slice.call(arguments, 1), function(e) {
    for (var r in e) e[r] !== void 0 && (i[r] = e[r]);
  }), i;
}, formatDate: function(i) {
  function e(r) {
    return r < 10 ? "0" + r : r;
  }
  return i.getFullYear() + "-" + e(i.getMonth() + 1) + "-" + e(i.getDate()) + " " + e(i.getHours()) + ":" + e(i.getMinutes()) + ":" + e(i.getSeconds()) + "." + ((i = i.getMilliseconds()) < 10 ? "00" + i : i < 100 ? "0" + i : i);
}, formatTimeZone: function(i, e) {
  var r;
  return typeof e != "number" ? i : (r = i.getTime(), i = 6e4 * i.getTimezoneOffset(), new Date(r + i + 36e5 * e));
}, formatJsonString: function(i) {
  try {
    return JSON.stringify(i, null, 8);
  } catch {
    return JSON.stringify(i);
  }
}, searchObjDate: function(i, e) {
  (_.check.isObject(i) || _.check.isArray(i)) && _.each(i, function(r, n) {
    _.check.isObject(r) || _.check.isArray(r) ? _.searchObjDate(i[n], e) : _.check.isDate(r) && (i[n] = _.formatDate(_.formatTimeZone(r, e)));
  });
}, check: { isUndefined: function(i) {
  return i === void 0;
}, isObject: function(i) {
  return toString.call(i) === "[object Object]" && i !== null;
}, isEmptyObject: function(i) {
  if (_.check.isObject(i)) {
    for (var e in i) if (hasOwnProperty.call(i, e)) return !1;
    return !0;
  }
  return !1;
}, isArray: function(i) {
  return toString.call(i) === "[object Array]";
}, isString: function(i) {
  return toString.call(i) === "[object String]";
}, isDate: function(i) {
  return toString.call(i) === "[object Date]";
}, isNumber: function(i) {
  return toString.call(i) === "[object Number]";
}, isBoolean: function(i) {
  return toString.call(i) === "[object Boolean]";
}, isJSONString: function(i) {
  try {
    JSON.parse(i);
  } catch {
    return !1;
  }
  return !0;
} } }, Log = (_.UUID = /* @__PURE__ */ (() => {
  function i() {
    for (var e = +/* @__PURE__ */ new Date(), r = 0; e === +/* @__PURE__ */ new Date(); ) r++;
    return e.toString(16) + r.toString(16);
  }
  return function() {
    var e = (e = String(screen.height * screen.width)) && /\d{5,}/.test(e) ? e.toString(16) : String(31242 * Math.random()).replace(".", "").slice(0, 8), e = i() + "-" + Math.random().toString(16).replace(".", "") + "-" + (() => {
      var r, n, s = navigator.userAgent, o = [], a = 0;
      function u(l, p) {
        for (var g = 0, d = 0; d < p.length; d++) g |= o[d] << 8 * d;
        return l ^ g;
      }
      for (r = 0; r < s.length; r++) n = s.charCodeAt(r), o.unshift(255 & n), 4 <= o.length && (a = u(a, o), o = []);
      return (a = 0 < o.length ? u(a, o) : a).toString(16);
    })() + "-" + e + "-" + i();
    return e || (String(Math.random()) + String(Math.random()) + String(Math.random())).slice(2, 15);
  };
})(), _.UUIDv4 = function() {
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(i) {
    var e = 16 * Math.random() | 0;
    return (i == "x" ? e : 3 & e | 8).toString(16);
  });
}, _.getReferrer = function(i) {
  return i = i || document.referrer, typeof i != "string" ? "referrer exception" + String(i) : typeof (i = (i = i.indexOf("https://www.baidu.com/") === 0 ? i.split("?")[0] : i).slice(0, MAX_REFERRER_STRING_LENGTH)) == "string" ? i : "";
}, _.url = /* @__PURE__ */ (() => {
  function i() {
    return new RegExp(/(.*?)\.?([^\.]*?)\.(com|net|org|biz|ws|in|me|co\.uk|co|org\.uk|ltd\.uk|plc\.uk|me\.uk|edu|mil|br\.com|cn\.com|eu\.com|hu\.com|no\.com|qc\.com|sa\.com|se\.com|se\.net|us\.com|uy\.com|ac|co\.ac|gv\.ac|or\.ac|ac\.ac|af|am|as|at|ac\.at|co\.at|gv\.at|or\.at|asn\.au|com\.au|edu\.au|org\.au|net\.au|id\.au|be|ac\.be|adm\.br|adv\.br|am\.br|arq\.br|art\.br|bio\.br|cng\.br|cnt\.br|com\.br|ecn\.br|eng\.br|esp\.br|etc\.br|eti\.br|fm\.br|fot\.br|fst\.br|g12\.br|gov\.br|ind\.br|inf\.br|jor\.br|lel\.br|med\.br|mil\.br|net\.br|nom\.br|ntr\.br|odo\.br|org\.br|ppg\.br|pro\.br|psc\.br|psi\.br|rec\.br|slg\.br|tmp\.br|tur\.br|tv\.br|vet\.br|zlg\.br|br|ab\.ca|bc\.ca|mb\.ca|nb\.ca|nf\.ca|ns\.ca|nt\.ca|on\.ca|pe\.ca|qc\.ca|sk\.ca|yk\.ca|ca|cc|ac\.cn|net\.cn|com\.cn|edu\.cn|gov\.cn|org\.cn|bj\.cn|sh\.cn|tj\.cn|cq\.cn|he\.cn|nm\.cn|ln\.cn|jl\.cn|hl\.cn|js\.cn|zj\.cn|ah\.cn|gd\.cn|gx\.cn|hi\.cn|sc\.cn|gz\.cn|yn\.cn|xz\.cn|sn\.cn|gs\.cn|qh\.cn|nx\.cn|xj\.cn|tw\.cn|hk\.cn|mo\.cn|cn|cx|cz|de|dk|fo|com\.ec|tm\.fr|com\.fr|asso\.fr|presse\.fr|fr|gf|gs|co\.il|net\.il|ac\.il|k12\.il|gov\.il|muni\.il|ac\.in|co\.in|org\.in|ernet\.in|gov\.in|net\.in|res\.in|is|it|ac\.jp|co\.jp|go\.jp|or\.jp|ne\.jp|ac\.kr|co\.kr|go\.kr|ne\.kr|nm\.kr|or\.kr|li|lt|lu|asso\.mc|tm\.mc|com\.mm|org\.mm|net\.mm|edu\.mm|gov\.mm|ms|nl|no|nu|pl|ro|org\.ro|store\.ro|tm\.ro|firm\.ro|www\.ro|arts\.ro|rec\.ro|info\.ro|nom\.ro|nt\.ro|se|si|com\.sg|org\.sg|net\.sg|gov\.sg|sk|st|tf|ac\.th|co\.th|go\.th|mi\.th|net\.th|or\.th|tm|to|com\.tr|edu\.tr|gov\.tr|k12\.tr|net\.tr|org\.tr|com\.tw|org\.tw|net\.tw|ac\.uk|uk\.com|uk\.net|gb\.com|gb\.net|vg|sh|kz|ch|info|ua|gov|name|pro|ie|hk|com\.hk|org\.hk|net\.hk|edu\.hk|us|tk|cd|by|ad|lv|eu\.lv|bz|es|jp|cl|ag|mobi|eu|co\.nz|org\.nz|net\.nz|maori\.nz|iwi\.nz|io|la|md|sc|sg|vc|tw|travel|my|se|tv|pt|com\.pt|edu\.pt|asia|fi|com\.ve|net\.ve|fi|org\.ve|web\.ve|info\.ve|co\.ve|tel|im|gr|ru|net\.ru|org\.ru|hr|com\.hr|ly|xyz)$/);
  }
  function e(n, a) {
    var o = n.charAt(0), a = a.split(o);
    return o === n ? a : a[(n = parseInt(n.substring(1), 10)) < 0 ? a.length + n : n - 1];
  }
  function r(n, s) {
    for (var o, a = n.charAt(0), u = s.split("&"), l = [], p = {}, g = n.substring(1), d = 0, v = u.length; d < v; d++) if ((l = (l = u[d].match(/(.*?)=(.*)/)) || [u[d], u[d], ""])[1].replace(/\s/g, "") !== "") {
      if (l[2] = (o = l[2] || "", _.decodeURIComponent(o.replace(/\+/g, " "))), g === l[1]) return l[2];
      (o = l[1].match(/(.*)\[([0-9]+)\]/)) ? (p[o[1]] = p[o[1]] || [], p[o[1]][o[2]] = l[2]) : p[l[1]] = l[2];
    }
    return a === n ? p : p[g];
  }
  return function(n, s) {
    var o, a = {};
    if (n === "tld?") return i();
    if (s = s || window.location.toString(), !n) return s;
    if (n = n.toString(), o = s.match(/^mailto:([^\/].+)/)) a.protocol = "mailto", a.email = o[1];
    else {
      if ((o = (s = (o = s.match(/(.*?)\/#\!(.*)/)) ? o[1] + o[2] : s).match(/(.*?)#(.*)/)) && (a.hash = o[2], s = o[1]), a.hash && n.match(/^#/)) return r(n, a.hash);
      if ((o = s.match(/(.*?)\?(.*)/)) && (a.query = o[2], s = o[1]), a.query && n.match(/^\?/)) return r(n, a.query);
      if ((o = s.match(/(.*?)\:?\/\/(.*)/)) && (a.protocol = o[1].toLowerCase(), s = o[2]), (o = s.match(/(.*?)(\/.*)/)) && (a.path = o[2], s = o[1]), a.path = (a.path || "").replace(/^([^\/])/, "/$1").replace(/\/$/, ""), (n = n.match(/^[\-0-9]+$/) ? n.replace(/^([^\/])/, "/$1") : n).match(/^\//)) return e(n, a.path.substring(1));
      if ((o = (o = e("/-1", a.path.substring(1))) && o.match(/(.*?)\.(.*)/)) && (a.file = o[0], a.filename = o[1], a.fileext = o[2]), (o = s.match(/(.*)\:([0-9]+)$/)) && (a.port = o[2], s = o[1]), (o = s.match(/(.*?)@(.*)/)) && (a.auth = o[1], s = o[2]), a.auth && (o = a.auth.match(/(.*)\:(.*)/), a.user = o ? o[1] : a.auth, a.pass = o ? o[2] : void 0), a.hostname = s.toLowerCase(), n.charAt(0) === ".") return e(n, a.hostname);
      i() && (o = a.hostname.match(i())) && (a.tld = o[3], a.domain = o[2] ? o[2] + "." + o[3] : void 0, a.sub = o[1] || void 0), s = a.port ? ":" + a.port : "", a.protocol = a.protocol || window.location.protocol.replace(":", ""), a.port = a.port || (a.protocol === "https" ? "443" : "80"), a.protocol = a.protocol || (a.port === "443" ? "https" : "http"), a.basic = a.protocol + "://" + a.hostname + s;
    }
    return n in a ? a[n] : n === "{}" ? a : "";
  };
})(), _.hashCode = function(i) {
  if (typeof i != "string") return 0;
  var e = 0;
  if (i.length !== 0) for (var r = 0; r < i.length; r++) e = (e << 5) - e + i.charCodeAt(r), e &= e;
  return e;
}, _.decodeURIComponent = function(i) {
  var e = "";
  try {
    e = decodeURIComponent(i);
  } catch {
    e = i;
  }
  return e;
}, _.encodeURIComponent = function(i) {
  var e = "";
  try {
    e = encodeURIComponent(i);
  } catch {
    e = i;
  }
  return e;
}, _.utf8Encode = function(i) {
  for (var e, r = "", n = e = 0, s = (i = (i + "").replace(/\r\n/g, `
`).replace(/\r/g, `
`)).length, o = 0; o < s; o++) {
    var a = i.charCodeAt(o), u = null;
    a < 128 ? e++ : u = 127 < a && a < 2048 ? String.fromCharCode(a >> 6 | 192, 63 & a | 128) : String.fromCharCode(a >> 12 | 224, a >> 6 & 63 | 128, 63 & a | 128), u !== null && (n < e && (r += i.substring(n, e)), r += u, n = e = o + 1);
  }
  return n < e && (r += i.substring(n, i.length)), r;
}, _.base64Encode = function(i) {
  var e, r, n, s, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", a = 0, u = 0, l = "", p = [];
  if (!i) return i;
  for (i = _.utf8Encode(i); e = (s = i.charCodeAt(a++) << 16 | i.charCodeAt(a++) << 8 | i.charCodeAt(a++)) >> 12 & 63, r = s >> 6 & 63, n = 63 & s, p[u++] = o.charAt(s >> 18 & 63) + o.charAt(e) + o.charAt(r) + o.charAt(n), a < i.length; ) ;
  switch (l = p.join(""), i.length % 3) {
    case 1:
      l = l.slice(0, -2) + "==";
      break;
    case 2:
      l = l.slice(0, -1) + "=";
  }
  return l;
}, _.cookie = { get: function(i) {
  for (var e = i + "=", r = document.cookie.split(";"), n = 0; n < r.length; n++) {
    for (var s = r[n]; s.charAt(0) === " "; ) s = s.substring(1, s.length);
    if (s.indexOf(e) === 0) return _.decodeURIComponent(s.substring(e.length, s.length));
  }
  return null;
}, set: function(i, e, l, n, s) {
  var o = "", a = "", u = "", l = (l = l === null ? 73e3 : l, n && (o = (n = _.url("domain", location.href)) ? "; domain=." + n : ""), l && (n = /* @__PURE__ */ new Date(), String(l).slice(-1) === "s" ? n.setTime(n.getTime() + 1e3 * Number(String(l).slice(0, -1))) : n.setTime(n.getTime() + 24 * l * 60 * 60 * 1e3), a = "; expires=" + n.toGMTString()), s && (u = "; secure"), i + "=" + encodeURIComponent(e) + a + "; path=/" + o + u);
  return document.cookie = l;
}, remove: function(i, e) {
  _.cookie.set(i, "", -1, e);
} }, _.localStorage = { get: function(i) {
  try {
    return window.localStorage.getItem(i);
  } catch (e) {
    _.localStorage.error(e);
  }
}, parse: function(i) {
  var e;
  try {
    e = JSON.parse(_.localStorage.get(i)) || null;
  } catch (r) {
    _.localStorage.error(r);
  }
  return e;
}, set: function(i, e) {
  try {
    window.localStorage.setItem(i, e);
  } catch (r) {
    _.localStorage.error(r);
  }
}, remove: function(i) {
  try {
    window.localStorage.removeItem(i);
  } catch (e) {
    _.localStorage.error(e);
  }
}, error: function(i) {
  console.error("localStorage error: " + i);
}, isSupported: function() {
  var i = !0;
  try {
    var e = "__thinkingdatasupport__", r = "testIsSupportStorage";
    _.localStorage.set(e, r), _.localStorage.get(e) !== r && (i = !1), _.localStorage.remove(e);
  } catch {
    i = !1;
  }
  return i;
} }, _.stripEmptyProperties = function(i) {
  var e = {};
  return _.each(i, function(r, n) {
    _.check.isString(r) && 0 < r.length && (e[n] = r);
  }), e;
}, _.info = { os: function() {
  var i = navigator.userAgent;
  return /Windows/i.test(i) ? /Phone/.test(i) || /WPDesktop/.test(i) ? "Windows Phone" : "Windows" : /(iPhone|iPad|iPod)/.test(i) ? "iOS" : /Android/.test(i) ? "Android" : /(BlackBerry|PlayBook|BB10)/i.test(i) ? "BlackBerry" : /Mac/i.test(i) ? "Mac OS X" : /Linux/.test(i) ? "Linux" : /CrOS/.test(i) ? "Chrome OS" : "";
}, browser: function() {
  var i = { type: "", version: "" };
  try {
    var e, r, n = navigator.userAgent.toLowerCase(), s = [];
    n.match(/baidubrowser/) !== null ? (i.type = "baidu", s.push(/baidubrowser\/([\d.]+)/)) : n.match(/bidubrowser/) !== null ? (i.type = "baidu", s.push(/bidubrowser\/([\d.]+)/)) : n.match(/edga/) !== null ? (i.type = "edge", s.push(/edga\/([\d.]+)/)) : n.match(/edgios/) !== null ? (i.type = "edge", s.push(/edgios\/([\d.]+)/)) : n.match(/liebaofast/) !== null ? (i.type = "liebao", s.push(/liebaofast\/([\d.]+)/)) : n.match(/sogoumobilebrowser/) !== null ? (i.type = "sogou", s.push(/sogoumobilebrowser\/([\d.]+)/)) : n.match(/lbbrowser/) !== null ? (i.type = "liebao", s.push(/lbbrowser\/([\d.]+)/)) : n.match(/crios/) !== null ? (i.type = "chrome", s.push(/crios\/([\d.]+)/)) : n.match(/qihoobrowser/) !== null ? (i.type = "360", s.push(/qihoobrowser\/([\d.]+)/)) : n.match(/mxios/) !== null ? (i.type = "maxthon", s.push(/mxios\/([\d.]+)/)) : n.match(/fxios/) !== null ? (i.type = "firefox", s.push(/fxios\/([\d.\w]+)/)) : n.match(/edge/) !== null ? (i.type = "edge", s.push(/edge\/([\d.]+)/)) : n.match(/metasr/) !== null ? (i.type = "sogou", s.push(/metasr ([\d.]+)/)) : n.match(/micromessenger/) !== null ? (i.type = "micromessenger", s.push(/micromessenger\/([\d.]+)/)) : n.match(/mqqbrowser/) !== null ? (i.type = "qq", s.push(/mqqbrowser\/([\d.]+)/)) : n.match(/qqbrowserlite/) !== null ? (i.type = "qq", s.push(/qqbrowserlite\/([\d.]+)/)) : n.match(/tencenttraveler/) !== null ? (i.type = "qq", s.push(/tencenttraveler\/([\d.]+)/)) : n.match(/qqbrowser/) !== null ? (i.type = "qq", s.push(/qqbrowser\/([\d.]+)/)) : n.match(/maxthon/) !== null ? (i.type = "maxthon", s.push(/maxthon\/([\d.]+)/)) : n.match(/ubrowser/) !== null ? (i.type = "uc", s.push(/ubrowser\/([\d.]+)/)) : n.match(/ucbrowser/) !== null ? (i.type = "uc", s.push(/ucbrowser\/([\d.]+)/)) : n.match(/firefox/) !== null ? (i.type = "firefox", s.push(/firefox\/([\d.]+)/)) : n.match(/opera/) !== null ? (i.type = "opera", s.push(/opera\/([\d.]+)/)) : n.match(/opr/) !== null ? (i.type = "opera", s.push(/opr\/([\d.]+)/)) : n.match(/chrome/) !== null ? (i.type = "chrome", s.push(/chrome\/([\d.]+)/)) : n.match(/safari/) !== null ? (i.type = "safari", s.push(/version\/([\d.]+)/)) : n.match(/trident/) === null && n.match(/msie/) === null || (i.type = "ie"), i.type === "ie" ? (e = n.match(/trident\/([\d.]+)/) ? n.match(/trident\/([\d.]+)/)[1] : "", r = n.match(/msie ([\d.]+)/) ? n.match(/msie ([\d.]+)/)[1] : "", e !== "" ? i.version = String(parseInt(e) + 4) : r !== "" && (i.version = r)) : s && (i.version = n.match(s[0]) ? n.match(s[0])[1] : "");
  } catch (o) {
    Log.w("getting browser info failed due to ", o);
  }
  return i;
}, properties: function() {
  var i = _.info.browser();
  return _.extend({ "#os": _.info.os(), "#lib_version": Config.LIB_VERSION, "#lib": "js", "#screen_height": screen.height, "#screen_width": screen.width, "#browser": i.type, "#browser_version": i.version, "#system_language": _.check.isString(navigator.language) ? navigator.language : "Value exception", "#ua": _.check.isString(navigator.userAgent) ? navigator.userAgent.toLowerCase() : "Value exception", "#utm": _.getUtm() });
}, pageProperties: function() {
  var i = _.getReferrer();
  return _.stripEmptyProperties({ "#referrer": i, "#referrer_host": i && _.url("hostname", i), "#url": location.href, "#url_path": location.pathname, "#title": document.title });
} }, _.getUtm = function() {
  var i = {};
  return _.each(utmTypes, function(e) {
    var r = _.getQueryParam(location.href, e);
    r.length && (i[e] = r);
  }), JSON.stringify(i);
}, _.getQueryParam = function(i, e) {
  return e = e.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"), i = _.decodeURIComponent(i), e = new RegExp("[\\?&]" + e + "=([^&#]*)").exec(i), e === null || e && typeof e[1] != "string" && e[1].length ? "" : _.decodeURIComponent(e[1]);
}, _.createString = function(i) {
  for (var e = i, r = Math.random().toString(36).substr(2); r.length < e; ) r += Math.random().toString(36).substr(2);
  return r = r.substr(0, i);
}, _.createAesKey = function() {
  return _.createString(16);
}, _.generateEncryptyData = function(i, e) {
  if (e !== void 0) {
    var r = e.publicKey, e = e.version;
    if (r !== void 0 && e !== void 0 && typeof CryptoJS < "u" && typeof JSEncrypt < "u") {
      var n = _.createAesKey();
      try {
        var s = CryptoJS.enc.Utf8.parse(n), o = CryptoJS.enc.Utf8.parse(JSON.stringify(i)), a = CryptoJS.AES.encrypt(o, s, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }).toString(), u = new JSEncrypt(), l = (u.setPublicKey(r), u.encrypt(n));
        return l === !1 ? (Log.w("encryption failed"), i) : { pkv: e, ekey: l, payload: a };
      } catch {
        Log.w("encryption failed");
      }
    }
  }
  return i;
}, _.paramType = function(i) {
  return Object.prototype.toString.call(i).replace("[object ", "").replace("]", "");
}, _.addEvent = function(i, e, r, n) {
  if (document.addEventListener) if (this.paramType(i) !== "Array" && this.paramType(i) !== "HTMLCollection" || !i.length || i === window) i.addEventListener(e, r, n);
  else for (var s = 0; s < i.length; s++) this.addEvent(i[s], e, r, n);
  else if (i.length && i !== window) for (var o = 0; o < i.length; o++) this.addEvent(i[o], e, r);
  else i.attachEvent("on" + e, function() {
    return r.call(i, window.event);
  });
}, _.getRandom = function() {
  return (/* @__PURE__ */ new Date()).getTime() + "_" + Math.floor(1e6 * Math.random());
}, _.safeJSONParse = function(i) {
  var e = null;
  try {
    e = JSON.parse(i);
  } catch {
    return i;
  }
  return e;
}, _.saveObjectVal = function(i, e) {
  _.check.isString(e) || (e = JSON.stringify(e)), _.localStorage.set(i, e);
}, _.readObjectVal = function(i) {
  return i = _.localStorage.get(i), i ? _.safeJSONParse(i) : null;
}, _.indexOf = function(i, e) {
  var r = i.indexOf;
  if (r) return r.call(i, e);
  for (var n = 0; n < i.length; n++) if (e === i[n]) return n;
  return -1;
}, _.hasEncrypty = function(i) {
  return !!_.check.isObject() && i.pkv !== "undefined" && i.ekey !== "undefined" && i.payload !== "undefined";
}, _.addSiteEvent = function(i, e, r, n) {
  function s(a) {
    return a && (a.preventDefault = s.preventDefault, a.stopPropagation = s.stopPropagation, a._getPath = s._getPath), a;
  }
  s._getPath = function() {
    var a;
    return this.path || this.composedPath && this.composedPath() || (a = this.target, new o(a).getParents());
  };
  var o = function(a) {
    this.ele = a;
  };
  s.preventDefault = function() {
    this.returnValue = !1;
  }, s.stopPropagation = function() {
    this.cancelBubble = !0;
  }, (function(a, u, l) {
    var p, g, d, v, y, S;
    n === void 0 && u === "click" && (n = !0), a && a.addEventListener ? a.addEventListener(u, function(b) {
      b._getPath = s._getPath, l.call(this, b);
    }, n) : (g = a[p = "on" + u], a[p] = (d = a, v = l, y = g, S = u, function(b) {
      var w, A;
      if (b = b || s(window.event)) return b.target = b.srcElement, w = !0, typeof y == "function" && (A = y(b)), b = v.call(d, b), S !== "beforeunload" ? A !== !1 && b !== !1 && w : void 0;
    }));
  }).apply(null, arguments);
}, _.getURLSearchParams = function(i) {
  for (var e = {}, r = (i = i || "").substring(1).split("&"), n = 0; n < r.length; n++) {
    var s, o = r[n].indexOf("=");
    o !== -1 && (s = r[n].substring(0, o), o = r[n].substring(o + 1), s = _.decodeURIComponent(s), o = _.decodeURIComponent(o), e[s] = o);
  }
  return e;
}, _.urlParse = function(i) {
  function e(r) {
    this._fields = { Username: 4, Password: 5, Port: 7, Protocol: 2, Host: 6, Path: 8, URL: 0, QueryString: 9, Fragment: 10 }, this._values = {}, this._regex = /^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/, r !== void 0 && this._parse(r);
  }
  return e.prototype.setUrl = function(r) {
    this._parse(r);
  }, e.prototype._initValues = function() {
    for (var r in this._fields) this._values[r] = "";
  }, e.prototype.addQueryString = function(r) {
    if (_typeof(r) !== "object") return !1;
    var n, s = this._values.QueryString || "";
    for (n in r) s = new RegExp(n + "[^&]+").test(s) ? s.replace(new RegExp(n + "[^&]+"), n + "=" + r[n]) : s.slice(-1) === "&" ? s + n + "=" + r[n] : s === "" ? n + "=" + r[n] : s + "&" + n + "=" + r[n];
    this._values.QueryString = s;
  }, e.prototype.getUrl = function() {
    var r = "";
    return (r += this._values.Origin) + (this._values.Port ? ":" + this._values.Port : "") + this._values.Path + (this._values.QueryString ? "?" + this._values.QueryString : "") + (this._values.Fragment ? "#" + this._values.Fragment : "");
  }, e.prototype._parse = function(o) {
    this._initValues(), this._regex.exec(o) || Log.i("URLParser::_parse -> Invalid URL");
    var n, o = o.split("#"), s = o[0], o = o.slice(1).join("#"), a = this._regex.exec(s);
    for (n in this._fields) a[this._fields[n]] !== void 0 && (this._values[n] = a[this._fields[n]]);
    this._values.Hostname = this._values.Host.replace(/:\d+$/, ""), this._values.Origin = this._values.Protocol + "://" + this._values.Hostname, this._values.Fragment = o;
  }, new e(i);
}, _.trim = function(i) {
  return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
}, _.URL = function(i) {
  var e, r, n = {};
  if (typeof window.URL == "function" && (() => {
    try {
      return new URL("http://modernizr.com/").href === "http://modernizr.com/";
    } catch {
      return !1;
    }
  })()) (n = new URL(i)).searchParams || (n.searchParams = (r = _.getURLSearchParams(n.search), { get: function(s) {
    return r[s];
  } }));
  else {
    if (_.check.isString(i) || (i = String(i)), i = _.trim(i), /^https?:\/\/.+/.test(i) === !1) return void Log.w("Invalid URL");
    i = _.urlParse(i), n.hash = i._values.Fragment, n.host = i._values.Host ? i._values.Host + (i._values.Port ? ":" + i._values.Port : "") : "", n.href = i._values.URL, n.password = i._values.Password, n.pathname = i._values.Path, n.port = i._values.Port, n.search = i._values.QueryString ? "?" + i._values.QueryString : "", n.username = i._values.Username, n.hostname = i._values.Hostname, n.protocol = i._values.Protocol ? i._values.Protocol + ":" : "", n.origin = i._values.Origin ? i._values.Origin + (i._values.Port ? ":" + i._values.Port : "") : "", n.searchParams = (e = _.getURLSearchParams("?" + i._values.QueryString), { get: function(s) {
      return e[s];
    } });
  }
  return n;
}, (() => {
  function i() {
    _classCallCheck(this, i);
  }
  return _createClass(i, null, [{ key: "i", value: function() {
    if (!this.showLog) return !1;
    if (this.showLog !== !0 && this.showLog !== "string" || (arguments[0] = _.formatJsonString(arguments[0])), (typeof console > "u" ? "undefined" : _typeof(console)) === "object" && console.log) try {
      return console.log.apply(console, arguments);
    } catch {
      console.log(arguments[0]);
    }
  } }, { key: "w", value: function() {
    if (!this.showLog) return !1;
    if (this.showLog !== !0 && this.showLog !== "string" || (arguments[0] = _.formatJsonString(arguments[0])), (typeof console > "u" ? "undefined" : _typeof(console)) === "object" && console.warn) try {
      return console.warn.apply(console, arguments);
    } catch {
      console.warn(arguments[0]);
    }
  } }]), i;
})()), KEY_NAME_MATCH_REGEX = /^[a-zA-Z][a-zA-Z0-9_]{0,49}$/;
(() => {
  function i() {
    _classCallCheck(this, i);
  }
  return _createClass(i, null, [{ key: "stripProperties", value: function(e) {
    return _.check.isObject(e) && _.each(e, function(r, n) {
      _.check.isString(r) || _.check.isNumber(r) || _.check.isDate(r) || _.check.isBoolean(r) || _.check.isArray(r) || _.check.isObject(r) || Log.w("The format of Data-", n, r, " does not meet the requirements and may not be stored correctly. The attribute value only supports String, Number, Date, Boolean, Array，Object");
    }), e;
  } }, { key: "_checkPropertiesKey", value: function(e) {
    var r = !0;
    return _.each(e, function(n, s) {
      KEY_NAME_MATCH_REGEX.test(s) || (Log.w("invalid key: " + s), r = !1);
    }), r;
  } }, { key: "event", value: function(e) {
    return !(!_.check.isString(e) || !KEY_NAME_MATCH_REGEX.test(e)) || (Log.w("Please check the parameter format, eventName must be an English letter or a string starting with '_', containing letters and numbers with no more than 50 characters: " + e), !1);
  } }, { key: "propertyName", value: function(e) {
    return !(!_.check.isString(e) || !KEY_NAME_MATCH_REGEX.test(e)) || (Log.w("Please check the parameter format, propertyName must be an English letter or a string starting with '_', containing letters and numbers with no more than 50 characters: " + e), !1);
  } }, { key: "properties", value: function(e) {
    return this.stripProperties(e), !e || !(!_.check.isObject(e) || !this._checkPropertiesKey(e) && (Log.w("Please check the parameter format, the key of properties can only start with a letter, contain numbers, letters and underscores _, and the maximum length is 50 characters"), 1));
  } }, { key: "propertiesMust", value: function(e) {
    return this.stripProperties(e), e === void 0 || !_.check.isObject(e) || _.check.isEmptyObject(e) ? (Log.w("properties must be objects and have values"), !1) : !!this._checkPropertiesKey(e) || (Log.w("Please check the parameter format, the key of properties can only start with a letter, contain numbers, letters and underscores _, and the maximum length is 50 characters"), !1);
  } }, { key: "userId", value: function(e) {
    return !(!_.check.isString(e) || !/^.{1,63}$/.test(e)) || (Log.w("User id must be a string that cannot be empty and is less than 64 bits"), !1);
  } }]), i;
})();
(() => {
  function i(e, r, n, s, o, a, u) {
    _classCallCheck(this, i), this.data = e, this.serverUrl = r, this.tryCount = n ?? 3, this.success = s, this.error = o, this.isDebug = a, this.dataSendTimeout = u;
  }
  return _createClass(i, [{ key: "run", value: function() {
    var e, r = null, n = ((r = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP")).open("post", this.serverUrl, !0), r.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), this);
    e = setTimeout(function() {
      try {
        r && _typeof(r) === "object" && r.abort && r.abort();
      } catch (s) {
        Log.e(s);
      }
      e && (clearTimeout(e), e = null, n.error && n.error(), r.onreadystatechange = null, r.onload = null, r.onerror = null);
    }, this.dataSendTimeout), r.onreadystatechange = function() {
      try {
        var s;
        r.readyState === 4 && (100 <= r.status && r.status < 200 ? Log.i("Ignoring temporary status code 1xx.") : 200 <= r.status && r.status < 300 || r.status === 304 ? (n.success && n.success(), e && (clearTimeout(e), e = null), n.isDebug && ((s = JSON.parse(r.response)).errorLevel !== 0 ? Log.w(s) : Log.i(s))) : (n.error && n.error(), e && (clearTimeout(e), e = null), 0 < n.tryCount && n.onFailed()));
      } catch (o) {
        Log.e(o);
      }
    }, r.send(this.data);
  } }, { key: "onFailed", value: function() {
    0 <= --this.tryCount && this.run();
  } }]), i;
})();
(() => {
  function i(e, r) {
    _classCallCheck(this, i), this.taLib = e, _.paramType(r) === "Object" && _.paramType(r.pageShow) === "Boolean" ? this.autoPageShow = r.pageShow : this.autoPageShow = !1, _.paramType(r) === "Object" && _.paramType(r.pageHide) === "Boolean" ? this.autoPageHide = r.pageHide : this.autoPageHide = !1;
  }
  return _createClass(i, [{ key: "start", value: function() {
    var e = this;
    e.trackPageShowEvent(), "onvisibilitychange" in document && _.addEvent(document, "visibilitychange", function() {
      document.hidden ? e.trackPageHideEvent() : e.trackPageShowEvent();
    });
  } }, { key: "trackPageShowEvent", value: function() {
    this.autoPageShow && this.taLib.track("ta_page_show", _.info.pageProperties()), this.taLib.timeEvent("ta_page_hide");
  } }, { key: "trackPageHideEvent", value: function() {
    this.autoPageHide && this.taLib.trackWithBeacon("ta_page_hide", _.info.pageProperties());
  } }, { key: "trackPageHideEventOnClose", value: function() {
    this.autoPageHide && this.isPageShow && this.taLib.trackWithBeacon("ta_page_hide", _.info.pageProperties());
  } }]), i;
})();
let thinkingdata_wx;
thinkingdata_wx = require("./tdanalytics.wx.min.js");
const initTa = ({
  appId: i,
  serverUrl: e
}) => {
  thinkingdata_wx.init({ appId: i, serverUrl: e });
}, sendAdExposureTa = (i) => {
  const e = Object.fromEntries(
    Object.entries(i).filter(
      ([r, n]) => n !== void 0 && n !== ""
    )
  );
  thinkingdata_wx.track({
    eventName: "ad_exposure_platform",
    properties: {
      ...e
    }
  });
}, handleTaParams = (i, e, r) => {
  let n = "";
  e.adType == "1" ? n = "H5广告" : e.adType == "6" ? n = "半屏小程序" : n = "广告类型错误";
  const { trafficId: s, orderNumber: o, ...a } = i;
  sendAdExposureTa({
    ...a,
    traffic_master_id: s,
    traffic_master_s_name: e.abbreviation,
    advertising_number: e.adId,
    advertising_name: e.adName,
    advertisers: e.advertisersName,
    taskId: e.taskId,
    adType: n,
    orderNumber: o,
    cashier: "流量主微信小程序收银台"
  });
}, useAds = () => ({ onAds: (e, r, n, s) => {
  openAd(e, r);
} }), openAd = (i, e, r, n) => {
  e.adType == "6" ? openAdEmbedded(i, e) : (sendAdExposureTa({
    ...i,
    desc: "广告类型错误",
    ...e,
    cashier: "流量主微信小程序收银台"
  }), console.log("广告类型错误"));
}, openAdEmbedded = (i, e) => {
  let r = e.appletRedirect && e.appletRedirect != "null" ? e.appletRedirect : "";
  (wx.openEmbeddedMiniProgram || wx.navigateToMiniProgram)({
    appId: e.appletAppid,
    path: r,
    envVersion: "release",
    success: () => {
      handleTaParams(i, e);
    },
    fail: (s) => {
    },
    complete: () => {
    }
  });
};
var ERR_CODES = /* @__PURE__ */ ((i) => (i.ERR_Params = "000011", i.ERR_Request = "000012", i.ERR_SupAd = "000013", i.ERR_OpenMiniProgram = "000014", i.ERR_OpenH5 = "000015", i.ERR_requestTraceId = "000016", i))(ERR_CODES || {});
const errCodesHandle = {
  "000011": "流量主ID或订单号不能为空",
  "000012": "请求广告失败",
  "000013": "暂不支持该广告类型",
  "000014": "打开小程序失败",
  "000015": "打开H5失败",
  "000016": "请求流水号不能为空"
};
class PayAd {
  constructor(e) {
    R(this, "env");
    R(this, "http");
    this.env = e || "prod", this.http = createWxRequest(this.env), initTa(taConfig[this.env]);
  }
  // 获取广告信息，仅获取广告名称后，直接返回广告名称 、requestTraceId
  async getAdsInfo(e, r) {
    this.showAd(e, r);
  }
  // 展示广告
  async showAd(e, r) {
    var o, a, u;
    const { aleartMsg: n, ...s } = e;
    if (!s.trafficId || !s.orderNumber) {
      this.callBackOnError(
        errCodesHandle[ERR_CODES.ERR_Params],
        ERR_CODES.ERR_Params,
        r
      );
      return;
    }
    try {
      const l = await this.getAd(s), p = l.traceId, g = l.data;
      if (!g) {
        this.callBackOnError(
          errCodesHandle[ERR_CODES.ERR_Request],
          ERR_CODES.ERR_Request,
          r
        );
        return;
      }
      if (g.adType !== "6") {
        this.callBackOnError(
          errCodesHandle[ERR_CODES.ERR_SupAd],
          ERR_CODES.ERR_SupAd,
          r
        );
        return;
      }
      if (e != null && e.requestTraceId) {
        const { onAds: d } = useAds();
        d(
          s,
          g,
          n || "",
          e.customClickEvent || !1
        ), (o = r == null ? void 0 : r.onSuccess) == null || o.call(r, "success");
      } else
        (a = r == null ? void 0 : r.onSuccess) == null || a.call(r, {
          adName: (g == null ? void 0 : g.remark) || "",
          requestTraceId: p
        });
    } catch (l) {
      (u = r == null ? void 0 : r.onError) == null || u.call(r, (l == null ? void 0 : l.data) || l);
    }
  }
  callBackOnError(e, r, n) {
    var o;
    wx.showToast({
      title: e,
      icon: "none",
      mask: !0
    });
    const s = {
      data: {
        msg: e,
        code: r
      }
    };
    (o = n == null ? void 0 : n.onError) == null || o.call(n, s);
  }
  async getAd(e) {
    const r = {
      adMarkEntry: "11",
      adType: "6",
      trafficId: e.trafficId || "",
      //流量主id
      openId: e.openId || ""
      //用户id
    }, n = encryptRequestData(r, rsaKey.public);
    return r_queryInfo(this.http.post, n);
  }
}
export {
  PayAd
};
