import { r as registerInstance, c as createEvent } from './index-f1d2a96f.js';

const ScConsumer = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.mountEmitter = createEvent(this, "mountConsumer", 7);
    this.setContext = async (context) => {
      this.context = context;
      return this.promise;
    };
    this.promise = new Promise(resolve => {
      this.resolvePromise = resolve;
    });
  }
  componentWillLoad() {
    this.mountEmitter.emit(this.setContext);
  }
  disconnectedCallback() {
    this.resolvePromise();
  }
  render() {
    if (!this.context) {
      return null;
    }
    return this.renderer(this.context);
  }
};

export { ScConsumer as sc_consumer };
