using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using Microsoft.CSharp.RuntimeBinder;
using mshtml;

namespace ZionRobot.Helpers
{
	// Token: 0x0200000E RID: 14
	internal class CQuery
	{
		// Token: 0x06000046 RID: 70 RVA: 0x00002DDC File Offset: 0x00000FDC
		public static bool CompareInnerHtmlByValue(IHTMLElement element, string value)
		{
			return element.innerHTML == value;
		}

		// Token: 0x06000047 RID: 71 RVA: 0x00002DFC File Offset: 0x00000FFC
		public static bool CompareInnerHtmlByElements(IHTMLElement element1, IHTMLElement element2)
		{
			try
			{
				string aa = (element1 as HTMLDocument).body.innerText;
				string bb = (element2 as HTMLDocument).body.innerText;
			}
			catch (Exception ex)
			{
				throw;
			}
			if (CQuery.<>o__2.<>p__2 == null)
			{
				CQuery.<>o__2.<>p__2 = CallSite<Func<CallSite, object, HTMLDocument>>.Create(Binder.Convert(CSharpBinderFlags.ConvertExplicit, typeof(HTMLDocument), typeof(CQuery)));
			}
			Func<CallSite, object, HTMLDocument> target = CQuery.<>o__2.<>p__2.Target;
			CallSite <>p__ = CQuery.<>o__2.<>p__2;
			if (CQuery.<>o__2.<>p__1 == null)
			{
				CQuery.<>o__2.<>p__1 = CallSite<Func<CallSite, object, object>>.Create(Binder.GetMember(CSharpBinderFlags.None, "document", typeof(CQuery), new CSharpArgumentInfo[]
				{
					CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
				}));
			}
			Func<CallSite, object, object> target2 = CQuery.<>o__2.<>p__1.Target;
			CallSite <>p__2 = CQuery.<>o__2.<>p__1;
			if (CQuery.<>o__2.<>p__0 == null)
			{
				CQuery.<>o__2.<>p__0 = CallSite<Func<CallSite, object, object>>.Create(Binder.GetMember(CSharpBinderFlags.None, "body", typeof(CQuery), new CSharpArgumentInfo[]
				{
					CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
				}));
			}
			string db = target(<>p__, target2(<>p__2, CQuery.<>o__2.<>p__0.Target(CQuery.<>o__2.<>p__0, element1.document))).body.innerText;
			if (CQuery.<>o__2.<>p__5 == null)
			{
				CQuery.<>o__2.<>p__5 = CallSite<Func<CallSite, object, HTMLDocument>>.Create(Binder.Convert(CSharpBinderFlags.ConvertExplicit, typeof(HTMLDocument), typeof(CQuery)));
			}
			Func<CallSite, object, HTMLDocument> target3 = CQuery.<>o__2.<>p__5.Target;
			CallSite <>p__3 = CQuery.<>o__2.<>p__5;
			if (CQuery.<>o__2.<>p__4 == null)
			{
				CQuery.<>o__2.<>p__4 = CallSite<Func<CallSite, object, object>>.Create(Binder.GetMember(CSharpBinderFlags.None, "document", typeof(CQuery), new CSharpArgumentInfo[]
				{
					CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
				}));
			}
			Func<CallSite, object, object> target4 = CQuery.<>o__2.<>p__4.Target;
			CallSite <>p__4 = CQuery.<>o__2.<>p__4;
			if (CQuery.<>o__2.<>p__3 == null)
			{
				CQuery.<>o__2.<>p__3 = CallSite<Func<CallSite, object, object>>.Create(Binder.GetMember(CSharpBinderFlags.None, "body", typeof(CQuery), new CSharpArgumentInfo[]
				{
					CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
				}));
			}
			string dbx = target3(<>p__3, target4(<>p__4, CQuery.<>o__2.<>p__3.Target(CQuery.<>o__2.<>p__3, element2.document))).body.innerText;
			return element1.innerHTML == element2.innerHTML;
		}

