(() => {
  "use strict";
  const t = {
    base_api_url: "",
    save_user_api_url: "",
    save_install_api_url: "",
    save_activity_api_url: "",
    auth_user_api_url: "",
  };
  function e(t) {
    return (
      (e =
        "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;
            }),
      e(t)
    );
  }
  var r;
  function n(t, r, n) {
    return (
      (r = (function (t) {
        var r = (function (t, r) {
          if ("object" !== e(t) || null === t) return t;
          var n = t[Symbol.toPrimitive];
          if (void 0 !== n) {
            var o = n.call(t, r || "default");
            if ("object" !== e(o)) return o;
            throw new TypeError("@@toPrimitive must return a primitive value.");
          }
          return ("string" === r ? String : Number)(t);
        })(t, "string");
        return "symbol" === e(r) ? r : String(r);
      })(r)) in t
        ? Object.defineProperty(t, r, {
            value: n,
            enumerable: !0,
            configurable: !0,
            writable: !0,
          })
        : (t[r] = n),
      t
    );
  }
  function o() {
    /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ o =
      function () {
        return t;
      };
    var t = {},
      r = Object.prototype,
      n = r.hasOwnProperty,
      i =
        Object.defineProperty ||
        function (t, e, r) {
          t[e] = r.value;
        },
      a = "function" == typeof Symbol ? Symbol : {},
      s = a.iterator || "@@iterator",
      c = a.asyncIterator || "@@asyncIterator",
      u = a.toStringTag || "@@toStringTag";
    function l(t, e, r) {
      return (
        Object.defineProperty(t, e, {
          value: r,
          enumerable: !0,
          configurable: !0,
          writable: !0,
        }),
        t[e]
      );
    }
    try {
      l({}, "");
    } catch (t) {
      l = function (t, e, r) {
        return (t[e] = r);
      };
    }
    function p(t, e, r, n) {
      var o = e && e.prototype instanceof f ? e : f,
        a = Object.create(o.prototype),
        s = new E(n || []);
      return i(a, "_invoke", { value: x(t, r, s) }), a;
    }
    function d(t, e, r) {
      try {
        return { type: "normal", arg: t.call(e, r) };
      } catch (t) {
        return { type: "throw", arg: t };
      }
    }
    t.wrap = p;
    var h = {};
    function f() {}
    function m() {}
    function g() {}
    var v = {};
    l(v, s, function () {
      return this;
    });
    var y = Object.getPrototypeOf,
      _ = y && y(y(C([])));
    _ && _ !== r && n.call(_, s) && (v = _);
    var S = (g.prototype = f.prototype = Object.create(v));
    function w(t) {
      ["next", "throw", "return"].forEach(function (e) {
        l(t, e, function (t) {
          return this._invoke(e, t);
        });
      });
    }
    function b(t, r) {
      function o(i, a, s, c) {
        var u = d(t[i], t, a);
        if ("throw" !== u.type) {
          var l = u.arg,
            p = l.value;
          return p && "object" == e(p) && n.call(p, "__await")
            ? r.resolve(p.__await).then(
                function (t) {
                  o("next", t, s, c);
                },
                function (t) {
                  o("throw", t, s, c);
                }
              )
            : r.resolve(p).then(
                function (t) {
                  (l.value = t), s(l);
                },
                function (t) {
                  return o("throw", t, s, c);
                }
              );
        }
        c(u.arg);
      }
      var a;
      i(this, "_invoke", {
        value: function (t, e) {
          function n() {
            return new r(function (r, n) {
              o(t, e, r, n);
            });
          }
          return (a = a ? a.then(n, n) : n());
        },
      });
    }
    function x(t, e, r) {
      var n = "suspendedStart";
      return function (o, i) {
        if ("executing" === n) throw new Error("Generator is already running");
        if ("completed" === n) {
          if ("throw" === o) throw i;
          return O();
        }
        for (r.method = o, r.arg = i; ; ) {
          var a = r.delegate;
          if (a) {
            var s = k(a, r);
            if (s) {
              if (s === h) continue;
              return s;
            }
          }
          if ("next" === r.method) r.sent = r._sent = r.arg;
          else if ("throw" === r.method) {
            if ("suspendedStart" === n) throw ((n = "completed"), r.arg);
            r.dispatchException(r.arg);
          } else "return" === r.method && r.abrupt("return", r.arg);
          n = "executing";
          var c = d(t, e, r);
          if ("normal" === c.type) {
            if (((n = r.done ? "completed" : "suspendedYield"), c.arg === h))
              continue;
            return { value: c.arg, done: r.done };
          }
          "throw" === c.type &&
            ((n = "completed"), (r.method = "throw"), (r.arg = c.arg));
        }
      };
    }
    function k(t, e) {
      var r = e.method,
        n = t.iterator[r];
      if (void 0 === n)
        return (
          (e.delegate = null),
          ("throw" === r &&
            t.iterator.return &&
            ((e.method = "return"),
            (e.arg = void 0),
            k(t, e),
            "throw" === e.method)) ||
            ("return" !== r &&
              ((e.method = "throw"),
              (e.arg = new TypeError(
                "The iterator does not provide a '" + r + "' method"
              )))),
          h
        );
      var o = d(n, t.iterator, e.arg);
      if ("throw" === o.type)
        return (e.method = "throw"), (e.arg = o.arg), (e.delegate = null), h;
      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),
            h)
          : i
        : ((e.method = "throw"),
          (e.arg = new TypeError("iterator result is not an object")),
          (e.delegate = null),
          h);
    }
    function $(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 L(t) {
      var e = t.completion || {};
      (e.type = "normal"), delete e.arg, (t.completion = e);
    }
    function E(t) {
      (this.tryEntries = [{ tryLoc: "root" }]),
        t.forEach($, this),
        this.reset(!0);
    }
    function C(t) {
      if (t) {
        var e = t[s];
        if (e) return e.call(t);
        if ("function" == typeof t.next) return t;
        if (!isNaN(t.length)) {
          var r = -1,
            o = function e() {
              for (; ++r < t.length; )
                if (n.call(t, r)) return (e.value = t[r]), (e.done = !1), e;
              return (e.value = void 0), (e.done = !0), e;
            };
          return (o.next = o);
        }
      }
      return { next: O };
    }
    function O() {
      return { value: void 0, done: !0 };
    }
    return (
      (m.prototype = g),
      i(S, "constructor", { value: g, configurable: !0 }),
      i(g, "constructor", { value: m, configurable: !0 }),
      (m.displayName = l(g, u, "GeneratorFunction")),
      (t.isGeneratorFunction = function (t) {
        var e = "function" == typeof t && t.constructor;
        return (
          !!e && (e === m || "GeneratorFunction" === (e.displayName || e.name))
        );
      }),
      (t.mark = function (t) {
        return (
          Object.setPrototypeOf
            ? Object.setPrototypeOf(t, g)
            : ((t.__proto__ = g), l(t, u, "GeneratorFunction")),
          (t.prototype = Object.create(S)),
          t
        );
      }),
      (t.awrap = function (t) {
        return { __await: t };
      }),
      w(b.prototype),
      l(b.prototype, c, function () {
        return this;
      }),
      (t.AsyncIterator = b),
      (t.async = function (e, r, n, o, i) {
        void 0 === i && (i = Promise);
        var a = new b(p(e, r, n, o), i);
        return t.isGeneratorFunction(r)
          ? a
          : a.next().then(function (t) {
              return t.done ? t.value : a.next();
            });
      }),
      w(S),
      l(S, u, "Generator"),
      l(S, s, function () {
        return this;
      }),
      l(S, "toString", function () {
        return "[object Generator]";
      }),
      (t.keys = function (t) {
        var e = Object(t),
          r = [];
        for (var n in e) r.push(n);
        return (
          r.reverse(),
          function t() {
            for (; r.length; ) {
              var n = r.pop();
              if (n in e) return (t.value = n), (t.done = !1), t;
            }
            return (t.done = !0), t;
          }
        );
      }),
      (t.values = C),
      (E.prototype = {
        constructor: E,
        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(L),
            !t)
          )
            for (var e in this)
              "t" === e.charAt(0) &&
                n.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 r(r, n) {
            return (
              (a.type = "throw"),
              (a.arg = t),
              (e.next = r),
              n && ((e.method = "next"), (e.arg = void 0)),
              !!n
            );
          }
          for (var o = this.tryEntries.length - 1; o >= 0; --o) {
            var i = this.tryEntries[o],
              a = i.completion;
            if ("root" === i.tryLoc) return r("end");
            if (i.tryLoc <= this.prev) {
              var s = n.call(i, "catchLoc"),
                c = n.call(i, "finallyLoc");
              if (s && c) {
                if (this.prev < i.catchLoc) return r(i.catchLoc, !0);
                if (this.prev < i.finallyLoc) return r(i.finallyLoc);
              } else if (s) {
                if (this.prev < i.catchLoc) return r(i.catchLoc, !0);
              } else {
                if (!c)
                  throw new Error("try statement without catch or finally");
                if (this.prev < i.finallyLoc) return r(i.finallyLoc);
              }
            }
          }
        },
        abrupt: function (t, e) {
          for (var r = this.tryEntries.length - 1; r >= 0; --r) {
            var o = this.tryEntries[r];
            if (
              o.tryLoc <= this.prev &&
              n.call(o, "finallyLoc") &&
              this.prev < o.finallyLoc
            ) {
              var i = o;
              break;
            }
          }
          i &&
            ("break" === t || "continue" === t) &&
            i.tryLoc <= e &&
            e <= i.finallyLoc &&
            (i = null);
          var a = i ? i.completion : {};
          return (
            (a.type = t),
            (a.arg = e),
            i
              ? ((this.method = "next"), (this.next = i.finallyLoc), h)
              : this.complete(a)
          );
        },
        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),
            h
          );
        },
        finish: function (t) {
          for (var e = this.tryEntries.length - 1; e >= 0; --e) {
            var r = this.tryEntries[e];
            if (r.finallyLoc === t)
              return this.complete(r.completion, r.afterLoc), L(r), h;
          }
        },
        catch: function (t) {
          for (var e = this.tryEntries.length - 1; e >= 0; --e) {
            var r = this.tryEntries[e];
            if (r.tryLoc === t) {
              var n = r.completion;
              if ("throw" === n.type) {
                var o = n.arg;
                L(r);
              }
              return o;
            }
          }
          throw new Error("illegal catch attempt");
        },
        delegateYield: function (t, e, r) {
          return (
            (this.delegate = { iterator: C(t), resultName: e, nextLoc: r }),
            "next" === this.method && (this.arg = void 0),
            h
          );
        },
      }),
      t
    );
  }
  function i(t, e, r, n, o, i, a) {
    try {
      var s = t[i](a),
        c = s.value;
    } catch (t) {
      return void r(t);
    }
    s.done ? e(c) : Promise.resolve(c).then(n, o);
  }
  var a =
    (n(
      (r = {
        uiSettings: {},
        load: function () {
          a.addEvents(),
            a.setSettingsValues(),
            a.updateScrapeState(),
            a.checkUserAuth();
        },
        addEvents: function () {
          $(document).on("click", ".close-popup", function (t) {
            self.close();
          }),
            $(document).on(
              "change keyup input",
              "#skip_duplicate_record_check",
              function (t) {
                var e = $(this).is(":checked");
                chrome.storage.local.get(function (t) {
                  (a.uiSettings = t),
                    (a.uiSettings.skip_duplicate_record_check = e),
                    chrome.storage.local.set({
                      skip_duplicate_record_check:
                        a.uiSettings.skip_duplicate_record_check,
                    });
                });
              }
            ),
            $(document).on("click", ".sign-out-btn", function (t) {
              t.preventDefault(),
                chrome.storage.local.get(function (t) {
                  (a.uiSettings = t),
                    (a.uiSettings.authUser = !1),
                    (a.uiSettings.authName = ""),
                    chrome.storage.local.set(
                      {
                        authUser: a.uiSettings.authUser,
                        authName: a.uiSettings.authName,
                      },
                      function (t) {
                        location.reload();
                      }
                    );
                });
            }),
            $(document).on("click", ".export-data-btn", function (t) {
              t.preventDefault(),
                s({ command: "downloadCSV", data: {} });
            }),
            $(document).on("click", ".clear-data-btn", function (t) {
              Swal.fire({
                type: "warning",
                title: "Are you sure you want to clear report data!",
                text: "",
                showCancelButton: !0,
                confirmButtonColor: "#3085d6",
                cancelButtonColor: "#d33",
                confirmButtonText: "Confirm",
              }).then(
                (function () {
                  var e,
                    r =
                      ((e = o().mark(function e(r) {
                        return o().wrap(function (e) {
                          for (;;)
                            switch ((e.prev = e.next)) {
                              case 0:
                                r.value &&
                                  (t.preventDefault(),
                                  chrome.storage.local.get(function (t) {
                                    (a.uiSettings = t),
                                      (a.uiSettings.last_item_index = 0),
                                      (a.uiSettings.current_processed_count = 0),
                                      (a.uiSettings.scrapped_items_arr = []),
                                      chrome.storage.local.set({
                                        last_item_index:
                                          a.uiSettings.last_item_index,
                                        current_processed_count:
                                          a.uiSettings.current_processed_count,
                                        scrapped_items_arr:
                                          a.uiSettings.scrapped_items_arr,
                                      }),
                                      location.reload();
                                  }));
                              case 1:
                              case "end":
                                return e.stop();
                            }
                        }, e);
                      })),
                      function () {
                        var t = this,
                          r = arguments;
                        return new Promise(function (n, o) {
                          var a = e.apply(t, r);
                          function s(t) {
                            i(a, n, o, s, c, "next", t);
                          }
                          function c(t) {
                            i(a, n, o, s, c, "throw", t);
                          }
                          s(void 0);
                        });
                      });
                  return function (t) {
                    return r.apply(this, arguments);
                  };
                })()
              );
            }),
            $(document).on(
              "change",
              '[name="scrape_limit_type"]',
              function (t) {
                "Limit" == $(this).val()
                  ? $("#scrape_limit_section").show()
                  : $("#scrape_limit_section").hide();
              }
            ),
            $(document).on("submit", "#start-search-form", function (t) {
              t.preventDefault();
              $(this);
              var e = !1,
                r = $(this).find("#Keywords_input").val(),
                n = $(this).find("#url_input").val(),
                o = $(this).find("#location_input").val(),
                i = o + "/" + r + "/",
                c = $(this).find('[type="submit"]');
              if ("Start Process" == c.text())
                if ("" == n.trim()) {
                  if ("" != r) {
                    if (String(r).length < 2)
                      return (
                        showSwal(
                          "error",
                          "Oops!...",
                          "You need to Enter valid keywords",
                          3e3
                        ),
                        !1
                      );
                    if ("" == o)
                      return (
                        showSwal(
                          "error",
                          "Oops!...",
                          "You need to Enter location",
                          3e3
                        ),
                        !1
                      );
                    if (String(o).length < 2)
                      return (
                        showSwal(
                          "error",
                          "Oops!...",
                          "You need to Enter valid location",
                          3e3
                        ),
                        !1
                      );
                  } else e = !0;
                  if (false)
                    return (
                      showSwal(
                        "error",
                        "Oops!...",
                        "You need to Enter search keywords",
                        3e3
                      ),
                      !1
                    );
                  var u = $('[name="scrape_limit_type"]:checked').val(),
                    l = $("#scrape_limit").val();
                  "Limit" == u &&
                    (("" != l && 0 != l && "0" != l) ||
                      showSwal(
                        "error",
                        "Oops!...",
                        "You need to enter a scrape limit",
                        3e3
                      )),
                    // Always allow scraping, ignore free trial limit
                    c.text("Stop & Download CSV"),
                    c.removeClass("start-proccess-btn"),
                    c.addClass("stop-proccess-btn"),
                    $("#currentProcessedCount").text(0),
                    s(
                        {
                        command: "startSearchProcess",
                        data: {
                            search_query: i,
                            Keywords_input: r,
                            location_input: o,
                            search_type: "Keyword",
                            scrape_limit: l,
                            scrape_limit_type: u,
                        },
                        }
                    );
                } else
                  chrome.storage.local.get(function (t) {
                    a.uiSettings = t;
                    var e = a.uiSettings.total_scrapped_count;
                    if (false)
                      return a.showFreeUserWarning(), !1;
                    var u = $('[name="scrape_limit_type"]:checked').val(),
                      l = $("#scrape_limit").val();
                    if ("Limit" == u) {
                      if ("" == l || 0 == l || "0" == l)
                        return (
                          showSwal(
                            "error",
                            "Oops!...",
                            "You need to enter a scrape limit",
                            3e3
                          ),
                          !1
                        );
                      if (-1 == n.indexOf("https://www.justdial.com/"))
                        return (
                          showSwal(
                            "error",
                            "Oops!...",
                            "You need to Enter Valid URL",
                            3e3
                          ),
                          !1
                        );
                      c.text("Stop & Download CSV"),
                        c.removeClass("start-proccess-btn"),
                        c.addClass("stop-proccess-btn"),
                        $("#currentProcessedCount").text(0),
                        s(
                          {
                            command: "startSearchProcess",
                            data: {
                              search_query: (i = n),
                              Keywords_input: r,
                              location_input: o,
                              search_type: "Url",
                              scrape_limit: l,
                              scrape_limit_type: u,
                            },
                          }
                        );
                    } else {
                      if (-1 == n.indexOf("https://www.justdial.com/"))
                        return (
                          showSwal(
                            "error",
                            "Oops!...",
                            "You need to Enter Valid URL",
                            3e3
                          ),
                          !1
                        );
                      c.text("Stop & Download CSV"),
                        c.removeClass("start-proccess-btn"),
                        c.addClass("stop-proccess-btn"),
                        $("#currentProcessedCount").text(0),
                        s(
                          {
                            command: "startSearchProcess",
                            data: {
                              search_query: (i = n),
                              Keywords_input: r,
                              location_input: o,
                              search_type: "Url",
                              scrape_limit: l,
                              scrape_limit_type: u,
                            },
                          }
                        );
                    }
                  });
              else
                c.text("Start Process"),
                  c.removeClass("stop-proccess-btn"),
                  c.addClass("start-proccess-btn"),
                  s(
                    { command: "stopAutoBotProcess", reason: "manual_stop" }
                  );
            }),
            $(document).on("click", "#resume-last-Scrape-btn", function (t) {
              t.preventDefault(),
                chrome.storage.local.get(function (t) {
                  "" != t.resume_url && null != t.resume_url
                    ? s(
                        { command: "resumeAutoBotProcess", reason: "manual" }
                      )
                    : showSwal(
                        "error",
                        "Oops!...",
                        "Resume process not found!",
                        3e3
                      );
                });
            });
        },
        authUserToServer: function (e, r, n) {
          chrome.storage.local.get(function (e) {
            (a.uiSettings = e),
              $.ajax({
                url: t.base_api_url + t.auth_user_api_url,
                type: "POST",
                data: {
                  key: a.uiSettings.key,
                  user_email: a.uiSettings.username,
                },
                cache: !1,
                success: function (t) {
                  n(t);
                },
                error: function (t) {
                  a.setSettingsValues(), a.updateScrapeState();
                },
              });
          });
        },
        setSettingsValues: function () {
          chrome.storage.local.get(function (t) {
            a.uiSettings = t;
            var e = a.uiSettings.scrape_status,
              r = $("#start-search-form").find('[type="submit"]');
            "Finished" == e
              ? (r.text("Start Process"),
                r.removeClass("stop-proccess-btn"),
                r.addClass("start-proccess-btn"),
                $("#resume-last-Scrape-btn").show())
              : "Inprogress" == e
              ? (r.text("Stop & Download CSV"),
                r.removeClass("start-proccess-btn"),
                r.addClass("stop-proccess-btn"),
                $("#resume-last-Scrape-btn").hide())
              : (r.text("Start Process"),
                r.removeClass("stop-proccess-btn"),
                r.addClass("start-proccess-btn"),
                $("#resume-last-Scrape-btn").hide());
          });
        },
        browserSupportFileUpload: function () {
          var t = !1;
          return (
            window.File &&
              window.FileReader &&
              window.FileList &&
              window.Blob &&
              (t = !0),
            t
          );
        },
        updateScrapeState: function () {
          chrome.storage.local.get(function (t) {
            a.uiSettings = t;
            var e = a.uiSettings.total_scrapped_count,
              r = a.uiSettings.current_processed_count;
            $("#currentProcessedCount").text(r),
              $("#totalScrappedItems").text(e);
            var n = a.uiSettings.skip_duplicate_record_check || !1;
            $("#skip_duplicate_record_check").prop("checked", n),
              a.setSettingsValues(),
              a.showScrapeItemsList(),
              chrome.storage.local.get(function (t) {
                a.uiSettings = t;
                
              });
            var o = a.uiSettings.userFreeTrialStarted;
            a.uiSettings.authUser;
            // 1 == o
            //   ? ($(".logged-user-info").hide(), $(".free-user-info").show())
            //   : ($(".free-user-info").hide(), $(".logged-user-info").show());
          });
        },
        checkUserAuth: function () {
          chrome.storage.local.get(function (t) {
            a.uiSettings = t;
            a.setSettingsValues();
            a.updateScrapeState();
          });
        },
      }),
      "authUserToServer",
      function (e, r, n) {
        chrome.storage.local.get(function (e) {
          var r = new Headers();
          r.append("x-key", e.key),
            r.append("x-csrf-token", e.token_id),
            r.append("x-product-id", "4"),
            r.append("Content-Type", "application/x-www-form-urlencoded");
          var o = new URLSearchParams();
          o.append("email", e.authName),
            fetch(t.base_api_url + t.auth_user_api_url, {
              method: "POST",
              headers: r,
              body: o,
              redirect: "follow",
            })
              .then(function (t) {
                return t.json();
              })
              .then(function (t) {
                return n(t);
              })
              .catch(function (t) {
                return console.log("error", t);
              }),
            a.setSettingsValues(),
            a.updateScrapeState();
        });
      }
    ),
    n(r, "showFreeUserWarning", function () {
    //   showSwal(
    //     "warning",
    //     "Upgrade plan",
    //     'You Need to upgrade your plan for scrape more data. <br> Click here to <a class="text-primary" href="login.html"> Upgrade </a> your plan. <br> <b>Note : </b> In Free trial version you can scrap up to 20 data only then after process stop automatically.',
    //     3e3
    //   );
    }),
    n(r, "showScrapeItemsList", function () {
      chrome.storage.local.get(function (t) {
        a.uiSettings = t;
        for (
          var e = a.uiSettings.scrapped_items_arr, r = "", n = 0;
          n < e.length;
          n++
        )
          r +=
            '<tr><td><div style="width: 50px;">' +
            (n + 1) +
            '</div></td><td><div style="width: 150px;">' +
            e[n].name +
            '</div></td><td><div style="width: 150px;">' +
            e[n].address +
            '</div></td><td><div style="width: 150px;">' +
            (e[n].contact_number_2
              ? '<a href="tel:' +
                e[n].contact_number_2 +
                '"> <i class="fa fa-phone"></i> ' +
                e[n].contact_number_2 +
                "</a>"
              : "") +
            ' </div> </td><td><div style="width: 150px;">' +
            (null != e[n].contact_number && "" != e[n].contact_number
              ? '<a href="tel:' +
                e[n].contact_number +
                '"> <i class="fa fa-phone"></i> ' +
                e[n].contact_number +
                "</a>"
              : "") +
            ' </div> </td><td><div style="width: 150px;">' +
            e[n].rating +
            '</div></td><td><div style="width: 150px;">' +
            e[n].reviews +
            "</div></td></tr>";
        ("Finished" == a.uiSettings.scrape_status && e.length > 0) ||
          (0 == e.length &&
            (r +=
              '<tr><td class="text-center text-danger" colspan="16"> No data found! </td></tr>')),
          $("#tbl_items_list").html(r);
      }
    );
    }),
    r);
  function s(t, e) {
    null != e && (t.callback = "yes"), chrome.runtime.sendMessage(t, e);
  }
  function c(t, e) {
    switch (t.command) {
      case "rec_getSettings":
        a.uiSettings = t.data.uiSettings;
        break;
      case "updateScrapeState":
        a.updateScrapeState();
    }
    void 0 !== t.data &&
      void 0 !== t.data.callback &&
      "yes" == t.data.callback &&
      (callback(), (callback = null));
  }
  $(document).ready(function () {
    chrome.runtime.onMessage.addListener(c);
    [].slice
      .call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
      .map(function (t) {
        return new bootstrap.Tooltip(t);
      });
  }),
    a.load();
})();

// --- Support Overlay Logic ---
document.addEventListener('DOMContentLoaded', function() {
    var supportBtn = document.getElementById('openSupportBtn');
    var closeBtn = document.getElementById('closeSupportBtn');
    var overlay = document.getElementById('supportOverlay');
    
    if(supportBtn) {
        supportBtn.addEventListener('click', function(e) {
            e.preventDefault();
            overlay.style.display = 'flex';
        });
    }
    if(closeBtn) {
        closeBtn.addEventListener('click', function() {
            overlay.style.display = 'none';
        });
    }
    if(overlay) {
        overlay.addEventListener('click', function(e) {
            if(e.target === overlay) {
                overlay.style.display = 'none';
            }
        });
    }
});
