import {
  getLogger
} from "./chunk-IZ4M5TJU.js";

// src/client/log.ts
function logger() {
  return getLogger("actor-client");
}

// src/common/websocket.ts
var webSocketPromise = null;
async function importWebSocket() {
  if (webSocketPromise !== null) {
    return webSocketPromise;
  }
  webSocketPromise = (async () => {
    let _WebSocket;
    if (typeof WebSocket !== "undefined") {
      _WebSocket = WebSocket;
    } else {
      try {
        const moduleName = "ws";
        const ws = await import(
          /* webpackIgnore: true */
          moduleName
        );
        _WebSocket = ws.default;
        logger().debug("using websocket from npm");
      } catch {
        _WebSocket = class MockWebSocket {
          constructor() {
            throw new Error(
              'WebSocket support requires installing the "ws" peer dependency.'
            );
          }
        };
        logger().debug("using mock websocket");
      }
    }
    return _WebSocket;
  })();
  return webSocketPromise;
}

export {
  logger,
  importWebSocket
};
//# sourceMappingURL=chunk-VBU4P2IX.js.map