using System;

namespace System.Reactive.Joins
{
	internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> : ActivePlan
	{
		internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third, JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh, JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh, JoinObserver<T12> twelfth, JoinObserver<T13> thirteenth, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> onNext, Action onCompleted)
			: base(onCompleted)
		{
			this._onNext = onNext;
			this._first = first;
			this._second = second;
			this._third = third;
			this._fourth = fourth;
			this._fifth = fifth;
			this._sixth = sixth;
			this._seventh = seventh;
			this._eighth = eighth;
			this._ninth = ninth;
			this._tenth = tenth;
			this._eleventh = eleventh;
			this._twelfth = twelfth;
			this._thirteenth = thirteenth;
			base.AddJoinObserver(first);
			base.AddJoinObserver(second);
			base.AddJoinObserver(third);
			base.AddJoinObserver(fourth);
			base.AddJoinObserver(fifth);
			base.AddJoinObserver(sixth);
			base.AddJoinObserver(seventh);
			base.AddJoinObserver(eighth);
			base.AddJoinObserver(ninth);
			base.AddJoinObserver(tenth);
			base.AddJoinObserver(eleventh);
			base.AddJoinObserver(twelfth);
			base.AddJoinObserver(thirteenth);
		}

		internal override void Match()
		{
			if (this._first.Queue.Count > 0 && this._second.Queue.Count > 0 && this._third.Queue.Count > 0 && this._fourth.Queue.Count > 0 && this._fifth.Queue.Count > 0 && this._sixth.Queue.Count > 0 && this._seventh.Queue.Count > 0 && this._eighth.Queue.Count > 0 && this._ninth.Queue.Count > 0 && this._tenth.Queue.Count > 0 && this._eleventh.Queue.Count > 0 && this._twelfth.Queue.Count > 0 && this._thirteenth.Queue.Count > 0)
			{
				Notification<T1> notification = this._first.Queue.Peek();
				Notification<T2> notification2 = this._second.Queue.Peek();
				Notification<T3> notification3 = this._third.Queue.Peek();
				Notification<T4> notification4 = this._fourth.Queue.Peek();
				Notification<T5> notification5 = this._fifth.Queue.Peek();
				Notification<T6> notification6 = this._sixth.Queue.Peek();
				Notification<T7> notification7 = this._seventh.Queue.Peek();
				Notification<T8> notification8 = this._eighth.Queue.Peek();
				Notification<T9> notification9 = this._ninth.Queue.Peek();
				Notification<T10> notification10 = this._tenth.Queue.Peek();
				Notification<T11> notification11 = this._eleventh.Queue.Peek();
				Notification<T12> notification12 = this._twelfth.Queue.Peek();
				Notification<T13> notification13 = this._thirteenth.Queue.Peek();
				if (notification.Kind != NotificationKind.OnCompleted && notification2.Kind != NotificationKind.OnCompleted && notification3.Kind != NotificationKind.OnCompleted && notification4.Kind != NotificationKind.OnCompleted && notification5.Kind != NotificationKind.OnCompleted && notification6.Kind != NotificationKind.OnCompleted && notification7.Kind != NotificationKind.OnCompleted && notification8.Kind != NotificationKind.OnCompleted && notification9.Kind != NotificationKind.OnCompleted && notification10.Kind != NotificationKind.OnCompleted && notification11.Kind != NotificationKind.OnCompleted && notification12.Kind != NotificationKind.OnCompleted)
				{
					if (notification13.Kind != NotificationKind.OnCompleted)
					{
						base.Dequeue();
						this._onNext(notification.Value, notification2.Value, notification3.Value, notification4.Value, notification5.Value, notification6.Value, notification7.Value, notification8.Value, notification9.Value, notification10.Value, notification11.Value, notification12.Value, notification13.Value);
						return;
					}
				}
				this._onCompleted();
				return;
			}
		}

		private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> _onNext;

		private readonly JoinObserver<T1> _first;

		private readonly JoinObserver<T2> _second;

		private readonly JoinObserver<T3> _third;

		private readonly JoinObserver<T4> _fourth;

		private readonly JoinObserver<T5> _fifth;

		private readonly JoinObserver<T6> _sixth;

		private readonly JoinObserver<T7> _seventh;

		private readonly JoinObserver<T8> _eighth;

		private readonly JoinObserver<T9> _ninth;

		private readonly JoinObserver<T10> _tenth;

		private readonly JoinObserver<T11> _eleventh;

		private readonly JoinObserver<T12> _twelfth;

		private readonly JoinObserver<T13> _thirteenth;
	}
}
