(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var jnitrace_engine_1 = require("jnitrace-engine");

var jnitrace_engine_2 = require("jnitrace-engine");

var jnitrace_engine_3 = require("jnitrace-engine");

var jnitrace_engine_4 = require("jnitrace-engine");

var method_data_1 = require("./utils/method_data");

var data_transport_1 = require("./transport/data_transport");

var IS_IN_REPL = true;
var transport = new data_transport_1.DataTransport();
var config = null;
jnitrace_engine_1.JNILibraryWatcher.setCallback({
  onLoaded: function onLoaded(path) {
    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
    if (!IS_IN_REPL && !jnitrace_engine_3.Config.initialised()) {
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      var op = recv("config", function (message) {
        var builder = new jnitrace_engine_4.ConfigBuilder();
        /* eslint-disable @typescript-eslint/no-unsafe-member-access */

        builder.libraries = message.payload.libraries;
        builder.backtrace = message.payload.backtrace;
        builder.includeExports = message.payload.include_export;
        builder.excludeExports = message.payload.exclude_export;
        builder.env = message.payload.env;
        builder.vm = message.payload.vm;
        config = builder.build();
        transport.setIncludeFilter(message.payload.include);
        transport.setExcludeFilter(message.payload.exclude);
        /* eslint-enable @typescript-eslint/no-unsafe-member-access */
      });
      op.wait();
    }

    if (config === null) {
      return;
    }

    config.libraries.forEach(function (element) {
      if (path.includes(element)) {
        send({
          type: "tracked_library",
          library: path
        });
      }
    });
  }
});
var jniEnvCallback = {
  onEnter: function onEnter(args) {
    this.args = args;
  },
  onLeave: function onLeave(retval) {
    var data = new method_data_1.MethodData(this.methodDef, this.args, retval.get(), this.javaMethod);
    transport.reportJNIEnvCall(data, this.backtrace);
  }
};
var javaVMCallback = {
  onEnter: function onEnter(args) {
    this.args = args;
  },
  onLeave: function onLeave(retval) {
    var data = new method_data_1.MethodData(this.methodDef, this.args, retval.get(), this.javaMethod);
    transport.reportJavaVMCall(data, this.backtrace);
  }
};
jnitrace_engine_2.JNIInterceptor.attach("DestroyJavaVM", javaVMCallback);
jnitrace_engine_2.JNIInterceptor.attach("AttachCurrentThread", javaVMCallback);
jnitrace_engine_2.JNIInterceptor.attach("DetachCurrentThread", javaVMCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetEnv", javaVMCallback);
jnitrace_engine_2.JNIInterceptor.attach("AttachCurrentThreadAsDaemon", javaVMCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetVersion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("DefineClass", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("FindClass", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("FromReflectedMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("FromReflectedField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ToReflectedMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetSuperclass", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("IsAssignableFrom", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ToReflectedField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("Throw", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ThrowNew", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ExceptionOccurred", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ExceptionDescribe", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ExceptionClear", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("FatalError", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("PushLocalFrame", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("PopLocalFrame", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewGlobalRef", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("DeleteGlobalRef", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("DeleteLocalRef", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("IsSameObject", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewLocalRef", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("EnsureLocalCapacity", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("AllocObject", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewObject", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewObjectV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewObjectA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetObjectClass", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("IsInstanceOf", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetMethodID", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallObjectMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallObjectMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallObjectMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallBooleanMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallBooleanMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallBooleanMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallByteMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallByteMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallByteMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallCharMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallCharMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallCharMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallShortMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallShortMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallShortMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallIntMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallIntMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallIntMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallLongMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallLongMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallLongMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallFloatMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallFloatMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallFloatMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallDoubleMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallDoubleMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallDoubleMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallVoidMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallVoidMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallVoidMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualObjectMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualObjectMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualObjectMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualBooleanMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualBooleanMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualBooleanMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualByteMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualByteMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualByteMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualCharMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualCharMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualCharMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualShortMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualShortMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualShortMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualIntMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualIntMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualIntMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualLongMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualLongMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualLongMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualFloatMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualFloatMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualFloatMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualDoubleMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualDoubleMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualDoubleMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualVoidMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualVoidMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallNonvirtualVoidMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetFieldID", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetObjectField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetBooleanField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetByteField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetCharField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetShortField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetIntField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetLongField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetFloatField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetDoubleField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetObjectField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetBooleanField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetByteField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetCharField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetShortField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetIntField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetLongField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetFloatField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetDoubleField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStaticMethodID", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticObjectMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticObjectMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticObjectMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticBooleanMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticBooleanMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticBooleanMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticByteMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticByteMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticByteMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticCharMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticCharMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticCharMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticShortMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticShortMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticShortMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticIntMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticIntMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticIntMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticLongMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticLongMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticLongMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticFloatMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticFloatMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticFloatMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticDoubleMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticDoubleMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticDoubleMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticVoidMethod", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticVoidMethodV", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("CallStaticVoidMethodA", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStaticFieldID", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStaticObjectField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStaticBooleanField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStaticByteField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStaticCharField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStaticShortField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStaticIntField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStaticLongField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStaticFloatField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStaticDoubleField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetStaticObjectField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetStaticBooleanField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetStaticByteField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetStaticCharField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetStaticShortField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetStaticIntField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetStaticLongField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetStaticFloatField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetStaticDoubleField", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewString", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStringLength", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStringChars", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ReleaseStringChars", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewStringUTF", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStringUTFLength", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStringUTFChars", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ReleaseStringUTFChars", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetArrayLength", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewObjectArray", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetObjectArrayElement", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetObjectArrayElement", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewBooleanArray", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewByteArray", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewCharArray", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewShortArray", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewIntArray", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewLongArray", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewFloatArray", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewDoubleArray", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetBooleanArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetByteArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetCharArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetShortArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetIntArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetLongArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetFloatArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetDoubleArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ReleaseBooleanArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ReleaseByteArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ReleaseCharArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ReleaseShortArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ReleaseIntArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ReleaseLongArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ReleaseFloatArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ReleaseDoubleArrayElements", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetBooleanArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetByteArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetCharArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetShortArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetIntArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetLongArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetFloatArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetDoubleArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetBooleanArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetByteArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetCharArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetShortArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetIntArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetLongArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetFloatArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("SetDoubleArrayRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("RegisterNatives", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("UnregisterNatives", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("MonitorEnter", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("MonitorExit", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetJavaVM", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStringRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStringUTFRegion", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetPrimitiveArrayCritical", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ReleasePrimitiveArrayCritical", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetStringCritical", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ReleaseStringCritical", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewWeakGlobalRef", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("DeleteWeakGlobalRef", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("ExceptionCheck", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("NewDirectByteBuffer", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetDirectBufferAddress", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetDirectBufferCapacity", jniEnvCallback);
jnitrace_engine_2.JNIInterceptor.attach("GetObjectRefType", jniEnvCallback);

},{"./transport/data_transport":2,"./utils/method_data":3,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/interopRequireDefault":19,"jnitrace-engine":128}],2:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));

var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var types_1 = require("../utils/types");

var jnitrace_engine_1 = require("jnitrace-engine");

var JNI_OK = 0;
var TYPE_NAME_START = 0;
var TYPE_NAME_END = -1;
var SKIP_ENV_INDEX = 1;
var EMPTY_ARRAY_LEN = 0;
var JAVA_VM_INDEX = 0;
var JNI_ENV_INDEX = 0;

var NativeMethodJSONContainer = function NativeMethodJSONContainer(name, sig, addr) {
  (0, _classCallCheck2["default"])(this, NativeMethodJSONContainer);
  this.name = {};
  this.sig = {};
  this.addr = {};
  this.name = name;
  this.sig = sig;
  this.addr = addr;
};
/* eslint-disable @typescript-eslint/camelcase */


var DataJSONContainer = /*#__PURE__*/function () {
  function DataJSONContainer(value, data, dataIndex) {
    (0, _classCallCheck2["default"])(this, DataJSONContainer);
    var RET_INDEX = -1;
    this.value = value;

    if (data !== null) {
      if (!(data instanceof ArrayBuffer)) {
        this.data = data;
      }
    }

    if (dataIndex !== undefined) {
      if (dataIndex === RET_INDEX) {
        this.has_data = true;
      } else {
        this.data_for = dataIndex;
      }
    }
  }

  (0, _createClass2["default"])(DataJSONContainer, [{
    key: "getMetadata",
    value: function getMetadata() {
      return this.metadata;
    }
  }, {
    key: "setMetadata",
    value: function setMetadata(metadata) {
      this.metadata = metadata;
    }
  }]);
  return DataJSONContainer;
}();

var BacktraceJSONContainer = function BacktraceJSONContainer(address, module, symbol) {
  (0, _classCallCheck2["default"])(this, BacktraceJSONContainer);
  this.address = address;
  this.module = module;
  this.symbol = symbol;
};

var RecordJSONContainer = function RecordJSONContainer(callType, method, args, ret, threadId, timestamp, javaParams, backtrace) {
  (0, _classCallCheck2["default"])(this, RecordJSONContainer);
  this.type = "trace_data";
  this.call_type = callType;
  this.method = method;
  this.args = args;
  this.ret = ret;
  this.thread_id = threadId;
  this.timestamp = timestamp;
  this.java_params = javaParams;
  this.backtrace = backtrace;
};
/* eslint-enable @typescript-eslint/camelcase */


var DataTransport = /*#__PURE__*/function () {
  function DataTransport() {
    (0, _classCallCheck2["default"])(this, DataTransport);
    this.start = (0, _now["default"])();
    this.byteArraySizes = new _map["default"]();
    this.jobjects = new _map["default"]();
    this.jfieldIDs = new _map["default"]();
    this.jmethodIDs = new _map["default"]();
    this.include = [];
    this.exclude = [];
  }

  (0, _createClass2["default"])(DataTransport, [{
    key: "setIncludeFilter",
    value: function setIncludeFilter(include) {
      this.include = include;
    }
  }, {
    key: "setExcludeFilter",
    value: function setExcludeFilter(exclude) {
      this.exclude = exclude;
    }
  }, {
    key: "reportJavaVMCall",
    value: function reportJavaVMCall(data, context) {
      var config = jnitrace_engine_1.Config.getInstance();
      var outputArgs = [];
      var outputRet = new DataJSONContainer(data.ret, null);
      var javaVM = data.getArgAsPtr(JAVA_VM_INDEX);

      if (!config.vm || this.shouldIgnoreMethod(data)) {
        return;
      }

      outputArgs.push(new DataJSONContainer(javaVM, null));
      var sendData = this.addJavaVMArgs(data, outputArgs);
      this.sendToHost("JavaVM", data, outputArgs, outputRet, sendData, context);
    }
  }, {
    key: "reportJNIEnvCall",
    value: function reportJNIEnvCall(data, context) {
      var RET_INDEX = 0;
      var config = jnitrace_engine_1.Config.getInstance();
      var outputArgs = [];
      var outputRet = [];
      var jniEnv = data.getArgAsPtr(JNI_ENV_INDEX);
      this.updateState(data);
      outputArgs.push(new DataJSONContainer(jniEnv, null));
      var sendData = null;
      var argData = this.addJNIEnvArgs(data, outputArgs);
      var retData = this.addJNIEnvRet(data, outputRet);

      if (argData !== null && retData === null) {
        sendData = argData;
      } else if (argData == null && retData !== null) {
        sendData = retData;
      }

      this.enrichTraceData(data, outputArgs, outputRet);

      if (!config.env || this.shouldIgnoreMethod(data)) {
        return;
      }

      this.sendToHost("JNIEnv", data, outputArgs, outputRet[RET_INDEX], sendData, context);
    }
  }, {
    key: "updateArrayLengths",
    value: function updateArrayLengths(data, isGet) {
      var JARRAY_INDEX = 1;

      if (isGet) {
        this.byteArraySizes.set(data.args[JARRAY_INDEX].toString(), data.ret);
      } else {
        //isSet
        this.byteArraySizes.set(data.ret.toString(), data.args[JARRAY_INDEX]);
      }
    }
  }, {
    key: "updateMethodIDs",
    value: function updateMethodIDs(data) {
      var NAME_INDEX = 2;
      var SIG_INDEX = 3;
      var methodID = data.ret.toString();
      var name = data.args[NAME_INDEX].readCString();
      var sig = data.args[SIG_INDEX].readCString();

      if (name !== null && sig !== null) {
        this.jmethodIDs.set(methodID, name + sig);
      }
    }
  }, {
    key: "updateFieldIDs",
    value: function updateFieldIDs(data) {
      var NAME_INDEX = 2;
      var SIG_INDEX = 3;
      var fieldID = data.ret.toString();
      var name = data.args[NAME_INDEX].readCString();
      var sig = data.args[SIG_INDEX].readCString();

      if (name !== null && sig !== null) {
        this.jfieldIDs.set(fieldID, name + ":" + sig);
      }
    }
  }, {
    key: "updateClassIDs",
    value: function updateClassIDs(data) {
      var NAME_INDEX = 1;
      var jclass = data.ret.toString();
      var name = data.args[NAME_INDEX].readCString();

      if (name !== null) {
        this.jobjects.set(jclass, name);
      }
    }
  }, {
    key: "updateObjectIDsFromRefs",
    value: function updateObjectIDsFromRefs(data, isCreate) {
      var OBJECT_INDEX = 1;

      if (isCreate) {
        var newRef = data.ret.toString();
        var oldRef = data.args[OBJECT_INDEX].toString();

        if (this.jobjects.has(oldRef)) {
          this.jobjects.set(newRef, this.jobjects.get(oldRef));
        }
      } else {
        var jobject = data.args[OBJECT_INDEX].toString();
        this.jobjects["delete"](jobject);
      }
    }
  }, {
    key: "updateObjectIDsFromClass",
    value: function updateObjectIDsFromClass(data) {
      var OBJECT_INDEX = 1;
      var jobject = data.args[OBJECT_INDEX].toString();
      var jclass = data.ret.toString();

      if (this.jobjects.has(jobject)) {
        this.jobjects.set(jclass, jobject);
      }
    }
  }, {
    key: "updateObjectIDsFromCall",
    value: function updateObjectIDsFromCall(data) {
      var TYPE_START = 1;
      var TYPE_END = -1;
      var LAST_CALL_INDEX = 3;
      var CALL_PTRS_OFFSET = 5;

      if (data.javaMethod !== undefined) {
        var start = 4;
        var lastArg = data.method.args[LAST_CALL_INDEX];

        if (["jvalue*", "va_list"].includes(lastArg)) {
          start = CALL_PTRS_OFFSET;
        }

        for (var i = start; i < data.args.length; i++) {
          var arg = data.args[i].toString();

          if (this.jobjects.has(arg)) {
            // skip where we have an existing class name
            continue;
          }

          var nativeJType = data.javaMethod.nativeParams[i - start];

          if (types_1.Types.isComplexObjectType(nativeJType)) {
            this.jobjects.set(arg, nativeJType.slice(TYPE_START, TYPE_END));
          }
        }

        if (data.method.name.includes("Object")) {
          if (!this.jobjects.has(data.ret.toString())) {
            this.jobjects.set(data.ret.toString(), data.javaMethod.ret.slice(TYPE_START, TYPE_END));
          }
        }
      }
    }
  }, {
    key: "updateState",
    value: function updateState(data) {
      var name = data.method.name;

      if (name === "GetArrayLength") {
        this.updateArrayLengths(data, true);
      } else if (name.startsWith("New") && name.endsWith("Array")) {
        this.updateArrayLengths(data, false);
      } else if (["GetMethodID", "GetStaticMethodID"].includes(name)) {
        this.updateMethodIDs(data);
      } else if (["GetFieldID", "GetStaticFieldID"].includes(name)) {
        this.updateFieldIDs(data);
      } else if (["FindClass", "DefineClass"].includes(name)) {
        this.updateClassIDs(data);
      } else if (name.startsWith("New") && name.endsWith("Ref")) {
        this.updateObjectIDsFromRefs(data, true);
      } else if (name.startsWith("Delete") && name.endsWith("Ref")) {
        this.updateObjectIDsFromRefs(data, false);
      } else if (name === "GetObjectClass") {
        this.updateObjectIDsFromClass(data);
      } else if (name.startsWith("Call")) {
        this.updateObjectIDsFromCall(data);
      }
    }
  }, {
    key: "shouldIgnoreMethod",
    value: function shouldIgnoreMethod(data) {
      var name = data.method.name;

      if (this.include.length > EMPTY_ARRAY_LEN) {
        var included = this.include.filter(function (i) {
          return new RegExp(i).test(name);
        });

        if (included.length === EMPTY_ARRAY_LEN) {
          return true;
        }
      }

      if (this.exclude.length > EMPTY_ARRAY_LEN) {
        var excluded = this.exclude.filter(function (e) {
          return new RegExp(e).test(name);
        });

        if (excluded.length > EMPTY_ARRAY_LEN) {
          return true;
        }
      }

      return false;
    }
  }, {
    key: "enrichSingleItem",
    value: function enrichSingleItem(type, key, item) {
      if (types_1.Types.isComplexObjectType(type)) {
        if (this.jobjects.has(key)) {
          item.setMetadata(this.jobjects.get(key));
        }
      } else if (type === "jmethodID") {
        if (this.jmethodIDs.has(key)) {
          item.setMetadata(this.jmethodIDs.get(key));
        }
      } else if (type === "jfieldID") {
        if (this.jfieldIDs.has(key)) {
          item.setMetadata(this.jfieldIDs.get(key));
        }
      }
    }
  }, {
    key: "enrichTraceData",
    value: function enrichTraceData(data, args, ret) {
      var ONLY_RET = 0;
      var i = 0;

      for (; i < data.method.args.length; i++) {
        if (["jvalue*, va_list"].includes(data.method.args[i])) {
          i++;
          continue;
        } else if (data.method.args[i] === "...") {
          break;
        }

        this.enrichSingleItem(data.method.args[i], data.args[i].toString(), args[i]);
      }

      var OFFSET = i;

      for (; i < args.length; i++) {
        if (data.javaMethod !== undefined) {
          this.enrichSingleItem(data.javaMethod.nativeParams[i - OFFSET], data.args[i].toString(), args[i]);
        }
      }

      if (data.ret !== undefined) {
        this.enrichSingleItem(data.method.ret, data.ret.toString(), ret[ONLY_RET]);
      }
    }
  }, {
    key: "addDefineClassArgs",
    value: function addDefineClassArgs(data, outputArgs) {
      var CLASS_NAME_INDEX = 1;
      var OBJECT_INDEX = 2;
      var BUF_INDEX = 3;
      var LEN_INDEX = 4;
      var name = data.getArgAsPtr(CLASS_NAME_INDEX).readCString();
      outputArgs.push(new DataJSONContainer(data.args[CLASS_NAME_INDEX], name));
      outputArgs.push(new DataJSONContainer(data.args[OBJECT_INDEX], null));
      var buf = data.getArgAsPtr(BUF_INDEX);
      var len = data.getArgAsNum(LEN_INDEX);
      var classData = buf.readByteArray(len);
      outputArgs.push(new DataJSONContainer(data.args[BUF_INDEX], null, BUF_INDEX));
      outputArgs.push(new DataJSONContainer(data.args[LEN_INDEX], null));
      return classData;
    }
  }, {
    key: "addFindClassArgs",
    value: function addFindClassArgs(data, outputArgs) {
      var CLASS_NAME_INDEX = 1;
      var name = data.getArgAsPtr(CLASS_NAME_INDEX).readCString();
      outputArgs.push(new DataJSONContainer(data.args[CLASS_NAME_INDEX], name));
    }
  }, {
    key: "addThrowNewArgs",
    value: function addThrowNewArgs(data, outputArgs) {
      var CLASS_INDEX = 1;
      var MESSAGE_INDEX = 2;
      var message = data.getArgAsPtr(MESSAGE_INDEX).readCString();
      outputArgs.push(new DataJSONContainer(data.args[CLASS_INDEX], null));
      outputArgs.push(new DataJSONContainer(data.args[MESSAGE_INDEX], message));
    }
  }, {
    key: "addFatalErrorArgs",
    value: function addFatalErrorArgs(data, outputArgs) {
      var MESSAGE_INDEX = 1;
      var message = data.getArgAsPtr(MESSAGE_INDEX).readCString();
      outputArgs.push(new DataJSONContainer(data.args[MESSAGE_INDEX], message));
    }
  }, {
    key: "addGetGenericIDArgs",
    value: function addGetGenericIDArgs(data, outputArgs) {
      var CLASS_INDEX = 1;
      var NAME_INDEX = 2;
      var SIG_INDEX = 3;
      var name = data.getArgAsPtr(NAME_INDEX).readCString();
      var sig = data.getArgAsPtr(SIG_INDEX).readCString();
      outputArgs.push(new DataJSONContainer(data.args[CLASS_INDEX], null));
      outputArgs.push(new DataJSONContainer(data.args[NAME_INDEX], name));
      outputArgs.push(new DataJSONContainer(data.args[SIG_INDEX], sig));
    }
  }, {
    key: "addNewStringArgs",
    value: function addNewStringArgs(data, outputArgs) {
      var BUF_INDEX = 1;
      var LEN_INDEX = 2;
      var buf = data.getArgAsPtr(BUF_INDEX);
      var len = data.getArgAsNum(LEN_INDEX);
      var unicode = buf.readByteArray(len);
      outputArgs.push(new DataJSONContainer(data.args[BUF_INDEX], null, BUF_INDEX));
      outputArgs.push(new DataJSONContainer(data.args[LEN_INDEX], null));
      return unicode;
    }
  }, {
    key: "addGetGenericBufferArgs",
    value: function addGetGenericBufferArgs(data, outputArgs) {
      var JARRAY_INDEX = 1;
      var BUF_INDEX = 2;
      outputArgs.push(new DataJSONContainer(data.args[JARRAY_INDEX], null));

      if (!data.getArgAsPtr(BUF_INDEX).isNull()) {
        outputArgs.push(new DataJSONContainer(data.args[BUF_INDEX], data.getArgAsPtr(BUF_INDEX).readS8()));
      } else {
        outputArgs.push(new DataJSONContainer(data.args[BUF_INDEX], null));
      }
    }
  }, {
    key: "addReleaseCharsArgs",
    value: function addReleaseCharsArgs(data, outputArgs) {
      var JSTIRNG_INDEX = 2;
      var UNICODE_BUF_INDEX = 2;
      var unicode = data.getArgAsPtr(UNICODE_BUF_INDEX).readCString();
      outputArgs.push(new DataJSONContainer(data.args[JSTIRNG_INDEX], null));
      outputArgs.push(new DataJSONContainer(data.args[UNICODE_BUF_INDEX], unicode));
    }
  }, {
    key: "addGetGenericBufferRegionArgs",
    value: function addGetGenericBufferRegionArgs(data, outputArgs) {
      var LAST_ARG_OFFSET = 1;
      var LEN_INDEX = 3;
      var BUF_INDEX = 4;
      var type = data.method.args[BUF_INDEX].slice(TYPE_NAME_START, TYPE_NAME_END);
      var nType = types_1.Types.convertNativeJTypeToFridaType(type);
      var size = types_1.Types.sizeOf(nType);
      var buf = data.getArgAsPtr(BUF_INDEX);
      var len = data.getArgAsNum(LEN_INDEX);
      var region = buf.readByteArray(len * size);
      var loopLen = data.args.length - LAST_ARG_OFFSET;

      for (var i = SKIP_ENV_INDEX; i < loopLen; i++) {
        outputArgs.push(new DataJSONContainer(data.args[i], null));
      }

      outputArgs.push(new DataJSONContainer(data.args[data.args.length - LAST_ARG_OFFSET], null, data.args.length - LAST_ARG_OFFSET));
      return region;
    }
  }, {
    key: "addNewStringUTFArgs",
    value: function addNewStringUTFArgs(data, outputArgs) {
      var CHAR_PTR_INDEX = 1;
      var utf = data.getArgAsPtr(CHAR_PTR_INDEX).readUtf8String();
      outputArgs.push(new DataJSONContainer(data.args[CHAR_PTR_INDEX], utf));
    }
  }, {
    key: "addRegisterNativesArgs",
    value: function addRegisterNativesArgs(data, outputArgs) {
      var JCLASS_INDEX = 1;
      var METHODS_PTR_INDEX = 2;
      var SIZE_INDEX = 3;
      var JNI_METHOD_SIZE = 3;
      var size = data.getArgAsNum(SIZE_INDEX);
      var natives = [];
      outputArgs.push(new DataJSONContainer(data.args[JCLASS_INDEX], null));

      for (var i = 0; i < size * JNI_METHOD_SIZE; i += JNI_METHOD_SIZE) {
        var methodsPtr = data.getArgAsPtr(METHODS_PTR_INDEX);
        var namePtr = methodsPtr.add(i * Process.pointerSize).readPointer();
        var name = namePtr.readCString();
        var sigOffset = 1;
        var sigPtr = methodsPtr.add((i + sigOffset) * Process.pointerSize).readPointer();
        var sig = sigPtr.readCString();
        var addrOffset = 2;
        var addr = methodsPtr.add((i + addrOffset) * Process.pointerSize).readPointer();
        natives.push(new NativeMethodJSONContainer({
          "value": namePtr.toString(),
          "data": name
        }, {
          "value": sigPtr.toString(),
          "data": sig
        }, {
          "value": addr.toString()
        }));
      }

      outputArgs.push(new DataJSONContainer(data.args[METHODS_PTR_INDEX], natives));
      outputArgs.push(new DataJSONContainer(data.args[SIZE_INDEX], null));
    }
  }, {
    key: "addGetJavaVMArgs",
    value: function addGetJavaVMArgs(data, outputArgs) {
      var JAVAVM_INDEX = 1;
      outputArgs.push(new DataJSONContainer(data.args[JAVAVM_INDEX], data.getArgAsPtr(JAVAVM_INDEX).readPointer()));
    }
  }, {
    key: "addReleaseStringCriticalArgs",
    value: function addReleaseStringCriticalArgs(data, outputArgs) {
      var JSTRING_INDEX = 1;
      var JCHAR_PTR_INDEX = 2;
      outputArgs.push(new DataJSONContainer(data.args[JSTRING_INDEX], null));
      outputArgs.push(new DataJSONContainer(data.args[JCHAR_PTR_INDEX], data.getArgAsPtr(JSTRING_INDEX).readCString()));
    }
  }, {
    key: "addReleaseElementsArgs",
    value: function addReleaseElementsArgs(data, outputArgs) {
      var BYTE_ARRAY_INDEX = 1;
      var BUFFER_PTR_INDEX = 2;
      var SKIP_ENV_INDEX = 1;
      var byteArrayArg = data.method.args[BUFFER_PTR_INDEX];
      var type = byteArrayArg.slice(TYPE_NAME_START, TYPE_NAME_END);
      var nType = types_1.Types.convertNativeJTypeToFridaType(type);
      var size = types_1.Types.sizeOf(nType);
      var buf = data.getArgAsPtr(BUFFER_PTR_INDEX);
      var byteArray = data.getArgAsPtr(BYTE_ARRAY_INDEX).toString();
      var len = this.byteArraySizes.get(byteArray);
      var region = null;

      if (len !== undefined) {
        region = buf.readByteArray(len * size);
      }

      for (var i = SKIP_ENV_INDEX; i < data.args.length; i++) {
        var arg = data.args[i];
        var dataFor = undefined;

        if (i === BUFFER_PTR_INDEX) {
          dataFor = i;
        }

        outputArgs.push(new DataJSONContainer(arg, null, dataFor));
      }

      return region;
    }
  }, {
    key: "addGenericArgs",
    value: function addGenericArgs(data, outputArgs) {
      for (var i = 1; i < data.args.length; i++) {
        outputArgs.push(new DataJSONContainer(data.args[i], null));
      }
    }
  }, {
    key: "addJNIEnvArgs",
    value: function addJNIEnvArgs(data, outputArgs) {
      var name = data.method.name;

      if (name === "DefineClass") {
        return this.addDefineClassArgs(data, outputArgs);
      } else if (name === "FindClass") {
        this.addFindClassArgs(data, outputArgs);
      } else if (name === "ThrowNew") {
        this.addThrowNewArgs(data, outputArgs);
      } else if (name === "FatalError") {
        this.addFatalErrorArgs(data, outputArgs);
      } else if (name.endsWith("ID")) {
        this.addGetGenericIDArgs(data, outputArgs);
      } else if (name === "NewString") {
        return this.addNewStringArgs(data, outputArgs);
      } else if (name.startsWith("Get") && name.endsWith("Chars") || name.startsWith("Get") && name.endsWith("Elements") || name.startsWith("Get") && name.endsWith("ArrayCritical") || name === "GetStringCritical") {
        this.addGetGenericBufferArgs(data, outputArgs);
      } else if (name.startsWith("Release") && name.endsWith("Chars")) {
        this.addReleaseCharsArgs(data, outputArgs);
      } else if (name.endsWith("Region")) {
        return this.addGetGenericBufferRegionArgs(data, outputArgs);
      } else if (name === "NewStringUTF") {
        this.addNewStringUTFArgs(data, outputArgs);
      } else if (name === "RegisterNatives") {
        this.addRegisterNativesArgs(data, outputArgs);
      } else if (name === "GetJavaVM") {
        this.addGetJavaVMArgs(data, outputArgs);
      } else if (name === "ReleaseStringCritical") {
        this.addReleaseStringCriticalArgs(data, outputArgs);
      } else if (name.startsWith("Release") && name.endsWith("Elements") || name.startsWith("Release") && name.endsWith("ArrayCritical")) {
        return this.addReleaseElementsArgs(data, outputArgs);
      } else {
        this.addGenericArgs(data, outputArgs);
      }

      return null;
    }
  }, {
    key: "addJNIEnvRet",
    value: function addJNIEnvRet(data, outputRet) {
      var RET_INDEX = -1;
      var ENVPTR_ARG_INDEX = 1;
      var name = data.method.name;

      if (name.startsWith("Get") && name.endsWith("Elements") || name.startsWith("Get") && name.endsWith("ArrayCritical")) {
        var key = data.args[ENVPTR_ARG_INDEX].toString();

        if (this.byteArraySizes.has(key)) {
          var type = data.method.ret.slice(TYPE_NAME_START, TYPE_NAME_END);
          var nType = types_1.Types.convertNativeJTypeToFridaType(type);
          var size = types_1.Types.sizeOf(nType);
          var buf = data.ret;
          var len = this.byteArraySizes.get(data.getArgAsPtr(ENVPTR_ARG_INDEX).toString());
          outputRet.push(new DataJSONContainer(data.ret, null, RET_INDEX));
          return buf.readByteArray(len * size);
        }
      }

      outputRet.push(new DataJSONContainer(data.ret, null));
      return null;
    }
  }, {
    key: "addAttachCurrentThreadArgs",
    value: function addAttachCurrentThreadArgs(data, outputArgs) {
      var ENV_ARG_INDEX = 1;
      var ARGS_ARG_INDEX = 2;
      var JINT_SIZE = 4;
      var argStructSize = types_1.Types.sizeOf("pointer") + types_1.Types.sizeOf("pointer") + JINT_SIZE;
      var env = data.args[ENV_ARG_INDEX];
      var envData = null;

      if (data.ret === JNI_OK) {
        envData = data.getArgAsPtr(ENV_ARG_INDEX).readPointer();
      } else if (!data.getArgAsPtr(ENV_ARG_INDEX).isNull()) {
        envData = data.getArgAsPtr(ENV_ARG_INDEX).readPointer();
      }

      outputArgs.push(new DataJSONContainer(env, envData));
      var argValue = data.args[ARGS_ARG_INDEX];

      if (!data.getArgAsPtr(ARGS_ARG_INDEX).isNull()) {
        outputArgs.push(new DataJSONContainer(argValue, null, ARGS_ARG_INDEX));
        return data.getArgAsPtr(ARGS_ARG_INDEX).readByteArray(argStructSize);
      } else {
        outputArgs.push(new DataJSONContainer(argValue, null));
      }

      return null;
    }
  }, {
    key: "addGetEnvArgs",
    value: function addGetEnvArgs(data, outputArgs) {
      var ENV_ARG_INDEX = 1;
      var VERSION_ARG_INDEX = 2;
      var env = data.args[ENV_ARG_INDEX];
      var binData = null;

      if (data.ret === JNI_OK) {
        binData = data.getArgAsPtr(ENV_ARG_INDEX).readPointer();
      } else if (!data.getArgAsPtr(ENV_ARG_INDEX).isNull()) {
        binData = data.getArgAsPtr(ENV_ARG_INDEX).readPointer();
      }

      outputArgs.push(new DataJSONContainer(env, binData));
      outputArgs.push(new DataJSONContainer(data.args[VERSION_ARG_INDEX], null));
    }
  }, {
    key: "addJavaVMArgs",
    value: function addJavaVMArgs(data, outputArgs) {
      var name = data.method.name;

      if (name.startsWith("AttachCurrentThread")) {
        return this.addAttachCurrentThreadArgs(data, outputArgs);
      } else if (name === "GetEnv") {
        this.addGetEnvArgs(data, outputArgs);
      }

      return null;
    }
  }, {
    key: "createBacktrace",
    value: function createBacktrace(context, type) {
      var bt = context;

      if (!(bt instanceof Array)) {
        var backtraceType = null;

        if (type === "fuzzy") {
          backtraceType = Backtracer.FUZZY;
        } else {
          backtraceType = Backtracer.ACCURATE;
        }

        bt = Thread.backtrace(context, backtraceType);
      }

      return bt.map(function (addr) {
        return new BacktraceJSONContainer(addr, Process.findModuleByAddress(addr), DebugSymbol.fromAddress(addr));
      });
    }
  }, {
    key: "sendToHost",
    value: function sendToHost(type, data, args, ret, sendData, context) {
      var config = jnitrace_engine_1.Config.getInstance();
      var jParams = data.jParams;
      var backtrace = undefined;

      if (context !== undefined) {
        backtrace = this.createBacktrace(context, config.backtrace);
      }

      var output = new RecordJSONContainer(type, data.method, args, ret, Process.getCurrentThreadId(), (0, _now["default"])() - this.start, jParams, backtrace);
      send(output, sendData);
    }
  }]);
  return DataTransport;
}();

exports.DataTransport = DataTransport;

},{"../utils/types":4,"@babel/runtime-corejs2/core-js/date/now":5,"@babel/runtime-corejs2/core-js/map":6,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/classCallCheck":15,"@babel/runtime-corejs2/helpers/createClass":16,"@babel/runtime-corejs2/helpers/interopRequireDefault":19,"jnitrace-engine":128}],3:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var MethodData = /*#__PURE__*/function () {
  function MethodData(method, args, ret, jmethod) {
    (0, _classCallCheck2["default"])(this, MethodData);
    this._method = method;
    this._jmethod = jmethod;
    this._args = args;
    this._ret = ret;

    if (jmethod === undefined) {
      this._jparams = [];
    } else {
      this._jparams = jmethod.nativeParams;
    }
  }

  (0, _createClass2["default"])(MethodData, [{
    key: "getArgAsPtr",
    value: function getArgAsPtr(i) {
      return this._args[i];
    }
  }, {
    key: "getArgAsNum",
    value: function getArgAsNum(i) {
      return this._args[i];
    }
  }, {
    key: "method",
    get: function get() {
      return this._method;
    }
  }, {
    key: "javaMethod",
    get: function get() {
      return this._jmethod;
    }
  }, {
    key: "args",
    get: function get() {
      return this._args;
    }
  }, {
    key: "jParams",
    get: function get() {
      return this._jparams;
    }
  }, {
    key: "ret",
    get: function get() {
      return this._ret;
    }
  }]);
  return MethodData;
}();

exports.MethodData = MethodData;

},{"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/classCallCheck":15,"@babel/runtime-corejs2/helpers/createClass":16,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],4:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});
var ARRAY_TYPE_INDEX = 1;
var TYPE_SIZE_64_BIT = 8;
var TYPE_SIZE_CHAR = 1;
var Types = {
  isComplexObjectType: function isComplexObjectType(type) {
    var JOBJECT = ["jobject", "jclass", "jweak"];
    return JOBJECT.includes(type);
  },
  sizeOf: function sizeOf(type) {
    if (type === "double" || type === "float" || type === "int64") {
      return TYPE_SIZE_64_BIT;
    } else if (type === "char") {
      return TYPE_SIZE_CHAR;
    } else {
      return Process.pointerSize;
    }
  },
  convertNativeJTypeToFridaType: function convertNativeJTypeToFridaType(jtype) {
    if (jtype.endsWith("*")) {
      return "pointer";
    }

    if (jtype === "va_list") {
      return "pointer";
    }

    if (jtype === "jmethodID") {
      return "pointer";
    }

    if (jtype === "jfieldID") {
      return "pointer";
    }

    if (jtype === "va_list") {
      return "va_list";
    }

    if (jtype === "jweak") {
      jtype = "jobject";
    }

    if (jtype === "jthrowable") {
      jtype = "jobject";
    }

    if (jtype.includes("Array")) {
      jtype = "jarray";
    }

    if (jtype === "jarray") {
      jtype = "jobject";
    }

    if (jtype === "jstring") {
      jtype = "jobject";
    }

    if (jtype === "jclass") {
      jtype = "jobject";
    }

    if (jtype === "jobject") {
      return "pointer";
    }

    if (jtype === "jsize") {
      jtype = "jint";
    }

    if (jtype === "jdouble") {
      return "double";
    }

    if (jtype === "jfloat") {
      return "float";
    }

    if (jtype === "jchar") {
      return "uint16";
    }

    if (jtype === "jboolean") {
      return "char";
    }

    if (jtype === "jlong") {
      return "int64";
    }

    if (jtype === "jint") {
      return "int";
    }

    if (jtype === "jshort") {
      return "int16";
    }

    if (jtype === "jbyte") {
      return "char";
    }

    return jtype;
  },
  convertJTypeToNativeJType: function convertJTypeToNativeJType(jtype) {
    var result = "";
    var isArray = false;

    if (jtype.startsWith("[")) {
      isArray = true;
      jtype = jtype.substring(ARRAY_TYPE_INDEX);
    }

    if (jtype === "B") {
      result += "jbyte";
    } else if (jtype === "S") {
      result += "jshort";
    } else if (jtype === "I") {
      result += "jint";
    } else if (jtype === "J") {
      result += "jlong";
    } else if (jtype === "F") {
      result += "jfloat";
    } else if (jtype === "D") {
      result += "jdouble";
    } else if (jtype === "C") {
      result += "jchar";
    } else if (jtype === "Z") {
      result += "jboolean";
    } else if (jtype.startsWith("L")) {
      if (jtype === "Ljava/lang/String;") {
        result += "jstring";
      } else if (jtype === "Ljava/lang/Class;") {
        result += "jclass";
      } else {
        result += "jobject";
      }
    }

    if (isArray) {
      if (result === "jstring") {
        result = "jobject";
      }

      result += "Array";
    }

    return result;
  }
};
exports.Types = Types;

},{"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],5:[function(require,module,exports){
module.exports = require("core-js/library/fn/date/now");
},{"core-js/library/fn/date/now":22}],6:[function(require,module,exports){
module.exports = require("core-js/library/fn/map");
},{"core-js/library/fn/map":23}],7:[function(require,module,exports){
module.exports = require("core-js/library/fn/object/create");
},{"core-js/library/fn/object/create":24}],8:[function(require,module,exports){
module.exports = require("core-js/library/fn/object/define-property");
},{"core-js/library/fn/object/define-property":25}],9:[function(require,module,exports){
module.exports = require("core-js/library/fn/object/get-prototype-of");
},{"core-js/library/fn/object/get-prototype-of":26}],10:[function(require,module,exports){
module.exports = require("core-js/library/fn/object/set-prototype-of");
},{"core-js/library/fn/object/set-prototype-of":27}],11:[function(require,module,exports){
module.exports = require("core-js/library/fn/reflect/construct");
},{"core-js/library/fn/reflect/construct":28}],12:[function(require,module,exports){
module.exports = require("core-js/library/fn/symbol");
},{"core-js/library/fn/symbol":29}],13:[function(require,module,exports){
module.exports = require("core-js/library/fn/symbol/iterator");
},{"core-js/library/fn/symbol/iterator":30}],14:[function(require,module,exports){
function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}

module.exports = _assertThisInitialized;
},{}],15:[function(require,module,exports){
function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

module.exports = _classCallCheck;
},{}],16:[function(require,module,exports){
var _Object$defineProperty = require("../core-js/object/define-property");

function _defineProperties(target, props) {
  for (var i = 0; i < props.length; i++) {
    var descriptor = props[i];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor) descriptor.writable = true;

    _Object$defineProperty(target, descriptor.key, descriptor);
  }
}

function _createClass(Constructor, protoProps, staticProps) {
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  if (staticProps) _defineProperties(Constructor, staticProps);
  return Constructor;
}

module.exports = _createClass;
},{"../core-js/object/define-property":8}],17:[function(require,module,exports){
var _Object$getPrototypeOf = require("../core-js/object/get-prototype-of");

var _Object$setPrototypeOf = require("../core-js/object/set-prototype-of");

function _getPrototypeOf(o) {
  module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _Object$getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || _Object$getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}

module.exports = _getPrototypeOf;
},{"../core-js/object/get-prototype-of":9,"../core-js/object/set-prototype-of":10}],18:[function(require,module,exports){
var _Object$create = require("../core-js/object/create");

function _inheritsLoose(subClass, superClass) {
  subClass.prototype = _Object$create(superClass.prototype);
  subClass.prototype.constructor = subClass;
  subClass.__proto__ = superClass;
}

module.exports = _inheritsLoose;
},{"../core-js/object/create":7}],19:[function(require,module,exports){
function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : {
    "default": obj
  };
}

module.exports = _interopRequireDefault;
},{}],20:[function(require,module,exports){
var _typeof = require("../helpers/typeof");

var assertThisInitialized = require("./assertThisInitialized");

function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  }

  return assertThisInitialized(self);
}

module.exports = _possibleConstructorReturn;
},{"../helpers/typeof":21,"./assertThisInitialized":14}],21:[function(require,module,exports){
var _Symbol$iterator = require("../core-js/symbol/iterator");

var _Symbol = require("../core-js/symbol");

function _typeof(obj) {
  "@babel/helpers - typeof";

  if (typeof _Symbol === "function" && typeof _Symbol$iterator === "symbol") {
    module.exports = _typeof = function _typeof(obj) {
      return typeof obj;
    };
  } else {
    module.exports = _typeof = function _typeof(obj) {
      return obj && typeof _Symbol === "function" && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj;
    };
  }

  return _typeof(obj);
}

module.exports = _typeof;
},{"../core-js/symbol":12,"../core-js/symbol/iterator":13}],22:[function(require,module,exports){
require('../../modules/es6.date.now');
module.exports = require('../../modules/_core').Date.now;

},{"../../modules/_core":46,"../../modules/es6.date.now":109}],23:[function(require,module,exports){
require('../modules/es6.object.to-string');
require('../modules/es6.string.iterator');
require('../modules/web.dom.iterable');
require('../modules/es6.map');
require('../modules/es7.map.to-json');
require('../modules/es7.map.of');
require('../modules/es7.map.from');
module.exports = require('../modules/_core').Map;

},{"../modules/_core":46,"../modules/es6.map":110,"../modules/es6.object.to-string":115,"../modules/es6.string.iterator":117,"../modules/es7.map.from":119,"../modules/es7.map.of":120,"../modules/es7.map.to-json":121,"../modules/web.dom.iterable":124}],24:[function(require,module,exports){
require('../../modules/es6.object.create');
var $Object = require('../../modules/_core').Object;
module.exports = function create(P, D) {
  return $Object.create(P, D);
};

},{"../../modules/_core":46,"../../modules/es6.object.create":111}],25:[function(require,module,exports){
require('../../modules/es6.object.define-property');
var $Object = require('../../modules/_core').Object;
module.exports = function defineProperty(it, key, desc) {
  return $Object.defineProperty(it, key, desc);
};

},{"../../modules/_core":46,"../../modules/es6.object.define-property":112}],26:[function(require,module,exports){
require('../../modules/es6.object.get-prototype-of');
module.exports = require('../../modules/_core').Object.getPrototypeOf;

},{"../../modules/_core":46,"../../modules/es6.object.get-prototype-of":113}],27:[function(require,module,exports){
require('../../modules/es6.object.set-prototype-of');
module.exports = require('../../modules/_core').Object.setPrototypeOf;

},{"../../modules/_core":46,"../../modules/es6.object.set-prototype-of":114}],28:[function(require,module,exports){
require('../../modules/es6.reflect.construct');
module.exports = require('../../modules/_core').Reflect.construct;

},{"../../modules/_core":46,"../../modules/es6.reflect.construct":116}],29:[function(require,module,exports){
require('../../modules/es6.symbol');
require('../../modules/es6.object.to-string');
require('../../modules/es7.symbol.async-iterator');
require('../../modules/es7.symbol.observable');
module.exports = require('../../modules/_core').Symbol;

},{"../../modules/_core":46,"../../modules/es6.object.to-string":115,"../../modules/es6.symbol":118,"../../modules/es7.symbol.async-iterator":122,"../../modules/es7.symbol.observable":123}],30:[function(require,module,exports){
require('../../modules/es6.string.iterator');
require('../../modules/web.dom.iterable');
module.exports = require('../../modules/_wks-ext').f('iterator');

},{"../../modules/_wks-ext":105,"../../modules/es6.string.iterator":117,"../../modules/web.dom.iterable":124}],31:[function(require,module,exports){
module.exports = function (it) {
  if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  return it;
};

},{}],32:[function(require,module,exports){
module.exports = function () { /* empty */ };

},{}],33:[function(require,module,exports){
module.exports = function (it, Constructor, name, forbiddenField) {
  if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
    throw TypeError(name + ': incorrect invocation!');
  } return it;
};

},{}],34:[function(require,module,exports){
var isObject = require('./_is-object');
module.exports = function (it) {
  if (!isObject(it)) throw TypeError(it + ' is not an object!');
  return it;
};

},{"./_is-object":65}],35:[function(require,module,exports){
var forOf = require('./_for-of');

module.exports = function (iter, ITERATOR) {
  var result = [];
  forOf(iter, false, result.push, result, ITERATOR);
  return result;
};

},{"./_for-of":55}],36:[function(require,module,exports){
// false -> Array#indexOf
// true  -> Array#includes
var toIObject = require('./_to-iobject');
var toLength = require('./_to-length');
var toAbsoluteIndex = require('./_to-absolute-index');
module.exports = function (IS_INCLUDES) {
  return function ($this, el, fromIndex) {
    var O = toIObject($this);
    var length = toLength(O.length);
    var index = toAbsoluteIndex(fromIndex, length);
    var value;
    // Array#includes uses SameValueZero equality algorithm
    // eslint-disable-next-line no-self-compare
    if (IS_INCLUDES && el != el) while (length > index) {
      value = O[index++];
      // eslint-disable-next-line no-self-compare
      if (value != value) return true;
    // Array#indexOf ignores holes, Array#includes - not
    } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
      if (O[index] === el) return IS_INCLUDES || index || 0;
    } return !IS_INCLUDES && -1;
  };
};

},{"./_to-absolute-index":96,"./_to-iobject":98,"./_to-length":99}],37:[function(require,module,exports){
// 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
// 4 -> Array#every
// 5 -> Array#find
// 6 -> Array#findIndex
var ctx = require('./_ctx');
var IObject = require('./_iobject');
var toObject = require('./_to-object');
var toLength = require('./_to-length');
var asc = require('./_array-species-create');
module.exports = function (TYPE, $create) {
  var IS_MAP = TYPE == 1;
  var IS_FILTER = TYPE == 2;
  var IS_SOME = TYPE == 3;
  var IS_EVERY = TYPE == 4;
  var IS_FIND_INDEX = TYPE == 6;
  var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  var create = $create || asc;
  return function ($this, callbackfn, that) {
    var O = toObject($this);
    var self = IObject(O);
    var f = ctx(callbackfn, that, 3);
    var length = toLength(self.length);
    var index = 0;
    var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
    var val, res;
    for (;length > index; index++) if (NO_HOLES || index in self) {
      val = self[index];
      res = f(val, index, O);
      if (TYPE) {
        if (IS_MAP) result[index] = res;   // map
        else if (res) switch (TYPE) {
          case 3: return true;             // some
          case 5: return val;              // find
          case 6: return index;            // findIndex
          case 2: result.push(val);        // filter
        } else if (IS_EVERY) return false; // every
      }
    }
    return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  };
};

},{"./_array-species-create":39,"./_ctx":47,"./_iobject":62,"./_to-length":99,"./_to-object":100}],38:[function(require,module,exports){
var isObject = require('./_is-object');
var isArray = require('./_is-array');
var SPECIES = require('./_wks')('species');

module.exports = function (original) {
  var C;
  if (isArray(original)) {
    C = original.constructor;
    // cross-realm fallback
    if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
    if (isObject(C)) {
      C = C[SPECIES];
      if (C === null) C = undefined;
    }
  } return C === undefined ? Array : C;
};

},{"./_is-array":64,"./_is-object":65,"./_wks":106}],39:[function(require,module,exports){
// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
var speciesConstructor = require('./_array-species-constructor');

module.exports = function (original, length) {
  return new (speciesConstructor(original))(length);
};

},{"./_array-species-constructor":38}],40:[function(require,module,exports){
'use strict';
var aFunction = require('./_a-function');
var isObject = require('./_is-object');
var invoke = require('./_invoke');
var arraySlice = [].slice;
var factories = {};

var construct = function (F, len, args) {
  if (!(len in factories)) {
    for (var n = [], i = 0; i < len; i++) n[i] = 'a[' + i + ']';
    // eslint-disable-next-line no-new-func
    factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
  } return factories[len](F, args);
};

module.exports = Function.bind || function bind(that /* , ...args */) {
  var fn = aFunction(this);
  var partArgs = arraySlice.call(arguments, 1);
  var bound = function (/* args... */) {
    var args = partArgs.concat(arraySlice.call(arguments));
    return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
  };
  if (isObject(fn.prototype)) bound.prototype = fn.prototype;
  return bound;
};

},{"./_a-function":31,"./_invoke":61,"./_is-object":65}],41:[function(require,module,exports){
// getting tag from 19.1.3.6 Object.prototype.toString()
var cof = require('./_cof');
var TAG = require('./_wks')('toStringTag');
// ES3 wrong here
var ARG = cof(function () { return arguments; }()) == 'Arguments';

// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
  try {
    return it[key];
  } catch (e) { /* empty */ }
};

module.exports = function (it) {
  var O, T, B;
  return it === undefined ? 'Undefined' : it === null ? 'Null'
    // @@toStringTag case
    : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
    // builtinTag case
    : ARG ? cof(O)
    // ES3 arguments fallback
    : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
};

},{"./_cof":42,"./_wks":106}],42:[function(require,module,exports){
var toString = {}.toString;

module.exports = function (it) {
  return toString.call(it).slice(8, -1);
};

},{}],43:[function(require,module,exports){
'use strict';
var dP = require('./_object-dp').f;
var create = require('./_object-create');
var redefineAll = require('./_redefine-all');
var ctx = require('./_ctx');
var anInstance = require('./_an-instance');
var forOf = require('./_for-of');
var $iterDefine = require('./_iter-define');
var step = require('./_iter-step');
var setSpecies = require('./_set-species');
var DESCRIPTORS = require('./_descriptors');
var fastKey = require('./_meta').fastKey;
var validate = require('./_validate-collection');
var SIZE = DESCRIPTORS ? '_s' : 'size';

var getEntry = function (that, key) {
  // fast case
  var index = fastKey(key);
  var entry;
  if (index !== 'F') return that._i[index];
  // frozen object case
  for (entry = that._f; entry; entry = entry.n) {
    if (entry.k == key) return entry;
  }
};

module.exports = {
  getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
    var C = wrapper(function (that, iterable) {
      anInstance(that, C, NAME, '_i');
      that._t = NAME;         // collection type
      that._i = create(null); // index
      that._f = undefined;    // first entry
      that._l = undefined;    // last entry
      that[SIZE] = 0;         // size
      if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
    });
    redefineAll(C.prototype, {
      // 23.1.3.1 Map.prototype.clear()
      // 23.2.3.2 Set.prototype.clear()
      clear: function clear() {
        for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
          entry.r = true;
          if (entry.p) entry.p = entry.p.n = undefined;
          delete data[entry.i];
        }
        that._f = that._l = undefined;
        that[SIZE] = 0;
      },
      // 23.1.3.3 Map.prototype.delete(key)
      // 23.2.3.4 Set.prototype.delete(value)
      'delete': function (key) {
        var that = validate(this, NAME);
        var entry = getEntry(that, key);
        if (entry) {
          var next = entry.n;
          var prev = entry.p;
          delete that._i[entry.i];
          entry.r = true;
          if (prev) prev.n = next;
          if (next) next.p = prev;
          if (that._f == entry) that._f = next;
          if (that._l == entry) that._l = prev;
          that[SIZE]--;
        } return !!entry;
      },
      // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
      // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
      forEach: function forEach(callbackfn /* , that = undefined */) {
        validate(this, NAME);
        var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
        var entry;
        while (entry = entry ? entry.n : this._f) {
          f(entry.v, entry.k, this);
          // revert to the last existing entry
          while (entry && entry.r) entry = entry.p;
        }
      },
      // 23.1.3.7 Map.prototype.has(key)
      // 23.2.3.7 Set.prototype.has(value)
      has: function has(key) {
        return !!getEntry(validate(this, NAME), key);
      }
    });
    if (DESCRIPTORS) dP(C.prototype, 'size', {
      get: function () {
        return validate(this, NAME)[SIZE];
      }
    });
    return C;
  },
  def: function (that, key, value) {
    var entry = getEntry(that, key);
    var prev, index;
    // change existing entry
    if (entry) {
      entry.v = value;
    // create new entry
    } else {
      that._l = entry = {
        i: index = fastKey(key, true), // <- index
        k: key,                        // <- key
        v: value,                      // <- value
        p: prev = that._l,             // <- previous entry
        n: undefined,                  // <- next entry
        r: false                       // <- removed
      };
      if (!that._f) that._f = entry;
      if (prev) prev.n = entry;
      that[SIZE]++;
      // add to index
      if (index !== 'F') that._i[index] = entry;
    } return that;
  },
  getEntry: getEntry,
  setStrong: function (C, NAME, IS_MAP) {
    // add .keys, .values, .entries, [@@iterator]
    // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
    $iterDefine(C, NAME, function (iterated, kind) {
      this._t = validate(iterated, NAME); // target
      this._k = kind;                     // kind
      this._l = undefined;                // previous
    }, function () {
      var that = this;
      var kind = that._k;
      var entry = that._l;
      // revert to the last existing entry
      while (entry && entry.r) entry = entry.p;
      // get next entry
      if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
        // or finish the iteration
        that._t = undefined;
        return step(1);
      }
      // return step by kind
      if (kind == 'keys') return step(0, entry.k);
      if (kind == 'values') return step(0, entry.v);
      return step(0, [entry.k, entry.v]);
    }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);

    // add [@@species], 23.1.2.2, 23.2.2.2
    setSpecies(NAME);
  }
};

},{"./_an-instance":33,"./_ctx":47,"./_descriptors":49,"./_for-of":55,"./_iter-define":68,"./_iter-step":69,"./_meta":72,"./_object-create":73,"./_object-dp":74,"./_redefine-all":86,"./_set-species":91,"./_validate-collection":103}],44:[function(require,module,exports){
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var classof = require('./_classof');
var from = require('./_array-from-iterable');
module.exports = function (NAME) {
  return function toJSON() {
    if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
    return from(this);
  };
};

},{"./_array-from-iterable":35,"./_classof":41}],45:[function(require,module,exports){
'use strict';
var global = require('./_global');
var $export = require('./_export');
var meta = require('./_meta');
var fails = require('./_fails');
var hide = require('./_hide');
var redefineAll = require('./_redefine-all');
var forOf = require('./_for-of');
var anInstance = require('./_an-instance');
var isObject = require('./_is-object');
var setToStringTag = require('./_set-to-string-tag');
var dP = require('./_object-dp').f;
var each = require('./_array-methods')(0);
var DESCRIPTORS = require('./_descriptors');

module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
  var Base = global[NAME];
  var C = Base;
  var ADDER = IS_MAP ? 'set' : 'add';
  var proto = C && C.prototype;
  var O = {};
  if (!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
    new C().entries().next();
  }))) {
    // create collection constructor
    C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
    redefineAll(C.prototype, methods);
    meta.NEED = true;
  } else {
    C = wrapper(function (target, iterable) {
      anInstance(target, C, NAME, '_c');
      target._c = new Base();
      if (iterable != undefined) forOf(iterable, IS_MAP, target[ADDER], target);
    });
    each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
      var IS_ADDER = KEY == 'add' || KEY == 'set';
      if (KEY in proto && !(IS_WEAK && KEY == 'clear')) hide(C.prototype, KEY, function (a, b) {
        anInstance(this, C, KEY);
        if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
        var result = this._c[KEY](a === 0 ? 0 : a, b);
        return IS_ADDER ? this : result;
      });
    });
    IS_WEAK || dP(C.prototype, 'size', {
      get: function () {
        return this._c.size;
      }
    });
  }

  setToStringTag(C, NAME);

  O[NAME] = C;
  $export($export.G + $export.W + $export.F, O);

  if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);

  return C;
};

},{"./_an-instance":33,"./_array-methods":37,"./_descriptors":49,"./_export":53,"./_fails":54,"./_for-of":55,"./_global":56,"./_hide":58,"./_is-object":65,"./_meta":72,"./_object-dp":74,"./_redefine-all":86,"./_set-to-string-tag":92}],46:[function(require,module,exports){
var core = module.exports = { version: '2.6.11' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef

},{}],47:[function(require,module,exports){
// optional / simple context binding
var aFunction = require('./_a-function');
module.exports = function (fn, that, length) {
  aFunction(fn);
  if (that === undefined) return fn;
  switch (length) {
    case 1: return function (a) {
      return fn.call(that, a);
    };
    case 2: return function (a, b) {
      return fn.call(that, a, b);
    };
    case 3: return function (a, b, c) {
      return fn.call(that, a, b, c);
    };
  }
  return function (/* ...args */) {
    return fn.apply(that, arguments);
  };
};

},{"./_a-function":31}],48:[function(require,module,exports){
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function (it) {
  if (it == undefined) throw TypeError("Can't call method on  " + it);
  return it;
};

},{}],49:[function(require,module,exports){
// Thank's IE8 for his funny defineProperty
module.exports = !require('./_fails')(function () {
  return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});

},{"./_fails":54}],50:[function(require,module,exports){
var isObject = require('./_is-object');
var document = require('./_global').document;
// typeof document.createElement is 'object' in old IE
var is = isObject(document) && isObject(document.createElement);
module.exports = function (it) {
  return is ? document.createElement(it) : {};
};

},{"./_global":56,"./_is-object":65}],51:[function(require,module,exports){
// IE 8- don't enum bug keys
module.exports = (
  'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');

},{}],52:[function(require,module,exports){
// all enumerable object keys, includes symbols
var getKeys = require('./_object-keys');
var gOPS = require('./_object-gops');
var pIE = require('./_object-pie');
module.exports = function (it) {
  var result = getKeys(it);
  var getSymbols = gOPS.f;
  if (getSymbols) {
    var symbols = getSymbols(it);
    var isEnum = pIE.f;
    var i = 0;
    var key;
    while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
  } return result;
};

},{"./_object-gops":79,"./_object-keys":82,"./_object-pie":83}],53:[function(require,module,exports){
var global = require('./_global');
var core = require('./_core');
var ctx = require('./_ctx');
var hide = require('./_hide');
var has = require('./_has');
var PROTOTYPE = 'prototype';

var $export = function (type, name, source) {
  var IS_FORCED = type & $export.F;
  var IS_GLOBAL = type & $export.G;
  var IS_STATIC = type & $export.S;
  var IS_PROTO = type & $export.P;
  var IS_BIND = type & $export.B;
  var IS_WRAP = type & $export.W;
  var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
  var expProto = exports[PROTOTYPE];
  var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
  var key, own, out;
  if (IS_GLOBAL) source = name;
  for (key in source) {
    // contains in native
    own = !IS_FORCED && target && target[key] !== undefined;
    if (own && has(exports, key)) continue;
    // export native or passed
    out = own ? target[key] : source[key];
    // prevent global pollution for namespaces
    exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
    // bind timers to global for call from export context
    : IS_BIND && own ? ctx(out, global)
    // wrap global constructors for prevent change them in library
    : IS_WRAP && target[key] == out ? (function (C) {
      var F = function (a, b, c) {
        if (this instanceof C) {
          switch (arguments.length) {
            case 0: return new C();
            case 1: return new C(a);
            case 2: return new C(a, b);
          } return new C(a, b, c);
        } return C.apply(this, arguments);
      };
      F[PROTOTYPE] = C[PROTOTYPE];
      return F;
    // make static versions for prototype methods
    })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
    // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
    if (IS_PROTO) {
      (exports.virtual || (exports.virtual = {}))[key] = out;
      // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
      if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
    }
  }
};
// type bitmap
$export.F = 1;   // forced
$export.G = 2;   // global
$export.S = 4;   // static
$export.P = 8;   // proto
$export.B = 16;  // bind
$export.W = 32;  // wrap
$export.U = 64;  // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;

},{"./_core":46,"./_ctx":47,"./_global":56,"./_has":57,"./_hide":58}],54:[function(require,module,exports){
module.exports = function (exec) {
  try {
    return !!exec();
  } catch (e) {
    return true;
  }
};

},{}],55:[function(require,module,exports){
var ctx = require('./_ctx');
var call = require('./_iter-call');
var isArrayIter = require('./_is-array-iter');
var anObject = require('./_an-object');
var toLength = require('./_to-length');
var getIterFn = require('./core.get-iterator-method');
var BREAK = {};
var RETURN = {};
var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
  var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
  var f = ctx(fn, that, entries ? 2 : 1);
  var index = 0;
  var length, step, iterator, result;
  if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
  // fast case for arrays with default iterator
  if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
    result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
    if (result === BREAK || result === RETURN) return result;
  } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
    result = call(iterator, f, step.value, entries);
    if (result === BREAK || result === RETURN) return result;
  }
};
exports.BREAK = BREAK;
exports.RETURN = RETURN;

},{"./_an-object":34,"./_ctx":47,"./_is-array-iter":63,"./_iter-call":66,"./_to-length":99,"./core.get-iterator-method":107}],56:[function(require,module,exports){
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
  ? window : typeof self != 'undefined' && self.Math == Math ? self
  // eslint-disable-next-line no-new-func
  : Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef

},{}],57:[function(require,module,exports){
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
  return hasOwnProperty.call(it, key);
};

},{}],58:[function(require,module,exports){
var dP = require('./_object-dp');
var createDesc = require('./_property-desc');
module.exports = require('./_descriptors') ? function (object, key, value) {
  return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
  object[key] = value;
  return object;
};

},{"./_descriptors":49,"./_object-dp":74,"./_property-desc":85}],59:[function(require,module,exports){
var document = require('./_global').document;
module.exports = document && document.documentElement;

},{"./_global":56}],60:[function(require,module,exports){
module.exports = !require('./_descriptors') && !require('./_fails')(function () {
  return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;
});

},{"./_descriptors":49,"./_dom-create":50,"./_fails":54}],61:[function(require,module,exports){
// fast apply, http://jsperf.lnkit.com/fast-apply/5
module.exports = function (fn, args, that) {
  var un = that === undefined;
  switch (args.length) {
    case 0: return un ? fn()
                      : fn.call(that);
    case 1: return un ? fn(args[0])
                      : fn.call(that, args[0]);
    case 2: return un ? fn(args[0], args[1])
                      : fn.call(that, args[0], args[1]);
    case 3: return un ? fn(args[0], args[1], args[2])
                      : fn.call(that, args[0], args[1], args[2]);
    case 4: return un ? fn(args[0], args[1], args[2], args[3])
                      : fn.call(that, args[0], args[1], args[2], args[3]);
  } return fn.apply(that, args);
};

},{}],62:[function(require,module,exports){
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = require('./_cof');
// eslint-disable-next-line no-prototype-builtins
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  return cof(it) == 'String' ? it.split('') : Object(it);
};

},{"./_cof":42}],63:[function(require,module,exports){
// check on default Array iterator
var Iterators = require('./_iterators');
var ITERATOR = require('./_wks')('iterator');
var ArrayProto = Array.prototype;

module.exports = function (it) {
  return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
};

},{"./_iterators":70,"./_wks":106}],64:[function(require,module,exports){
// 7.2.2 IsArray(argument)
var cof = require('./_cof');
module.exports = Array.isArray || function isArray(arg) {
  return cof(arg) == 'Array';
};

},{"./_cof":42}],65:[function(require,module,exports){
module.exports = function (it) {
  return typeof it === 'object' ? it !== null : typeof it === 'function';
};

},{}],66:[function(require,module,exports){
// call something on iterator step with safe closing on error
var anObject = require('./_an-object');
module.exports = function (iterator, fn, value, entries) {
  try {
    return entries ? fn(anObject(value)[0], value[1]) : fn(value);
  // 7.4.6 IteratorClose(iterator, completion)
  } catch (e) {
    var ret = iterator['return'];
    if (ret !== undefined) anObject(ret.call(iterator));
    throw e;
  }
};

},{"./_an-object":34}],67:[function(require,module,exports){
'use strict';
var create = require('./_object-create');
var descriptor = require('./_property-desc');
var setToStringTag = require('./_set-to-string-tag');
var IteratorPrototype = {};

// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });

module.exports = function (Constructor, NAME, next) {
  Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
  setToStringTag(Constructor, NAME + ' Iterator');
};

},{"./_hide":58,"./_object-create":73,"./_property-desc":85,"./_set-to-string-tag":92,"./_wks":106}],68:[function(require,module,exports){
'use strict';
var LIBRARY = require('./_library');
var $export = require('./_export');
var redefine = require('./_redefine');
var hide = require('./_hide');
var Iterators = require('./_iterators');
var $iterCreate = require('./_iter-create');
var setToStringTag = require('./_set-to-string-tag');
var getPrototypeOf = require('./_object-gpo');
var ITERATOR = require('./_wks')('iterator');
var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
var FF_ITERATOR = '@@iterator';
var KEYS = 'keys';
var VALUES = 'values';

var returnThis = function () { return this; };

module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
  $iterCreate(Constructor, NAME, next);
  var getMethod = function (kind) {
    if (!BUGGY && kind in proto) return proto[kind];
    switch (kind) {
      case KEYS: return function keys() { return new Constructor(this, kind); };
      case VALUES: return function values() { return new Constructor(this, kind); };
    } return function entries() { return new Constructor(this, kind); };
  };
  var TAG = NAME + ' Iterator';
  var DEF_VALUES = DEFAULT == VALUES;
  var VALUES_BUG = false;
  var proto = Base.prototype;
  var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
  var $default = $native || getMethod(DEFAULT);
  var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
  var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
  var methods, key, IteratorPrototype;
  // Fix native
  if ($anyNative) {
    IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
    if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
      // Set @@toStringTag to native iterators
      setToStringTag(IteratorPrototype, TAG, true);
      // fix for some old engines
      if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
    }
  }
  // fix Array#{values, @@iterator}.name in V8 / FF
  if (DEF_VALUES && $native && $native.name !== VALUES) {
    VALUES_BUG = true;
    $default = function values() { return $native.call(this); };
  }
  // Define iterator
  if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
    hide(proto, ITERATOR, $default);
  }
  // Plug for library
  Iterators[NAME] = $default;
  Iterators[TAG] = returnThis;
  if (DEFAULT) {
    methods = {
      values: DEF_VALUES ? $default : getMethod(VALUES),
      keys: IS_SET ? $default : getMethod(KEYS),
      entries: $entries
    };
    if (FORCED) for (key in methods) {
      if (!(key in proto)) redefine(proto, key, methods[key]);
    } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
  }
  return methods;
};

},{"./_export":53,"./_hide":58,"./_iter-create":67,"./_iterators":70,"./_library":71,"./_object-gpo":80,"./_redefine":87,"./_set-to-string-tag":92,"./_wks":106}],69:[function(require,module,exports){
module.exports = function (done, value) {
  return { value: value, done: !!done };
};

},{}],70:[function(require,module,exports){
module.exports = {};

},{}],71:[function(require,module,exports){
module.exports = true;

},{}],72:[function(require,module,exports){
var META = require('./_uid')('meta');
var isObject = require('./_is-object');
var has = require('./_has');
var setDesc = require('./_object-dp').f;
var id = 0;
var isExtensible = Object.isExtensible || function () {
  return true;
};
var FREEZE = !require('./_fails')(function () {
  return isExtensible(Object.preventExtensions({}));
});
var setMeta = function (it) {
  setDesc(it, META, { value: {
    i: 'O' + ++id, // object ID
    w: {}          // weak collections IDs
  } });
};
var fastKey = function (it, create) {
  // return primitive with prefix
  if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  if (!has(it, META)) {
    // can't set metadata to uncaught frozen object
    if (!isExtensible(it)) return 'F';
    // not necessary to add metadata
    if (!create) return 'E';
    // add missing metadata
    setMeta(it);
  // return object ID
  } return it[META].i;
};
var getWeak = function (it, create) {
  if (!has(it, META)) {
    // can't set metadata to uncaught frozen object
    if (!isExtensible(it)) return true;
    // not necessary to add metadata
    if (!create) return false;
    // add missing metadata
    setMeta(it);
  // return hash weak collections IDs
  } return it[META].w;
};
// add metadata on freeze-family methods calling
var onFreeze = function (it) {
  if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
  return it;
};
var meta = module.exports = {
  KEY: META,
  NEED: false,
  fastKey: fastKey,
  getWeak: getWeak,
  onFreeze: onFreeze
};

},{"./_fails":54,"./_has":57,"./_is-object":65,"./_object-dp":74,"./_uid":102}],73:[function(require,module,exports){
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = require('./_an-object');
var dPs = require('./_object-dps');
var enumBugKeys = require('./_enum-bug-keys');
var IE_PROTO = require('./_shared-key')('IE_PROTO');
var Empty = function () { /* empty */ };
var PROTOTYPE = 'prototype';

// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function () {
  // Thrash, waste and sodomy: IE GC bug
  var iframe = require('./_dom-create')('iframe');
  var i = enumBugKeys.length;
  var lt = '<';
  var gt = '>';
  var iframeDocument;
  iframe.style.display = 'none';
  require('./_html').appendChild(iframe);
  iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  // createDict = iframe.contentWindow.Object;
  // html.removeChild(iframe);
  iframeDocument = iframe.contentWindow.document;
  iframeDocument.open();
  iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  iframeDocument.close();
  createDict = iframeDocument.F;
  while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
  return createDict();
};

module.exports = Object.create || function create(O, Properties) {
  var result;
  if (O !== null) {
    Empty[PROTOTYPE] = anObject(O);
    result = new Empty();
    Empty[PROTOTYPE] = null;
    // add "__proto__" for Object.getPrototypeOf polyfill
    result[IE_PROTO] = O;
  } else result = createDict();
  return Properties === undefined ? result : dPs(result, Properties);
};

},{"./_an-object":34,"./_dom-create":50,"./_enum-bug-keys":51,"./_html":59,"./_object-dps":75,"./_shared-key":93}],74:[function(require,module,exports){
var anObject = require('./_an-object');
var IE8_DOM_DEFINE = require('./_ie8-dom-define');
var toPrimitive = require('./_to-primitive');
var dP = Object.defineProperty;

exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  anObject(O);
  P = toPrimitive(P, true);
  anObject(Attributes);
  if (IE8_DOM_DEFINE) try {
    return dP(O, P, Attributes);
  } catch (e) { /* empty */ }
  if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  if ('value' in Attributes) O[P] = Attributes.value;
  return O;
};

},{"./_an-object":34,"./_descriptors":49,"./_ie8-dom-define":60,"./_to-primitive":101}],75:[function(require,module,exports){
var dP = require('./_object-dp');
var anObject = require('./_an-object');
var getKeys = require('./_object-keys');

module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {
  anObject(O);
  var keys = getKeys(Properties);
  var length = keys.length;
  var i = 0;
  var P;
  while (length > i) dP.f(O, P = keys[i++], Properties[P]);
  return O;
};

},{"./_an-object":34,"./_descriptors":49,"./_object-dp":74,"./_object-keys":82}],76:[function(require,module,exports){
var pIE = require('./_object-pie');
var createDesc = require('./_property-desc');
var toIObject = require('./_to-iobject');
var toPrimitive = require('./_to-primitive');
var has = require('./_has');
var IE8_DOM_DEFINE = require('./_ie8-dom-define');
var gOPD = Object.getOwnPropertyDescriptor;

exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {
  O = toIObject(O);
  P = toPrimitive(P, true);
  if (IE8_DOM_DEFINE) try {
    return gOPD(O, P);
  } catch (e) { /* empty */ }
  if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
};

},{"./_descriptors":49,"./_has":57,"./_ie8-dom-define":60,"./_object-pie":83,"./_property-desc":85,"./_to-iobject":98,"./_to-primitive":101}],77:[function(require,module,exports){
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toIObject = require('./_to-iobject');
var gOPN = require('./_object-gopn').f;
var toString = {}.toString;

var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  ? Object.getOwnPropertyNames(window) : [];

var getWindowNames = function (it) {
  try {
    return gOPN(it);
  } catch (e) {
    return windowNames.slice();
  }
};

module.exports.f = function getOwnPropertyNames(it) {
  return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
};

},{"./_object-gopn":78,"./_to-iobject":98}],78:[function(require,module,exports){
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys = require('./_object-keys-internal');
var hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');

exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  return $keys(O, hiddenKeys);
};

},{"./_enum-bug-keys":51,"./_object-keys-internal":81}],79:[function(require,module,exports){
exports.f = Object.getOwnPropertySymbols;

},{}],80:[function(require,module,exports){
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has = require('./_has');
var toObject = require('./_to-object');
var IE_PROTO = require('./_shared-key')('IE_PROTO');
var ObjectProto = Object.prototype;

module.exports = Object.getPrototypeOf || function (O) {
  O = toObject(O);
  if (has(O, IE_PROTO)) return O[IE_PROTO];
  if (typeof O.constructor == 'function' && O instanceof O.constructor) {
    return O.constructor.prototype;
  } return O instanceof Object ? ObjectProto : null;
};

},{"./_has":57,"./_shared-key":93,"./_to-object":100}],81:[function(require,module,exports){
var has = require('./_has');
var toIObject = require('./_to-iobject');
var arrayIndexOf = require('./_array-includes')(false);
var IE_PROTO = require('./_shared-key')('IE_PROTO');

module.exports = function (object, names) {
  var O = toIObject(object);
  var i = 0;
  var result = [];
  var key;
  for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
  // Don't enum bug & hidden keys
  while (names.length > i) if (has(O, key = names[i++])) {
    ~arrayIndexOf(result, key) || result.push(key);
  }
  return result;
};

},{"./_array-includes":36,"./_has":57,"./_shared-key":93,"./_to-iobject":98}],82:[function(require,module,exports){
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = require('./_object-keys-internal');
var enumBugKeys = require('./_enum-bug-keys');

module.exports = Object.keys || function keys(O) {
  return $keys(O, enumBugKeys);
};

},{"./_enum-bug-keys":51,"./_object-keys-internal":81}],83:[function(require,module,exports){
exports.f = {}.propertyIsEnumerable;

},{}],84:[function(require,module,exports){
// most Object methods by ES6 should accept primitives
var $export = require('./_export');
var core = require('./_core');
var fails = require('./_fails');
module.exports = function (KEY, exec) {
  var fn = (core.Object || {})[KEY] || Object[KEY];
  var exp = {};
  exp[KEY] = exec(fn);
  $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
};

},{"./_core":46,"./_export":53,"./_fails":54}],85:[function(require,module,exports){
module.exports = function (bitmap, value) {
  return {
    enumerable: !(bitmap & 1),
    configurable: !(bitmap & 2),
    writable: !(bitmap & 4),
    value: value
  };
};

},{}],86:[function(require,module,exports){
var hide = require('./_hide');
module.exports = function (target, src, safe) {
  for (var key in src) {
    if (safe && target[key]) target[key] = src[key];
    else hide(target, key, src[key]);
  } return target;
};

},{"./_hide":58}],87:[function(require,module,exports){
module.exports = require('./_hide');

},{"./_hide":58}],88:[function(require,module,exports){
'use strict';
// https://tc39.github.io/proposal-setmap-offrom/
var $export = require('./_export');
var aFunction = require('./_a-function');
var ctx = require('./_ctx');
var forOf = require('./_for-of');

module.exports = function (COLLECTION) {
  $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
    var mapFn = arguments[1];
    var mapping, A, n, cb;
    aFunction(this);
    mapping = mapFn !== undefined;
    if (mapping) aFunction(mapFn);
    if (source == undefined) return new this();
    A = [];
    if (mapping) {
      n = 0;
      cb = ctx(mapFn, arguments[2], 2);
      forOf(source, false, function (nextItem) {
        A.push(cb(nextItem, n++));
      });
    } else {
      forOf(source, false, A.push, A);
    }
    return new this(A);
  } });
};

},{"./_a-function":31,"./_ctx":47,"./_export":53,"./_for-of":55}],89:[function(require,module,exports){
'use strict';
// https://tc39.github.io/proposal-setmap-offrom/
var $export = require('./_export');

module.exports = function (COLLECTION) {
  $export($export.S, COLLECTION, { of: function of() {
    var length = arguments.length;
    var A = new Array(length);
    while (length--) A[length] = arguments[length];
    return new this(A);
  } });
};

},{"./_export":53}],90:[function(require,module,exports){
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var isObject = require('./_is-object');
var anObject = require('./_an-object');
var check = function (O, proto) {
  anObject(O);
  if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
};
module.exports = {
  set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
    function (test, buggy, set) {
      try {
        set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2);
        set(test, []);
        buggy = !(test instanceof Array);
      } catch (e) { buggy = true; }
      return function setPrototypeOf(O, proto) {
        check(O, proto);
        if (buggy) O.__proto__ = proto;
        else set(O, proto);
        return O;
      };
    }({}, false) : undefined),
  check: check
};

},{"./_an-object":34,"./_ctx":47,"./_is-object":65,"./_object-gopd":76}],91:[function(require,module,exports){
'use strict';
var global = require('./_global');
var core = require('./_core');
var dP = require('./_object-dp');
var DESCRIPTORS = require('./_descriptors');
var SPECIES = require('./_wks')('species');

module.exports = function (KEY) {
  var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
  if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
    configurable: true,
    get: function () { return this; }
  });
};

},{"./_core":46,"./_descriptors":49,"./_global":56,"./_object-dp":74,"./_wks":106}],92:[function(require,module,exports){
var def = require('./_object-dp').f;
var has = require('./_has');
var TAG = require('./_wks')('toStringTag');

module.exports = function (it, tag, stat) {
  if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
};

},{"./_has":57,"./_object-dp":74,"./_wks":106}],93:[function(require,module,exports){
var shared = require('./_shared')('keys');
var uid = require('./_uid');
module.exports = function (key) {
  return shared[key] || (shared[key] = uid(key));
};

},{"./_shared":94,"./_uid":102}],94:[function(require,module,exports){
var core = require('./_core');
var global = require('./_global');
var SHARED = '__core-js_shared__';
var store = global[SHARED] || (global[SHARED] = {});

(module.exports = function (key, value) {
  return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
  version: core.version,
  mode: require('./_library') ? 'pure' : 'global',
  copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
});

},{"./_core":46,"./_global":56,"./_library":71}],95:[function(require,module,exports){
var toInteger = require('./_to-integer');
var defined = require('./_defined');
// true  -> String#at
// false -> String#codePointAt
module.exports = function (TO_STRING) {
  return function (that, pos) {
    var s = String(defined(that));
    var i = toInteger(pos);
    var l = s.length;
    var a, b;
    if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
    a = s.charCodeAt(i);
    return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
      ? TO_STRING ? s.charAt(i) : a
      : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  };
};

},{"./_defined":48,"./_to-integer":97}],96:[function(require,module,exports){
var toInteger = require('./_to-integer');
var max = Math.max;
var min = Math.min;
module.exports = function (index, length) {
  index = toInteger(index);
  return index < 0 ? max(index + length, 0) : min(index, length);
};

},{"./_to-integer":97}],97:[function(require,module,exports){
// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
module.exports = function (it) {
  return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};

},{}],98:[function(require,module,exports){
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = require('./_iobject');
var defined = require('./_defined');
module.exports = function (it) {
  return IObject(defined(it));
};

},{"./_defined":48,"./_iobject":62}],99:[function(require,module,exports){
// 7.1.15 ToLength
var toInteger = require('./_to-integer');
var min = Math.min;
module.exports = function (it) {
  return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};

},{"./_to-integer":97}],100:[function(require,module,exports){
// 7.1.13 ToObject(argument)
var defined = require('./_defined');
module.exports = function (it) {
  return Object(defined(it));
};

},{"./_defined":48}],101:[function(require,module,exports){
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = require('./_is-object');
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function (it, S) {
  if (!isObject(it)) return it;
  var fn, val;
  if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
  if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  throw TypeError("Can't convert object to primitive value");
};

},{"./_is-object":65}],102:[function(require,module,exports){
var id = 0;
var px = Math.random();
module.exports = function (key) {
  return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};

},{}],103:[function(require,module,exports){
var isObject = require('./_is-object');
module.exports = function (it, TYPE) {
  if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
  return it;
};

},{"./_is-object":65}],104:[function(require,module,exports){
var global = require('./_global');
var core = require('./_core');
var LIBRARY = require('./_library');
var wksExt = require('./_wks-ext');
var defineProperty = require('./_object-dp').f;
module.exports = function (name) {
  var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
  if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
};

},{"./_core":46,"./_global":56,"./_library":71,"./_object-dp":74,"./_wks-ext":105}],105:[function(require,module,exports){
exports.f = require('./_wks');

},{"./_wks":106}],106:[function(require,module,exports){
var store = require('./_shared')('wks');
var uid = require('./_uid');
var Symbol = require('./_global').Symbol;
var USE_SYMBOL = typeof Symbol == 'function';

var $exports = module.exports = function (name) {
  return store[name] || (store[name] =
    USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};

$exports.store = store;

},{"./_global":56,"./_shared":94,"./_uid":102}],107:[function(require,module,exports){
var classof = require('./_classof');
var ITERATOR = require('./_wks')('iterator');
var Iterators = require('./_iterators');
module.exports = require('./_core').getIteratorMethod = function (it) {
  if (it != undefined) return it[ITERATOR]
    || it['@@iterator']
    || Iterators[classof(it)];
};

},{"./_classof":41,"./_core":46,"./_iterators":70,"./_wks":106}],108:[function(require,module,exports){
'use strict';
var addToUnscopables = require('./_add-to-unscopables');
var step = require('./_iter-step');
var Iterators = require('./_iterators');
var toIObject = require('./_to-iobject');

// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {
  this._t = toIObject(iterated); // target
  this._i = 0;                   // next index
  this._k = kind;                // kind
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function () {
  var O = this._t;
  var kind = this._k;
  var index = this._i++;
  if (!O || index >= O.length) {
    this._t = undefined;
    return step(1);
  }
  if (kind == 'keys') return step(0, index);
  if (kind == 'values') return step(0, O[index]);
  return step(0, [index, O[index]]);
}, 'values');

// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;

addToUnscopables('keys');
addToUnscopables('values');
addToUnscopables('entries');

},{"./_add-to-unscopables":32,"./_iter-define":68,"./_iter-step":69,"./_iterators":70,"./_to-iobject":98}],109:[function(require,module,exports){
// 20.3.3.1 / 15.9.4.4 Date.now()
var $export = require('./_export');

$export($export.S, 'Date', { now: function () { return new Date().getTime(); } });

},{"./_export":53}],110:[function(require,module,exports){
'use strict';
var strong = require('./_collection-strong');
var validate = require('./_validate-collection');
var MAP = 'Map';

// 23.1 Map Objects
module.exports = require('./_collection')(MAP, function (get) {
  return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
}, {
  // 23.1.3.6 Map.prototype.get(key)
  get: function get(key) {
    var entry = strong.getEntry(validate(this, MAP), key);
    return entry && entry.v;
  },
  // 23.1.3.9 Map.prototype.set(key, value)
  set: function set(key, value) {
    return strong.def(validate(this, MAP), key === 0 ? 0 : key, value);
  }
}, strong, true);

},{"./_collection":45,"./_collection-strong":43,"./_validate-collection":103}],111:[function(require,module,exports){
var $export = require('./_export');
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
$export($export.S, 'Object', { create: require('./_object-create') });

},{"./_export":53,"./_object-create":73}],112:[function(require,module,exports){
var $export = require('./_export');
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f });

},{"./_descriptors":49,"./_export":53,"./_object-dp":74}],113:[function(require,module,exports){
// 19.1.2.9 Object.getPrototypeOf(O)
var toObject = require('./_to-object');
var $getPrototypeOf = require('./_object-gpo');

require('./_object-sap')('getPrototypeOf', function () {
  return function getPrototypeOf(it) {
    return $getPrototypeOf(toObject(it));
  };
});

},{"./_object-gpo":80,"./_object-sap":84,"./_to-object":100}],114:[function(require,module,exports){
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $export = require('./_export');
$export($export.S, 'Object', { setPrototypeOf: require('./_set-proto').set });

},{"./_export":53,"./_set-proto":90}],115:[function(require,module,exports){

},{}],116:[function(require,module,exports){
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
var $export = require('./_export');
var create = require('./_object-create');
var aFunction = require('./_a-function');
var anObject = require('./_an-object');
var isObject = require('./_is-object');
var fails = require('./_fails');
var bind = require('./_bind');
var rConstruct = (require('./_global').Reflect || {}).construct;

// MS Edge supports only 2 arguments and argumentsList argument is optional
// FF Nightly sets third argument as `new.target`, but does not create `this` from it
var NEW_TARGET_BUG = fails(function () {
  function F() { /* empty */ }
  return !(rConstruct(function () { /* empty */ }, [], F) instanceof F);
});
var ARGS_BUG = !fails(function () {
  rConstruct(function () { /* empty */ });
});

$export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', {
  construct: function construct(Target, args /* , newTarget */) {
    aFunction(Target);
    anObject(args);
    var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
    if (ARGS_BUG && !NEW_TARGET_BUG) return rConstruct(Target, args, newTarget);
    if (Target == newTarget) {
      // w/o altered newTarget, optimization for 0-4 arguments
      switch (args.length) {
        case 0: return new Target();
        case 1: return new Target(args[0]);
        case 2: return new Target(args[0], args[1]);
        case 3: return new Target(args[0], args[1], args[2]);
        case 4: return new Target(args[0], args[1], args[2], args[3]);
      }
      // w/o altered newTarget, lot of arguments case
      var $args = [null];
      $args.push.apply($args, args);
      return new (bind.apply(Target, $args))();
    }
    // with altered newTarget, not support built-in constructors
    var proto = newTarget.prototype;
    var instance = create(isObject(proto) ? proto : Object.prototype);
    var result = Function.apply.call(Target, instance, args);
    return isObject(result) ? result : instance;
  }
});

},{"./_a-function":31,"./_an-object":34,"./_bind":40,"./_export":53,"./_fails":54,"./_global":56,"./_is-object":65,"./_object-create":73}],117:[function(require,module,exports){
'use strict';
var $at = require('./_string-at')(true);

// 21.1.3.27 String.prototype[@@iterator]()
require('./_iter-define')(String, 'String', function (iterated) {
  this._t = String(iterated); // target
  this._i = 0;                // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function () {
  var O = this._t;
  var index = this._i;
  var point;
  if (index >= O.length) return { value: undefined, done: true };
  point = $at(O, index);
  this._i += point.length;
  return { value: point, done: false };
});

},{"./_iter-define":68,"./_string-at":95}],118:[function(require,module,exports){
'use strict';
// ECMAScript 6 symbols shim
var global = require('./_global');
var has = require('./_has');
var DESCRIPTORS = require('./_descriptors');
var $export = require('./_export');
var redefine = require('./_redefine');
var META = require('./_meta').KEY;
var $fails = require('./_fails');
var shared = require('./_shared');
var setToStringTag = require('./_set-to-string-tag');
var uid = require('./_uid');
var wks = require('./_wks');
var wksExt = require('./_wks-ext');
var wksDefine = require('./_wks-define');
var enumKeys = require('./_enum-keys');
var isArray = require('./_is-array');
var anObject = require('./_an-object');
var isObject = require('./_is-object');
var toObject = require('./_to-object');
var toIObject = require('./_to-iobject');
var toPrimitive = require('./_to-primitive');
var createDesc = require('./_property-desc');
var _create = require('./_object-create');
var gOPNExt = require('./_object-gopn-ext');
var $GOPD = require('./_object-gopd');
var $GOPS = require('./_object-gops');
var $DP = require('./_object-dp');
var $keys = require('./_object-keys');
var gOPD = $GOPD.f;
var dP = $DP.f;
var gOPN = gOPNExt.f;
var $Symbol = global.Symbol;
var $JSON = global.JSON;
var _stringify = $JSON && $JSON.stringify;
var PROTOTYPE = 'prototype';
var HIDDEN = wks('_hidden');
var TO_PRIMITIVE = wks('toPrimitive');
var isEnum = {}.propertyIsEnumerable;
var SymbolRegistry = shared('symbol-registry');
var AllSymbols = shared('symbols');
var OPSymbols = shared('op-symbols');
var ObjectProto = Object[PROTOTYPE];
var USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f;
var QObject = global.QObject;
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;

// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDesc = DESCRIPTORS && $fails(function () {
  return _create(dP({}, 'a', {
    get: function () { return dP(this, 'a', { value: 7 }).a; }
  })).a != 7;
}) ? function (it, key, D) {
  var protoDesc = gOPD(ObjectProto, key);
  if (protoDesc) delete ObjectProto[key];
  dP(it, key, D);
  if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
} : dP;

