(() => { var m = Object.defineProperty; var g = (e, t, n) => t in e ? m(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var a = (e, t, n) => g(e, typeof t != "symbol" ? t + "" : t, n); function w(e) { const t = history.pushState; history.pushState = function(r, c) { t.apply(this, arguments), e(); }; const n = () => { e(); }; return addEventListener("popstate", n), () => { history.pushState = t, removeEventListener("popstate", n); }; } const f = 1e3; function y(e) { return "?" + Object.keys(e).map(function(t) { return encodeURIComponent(t) + "=" + encodeURIComponent(e[t]); }).join("&"); } function T(e, t) { return new Promise((n) => { const r = { ht: 1 // Assume first hit (new visit) }, c = `${e.replace(/\/collect$/, "/cache")}?sid=${encodeURIComponent(t)}`, o = new XMLHttpRequest(); o.open("GET", c, !0), o.timeout = f, o.setRequestHeader("Content-Type", "text/plain"), o.onload = function() { if (o.status === 200) try { const i = JSON.parse( o.responseText ); n(i); } catch { n(r); } else n(r); }, o.onerror = () => n(r), o.ontimeout = () => n(r), o.send(); }); } function I(e, t) { const n = new XMLHttpRequest(), r = e + y(t); n.open("GET", r, !0), n.setRequestHeader("Content-Type", "text/plain"), n.timeout = f, n.send(); } function E(e) { const t = w(() => { u(e); }); return u(e), t; } function S() { const e = document.querySelector( 'link[rel="canonical"][href]' ); if (!e) return null; const t = document.createElement("a"); return t.href = e.href, t; } function U(e) { const t = document.createElement("a"); t.href = e; const n = t.protocol + "//" + t.hostname, r = t.pathname; return { hostname: n, path: r }; } function k(e, t) { return !t && document.referrer.indexOf(e) < 0 && (t = document.referrer), t.split("?")[0]; } async function u(e, t = {}) { const r = S() ?? window.location; if (r.host === "" && navigator.userAgent.indexOf("Electron") < 0) return; const c = t.url || r.pathname + r.search || "/", { hostname: o, path: i } = U(c), h = k(o, t.referrer || ""), s = { p: i, h: o, r: h, sid: e.siteId }; try { const p = await T( e.reporterUrl, e.siteId ); Object.assign(s, { ht: p.ht.toString() }); } catch { } I(e.reporterUrl, s); } class P { constructor(t) { a(this, "siteId"); a(this, "reporterUrl"); a(this, "_cleanupAutoTrackPageviews"); this.siteId = t.siteId, this.reporterUrl = t.reporterUrl, (t.autoTrackPageviews === void 0 || t.autoTrackPageviews) && setTimeout(() => { this._cleanupAutoTrackPageviews = E(this); }, 0); } cleanup() { this._cleanupAutoTrackPageviews && this._cleanupAutoTrackPageviews(); } } const l = { client: void 0 }; function v(e) { if (l.client) throw new Error("Counterscale has already been initialized."); l.client = new P(e); } function R() { return document.getElementById( "counterscale-script" ); } function q() { let e; return (window.counterscale && window.counterscale.q || []).forEach(function(n) { n[0] === "set" && n[1] === "siteId" && (e = n[2]); }), e; } function d() { const e = R(), t = (e == null ? void 0 : e.getAttribute("data-site-id")) || q(), n = e == null ? void 0 : e.src.replace("tracker.js", "collect"); !t || !n || v({ siteId: t, reporterUrl: n, autoTrackPageviews: !0 }); } (function() { if (document.body === null) { document.addEventListener("DOMContentLoaded", () => { d(); }); return; } d(); })(); })()