import { e, n2 as n, y3 as y } from "./chunk-Y3WMVFTW.js"; import { T, g, m } from "./chunk-ULGDPLM2.js"; import { q } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/core/Promise.js var h; !function(s) { s[s.PENDING = 0] = "PENDING", s[s.RESOLVED = 1] = "RESOLVED", s[s.REJECTED = 2] = "REJECTED"; }(h || (h = {})); var n2 = class { constructor(s) { this.instance = s, this._resolver = T(), this._status = h.PENDING, this._resolvingPromises = [], this._resolver.promise.then(() => { this._status = h.RESOLVED, this._cleanUp(); }, () => { this._status = h.REJECTED, this._cleanUp(); }); } addResolvingPromise(s) { this._resolvingPromises.push(s), this._tryResolve(); } isResolved() { return this._status === h.RESOLVED; } isRejected() { return this._status === h.REJECTED; } isFulfilled() { return this._status !== h.PENDING; } abort() { this._resolver.reject(m()); } when(s, e2) { return this._resolver.promise.then(s, e2); } _cleanUp() { this._allPromise = this._resolvingPromises = this._allPromise = null; } _tryResolve() { if (this.isFulfilled()) return; const s = T(), e2 = [...this._resolvingPromises, q(s.promise)], t = this._allPromise = Promise.all(e2); t.then(() => { this.isFulfilled() || this._allPromise !== t || this._resolver.resolve(this.instance); }, (s2) => { this.isFulfilled() || this._allPromise !== t || g(s2) || this._resolver.reject(s2); }), s.resolve(); } }; var m2 = (e2) => { let i = class extends e2 { constructor(...s) { super(...s), this._promiseProps = new n2(this), this.addResolvingPromise(Promise.resolve()); } isResolved() { return this._promiseProps.isResolved(); } isRejected() { return this._promiseProps.isRejected(); } isFulfilled() { return this._promiseProps.isFulfilled(); } when(s, e3) { return new Promise((s2, e4) => { this._promiseProps.when(s2, e4); }).then(s, e3); } catch(s) { return this.when(null, s); } addResolvingPromise(s) { s && !this._promiseProps.isFulfilled() && this._promiseProps.addResolvingPromise("_promiseProps" in s ? s.when() : s); } }; return i = e([n("esri.core.Promise")], i), i; }; var _ = class extends m2(y) { }; _ = e([n("esri.core.Promise")], _); export { m2 as m, _ }; //# sourceMappingURL=chunk-YBSUITLL.js.map