const require_rolldown_runtime = require('../../../../../../../../../_virtual/rolldown_runtime.js');
const require_Observable$1 = require('../Observable.js');
const require_OperatorSubscriber$1 = require('../operators/OperatorSubscriber.js');
const require_innerFrom$1 = require('./innerFrom.js');
const require_argsOrArgArray$1 = require('../util/argsOrArgArray.js');

//#region ../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/cjs/internal/observable/race.js
var require_race = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/cjs/internal/observable/race.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	var Observable_1 = require_Observable$1.require_Observable();
	var innerFrom_1 = require_innerFrom$1.require_innerFrom();
	var argsOrArgArray_1 = require_argsOrArgArray$1.require_argsOrArgArray();
	var OperatorSubscriber_1 = require_OperatorSubscriber$1.require_OperatorSubscriber();
	function race() {
		var sources = [];
		for (var _i = 0; _i < arguments.length; _i++) sources[_i] = arguments[_i];
		sources = argsOrArgArray_1.argsOrArgArray(sources);
		return sources.length === 1 ? innerFrom_1.innerFrom(sources[0]) : new Observable_1.Observable(raceInit(sources));
	}
	exports.race = race;
	function raceInit(sources) {
		return function(subscriber) {
			var subscriptions = [];
			var _loop_1 = function(i$1) {
				subscriptions.push(innerFrom_1.innerFrom(sources[i$1]).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function(value) {
					if (subscriptions) {
						for (var s = 0; s < subscriptions.length; s++) s !== i$1 && subscriptions[s].unsubscribe();
						subscriptions = null;
					}
					subscriber.next(value);
				})));
			};
			for (var i = 0; subscriptions && !subscriber.closed && i < sources.length; i++) _loop_1(i);
		};
	}
	exports.raceInit = raceInit;
}) });

//#endregion
Object.defineProperty(exports, 'default', {
  enumerable: true,
  get: function () {
    return require_race();
  }
});