		// Token: 0x06000048 RID: 72 RVA: 0x00003034 File Offset: 0x00001234
		public static bool CompareInnerTextByValue(IHTMLElement element, string value)
		{
			return element.innerText == value;
		}

		// Token: 0x06000049 RID: 73 RVA: 0x00003054 File Offset: 0x00001254
		public static bool CompareInnerTextByElements(IHTMLElement element1, IHTMLElement element2)
		{
			return element1.innerText == element2.innerText;
		}

		// Token: 0x0600004A RID: 74 RVA: 0x00003078 File Offset: 0x00001278
		public static List<IHTMLElement> Find(string selector, List<IHTMLElementCollection> listElements)
		{
			List<IHTMLElement> result = new List<IHTMLElement>();
			bool cont = true;
			foreach (string tag in selector.Split(new char[]
			{
				'>'
			}).ToList<string>())
			{
				MatchCollection tmp = Regex.Matches(tag, CQuery.pattern);
				int count = 0;
				foreach (object obj in tmp)
				{
					Match match = (Match)obj;
					count++;
					char c = match.Value[0];
					char c2 = c;
					if (c2 != ':')
					{
						if (c2 != '[')
						{
							string[] parts2 = match.Value.ToUpper().Split(";".ToCharArray(), 2);
							bool flag = result.Count == 0;
							if (flag)
							{
								foreach (IHTMLElementCollection elements in listElements)
								{
									bool flag2 = parts2.Count<string>() == 1;
									if (flag2)
									{
										if (CQuery.<>o__5.<>p__21 == null)
										{
											CQuery.<>o__5.<>p__21 = CallSite<Action<CallSite, List<IHTMLElement>, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.ResultDiscarded, "AddRange", null, typeof(CQuery), new CSharpArgumentInfo[]
											{
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
											}));
										}
										Action<CallSite, List<IHTMLElement>, object> target = CQuery.<>o__5.<>p__21.Target;
										CallSite <>p__ = CQuery.<>o__5.<>p__21;
										List<IHTMLElement> arg = result;
										if (CQuery.<>o__5.<>p__20 == null)
										{
											CQuery.<>o__5.<>p__20 = CallSite<Func<CallSite, Type, object, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.None, "getChildren", null, typeof(CQuery), new CSharpArgumentInfo[]
											{
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.IsStaticType, null),
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
											}));
										}
										target(<>p__, arg, CQuery.<>o__5.<>p__20.Target(CQuery.<>o__5.<>p__20, typeof(CQuery), elements.tags(match.Value)));
									}
									else
									{
										if (CQuery.<>o__5.<>p__23 == null)
										{
											CQuery.<>o__5.<>p__23 = CallSite<Action<CallSite, List<IHTMLElement>, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.ResultDiscarded, "AddRange", null, typeof(CQuery), new CSharpArgumentInfo[]
											{
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
											}));
										}
										Action<CallSite, List<IHTMLElement>, object> target2 = CQuery.<>o__5.<>p__23.Target;
										CallSite <>p__2 = CQuery.<>o__5.<>p__23;
										List<IHTMLElement> arg2 = result;
										if (CQuery.<>o__5.<>p__22 == null)
										{
											CQuery.<>o__5.<>p__22 = CallSite<Func<CallSite, Type, object, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.None, "getChildren", null, typeof(CQuery), new CSharpArgumentInfo[]
											{
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.IsStaticType, null),
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
											}));
										}
										target2(<>p__2, arg2, CQuery.<>o__5.<>p__22.Target(CQuery.<>o__5.<>p__22, typeof(CQuery), elements.item(int.Parse(parts2[1]), Type.Missing)));
									}
								}
							}
							else
							{
								List<IHTMLElement> temp = new List<IHTMLElement>();
								foreach (IHTMLElement element3 in result)
								{
									bool flag3 = parts2.Count<string>() == 1;
									if (flag3)
									{
										if (CQuery.<>o__5.<>p__25 == null)
										{
											CQuery.<>o__5.<>p__25 = CallSite<Action<CallSite, List<IHTMLElement>, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.ResultDiscarded, "AddRange", null, typeof(CQuery), new CSharpArgumentInfo[]
											{
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
											}));
										}
										Action<CallSite, List<IHTMLElement>, object> target3 = CQuery.<>o__5.<>p__25.Target;
										CallSite <>p__3 = CQuery.<>o__5.<>p__25;
										List<IHTMLElement> arg3 = temp;
										if (CQuery.<>o__5.<>p__24 == null)
										{
											CQuery.<>o__5.<>p__24 = CallSite<Func<CallSite, Type, object, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.None, "getChildren", null, typeof(CQuery), new CSharpArgumentInfo[]
											{
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.IsStaticType, null),
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
											}));
										}
										target3(<>p__3, arg3, CQuery.<>o__5.<>p__24.Target(CQuery.<>o__5.<>p__24, typeof(CQuery), (element3.all as IHTMLElementCollection).tags(match.Value)));
									}
									else
									{
										if (CQuery.<>o__5.<>p__27 == null)
										{
											CQuery.<>o__5.<>p__27 = CallSite<Action<CallSite, List<IHTMLElement>, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.ResultDiscarded, "AddRange", null, typeof(CQuery), new CSharpArgumentInfo[]
											{
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
											}));
										}
										Action<CallSite, List<IHTMLElement>, object> target4 = CQuery.<>o__5.<>p__27.Target;
										CallSite <>p__4 = CQuery.<>o__5.<>p__27;
										List<IHTMLElement> arg4 = temp;
										if (CQuery.<>o__5.<>p__26 == null)
										{
											CQuery.<>o__5.<>p__26 = CallSite<Func<CallSite, Type, object, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.None, "getChildren", null, typeof(CQuery), new CSharpArgumentInfo[]
											{
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.IsStaticType, null),
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
											}));
										}
										target4(<>p__4, arg4, CQuery.<>o__5.<>p__26.Target(CQuery.<>o__5.<>p__26, typeof(CQuery), (element3.all as IHTMLElementCollection).item(match.Value, parts2[1])));
									}
								}
								result = temp;
							}
							bool flag4 = result.Count == 0;
							if (flag4)
							{
								cont = false;
							}
						}
						else
						{
							string[] parts = match.Value.TrimStart(new char[]
							{
								'['
							}).TrimEnd(new char[]
							{
								']'
							}).Split("=".ToCharArray(), 2);
							bool flag5 = result.Count == 0;
							if (flag5)
							{
								foreach (IHTMLElementCollection elements2 in listElements)
								{
									foreach (object obj2 in elements2)
									{
										IHTMLElement element2 = (IHTMLElement)obj2;
										object attr = element2.getAttribute(parts[0], 0);
										if (CQuery.<>o__5.<>p__8 == null)
										{
											CQuery.<>o__5.<>p__8 = CallSite<Func<CallSite, object, bool>>.Create(Binder.UnaryOperation(CSharpBinderFlags.None, ExpressionType.IsTrue, typeof(CQuery), new CSharpArgumentInfo[]
											{
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
											}));
										}
										Func<CallSite, object, bool> target5 = CQuery.<>o__5.<>p__8.Target;
										CallSite <>p__5 = CQuery.<>o__5.<>p__8;
										if (CQuery.<>o__5.<>p__0 == null)
										{
											CQuery.<>o__5.<>p__0 = CallSite<Func<CallSite, object, object, object>>.Create(Binder.BinaryOperation(CSharpBinderFlags.None, ExpressionType.NotEqual, typeof(CQuery), new CSharpArgumentInfo[]
											{
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.Constant, null)
											}));
										}
										object obj3 = CQuery.<>o__5.<>p__0.Target(CQuery.<>o__5.<>p__0, attr, null);
										if (CQuery.<>o__5.<>p__4 == null)
										{
											CQuery.<>o__5.<>p__4 = CallSite<Func<CallSite, object, bool>>.Create(Binder.UnaryOperation(CSharpBinderFlags.None, ExpressionType.IsFalse, typeof(CQuery), new CSharpArgumentInfo[]
											{
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
											}));
										}
										object obj4;
										if (!CQuery.<>o__5.<>p__4.Target(CQuery.<>o__5.<>p__4, obj3))
										{
											if (CQuery.<>o__5.<>p__3 == null)
											{
												CQuery.<>o__5.<>p__3 = CallSite<Func<CallSite, object, object, object>>.Create(Binder.BinaryOperation(CSharpBinderFlags.BinaryOperationLogical, ExpressionType.And, typeof(CQuery), new CSharpArgumentInfo[]
												{
													CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
													CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
												}));
											}
											Func<CallSite, object, object, object> target6 = CQuery.<>o__5.<>p__3.Target;
											CallSite <>p__6 = CQuery.<>o__5.<>p__3;
											object arg5 = obj3;
											if (CQuery.<>o__5.<>p__2 == null)
											{
												CQuery.<>o__5.<>p__2 = CallSite<Func<CallSite, object, object>>.Create(Binder.UnaryOperation(CSharpBinderFlags.None, ExpressionType.Not, typeof(CQuery), new CSharpArgumentInfo[]
												{
													CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
												}));
											}
											Func<CallSite, object, object> target7 = CQuery.<>o__5.<>p__2.Target;
											CallSite <>p__7 = CQuery.<>o__5.<>p__2;
											if (CQuery.<>o__5.<>p__1 == null)
											{
												CQuery.<>o__5.<>p__1 = CallSite<Func<CallSite, DBNull, object, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.None, "Equals", null, typeof(CQuery), new CSharpArgumentInfo[]
												{
													CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),
													CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
												}));
											}
											obj4 = target6(<>p__6, arg5, target7(<>p__7, CQuery.<>o__5.<>p__1.Target(CQuery.<>o__5.<>p__1, DBNull.Value, attr)));
										}
										else
										{
											obj4 = obj3;
										}
										object obj5 = obj4;
										if (CQuery.<>o__5.<>p__7 == null)
										{
											CQuery.<>o__5.<>p__7 = CallSite<Func<CallSite, object, bool>>.Create(Binder.UnaryOperation(CSharpBinderFlags.None, ExpressionType.IsFalse, typeof(CQuery), new CSharpArgumentInfo[]
											{
												CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
											}));
										}
										object arg7;
										if (!CQuery.<>o__5.<>p__7.Target(CQuery.<>o__5.<>p__7, obj5))
										{
											if (CQuery.<>o__5.<>p__6 == null)
											{
												CQuery.<>o__5.<>p__6 = CallSite<Func<CallSite, object, object, object>>.Create(Binder.BinaryOperation(CSharpBinderFlags.BinaryOperationLogical, ExpressionType.And, typeof(CQuery), new CSharpArgumentInfo[]
												{
													CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
													CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
												}));
											}
											Func<CallSite, object, object, object> target8 = CQuery.<>o__5.<>p__6.Target;
											CallSite <>p__8 = CQuery.<>o__5.<>p__6;
											object arg6 = obj5;
											if (CQuery.<>o__5.<>p__5 == null)
											{
												CQuery.<>o__5.<>p__5 = CallSite<Func<CallSite, object, string, object>>.Create(Binder.BinaryOperation(CSharpBinderFlags.None, ExpressionType.Equal, typeof(CQuery), new CSharpArgumentInfo[]
												{
													CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
													CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null)
												}));
											}
											arg7 = target8(<>p__8, arg6, CQuery.<>o__5.<>p__5.Target(CQuery.<>o__5.<>p__5, attr, parts[1]));
										}
										else
										{
											arg7 = obj5;
										}
										bool flag6 = target5(<>p__5, arg7);
										if (flag6)
										{
											result.Add(element2);
										}
									}
								}
							}
							else
							{
								bool flag7 = parts[0].ToUpper() == "CLASS";
								if (flag7)
								{
									result = CQuery.searchByClass((from i in result
									where i.className != null && i.className != string.Empty
									select i).ToList<IHTMLElement>(), parts[1]);
								}
								else
								{
									bool flag8 = parts[0].ToUpper() == "INNERTEXT";
									if (flag8)
									{
										result = CQuery.searchByInnerText(result, parts[1]);
									}
									else
									{
										try
										{
											bool flag9 = parts.Count<string>() == 1;
											if (!flag9)
											{
												IEnumerable<IHTMLElement> a = result.Where(delegate(IHTMLElement element)
												{
													if (CQuery.<>o__5.<>p__10 == null)
													{
														CQuery.<>o__5.<>p__10 = CallSite<Func<CallSite, object, bool>>.Create(Binder.Convert(CSharpBinderFlags.None, typeof(bool), typeof(CQuery)));
													}
													Func<CallSite, object, bool> target9 = CQuery.<>o__5.<>p__10.Target;
													CallSite <>p__9 = CQuery.<>o__5.<>p__10;
													if (CQuery.<>o__5.<>p__9 == null)
													{
														CQuery.<>o__5.<>p__9 = CallSite<Func<CallSite, object, string, object>>.Create(Binder.BinaryOperation(CSharpBinderFlags.None, ExpressionType.Equal, typeof(CQuery), new CSharpArgumentInfo[]
														{
															CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
															CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null)
														}));
													}
													return target9(<>p__9, CQuery.<>o__5.<>p__9.Target(CQuery.<>o__5.<>p__9, element.getAttribute(parts[0], 0), parts[1]));
												});
												result = result.Where(delegate(IHTMLElement element)
												{
													if (CQuery.<>o__5.<>p__19 == null)
													{
														CQuery.<>o__5.<>p__19 = CallSite<Func<CallSite, object, bool>>.Create(Binder.Convert(CSharpBinderFlags.None, typeof(bool), typeof(CQuery)));
													}
													Func<CallSite, object, bool> target9 = CQuery.<>o__5.<>p__19.Target;
													CallSite <>p__9 = CQuery.<>o__5.<>p__19;
													if (CQuery.<>o__5.<>p__11 == null)
													{
														CQuery.<>o__5.<>p__11 = CallSite<Func<CallSite, object, string, object>>.Create(Binder.BinaryOperation(CSharpBinderFlags.None, ExpressionType.Equal, typeof(CQuery), new CSharpArgumentInfo[]
														{
															CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
															CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null)
														}));
													}
													object obj6 = CQuery.<>o__5.<>p__11.Target(CQuery.<>o__5.<>p__11, element.getAttribute(parts[0], 0), parts[1]);
													if (CQuery.<>o__5.<>p__18 == null)
													{
														CQuery.<>o__5.<>p__18 = CallSite<Func<CallSite, object, bool>>.Create(Binder.UnaryOperation(CSharpBinderFlags.None, ExpressionType.IsTrue, typeof(CQuery), new CSharpArgumentInfo[]
														{
															CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
														}));
													}
													object arg13;
													if (!CQuery.<>o__5.<>p__18.Target(CQuery.<>o__5.<>p__18, obj6))
													{
														if (CQuery.<>o__5.<>p__17 == null)
														{
															CQuery.<>o__5.<>p__17 = CallSite<Func<CallSite, object, object, object>>.Create(Binder.BinaryOperation(CSharpBinderFlags.BinaryOperationLogical, ExpressionType.Or, typeof(CQuery), new CSharpArgumentInfo[]
															{
																CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
																CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
															}));
														}
														Func<CallSite, object, object, object> target10 = CQuery.<>o__5.<>p__17.Target;
														CallSite <>p__10 = CQuery.<>o__5.<>p__17;
														object arg8 = obj6;
														bool flag13 = Regex.IsMatch(parts[1], "\\.\\*");
														object arg12;
														if (flag13)
														{
															if (CQuery.<>o__5.<>p__16 == null)
															{
																CQuery.<>o__5.<>p__16 = CallSite<Func<CallSite, bool, object, object>>.Create(Binder.BinaryOperation(CSharpBinderFlags.BinaryOperationLogical, ExpressionType.And, typeof(CQuery), new CSharpArgumentInfo[]
																{
																	CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),
																	CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
																}));
															}
															Func<CallSite, bool, object, object> target11 = CQuery.<>o__5.<>p__16.Target;
															CallSite <>p__11 = CQuery.<>o__5.<>p__16;
															bool arg9 = flag13;
															if (CQuery.<>o__5.<>p__12 == null)
															{
																CQuery.<>o__5.<>p__12 = CallSite<Func<CallSite, object, object, object>>.Create(Binder.BinaryOperation(CSharpBinderFlags.None, ExpressionType.NotEqual, typeof(CQuery), new CSharpArgumentInfo[]
																{
																	CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
																	CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.Constant, null)
																}));
															}
															object obj7 = CQuery.<>o__5.<>p__12.Target(CQuery.<>o__5.<>p__12, element.getAttribute(parts[0], 0), null);
															if (CQuery.<>o__5.<>p__15 == null)
															{
																CQuery.<>o__5.<>p__15 = CallSite<Func<CallSite, object, bool>>.Create(Binder.UnaryOperation(CSharpBinderFlags.None, ExpressionType.IsFalse, typeof(CQuery), new CSharpArgumentInfo[]
																{
																	CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
																}));
															}
															object arg11;
															if (!CQuery.<>o__5.<>p__15.Target(CQuery.<>o__5.<>p__15, obj7))
															{
																if (CQuery.<>o__5.<>p__14 == null)
																{
																	CQuery.<>o__5.<>p__14 = CallSite<Func<CallSite, object, bool, object>>.Create(Binder.BinaryOperation(CSharpBinderFlags.BinaryOperationLogical, ExpressionType.And, typeof(CQuery), new CSharpArgumentInfo[]
																	{
																		CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
																		CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null)
																	}));
																}
																Func<CallSite, object, bool, object> target12 = CQuery.<>o__5.<>p__14.Target;
																CallSite <>p__12 = CQuery.<>o__5.<>p__14;
																object arg10 = obj7;
																if (CQuery.<>o__5.<>p__13 == null)
																{
																	CQuery.<>o__5.<>p__13 = CallSite<Func<CallSite, object, string>>.Create(Binder.Convert(CSharpBinderFlags.ConvertExplicit, typeof(string), typeof(CQuery)));
																}
																arg11 = target12(<>p__12, arg10, CQuery.<>o__5.<>p__13.Target(CQuery.<>o__5.<>p__13, element.getAttribute(parts[0], 0)).Contains(parts[1].Replace(".*", "")));
															}
															else
															{
																arg11 = obj7;
															}
															arg12 = target11(<>p__11, arg9, arg11);
														}
														else
														{
															arg12 = flag13;
														}
														arg13 = target10(<>p__10, arg8, arg12);
													}
													else
													{
														arg13 = obj6;
													}
													return target9(<>p__9, arg13);
												}).ToList<IHTMLElement>();
												bool flag10 = result.Count == 0;
												if (flag10)
												{
													cont = false;
												}
											}
										}
										catch (Exception ex)
										{
											throw;
										}
									}
								}
							}
						}
					}
					bool flag11 = !cont;
					if (flag11)
					{
						break;
					}
				}
				bool flag12 = !cont;
				if (flag12)
				{
					break;
				}
			}
			return result;
		}

		// Token: 0x0600004B RID: 75 RVA: 0x00003B64 File Offset: 0x00001D64
		private static List<IHTMLElement> searchByClass(List<IHTMLElement> elements, string value)
		{
			List<IHTMLElement> result = new List<IHTMLElement>();
			List<string> parts = value.Split(new char[]
			{
				'|'
			}).ToList<string>();
			foreach (IHTMLElement element in elements)
			{
				foreach (string part in parts)
				{
					bool flag = Regex.IsMatch(element.className, part);
					if (flag)
					{
						result.Add(element);
						break;
					}
				}
			}
			return result;
		}

		// Token: 0x0600004C RID: 76 RVA: 0x00003C30 File Offset: 0x00001E30
		private static List<IHTMLElement> searchByInnerText(List<IHTMLElement> elements, string value)
		{
			List<IHTMLElement> result = new List<IHTMLElement>();
			List<string> parts = value.Split(new char[]
			{
				'|'
			}).ToList<string>();
			List<string> chars = new List<string>
			{
				"\\",
				"$",
				"^",
				"*",
				"(",
				")",
				"+",
				"{",
				"}",
				"[",
				"]",
				"|",
				"?",
				"-",
				".",
				"/"
			};
			foreach (string part in parts)
			{
				string partTemp = Regex.Replace(part, "\\W", string.Empty);
				chars.ForEach(delegate(string c)
				{
					partTemp = partTemp.Replace(c, "\\" + c);
				});
				foreach (IHTMLElement element in elements)
				{
					string text = element.innerText;
					bool flag = text != null;
					if (flag)
					{
						string temp = Regex.Replace(text, "\\W", string.Empty);
						bool flag2 = Regex.IsMatch(temp, partTemp);
						if (flag2)
						{
							result.Add(element);
							break;
						}
					}
				}
			}
			return result;
		}

		// Token: 0x0600004D RID: 77 RVA: 0x00003E28 File Offset: 0x00002028
		private static List<IHTMLElement> getChildren(dynamic elements)
		{
			List<IHTMLElement> children = new List<IHTMLElement>();
			if (CQuery.<>o__8.<>p__0 == null)
			{
				CQuery.<>o__8.<>p__0 = CallSite<Func<CallSite, object, IEnumerable>>.Create(Binder.Convert(CSharpBinderFlags.None, typeof(IEnumerable), typeof(CQuery)));
			}
			using (IEnumerator enumerator = CQuery.<>o__8.<>p__0.Target(CQuery.<>o__8.<>p__0, elements).GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					if (CQuery.<>o__8.<>p__1 == null)
					{
						CQuery.<>o__8.<>p__1 = CallSite<Func<CallSite, object, IHTMLElement>>.Create(Binder.Convert(CSharpBinderFlags.ConvertExplicit, typeof(IHTMLElement), typeof(CQuery)));
					}
					IHTMLElement element = CQuery.<>o__8.<>p__1.Target(CQuery.<>o__8.<>p__1, enumerator.Current);
					children.Add(element);
				}
			}
			return children;
		}

		// Token: 0x0600004E RID: 78 RVA: 0x00003F10 File Offset: 0x00002110
		private static List<IHTMLElement> getChild(IHTMLElement parent, string tagName)
		{
			List<IHTMLElement> children = new List<IHTMLElement>();
			if (CQuery.<>o__9.<>p__0 == null)
			{
				CQuery.<>o__9.<>p__0 = CallSite<Func<CallSite, object, IEnumerable>>.Create(Binder.Convert(CSharpBinderFlags.None, typeof(IEnumerable), typeof(CQuery)));
			}
			using (IEnumerator enumerator = CQuery.<>o__9.<>p__0.Target(CQuery.<>o__9.<>p__0, parent.children).GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					if (CQuery.<>o__9.<>p__1 == null)
					{
						CQuery.<>o__9.<>p__1 = CallSite<Func<CallSite, object, IHTMLElement>>.Create(Binder.Convert(CSharpBinderFlags.ConvertExplicit, typeof(IHTMLElement), typeof(CQuery)));
					}
					IHTMLElement child = CQuery.<>o__9.<>p__1.Target(CQuery.<>o__9.<>p__1, enumerator.Current);
					bool flag = child.tagName == tagName.ToUpper();
					if (flag)
					{
						children.Add(child);
					}
					children.AddRange(CQuery.getChild(child, tagName));
				}
			}
			return children;
		}

		// Token: 0x0400001C RID: 28
		private static string pattern = "\\[.*\\]$|([:=\\[\\(]{0}[a-zA-Z0-9;]{1,})";
	}
}
