import { __require as h } from "./index.es233.js";
var c, a;
function p() {
  if (a)
    return c;
  a = 1;
  var f = h();
  function s(i) {
    if (typeof i != "function")
      throw new TypeError("executor must be a function.");
    var n;
    this.promise = new Promise(function(r) {
      n = r;
    });
    var e = this;
    this.promise.then(function(t) {
      if (e._listeners) {
        var r, o = e._listeners.length;
        for (r = 0; r < o; r++)
          e._listeners[r](t);
        e._listeners = null;
      }
    }), this.promise.then = function(t) {
      var r, o = new Promise(function(u) {
        e.subscribe(u), r = u;
      }).then(t);
      return o.cancel = function() {
        e.unsubscribe(r);
      }, o;
    }, i(function(r) {
      e.reason || (e.reason = new f(r), n(e.reason));
    });
  }
  return s.prototype.throwIfRequested = function() {
    if (this.reason)
      throw this.reason;
  }, s.prototype.subscribe = function(n) {
    if (this.reason) {
      n(this.reason);
      return;
    }
    this._listeners ? this._listeners.push(n) : this._listeners = [n];
  }, s.prototype.unsubscribe = function(n) {
    if (this._listeners) {
      var e = this._listeners.indexOf(n);
      e !== -1 && this._listeners.splice(e, 1);
    }
  }, s.source = function() {
    var n, e = new s(function(r) {
      n = r;
    });
    return {
      token: e,
      cancel: n
    };
  }, c = s, c;
}
export {
  p as __require
};
//# sourceMappingURL=index.es234.js.map
