var o = Object.defineProperty;
var l = (s, e, t) => e in s ? o(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
var i = (s, e, t) => l(s, typeof e != "symbol" ? e + "" : e, t);
let r;
function c(s) {
  r = s;
}
function u() {
  if (!r)
    throw new Error(
      "[@netless/appliance-plugin/bridge] white-web-sdk runtime has not been bound yet."
    );
  return r;
}
const h = "/assets/fullWorker-Cud7fwjG.js", d = "/assets/subWorker-BL9l8peV.js";
class g {
  constructor() {
    i(this, "control");
    i(this, "_listeners", {});
  }
  _inject(e) {
    this.control = e;
  }
  _onEvent(e, t) {
    this._listeners[e] && this._listeners[e](...t);
  }
  callbacks(e, t) {
    this._listeners[e] = t;
  }
  removeCallback(e) {
    delete this._listeners[e];
  }
}
class b {
  constructor(e) {
    i(this, "control");
    i(this, "worker");
    i(this, "publicMsgEmitter");
    i(this, "plugins", /* @__PURE__ */ new Map());
    const { control: t, publicMsgEmitter: n } = e;
    this.control = t, this.publicMsgEmitter = n, this.worker = t.worker;
  }
  use(e) {
    this.plugins.set(e.kind, e), e._inject(this.control), e.onCreate();
  }
  destroy() {
    this.plugins.forEach((e) => {
      this.plugins.delete(e.kind), e.onDestroy();
    });
  }
  dispatchPluginEvent(e, ...t) {
    this.plugins.forEach((n) => {
      n._onEvent(e, t);
    });
  }
}
async function k(s) {
  return c(s), import("./index-zUtKU6c_.mjs").then((e) => e.a7);
}
export {
  b as P,
  g as a,
  h as f,
  u as g,
  k as l,
  d as s
};