var wrap = function (tag) {
  var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
  sym._k = tag;
  return sym;
};

var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
  return typeof it == 'symbol';
} : function (it) {
  return it instanceof $Symbol;
};

var $defineProperty = function defineProperty(it, key, D) {
  if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
  anObject(it);
  key = toPrimitive(key, true);
  anObject(D);
  if (has(AllSymbols, key)) {
    if (!D.enumerable) {
      if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
      it[HIDDEN][key] = true;
    } else {
      if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
      D = _create(D, { enumerable: createDesc(0, false) });
    } return setSymbolDesc(it, key, D);
  } return dP(it, key, D);
};
var $defineProperties = function defineProperties(it, P) {
  anObject(it);
  var keys = enumKeys(P = toIObject(P));
  var i = 0;
  var l = keys.length;
  var key;
  while (l > i) $defineProperty(it, key = keys[i++], P[key]);
  return it;
};
var $create = function create(it, P) {
  return P === undefined ? _create(it) : $defineProperties(_create(it), P);
};
var $propertyIsEnumerable = function propertyIsEnumerable(key) {
  var E = isEnum.call(this, key = toPrimitive(key, true));
  if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
  return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
};
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
  it = toIObject(it);
  key = toPrimitive(key, true);
  if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
  var D = gOPD(it, key);
  if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
  return D;
};
var $getOwnPropertyNames = function getOwnPropertyNames(it) {
  var names = gOPN(toIObject(it));
  var result = [];
  var i = 0;
  var key;
  while (names.length > i) {
    if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
  } return result;
};
var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
  var IS_OP = it === ObjectProto;
  var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
  var result = [];
  var i = 0;
  var key;
  while (names.length > i) {
    if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
  } return result;
};

