// src/workers/core/dev-control.worker.ts
import { WorkerEntrypoint } from "cloudflare:workers";
import workerdUnsafe from "workerd:unsafe";

// src/shared/dev-control.ts
function getDevControlDurableObjectBindingName(scriptName, className) {
  return ["MINIFLARE_DEV_CONTROL_DO", scriptName, className].join(":");
}

// src/workers/core/dev-control.worker.ts
function getDurableObjectNamespace(env, bindingName) {
  let namespace = env[bindingName];
  return !(typeof namespace == "object" && namespace !== null) || !("idFromName" in namespace) || typeof namespace.idFromName != "function" || !("idFromString" in namespace) || typeof namespace.idFromString != "function" || !("get" in namespace) || typeof namespace.get != "function" ? null : namespace;
}
var DevControl = class extends WorkerEntrypoint {
  async evictDurableObject(scriptName, className, options) {
    let doNamespace = getDurableObjectNamespace(
      this.env,
      getDevControlDurableObjectBindingName(scriptName, className)
    );
    if (!doNamespace)
      throw new TypeError(
        `Expected Durable Object namespace binding for ${scriptName}:${className}`
      );
    let id = options.id === void 0 ? doNamespace.idFromName(options.name) : doNamespace.idFromString(options.id), stub = doNamespace.get(id);
    await workerdUnsafe.evict(stub, {
      webSockets: options.webSockets
    });
  }
};
export {
  DevControl as default
};
//# sourceMappingURL=dev-control.worker.js.map
