'use strict'
!(function(require, directRequire) {
  const a = require('iconv-lite')
  module.exports = {
    encodeArrayBufferSync: async function(b, c) {
      let d = c.args.format,
        e = c.args.data
      try {
        let b = a.encode(e, d),
          f = b.toString('base64')
        return {
          errMsg: `${c.api}:ok`,
          base64: f,
          __cover: { base64: 'buffer' }
        }
      } catch (a) {
        return { errMsg: `${c.api}:fail ${a}` }
      }
    },
    decodeArrayBufferSync: async function(b, c) {
      let d = c.args.format,
        e = c.args.data
      try {
        let b = new Buffer(e, 'base64'),
          f = a.decode(b, d)
        return { errMsg: `${c.api}:ok`, result: f }
      } catch (a) {
        return { errMsg: `${c.api}:fail` }
      }
    }
  }
})(require('lazyload'), require)