// 19.4.1.1 Symbol([description])
if (!USE_NATIVE) {
  $Symbol = function Symbol() {
    if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
    var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
    var $set = function (value) {
      if (this === ObjectProto) $set.call(OPSymbols, value);
      if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
      setSymbolDesc(this, tag, createDesc(1, value));
    };
    if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
    return wrap(tag);
  };
  redefine($Symbol[PROTOTYPE], 'toString', function toString() {
    return this._k;
  });

  $GOPD.f = $getOwnPropertyDescriptor;
  $DP.f = $defineProperty;
  require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames;
  require('./_object-pie').f = $propertyIsEnumerable;
  $GOPS.f = $getOwnPropertySymbols;

  if (DESCRIPTORS && !require('./_library')) {
    redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
  }

  wksExt.f = function (name) {
    return wrap(wks(name));
  };
}

$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });

for (var es6Symbols = (
  // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
  'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);

for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);

$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
  // 19.4.2.1 Symbol.for(key)
  'for': function (key) {
    return has(SymbolRegistry, key += '')
      ? SymbolRegistry[key]
      : SymbolRegistry[key] = $Symbol(key);
  },
  // 19.4.2.5 Symbol.keyFor(sym)
  keyFor: function keyFor(sym) {
    if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
    for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
  },
  useSetter: function () { setter = true; },
  useSimple: function () { setter = false; }
});

