'use strict'
!(function(require, directRequire) {
  function c(a, b) {
    ;(a = a.split('.')), (b = b.split('.'))
    for (var c = Math.max(a.length, b.length); a.length < c; ) a.push('0')
    for (; b.length < c; ) b.push('0')
    for (var d = 0; d < c; d++) {
      var e = parseInt(a[d]),
        f = parseInt(b[d])
      if (e > f) return 1
      if (e < f) return -1
    }
    return 0
  }
  function a(a) {
    return {
      updateTime: a.update_time ? 1e3 * a.update_time : void 0,
      android: a.android,
      ios: a.iOS,
      total: a.total
    }
  }
  const b = require('./15ba1827c7f6564a45df6bd44da3a977.js'),
    d = require('./233d77ecf0781f44985f684f70e316d0.js'),
    e = require('./f171257bbcaef547a3cf27266ccb0db2.js'),
    f = require('./92320c1386e6db6a6f2556736a9bc280.js'),
    g = require('./logger.js'),
    h = f.WeappVendor,
    i = require('path'),
    j = require('fs')
  let k = null
  module.exports = {
    getOnlineVendorList: function() {
      return new Promise(async (d, f) => {
        if (k) return d(k)
        try {
          const { body: h } = await b({
              url: e.getPublicLibUsageRate,
              needToken: 1,
              needAppID: 1
            }),
            i = h.json_data
          if (i) {
            const b = 'string' == typeof i ? JSON.parse(i) : i,
              e = a(b)
            if (!e.total) return f()
            const g = b.total
              .sort((d, a) => c(d.sdkVer, a.sdkVer))
              .map(b => b.sdkVer)
            ;(k = g), d(g)
          } else
            return g.error(`get public lib usage rate fail, body: ${h}`), f()
        } catch (a) {
          return (
            g.error(`get public lib usage rate fail, error: ${a.toString()}`),
            f()
          )
        }
      })
    },
    clearVendorListCache: function() {
      k = null
    },
    compareVersion: c
  }
})(require('lazyload'), require)
