"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const env = require("./env.js");
const _const = require("./const.js");
const proxy = require("./proxy.js");
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
  const descriptor = pluginDescriptor;
  const target = env.getTarget();
  const hook = env.getDevtoolsGlobalHook();
  const enableProxy = env.isProxyAvailable && descriptor.enableEarlyProxy;
  if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
    hook.emit(_const.HOOK_SETUP, pluginDescriptor, setupFn);
  } else {
    const proxy$1 = enableProxy ? new proxy.ApiProxy(descriptor, hook) : null;
    const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
    list.push({
      pluginDescriptor: descriptor,
      setupFn,
      proxy: proxy$1
    });
    if (proxy$1) {
      setupFn(proxy$1.proxiedTarget);
    }
  }
}
exports.setupDevtoolsPlugin = setupDevtoolsPlugin;