$export($export.S + $export.F * !USE_NATIVE, 'Object', {
  // 19.1.2.2 Object.create(O [, Properties])
  create: $create,
  // 19.1.2.4 Object.defineProperty(O, P, Attributes)
  defineProperty: $defineProperty,
  // 19.1.2.3 Object.defineProperties(O, Properties)
  defineProperties: $defineProperties,
  // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
  // 19.1.2.7 Object.getOwnPropertyNames(O)
  getOwnPropertyNames: $getOwnPropertyNames,
  // 19.1.2.8 Object.getOwnPropertySymbols(O)
  getOwnPropertySymbols: $getOwnPropertySymbols
});

// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
// https://bugs.chromium.org/p/v8/issues/detail?id=3443
var FAILS_ON_PRIMITIVES = $fails(function () { $GOPS.f(1); });

$export($export.S + $export.F * FAILS_ON_PRIMITIVES, 'Object', {
  getOwnPropertySymbols: function getOwnPropertySymbols(it) {
    return $GOPS.f(toObject(it));
  }
});

// 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
  var S = $Symbol();
  // MS Edge converts symbol values to JSON as {}
  // WebKit converts symbol values to JSON as null
  // V8 throws on boxed symbols
  return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
})), 'JSON', {
  stringify: function stringify(it) {
    var args = [it];
    var i = 1;
    var replacer, $replacer;
    while (arguments.length > i) args.push(arguments[i++]);
    $replacer = replacer = args[1];
    if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
    if (!isArray(replacer)) replacer = function (key, value) {
      if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
      if (!isSymbol(value)) return value;
    };
    args[1] = replacer;
    return _stringify.apply($JSON, args);
  }
});

// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);

},{"./_an-object":34,"./_descriptors":49,"./_enum-keys":52,"./_export":53,"./_fails":54,"./_global":56,"./_has":57,"./_hide":58,"./_is-array":64,"./_is-object":65,"./_library":71,"./_meta":72,"./_object-create":73,"./_object-dp":74,"./_object-gopd":76,"./_object-gopn":78,"./_object-gopn-ext":77,"./_object-gops":79,"./_object-keys":82,"./_object-pie":83,"./_property-desc":85,"./_redefine":87,"./_set-to-string-tag":92,"./_shared":94,"./_to-iobject":98,"./_to-object":100,"./_to-primitive":101,"./_uid":102,"./_wks":106,"./_wks-define":104,"./_wks-ext":105}],119:[function(require,module,exports){
// https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
require('./_set-collection-from')('Map');

},{"./_set-collection-from":88}],120:[function(require,module,exports){
// https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
require('./_set-collection-of')('Map');

},{"./_set-collection-of":89}],121:[function(require,module,exports){
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $export = require('./_export');

$export($export.P + $export.R, 'Map', { toJSON: require('./_collection-to-json')('Map') });

},{"./_collection-to-json":44,"./_export":53}],122:[function(require,module,exports){
require('./_wks-define')('asyncIterator');

},{"./_wks-define":104}],123:[function(require,module,exports){
require('./_wks-define')('observable');

},{"./_wks-define":104}],124:[function(require,module,exports){
require('./es6.array.iterator');
var global = require('./_global');
var hide = require('./_hide');
var Iterators = require('./_iterators');
var TO_STRING_TAG = require('./_wks')('toStringTag');

var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
  'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
  'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
  'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
  'TextTrackList,TouchList').split(',');

for (var i = 0; i < DOMIterables.length; i++) {
  var NAME = DOMIterables[i];
  var Collection = global[NAME];
  var proto = Collection && Collection.prototype;
  if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
  Iterators[NAME] = Iterators.Array;
}

},{"./_global":56,"./_hide":58,"./_iterators":70,"./_wks":106,"./es6.array.iterator":108}],125:[function(require,module,exports){
module.exports=[
    {
        "name": "reserved0",
        "args": [],
        "ret": "void"
    },
    {
        "name": "reserved1",
        "args": [],
        "ret": "void"
    },
    {
        "name": "reserved2",
        "args": [],
        "ret": "void"
    },
    {
        "name": "DestroyJavaVM",
        "args": [
            "JavaVM*"
        ],
        "ret": "jint"
    },
    {
        "name": "AttachCurrentThread",
        "args": [
            "JavaVM*",
            "void**",
            "void*"
        ],
        "ret": "jint"
    },
    {
        "name": "DetachCurrentThread",
        "args": [
            "JavaVM*"
        ],
        "ret": "jint"
    },
    {
        "name": "GetEnv",
        "args": [
            "JavaVM*",
            "void**",
            "jint"
        ],
        "ret": "jint"
    },
    {
        "name": "AttachCurrentThreadAsDaemon",
        "args": [
            "JavaVM*",
            "void**",
            "void*"
        ],
        "ret": "jint"
    }
]

},{}],126:[function(require,module,exports){
module.exports=[
    {
        "name": "reserved0",
        "args": [],
        "ret": "void"
    },
    {
        "name": "reserved1",
        "args": [],
        "ret": "void"
    },
    {
        "name": "reserved2",
        "args": [],
        "ret": "void"
    },
    {
        "name": "reserved3",
        "args": [],
        "ret": "void"
    },
    {
        "name": "GetVersion",
        "args": [
            "JNIEnv*"
        ],
        "ret": "jint"
    },
    {
        "name": "DefineClass",
        "args": [
            "JNIEnv*",
            "char*",
            "jobject",
            "jbyte*",
            "jsize"
        ],
        "ret": "jclass"
    },
    {
        "name": "FindClass",
        "args": [
            "JNIEnv*",
            "char*"
        ],
        "ret": "jclass"
    },
    {
        "name": "FromReflectedMethod",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "jmethodID"
    },
    {
        "name": "FromReflectedField",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "jfieldID"
    },
    {
        "name": "ToReflectedMethod",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "jboolean"
        ],
        "ret": "jobject"
    },
    {
        "name": "GetSuperclass",
        "args": [
            "JNIEnv*",
            "jclass"
        ],
        "ret": "jclass"
    },
    {
        "name": "IsAssignableFrom",
        "args": [
            "JNIEnv*",
            "jclass",
            "jclass"
        ],
        "ret": "jboolean"
    },
    {
        "name": "ToReflectedField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID",
            "jboolean"
        ],
        "ret": "jobject"
    },
    {
        "name": "Throw",
        "args": [
            "JNIEnv*",
            "jthrowable"
        ],
        "ret": "jint"
    },
    {
        "name": "ThrowNew",
        "args": [
            "JNIEnv*",
            "jclass",
            "char*"
        ],
        "ret": "jint"
    },
    {
        "name": "ExceptionOccurred",
        "args": [
            "JNIEnv*"
        ],
        "ret": "jthrowable"
    },
    {
        "name": "ExceptionDescribe",
        "args": [
            "JNIEnv*"
        ],
        "ret": "void"
    },
    {
        "name": "ExceptionClear",
        "args": [
            "JNIEnv*"
        ],
        "ret": "void"
    },
    {
        "name": "FatalError",
        "args": [
            "JNIEnv*",
            "char*"
        ],
        "ret": "void"
    },
    {
        "name": "PushLocalFrame",
        "args": [
            "JNIEnv*",
            "jint"
        ],
        "ret": "jint"
    },
    {
        "name": "PopLocalFrame",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "jobject"
    },
    {
        "name": "NewGlobalRef",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "jobject"
    },
    {
        "name": "DeleteGlobalRef",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "void"
    },
    {
        "name": "DeleteLocalRef",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "void"
    },
    {
        "name": "IsSameObject",
        "args": [
            "JNIEnv*",
            "jobject",
            "jobject"
        ],
        "ret": "jboolean"
    },
    {
        "name": "NewLocalRef",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "jobject"
    },
    {
        "name": "EnsureLocalCapacity",
        "args": [
            "JNIEnv*",
            "jint"
        ],
        "ret": "jint"
    },
    {
        "name": "AllocObject",
        "args": [
            "JNIEnv*",
            "jclass"
        ],
        "ret": "jobject"
    },
    {
        "name": "NewObject",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jobject"
    },
    {
        "name": "NewObjectV",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jobject"
    },
    {
        "name": "NewObjectA",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jobject"
    },
    {
        "name": "GetObjectClass",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "jclass"
    },
    {
        "name": "IsInstanceOf",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass"
        ],
        "ret": "jboolean"
    },
    {
        "name": "GetMethodID",
        "args": [
            "JNIEnv*",
            "jclass",
            "char*",
            "char*"
        ],
        "ret": "jmethodID"
    },
    {
        "name": "CallObjectMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "..."
        ],
        "ret": "jobject"
    },
    {
        "name": "CallObjectMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "va_list"
        ],
        "ret": "jobject"
    },
    {
        "name": "CallObjectMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jobject"
    },
    {
        "name": "CallBooleanMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "..."
        ],
        "ret": "jboolean"
    },
    {
        "name": "CallBooleanMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "va_list"
        ],
        "ret": "jboolean"
    },
    {
        "name": "CallBooleanMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jboolean"
    },
    {
        "name": "CallByteMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "..."
        ],
        "ret": "jbyte"
    },
    {
        "name": "CallByteMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "va_list"
        ],
        "ret": "jbyte"
    },
    {
        "name": "CallByteMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jbyte"
    },
    {
        "name": "CallCharMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "..."
        ],
        "ret": "jchar"
    },
    {
        "name": "CallCharMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "va_list"
        ],
        "ret": "jchar"
    },
    {
        "name": "CallCharMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jchar"
    },
    {
        "name": "CallShortMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "..."
        ],
        "ret": "jshort"
    },
    {
        "name": "CallShortMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "va_list"
        ],
        "ret": "jshort"
    },
    {
        "name": "CallShortMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jshort"
    },
    {
        "name": "CallIntMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "..."
        ],
        "ret": "jint"
    },
    {
        "name": "CallIntMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "va_list"
        ],
        "ret": "jint"
    },
    {
        "name": "CallIntMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jint"
    },
    {
        "name": "CallLongMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "..."
        ],
        "ret": "jlong"
    },
    {
        "name": "CallLongMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "va_list"
        ],
        "ret": "jlong"
    },
    {
        "name": "CallLongMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jlong"
    },
    {
        "name": "CallFloatMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "..."
        ],
        "ret": "jfloat"
    },
    {
        "name": "CallFloatMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "va_list"
        ],
        "ret": "jfloat"
    },
    {
        "name": "CallFloatMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jfloat"
    },
    {
        "name": "CallDoubleMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "..."
        ],
        "ret": "jdouble"
    },
    {
        "name": "CallDoubleMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "va_list"
        ],
        "ret": "jdouble"
    },
    {
        "name": "CallDoubleMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jdouble"
    },
    {
        "name": "CallVoidMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "..."
        ],
        "ret": "void"
    },
    {
        "name": "CallVoidMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "va_list"
        ],
        "ret": "void"
    },
    {
        "name": "CallVoidMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "void"
    },
    {
        "name": "CallNonvirtualObjectMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jobject"
    },
    {
        "name": "CallNonvirtualObjectMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jobject"
    },
    {
        "name": "CallNonvirtualObjectMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jobject"
    },
    {
        "name": "CallNonvirtualBooleanMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jboolean"
    },
    {
        "name": "CallNonvirtualBooleanMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jboolean"
    },
    {
        "name": "CallNonvirtualBooleanMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jboolean"
    },
    {
        "name": "CallNonvirtualByteMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jbyte"
    },
    {
        "name": "CallNonvirtualByteMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jbyte"
    },
    {
        "name": "CallNonvirtualByteMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jbyte"
    },
    {
        "name": "CallNonvirtualCharMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jchar"
    },
    {
        "name": "CallNonvirtualCharMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jchar"
    },
    {
        "name": "CallNonvirtualCharMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jchar"
    },
    {
        "name": "CallNonvirtualShortMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jshort"
    },
    {
        "name": "CallNonvirtualShortMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jshort"
    },
    {
        "name": "CallNonvirtualShortMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jshort"
    },
    {
        "name": "CallNonvirtualIntMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jint"
    },
    {
        "name": "CallNonvirtualIntMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jint"
    },
    {
        "name": "CallNonvirtualIntMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jint"
    },
    {
        "name": "CallNonvirtualLongMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jlong"
    },
    {
        "name": "CallNonvirtualLongMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jlong"
    },
    {
        "name": "CallNonvirtualLongMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jlong"
    },
    {
        "name": "CallNonvirtualFloatMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jfloat"
    },
    {
        "name": "CallNonvirtualFloatMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jfloat"
    },
    {
        "name": "CallNonvirtualFloatMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jfloat"
    },
    {
        "name": "CallNonvirtualDoubleMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jdouble"
    },
    {
        "name": "CallNonvirtualDoubleMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jdouble"
    },
    {
        "name": "CallNonvirtualDoubleMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jdouble"
    },
    {
        "name": "CallNonvirtualVoidMethod",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "void"
    },
    {
        "name": "CallNonvirtualVoidMethodV",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "void"
    },
    {
        "name": "CallNonvirtualVoidMethodA",
        "args": [
            "JNIEnv*",
            "jobject",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "void"
    },
    {
        "name": "GetFieldID",
        "args": [
            "JNIEnv*",
            "jclass",
            "char*",
            "char*"
        ],
        "ret": "jfieldID"
    },
    {
        "name": "GetObjectField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID"
        ],
        "ret": "jobject"
    },
    {
        "name": "GetBooleanField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID"
        ],
        "ret": "jboolean"
    },
    {
        "name": "GetByteField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID"
        ],
        "ret": "jbyte"
    },
    {
        "name": "GetCharField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID"
        ],
        "ret": "jchar"
    },
    {
        "name": "GetShortField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID"
        ],
        "ret": "jshort"
    },
    {
        "name": "GetIntField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID"
        ],
        "ret": "jint"
    },
    {
        "name": "GetLongField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID"
        ],
        "ret": "jlong"
    },
    {
        "name": "GetFloatField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID"
        ],
        "ret": "jfloat"
    },
    {
        "name": "GetDoubleField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID"
        ],
        "ret": "jdouble"
    },
    {
        "name": "SetObjectField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID",
            "jobject"
        ],
        "ret": "void"
    },
    {
        "name": "SetBooleanField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID",
            "jboolean"
        ],
        "ret": "void"
    },
    {
        "name": "SetByteField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID",
            "jbyte"
        ],
        "ret": "void"
    },
    {
        "name": "SetCharField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID",
            "jchar"
        ],
        "ret": "void"
    },
    {
        "name": "SetShortField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID",
            "jshort"
        ],
        "ret": "void"
    },
    {
        "name": "SetIntField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID",
            "jint"
        ],
        "ret": "void"
    },
    {
        "name": "SetLongField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID",
            "jlong"
        ],
        "ret": "void"
    },
    {
        "name": "SetFloatField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID",
            "jfloat"
        ],
        "ret": "void"
    },
    {
        "name": "SetDoubleField",
        "args": [
            "JNIEnv*",
            "jobject",
            "jfieldID",
            "jdouble"
        ],
        "ret": "void"
    },
    {
        "name": "GetStaticMethodID",
        "args": [
            "JNIEnv*",
            "jclass",
            "char*",
            "char*"
        ],
        "ret": "jmethodID"
    },
    {
        "name": "CallStaticObjectMethod",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jobject"
    },
    {
        "name": "CallStaticObjectMethodV",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jobject"
    },
    {
        "name": "CallStaticObjectMethodA",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jobject"
    },
    {
        "name": "CallStaticBooleanMethod",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jboolean"
    },
    {
        "name": "CallStaticBooleanMethodV",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jboolean"
    },
    {
        "name": "CallStaticBooleanMethodA",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jboolean"
    },
    {
        "name": "CallStaticByteMethod",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jbyte"
    },
    {
        "name": "CallStaticByteMethodV",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jbyte"
    },
    {
        "name": "CallStaticByteMethodA",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jbyte"
    },
    {
        "name": "CallStaticCharMethod",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jchar"
    },
    {
        "name": "CallStaticCharMethodV",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jchar"
    },
    {
        "name": "CallStaticCharMethodA",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jchar"
    },
    {
        "name": "CallStaticShortMethod",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jshort"
    },
    {
        "name": "CallStaticShortMethodV",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jshort"
    },
    {
        "name": "CallStaticShortMethodA",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jshort"
    },
    {
        "name": "CallStaticIntMethod",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jint"
    },
    {
        "name": "CallStaticIntMethodV",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jint"
    },
    {
        "name": "CallStaticIntMethodA",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jint"
    },
    {
        "name": "CallStaticLongMethod",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jlong"
    },
    {
        "name": "CallStaticLongMethodV",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jlong"
    },
    {
        "name": "CallStaticLongMethodA",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jlong"
    },
    {
        "name": "CallStaticFloatMethod",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jfloat"
    },
    {
        "name": "CallStaticFloatMethodV",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jfloat"
    },
    {
        "name": "CallStaticFloatMethodA",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jfloat"
    },
    {
        "name": "CallStaticDoubleMethod",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "jdouble"
    },
    {
        "name": "CallStaticDoubleMethodV",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "jdouble"
    },
    {
        "name": "CallStaticDoubleMethodA",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "jdouble"
    },
    {
        "name": "CallStaticVoidMethod",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "..."
        ],
        "ret": "void"
    },
    {
        "name": "CallStaticVoidMethodV",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "va_list"
        ],
        "ret": "void"
    },
    {
        "name": "CallStaticVoidMethodA",
        "args": [
            "JNIEnv*",
            "jclass",
            "jmethodID",
            "jvalue*"
        ],
        "ret": "void"
    },
    {
        "name": "GetStaticFieldID",
        "args": [
            "JNIEnv*",
            "jclass",
            "char*",
            "char*"
        ],
        "ret": "jfieldID"
    },
    {
        "name": "GetStaticObjectField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID"
        ],
        "ret": "jobject"
    },
    {
        "name": "GetStaticBooleanField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID"
        ],
        "ret": "jboolean"
    },
    {
        "name": "GetStaticByteField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID"
        ],
        "ret": "jbyte"
    },
    {
        "name": "GetStaticCharField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID"
        ],
        "ret": "jchar"
    },
    {
        "name": "GetStaticShortField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID"
        ],
        "ret": "jshort"
    },
    {
        "name": "GetStaticIntField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID"
        ],
        "ret": "jint"
    },
    {
        "name": "GetStaticLongField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID"
        ],
        "ret": "jlong"
    },
    {
        "name": "GetStaticFloatField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID"
        ],
        "ret": "jfloat"
    },
    {
        "name": "GetStaticDoubleField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID"
        ],
        "ret": "jdouble"
    },
    {
        "name": "SetStaticObjectField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID",
            "jobject"
        ],
        "ret": "void"
    },
    {
        "name": "SetStaticBooleanField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID",
            "jboolean"
        ],
        "ret": "void"
    },
    {
        "name": "SetStaticByteField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID",
            "jbyte"
        ],
        "ret": "void"
    },
    {
        "name": "SetStaticCharField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID",
            "jchar"
        ],
        "ret": "void"
    },
    {
        "name": "SetStaticShortField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID",
            "jshort"
        ],
        "ret": "void"
    },
    {
        "name": "SetStaticIntField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID",
            "jint"
        ],
        "ret": "void"
    },
    {
        "name": "SetStaticLongField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID",
            "jlong"
        ],
        "ret": "void"
    },
    {
        "name": "SetStaticFloatField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID",
            "jfloat"
        ],
        "ret": "void"
    },
    {
        "name": "SetStaticDoubleField",
        "args": [
            "JNIEnv*",
            "jclass",
            "jfieldID",
            "jdouble"
        ],
        "ret": "void"
    },
    {
        "name": "NewString",
        "args": [
            "JNIEnv*",
            "jchar*",
            "jsize"
        ],
        "ret": "jstring"
    },
    {
        "name": "GetStringLength",
        "args": [
            "JNIEnv*",
            "jstring"
        ],
        "ret": "jsize"
    },
    {
        "name": "GetStringChars",
        "args": [
            "JNIEnv*",
            "jstring",
            "jboolean*"
        ],
        "ret": "jchar*"
    },
    {
        "name": "ReleaseStringChars",
        "args": [
            "JNIEnv*",
            "jstring",
            "jchar*"
        ],
        "ret": "void"
    },
    {
        "name": "NewStringUTF",
        "args": [
            "JNIEnv*",
            "char*"
        ],
        "ret": "jstring"
    },
    {
        "name": "GetStringUTFLength",
        "args": [
            "JNIEnv*",
            "jstring"
        ],
        "ret": "jsize"
    },
    {
        "name": "GetStringUTFChars",
        "args": [
            "JNIEnv*",
            "jstring",
            "jboolean*"
        ],
        "ret": "char*"
    },
    {
        "name": "ReleaseStringUTFChars",
        "args": [
            "JNIEnv*",
            "jstring",
            "char*"
        ],
        "ret": "void"
    },
    {
        "name": "GetArrayLength",
        "args": [
            "JNIEnv*",
            "jarray"
        ],
        "ret": "jsize"
    },
    {
        "name": "NewObjectArray",
        "args": [
            "JNIEnv*",
            "jsize",
            "jclass",
            "jobject"
        ],
        "ret": "jobjectArray"
    },
    {
        "name": "GetObjectArrayElement",
        "args": [
            "JNIEnv*",
            "jobjectArray",
            "jsize"
        ],
        "ret": "jobject"
    },
    {
        "name": "SetObjectArrayElement",
        "args": [
            "JNIEnv*",
            "jobjectArray",
            "jsize",
            "jobject"
        ],
        "ret": "void"
    },
    {
        "name": "NewBooleanArray",
        "args": [
            "JNIEnv*",
            "jsize"
        ],
        "ret": "jbooleanArray"
    },
    {
        "name": "NewByteArray",
        "args": [
            "JNIEnv*",
            "jsize"
        ],
        "ret": "jbyteArray"
    },
    {
        "name": "NewCharArray",
        "args": [
            "JNIEnv*",
            "jsize"
        ],
        "ret": "jcharArray"
    },
    {
        "name": "NewShortArray",
        "args": [
            "JNIEnv*",
            "jsize"
        ],
        "ret": "jshortArray"
    },
    {
        "name": "NewIntArray",
        "args": [
            "JNIEnv*",
            "jsize"
        ],
        "ret": "jintArray"
    },
    {
        "name": "NewLongArray",
        "args": [
            "JNIEnv*",
            "jsize"
        ],
        "ret": "jlongArray"
    },
    {
        "name": "NewFloatArray",
        "args": [
            "JNIEnv*",
            "jsize"
        ],
        "ret": "jfloatArray"
    },
    {
        "name": "NewDoubleArray",
        "args": [
            "JNIEnv*",
            "jsize"
        ],
        "ret": "jdoubleArray"
    },
    {
        "name": "GetBooleanArrayElements",
        "args": [
            "JNIEnv*",
            "jbooleanArray",
            "jboolean*"
        ],
        "ret": "jboolean*"
    },
    {
        "name": "GetByteArrayElements",
        "args": [
            "JNIEnv*",
            "jbyteArray",
            "jboolean*"
        ],
        "ret": "jbyte*"
    },
    {
        "name": "GetCharArrayElements",
        "args": [
            "JNIEnv*",
            "jcharArray",
            "jboolean*"
        ],
        "ret": "jchar*"
    },
    {
        "name": "GetShortArrayElements",
        "args": [
            "JNIEnv*",
            "jshortArray",
            "jboolean*"
        ],
        "ret": "jshort*"
    },
    {
        "name": "GetIntArrayElements",
        "args": [
            "JNIEnv*",
            "jintArray",
            "jboolean*"
        ],
        "ret": "jint*"
    },
    {
        "name": "GetLongArrayElements",
        "args": [
            "JNIEnv*",
            "jlongArray",
            "jboolean*"
        ],
        "ret": "jlong*"
    },
    {
        "name": "GetFloatArrayElements",
        "args": [
            "JNIEnv*",
            "jfloatArray",
            "jboolean*"
        ],
        "ret": "jfloat*"
    },
    {
        "name": "GetDoubleArrayElements",
        "args": [
            "JNIEnv*",
            "jdoubleArray",
            "jboolean*"
        ],
        "ret": "jdouble*"
    },
    {
        "name": "ReleaseBooleanArrayElements",
        "args": [
            "JNIEnv*",
            "jbooleanArray",
            "jboolean*",
            "jint"
        ],
        "ret": "void"
    },
    {
        "name": "ReleaseByteArrayElements",
        "args": [
            "JNIEnv*",
            "jbyteArray",
            "jbyte*",
            "jint"
        ],
        "ret": "void"
    },
    {
        "name": "ReleaseCharArrayElements",
        "args": [
            "JNIEnv*",
            "jcharArray",
            "jchar*",
            "jint"
        ],
        "ret": "void"
    },
    {
        "name": "ReleaseShortArrayElements",
        "args": [
            "JNIEnv*",
            "jshortArray",
            "jshort*",
            "jint"
        ],
        "ret": "void"
    },
    {
        "name": "ReleaseIntArrayElements",
        "args": [
            "JNIEnv*",
            "jintArray",
            "jint*",
            "jint"
        ],
        "ret": "void"
    },
    {
        "name": "ReleaseLongArrayElements",
        "args": [
            "JNIEnv*",
            "jlongArray",
            "jlong*",
            "jint"
        ],
        "ret": "void"
    },
    {
        "name": "ReleaseFloatArrayElements",
        "args": [
            "JNIEnv*",
            "jfloatArray",
            "jfloat*",
            "jint"
        ],
        "ret": "void"
    },
    {
        "name": "ReleaseDoubleArrayElements",
        "args": [
            "JNIEnv*",
            "jdoubleArray",
            "jdouble*",
            "jint"
        ],
        "ret": "void"
    },
    {
        "name": "GetBooleanArrayRegion",
        "args": [
            "JNIEnv*",
            "jbooleanArray",
            "jsize",
            "jsize",
            "jboolean*"
        ],
        "ret": "void"
    },
    {
        "name": "GetByteArrayRegion",
        "args": [
            "JNIEnv*",
            "jbyteArray",
            "jsize",
            "jsize",
            "jbyte*"
        ],
        "ret": "void"
    },
    {
        "name": "GetCharArrayRegion",
        "args": [
            "JNIEnv*",
            "jcharArray",
            "jsize",
            "jsize",
            "jchar*"
        ],
        "ret": "void"
    },
    {
        "name": "GetShortArrayRegion",
        "args": [
            "JNIEnv*",
            "jshortArray",
            "jsize",
            "jsize",
            "jshort*"
        ],
        "ret": "void"
    },
    {
        "name": "GetIntArrayRegion",
        "args": [
            "JNIEnv*",
            "jintArray",
            "jsize",
            "jsize",
            "jint*"
        ],
        "ret": "void"
    },
    {
        "name": "GetLongArrayRegion",
        "args": [
            "JNIEnv*",
            "jlongArray",
            "jsize",
            "jsize",
            "jlong*"
        ],
        "ret": "void"
    },
    {
        "name": "GetFloatArrayRegion",
        "args": [
            "JNIEnv*",
            "jfloatArray",
            "jsize",
            "jsize",
            "jfloat*"
        ],
        "ret": "void"
    },
    {
        "name": "GetDoubleArrayRegion",
        "args": [
            "JNIEnv*",
            "jdoubleArray",
            "jsize",
            "jsize",
            "jdouble*"
        ],
        "ret": "void"
    },
    {
        "name": "SetBooleanArrayRegion",
        "args": [
            "JNIEnv*",
            "jbooleanArray",
            "jsize",
            "jsize",
            "jboolean*"
        ],
        "ret": "void"
    },
    {
        "name": "SetByteArrayRegion",
        "args": [
            "JNIEnv*",
            "jbyteArray",
            "jsize",
            "jsize",
            "jbyte*"
        ],
        "ret": "void"
    },
    {
        "name": "SetCharArrayRegion",
        "args": [
            "JNIEnv*",
            "jcharArray",
            "jsize",
            "jsize",
            "jchar*"
        ],
        "ret": "void"
    },
    {
        "name": "SetShortArrayRegion",
        "args": [
            "JNIEnv*",
            "jshortArray",
            "jsize",
            "jsize",
            "jshort*"
        ],
        "ret": "void"
    },
    {
        "name": "SetIntArrayRegion",
        "args": [
            "JNIEnv*",
            "jintArray",
            "jsize",
            "jsize",
            "jint*"
        ],
        "ret": "void"
    },
    {
        "name": "SetLongArrayRegion",
        "args": [
            "JNIEnv*",
            "jlongArray",
            "jsize",
            "jsize",
            "jlong*"
        ],
        "ret": "void"
    },
    {
        "name": "SetFloatArrayRegion",
        "args": [
            "JNIEnv*",
            "jfloatArray",
            "jsize",
            "jsize",
            "jfloat*"
        ],
        "ret": "void"
    },
    {
        "name": "SetDoubleArrayRegion",
        "args": [
            "JNIEnv*",
            "jdoubleArray",
            "jsize",
            "jsize",
            "jdouble*"
        ],
        "ret": "void"
    },
    {
        "name": "RegisterNatives",
        "args": [
            "JNIEnv*",
            "jclass",
            "JNINativeMethod*",
            "jint"
        ],
        "ret": "jint"
    },
    {
        "name": "UnregisterNatives",
        "args": [
            "JNIEnv*",
            "jclass"
        ],
        "ret": "jint"
    },
    {
        "name": "MonitorEnter",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "jint"
    },
    {
        "name": "MonitorExit",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "jint"
    },
    {
        "name": "GetJavaVM",
        "args": [
            "JNIEnv*",
            "JavaVM**"
        ],
        "ret": "jint"
    },
    {
        "name": "GetStringRegion",
        "args": [
            "JNIEnv*",
            "jstring",
            "jsize",
            "jsize",
            "jchar*"
        ],
        "ret": "void"
    },
    {
        "name": "GetStringUTFRegion",
        "args": [
            "JNIEnv*",
            "jstring",
            "jsize",
            "jsize",
            "char*"
        ],
        "ret": "void"
    },
    {
        "name": "GetPrimitiveArrayCritical",
        "args": [
            "JNIEnv*",
            "jarray",
            "jboolean*"
        ],
        "ret": "void"
    },
    {
        "name": "ReleasePrimitiveArrayCritical",
        "args": [
            "JNIEnv*",
            "jarray",
            "void*",
            "jint"
        ],
        "ret": "void"
    },
    {
        "name": "GetStringCritical",
        "args": [
            "JNIEnv*",
            "jstring",
            "jboolean*"
        ],
        "ret": "jchar"
    },
    {
        "name": "ReleaseStringCritical",
        "args": [
            "JNIEnv*",
            "jstring",
            "jchar*"
        ],
        "ret": "void"
    },
    {
        "name": "NewWeakGlobalRef",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "jweak"
    },
    {
        "name": "DeleteWeakGlobalRef",
        "args": [
            "JNIEnv*",
            "jweak"
        ],
        "ret": "void"
    },
    {
        "name": "ExceptionCheck",
        "args": [
            "JNIEnv*"
        ],
        "ret": "jboolean"
    },
    {
        "name": "NewDirectByteBuffer",
        "args": [
            "JNIEnv*",
            "void*",
            "jlong"
        ],
        "ret": "jobject"
    },
    {
        "name": "GetDirectBufferAddress",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "void"
    },
    {
        "name": "GetDirectBufferCapacity",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "jlong"
    },
    {
        "name": "GetObjectRefType",
        "args": [
            "JNIEnv*",
            "jobject"
        ],
        "ret": "jobjectRefType"
    }
]

},{}],127:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var reference_manager_1 = require("./utils/reference_manager");

