(() => {
  function t(e) {
    return (
      (t =
        "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
          ? function (t) {
              return typeof t;
            }
          : function (t) {
              return t &&
                "function" == typeof Symbol &&
                t.constructor === Symbol &&
                t !== Symbol.prototype
                ? "symbol"
                : typeof t;
            }),
      t(e)
    );
  }
  function e() {
    "use strict";
    /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ e =
      function () {
        return n;
      };
    var n = {},
      r = Object.prototype,
      o = r.hasOwnProperty,
      i =
        Object.defineProperty ||
        function (t, e, n) {
          t[e] = n.value;
        },
      s = "function" == typeof Symbol ? Symbol : {},
      a = s.iterator || "@@iterator",
      c = s.asyncIterator || "@@asyncIterator",
      u = s.toStringTag || "@@toStringTag";
    function l(t, e, n) {
      return (
        Object.defineProperty(t, e, {
          value: n,
          enumerable: !0,
          configurable: !0,
          writable: !0,
        }),
        t[e]
      );
    }
    try {
      l({}, "");
    } catch (t) {
      l = function (t, e, n) {
        return (t[e] = n);
      };
    }
    function f(t, e, n, r) {
      var o = e && e.prototype instanceof d ? e : d,
        s = Object.create(o.prototype),
        a = new L(r || []);
      return i(s, "_invoke", { value: S(t, n, a) }), s;
    }
    function h(t, e, n) {
      try {
        return { type: "normal", arg: t.call(e, n) };
      } catch (t) {
        return { type: "throw", arg: t };
      }
    }
    n.wrap = f;
    var p = {};
    function d() {}
    function m() {}
    function g() {}
    var _ = {};
    l(_, a, function () {
      return this;
    });
    var v = Object.getPrototypeOf,
      y = v && v(v(B([])));
    y && y !== r && o.call(y, a) && (_ = y);
    var b = (g.prototype = d.prototype = Object.create(_));
    function w(t) {
      ["next", "throw", "return"].forEach(function (e) {
        l(t, e, function (t) {
          return this._invoke(e, t);
        });
      });
    }
    function x(e, n) {
      function r(i, s, a, c) {
        var u = h(e[i], e, s);
        if ("throw" !== u.type) {
          var l = u.arg,
            f = l.value;
          return f && "object" == t(f) && o.call(f, "__await")
            ? n.resolve(f.__await).then(
                function (t) {
                  r("next", t, a, c);
                },
                function (t) {
                  r("throw", t, a, c);
                }
              )
            : n.resolve(f).then(
                function (t) {
                  (l.value = t), a(l);
                },
                function (t) {
                  return r("throw", t, a, c);
                }
              );
        }
        c(u.arg);
      }
      var s;
      i(this, "_invoke", {
        value: function (t, e) {
          function o() {
            return new n(function (n, o) {
              r(t, e, n, o);
            });
          }
          return (s = s ? s.then(o, o) : o());
        },
      });
    }
    function S(t, e, n) {
      var r = "suspendedStart";
      return function (o, i) {
        if ("executing" === r) throw new Error("Generator is already running");
        if ("completed" === r) {
          if ("throw" === o) throw i;
          return T();
        }
        for (n.method = o, n.arg = i; ; ) {
          var s = n.delegate;
          if (s) {
            var a = k(s, n);
            if (a) {
              if (a === p) continue;
              return a;
            }
          }
          if ("next" === n.method) n.sent = n._sent = n.arg;
          else if ("throw" === n.method) {
            if ("suspendedStart" === r) throw ((r = "completed"), n.arg);
            n.dispatchException(n.arg);
          } else "return" === n.method && n.abrupt("return", n.arg);
          r = "executing";
          var c = h(t, e, n);
          if ("normal" === c.type) {
            if (((r = n.done ? "completed" : "suspendedYield"), c.arg === p))
              continue;
            return { value: c.arg, done: n.done };
          }
          "throw" === c.type &&
            ((r = "completed"), (n.method = "throw"), (n.arg = c.arg));
        }
      };
    }
    function k(t, e) {
      var n = e.method,
        r = t.iterator[n];
      if (void 0 === r)
        return (
          (e.delegate = null),
          ("throw" === n &&
            t.iterator.return &&
            ((e.method = "return"),
            (e.arg = void 0),
            k(t, e),
            "throw" === e.method)) ||
            ("return" !== n &&
              ((e.method = "throw"),
              (e.arg = new TypeError(
                "The iterator does not provide a '" + n + "' method"
              )))),
          p
        );
      var o = h(r, t.iterator, e.arg);
      if ("throw" === o.type)
        return (e.method = "throw"), (e.arg = o.arg), (e.delegate = null), p;
      var i = o.arg;
      return i
        ? i.done
          ? ((e[t.resultName] = i.value),
            (e.next = t.nextLoc),
            "return" !== e.method && ((e.method = "next"), (e.arg = void 0)),
            (e.delegate = null),
            p)
          : i
        : ((e.method = "throw"),
          (e.arg = new TypeError("iterator result is not an object")),
          (e.delegate = null),
          p);
    }
    function P(t) {
      var e = { tryLoc: t[0] };
      1 in t && (e.catchLoc = t[1]),
        2 in t && ((e.finallyLoc = t[2]), (e.afterLoc = t[3])),
        this.tryEntries.push(e);
    }
    function E(t) {
      var e = t.completion || {};
      (e.type = "normal"), delete e.arg, (t.completion = e);
    }
    function L(t) {
      (this.tryEntries = [{ tryLoc: "root" }]),
        t.forEach(P, this),
        this.reset(!0);
    }
    function B(t) {
      if (t) {
        var e = t[a];
        if (e) return e.call(t);
        if ("function" == typeof t.next) return t;
        if (!isNaN(t.length)) {
          var n = -1,
            r = function e() {
              for (; ++n < t.length; )
                if (o.call(t, n)) return (e.value = t[n]), (e.done = !1), e;
              return (e.value = void 0), (e.done = !0), e;
            };
          return (r.next = r);
        }
      }
      return { next: T };
    }
    function T() {
      return { value: void 0, done: !0 };
    }
    return (
      (m.prototype = g),
      i(b, "constructor", { value: g, configurable: !0 }),
      i(g, "constructor", { value: m, configurable: !0 }),
      (m.displayName = l(g, u, "GeneratorFunction")),
      (n.isGeneratorFunction = function (t) {
        var e = "function" == typeof t && t.constructor;
        return (
          !!e && (e === m || "GeneratorFunction" === (e.displayName || e.name))
        );
      }),
      (n.mark = function (t) {
        return (
          Object.setPrototypeOf
            ? Object.setPrototypeOf(t, g)
            : ((t.__proto__ = g), l(t, u, "GeneratorFunction")),
          (t.prototype = Object.create(b)),
          t
        );
      }),
      (n.awrap = function (t) {
        return { __await: t };
      }),
      w(x.prototype),
      l(x.prototype, c, function () {
        return this;
      }),
      (n.AsyncIterator = x),
      (n.async = function (t, e, r, o, i) {
        void 0 === i && (i = Promise);
        var s = new x(f(t, e, r, o), i);
        return n.isGeneratorFunction(e)
          ? s
          : s.next().then(function (t) {
              return t.done ? t.value : s.next();
            });
      }),
      w(b),
      l(b, u, "Generator"),
      l(b, a, function () {
        return this;
      }),
      l(b, "toString", function () {
        return "[object Generator]";
      }),
      (n.keys = function (t) {
        var e = Object(t),
          n = [];
        for (var r in e) n.push(r);
        return (
          n.reverse(),
          function t() {
            for (; n.length; ) {
              var r = n.pop();
              if (r in e) return (t.value = r), (t.done = !1), t;
            }
            return (t.done = !0), t;
          }
        );
      }),
      (n.values = B),
      (L.prototype = {
        constructor: L,
        reset: function (t) {
          if (
            ((this.prev = 0),
            (this.next = 0),
            (this.sent = this._sent = void 0),
            (this.done = !1),
            (this.delegate = null),
            (this.method = "next"),
            (this.arg = void 0),
            this.tryEntries.forEach(E),
            !t)
          )
            for (var e in this)
              "t" === e.charAt(0) &&
                o.call(this, e) &&
                !isNaN(+e.slice(1)) &&
                (this[e] = void 0);
        },
        stop: function () {
          this.done = !0;
          var t = this.tryEntries[0].completion;
          if ("throw" === t.type) throw t.arg;
          return this.rval;
        },
        dispatchException: function (t) {
          if (this.done) throw t;
          var e = this;
          function n(n, r) {
            return (
              (s.type = "throw"),
              (s.arg = t),
              (e.next = n),
              r && ((e.method = "next"), (e.arg = void 0)),
              !!r
            );
          }
          for (var r = this.tryEntries.length - 1; r >= 0; --r) {
            var i = this.tryEntries[r],
              s = i.completion;
            if ("root" === i.tryLoc) return n("end");
            if (i.tryLoc <= this.prev) {
              var a = o.call(i, "catchLoc"),
                c = o.call(i, "finallyLoc");
              if (a && c) {
                if (this.prev < i.catchLoc) return n(i.catchLoc, !0);
                if (this.prev < i.finallyLoc) return n(i.finallyLoc);
              } else if (a) {
                if (this.prev < i.catchLoc) return n(i.catchLoc, !0);
              } else {
                if (!c)
                  throw new Error("try statement without catch or finally");
                if (this.prev < i.finallyLoc) return n(i.finallyLoc);
              }
            }
          }
        },
        abrupt: function (t, e) {
          for (var n = this.tryEntries.length - 1; n >= 0; --n) {
            var r = this.tryEntries[n];
            if (
              r.tryLoc <= this.prev &&
              o.call(r, "finallyLoc") &&
              this.prev < r.finallyLoc
            ) {
              var i = r;
              break;
            }
          }
          i &&
            ("break" === t || "continue" === t) &&
            i.tryLoc <= e &&
            e <= i.finallyLoc &&
            (i = null);
          var s = i ? i.completion : {};
          return (
            (s.type = t),
            (s.arg = e),
            i
              ? ((this.method = "next"), (this.next = i.finallyLoc), p)
              : this.complete(s)
          );
        },
        complete: function (t, e) {
          if ("throw" === t.type) throw t.arg;
          return (
            "break" === t.type || "continue" === t.type
              ? (this.next = t.arg)
              : "return" === t.type
              ? ((this.rval = this.arg = t.arg),
                (this.method = "return"),
                (this.next = "end"))
              : "normal" === t.type && e && (this.next = e),
            p
          );
        },
        finish: function (t) {
          for (var e = this.tryEntries.length - 1; e >= 0; --e) {
            var n = this.tryEntries[e];
            if (n.finallyLoc === t)
              return this.complete(n.completion, n.afterLoc), E(n), p;
          }
        },
        catch: function (t) {
          for (var e = this.tryEntries.length - 1; e >= 0; --e) {
            var n = this.tryEntries[e];
            if (n.tryLoc === t) {
              var r = n.completion;
              if ("throw" === r.type) {
                var o = r.arg;
                E(n);
              }
              return o;
            }
          }
          throw new Error("illegal catch attempt");
        },
        delegateYield: function (t, e, n) {
          return (
            (this.delegate = { iterator: B(t), resultName: e, nextLoc: n }),
            "next" === this.method && (this.arg = void 0),
            p
          );
        },
      }),
      n
    );
  }
  function n(t, e, n, r, o, i, s) {
    try {
      var a = t[i](s),
        c = a.value;
    } catch (t) {
      return void n(t);
    }
    a.done ? e(c) : Promise.resolve(c).then(r, o);
  }
  function r(t) {
    return function () {
      var e = this,
        r = arguments;
      return new Promise(function (o, i) {
        var s = t.apply(e, r);
        function a(t) {
          n(s, o, i, a, c, "next", t);
        }
        function c(t) {
          n(s, o, i, a, c, "throw", t);
        }
        a(void 0);
      });
    };
  }
  function o(e, n, r) {
    return (
      (n = (function (e) {
        var n = (function (e, n) {
          if ("object" !== t(e) || null === e) return e;
          var r = e[Symbol.toPrimitive];
          if (void 0 !== r) {
            var o = r.call(e, n || "default");
            if ("object" !== t(o)) return o;
            throw new TypeError("@@toPrimitive must return a primitive value.");
          }
          return ("string" === n ? String : Number)(e);
        })(e, "string");
        return "symbol" === t(n) ? n : String(n);
      })(n)) in e
        ? Object.defineProperty(e, n, {
            value: r,
            enumerable: !0,
            configurable: !0,
            writable: !0,
          })
        : (e[n] = r),
      e
    );
  }
  var i,
    s = [],
    a = 0,
    c = {
      load: function () {
        u({ command: "checkSearchStatus" }, function (t) {
          t &&
            t.is_search &&
            1 == t.is_search &&
            chrome.storage.local.get(function (t) {
              if (((c.uiSettings = t), 0 == $(".resultbox_listview").length)) {
                var e = c.uiSettings.referesh_count || 0;
                (e = parseInt(e)) >= 4
                  ? (c.initAutoBotProcess(), c.shoqAutoBotProcessToster())
                  : ((e += 1),
                    (c.uiSettings.referesh_count = e),
                    chrome.storage.local.set({
                      referesh_count: c.uiSettings.referesh_count,
                    }),
                    setTimeout(function () {
                      location.reload();
                    }, 100));
              } else
                (c.uiSettings.referesh_count = e),
                  chrome.storage.local.set({
                    referesh_count: c.uiSettings.referesh_count,
                  }),
                  c.initAutoBotProcess(),
                  c.shoqAutoBotProcessToster();
            });
        });
      },
      onExtMessage: function (t, e, n) {
        switch (((c.message = t), t.command)) {
          case "stopAutoBotProcessContent":
            u(
              { command: "stopAutoBotProcess", reason: t.reason }
            );
            break;
          case "removeBlocker":
            c.removeBlocker();
        }
      },
      addEvents: function (t, e, n) {
        $(document).on("click", "#view-auto-bot-progress-btn", function (t) {
          t.preventDefault(),
            u({ command: "viewAutoBotProcess" });
        });
      },
      shoqAutoBotProcessToster: function () {
        var t,
          e =
            "This is an active " +
            chrome.runtime.getManifest().name +
            " Tab Do not Close or Minimize";
        function n(t) {}
        (toastr.options =
          (o(
            (t = {
              closeButton: !1,
              debug: !1,
              progressBar: !1,
              preventDuplicates: !1,
              newestOnTop: !1,
              tapToDismiss: !1,
              positionClass: "toast-top-left",
              onclick: n,
              showDuration: "400",
              hideDuration: "1000",
              timeOut: 0,
              extendedTimeOut: 0,
            }),
            "extendedTimeOut",
            "1000"
          ),
          o(t, "showEasing", "swing"),
          o(t, "hideEasing", "linear"),
          o(t, "showMethod", "fadeIn"),
          o(t, "hideMethod", "noop"),
          t)),
          toastr.warning(e, chrome.runtime.getManifest().name + " is working"),
          setTimeout(function () {
            var t =
              "<a href='#' id='view-auto-bot-progress-btn'> View " +
              chrome.runtime.getManifest().name +
              " Auto Bot Process </a>";
            (toastr.options = {
              closeButton: !1,
              debug: !1,
              progressBar: !1,
              preventDuplicates: !1,
              newestOnTop: !1,
              tapToDismiss: !1,
              positionClass: "toast-top-left",
              onclick: n,
              showDuration: "400",
              hideDuration: "1000",
              timeOut: 0,
              extendedTimeOut: 0,
              showEasing: "swing",
              hideEasing: "linear",
              showMethod: "fadeIn",
              hideMethod: "noop",
            }),
              toastr.info(t, "");
          }, 3e3);
      },
      initAutoBotProcess: function (t, e, n) {
        chrome.storage.local.get(function (t) {
          (c.uiSettings = t),
            "Inprogress" == c.uiSettings.scrape_status &&
              (c.createBlocker(),
              c.zoomScroll(function () {
                c.startAutoBotProcess();
              }));
        });
      },
      createBlocker: function () {
        // $("#blocker").remove(),
        //   $("html body")
        //     .prepend(
        //       '<div style="width: 100%;height: 100%; top:0; left: 0; background-color: #000;opacity: 0.2; z-index: 200; position: fixed;" id="blocker"></div>'
        //     )
        //     .fadeIn(1e4);
      },
    //   removeBlocker: function () {
    //     $("#blocker").fadeOut(5e3), $("#toast-container").fadeOut(5e3);
    //   },
      zoomScroll: function (t) {
        $("html, body").animate(
          { scrollTop: $(document).height() - ($(window).height() - 1e3) },
          5e3
        ),
          null != t &&
            u({ command: "set_delay_in_bg", timeout: 5e3 }, function () {
              t();
              
            });
      },
      startAutoBotProcess: function () {
        chrome.storage.local.get(function (t) {
          c.uiSettings = t;
          c.uiSettings.scrape_status;
          u({ command: "updateScrapeState" });
        //   var n = c.uiSettings.scrape_limit_type,
        //     o =
        //       (c.uiSettings.scrape_status,
        //       parseInt(c.uiSettings.total_scrapped_count)),
        //     i = c.uiSettings.userFreeTrialStarted,
        //     s = parseInt(c.uiSettings.current_processed_count);
        //   if ("Limit" == n && s >= parseInt(c.uiSettings.scrape_limit))
        //     return (
        //       u(
        //         {
        //           command: "stopAutoBotProcess",
        //           reason: "next_profile_not_found",
        //         },
        //         function (t) {}
        //       ),
        //       !1
        //     );
        //   if (1 == i && parseInt(o) >= 20)
        //     return (
        //       u(
        //         {
        //           command: "stopAutoBotProcess",
        //           reason: "trial_version_expire",
        //         },
        //         function (t) {}
        //       ),
        //       !1
        //     );
          u(
            { command: "set_delay_in_bg", timeout: 1e3 * l(1, 1) },
            r(
              e().mark(function t() {
                return e().wrap(function (t) {
                  for (;;)
                    switch ((t.prev = t.next)) {
                      case 0:
                        chrome.storage.local.get(
                          (function () {
                            var t = r(
                              e().mark(function t(n) {
                                var r, o;
                                return e().wrap(function (t) {
                                  for (;;)
                                    switch ((t.prev = t.next)) {
                                      case 0:
                                        if (
                                          ((c.uiSettings = n),
                                          (r = c.uiSettings.scrapped_items_arr),
                                          "Inprogress" !=
                                            c.uiSettings.scrape_status)
                                        ) {
                                          t.next = 9;
                                          break;
                                        }
                                        return (
                                          (t.next = 6),
                                          c.scrapeCurrentPageData()
                                        );
                                      case 6:
                                        return (
                                          (o = t.sent),
                                          u(
                                            {
                                              command: "set_delay_in_bg",
                                              timeout: 100,
                                            },
                                            function () {
                                              chrome.storage.local.get(
                                                function (t) {
                                                  c.uiSettings = t;
                                                  var e =
                                                      c.uiSettings
                                                        .scrape_status,
                                                    n =
                                                      c.uiSettings
                                                        .total_scrapped_count,
                                                    i =
                                                      c.uiSettings
                                                        .scrape_limit_type,
                                                    s =
                                                      (parseInt(
                                                        c.uiSettings
                                                          .scrape_limit
                                                      ),
                                                      c.uiSettings
                                                        .scrape_item_index),
                                                    a =
                                                      c.uiSettings
                                                        .current_processed_count,
                                                    l =
                                                      c.uiSettings
                                                        .userFreeTrialStarted,
                                                    h =
                                                      c.uiSettings
                                                        .skip_duplicate_record_check;
                                                  if (
                                                    (false)
                                                  )
                                                    return (
                                                      u(
                                                        {
                                                        //   command:
                                                        //     "stopAutoBotProcess",
                                                        //   reason:
                                                        //     "trial_version_expire",
                                                        }
                                                      ),
                                                      !1
                                                    );
                                                  if ("Inprogress" == e) {
                                                    if (
                                                      false
                                                    )
                                                      return (
                                                        u(
                                                          {
                                                            command:
                                                              "stopAutoBotProcess",
                                                            reason:
                                                              "trial_version_expire",
                                                          }
                                                        ),
                                                        !1
                                                      );
                                                    var p = o.search_items_arr;
                                                    if (p && p.length > 0) {
                                                      var d = p[0];
                                                      f(
                                                        chrome.runtime.getManifest()
                                                          .name + " is working",
                                                        2e3,
                                                        "success",
                                                        'Collecting business data : "' +
                                                          d.name +
                                                          '"'
                                                      ),
                                                        c.getPgeItemDetails(
                                                          d,
                                                          function (t) {
                                                            var e = "",
                                                              o = "google.com",
                                                              l = "maps",
                                                              p = "search";
                                                            "" != d.title &&
                                                            null != d.title
                                                              ? (e =
                                                                  "https://www." +
                                                                  o +
                                                                  "/" +
                                                                  l +
                                                                  "/" +
                                                                  p +
                                                                  "/" +
                                                                  d.title +
                                                                  "/")
                                                              : (e =
                                                                  "https://www." +
                                                                  o +
                                                                  "/" +
                                                                  l +
                                                                  "/" +
                                                                  p +
                                                                  "/" +
                                                                  d.name +
                                                                  " " +
                                                                  (d.address ||
                                                                    "") +
                                                                  "/");
                                                            c.getPhoneFromAddress(
                                                              t,
                                                              e,
                                                              function (t) {
                                                                if (
                                                                  "Limit" == i
                                                                ) {
                                                                  var e =
                                                                    parseInt(
                                                                      c
                                                                        .uiSettings
                                                                        .scrape_limit
                                                                    );
                                                                  if (false)
                                                                    return (
                                                                      u(
                                                                        {
                                                                          command:
                                                                            "stopAutoBotProcess",
                                                                          reason:
                                                                            "next_profile_not_found",
                                                                        },
                                                                        function (
                                                                          t
                                                                        ) {}
                                                                      ),
                                                                      !1
                                                                    );
                                                                }
                                                                "" == t.name || "" == t.link
                                                                  ? (f(
                                                                      "Process is working...",
                                                                      2e3,
                                                                      "info",
                                                                      "Skip Business Profile!"
                                                                    ),
                                                                    (s =
                                                                      parseInt(
                                                                        s
                                                                      ) + 1))
                                                                  : 0 ==
                                                                    c.checkDuplicatesData(
                                                                      r,
                                                                      t,
                                                                      h
                                                                    )
                                                                  ? (delete t.title,
                                                                    r.push(t),
                                                                    (n =
                                                                      parseInt(
                                                                        n
                                                                      ) + 1),
                                                                    (a =
                                                                      parseInt(
                                                                        a
                                                                      ) + 1),
                                                                    (s =
                                                                      parseInt(
                                                                        s
                                                                      ) + 1))
                                                                  : (f(
                                                                      "Process is working...",
                                                                      2e3,
                                                                      "info",
                                                                      "Skip Business Profile!"
                                                                    ),
                                                                    (s =
                                                                      parseInt(
                                                                        s
                                                                      ) + 1));
                                                                chrome.storage.local.get(
                                                                  function (t) {
                                                                    (c.uiSettings =
                                                                      t),
                                                                      (c.uiSettings.scrapped_items_arr =
                                                                        r),
                                                                      (c.uiSettings.total_scrapped_count =
                                                                        n),
                                                                      (c.uiSettings.current_processed_count =
                                                                        a),
                                                                      (c.uiSettings.scrape_item_index =
                                                                        s),
                                                                      chrome.storage.local.set(
                                                                        {
                                                                          scrapped_items_arr:
                                                                            c
                                                                              .uiSettings
                                                                              .scrapped_items_arr,
                                                                          total_scrapped_count:
                                                                            c
                                                                              .uiSettings
                                                                              .total_scrapped_count,
                                                                          scrape_item_index:
                                                                            c
                                                                              .uiSettings
                                                                              .scrape_item_index,
                                                                          current_processed_count:
                                                                            c
                                                                              .uiSettings
                                                                              .current_processed_count,
                                                                        }
                                                                      ),
                                                                      c.startAutoBotProcess();
                                                                  }
                                                                );
                                                              }
                                                            );
                                                          }
                                                        );
                                                    } else
                                                      "Inprogress" == e &&
                                                        c.clickNextPage();
                                                  }
                                                }
                                              );
                                            }
                                          ),
                                          t.abrupt("return", !1)
                                        );
                                      case 9:
                                      case "end":
                                        return t.stop();
                                    }
                                }, t);
                              })
                            );
                            return function (e) {
                              return t.apply(this, arguments);
                            };
                          })()
                        );
                      case 1:
                      case "end":
                        return t.stop();
                    }
                }, t);
              })
            )
          );
        });
      },
      checkDuplicatesData: function (t, e, n) {
        for (var r = !1, o = 0; o < t.length; o++) {
          var i = t[o];
          if (
            1 == n &&
            i.name == e.name &&
            i.contact_number_2 == e.contact_number_2
          ) {
            r = !0;
            break;
          }
        }
        return r;
      },
      scroll_items_div: function (t, e) {
        var n = $("html"),
          r = 3e3 * t,
          o = n.scrollTop();
        (o = parseInt(o)),
          0 == n.length
            ? e()
            : (n.animate({ scrollTop: 0 }, 0),
              n.animate({ scrollTop: r }, 3e3, function () {
                u({ command: "set_delay_in_bg", timeout: 3e3 }, function () {
                  t += 1;
                  var r = n.scrollTop();
                  (r = parseInt(r)) == o ? e() : c.scroll_items_div(t, e);
                });
              }));
      },
      clickNextPage: function () {
        if (1 == navigator.onLine) {
          var t = $("html:eq(0)");
          a = t.scrollTop();
          var e = 1e3 * l(3, 6);
          t.animate({ scrollTop: 0 }, 0);
          var n = $('[class*="results_listing_container"]'),
            r = n.find('[role="listitem"]:last');
          0 == r.length && (r = n.find(".resultbox:last")),
            r.length > 0 &&
              r[0].scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" }); window.scrollTo(0, document.body.scrollHeight);
            u({ command: "set_delay_in_bg", timeout: e }, function () {
              var e = t.scrollTop();
              u({ command: "set_delay_in_bg", timeout: 500 }, function () {
                var t = $(
                  ".resultbox .resultbox_info"
                );
                e == a || t.length > 0
                  ? t.length > 0
                    ? u(
                        { command: "set_delay_in_bg", timeout: 500 },
                        function () {
                          chrome.storage.local.get(function (t) {
                            var e = t.data_not_found_referesh_count || 0;
                            e >= 5
                              ? ((e = 0),
                                chrome.storage.local.set({
                                  data_not_found_referesh_count: e,
                                }),
                                u(
                                  {
                                    // command: "stopAutoBotProcess",
                                    // reason: "next_profile_not_found",
                                  }
                                ))
                              : ((e += 1),
                                chrome.storage.local.set({
                                  data_not_found_referesh_count: e,
                                }),
                                location.reload(!0));
                          });
                        }
                      )
                    : u(
                        {
                        //   command: "stopAutoBotProcess",
                        //   reason: "next_profile_not_found",
                        }
                      )
                  : u(
                      { command: "set_delay_in_bg", timeout: 1e3 * l(3, 6) },
                      function () {
                        c.startAutoBotProcess();
                      }
                    );
              });
            });
        }
      },
      getPhoneFromAddress: function (t, e, n) {
        // As requested, skipping the Google Search fallback.
        return n(t), !1;
      },
      scrapeCurrentPageData:
        ((i = r(
          e().mark(function t() {
            var n, r, o, i, s, a;
            return e().wrap(function (t) {
              for (;;)
                switch ((t.prev = t.next)) {
                  case 0:
                    return (t.next = 2), chrome.storage.local.get();
                  case 2:
                    return (
                      (n = t.sent),
                      (r = n.scrape_item_index),
                      (o = {}),
                      (i = $('[class*="results_listing_container"]')),
                      0 ==
                        (s = i.find('[role="listitem"]:eq(' + r + ")"))
                          .length && (s = i.find(".resultbox:eq(" + r + ")")),
                      s.length > 0 &&
                        s[0].scrollIntoView({
                          behavior: "smooth",
                          block: "center",
                          inline: "nearest",
                        }),
                      (a = []),
                      s.each(function () {
                        var t = {
                            name: "",
                            title: "",
                            address: "",
                            contact_number: "",
                            contact_number_2: "",
                            reviews: "",
                            rating: "",
                            hours_of_operation: "",
                            link: "",
                          },
                          e = "";
                        $(this).find(".resultbox_title_anchor:eq(0)").length >
                          0 &&
                          (e = $(this)
                            .find(".resultbox_title_anchor:eq(0)")
                            .text()
                            .trim());
                        var n = "";
                        $(this).find(".resultbox_title_anchorbox:eq(0)")
                          .length > 0 &&
                          (n = $(this)
                            .find(".resultbox_title_anchorbox:eq(0)")
                            .prop("href"));
                        var r = "";
                        $(this).find(".resultbox_address:eq(0)").length > 0 &&
                          (r = $(this)
                            .find(".resultbox_address:eq(0)")
                            .text()
                            .trim());
                        var o = "";
                        $(this).find(".resultbox_title_anchorbox:eq(0)")
                          .length > 0 &&
                          (o = $(this)
                            .find(".resultbox_title_anchorbox:eq(0)")
                            .prop("title"));
                        var i = "";
                        if ($(this).find(".callcontent").length > 0) {
                          i = $(this).find(".callcontent").text().trim();
                        } else if ($(this).find(".callNowAnchor").length > 0) {
                          i = $(this).find(".callNowAnchor").text().trim();
                        }
                        var s = $(this)
                            .find(".resultbox_totalrate:eq(0)")
                            .text()
                            .trim(),
                          c = $(this)
                            .find(".resultbox_countrate:eq(0)")
                            .text()
                            .trim(),
                          u = $(this)
                            .find(".resultbox_activity:eq(0)")
                            .text()
                            .trim();
                        (t.name = e),
                          (t.title = o),
                          (t.address = r),
                          (t.link = n),
                          (t.reviews = s),
                          (t.rating = c),
                          (t.hours_of_operation = u),
                          (t.contact_number = i),
                          a.push(t);
                      }),
                      (o.search_items_arr = a || []),
                      t.abrupt("return", o)
                    );
                  case 14:
                  case "end":
                    return t.stop();
                }
            }, t);
          })
        )),
        function () {
          return i.apply(this, arguments);
        }),
      getPgeItemDetails: function (t, e) {
        return e(t), !1;
      },
      getWhatsappNumber: function (t, e) {
        u({ command: "getWhatsappNumber", data: t }, function (t) {
          e(t);
        });
      },
      parseQueryString: function (t) {
        var e,
          n,
          r,
          o,
          i = {};
        for (r = 0, o = (e = t.replace("?", "&").split("&")).length; r < o; r++)
          i[(n = e[r].split("="))[0]] = n[1];
        return i;
      },
    };
  function u(t, e) {
    null != e && (s.push(e), (t.callback = "yes")),
      chrome.runtime.sendMessage(t, e);
  }
  function l(t, e) {
    return Math.floor(Math.random() * (e - t + 1) + t);
  }
  function f(t, e, n, r, o) {
    null == e && (e = "7000"),
      (o = null != o ? "toast-top-right" : "toast-top-left"),
      (showTypeArr = ["success", "info", "warning", "error"]),
      (toastr.options = {
        closeButton: !0,
        debug: !1,
        progressBar: !0,
        preventDuplicates: !0,
        newestOnTop: !1,
        positionClass: o,
        onclick: function (t) {},
        showDuration: "400",
        hideDuration: "1000",
        timeOut: e,
        extendedTimeOut: "1000",
        showEasing: "swing",
        hideEasing: "linear",
        showMethod: "fadeIn",
        hideMethod: "fadeOut",
      }),
      null == r && (r = "eLink is working"),
      showTypeArr.includes(n) ? toastr[n](t, r) : toastr.info(t, r);
  }
  chrome.runtime.onMessage.addListener(c.onExtMessage),
    $(document).ready(function () {
      u({ command: "set_delay_in_bg", timeout: 1e3 }, function () {
        c.load(), c.addEvents();
      });
    }),
    window.addEventListener("load", function () {
      window.addEventListener("online", function (t) {
        u({ command: "checkSearchStatus" }, function (t) {
          t &&
            t.is_search &&
            1 == t.is_search &&
            u({ command: "set_delay_in_bg", timeout: 1e3 }, function () {
              window.location.reload();
            });
        });
      });
    });
})();
