const require_promises = require('./promises.cjs');

//#region src/context.ts
const InvocationIdParser = { fromString(id) {
	if (!id.startsWith("inv")) throw new Error(`Expected invocation id to start with 'inv' but got ${id}`);
	return id;
} };
const RestatePromise = {
	resolve(value) {
		if (value instanceof require_promises.InternalRestatePromise) return value;
		return require_promises.ConstRestatePromise.resolve(value);
	},
	reject(reason) {
		return require_promises.ConstRestatePromise.reject(reason);
	},
	all(values) {
		return require_promises.CombinatorRestatePromise.fromPromises((p) => Promise.all(p), values);
	},
	race(values) {
		if (values.length === 0) return require_promises.ConstRestatePromise.pending();
		return require_promises.CombinatorRestatePromise.fromPromises((p) => Promise.race(p), values);
	},
	any(values) {
		return require_promises.CombinatorRestatePromise.fromPromises((p) => Promise.any(p), values);
	},
	allSettled(values) {
		return require_promises.CombinatorRestatePromise.fromPromises((p) => Promise.allSettled(p), values);
	}
};

//#endregion
exports.InvocationIdParser = InvocationIdParser;
exports.RestatePromise = RestatePromise;