var config_1 = require("./utils/config");

var jni_env_interceptor_x86_1 = require("./jni/x86/jni_env_interceptor_x86");

var jni_env_interceptor_x64_1 = require("./jni/x64/jni_env_interceptor_x64");

var jni_env_interceptor_arm_1 = require("./jni/arm/jni_env_interceptor_arm");

var jni_env_interceptor_arm64_1 = require("./jni/arm64/jni_env_interceptor_arm64");

var java_vm_interceptor_1 = require("./jni/java_vm_interceptor");

var jni_thread_manager_1 = require("./jni/jni_thread_manager");

var _1 = require(".");

function run(callbackManager) {
  var JNI_ENV_INDEX = 0;
  var JAVA_VM_INDEX = 0;
  var LIB_TRACK_FIRST_INDEX = 0;
  var threads = new jni_thread_manager_1.JNIThreadManager();
  var references = new reference_manager_1.ReferenceManager();
  var jniEnvInterceptor = undefined;

  if (Process.arch === "ia32") {
    jniEnvInterceptor = new jni_env_interceptor_x86_1.JNIEnvInterceptorX86(references, threads, callbackManager);
  } else if (Process.arch === "x64") {
    jniEnvInterceptor = new jni_env_interceptor_x64_1.JNIEnvInterceptorX64(references, threads, callbackManager);
  } else if (Process.arch === "arm") {
    jniEnvInterceptor = new jni_env_interceptor_arm_1.JNIEnvInterceptorARM(references, threads, callbackManager);
  } else if (Process.arch === "arm64") {
    jniEnvInterceptor = new jni_env_interceptor_arm64_1.JNIEnvInterceptorARM64(references, threads, callbackManager);
  }

  if (jniEnvInterceptor === undefined) {
    throw new Error(Process.arch + " currently unsupported, please file an issue.");
  }

  var javaVMInterceptor = new java_vm_interceptor_1.JavaVMInterceptor(references, threads, jniEnvInterceptor, callbackManager);
  jniEnvInterceptor.setJavaVMInterceptor(javaVMInterceptor);
  var trackedLibs = new _map["default"]();
  var libBlacklist = new _map["default"]();

  function checkLibrary(path) {
    var EMPTY_ARRAY_LENGTH = 0;
    var ONE_ELEMENT_ARRAY_LENGTH = 1;
    var willFollowLib = false;

    if (path === null) {
      return false;
    }

    _1.JNILibraryWatcher.doCallback(path);

    var config = config_1.Config.getInstance();

    if (config.libraries.length === ONE_ELEMENT_ARRAY_LENGTH) {
      if (config.libraries[LIB_TRACK_FIRST_INDEX] === "*") {
        willFollowLib = true;
      }
    }

    if (!willFollowLib) {
      willFollowLib = config.libraries.filter(function (l) {
        return path.includes(l);
      }).length > EMPTY_ARRAY_LENGTH;
    }

    return willFollowLib;
  }

  function interceptJNIOnLoad(jniOnLoadAddr) {
    return Interceptor.attach(jniOnLoadAddr, {
      onEnter: function onEnter(args) {
        var shadowJavaVM = NULL;
        var javaVM = ptr(args[JAVA_VM_INDEX].toString());

        if (!threads.hasJavaVM()) {
          threads.setJavaVM(javaVM);
        }

        if (!javaVMInterceptor.isInitialised()) {
          shadowJavaVM = javaVMInterceptor.create();
        } else {
          shadowJavaVM = javaVMInterceptor.get();
        }

        args[JAVA_VM_INDEX] = shadowJavaVM;
      }
    });
  }

  function interceptJNIFunction(jniFunctionAddr) {
    return Interceptor.attach(jniFunctionAddr, {
      onEnter: function onEnter(args) {
        if (jniEnvInterceptor === undefined) {
          return;
        }

        var threadId = this.threadId;
        var jniEnv = ptr(args[JNI_ENV_INDEX].toString());
        var shadowJNIEnv = NULL;
        threads.setJNIEnv(threadId, jniEnv);

        if (!jniEnvInterceptor.isInitialised()) {
          shadowJNIEnv = jniEnvInterceptor.create();
        } else {
          shadowJNIEnv = jniEnvInterceptor.get();
        }

        args[JNI_ENV_INDEX] = shadowJNIEnv;
      }
    });
  }

  var dlopenRef = Module.findExportByName(null, "dlopen");
  var dlsymRef = Module.findExportByName(null, "dlsym");
  var dlcloseRef = Module.findExportByName(null, "dlclose");

  if (dlopenRef !== null && dlsymRef !== null && dlcloseRef !== null) {
    var HANDLE_INDEX = 0;
    var dlopen = new NativeFunction(dlopenRef, "pointer", ["pointer", "int"]);
    Interceptor.replace(dlopen, new NativeCallback(function (filename, mode) {
      var path = filename.readCString();
      var retval = dlopen(filename, mode);

      if (path !== null) {
        if (checkLibrary(path)) {
          // eslint-disable-next-line @typescript-eslint/no-base-to-string
          trackedLibs.set(retval.toString(), true);
        } else {
          // eslint-disable-next-line @typescript-eslint/no-base-to-string
          libBlacklist.set(retval.toString(), true);
        }
      }

      return retval;
    }, "pointer", ["pointer", "int"]));
    var dlsym = new NativeFunction(dlsymRef, "pointer", ["pointer", "pointer"]);
    Interceptor.attach(dlsym, {
      onEnter: function onEnter(args) {
        var SYMBOL_INDEX = 1;
        this.handle = ptr(args[HANDLE_INDEX].toString());

        if (libBlacklist.has(this.handle)) {
          return;
        }

        this.symbol = args[SYMBOL_INDEX].readCString();
      },
      onLeave: function onLeave(retval) {
        var _this = this;

        if (retval.isNull() || libBlacklist.has(this.handle)) {
          return;
        }

        var config = config_1.Config.getInstance();
        var EMPTY_ARRAY_LEN = 0;

        if (config.includeExport.length > EMPTY_ARRAY_LEN) {
          var included = config.includeExport.filter(function (i) {
            return _this.symbol.includes(i);
          });

          if (included.length === EMPTY_ARRAY_LEN) {
            return;
          }
        }

        if (config.excludeExport.length > EMPTY_ARRAY_LEN) {
          var excluded = config.excludeExport.filter(function (e) {
            return _this.symbol.includes(e);
          });

          if (excluded.length > EMPTY_ARRAY_LEN) {
            return;
          }
        }

        if (!trackedLibs.has(this.handle)) {
          // Android 7 and above miss the initial dlopen call.
          // Give it another chance in dlsym.
          var mod = Process.findModuleByAddress(retval);

          if (mod !== null && checkLibrary(mod.path)) {
            trackedLibs.set(this.handle, true);
          }
        }

        if (trackedLibs.has(this.handle)) {
          var symbol = this.symbol;

          if (symbol === "JNI_OnLoad") {
            interceptJNIOnLoad(ptr(retval.toString()));
          } else if (symbol.startsWith("Java_")) {
            interceptJNIFunction(ptr(retval.toString()));
          }
        } else {
          var name = config.libraries[HANDLE_INDEX];

          if (name !== "*") {
            var _mod = Process.findModuleByAddress(retval);

            if (_mod === null) {
              return;
            }

            name = _mod.name;
          }

          if (/lib.+\.so/.exec(name) === null) {
            return;
          }

          if (config.libraries.includes(name) || name === "*") {
            interceptJNIFunction(ptr(retval.toString()));
          }
        }
      }
    });
    var dlclose = new NativeFunction(dlcloseRef, "int", ["pointer"]);
    Interceptor.attach(dlclose, {
      onEnter: function onEnter(args) {
        var handle = args[HANDLE_INDEX].toString();

        if (trackedLibs.has(handle)) {
          this.handle = handle;
        }
      },
      onLeave: function onLeave(retval) {
        if (this.handle !== undefined) {
          if (retval.isNull()) {
            trackedLibs["delete"](this.handle);
          }
        }
      }
    });
  }
}

exports.run = run;

},{".":128,"./jni/arm/jni_env_interceptor_arm":130,"./jni/arm64/jni_env_interceptor_arm64":131,"./jni/java_vm_interceptor":133,"./jni/jni_thread_manager":136,"./jni/x64/jni_env_interceptor_x64":137,"./jni/x86/jni_env_interceptor_x86":138,"./utils/config":139,"./utils/reference_manager":142,"@babel/runtime-corejs2/core-js/map":6,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],128:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
  return mod && mod.__esModule ? mod : {
    "default": mod
  };
};

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var config_1 = require("./utils/config");

exports.Config = config_1.Config;

var config_builder_1 = require("./utils/config_builder");

exports.ConfigBuilder = config_builder_1.ConfigBuilder;

var jni_callback_manager_1 = require("./internal/jni_callback_manager");

var jni_method_1 = require("./jni/jni_method");

exports.JNIMethod = jni_method_1.JNIMethod;

var java_method_1 = require("./utils/java_method");

exports.JavaMethod = java_method_1.JavaMethod;

var jni_env_json_1 = __importDefault(require("./data/jni_env.json"));

var java_vm_json_1 = __importDefault(require("./data/java_vm.json"));
/* eslint-disable @typescript-eslint/no-require-imports */


var engine = require("./engine");
/* eslint-enable @typescript-eslint/no-require-imports */


var globalCallbackManager = new jni_callback_manager_1.JNICallbackManager();
/**
 * Wrapper class for return values from a traced JNI API call.
 */

var JNINativeReturnValue = /*#__PURE__*/function () {
  function JNINativeReturnValue(value) {
    this.value = value;
  }
  /**
   * Get the return value of the JNI call.
   */


  var _proto = JNINativeReturnValue.prototype;

  _proto.get = function get() {
    return this.value;
  }
  /**
   * Replace the value returned by the JNI API call. Using replace
   * will change the return of the callee to the provided value.
   *
   * @param value - the new value that should be returned
   */
  ;

  _proto.replace = function replace(value) {
    this.value = value;
  };

  return JNINativeReturnValue;
}();

exports.JNINativeReturnValue = JNINativeReturnValue;
/**
 * Listener on a JNI API intercept. Allows that intercept to later
 * be stopped.
 */

var JNIInvocationListener = /*#__PURE__*/function () {
  function JNIInvocationListener(callbacks, method) {
    this.callbacks = callbacks;
    this.method = method;
  }
  /**
   * Detatch the JNI API intercept.
   */


  var _proto2 = JNIInvocationListener.prototype;

  _proto2.detach = function detach() {
    if (this.callbacks.has(this.method)) {
      this.callbacks["delete"](this.method);
    }
  };

  return JNIInvocationListener;
}();

exports.JNIInvocationListener = JNIInvocationListener;
/* eslint-disable @typescript-eslint/no-namespace */

/**
 * Intercepts JNI API calls through the Frida Interceptor. This module is
 * designed to mirror closely the syntax and semantics of the Frida
 * Interceptor.
 */

var JNIInterceptor;

(function (JNIInterceptor) {
  var callbackManager = globalCallbackManager;
  /**
   * Intercepts calls to the given JNI API `method`. This method must be the
   * name of the a method in either the JNIEnv struct or the JavaVM struct.
   *
   *
   * @param method - name of the JNI method to intercept
   * @param callback - a callback with an onEnter and/or onLeave
   * @returns a listener object to detach the intercept
   */

  function attach(method, callback) {
    for (var i = 4; i < jni_env_json_1["default"].length; i++) {
      var element = jni_env_json_1["default"][i];

      if (element.name === method) {
        return callbackManager.addCallback(method, callback);
      }
    }

    for (var _i = 3; _i < java_vm_json_1["default"].length; _i++) {
      var _element = java_vm_json_1["default"][_i];

      if (_element.name === method) {
        return callbackManager.addCallback(method, callback);
      }
    }

    throw new Error("Method name (" + method + ") is not a valid JNI method.");
  }

  JNIInterceptor.attach = attach;
  /**
   * Detatch all current JNIIntercepts.
   */

  function detatchAll() {
    callbackManager.clear();
  }

  JNIInterceptor.detatchAll = detatchAll;
})(JNIInterceptor || (JNIInterceptor = {}));

exports.JNIInterceptor = JNIInterceptor;
var JNILibraryWatcher;

(function (JNILibraryWatcher) {
  var callback;
  /**
   * Set a callback to listen to new library loaded events. The callback
   * will be triggered whenever a new library load is detected by JNI trace.
   * The callback will provide the full path to the library being loaded.
   *
   * @param callback - the listener for library load events
   */

  function setCallback(cb) {
    callback = cb;
  }

  JNILibraryWatcher.setCallback = setCallback;

  function doCallback(library) {
    var _callback;

    if (((_callback = callback) == null ? void 0 : _callback.onLoaded) !== undefined) {
      callback.onLoaded(library);
    }
  }

  JNILibraryWatcher.doCallback = doCallback;
})(JNILibraryWatcher || (JNILibraryWatcher = {}));

exports.JNILibraryWatcher = JNILibraryWatcher;
/* eslint-enable @typescript-eslint/no-namespace */

engine.run(globalCallbackManager);

},{"./data/java_vm.json":125,"./data/jni_env.json":126,"./engine":127,"./internal/jni_callback_manager":129,"./jni/jni_method":135,"./utils/config":139,"./utils/config_builder":140,"./utils/java_method":141,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],129:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var __1 = require("..");

var __2 = require("..");

var JNICallbackManager = /*#__PURE__*/function () {
  function JNICallbackManager() {
    this.callbacks = new _map["default"]();
  }

  var _proto = JNICallbackManager.prototype;

  _proto.addCallback = function addCallback(method, callback) {
    if (!this.callbacks.has(method)) {
      this.callbacks.set(method, callback);
      return new __1.JNIInvocationListener(this.callbacks, method);
    } else {
      throw new Error("Callback already exists for " + method + " please detach first.");
    }
  };

  _proto.doBeforeCallback = function doBeforeCallback(method, ctx, args) {
    if (this.callbacks.has(method)) {
      var cb = this.callbacks.get(method);

      if ((cb == null ? void 0 : cb.onEnter) !== undefined) {
        cb.onEnter.call(ctx, args);
      }
    }
  };

  _proto.doAfterCallback = function doAfterCallback(method, ctx, retval) {
    if (this.callbacks.has(method)) {
      var cb = this.callbacks.get(method);

      if ((cb == null ? void 0 : cb.onLeave) !== undefined) {
        var wrappedRet = new __2.JNINativeReturnValue(retval);
        cb.onLeave.call(ctx, wrappedRet);

        if (wrappedRet.get() !== retval) {
          retval = wrappedRet.get();
        }
      }
    }

    return retval;
  };

  _proto.clear = function clear() {
    this.callbacks.clear();
  };

  return JNICallbackManager;
}();

exports.JNICallbackManager = JNICallbackManager;

},{"..":128,"@babel/runtime-corejs2/core-js/map":6,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],130:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _construct = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/construct"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));

var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inheritsLoose"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

function _createSuper(Derived) {
  return function () {
    var Super = (0, _getPrototypeOf2["default"])(Derived),
        result;

    if (_isNativeReflectConstruct()) {
      var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor;
      result = (0, _construct["default"])(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }

    return (0, _possibleConstructorReturn2["default"])(this, result);
  };
}

function _isNativeReflectConstruct() {
  if (typeof Reflect === "undefined" || !_construct["default"]) return false;
  if (_construct["default"].sham) return false;
  if (typeof Proxy === "function") return true;

  try {
    Date.prototype.toString.call((0, _construct["default"])(Date, [], function () {}));
    return true;
  } catch (e) {
    return false;
  }
}

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var jni_env_interceptor_1 = require("../jni_env_interceptor");

var types_1 = require("../../utils/types");

var JNIEnvInterceptorARM = /*#__PURE__*/function (_jni_env_interceptor_) {
  (0, _inheritsLoose2["default"])(JNIEnvInterceptorARM, _jni_env_interceptor_);

  var _super = _createSuper(JNIEnvInterceptorARM);

  function JNIEnvInterceptorARM(references, threads, callbackManager) {
    var _this;

    _this = _jni_env_interceptor_.call(this, references, threads, callbackManager) || this;
    _this.vaList = NULL;
    _this.vaListOffset = 0;
    return _this;
  }

  var _proto = JNIEnvInterceptorARM.prototype;

  _proto.createStubFunction = function createStubFunction() {
    var stub = Memory.alloc(Process.pageSize);
    Memory.patchCode(stub, Process.pageSize, function (code) {
      var cw = new ArmWriter(code, {
        pc: stub
      }); // push { lr }

      var PUSH_LR = 0xe52de004;
      cw.putInstruction(PUSH_LR); // pop { pc }

      var POP_PC = 0xe49df004;
      cw.putInstruction(POP_PC);
    });
    return stub;
  };

  _proto.buildVaArgParserShellcode = function buildVaArgParserShellcode(text, _, parser) {
    var DATA_OFFSET = 0x400;
    text.add(DATA_OFFSET).writePointer(parser);
    Memory.patchCode(text, Process.pageSize, function (code) {
      var cw = new ArmWriter(code, {
        pc: text
      }); // nops for the context interceptor to overwrite

      cw.putNop();
      cw.putNop();
      cw.putNop();
      cw.putNop(); // str r0, [pc, #0x400]

      var STR_R0_400 = 0xe58f0400;
      cw.putInstruction(STR_R0_400); // str r1, [pc, #0x400]

      var STR_R1_400 = 0xe58f1400;
      cw.putInstruction(STR_R1_400); // str r2, [pc, #0x400]

      var STR_R2_400 = 0xe58f2400;
      cw.putInstruction(STR_R2_400); // str r3, [pc, #0x400]

      var STR_R3_400 = 0xe58f3400;
      cw.putInstruction(STR_R3_400); // str lr, [pc, #0x400]

      var STR_LR_400 = 0xe58fe400;
      cw.putInstruction(STR_LR_400); // ldr r0, [pc, #0x3e4]

      var LDR_R0_3E4 = 0xe59f03d4;
      cw.putInstruction(LDR_R0_3E4); // blx r0

      var BLX_R0 = 0xe12fff30;
      cw.putInstruction(BLX_R0); // ldr r1, [pc, 0x3e0]

      var LDR_R1_3E0 = 0xe59f13e8;
      cw.putInstruction(LDR_R1_3E0); // ldr r2, [pc, 0x3e0]

      var LDR_R2_3E0 = 0xe59f23e8;
      cw.putInstruction(LDR_R2_3E0); // ldr r3, [pc, 0x3e0]

      var LDR_R3_3E0 = 0xe59f33e8;
      cw.putInstruction(LDR_R3_3E0); //blx r0

      cw.putInstruction(BLX_R0); // ldr r1, [pc, #0x3e4]

      var LDR_R1_3E4 = 0xe59f13e4;
      cw.putInstruction(LDR_R1_3E4); // bx r1

      var BX_R1 = 0xe12fff11;
      cw.putInstruction(BX_R1);
      cw.flush();
    });
  };

  _proto.setUpVaListArgExtract = function setUpVaListArgExtract(vaList) {
    this.vaList = vaList;
    this.vaListOffset = 0;
  };

  _proto.extractVaListArgValue = function extractVaListArgValue(method, paramId) {
    var currentPtr = this.vaList.add(this.vaListOffset);
    this.vaListOffset += types_1.Types.sizeOf(method.fridaParams[paramId]);
    return currentPtr;
  };

  _proto.resetVaListArgExtract = function resetVaListArgExtract() {
    this.vaList = NULL;
    this.vaListOffset = 0;
  };

  return JNIEnvInterceptorARM;
}(jni_env_interceptor_1.JNIEnvInterceptor);

exports.JNIEnvInterceptorARM = JNIEnvInterceptorARM;

},{"../../utils/types":143,"../jni_env_interceptor":134,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/core-js/reflect/construct":11,"@babel/runtime-corejs2/helpers/getPrototypeOf":17,"@babel/runtime-corejs2/helpers/inheritsLoose":18,"@babel/runtime-corejs2/helpers/interopRequireDefault":19,"@babel/runtime-corejs2/helpers/possibleConstructorReturn":20}],131:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _construct = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/construct"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));

var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inheritsLoose"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

