"use strict";
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  return value;
};
class AbortablePromise {
  constructor(executor) {
    __publicField(this, "promise");
    __publicField(this, "_reject", null);
    this.promise = new Promise((resolve, reject) => {
      executor(resolve, reject);
      this._reject = reject;
    });
  }
  abort(error) {
    if (this._reject) {
      this._reject(error);
    }
  }
  then(onfulfilled, onrejected) {
    return this.promise.then(onfulfilled, onrejected);
  }
  catch(onrejected) {
    return this.promise.catch(onrejected);
  }
}
exports.AbortablePromise = AbortablePromise;