function _createSuper(Derived) {
  return function () {
    var Super = (0, _getPrototypeOf2["default"])(Derived),
        result;

    if (_isNativeReflectConstruct()) {
      var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor;
      result = (0, _construct["default"])(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }

    return (0, _possibleConstructorReturn2["default"])(this, result);
  };
}

function _isNativeReflectConstruct() {
  if (typeof Reflect === "undefined" || !_construct["default"]) return false;
  if (_construct["default"].sham) return false;
  if (typeof Proxy === "function") return true;

  try {
    Date.prototype.toString.call((0, _construct["default"])(Date, [], function () {}));
    return true;
  } catch (e) {
    return false;
  }
}

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var jni_env_interceptor_1 = require("../jni_env_interceptor");

var JNIEnvInterceptorARM64 = /*#__PURE__*/function (_jni_env_interceptor_) {
  (0, _inheritsLoose2["default"])(JNIEnvInterceptorARM64, _jni_env_interceptor_);

  var _super = _createSuper(JNIEnvInterceptorARM64);

  function JNIEnvInterceptorARM64(references, threads, callbackManager) {
    var _this;

    _this = _jni_env_interceptor_.call(this, references, threads, callbackManager) || this;
    _this.stack = NULL;
    _this.stackIndex = 0;
    _this.grTop = NULL;
    _this.vrTop = NULL;
    _this.grOffs = 0;
    _this.grOffsIndex = 0;
    _this.vrOffs = 0;
    _this.vrOffsIndex = 0;
    return _this;
  }

  var _proto = JNIEnvInterceptorARM64.prototype;

  _proto.createStubFunction = function createStubFunction() {
    var stub = Memory.alloc(Process.pageSize);
    Memory.patchCode(stub, Process.pageSize, function (code) {
      var cw = new Arm64Writer(code, {
        pc: stub
      }); // ret

      var RET = 0xd65f03c0;
      cw.putInstruction(RET);
    });
    return stub;
  };

  _proto.buildVaArgParserShellcode = function buildVaArgParserShellcode(text, _, parser) {
    var DATA_OFFSET = 0x400;
    var BITS_IN_BYTE = 8;
    var HALF = 2;
    var NUM_REGS = 31;
    var NUM_REG_NO_LR = 30;
    text.add(DATA_OFFSET).writePointer(parser);
    Memory.patchCode(text, Process.pageSize, function (code) {
      var cw = new Arm64Writer(code, {
        pc: text
      }); // adrp x0, #0

      var ADRP_X0_0 = 0x90000000;
      cw.putInstruction(ADRP_X0_0); // back up all registers - just to be safe

      for (var i = 1; i < NUM_REGS; i++) {
        var ins = 0xF9000000; // src reg

        ins += i;
        var base = 0x408;
        var offset = base + i * Process.pointerSize; // dst address

        ins += offset / HALF << BITS_IN_BYTE; // str x<n>, [x0, #<offset>]

        cw.putInstruction(ins);
      } // ldr x0, [x0, #0x400]


      var LDR_X0_X0_400 = 0xF9420000;
      cw.putInstruction(LDR_X0_X0_400); // blr x0

      var BLR_X0 = 0xD63F0000;
      cw.putInstruction(BLR_X0);
      cw.putPushRegReg("x0", "sp"); // adrp x0, #0

      cw.putInstruction(ADRP_X0_0); // restore all registers - apart from lr and sp

      for (var _i = 1; _i < NUM_REG_NO_LR; _i++) {
        var _ins = 0xF9400000; // src reg

        _ins += _i;
        var _base = 0x408;

        var _offset = _base + _i * Process.pointerSize; // dst address


        _ins += _offset / HALF << BITS_IN_BYTE; // ldr x<n>, [x0, #<offset>]

        cw.putInstruction(_ins);
      }

      cw.putPopRegReg("x0", "sp"); // blr x0

      cw.putInstruction(BLR_X0); // adrp x1, #0

      var ADRP_X1_0 = 0x90000001;
      cw.putInstruction(ADRP_X1_0); // ldr x2, [x1, #0x4f8]

      var LDR_X2_X1_4F8 = 0xF9427C22;
      cw.putInstruction(LDR_X2_X1_4F8); // br x2

      var BR_X2 = 0xD61F0040;
      cw.putInstruction(BR_X2);
      cw.flush();
    });
  };

  _proto.setUpVaListArgExtract = function setUpVaListArgExtract(vaList) {
    var vrStart = 2;
    var grOffset = 3;
    var vrOffset = 4;
    this.stack = vaList.readPointer();
    this.stackIndex = 0;
    this.grTop = vaList.add(Process.pointerSize).readPointer();
    this.vrTop = vaList.add(Process.pointerSize * vrStart).readPointer();
    this.grOffs = vaList.add(Process.pointerSize * grOffset).readS32();
    this.grOffsIndex = 0;
    this.vrOffs = vaList.add(Process.pointerSize * grOffset + vrOffset).readS32();
    this.vrOffsIndex = 0;
  };

  _proto.extractVaListArgValue = function extractVaListArgValue(method, paramId) {
    var MAX_VR_REG_NUM = 8;
    var VR_REG_SIZE = 2;
    var MAX_GR_REG_NUM = 4;
    var currentPtr = NULL;

    if (method.fridaParams[paramId] === "float" || method.fridaParams[paramId] === "double") {
      if (this.vrOffsIndex < MAX_VR_REG_NUM) {
        currentPtr = this.vrTop.add(this.vrOffs).add(this.vrOffsIndex * Process.pointerSize * VR_REG_SIZE);
        this.vrOffsIndex++;
      } else {
        currentPtr = this.stack.add(this.stackIndex * Process.pointerSize);
        this.stackIndex++;
      }
    } else {
      if (this.grOffsIndex < MAX_GR_REG_NUM) {
        currentPtr = this.grTop.add(this.grOffs).add(this.grOffsIndex * Process.pointerSize);
        this.grOffsIndex++;
      } else {
        currentPtr = this.stack.add(this.stackIndex * Process.pointerSize);
        this.stackIndex++;
      }
    }

    return currentPtr;
  };

  _proto.resetVaListArgExtract = function resetVaListArgExtract() {
    this.stack = NULL;
    this.stackIndex = 0;
    this.grTop = NULL;
    this.vrTop = NULL;
    this.grOffs = 0;
    this.grOffsIndex = 0;
    this.vrOffs = 0;
    this.vrOffsIndex = 0;
  };

  return JNIEnvInterceptorARM64;
}(jni_env_interceptor_1.JNIEnvInterceptor);

exports.JNIEnvInterceptorARM64 = JNIEnvInterceptorARM64;

},{"../jni_env_interceptor":134,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/core-js/reflect/construct":11,"@babel/runtime-corejs2/helpers/getPrototypeOf":17,"@babel/runtime-corejs2/helpers/inheritsLoose":18,"@babel/runtime-corejs2/helpers/interopRequireDefault":19,"@babel/runtime-corejs2/helpers/possibleConstructorReturn":20}],132:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
  return mod && mod.__esModule ? mod : {
    "default": mod
  };
};

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var java_vm_json_1 = __importDefault(require("../data/java_vm.json"));

var JavaVM = /*#__PURE__*/function () {
  function JavaVM() {
    this._methods = java_vm_json_1["default"];
  }

  JavaVM.getInstance = function getInstance() {
    if (JavaVM.instance === undefined) {
      JavaVM.instance = new JavaVM();
    }

    return JavaVM.instance;
  };

  (0, _createClass2["default"])(JavaVM, [{
    key: "methods",
    get: function get() {
      return this._methods;
    }
  }]);
  return JavaVM;
}();

exports.JavaVM = JavaVM;

},{"../data/java_vm.json":125,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/createClass":16,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],133:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var java_vm_1 = require("./java_vm");

var types_1 = require("../utils/types");

var config_1 = require("../utils/config");

var JAVA_VM_INDEX = 0;
var JNI_OK = 0;
var JNI_ENV_INDEX = 1;

var JavaVMInterceptor = /*#__PURE__*/function () {
  function JavaVMInterceptor(references, threads, jniEnvInterceptor, callbackManager) {
    this.references = references;
    this.threads = threads;
    this.jniEnvInterceptor = jniEnvInterceptor;
    this.callbackManager = callbackManager;
    this.shadowJavaVM = NULL;
  }

  var _proto = JavaVMInterceptor.prototype;

  _proto.isInitialised = function isInitialised() {
    return !this.shadowJavaVM.isNull();
  };

  _proto.get = function get() {
    return this.shadowJavaVM;
  };

  _proto.create = function create() {
    var javaVMOffset = 3;
    var javaVMLength = 8;
    var javaVM = this.threads.getJavaVM();
    var newJavaVMStruct = Memory.alloc(Process.pointerSize * javaVMLength);
    this.references.add(newJavaVMStruct);
    var newJavaVM = Memory.alloc(Process.pointerSize);
    newJavaVM.writePointer(newJavaVMStruct);

    for (var i = javaVMOffset; i < javaVMLength; i++) {
      var offset = i * Process.pointerSize;
      var javaVMStruct = javaVM.readPointer();
      var methodAddr = javaVMStruct.add(offset).readPointer();
      var callback = this.createJavaVMIntercept(i, methodAddr);
      var trampoline = this.jniEnvInterceptor.createStubFunction();
      this.references.add(trampoline); // ensure the CpuContext will be populated

      Interceptor.replace(trampoline, callback);
      newJavaVMStruct.add(offset).writePointer(trampoline);
    }

    this.shadowJavaVM = newJavaVM;
    return newJavaVM;
  };

  _proto.createJavaVMIntercept = function createJavaVMIntercept(id, methodAddr) {
    var self = this;
    var method = java_vm_1.JavaVM.getInstance().methods[id];
    var config = config_1.Config.getInstance();
    var fridaArgs = method.args.map(function (a) {
      return types_1.Types.convertNativeJTypeToFridaType(a);
    });
    var fridaRet = types_1.Types.convertNativeJTypeToFridaType(method.ret);
    var nativeFunction = new NativeFunction(methodAddr, fridaRet, fridaArgs);
    var nativeCallback = new NativeCallback(function () {
      var threadId = this.threadId;
      var javaVM = self.threads.getJavaVM();
      var localArgs = [].slice.call(arguments);
      var jniEnv = NULL;
      localArgs[JAVA_VM_INDEX] = javaVM;
      var ctx = {
        methodDef: method,
        jniAddress: methodAddr,
        threadId: threadId
      };

      if (config.backtrace === "accurate") {
        ctx.backtrace = Thread.backtrace(this.context, Backtracer.ACCURATE);
      } else if (config.backtrace === "fuzzy") {
        ctx.backtrace = Thread.backtrace(this.context, Backtracer.FUZZY);
      }

      self.callbackManager.doBeforeCallback(method.name, ctx, localArgs);
      var ret = nativeFunction.apply(null, localArgs);
      ret = self.callbackManager.doAfterCallback(method.name, ctx, ret);

      if (method.name === "GetEnv" || method.name === "AttachCurrentThread" || method.name === "AttachCurrentThreadAsDaemon") {
        if (ret === JNI_OK) {
          self.threads.setJNIEnv(threadId, localArgs[JNI_ENV_INDEX].readPointer());
        }

        if (!self.jniEnvInterceptor.isInitialised()) {
          jniEnv = self.jniEnvInterceptor.create();
        } else {
          jniEnv = self.jniEnvInterceptor.get();
        }

        localArgs[JNI_ENV_INDEX].writePointer(jniEnv);
      }

      return ret;
    }, fridaRet, fridaArgs);
    this.references.add(nativeCallback);
    return nativeCallback;
  };

  return JavaVMInterceptor;
}();

exports.JavaVMInterceptor = JavaVMInterceptor;

},{"../utils/config":139,"../utils/types":143,"./java_vm":132,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],134:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
  return mod && mod.__esModule ? mod : {
    "default": mod
  };
};

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var jni_env_json_1 = __importDefault(require("../data/jni_env.json"));

var types_1 = require("../utils/types");

var java_method_1 = require("../utils/java_method");

var config_1 = require("../utils/config");

var TYPE_NAME_START = 0;
var TYPE_NAME_END = -1;
var COPY_ARRAY_INDEX = 0;
var JNI_ENV_INDEX = 0;

var JNIEnvInterceptor = /*#__PURE__*/function () {
  function JNIEnvInterceptor(references, threads, callbackManager) {
    this.references = references;
    this.threads = threads;
    this.callbackManager = callbackManager;
    this.javaVMInterceptor = null;
    this.shadowJNIEnv = NULL;
    this.methods = new _map["default"]();
    this.fastMethodLookup = new _map["default"]();
    this.vaArgsBacktraces = new _map["default"]();
  }

  var _proto = JNIEnvInterceptor.prototype;

  _proto.isInitialised = function isInitialised() {
    return !this.shadowJNIEnv.equals(NULL);
  };

  _proto.get = function get() {
    return this.shadowJNIEnv;
  };

  _proto.create = function create() {
    var END_INDEX = 1;
    var threadId = Process.getCurrentThreadId();
    var jniEnv = this.threads.getJNIEnv(threadId);
    var jniEnvOffset = 4;
    var jniEnvLength = 232;
    var newJNIEnvStruct = Memory.alloc(Process.pointerSize * jniEnvLength);
    this.references.add(newJNIEnvStruct);
    var newJNIEnv = Memory.alloc(Process.pointerSize);
    newJNIEnv.writePointer(newJNIEnvStruct);
    this.references.add(newJNIEnv);

    for (var i = jniEnvOffset; i < jniEnvLength; i++) {
      var method = jni_env_json_1["default"][i];
      var offset = i * Process.pointerSize;
      var jniEnvStruct = jniEnv.readPointer();
      var methodAddr = jniEnvStruct.add(offset).readPointer();

      if (method.args[method.args.length - END_INDEX] === "...") {
        var callback = this.createJNIVarArgIntercept(i, methodAddr);
        var trampoline = this.createStubFunction();
        this.references.add(trampoline); // ensure the CpuContext will be populated

        Interceptor.replace(trampoline, callback);
        newJNIEnvStruct.add(offset).writePointer(trampoline);
      } else {
        var _callback = this.createJNIIntercept(i, methodAddr);

        var _trampoline = this.createStubFunction();

        this.references.add(_trampoline); // ensure the CpuContext will be populated

        Interceptor.replace(_trampoline, _callback);
        newJNIEnvStruct.add(offset).writePointer(_trampoline);
      }
    }

    this.shadowJNIEnv = newJNIEnv;
    return newJNIEnv;
  };

  _proto.setJavaVMInterceptor = function setJavaVMInterceptor(javaVMInterceptor) {
    this.javaVMInterceptor = javaVMInterceptor;
  };

  _proto.createStubFunction = function createStubFunction() {
    // eslint-disable-next-line @typescript-eslint/no-empty-function
    return new NativeCallback(function () {}, "void", []);
  };

  _proto.createJNIVarArgIntercept = function createJNIVarArgIntercept(id, methodPtr) {
    var self = this;
    var method = jni_env_json_1["default"][id];
    var text = Memory.alloc(Process.pageSize);
    var data = Memory.alloc(Process.pageSize);
    this.references.add(text);
    this.references.add(data);
    var vaArgsCallback = this.createJNIVarArgInitialCallback(method, methodPtr);
    this.references.add(vaArgsCallback);
    self.buildVaArgParserShellcode(text, data, vaArgsCallback);
    var config = config_1.Config.getInstance();
    Interceptor.attach(text, function () {
      var backtraceType = Backtracer.ACCURATE;

      if (config.backtrace === "fuzzy") {
        backtraceType = config.backtrace;
      }

      self.vaArgsBacktraces.set(this.threadId, Thread.backtrace(this.context, backtraceType));
    });
    return text;
  };

  _proto.addJavaArgsForJNIIntercept = function addJavaArgsForJNIIntercept(method, args) {
    var LAST_INDEX = -1;
    var FIRST_INDEX = 0;
    var METHOD_ID_INDEX = 2;
    var NON_VIRTUAL_METHOD_ID_INDEX = 3;
    var methodIndex = METHOD_ID_INDEX;

    if (method.name.includes("Nonvirtual")) {
      methodIndex = NON_VIRTUAL_METHOD_ID_INDEX;
    }

    var lastParamType = method.args.slice(LAST_INDEX)[FIRST_INDEX];

    if (!["va_list", "jvalue*"].includes(lastParamType)) {
      return args.slice(COPY_ARRAY_INDEX);
    }

    var clonedArgs = args.slice(COPY_ARRAY_INDEX);
    var midPtr = args[methodIndex];

    if (!this.methods.has(midPtr.toString())) {
      send({
        type: "error",
        message: "Failed to find corresponding method ID " + "for method \"" + method.name + "\" call."
      });
      return args.slice(COPY_ARRAY_INDEX);
    }

    var javaMethod = this.methods.get(midPtr.toString());
    var nativeJTypes = javaMethod.nativeParams;
    var readPtr = args.slice(LAST_INDEX)[FIRST_INDEX];

    if (lastParamType === "va_list") {
      this.setUpVaListArgExtract(readPtr);
    }

    var UNION_SIZE = 8;

    for (var i = 0; i < nativeJTypes.length; i++) {
      var type = types_1.Types.convertNativeJTypeToFridaType(nativeJTypes[i]);
      var val = void 0;

      if (lastParamType === "va_list") {
        var currentPtr = this.extractVaListArgValue(javaMethod, i);
        val = this.readValue(currentPtr, type, true);
      } else {
        val = this.readValue(readPtr.add(UNION_SIZE * i), type);
      }

      clonedArgs.push(val);
    }

    if (lastParamType === "va_list") {
      this.resetVaListArgExtract();
    }

    return clonedArgs;
  };

  _proto.handleGetMethodResult = function handleGetMethodResult(args, ret) {
    var SIG_INDEX = 3;
    var signature = args[SIG_INDEX].readCString();

    if (signature !== null) {
      var methodSig = new java_method_1.JavaMethod(signature);
      this.methods.set(ret.toString(), methodSig);
    }
  };

  _proto.handleGetJavaVM = function handleGetJavaVM(args, ret) {
    if (this.javaVMInterceptor !== null) {
      var JNI_OK = 0;
      var JAVA_VM_INDEX = 1;

      if (ret === JNI_OK) {
        var javaVMPtr = args[JAVA_VM_INDEX];
        this.threads.setJavaVM(javaVMPtr.readPointer());
        var javaVM;

        if (!this.javaVMInterceptor.isInitialised()) {
          javaVM = this.javaVMInterceptor.create();
        } else {
          javaVM = this.javaVMInterceptor.get();
        }

        javaVMPtr.writePointer(javaVM);
      }
    }
  };

  _proto.handleRegisterNatives = function handleRegisterNatives(args) {
    var METHOD_INDEX = 2;
    var SIZE_INDEX = 3;
    var JNI_METHOD_SIZE = 3;
    var self = this;
    var methods = args[METHOD_INDEX];
    var size = args[SIZE_INDEX];

    var _loop = function _loop(i) {
      var methodsPtr = methods;
      var namePtr = methodsPtr.add(i * Process.pointerSize).readPointer();
      var name = namePtr.readCString();
      var sigOffset = 1;
      var sigPtr = methodsPtr.add((i + sigOffset) * Process.pointerSize).readPointer();
      var sig = sigPtr.readCString();
      var addrOffset = 2;
      var addr = methodsPtr.add((i + addrOffset) * Process.pointerSize).readPointer();

      if (name === null || sig === null) {
        return "continue";
      }

      Interceptor.attach(addr, {
        onEnter: function onEnter(args) {
          var check = name + sig;
          var config = config_1.Config.getInstance();
          var EMPTY_ARRAY_LEN = 0;

          if (config.includeExport.length > EMPTY_ARRAY_LEN) {
            var included = config.includeExport.filter(function (i) {
              return check.includes(i);
            });

            if (included.length === EMPTY_ARRAY_LEN) {
              return;
            }
          }

          if (config.excludeExport.length > EMPTY_ARRAY_LEN) {
            var excluded = config.excludeExport.filter(function (e) {
              return check.includes(e);
            });

            if (excluded.length > EMPTY_ARRAY_LEN) {
              return;
            }
          }

          if (!self.threads.hasJNIEnv(this.threadId)) {
            self.threads.setJNIEnv(this.threadId, args[JNI_ENV_INDEX]);
          }

          args[JNI_ENV_INDEX] = self.shadowJNIEnv;
        }
      });
    };

    for (var i = 0; i < size * JNI_METHOD_SIZE; i += JNI_METHOD_SIZE) {
      var _ret = _loop(i);

      if (_ret === "continue") continue;
    }
  };

  _proto.handleJNIInterceptResult = function handleJNIInterceptResult(method, args, ret) {
    var name = method.name;

    if (["GetMethodID", "GetStaticMethodID"].includes(name)) {
      this.handleGetMethodResult(args, ret);
    } else if (method.name === "GetJavaVM") {
      this.handleGetJavaVM(args, ret);
    } else if (method.name === "RegisterNatives") {
      this.handleRegisterNatives(args);
    }
  };

  _proto.createJNIIntercept = function createJNIIntercept(id, methodPtr) {
    var self = this;
    var METHOD_ID_INDEX = 2;
    var method = jni_env_json_1["default"][id];
    var config = config_1.Config.getInstance();
    var paramTypes = method.args.map(function (t) {
      return types_1.Types.convertNativeJTypeToFridaType(t);
    });
    var retType = types_1.Types.convertNativeJTypeToFridaType(method.ret);
    var nativeFunction = new NativeFunction(methodPtr, retType, paramTypes);
    var nativeCallback = new NativeCallback(function () {
      var threadId = this.threadId;
      var jniEnv = self.threads.getJNIEnv(threadId);
      var args = [].slice.call(arguments);
      args[JNI_ENV_INDEX] = jniEnv;
      var clonedArgs = self.addJavaArgsForJNIIntercept(method, args);
      var ctx = {
        jniAddress: methodPtr,
        threadId: threadId,
        methodDef: method
      };

      if (config.backtrace === "accurate") {
        ctx.backtrace = Thread.backtrace(this.context, Backtracer.ACCURATE);
      } else if (config.backtrace === "fuzzy") {
        ctx.backtrace = Thread.backtrace(this.context, Backtracer.FUZZY);
      }

      if (args.length !== clonedArgs.length) {
        // eslint-disable-next-line @typescript-eslint/no-base-to-string
        var key = args[METHOD_ID_INDEX].toString();
        ctx.javaMethod = self.methods.get(key);
      }

      self.callbackManager.doBeforeCallback(method.name, ctx, clonedArgs);
      var ret = nativeFunction.apply(null, args);
      ret = self.callbackManager.doAfterCallback(method.name, ctx, ret);
      self.handleJNIInterceptResult(method, args, ret);
      return ret;
    }, retType, paramTypes);
    this.references.add(nativeCallback);
    return nativeCallback;
  };

  _proto.createJNIVarArgMainCallback = function createJNIVarArgMainCallback(method, methodPtr, initialparamTypes, mainParamTypes, retType) {
    var self = this;
    var mainCallback = new NativeCallback(function () {
      var METHOD_ID_INDEX = 2;
      var threadId = this.threadId;
      var args = [].slice.call(arguments);
      var jniEnv = self.threads.getJNIEnv(threadId); // eslint-disable-next-line @typescript-eslint/no-base-to-string

      var key = args[METHOD_ID_INDEX].toString();
      var jmethod = self.methods.get(key);
      args[JNI_ENV_INDEX] = jniEnv;
      var ctx = {
        backtrace: self.vaArgsBacktraces.get(this.threadId),
        jniAddress: methodPtr,
        threadId: threadId,
        methodDef: method,
        javaMethod: jmethod
      };
      self.callbackManager.doBeforeCallback(method.name, ctx, args);
      var ret = new NativeFunction(methodPtr, retType, initialparamTypes).apply(null, args);
      ret = self.callbackManager.doAfterCallback(method.name, ctx, ret);
      self.vaArgsBacktraces["delete"](this.threadId);
      return ret;
    }, retType, mainParamTypes);
    return mainCallback;
  };

  _proto.createJNIVarArgInitialCallback = function createJNIVarArgInitialCallback(method, methodPtr) {
    var self = this;
    var vaArgsCallback = new NativeCallback(function () {
      var METHOD_ID_INDEX = 2; // eslint-disable-next-line @typescript-eslint/no-base-to-string

      var methodId = arguments[METHOD_ID_INDEX].toString();
      var javaMethod = self.methods.get(methodId);

      if (self.fastMethodLookup.has(methodId)) {
        return self.fastMethodLookup.get(methodId);
      }

      var originalParams = method.args.slice(TYPE_NAME_START, TYPE_NAME_END).map(function (t) {
        return types_1.Types.convertNativeJTypeToFridaType(t);
      });
      var callbackParams = originalParams.slice(COPY_ARRAY_INDEX);
      originalParams.push("...");
      javaMethod.fridaParams.forEach(function (p) {
        callbackParams.push(p === "float" ? "double" : p);
        originalParams.push(p);
      });
      var retType = types_1.Types.convertNativeJTypeToFridaType(method.ret);
      var mainCallback = self.createJNIVarArgMainCallback(method, methodPtr, originalParams, callbackParams, retType);
      self.references.add(mainCallback);
      self.fastMethodLookup.set(methodId, mainCallback);
      return mainCallback;
    }, "pointer", ["pointer", "pointer", "pointer"]);
    return vaArgsCallback;
  };

  _proto.readValue = function readValue(currentPtr, type, extend) {
    var val = NULL;

    if (type === "char") {
      val = currentPtr.readS8();
    } else if (type === "int16") {
      val = currentPtr.readS16();
    } else if (type === "uint16") {
      val = currentPtr.readU16();
    } else if (type === "int") {
      val = currentPtr.readS32();
    } else if (type === "int64") {
      val = currentPtr.readS64();
    } else if (type === "float") {
      if (extend === true) {
        val = currentPtr.readDouble();
      } else {
        val = currentPtr.readFloat();
      }
    } else if (type === "double") {
      val = currentPtr.readDouble();
    } else if (type === "pointer") {
      val = currentPtr.readPointer();
    }

    return val;
  };

  return JNIEnvInterceptor;
}();

exports.JNIEnvInterceptor = JNIEnvInterceptor;

},{"../data/jni_env.json":126,"../utils/config":139,"../utils/java_method":141,"../utils/types":143,"@babel/runtime-corejs2/core-js/map":6,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],135:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});
/**
 * Contains a definition of the JNI API method.
 */

var JNIMethod = function JNIMethod(name, args, ret) {
  this.name = name;
  this.args = args;
  this.ret = ret;
};

exports.JNIMethod = JNIMethod;

},{"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],136:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var JNIThreadManager = /*#__PURE__*/function () {
  function JNIThreadManager() {
    this.threads = {};
    this.shadowJavaVM = NULL;
  }

  var _proto = JNIThreadManager.prototype;

  _proto.getJavaVM = function getJavaVM() {
    return this.shadowJavaVM;
  };

  _proto.hasJavaVM = function hasJavaVM() {
    return !this.shadowJavaVM.isNull();
  };

  _proto.setJavaVM = function setJavaVM(javaVM) {
    this.shadowJavaVM = javaVM;
  };

  _proto.getJNIEnv = function getJNIEnv(threadId) {
    if (this.threads[threadId] !== undefined) {
      return this.threads[threadId];
    } else {
      return NULL;
    }
  };

  _proto.hasJNIEnv = function hasJNIEnv(threadId) {
    return !this.getJNIEnv(threadId).isNull();
  };

  _proto.setJNIEnv = function setJNIEnv(threadId, jniEnv) {
    this.createEntry(threadId, jniEnv);
  };

  _proto.needsJNIEnvUpdate = function needsJNIEnvUpdate(threadId, jniEnv) {
    var entry = this.getEntry(threadId);

    if (entry === undefined || !entry.equals(jniEnv)) {
      return true;
    }

    return false;
  };

  _proto.createEntry = function createEntry(threadId, jniEnv) {
    this.threads[threadId] = jniEnv;
  };

  _proto.getEntry = function getEntry(threadId) {
    return this.threads[threadId];
  };

  return JNIThreadManager;
}();

exports.JNIThreadManager = JNIThreadManager;

},{"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],137:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _construct = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/construct"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));

var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inheritsLoose"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

function _createSuper(Derived) {
  return function () {
    var Super = (0, _getPrototypeOf2["default"])(Derived),
        result;

    if (_isNativeReflectConstruct()) {
      var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor;
      result = (0, _construct["default"])(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }

    return (0, _possibleConstructorReturn2["default"])(this, result);
  };
}

function _isNativeReflectConstruct() {
  if (typeof Reflect === "undefined" || !_construct["default"]) return false;
  if (_construct["default"].sham) return false;
  if (typeof Proxy === "function") return true;

  try {
    Date.prototype.toString.call((0, _construct["default"])(Date, [], function () {}));
    return true;
  } catch (e) {
    return false;
  }
}

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var jni_env_interceptor_1 = require("../jni_env_interceptor");

var JNIEnvInterceptorX64 = /*#__PURE__*/function (_jni_env_interceptor_) {
  (0, _inheritsLoose2["default"])(JNIEnvInterceptorX64, _jni_env_interceptor_);

  var _super = _createSuper(JNIEnvInterceptorX64);

  function JNIEnvInterceptorX64(references, threads, callbackManager) {
    var _this;

    _this = _jni_env_interceptor_.call(this, references, threads, callbackManager) || this;
    _this.grOffset = 0;
    _this.grOffsetStart = 0;
    _this.fpOffset = 0;
    _this.fpOffsetStart = 0;
    _this.overflowPtr = NULL;
    _this.dataPtr = NULL;
    return _this;
  }

  var _proto = JNIEnvInterceptorX64.prototype;

  _proto.buildVaArgParserShellcode = function buildVaArgParserShellcode(text, data, parser) {
    Memory.patchCode(text, Process.pageSize, function (code) {
      var cw = new X86Writer(code, {
        pc: text
      });
      var XMM_INC_VALUE = 8;
      var SKIP_FIRST_REG = 1;
      var XMM_MOV_INS_1 = 0x66;
      var XMM_MOV_INS_2 = 0x48;
      var XMM_MOV_INS_3 = 0x0f;
      var XMM_MOV_TO_INS_4 = 0x7e;
      var XMM_MOV_INS_5 = 0xc7;
      var regs = ["rdi", "rsi", "rdx", "rcx", "r8", "r9", "rax", "rbx", "r10", "r11", "r12", "r13", "r14", "r15", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"];
      var dataOffset = 0;
      var xmmOffset = 0;

      for (var i = 0; i < regs.length; i++) {
        cw.putMovNearPtrReg(data.add(dataOffset), "rdi");
        dataOffset += Process.pointerSize;

        if (i < regs.length - SKIP_FIRST_REG) {
          if (regs[i + SKIP_FIRST_REG].includes("xmm")) {
            cw.putU8(XMM_MOV_INS_1);
            cw.putU8(XMM_MOV_INS_2);
            cw.putU8(XMM_MOV_INS_3);
            cw.putU8(XMM_MOV_TO_INS_4);
            cw.putU8(XMM_MOV_INS_5 + xmmOffset * XMM_INC_VALUE);
            xmmOffset++;
          } else {
            cw.putMovRegReg("rdi", regs[i + SKIP_FIRST_REG]);
          }
        }
      }

      xmmOffset--;
      cw.putPopReg("rdi");
      cw.putMovNearPtrReg(data.add(dataOffset), "rdi");
      dataOffset += Process.pointerSize;
      cw.putCallAddress(parser);
      cw.putMovNearPtrReg(data.add(dataOffset), "rax");
      dataOffset += Process.pointerSize;
      var REG_SIZE = 2;
      var END_INDEX = 1;
      var SKIP_FIRST_COPY = 0;
      var FIRST_ELEM_INDEX = 0;
      var XMM_MOV_FROM_INS_4 = 0x6e;
      var regRestoreOffset = dataOffset - Process.pointerSize * REG_SIZE;

      for (var _i = regs.length - END_INDEX; _i >= FIRST_ELEM_INDEX; _i--) {
        regRestoreOffset = _i * Process.pointerSize;
        cw.putMovRegNearPtr("rdi", data.add(regRestoreOffset));

        if (_i > SKIP_FIRST_COPY) {
          if (regs[_i].includes("xmm")) {
            cw.putU8(XMM_MOV_INS_1);
            cw.putU8(XMM_MOV_INS_2);
            cw.putU8(XMM_MOV_INS_3);
            cw.putU8(XMM_MOV_FROM_INS_4);
            cw.putU8(XMM_MOV_INS_5 + xmmOffset * XMM_INC_VALUE);
            xmmOffset--;
          } else {
            cw.putMovRegReg(regs[_i], "rdi");
          }
        }
      }

      cw.putMovNearPtrReg(data.add(dataOffset), "rdi");
      var rdiBackup = dataOffset;
      dataOffset += Process.pointerSize;
      var cbAddressOffset = rdiBackup - Process.pointerSize;
      cw.putMovRegNearPtr("rdi", data.add(cbAddressOffset));
      cw.putMovNearPtrReg(data.add(dataOffset), "r13");
      var r13Backup = dataOffset;
      cw.putMovRegReg("r13", "rdi");
      cw.putMovRegNearPtr("rdi", data.add(rdiBackup));
      cw.putCallReg("r13");
      cw.putMovRegNearPtr("r13", data.add(r13Backup));
      var retAddressOffset = cbAddressOffset - Process.pointerSize;
      cw.putJmpNearPtr(data.add(retAddressOffset));
      cw.flush();
    });
  };

  _proto.setUpVaListArgExtract = function setUpVaListArgExtract(vaList) {
    var FP_OFFSET = 4;
    var DATA_OFFSET = 2;
    this.grOffset = vaList.readU32();
    this.grOffsetStart = this.grOffset;
    this.fpOffset = vaList.add(FP_OFFSET).readU32();
    this.fpOffsetStart = this.fpOffset;
    this.overflowPtr = vaList.add(Process.pointerSize).readPointer();
    this.dataPtr = vaList.add(Process.pointerSize * DATA_OFFSET).readPointer();
  };

  _proto.extractVaListArgValue = function extractVaListArgValue(method, paramId) {
    var FP_REG_SIZE = 2;
    var MAX_GR_REG_NUM = 2;
    var MAX_FP_REG_NUM = 14;
    var OFFSET = 1;
    var currentPtr = NULL;

    if (method.fridaParams[paramId] === "float" || method.fridaParams[paramId] === "double") {
      var fpDelta = this.fpOffset - this.fpOffsetStart;

      if (fpDelta / Process.pointerSize < MAX_FP_REG_NUM) {
        currentPtr = this.dataPtr.add(this.fpOffset);
        this.fpOffset += Process.pointerSize * FP_REG_SIZE;
      } else {
        var reverseId = method.fridaParams.length - paramId - OFFSET;
        currentPtr = this.overflowPtr.add(reverseId * Process.pointerSize);
      }
    } else {
      var grDelta = this.grOffset - this.grOffsetStart;

      if (grDelta / Process.pointerSize < MAX_GR_REG_NUM) {
        currentPtr = this.dataPtr.add(this.grOffset);
        this.grOffset += Process.pointerSize;
      } else {
        var _reverseId = method.fridaParams.length - paramId - OFFSET;

        currentPtr = this.overflowPtr.add(_reverseId * Process.pointerSize);
      }
    }

    return currentPtr;
  };

  _proto.resetVaListArgExtract = function resetVaListArgExtract() {
    this.grOffset = 0;
    this.grOffsetStart = 0;
    this.fpOffset = 0;
    this.fpOffsetStart = 0;
    this.overflowPtr = NULL;
    this.dataPtr = NULL;
  };

  return JNIEnvInterceptorX64;
}(jni_env_interceptor_1.JNIEnvInterceptor);

exports.JNIEnvInterceptorX64 = JNIEnvInterceptorX64;

},{"../jni_env_interceptor":134,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/core-js/reflect/construct":11,"@babel/runtime-corejs2/helpers/getPrototypeOf":17,"@babel/runtime-corejs2/helpers/inheritsLoose":18,"@babel/runtime-corejs2/helpers/interopRequireDefault":19,"@babel/runtime-corejs2/helpers/possibleConstructorReturn":20}],138:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _construct = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/construct"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));

var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inheritsLoose"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

function _createSuper(Derived) {
  return function () {
    var Super = (0, _getPrototypeOf2["default"])(Derived),
        result;

    if (_isNativeReflectConstruct()) {
      var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor;
      result = (0, _construct["default"])(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }

    return (0, _possibleConstructorReturn2["default"])(this, result);
  };
}

function _isNativeReflectConstruct() {
  if (typeof Reflect === "undefined" || !_construct["default"]) return false;
  if (_construct["default"].sham) return false;
  if (typeof Proxy === "function") return true;

  try {
    Date.prototype.toString.call((0, _construct["default"])(Date, [], function () {}));
    return true;
  } catch (e) {
    return false;
  }
}

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var jni_env_interceptor_1 = require("../jni_env_interceptor");

var types_1 = require("../../utils/types");

var JNIEnvInterceptorX86 = /*#__PURE__*/function (_jni_env_interceptor_) {
  (0, _inheritsLoose2["default"])(JNIEnvInterceptorX86, _jni_env_interceptor_);

  var _super = _createSuper(JNIEnvInterceptorX86);

  function JNIEnvInterceptorX86(references, threads, callbackManager) {
    var _this;

    _this = _jni_env_interceptor_.call(this, references, threads, callbackManager) || this;
    _this.vaList = NULL;
    _this.vaListOffset = 0;
    return _this;
  }

  var _proto = JNIEnvInterceptorX86.prototype;

  _proto.buildVaArgParserShellcode = function buildVaArgParserShellcode(text, _, parser) {
    var DATA_OFFSET = 0x400;
    text.add(DATA_OFFSET).writePointer(parser);
    Memory.patchCode(text, Process.pageSize, function (code) {
      var cw = new X86Writer(code, {
        pc: text
      });
      var dataOffset = DATA_OFFSET + Process.pointerSize;
      cw.putPopReg("eax");
      cw.putMovNearPtrReg(text.add(dataOffset + Process.pointerSize), "eax");
      cw.putCallAddress(parser);
      cw.putCallReg("eax");
      cw.putJmpNearPtr(text.add(dataOffset + Process.pointerSize));
      cw.flush();
    });
  };

  _proto.setUpVaListArgExtract = function setUpVaListArgExtract(vaList) {
    this.vaList = vaList;
    this.vaListOffset = 0;
  };

  _proto.extractVaListArgValue = function extractVaListArgValue(method, paramId) {
    var currentPtr = this.vaList.add(this.vaListOffset);
    this.vaListOffset += types_1.Types.sizeOf(method.fridaParams[paramId]);
    return currentPtr;
  };

  _proto.resetVaListArgExtract = function resetVaListArgExtract() {
    this.vaList = NULL;
    this.vaListOffset = 0;
  };

  return JNIEnvInterceptorX86;
}(jni_env_interceptor_1.JNIEnvInterceptor);

exports.JNIEnvInterceptorX86 = JNIEnvInterceptorX86;

},{"../../utils/types":143,"../jni_env_interceptor":134,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/core-js/reflect/construct":11,"@babel/runtime-corejs2/helpers/getPrototypeOf":17,"@babel/runtime-corejs2/helpers/inheritsLoose":18,"@babel/runtime-corejs2/helpers/interopRequireDefault":19,"@babel/runtime-corejs2/helpers/possibleConstructorReturn":20}],139:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var config_builder_1 = require("./config_builder");
/**
 * Config class to store options for the JNIInterception engine to use.
 */


var Config = /*#__PURE__*/function () {
  function Config(builder) {
    this._libraries = builder.libraries;
    this._backtrace = builder.backtrace;
    this._includeExport = builder.includeExports;
    this._excludeExport = builder.excludeExports;
    this._env = builder.env;
    this._vm = builder.vm;
    this._hostInitialised = false;
  }
  /**
   * Get a list of libraries the the JNIInterceptor is attempting to trace.
   */

  /**
   * Returns if the Config has been initialised.
   */


  Config.initialised = function initialised() {
    if (Config.instance === undefined) {
      return false;
    } else {
      return Config.instance._hostInitialised;
    }
  }
  /**
   * Gets an instance of the Config.
   *
   * @param builder - an optional builder if the Config needs to be rebuilt.
   */
  ;

  Config.getInstance = function getInstance(builder) {
    if (builder !== undefined) {
      Config.instance = new Config(builder);
      Config.instance._hostInitialised = true;
    } else if (Config.instance === undefined) {
      Config.instance = new Config(new config_builder_1.ConfigBuilder());
    }

    return Config.instance;
  };

  (0, _createClass2["default"])(Config, [{
    key: "libraries",
    get: function get() {
      return this._libraries;
    }
    /**
     * Get the type of backtrace that the JNIInterceptor should be using for
     * backtraces.
     */

  }, {
    key: "backtrace",
    get: function get() {
      return this._backtrace;
    }
    /**
     * Get a list of the exports that the jnitrace engine should be
     * intercepting.
     */

  }, {
    key: "includeExport",
    get: function get() {
      return this._includeExport;
    }
    /**
     * Get a list of the exports that the jnitrace engine should not be
     * intercepting.
     */

  }, {
    key: "excludeExport",
    get: function get() {
      return this._excludeExport;
    }
    /**
     * Get whether the jnitrace engine should be tracing the whole JNIEnv
     * struct.
     */

  }, {
    key: "env",
    get: function get() {
      return this._env;
    }
    /**
     * Get whether the jnitrace engine should be tracing the whole JavaVM
     * struct.
     */

  }, {
    key: "vm",
    get: function get() {
      return this._vm;
    }
  }]);
  return Config;
}();

exports.Config = Config;

},{"./config_builder":140,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/createClass":16,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],140:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var config_1 = require("./config");
/**
 * ConfigBuilder class for creating the immutable Config.
 */


var ConfigBuilder = /*#__PURE__*/function () {
  function ConfigBuilder() {
    this._libraries = ["*"];
    this._backtrace = "accurate";
    this._includeExports = [];
    this._excludeExports = [];
    this._env = true;
    this._vm = true;
  }
  /**
   * A list of libraries that the jnitrace engine should trace.
   */


  var _proto = ConfigBuilder.prototype;
  /**
   * Build the Config to be used by the jnitrace engine.
   */

  _proto.build = function build() {
    return config_1.Config.getInstance(this);
  };

  (0, _createClass2["default"])(ConfigBuilder, [{
    key: "libraries",
    set: function set(libraries) {
      this._libraries = libraries;
    }
    /**
     * Get the list of libraries that the jnitrace engine should be tracing.
     */
    ,
    get: function get() {
      return this._libraries;
    }
    /**
     * Set the Frida backtrace method that the jnitrace engine should use.
     */

  }, {
    key: "backtrace",
    set: function set(backtrace) {
      if (["fuzzy", "accurate", "none"].includes(backtrace)) {
        this._backtrace = backtrace;
      } else {
        throw new Error("Backtracer value must be one of the following, [fuzzy, accurate, none].");
      }
    }
    /**
     * Get the Frida backtrace method that the jnitrace engine should use.
     */
    ,
    get: function get() {
      return this._backtrace;
    }
    /**
     * Set the list of exports that the jnitrace engine should trace.
     */

  }, {
    key: "includeExports",
    set: function set(exports) {
      this._includeExports = exports;
    }
    /**
     * Get the list of exports that the jnitrace engine should trace.
     */
    ,
    get: function get() {
      return this._includeExports;
    }
    /**
     * Set the list of exports that the jnitrace engine should not trace.
     */

  }, {
    key: "excludeExports",
    set: function set(exports) {
      this._excludeExports = exports;
    }
    /**
     * Get the list of exports that the jnitrace engine should not tracqe.
     */
    ,
    get: function get() {
      return this._excludeExports;
    }
    /**
     * Set whether the jnitrace engine should or should not trace JNIEnv struct
     * method calls.
     */

  }, {
    key: "env",
    set: function set(env) {
      this._env = env;
    }
    /**
     * Get whether the jnitrace engine should or should not trace JNIEnv struct
     * method calls.
     */
    ,
    get: function get() {
      return this._env;
    }
    /**
     * Set whether the jnitrace engine should or should not trace JavaVM struct
     * method calls.
     */

  }, {
    key: "vm",
    set: function set(vm) {
      this._vm = vm;
    }
    /**
     * Get whether the jnitrace engine should or should not trace JavaVM struct
     * method calls.
     */
    ,
    get: function get() {
      return this._vm;
    }
  }]);
  return ConfigBuilder;
}();

exports.ConfigBuilder = ConfigBuilder;

},{"./config":139,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/createClass":16,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],141:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var types_1 = require("./types");

var SEMI_COLON_OFFSET = 1;
/**
 * Abstracts a Java method referenced in native code.
 */

var JavaMethod = /*#__PURE__*/function () {
  function JavaMethod(signature) {
    var primitiveTypes = ["B", "S", "I", "J", "F", "D", "C", "Z", "V"];
    var isArray = false;
    var isRet = false;
    var jParamTypes = [];
    var jRetType = "unknown";

    for (var i = 0; i < signature.length; i++) {
      if (signature.charAt(i) === "(") {
        continue;
      }

      if (signature.charAt(i) === ")") {
        isRet = true;
        continue;
      }

      if (signature.charAt(i) === "[") {
        isArray = true;
        continue;
      }

      var jtype = "unknown";

      if (primitiveTypes.includes(signature.charAt(i))) {
        jtype = signature.charAt(i);
      } else if (signature.charAt(i) === "L") {
        var end = signature.indexOf(";", i) + SEMI_COLON_OFFSET;
        jtype = signature.substring(i, end);
        i = end - SEMI_COLON_OFFSET;
      } //TODO DELETE


      if (isArray) {
        jtype = "[" + jtype;
      }

      if (!isRet) {
        jParamTypes.push(jtype);
      } else {
        jRetType = jtype;
      }

      isArray = false;
    }

    this._ = signature;
    this._params = jParamTypes;
    this._ret = jRetType;
  }
  /**
   * Get the Java param types for the method.
   */


  (0, _createClass2["default"])(JavaMethod, [{
    key: "params",
    get: function get() {
      return this._params;
    }
    /**
     * Get the Java param types as native jtypes.
     */

  }, {
    key: "nativeParams",
    get: function get() {
      var nativeParams = [];

      this._params.forEach(function (p) {
        var nativeJType = types_1.Types.convertJTypeToNativeJType(p);
        nativeParams.push(nativeJType);
      });

      return nativeParams;
    }
    /**
     * Get the Java params as Frida native types.
     */

  }, {
    key: "fridaParams",
    get: function get() {
      var fridaParams = [];

      this._params.forEach(function (p) {
        var nativeJType = types_1.Types.convertJTypeToNativeJType(p);
        var fridaType = types_1.Types.convertNativeJTypeToFridaType(nativeJType);
        fridaParams.push(fridaType);
      });

      return fridaParams;
    }
    /**
     * Get the Java return type of the method.
     */

  }, {
    key: "ret",
    get: function get() {
      return this._ret;
    }
    /**
     * Get the Java return type as a Frida native type.
     */

  }, {
    key: "fridaRet",
    get: function get() {
      var jTypeRet = types_1.Types.convertJTypeToNativeJType(this._ret);
      return types_1.Types.convertNativeJTypeToFridaType(jTypeRet);
    }
  }]);
  return JavaMethod;
}();

exports.JavaMethod = JavaMethod;

},{"./types":143,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/createClass":16,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],142:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});

var ReferenceManager = /*#__PURE__*/function () {
  function ReferenceManager() {
    this.references = new _map["default"]();
  }

  var _proto = ReferenceManager.prototype;

  _proto.add = function add(ref) {
    this.references.set(ref.toString(), ref);
  };

  _proto.release = function release(ref) {
    if (this.references.has(ref.toString())) {
      this.references["delete"](ref.toString());
    }
  };

  return ReferenceManager;
}();

exports.ReferenceManager = ReferenceManager;

},{"@babel/runtime-corejs2/core-js/map":6,"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}],143:[function(require,module,exports){
"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

(0, _defineProperty["default"])(exports, "__esModule", {
  value: true
});
var ARRAY_TYPE_INDEX = 1;
var TYPE_SIZE_64_BIT = 8;
var TYPE_SIZE_CHAR = 1;
var Types = {
  isComplexObjectType: function isComplexObjectType(type) {
    var JOBJECT = ["jobject", "jclass", "jweak"];
    return JOBJECT.includes(type);
  },
  sizeOf: function sizeOf(type) {
    if (type === "double" || type === "float" || type === "int64") {
      return TYPE_SIZE_64_BIT;
    } else if (type === "char") {
      return TYPE_SIZE_CHAR;
    } else {
      return Process.pointerSize;
    }
  },
  convertNativeJTypeToFridaType: function convertNativeJTypeToFridaType(jtype) {
    if (jtype.endsWith("*")) {
      return "pointer";
    }

    if (jtype === "va_list") {
      return "pointer";
    }

    if (jtype === "jmethodID") {
      return "pointer";
    }

    if (jtype === "jfieldID") {
      return "pointer";
    }

    if (jtype === "va_list") {
      return "va_list";
    }

    if (jtype === "jweak") {
      jtype = "jobject";
    }

    if (jtype === "jthrowable") {
      jtype = "jobject";
    }

    if (jtype.includes("Array")) {
      jtype = "jarray";
    }

    if (jtype === "jarray") {
      jtype = "jobject";
    }

    if (jtype === "jstring") {
      jtype = "jobject";
    }

    if (jtype === "jclass") {
      jtype = "jobject";
    }

    if (jtype === "jobject") {
      return "pointer";
    }

    if (jtype === "jsize") {
      jtype = "jint";
    }

    if (jtype === "jdouble") {
      return "double";
    }

    if (jtype === "jfloat") {
      return "float";
    }

    if (jtype === "jchar") {
      return "uint16";
    }

    if (jtype === "jboolean") {
      return "char";
    }

    if (jtype === "jlong") {
      return "int64";
    }

    if (jtype === "jint") {
      return "int";
    }

    if (jtype === "jshort") {
      return "int16";
    }

    if (jtype === "jbyte") {
      return "char";
    }

    return jtype;
  },
  convertJTypeToNativeJType: function convertJTypeToNativeJType(jtype) {
    var result = "";
    var isArray = false;

    if (jtype.startsWith("[")) {
      isArray = true;
      jtype = jtype.substring(ARRAY_TYPE_INDEX);
    }

    if (jtype === "B") {
      result += "jbyte";
    } else if (jtype === "S") {
      result += "jshort";
    } else if (jtype === "I") {
      result += "jint";
    } else if (jtype === "J") {
      result += "jlong";
    } else if (jtype === "F") {
      result += "jfloat";
    } else if (jtype === "D") {
      result += "jdouble";
    } else if (jtype === "C") {
      result += "jchar";
    } else if (jtype === "Z") {
      result += "jboolean";
    } else if (jtype.startsWith("L")) {
      if (jtype === "Ljava/lang/String;") {
        result += "jstring";
      } else if (jtype === "Ljava/lang/Class;") {
        result += "jclass";
      } else {
        result += "jobject";
      }
    }

    if (isArray) {
      if (result === "jstring") {
        result = "jobject";
      }

      result += "Array";
    }

    return result;
  }
};
exports.Types = Types;

},{"@babel/runtime-corejs2/core-js/object/define-property":8,"@babel/runtime-corejs2/helpers/interopRequireDefault":19}]},{},[1])
//# sourceMappingURL=data:application/json;charset=utf-8;base64, 
