(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.id="inside-ad",t.appendChild(document.createTextNode("#streann-node{position:fixed;right:0;bottom:0;width:auto;max-width:100vw}#streann-node:has(#page-content){height:auto!important}@media (max-width: 425px){#streann-node:has(#page-content){width:75vw!important}}#page-content{position:relative;width:426px;max-width:100%}#page-content-split-ad{position:relative!important;width:100vh!important}#video-container{position:relative;padding-bottom:56.25%}#video-element{position:absolute;top:0;left:0;width:100%;height:100%}#streann-adhesion{position:fixed;width:100%;left:0;top:0;background:#0006;height:100px;z-index:10000;padding-top:15px;padding-bottom:15px}.adhesion-container{width:100%;margin:0 auto;text-align:center;opacity:1!important;z-index:11111}#adhesion{margin:0 auto;text-align:center}.close-btn-container{position:fixed;right:10px;opacity:1!important;top:10px;height:30px;width:30px;border-radius:100%;background-color:#fff;display:flex;justify-content:center}.closeButton{position:absolute;background-color:#00000080;padding:5px 13px;top:0;right:0;z-index:1;cursor:pointer;border-radius:4px;display:none}#cornerCloseButton{top:6px;right:6px;padding:4px;line-height:0;color:#fff;background-color:#0009;border-radius:4px;box-sizing:content-box}#cornerCloseButton svg{display:block;width:18px;height:18px}#cornerCloseButton:hover{background-color:#000c}#streann-logo{position:absolute;top:0;left:0;z-index:1;cursor:pointer}.logo{width:30px;height:30px}#un-mute,#mute{position:absolute;bottom:0;left:0;padding:5px 13px;z-index:1;cursor:pointer}.split-ad-close-btn{position:absolute;right:1px;top:90%;transform:translateY(-50%);background-color:transparent;color:#fff;padding:10px 20px;border:2px solid white;cursor:pointer;border-radius:5px;font-size:16px}.split-ad-unmute-btn{display:block;position:absolute;top:10px;right:10px;background-color:transparent;border:none;border-radius:50%;width:40px;height:40px;cursor:pointer;padding:8px;z-index:1000}#video-container-split-ad{position:relative!important;padding-bottom:56.25%}")),document.head.appendChild(t)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
var Xe = Object.defineProperty;
var Qe = (n, e, t) => e in n ? Xe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
var c = (n, e, t) => (Qe(n, typeof e != "symbol" ? e + "" : e, t), t);
var k = /* @__PURE__ */ ((n) => (n.CORNER = "CORNER", n.EMBED = "EMBED", n.ADHESION = "ADHESION", n.EMBED_FLOAT = "EMBED_FLOAT", n.SPLIT_AD = "SPLIT_AD", n))(k || {}), I = /* @__PURE__ */ ((n) => (n.VAST = "VAST", n.BANNER = "BANNER", n.LOCAL_VIDEO = "LOCAL_VIDEO", n.LOCAL_IMAGE = "LOCAL_IMAGE", n))(I || {}), Oe = /* @__PURE__ */ ((n) => (n[n.SUNDAY = 0] = "SUNDAY", n[n.MONDAY = 1] = "MONDAY", n[n.TUESDAY = 2] = "TUESDAY", n[n.WEDNESDAY = 3] = "WEDNESDAY", n[n.THURSDAY = 4] = "THURSDAY", n[n.FRIDAY = 5] = "FRIDAY", n[n.SATURDAY = 6] = "SATURDAY", n))(Oe || {});
const C = {
  apiKey: "",
  apiToken: "",
  baseUrl: "",
  isAlreadyInit: !1
};
let M = null, V = null;
function Pe() {
  return M ? Promise.resolve(M) : (V || (V = Je().finally(() => {
    V = null;
  })), V);
}
async function Je() {
  try {
    const t = await (await fetch("https://geoip.streann.tech/")).json();
    return M = {
      country: t.countryCode || t.country || "",
      city: t.city || "",
      state: t.region || t.state || "",
      zip: t.zip || t.PostalCode || ""
    }, M;
  } catch {
    return {
      country: "",
      city: "",
      state: "",
      zip: ""
    };
  }
}
function Ze() {
  return M;
}
const F = "%c streann.com(cornerAd) %c", H = "background: orange; color: black; display: block;border-radius: 2px; padding: 2px;", x = "background: white; color: black;", ee = "streannAdsDebug";
function et() {
  try {
    const n = new URLSearchParams(window.location.search).get("debug");
    return n === "true" || n === "1" ? (sessionStorage.setItem(ee, "1"), !0) : n === "false" || n === "0" ? (sessionStorage.removeItem(ee), !1) : sessionStorage.getItem(ee) === "1";
  } catch {
    return !1;
  }
}
class tt {
  constructor() {
    c(this, "debugEnabled", et());
  }
  info(...e) {
    console.info(F, H, x, ...e);
  }
  warn(...e) {
    console.warn(F, H, x, ...e);
  }
  error(...e) {
    console.error(F, H, x, ...e);
  }
  // Only printed with ?debug=true (see above)
  debug(...e) {
    if (!this.debugEnabled)
      return;
    const t = (performance.now() / 1e3).toFixed(1) + "s";
    console.info(F, H, x, `[${t}]`, ...e);
  }
}
const a = new tt();
let z = null;
function nt() {
  return z ? a.debug("getCampaigns(): using cached campaigns") : z = rt().catch((n) => (a.debug("getCampaigns(): request FAILED, will retry on next refresh", (n == null ? void 0 : n.message) || n), z = null, [])), z;
}
async function rt() {
  const { country: n } = await Pe();
  if (!n)
    throw new Error("Could not resolve country");
  localStorage.setItem("streannCountryId", n), a.debug("getCampaigns(): fetching campaigns", { country: n });
  const e = await fetch(
    `${C.baseUrl}v1/r/${C.apiKey}/campaigns/WEB?country=${n}`,
    {
      method: "GET",
      headers: new Headers({
        Authorization: `ApiToken ${C.apiToken}`
      })
    }
  );
  if (e.status != 200)
    throw new Error(`Something went wrong fetching campaigns: ${e.status}`);
  return e.json();
}
function it() {
  return Object.values(Oe)[(/* @__PURE__ */ new Date()).getDay()];
}
function ve(n) {
  let e = n.reduce((o, s) => o + s.weight, 0), t = Math.floor(Math.random() * e) + 1, r = 0, i = null;
  for (let o of n)
    if (r += o.weight, t <= r) {
      i = o;
      break;
    }
  return i || n[0];
}
function ke(n) {
  return new Promise((e, t) => {
    const r = document.createElement("script");
    r.async = !0, r.src = n, r.onload = e, r.onerror = t, document.body.appendChild(r);
  });
}
function Te(n) {
  const e = Date.now(), t = new Date(n.startDate), r = new Date(n.endDate);
  return t.getTime() <= e && r.getTime() >= e;
}
function Ne(n) {
  if (!n.timePeriods)
    return !0;
  const e = it(), t = /* @__PURE__ */ new Date();
  return n.timePeriods.every((i) => {
    const [o, s, d] = i.startTime.split(":").map(Number), l = /* @__PURE__ */ new Date();
    l.setHours(o), l.setMinutes(s), l.setSeconds(d);
    const [h, m, g] = i.endTime.split(":").map(Number), f = /* @__PURE__ */ new Date();
    return f.setHours(h), f.setMinutes(m), f.setSeconds(g), i.daysOfWeek.includes(e) && l <= t && f >= t;
  });
}
function ot(n) {
  const e = location.host.replace(/^www\./, ""), t = n.replace(/^https?:\/\//, "").replace(/^www\./, "");
  return e === t;
}
function re(n) {
  if (n.domain) {
    if (n.domain.includes(location.host) || ot(n.domain)) {
      if (n.absolutePath && n.absolutePath.length > 0)
        return !!n.absolutePath.some((e) => e === location.pathname);
      if (n.tags && n.tags.length)
        return n.tags.some((e) => location.pathname.includes(e));
    }
    return !1;
  } else {
    if (n.absolutePath && n.absolutePath.length > 0)
      return !!n.absolutePath.some((e) => e === location.pathname);
    if (n.tags && n.tags.length)
      return n.tags.some((e) => location.pathname.includes(e));
  }
  return !0;
}
function st(n) {
  const e = n.placements.filter(re).filter(ie);
  return !(!e || e.length == 0);
}
function ie(n) {
  var i, o;
  const e = (o = (i = n.properties) == null ? void 0 : i.webSettings) == null ? void 0 : o.screens;
  let t = "";
  const r = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
  return r <= 425 ? t = "MOBILE" : r <= 768 ? t = "TABLET" : t = "DESKTOP", e ? e.includes(t) : !0;
}
function at(n) {
  const e = n.filter(Te).filter(Ne);
  a.debugEnabled && n.forEach((o) => {
    a.debug(`filter campaign "${o.name}"`, {
      dateOk: Te(o),
      timePeriodOk: Ne(o),
      startDate: o.startDate,
      endDate: o.endDate,
      timePeriods: o.timePeriods,
      browserTime: (/* @__PURE__ */ new Date()).toString()
    });
  });
  let t;
  if (e.length > 1 ? t = ve(e.filter(st)) : t = e[0], !t || !t.placements)
    return { campaign: void 0, filteredPlacements: [] };
  const r = t.placements.filter(re).filter(ie);
  if (a.debugEnabled) {
    const o = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, s = o <= 425 ? "MOBILE" : o <= 768 ? "TABLET" : "DESKTOP";
    t.placements.forEach((d) => {
      var l, h;
      a.debug(`filter placement "${d.name}" [${d.viewType}]`, {
        tagOk: re(d),
        screenOk: ie(d),
        currentScreen: `${s} (width ${o})`,
        screens: (h = (l = d.properties) == null ? void 0 : l.webSettings) == null ? void 0 : h.screens,
        domain: d.domain,
        host: location.host,
        tags: d.tags,
        absolutePath: d.absolutePath,
        path: location.pathname
      });
    });
  }
  r.length == 0;
  const i = r.map(
    (o) => o.ads.length > 1 ? { ...o, ad: ve(o.ads) } : { ...o, ad: o.ads[0] }
  );
  return { campaign: t, filteredPlacements: i };
}
class dt {
  constructor(e, t) {
    c(this, "campaing");
    c(this, "refresh");
    c(this, "refreshTimeout");
    this.campaing = e, this.refresh = t;
  }
  insideAdReceived(e) {
    a.debug("insideAdReceived", e);
  }
  insideAdLoaded() {
    a.debug("insideAdLoaded");
  }
  insideAdPlay() {
    a.debug("insideAdPlay");
  }
  insideAdStop() {
    const e = this.campaing.properties.intervalInMinutes || 1;
    if (!e || e <= 0) {
      a.debug("No refresh interval configured, ads will not repeat");
      return;
    }
    this.clearRefreshTimeout(), a.debug(`Next ad refresh scheduled in ${e} minutes`), this.refreshTimeout = setTimeout(() => {
      this.refresh();
    }, e * 6e4);
  }
  insideAdSkipped() {
    a.debug("insideAdSkipped");
  }
  insideAdClicked() {
    a.debug("insideAdClicked");
  }
  insideAdError(e) {
    a.debug("insideAdError", e);
  }
  insideAdVolumeChanged(e) {
    a.debug("insideAdVolumeChanged", e);
  }
  clearRefreshTimeout() {
    clearTimeout(this.refreshTimeout);
  }
}
const lt = "https://imasdk.googleapis.com/js/sdkloader/ima3.js";
let O = null;
const Ie = () => {
  O = null;
}, Me = () => {
  const n = window;
  return n.google && n.google.ima ? Promise.resolve(n.google.ima) : O || (O = ke(lt).then(() => n.google.ima), O.then(Ie).catch(Ie), O);
}, ct = "https://securepubads.g.doubleclick.net/tag/js/gpt.js", ut = () => {
  const n = window;
  return n.googletag && n.googletag.apiReady ? Promise.resolve(n.googletag) : ke(ct).then(() => n.googletag);
};
var oe = function(n, e) {
  return oe = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, r) {
    t.__proto__ = r;
  } || function(t, r) {
    for (var i in r)
      Object.prototype.hasOwnProperty.call(r, i) && (t[i] = r[i]);
  }, oe(n, e);
};
function K(n, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
  oe(n, e);
  function t() {
    this.constructor = n;
  }
  n.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
}
function se(n) {
  var e = typeof Symbol == "function" && Symbol.iterator, t = e && n[e], r = 0;
  if (t)
    return t.call(n);
  if (n && typeof n.length == "number")
    return {
      next: function() {
        return n && r >= n.length && (n = void 0), { value: n && n[r++], done: !n };
      }
    };
  throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function G(n, e) {
  var t = typeof Symbol == "function" && n[Symbol.iterator];
  if (!t)
    return n;
  var r = t.call(n), i, o = [], s;
  try {
    for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; )
      o.push(i.value);
  } catch (d) {
    s = { error: d };
  } finally {
    try {
      i && !i.done && (t = r.return) && t.call(r);
    } finally {
      if (s)
        throw s.error;
    }
  }
  return o;
}
function q(n, e, t) {
  if (t || arguments.length === 2)
    for (var r = 0, i = e.length, o; r < i; r++)
      (o || !(r in e)) && (o || (o = Array.prototype.slice.call(e, 0, r)), o[r] = e[r]);
  return n.concat(o || Array.prototype.slice.call(e));
}
function w(n) {
  return typeof n == "function";
}
function Ue(n) {
  var e = function(r) {
    Error.call(r), r.stack = new Error().stack;
  }, t = n(e);
  return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
}
var te = Ue(function(n) {
  return function(t) {
    n(this), this.message = t ? t.length + ` errors occurred during unsubscription:
` + t.map(function(r, i) {
      return i + 1 + ") " + r.toString();
    }).join(`
  `) : "", this.name = "UnsubscriptionError", this.errors = t;
  };
});
function ae(n, e) {
  if (n) {
    var t = n.indexOf(e);
    0 <= t && n.splice(t, 1);
  }
}
var W = function() {
  function n(e) {
    this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
  }
  return n.prototype.unsubscribe = function() {
    var e, t, r, i, o;
    if (!this.closed) {
      this.closed = !0;
      var s = this._parentage;
      if (s)
        if (this._parentage = null, Array.isArray(s))
          try {
            for (var d = se(s), l = d.next(); !l.done; l = d.next()) {
              var h = l.value;
              h.remove(this);
            }
          } catch (E) {
            e = { error: E };
          } finally {
            try {
              l && !l.done && (t = d.return) && t.call(d);
            } finally {
              if (e)
                throw e.error;
            }
          }
        else
          s.remove(this);
      var m = this.initialTeardown;
      if (w(m))
        try {
          m();
        } catch (E) {
          o = E instanceof te ? E.errors : [E];
        }
      var g = this._finalizers;
      if (g) {
        this._finalizers = null;
        try {
          for (var f = se(g), b = f.next(); !b.done; b = f.next()) {
            var R = b.value;
            try {
              we(R);
            } catch (E) {
              o = o ?? [], E instanceof te ? o = q(q([], G(o)), G(E.errors)) : o.push(E);
            }
          }
        } catch (E) {
          r = { error: E };
        } finally {
          try {
            b && !b.done && (i = f.return) && i.call(f);
          } finally {
            if (r)
              throw r.error;
          }
        }
      }
      if (o)
        throw new te(o);
    }
  }, n.prototype.add = function(e) {
    var t;
    if (e && e !== this)
      if (this.closed)
        we(e);
      else {
        if (e instanceof n) {
          if (e.closed || e._hasParent(this))
            return;
          e._addParent(this);
        }
        (this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(e);
      }
  }, n.prototype._hasParent = function(e) {
    var t = this._parentage;
    return t === e || Array.isArray(t) && t.includes(e);
  }, n.prototype._addParent = function(e) {
    var t = this._parentage;
    this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e;
  }, n.prototype._removeParent = function(e) {
    var t = this._parentage;
    t === e ? this._parentage = null : Array.isArray(t) && ae(t, e);
  }, n.prototype.remove = function(e) {
    var t = this._finalizers;
    t && ae(t, e), e instanceof n && e._removeParent(this);
  }, n.EMPTY = function() {
    var e = new n();
    return e.closed = !0, e;
  }(), n;
}(), _e = W.EMPTY;
function Ve(n) {
  return n instanceof W || n && "closed" in n && w(n.remove) && w(n.add) && w(n.unsubscribe);
}
function we(n) {
  w(n) ? n() : n.unsubscribe();
}
var Fe = {
  onUnhandledError: null,
  onStoppedNotification: null,
  Promise: void 0,
  useDeprecatedSynchronousErrorHandling: !1,
  useDeprecatedNextContext: !1
}, de = {
  setTimeout: function(n, e) {
    for (var t = [], r = 2; r < arguments.length; r++)
      t[r - 2] = arguments[r];
    var i = de.delegate;
    return i != null && i.setTimeout ? i.setTimeout.apply(i, q([n, e], G(t))) : setTimeout.apply(void 0, q([n, e], G(t)));
  },
  clearTimeout: function(n) {
    var e = de.delegate;
    return ((e == null ? void 0 : e.clearTimeout) || clearTimeout)(n);
  },
  delegate: void 0
};
function pt(n) {
  de.setTimeout(function() {
    throw n;
  });
}
function Re() {
}
function j(n) {
  n();
}
var He = function(n) {
  K(e, n);
  function e(t) {
    var r = n.call(this) || this;
    return r.isStopped = !1, t ? (r.destination = t, Ve(t) && t.add(r)) : r.destination = gt, r;
  }
  return e.create = function(t, r, i) {
    return new le(t, r, i);
  }, e.prototype.next = function(t) {
    this.isStopped || this._next(t);
  }, e.prototype.error = function(t) {
    this.isStopped || (this.isStopped = !0, this._error(t));
  }, e.prototype.complete = function() {
    this.isStopped || (this.isStopped = !0, this._complete());
  }, e.prototype.unsubscribe = function() {
    this.closed || (this.isStopped = !0, n.prototype.unsubscribe.call(this), this.destination = null);
  }, e.prototype._next = function(t) {
    this.destination.next(t);
  }, e.prototype._error = function(t) {
    try {
      this.destination.error(t);
    } finally {
      this.unsubscribe();
    }
  }, e.prototype._complete = function() {
    try {
      this.destination.complete();
    } finally {
      this.unsubscribe();
    }
  }, e;
}(W), ht = Function.prototype.bind;
function ne(n, e) {
  return ht.call(n, e);
}
var ft = function() {
  function n(e) {
    this.partialObserver = e;
  }
  return n.prototype.next = function(e) {
    var t = this.partialObserver;
    if (t.next)
      try {
        t.next(e);
      } catch (r) {
        Y(r);
      }
  }, n.prototype.error = function(e) {
    var t = this.partialObserver;
    if (t.error)
      try {
        t.error(e);
      } catch (r) {
        Y(r);
      }
    else
      Y(e);
  }, n.prototype.complete = function() {
    var e = this.partialObserver;
    if (e.complete)
      try {
        e.complete();
      } catch (t) {
        Y(t);
      }
  }, n;
}(), le = function(n) {
  K(e, n);
  function e(t, r, i) {
    var o = n.call(this) || this, s;
    if (w(t) || !t)
      s = {
        next: t ?? void 0,
        error: r ?? void 0,
        complete: i ?? void 0
      };
    else {
      var d;
      o && Fe.useDeprecatedNextContext ? (d = Object.create(t), d.unsubscribe = function() {
        return o.unsubscribe();
      }, s = {
        next: t.next && ne(t.next, d),
        error: t.error && ne(t.error, d),
        complete: t.complete && ne(t.complete, d)
      }) : s = t;
    }
    return o.destination = new ft(s), o;
  }
  return e;
}(He);
function Y(n) {
  pt(n);
}
function mt(n) {
  throw n;
}
var gt = {
  closed: !0,
  next: Re,
  error: mt,
  complete: Re
}, yt = function() {
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
}();
function Et(n) {
  return n;
}
function At(n) {
  return n.length === 0 ? Et : n.length === 1 ? n[0] : function(t) {
    return n.reduce(function(r, i) {
      return i(r);
    }, t);
  };
}
var Ce = function() {
  function n(e) {
    e && (this._subscribe = e);
  }
  return n.prototype.lift = function(e) {
    var t = new n();
    return t.source = this, t.operator = e, t;
  }, n.prototype.subscribe = function(e, t, r) {
    var i = this, o = St(e) ? e : new le(e, t, r);
    return j(function() {
      var s = i, d = s.operator, l = s.source;
      o.add(d ? d.call(o, l) : l ? i._subscribe(o) : i._trySubscribe(o));
    }), o;
  }, n.prototype._trySubscribe = function(e) {
    try {
      return this._subscribe(e);
    } catch (t) {
      e.error(t);
    }
  }, n.prototype.forEach = function(e, t) {
    var r = this;
    return t = Be(t), new t(function(i, o) {
      var s = new le({
        next: function(d) {
          try {
            e(d);
          } catch (l) {
            o(l), s.unsubscribe();
          }
        },
        error: o,
        complete: i
      });
      r.subscribe(s);
    });
  }, n.prototype._subscribe = function(e) {
    var t;
    return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(e);
  }, n.prototype[yt] = function() {
    return this;
  }, n.prototype.pipe = function() {
    for (var e = [], t = 0; t < arguments.length; t++)
      e[t] = arguments[t];
    return At(e)(this);
  }, n.prototype.toPromise = function(e) {
    var t = this;
    return e = Be(e), new e(function(r, i) {
      var o;
      t.subscribe(function(s) {
        return o = s;
      }, function(s) {
        return i(s);
      }, function() {
        return r(o);
      });
    });
  }, n.create = function(e) {
    return new n(e);
  }, n;
}();
function Be(n) {
  var e;
  return (e = n ?? Fe.Promise) !== null && e !== void 0 ? e : Promise;
}
function bt(n) {
  return n && w(n.next) && w(n.error) && w(n.complete);
}
function St(n) {
  return n && n instanceof He || bt(n) && Ve(n);
}
var vt = Ue(function(n) {
  return function() {
    n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
  };
}), xe = function(n) {
  K(e, n);
  function e() {
    var t = n.call(this) || this;
    return t.closed = !1, t.currentObservers = null, t.observers = [], t.isStopped = !1, t.hasError = !1, t.thrownError = null, t;
  }
  return e.prototype.lift = function(t) {
    var r = new Le(this, this);
    return r.operator = t, r;
  }, e.prototype._throwIfClosed = function() {
    if (this.closed)
      throw new vt();
  }, e.prototype.next = function(t) {
    var r = this;
    j(function() {
      var i, o;
      if (r._throwIfClosed(), !r.isStopped) {
        r.currentObservers || (r.currentObservers = Array.from(r.observers));
        try {
          for (var s = se(r.currentObservers), d = s.next(); !d.done; d = s.next()) {
            var l = d.value;
            l.next(t);
          }
        } catch (h) {
          i = { error: h };
        } finally {
          try {
            d && !d.done && (o = s.return) && o.call(s);
          } finally {
            if (i)
              throw i.error;
          }
        }
      }
    });
  }, e.prototype.error = function(t) {
    var r = this;
    j(function() {
      if (r._throwIfClosed(), !r.isStopped) {
        r.hasError = r.isStopped = !0, r.thrownError = t;
        for (var i = r.observers; i.length; )
          i.shift().error(t);
      }
    });
  }, e.prototype.complete = function() {
    var t = this;
    j(function() {
      if (t._throwIfClosed(), !t.isStopped) {
        t.isStopped = !0;
        for (var r = t.observers; r.length; )
          r.shift().complete();
      }
    });
  }, e.prototype.unsubscribe = function() {
    this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
  }, Object.defineProperty(e.prototype, "observed", {
    get: function() {
      var t;
      return ((t = this.observers) === null || t === void 0 ? void 0 : t.length) > 0;
    },
    enumerable: !1,
    configurable: !0
  }), e.prototype._trySubscribe = function(t) {
    return this._throwIfClosed(), n.prototype._trySubscribe.call(this, t);
  }, e.prototype._subscribe = function(t) {
    return this._throwIfClosed(), this._checkFinalizedStatuses(t), this._innerSubscribe(t);
  }, e.prototype._innerSubscribe = function(t) {
    var r = this, i = this, o = i.hasError, s = i.isStopped, d = i.observers;
    return o || s ? _e : (this.currentObservers = null, d.push(t), new W(function() {
      r.currentObservers = null, ae(d, t);
    }));
  }, e.prototype._checkFinalizedStatuses = function(t) {
    var r = this, i = r.hasError, o = r.thrownError, s = r.isStopped;
    i ? t.error(o) : s && t.complete();
  }, e.prototype.asObservable = function() {
    var t = new Ce();
    return t.source = this, t;
  }, e.create = function(t, r) {
    return new Le(t, r);
  }, e;
}(Ce), Le = function(n) {
  K(e, n);
  function e(t, r) {
    var i = n.call(this) || this;
    return i.destination = t, i.source = r, i;
  }
  return e.prototype.next = function(t) {
    var r, i;
    (i = (r = this.destination) === null || r === void 0 ? void 0 : r.next) === null || i === void 0 || i.call(r, t);
  }, e.prototype.error = function(t) {
    var r, i;
    (i = (r = this.destination) === null || r === void 0 ? void 0 : r.error) === null || i === void 0 || i.call(r, t);
  }, e.prototype.complete = function() {
    var t, r;
    (r = (t = this.destination) === null || t === void 0 ? void 0 : t.complete) === null || r === void 0 || r.call(t);
  }, e.prototype._subscribe = function(t) {
    var r, i;
    return (i = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(t)) !== null && i !== void 0 ? i : _e;
  }, e;
}(xe);
const ze = new xe();
function $(n) {
  ze.next(n);
}
function Tt() {
  return ze.asObservable();
}
class Nt {
  constructor() {
    c(this, "googletag");
    c(this, "timeOutCornerBanner");
    c(this, "timeOutAdhesion");
    c(this, "insideAdCallback");
    c(this, "onCornerBannerFinish");
    c(this, "onCornerBannerLoaded");
    c(this, "mapBanners", /* @__PURE__ */ new Map());
    c(this, "onSlotRender", (e) => {
      const t = e.slot, r = t.getSlotElementId(), i = this.mapBanners.get(r);
      i && (e.isEmpty ? (a.debug("Banner slot rendered EMPTY", {
        slotId: r,
        bannerUrl: i.url,
        bannerType: i.type,
        adUnitPath: t.getAdUnitPath(),
        size: e.size,
        creativeId: e.creativeId,
        lineItemId: e.lineItemId
      }), i.type === "CORNER" && this.onCornerBannerFinish(!0), i.type === "ADHESION" && $("ERROR")) : (a.debug("Banner slot rendered SUCCESSFULLY", {
        slotId: r,
        bannerUrl: i.url,
        size: e.size,
        creativeId: e.creativeId,
        lineItemId: e.lineItemId,
        advertiserId: e.advertiserId
      }), i.type === "CORNER" && this.onCornerBannerLoaded && this.onCornerBannerLoaded(), i.type === "ADHESION" && $("STARTED")));
    });
    c(this, "onViewableListener", (e) => {
      const t = e.slot, r = this.mapBanners.get(t.getSlotElementId());
      r && (r.type === "CORNER" ? this.timeOutCornerBanner = setTimeout(() => {
        if (!this.checkIfBannerExist(t.getSlotElementId())) {
          a.debug("Banner not found refreshing false");
          return;
        }
        this.destroyCornerAdBanner();
      }, r.duration * 1e3) : r.type === "ADHESION" ? this.timeOutAdhesion = setTimeout(() => {
        if (!this.checkIfBannerExist(t.getSlotElementId())) {
          a.debug("Banner not found refreshing false");
          return;
        }
        this.removeBanner(r.id);
      }, r.duration * 1e3) : setTimeout(() => {
        if (!this.checkIfBannerExist(t.getSlotElementId())) {
          a.debug("Banner not found refreshing false");
          return;
        }
        a.debug("Refreshing banner", r == null ? void 0 : r.id), this.googletag.pubads().refresh([t]);
      }, r.duration * 1e3));
    });
    ut().then((e) => {
      this.googletag = e, a.debug("googletag loaded"), this.init();
    });
  }
  init() {
    this.googletag.cmd.push(() => {
      this.googletag.pubads().addEventListener("impressionViewable", this.onViewableListener), this.googletag.pubads().addEventListener("slotRenderEnded", this.onSlotRender), this.googletag.pubads().addEventListener("slotRequested", (e) => {
        const t = e.slot;
        this.mapBanners.get(t.getSlotElementId()) && a.debug("Banner ad REQUEST sent to Google", {
          slotId: t.getSlotElementId(),
          adUnitPath: t.getAdUnitPath(),
          targetingKeys: t.getTargetingKeys()
        });
      }), this.googletag.pubads().addEventListener("slotResponseReceived", (e) => {
        const t = e.slot;
        this.mapBanners.get(t.getSlotElementId()) && a.debug("Banner ad RESPONSE received from Google", {
          slotId: t.getSlotElementId(),
          adUnitPath: t.getAdUnitPath()
        });
      }), this.googletag.pubads().setCentering(!0), this.googletag.enableServices();
    });
  }
  checkIfBannerExist(e) {
    return this.mapBanners.has(e);
  }
  mapToBannerSizes(e) {
    const t = [];
    return e.forEach(({ width: r, height: i }) => {
      t.push([r, i]);
    }), t;
  }
  addBanners(e) {
    this.googletag.cmd.push(() => {
      e.forEach((t) => {
        if (t.type == "CORNER") {
          const o = document.querySelector("#streann-node");
          if (!o) {
            a.debug("streann-node not found - cannot insert corner banner"), setTimeout(() => this.addBanners([t]), 500);
            return;
          }
          const s = o.querySelector("#page-content");
          s && s.remove(), document.getElementById(t.id) || o.insertAdjacentHTML("beforeend", `<div id="${t.id}"></div>`);
          const d = this.mapBanners.get(t.id);
          if (d) {
            a.debug("Destroying existing corner banner before creating new one");
            try {
              this.googletag.destroySlots([d.slot]), this.mapBanners.delete(t.id), a.debug("Destroyed existing banner slot", t.id);
            } catch (l) {
              a.debug("Error destroying existing slot:", l), this.mapBanners.delete(t.id);
            }
          }
        }
        const r = this.mapToBannerSizes(t.sizes);
        a.debug("Attempting to define banner slot", {
          adUnitPath: t.url,
          sizes: r,
          elementId: t.id,
          bannerType: t.type
        });
        const i = this.googletag.defineSlot(
          t.url,
          r,
          t.id
        );
        if (!i) {
          a.debug("Banner cannot be defined", t), t.type === "CORNER" && this.onCornerBannerFinish && this.onCornerBannerFinish(!0);
          return;
        }
        a.debug("Banner defined successfully", {
          adUnitPath: i.getAdUnitPath(),
          slotElementId: i.getSlotElementId()
        }), i.addService(this.googletag.pubads()), this.mapBanners.set(t.id, { ...t, slot: i }), a.debug("Calling googletag.display() for banner", t.id), this.googletag.display(t.id);
      });
    });
  }
  removeBanner(e) {
    const t = this.mapBanners.get(e);
    if (t) {
      if (t.type === "ADHESION") {
        $("FINISHED"), clearTimeout(this.timeOutAdhesion), this.clearSlot(t.slot), this.mapBanners.delete(e);
        return;
      }
      this.clearSlot(t.slot);
    }
  }
  addCallback(e, t, r) {
    this.insideAdCallback = e, this.onCornerBannerFinish = t, this.onCornerBannerLoaded = r;
  }
  destroyCornerAdBanner() {
    const e = this.mapBanners.get("corner-banner");
    e && (clearTimeout(this.timeOutCornerBanner), this.mapBanners.delete("corner-banner"), this.googletag.cmd.push(() => {
      try {
        this.googletag.destroySlots([e.slot]), a.debug("Destroyed corner banner slot");
      } catch (t) {
        a.debug("Error destroying corner banner slot:", t);
      }
    }), this.onCornerBannerFinish(!1), this.insideAdCallback && this.insideAdCallback.insideAdStop());
  }
  clearSlot(e) {
    this.googletag.cmd.push(() => {
      this.googletag.pubads().clear([e]), a.debug("clearing slot", e);
      try {
        const t = e.getSlotElementId();
        this.mapBanners.has(t) && (this.mapBanners.delete(t), a.debug("deleted banner mapping for", t));
      } catch (t) {
        a.debug("Could not delete banner map entry:", t);
      }
    });
  }
  clearAllSlots() {
    a.debug("clearing All slots"), this.googletag.cmd.push(() => {
    }), this.mapBanners.clear();
  }
}
const D = new Nt(), It = {
  "559ff7ade4b0d0aff40888dd": "waOD17zDaPce11Z0puO7SnklPkRA9OFA",
  "611fd870e4b03ec37aae6e5e": "7cYD4eXXRSfU3Fm1cRUfbzLjGl5TCa0H",
  //Bethelmedia
  "63588500e4b0a3efdffcd7ae": "2JW19nsrunPbTCvLlDpujMeEqy7B5BKw",
  //Emmanueltv
  "6849d5ca8f0828869550a9d4": "VVClTfMzzYh9tp8xzWiXgtZiXLSOAKTC",
  //Fearpix
  "61290efae4b0304f3eb75567": "SfZ3PMQtGdOvQLpddJcqRXQM9byJT2oR",
  //FlexFlix
  "67ae4dca8f0849e7e4f7bacd": "AGOodqAzgaWFLGl4dnABChTF7fOr4N6B",
  //GameStreamMedia
  "665489308f0895bfb0a92709": "8n31clcNq8cBbtgFzfJlCDmhFFLqkOVt",
  //Gols
  "68d6ef1f8f0806541640a2bf": "aVgVElbEaVAlkTGtiEACO2OcLSutKY4V",
  //ImpactProfessionals
  "67ffb7cd8f088acea336789e": "AChsRySIuKQeAB2JTjaXKEQLaG9zr8qk",
  //Okgol
  "5fc01321e4b0612f786b31c1": "LnfN4l7AeFfI3ygS5ChjTFwfO9KpiKjd",
  //Panamsport,
  "61316705e4b0295f87dae396": "YTAtmWLysGqH38Hl8pH3GNWxKjuJwW1T",
  //Tdmax
  "67afc6258f0849e7e502973e": "bo2q97sTBTo35YQaMo14uiusWqosZr3p",
  //Televicentro
  "686c6dac8f0802f464222b69": "8oGsm3BJC5qq4mrDY2b3oDkcImVJ2Nb5",
  //Tvin
  "613fa9a7e4b0ee1171b95105": "aCQPR3Q6FuA0HmDPRYdKONpC7ULP6dCj",
  //Wipr
  "56bb41cce4b01db401d1b040": "XKHTYLWGqZszh7ZSIUl91CDeQZ23Cg0m"
  //Actualidad
};
function wt(n) {
  return It[n];
}
const Rt = "3.6.7";
class Ct {
  constructor() {
    c(this, "initialized", !1);
    c(this, "writeKey");
    c(this, "resellerId");
  }
  initialize(e) {
    this.initialized || (this.resellerId = e, this.writeKey = wt(e), this.writeKey && (this.loadSegmentSnippet(this.writeKey), this.initialized = !0));
  }
  getCommonProperties() {
    const e = Ze();
    return {
      resellerId: this.resellerId || "",
      country: (e == null ? void 0 : e.country) || "",
      city: (e == null ? void 0 : e.city) || "",
      state: (e == null ? void 0 : e.state) || "",
      zip: (e == null ? void 0 : e.zip) || "",
      platform: "Web",
      deviceType: "Web",
      appVersion: Rt
    };
  }
  loadSegmentSnippet(e) {
    const t = window.analytics = window.analytics || [];
    if (!t.initialize) {
      if (t.invoked)
        return;
      t.invoked = !0, t.methods = [
        "trackSubmit",
        "trackClick",
        "trackLink",
        "trackForm",
        "pageview",
        "identify",
        "reset",
        "group",
        "track",
        "ready",
        "alias",
        "debug",
        "page",
        "once",
        "off",
        "on",
        "addSourceMiddleware",
        "addIntegrationMiddleware",
        "setAnonymousId",
        "addDestinationMiddleware"
      ], t.factory = function(r) {
        return function(...i) {
          return i.unshift(r), t.push(i), t;
        };
      };
      for (const r of t.methods)
        t[r] = t.factory(r);
      t.load = function(r, i) {
        var d;
        const o = document.createElement("script");
        o.type = "text/javascript", o.async = !0, o.src = `https://cdn.segment.com/analytics.js/v1/${r}/analytics.min.js`;
        const s = document.getElementsByTagName("script")[0];
        (d = s == null ? void 0 : s.parentNode) == null || d.insertBefore(o, s), t._loadOptions = i;
      }, t._writeKey = e, t.SNIPPET_VERSION = "4.15.3", t.load(e), t.page();
    }
  }
  track(e, t) {
    if (this.initialized)
      try {
        const r = window.analytics;
        if (r && r.track) {
          const i = {
            ...this.getCommonProperties(),
            ...t
          };
          r.track(e, i);
        }
      } catch {
      }
  }
  trackAdRequested(e) {
    this.track("Ad Requested", {
      screen: e
    });
  }
  trackAdDisplayed(e, t, r) {
    this.track("Ad Displayed", {
      adName: e,
      adType: t,
      screen: r
    });
  }
  trackAdFailed(e, t) {
    this.track("Ad Failed", {
      screen: e,
      error: t
    });
  }
}
const X = new Ct();
let y, A, _, Q, S, v, u, J, me, p, Z, ce, U = !1, T = 0;
const Ye = `
<div id="page-content">
    <div id="video-container">
      <video id="video-element" src="" playsinline webkit-playsinline>
      </video>
      <div id="ad-container"></div>
    </div>
</div>
`, Bt = `
<div id="page-content-split-ad">
 <div id="video-container-split-ad">
      <video id="video-element" src="">
      </video>
      <div id="ad-container"></div>
    </div>
</div>
`;
let ge = "", B, N = null;
function Lt(n, e, t, r, i, o) {
  T++;
  const s = T;
  i && o && (N = {
    adName: i.name,
    adType: i.adType,
    screen: o
  }), a.debug("initImaSdk called - starting VAST ad request", {
    vastUrl: e,
    sessionId: s,
    timestamp: (/* @__PURE__ */ new Date()).toISOString()
  }), Me().then((d) => {
    var m;
    if (s !== T) {
      a.debug("STALE SESSION detected - ad request cancelled", {
        requestedSessionId: s,
        currentSessionId: T
      });
      return;
    }
    Z = t, ce = r, B = n, (m = document.querySelector("#streann-node")) == null || m.insertAdjacentHTML("beforeend", Ye), p = d, ge = je(e), u = document.getElementById("video-element"), Q = document.getElementById("playButton"), S = document.getElementById("mute"), v = document.getElementById("un-mute"), v.style.display = "none", S.style.display = "none";
    const l = document.getElementById("cornerCloseButton"), h = document.getElementById("streann-logo");
    l && (l.style.display = "none"), h && (h.style.display = "none"), Mt(), Ge();
  }).catch((d) => {
    a.debug("FAILED loading IMA SDK (ad blocker / network?) - no corner will show", d);
  });
}
function Dt(n, e, t, r, i, o) {
  i && o && (N = {
    adName: i.name,
    adType: i.adType,
    screen: o
  }), Me().then((s) => {
    Z = t, B = n;
    const d = document.getElementById(r);
    if (d)
      d.insertAdjacentHTML("beforeend", Bt);
    else {
      console.error(`Container with id ${r} not found`);
      return;
    }
    p = s, ge = je(e), u = d.querySelector("#video-element"), Q = d.querySelector("#playButton"), Ut(r), Ge();
  }).catch((s) => {
    a.debug("FAILED loading IMA SDK (ad blocker / network?) - no corner will show", s);
  });
}
function je(n) {
  switch (!0) {
    case n.includes("[STREANN-PLAYER-HEIGHT]"):
      return n.replace("[STREANN-PLAYER-HEIGHT]", window.innerHeight.toString());
    case n.includes("[STREANN-PLAYER-WIDTH]"):
      return n.replace("[STREANN-PLAYER-WIDTH]", window.innerWidth.toString());
    case n.includes("[STREANN-APP-BUNDLE-ID]"):
      return n.replace("[STREANN-APP-BUNDLE-ID]", "");
    case n.includes("[STREANN-APP-NAME]"):
      return n.replace("[STREANN-APP-NAME]", "");
    case n.includes("[STREANN-APP-VERSION]"):
      return n.replace("[STREANN-APP-VERSION]", "");
    case n.includes("[STREANN-APP-DOMAIN]"):
      return n.replace("[STREANN-APP-DOMAIN]", "");
    case n.includes("[STREANN-APP-STORE-URL]"):
      return n.replace("[STREANN-APP-STORE-URL]", "");
    case n.includes("[STREANN-SITE-URL]"):
      return n.replace("[STREANN-SITE-URL]", `${window.location.origin}${window.location.pathname}`);
    case n.includes("[STREANN-CONTENT-ID]"): {
      const e = localStorage.getItem("streannContentId") || "";
      return n.replace("[STREANN-CONTENT-ID]", e);
    }
    case n.includes("[STREANN-CONTENT-TITLE]"): {
      const e = localStorage.getItem("streannContentTitle") || "";
      return n.replace("[STREANN-CONTENT-TITLE]", e);
    }
    case n.includes("[STREANN-CONTENT-LENGTH]"):
      return n.replace("[STREANN-CONTENT-LENGTH]", "");
    case n.includes("[STREANN-CONTENT-URL]"):
      return n.replace("[STREANN-CONTENT-URL]", window.location.href);
    case n.includes("[STREANN-CONTENT-ENCODED-URL]"):
      return n.replace("[STREANN-CONTENT-ENCODED-URL]", "");
    case n.includes("[STREANN-DESCRIPTION-URL]"):
      return n.replace("[STREANN-DESCRIPTION-URL]", "");
    case n.includes("[STREANN-DEVICE-ID]"):
      return n.replace("[STREANN-DEVICE-ID]", "");
    case n.includes("[STREANN-NETWORK]"):
      return n.replace("[STREANN-NETWORK]", "");
    case n.includes("[STREANN-CARRIER]"):
      return n.replace("[STREANN-CARRIER]", "");
    case n.includes("[STREANN-DEVICE-MANUFACTURER]"):
      return n.replace("[STREANN-DEVICE-MANUFACTURER]", "");
    case n.includes("[STREANN-DEVICE-MODEL]"):
      return n.replace("[STREANN-DEVICE-MODEL]", "");
    case n.includes("[STREANN-DEVICE-OS]"):
      return n.replace("[STREANN-DEVICE-OS]", "");
    case n.includes("[STREANN-DEVICE-OS-VERSION]"):
      return n.replace("[STREANN-DEVICE-OS-VERSION]", "");
    case n.includes("[STREANN-DEVICE-TYPE]"):
      return n.replace("[STREANN-DEVICE-TYPE]", "web");
    case n.includes("[STREANN-IP]"):
      return n.replace("[STREANN-IP]", "https://geoip.streann.com/");
    case n.includes("[STREANN-UA]"):
      return n.replace("[STREANN-UA]", navigator.userAgent);
    case n.includes("[STREANN-IFA-TYPE]"):
      return n.replace("[STREANN-IFA-TYPE]", "");
    case n.includes("[STREANN-ADVERTISING-ID]"):
      return n.replace("[STREANN-ADVERTISING-ID]", "");
    case n.includes("[STREANN-ADVERTISING-ID-HEX]"):
      return n.replace("[STREANN-ADVERTISING-ID-HEX]", "");
    case n.includes("[STREANN-ADVERTISING-ID-MD5]"):
      return n.replace("[STREANN-ADVERTISING-ID-MD5]", "");
    case n.includes("[STREANN-IDFA]"):
      return n.replace("[STREANN-IDFA]", "");
    case n.includes("[STREANN-IDFA-MD5]"):
      return n.replace("[STREANN-IDFA-MD5]", "");
    case n.includes("[STREANN-IDFA-HEX]"):
      return n.replace("[STREANN-IDFA-HEX]", "");
    case n.includes("[STREANN-LOCATION-LAT]"):
      return n.replace("[STREANN-LOCATION-LAT]", "");
    case n.includes("[STREANN-LOCATION-LONG]"):
      return n.replace("[STREANN-LOCATION-LONG]", "");
    case n.includes("[STREANN-COUNTRY-ID]"): {
      const e = localStorage.getItem("streannCountryId") || "";
      return n.replace("[STREANN-COUNTRY-ID]", e);
    }
    case n.includes("[STREANN-DO-NOT-TRACK]"):
      return n.replace("[STREANN-DO-NOT-TRACK]", "");
    case n.includes("[STREANN-GDPR]"):
      return n.replace("[STREANN-GDPR]", "");
    case n.includes("[STREANN-GDPR-CONSENT]"):
      return n.replace("[STREANN-GDPR-CONSENT]", "");
    case n.includes("[STREANN-USER-BIRTHYEAR]"):
      return n.replace("[STREANN-USER-BIRTHYEAR]", "");
    case n.includes("[STREANN-USER-GENDER]"):
      return n.replace("[STREANN-USER-GENDER]", "");
    case n.includes("[STREANN-CACHEBUSTER]"): {
      const e = () => Math.random().toString(36).substring(2, 12);
      return n.replace("[STREANN-CACHEBUSTER]", e());
    }
    case n.includes("[STREANN-US-PRIVACY]"):
      return n.replace("[STREANN-US-PRIVACY]", "");
    default:
      return n;
  }
}
let ue;
function Ot(n, e, t) {
  var s, d;
  ue = t, (s = document.querySelector("#streann-node")) == null || s.insertAdjacentHTML("beforeend", Ye);
  const r = document.getElementById("video-element");
  Q = document.getElementById("playButton"), S = document.getElementById("mute"), v = document.getElementById("un-mute");
  const i = document.getElementById("cornerCloseButton"), o = document.getElementById("streann-logo");
  (d = document.getElementById("video-container")) == null || d.append(v, S), i && (i.style.display = "none"), o && (o.style.display = "none"), v.style.display = "none", S.style.display = "none", r.muted = !0, r.defaultMuted = !0, r.setAttribute("muted", ""), r.setAttribute("playsinline", ""), r.src = n.url, r.load(), a.debug("Local video ad: loading", { url: n.url, name: n.name }), r.addEventListener("error", () => {
    var l, h;
    a.debug("Local video ad: video ERROR", { code: (l = r.error) == null ? void 0 : l.code, message: (h = r.error) == null ? void 0 : h.message }), ye(!0);
  }, { once: !0 }), r.addEventListener("playing", () => {
    a.debug("Local video ad: playing", { duration: r.duration }), o && (o.style.display = "block"), r.muted ? (v.style.display = "block", S.style.display = "none") : (v.style.display = "none", S.style.display = "block"), e && e();
  }, { once: !0 }), r.play().catch(function(l) {
    a.debug("Local video ad: autoplay FAILED", l == null ? void 0 : l.name, l == null ? void 0 : l.message);
  }), r.addEventListener("click", function() {
    n.properties.clickThroughUrl && window.open(n.properties.clickThroughUrl, "_blank");
  }), r.addEventListener("ended", $e), S.addEventListener("click", () => {
    r.muted = !0, S.style.display = "none", v.style.display = "block";
  }), v.addEventListener("click", () => {
    r.muted = !1, v.style.display = "none", S.style.display = "block";
  });
}
function $e() {
  a.debug("Local video ad: ended"), ye();
}
function ye(n = !1) {
  const e = document.getElementById("video-element");
  e && (e.pause(), e.removeEventListener("ended", $e), e.style.display = "none");
  const t = document.getElementById("page-content");
  if (t) {
    const i = document.getElementById("streann-node"), o = [document.getElementById("un-mute"), document.getElementById("mute")].filter((s) => !!s);
    o.forEach((s) => s.style.display = "none"), i == null || i.append(...o), t.remove();
  }
  const r = ue;
  ue = void 0, r && r(n);
}
function Ge() {
  u.volume = 0, u.muted = !0;
  const n = u.play();
  n !== void 0 && n.then(Pt).catch(kt);
}
function Pt() {
  a.debug("Autoplay check: muted autoplay allowed"), u.pause(), J = !0, me = !0, qe();
}
function kt(n) {
  a.debug("Autoplay check: muted autoplay FAILED (continuing as muted anyway)", (n == null ? void 0 : n.message) || n), u.pause(), J = !0, me = !0, qe();
}
function Mt() {
  Vt(), A = new p.AdsLoader(_), A.getSettings().setDisableCustomPlaybackForIOS10Plus(!0), A.addEventListener(
    p.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
    Ke,
    !1
  ), U = !1, A.addEventListener(p.AdErrorEvent.Type.AD_ERROR, Ae, !1), u.onended = Ee;
}
function Ut(n) {
  _t(n), A = new p.AdsLoader(_), A.addEventListener(
    p.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
    Ke,
    !1
  ), U = !1, A.addEventListener(p.AdErrorEvent.Type.AD_ERROR, Ae, !1), u.onended = Ee;
}
function _t(n) {
  var t;
  const e = (t = document.getElementById(n)) == null ? void 0 : t.querySelector("#ad-container");
  if (e.style.display = "none", !e) {
    console.error(`Ad container not found in ${n}`);
    return;
  }
  _ = new p.AdDisplayContainer(e, u);
}
function Ee() {
  u.onended = null, A && A.contentComplete();
}
function qe() {
  const n = new p.AdsRequest();
  n.adTagUrl = ge, n.linearAdSlotWidth = u.clientWidth, n.linearAdSlotHeight = u.clientHeight, n.nonLinearAdSlotWidth = u.clientWidth, n.nonLinearAdSlotHeight = u.clientHeight / 3, n.vastLoadTimeout = 1e4, n.setAdWillAutoPlay(J), n.setAdWillPlayMuted(me), a.debug("Requesting VAST ad", {
    url: n.adTagUrl,
    slot: `${u.clientWidth}x${u.clientHeight}`
  }), A.requestAds(n), N && X.trackAdRequested(N.screen);
}
function Vt() {
  const n = document.getElementById("ad-container");
  if (!n) {
    console.error("NO AD CONTIANER");
    return;
  }
  _ = new p.AdDisplayContainer(n, u);
}
function Ft() {
  try {
    _.initialize(), y.init(
      u.clientWidth,
      u.clientHeight,
      p.ViewMode.NORMAL
    ), y.start();
  } catch (n) {
    console.error(n), u.play();
  }
}
function Ke(n) {
  a.debug("IMA AdsManager loaded (VAST response has an ad)");
  const e = new p.AdsRenderingSettings();
  e.restoreCustomPlaybackStateOnAdBreakComplete = !0, e.loadVideoTimeout = 15e3, y = n.getAdsManager(
    u,
    e
  ), y.setVolume(0), U = !1, y.addEventListener(p.AdErrorEvent.Type.AD_ERROR, Ae), y.addEventListener(
    p.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
    Ht
  ), y.addEventListener(
    p.AdEvent.Type.CONTENT_RESUME_REQUESTED,
    xt
  ), y.addEventListener(p.AdEvent.Type.ALL_ADS_COMPLETED, P), y.addEventListener(p.AdEvent.Type.LOADED, P), y.addEventListener(p.AdEvent.Type.STARTED, P), y.addEventListener(p.AdEvent.Type.IMPRESSION, P), y.addEventListener(p.AdEvent.Type.COMPLETE, P), J ? Ft() : Q.style.display = "block";
}
function P(n) {
  var t, r, i, o, s;
  const e = n.getAd();
  switch (a.debug(`IMA event: ${n.type}`, e ? {
    adId: (t = e.getAdId) == null ? void 0 : t.call(e),
    title: (r = e.getTitle) == null ? void 0 : r.call(e),
    duration: (i = e.getDuration) == null ? void 0 : i.call(e),
    linear: (o = e.isLinear) == null ? void 0 : o.call(e)
  } : ""), n.type) {
    case p.AdEvent.Type.LOADED:
      B.insideAdLoaded(), e.isLinear() || u.play();
      break;
    case p.AdEvent.Type.STARTED:
      B.insideAdPlay(), N && X.trackAdDisplayed(
        N.adName,
        N.adType,
        N.screen
      );
      const d = (s = document.getElementById("split-ad-container")) == null ? void 0 : s.querySelector("#ad-container");
      if (d) {
        d.style.display = "block";
        const l = document.getElementById("vjsplayer");
        l && (l.style.width = "50%", l.style.float = "right");
      }
      break;
    case p.AdEvent.Type.IMPRESSION:
      be(!0), ce && ce();
      break;
    case p.AdEvent.Type.CLICK:
      B.insideAdClicked();
      break;
    case p.AdEvent.Type.SKIPPED:
      pe(), B.insideAdSkipped();
      break;
    case p.AdEvent.Type.ALL_ADS_COMPLETED:
      pe();
      break;
    case p.AdEvent.Type.COMPLETE:
      break;
  }
}
function Ae(n) {
  var r;
  if (U) {
    a.debug("VAST error BLOCKED - adErrorHandled flag already true", {
      errorCode: n.getError().getErrorCode(),
      errorMessage: n.getError().getMessage(),
      currentSessionId: T
    });
    return;
  }
  if (U = !0, a.debug("VAST ad ERROR - triggering fallback", {
    errorCode: n.getError().getErrorCode(),
    errorMessage: n.getError().getMessage(),
    errorType: n.getError().getType(),
    sessionId: T
  }), N) {
    const i = `${n.getError().getErrorCode()}: ${n.getError().getMessage()}`;
    X.trackAdFailed(N.screen, i);
  }
  T++, a.debug("Session ID incremented to prevent stale errors", {
    newSessionId: T
  }), (r = document.getElementById("split-ad-container")) == null || r.remove();
  const e = document.getElementById("vjsplayer");
  if (e && (e.style.width = "100%", e.style.float = "none"), y)
    try {
      y.destroy();
    } catch (i) {
      a.debug("Error destroying adsManager:", i);
    }
  if (A)
    try {
      A.contentComplete();
    } catch {
    }
  const t = document.getElementById("page-content");
  t && t.remove(), u && (u.onended = null, u.pause()), be(!1), B.insideAdError(n.getError().toString()), a.debug("VAST error cleanup complete - calling onAdFinish(true) to trigger waterfall"), Z(!0);
}
function Ht() {
  u.pause(), u.onended = null;
}
function xt() {
  u.onended = Ee;
}
function pe() {
  if (a.debug("destoryIma called - cleaning up VAST ad", {
    sessionId: T
  }), T++, Z(), be(!1), y)
    try {
      y.destroy(), a.debug("adsManager destroyed successfully");
    } catch (t) {
      a.debug("Error destroying adsManager:", t);
    }
  if (A)
    try {
      A.contentComplete(), a.debug("adsLoader content complete called");
    } catch (t) {
      a.debug("Error calling adsLoader.contentComplete:", t);
    }
  const n = document.getElementById("page-content");
  n && n.remove();
  const e = document.getElementById("split-ad-container");
  if (e) {
    e.remove();
    const t = document.getElementById("vjsplayer");
    t && (t.style.width = "100%", t.style.float = "none");
  }
  B.insideAdStop();
}
function be(n) {
  const e = document.getElementById("streann-logo");
  n ? e && (e.style.display = "block") : e && (e.style.display = "none");
}
const L = class L {
  constructor(e, t, r) {
    c(this, "placement");
    // private ad : any;
    c(this, "counterFailedCornerAd", 0);
    c(this, "insideAdCallback");
    c(this, "currentAd");
    c(this, "closeButtonTimer");
    c(this, "adInProgress", !1);
    c(this, "lastAttemptTime", 0);
    c(this, "currentAttemptCount", 0);
    c(this, "finishing", !1);
    var o, s, d, l;
    this.placement = e, this.insideAdCallback = r;
    const i = 1;
    a.debug(`Corner placement "${e.name}": ad "${t == null ? void 0 : t.name}" (${t == null ? void 0 : t.adType}) starts in ${i}s`, {
      adminStartAfterSeconds: (o = e.properties) == null ? void 0 : o.startAfterSeconds,
      showCloseButtonAfterSeconds: (s = e.properties) == null ? void 0 : s.showCloseButtonAfterSeconds,
      styles: (l = (d = e.properties) == null ? void 0 : d.webSettings) == null ? void 0 : l.styles,
      fallback: t != null && t.fallback ? `${t.fallback.adType} "${t.fallback.name}"` : null
    }), this.counterFailedCornerAd = 0, setTimeout(() => {
      this.startAd(t);
    }, Number(i) * 1e3);
  }
  cornerElem(e) {
    return `
  <div id="streann-node" style="${e}">
    <div id="cornerCloseButton" class="closeButton" role="button" aria-label="Close ad">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true">
        <path d="M6 6l12 12M18 6L6 18"/>
      </svg>
    </div>
    <div id="streann-logo" class="streann-logo" style="display: none;">
      <a href="https://streann.com/" target="_blank">
        <img src="https://img.streann.com/streann-img/559ff7ade4b0d0aff40888dd/uploads/images/754c4884-ab89-4331-9134-bbe6f89bde28/NEW_Streann-Logo-Icon-Inside-Corner.png" class="logo" alt="streann-logo">    
      </a>
    </div>
    <div id="un-mute" class="un-mute" style="display: none;">
      <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-volume-mute-fill" viewBox="0 0 16 16">
        <path d="M6.717 3.55A.5.5 0 0 1 7 4v8a.5.5 0 0 1-.812.39L3.825 10.5H1.5A.5.5 0 0 1 1 10V6a.5.5 0 0 1 .5-.5h2.325l2.363-1.89a.5.5 0 0 1 .529-.06m7.137 2.096a.5.5 0 0 1 0 .708L12.207 8l1.647 1.646a.5.5 0 0 1-.708.708L11.5 8.707l-1.646 1.647a.5.5 0 0 1-.708-.708L10.793 8 9.146 6.354a.5.5 0 1 1 .708-.708L11.5 7.293l1.646-1.647a.5.5 0 0 1 .708 0"/>
      </svg>
    </div>
    <div class="mute" id="mute" style="display: none;">
      <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-volume-up-fill" viewBox="0 0 16 16">
        <path d="M11.536 14.01A8.47 8.47 0 0 0 14.026 8a8.47 8.47 0 0 0-2.49-6.01l-.708.707A7.48 7.48 0 0 1 13.025 8c0 2.071-.84 3.946-2.197 5.303z"/>
        <path d="M10.121 12.596A6.48 6.48 0 0 0 12.025 8a6.48 6.48 0 0 0-1.904-4.596l-.707.707A5.48 5.48 0 0 1 11.025 8a5.48 5.48 0 0 1-1.61 3.89z"/>
        <path d="M8.707 11.182A4.5 4.5 0 0 0 10.025 8a4.5 4.5 0 0 0-1.318-3.182L8 5.525A3.5 3.5 0 0 1 9.025 8 3.5 3.5 0 0 1 8 10.475zM6.717 3.55A.5.5 0 0 1 7 4v8a.5.5 0 0 1-.812.39L3.825 10.5H1.5A.5.5 0 0 1 1 10V6a.5.5 0 0 1 .5-.5h2.325l2.363-1.89a.5.5 0 0 1 .529-.06"/>
      </svg>
    </div>
  </div>
`;
  }
  // Delay before trying next ad in waterfall
  startAd(e) {
    var i, o, s, d;
    if (this.adInProgress) {
      a.debug("BLOCKED: Ad already in progress, skipping startAd", {
        blockedAdType: e.adType,
        blockedAdName: e.name,
        currentAdInProgress: (i = this.currentAd) == null ? void 0 : i.adType
      });
      return;
    }
    const t = Date.now(), r = t - this.lastAttemptTime;
    if (this.currentAttemptCount > 0 && r < L.MIN_RETRY_DELAY && this.lastAttemptTime > 0) {
      const l = L.MIN_RETRY_DELAY - r;
      a.debug("RATE LIMITED: Delaying startAd", {
        adType: e.adType,
        adName: e.name,
        delayMs: l
      }), setTimeout(() => this.startAd(e), l);
      return;
    }
    if (this.lastAttemptTime = t, this.currentAttemptCount++, a.debug("Starting ad attempt", {
      adType: e.adType,
      adName: e.name,
      attemptNumber: this.currentAttemptCount,
      waterfallDepth: this.counterFailedCornerAd
    }), this.adInProgress = !0, this.currentAd = e, this.createCornerAdView(), e.adType == I.VAST) {
      const l = ((d = (s = (o = this.placement.properties) == null ? void 0 : o.webSettings) == null ? void 0 : s.screens) == null ? void 0 : d[0]) || window.location.pathname;
      Lt(
        this.insideAdCallback,
        e.url,
        this.onAdFinish.bind(this),
        this.startCloseButtonTimer.bind(this),
        // Start timer only when VAST ad loads
        e,
        l
      );
    } else if (e.adType == I.BANNER) {
      D.addCallback(
        this.insideAdCallback,
        this.onAdFinish.bind(this),
        this.startCloseButtonTimer.bind(this)
        // Start timer only when banner loads
      );
      const l = {
        duration: e.properties.durationInSeconds,
        id: "corner-banner",
        sizes: e.properties.sizes,
        type: "CORNER",
        url: e.url
      };
      D.addBanners([l]);
    } else
      e.adType == I.LOCAL_VIDEO ? Ot(
        e,
        this.startCloseButtonTimer.bind(this),
        // Start timer only when the video is playing
        this.onAdFinish.bind(this)
      ) : a.debug("AD TYPE NOT SUPPORTED");
  }
  createCornerAdView() {
    var r, i, o, s, d;
    if (document.getElementById("streann-node")) {
      const l = document.getElementById("cornerCloseButton");
      l && (l.style.display = "none");
      return;
    }
    const t = ((i = (r = this.placement.properties) == null ? void 0 : r.webSettings) == null ? void 0 : i.styles) || `
      position: fixed;
      bottom: 0;
      right: 0;
      z-index: 1000;
      width: 300px;
      height: 250px;
    `;
    a.debug("Creating corner container", { style: t.replace(/\s+/g, " ").trim() }), (o = document.querySelector("body")) == null || o.insertAdjacentHTML("beforeend", this.cornerElem(t || "")), ((s = this.currentAd) == null ? void 0 : s.adType) != I.BANNER && ((d = document.getElementById("streann-node")) == null || d.style.removeProperty("height"));
  }
  // Call this when ad successfully loads (from bannerService or ima)
  startCloseButtonTimer() {
    var t, r;
    const e = document.getElementById("streann-node");
    if (e) {
      const i = e.getBoundingClientRect(), { clientWidth: o, clientHeight: s } = document.documentElement;
      a.debug(`Corner ad visible (${(t = this.currentAd) == null ? void 0 : t.adType})`, {
        size: `${Math.round(i.width)}x${Math.round(i.height)}`,
        offset: `right ${Math.round(o - i.right)}px, bottom ${Math.round(s - i.bottom)}px`,
        viewport: `${o}x${s}`,
        appliedStyle: e.getAttribute("style")
      });
    }
    if (((r = this.currentAd) == null ? void 0 : r.adType) == I.BANNER) {
      const i = document.getElementById("streann-logo");
      i && (i.style.display = "block");
    }
    this.showCloseButton();
  }
  showCloseButton() {
    if (this.closeButtonTimer && (clearTimeout(this.closeButtonTimer), this.closeButtonTimer = void 0), this.placement.properties.showCloseButtonAfterSeconds != null) {
      const e = this.placement.properties.showCloseButtonAfterSeconds;
      this.closeButtonTimer = setTimeout(() => {
        const t = document.getElementById("cornerCloseButton");
        t && (t.onclick = this.handleOnCloseButton.bind(this), t.style.setProperty("display", "block"), a.debug(`Close button shown (after ${e}s)`));
      }, Number(e) * 1e3);
    }
  }
  handleOnCloseButton() {
    var e, t, r;
    a.debug("Corner ad close button clicked"), ((e = this.currentAd) == null ? void 0 : e.adType) == I.BANNER ? D.destroyCornerAdBanner() : ((t = this.currentAd) == null ? void 0 : t.adType) == I.VAST ? pe() : ((r = this.currentAd) == null ? void 0 : r.adType) == I.LOCAL_VIDEO ? ye() : a.debug("Closing UnSupperoted ad type");
  }
  onAdFinish(e = !1) {
    var s, d, l, h, m, g, f, b;
    if (this.finishing)
      return;
    this.finishing = !0, this.adInProgress = !1, this.closeButtonTimer && (clearTimeout(this.closeButtonTimer), this.closeButtonTimer = void 0), a.debug("cornerAd finished", {
      withError: e,
      failedAttempts: this.counterFailedCornerAd,
      currentAdType: (s = this.currentAd) == null ? void 0 : s.adType,
      currentAdName: (d = this.currentAd) == null ? void 0 : d.name,
      hasFallback: !!((l = this.currentAd) != null && l.fallback)
    });
    const t = (h = this.currentAd) == null ? void 0 : h.fallback;
    if (t && e && this.counterFailedCornerAd < 20) {
      a.debug("cornerAd starting waterfall ad", {
        adId: t.id,
        adName: t.name,
        adType: t.adType,
        waterfallDepth: this.counterFailedCornerAd + 1
      }), this.counterFailedCornerAd++;
      const R = document.getElementById("cornerCloseButton"), E = document.getElementById("streann-logo");
      R && (R.style.display = "none"), E && (E.style.display = "none"), this.finishing = !1, setTimeout(() => {
        this.startAd(t);
      }, L.WATERFALL_RETRY_DELAY);
      return;
    }
    e && !t ? a.debug("cornerAd waterfall EXHAUSTED - no more fallbacks", {
      lastAdType: (m = this.currentAd) == null ? void 0 : m.adType,
      lastAdName: (g = this.currentAd) == null ? void 0 : g.name,
      totalAttempts: this.counterFailedCornerAd + 1
    }) : e && this.counterFailedCornerAd >= 20 && a.debug("cornerAd waterfall MAX RETRIES reached", {
      lastAdType: (f = this.currentAd) == null ? void 0 : f.adType,
      lastAdName: (b = this.currentAd) == null ? void 0 : b.name,
      totalAttempts: this.counterFailedCornerAd + 1
    });
    const r = e ? 0 : 1e3;
    this.counterFailedCornerAd = 0, this.currentAttemptCount = 0, this.lastAttemptTime = 0;
    const i = document.getElementById("cornerCloseButton"), o = document.getElementById("streann-logo");
    i && (i.style.display = "none"), o && (o.style.display = "none"), setTimeout(() => {
      const R = document.getElementById("streann-node");
      R && (R.remove(), a.debug("Corner ad removed", R.id)), this.finishing = !1, this.insideAdCallback && this.insideAdCallback.insideAdStop();
    }, r);
  }
};
c(L, "MIN_RETRY_DELAY", 1e3), // 1 second between attempts
c(L, "WATERFALL_RETRY_DELAY", 500);
let he = L;
class zt {
  constructor(e, t) {
    var l, h, m;
    const r = {
      id: "",
      duration: t.properties.durationInSeconds,
      sizes: t.properties.sizes,
      type: "EMBED",
      url: t.url
    }, i = (l = e.properties) == null ? void 0 : l.webSettings;
    if (!i)
      return;
    const { elemId: o, parentXpath: s, advancedScript: d } = i;
    if (o) {
      const g = document.getElementById(o);
      if (!g)
        return;
      const f = (m = (h = e.properties) == null ? void 0 : h.webSettings) == null ? void 0 : m.styles;
      f && g.setAttribute("style", f), r.id = o;
    } else if (s) {
      const g = this.getElementByXpath(s);
      if (!g)
        return;
      if (document.getElementById(e.id))
        r.id = e.id;
      else {
        const b = this.generateElement(e);
        g.appendChild(b), r.id = e.id;
      }
    } else if (d) {
      const g = new Function(d)();
      if (!document.getElementById(g))
        return;
      r.id = g;
    } else
      return;
    D.addBanners([r]);
  }
  getElementByXpath(e) {
    return document.evaluate(
      e,
      document,
      null,
      XPathResult.FIRST_ORDERED_NODE_TYPE,
      null
    ).singleNodeValue;
  }
  generateElement(e) {
    var i, o;
    const t = document.createElement("div");
    t.setAttribute("id", e.id);
    const r = (o = (i = e.properties) == null ? void 0 : i.webSettings) == null ? void 0 : o.styles;
    return r && t.setAttribute("style", r), t;
  }
  randId() {
    return Math.random().toString(36).replace("0.", "inside-ad");
  }
}
class Yt {
  constructor() {
    c(this, "adHeasonElem", `<div id="streann-adhesion">
    <div class="adhesion-container">
        <div id="adhesion">
        </div>
    </div>
    <div class="close-btn-container">
    <button id='adHesionCloseBtn' class="closeButton">x</button>
    </div>
</div>`);
    c(this, "lastShownLocation", "");
    c(this, "adHesionTimeout");
  }
  setAd(e, t) {
    if (this.lastShownLocation == location.pathname)
      return;
    Tt().subscribe({
      next: (i) => {
        switch (i) {
          case "REQUESTED":
            this.lastShownLocation = location.pathname;
            break;
          case "ERROR":
            this.onAdFinish();
            break;
          case "STARTED":
            break;
          case "FINISHED":
            this.onAdFinish();
            break;
        }
      }
    });
    const r = e.properties.startAfterSeconds;
    r != null ? (clearTimeout(this.adHesionTimeout), this.adHesionTimeout = setTimeout(() => {
      this.startAd(t);
    }, Number(r) * 1e3)) : this.startAd(t);
  }
  onCloseButton() {
    D.removeBanner("adhesion");
  }
  createAdHeasonElem() {
    var t;
    (t = document.querySelector("body")) == null || t.insertAdjacentHTML("beforeend", this.adHeasonElem);
    const e = document.getElementById("adHesionCloseBtn");
    e && (e.style.setProperty("display", "block"), e.onclick = this.onCloseButton.bind(this));
  }
  startAd(e) {
    $("REQUESTED"), this.createAdHeasonElem();
    const t = {
      duration: e.properties.durationInSeconds,
      id: "adhesion",
      sizes: e.properties.sizes,
      type: "ADHESION",
      url: e.url
      // url: "/22290518902/flexflix_web_corner_rectangle",
    };
    D.addBanners([t]);
  }
  onAdFinish() {
    var e;
    (e = document.getElementById("streann-adhesion")) == null || e.remove();
  }
}
const We = new Yt();
class jt {
  constructor(e, t, r) {
    c(this, "placement");
    c(this, "ad");
    c(this, "insideAdCallback");
    c(this, "currentAd");
    c(this, "insideAdActive", !1);
    this.placement = e, this.ad = t, this.insideAdCallback = r, setTimeout(() => {
      this.startAd(t);
    }, Number(5) * 1e3), window.addEventListener("popstate", this.removeAd.bind(this)), window.addEventListener("hashchange", this.removeAd.bind(this));
  }
  splitAdElem(e) {
    return `<div id="streann-splitad" style="${e};height: 100vh; background: black; display: flex; justify-content: center; align-items: center; position: relative;">
            <video id="ad-player" style="width: 100%; height: 100%;"></video>
            <button id="cornerUnmuteSplitAdButton" class="split-ad-unmute-btn"></button>
            <button id="cornerCloseSplitAdButton" class="split-ad-close-btn">Skip Ad</button>
        </div>`;
  }
  initLocalVideoAd_(e) {
    const t = document.getElementById("ad-player");
    t ? (t.style.display = "none", t.addEventListener("play", () => {
      t.style.display = "block";
    }), t.src = e.url, t.muted = !0, t.autoplay = !0, t.play().catch((r) => {
      console.error("Error playing ad video:", r);
    }), t.addEventListener("ended", () => {
      var i;
      (i = document.getElementById("streann-splitad")) == null || i.remove();
      const r = document.getElementById("vjsplayer");
      r && (r.style.width = "100%", r.style.float = "none");
    })) : console.error("Ad player not found");
  }
  startAd(e) {
    var r, i, o;
    if (this.insideAdActive)
      return;
    this.insideAdActive = !0;
    const t = localStorage.getItem("streannShowSplitAd");
    if (this.cleanupExistingAdContainer(), !t || t === "false") {
      console.warn("No ads in player"), this.insideAdActive = !1;
      return;
    } else {
      this.currentAd = e;
      const s = document.querySelector("body");
      if (s && (s.classList.remove("flex-column"), s.classList.add("flex-row-reverse")), e.adType === "LOCAL_VIDEO")
        this.createSplitAdView(), this.initLocalVideoAd_(e);
      else if (e.adType === "VAST") {
        this.createSplitAdViewVast();
        const d = ((o = (i = (r = this.placement.properties) == null ? void 0 : r.webSettings) == null ? void 0 : i.screens) == null ? void 0 : o[0]) || window.location.pathname;
        Dt(this.insideAdCallback, e.url, this.removeAd.bind(this), "split-ad-container", e, d);
      } else
        console.warn("Ad type not supported");
    }
  }
  createSplitAdViewVast() {
    const e = document.createElement("div");
    e.id = "split-ad-container", e.style.setProperty("width", "50%", "important"), e.style.background = "black", e.style.height = "100vh", e.style.display = "flex", e.style.justifyContent = "center", e.style.alignItems = "center", document.body.appendChild(e);
  }
  createSplitAdView() {
    var r, i, o;
    const e = document.getElementById("vjsplayer");
    e && (e.style.width = "50%", e.style.float = "right", e.style.height = "100vh", e.style.display = "flex", e.style.justifyContent = "center", e.style.alignItems = "center");
    const t = ((i = (r = this.placement.properties) == null ? void 0 : r.webSettings) == null ? void 0 : i.styles) || "";
    (o = document.querySelector("body")) == null || o.insertAdjacentHTML("beforeend", this.splitAdElem(t)), this.showCloseButton(), this.showUnmuteButton();
  }
  showCloseButton() {
    if (this.placement.properties.showCloseButtonAfterSeconds != null) {
      const e = document.getElementById("cornerCloseSplitAdButton");
      if (!e)
        return;
      const t = this.placement.properties.showCloseButtonAfterSeconds;
      e.style.setProperty("display", "none"), setTimeout(() => {
        e.onclick = this.handleOnCloseButton.bind(this), e.style.setProperty("display", "block");
      }, Number(t) * 1e3);
    }
  }
  showUnmuteButton() {
    const e = document.getElementById("cornerUnmuteSplitAdButton");
    e && (e.innerHTML = `<svg width="24" height="24" viewBox="0 0 24 24" fill="white">
                <path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/>
            </svg>`, e.onclick = this.toggleMute.bind(this));
  }
  toggleMute() {
    const e = document.getElementById("cornerUnmuteSplitAdButton"), t = document.getElementById("ad-player");
    !t || !e || (t.muted ? (t.muted = !1, e.innerHTML = `<svg width="24" height="24" viewBox="0 0 24 24" fill="white">
                    <path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>
                </svg>`) : (t.muted = !0, e.innerHTML = `<svg width="24" height="24" viewBox="0 0 24 24" fill="white">
                    <path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/>
                </svg>`));
  }
  handleOnCloseButton() {
    const e = document.getElementById("streann-splitad"), t = document.getElementById("ad-player");
    t && (t.pause(), t.currentTime = 0), e && e.remove();
    const r = document.getElementById("vjsplayer");
    r && (r.style.width = "100%", r.style.float = "none");
  }
  removeAd() {
    var r, i;
    this.insideAdActive = !1, (r = document.getElementById("split-ad-container")) == null || r.remove(), (i = document.getElementById("streann-splitad")) == null || i.remove();
    const e = document.getElementById("vjsplayer");
    e && (e.style.width = "100%", e.style.float = "none");
    const t = document.querySelector("body");
    t && (t.classList.remove("flex-row-reverse"), t.classList.add("flex-column"));
  }
  cleanupExistingAdContainer() {
    const e = document.getElementById("split-ad-container");
    e && e.remove();
    const t = document.getElementById("streann-splitad");
    t && t.remove();
  }
}
window.insideAd = {
  initialize: $t,
  debug: !0
};
function $t(n) {
  C.isAlreadyInit || !n.apiKey && !n.apiToken && !n.baseUrl || (C.apiKey = n.apiKey, C.apiToken = n.apiToken, C.baseUrl = n.baseUrl, C.isAlreadyInit = !0, a.info("ADS 07.10.2026 | V.3.7.4"), a.debug("Debug logs ON (disable with ?debug=false)", {
    baseUrl: n.baseUrl,
    apiKey: n.apiKey,
    url: window.location.href,
    viewport: `${document.documentElement.clientWidth}x${document.documentElement.clientHeight}`,
    innerWidth: window.innerWidth,
    userAgent: navigator.userAgent
  }), n.apiKey && X.initialize(n.apiKey), Pe(), Se());
}
let fe;
async function Se() {
  var d;
  const n = await nt();
  a.debug(`main(): ${n.length} campaign(s) received`, n);
  const { campaign: e, filteredPlacements: t } = at(n);
  if (!e || t.length === 0) {
    a.debug("main(): NO campaign/placement matches this page/screen, nothing will show", {
      campaign: e == null ? void 0 : e.name,
      path: window.location.pathname,
      innerWidth: window.innerWidth
    });
    return;
  }
  a.debug(`main(): campaign "${e.name}" selected`, {
    placements: t.map((l) => {
      var h, m;
      return `${l.name} [${l.viewType}] -> ${(h = l.ad) == null ? void 0 : h.adType} "${(m = l.ad) == null ? void 0 : m.name}"`;
    }),
    intervalInMinutes: (d = e.properties) == null ? void 0 : d.intervalInMinutes
  });
  const r = new dt(e, Se), i = t.find(
    (l) => l.viewType == k.CORNER
  );
  i || a.debug("main(): NO CORNER placement matches this page/screen"), i && (fe = new he(
    i,
    i.ad,
    r
  ));
  const o = t.find(
    (l) => l.viewType == k.SPLIT_AD
  );
  o && new jt(
    o,
    o.ad,
    r
  );
  const s = t.find(
    (l) => l.viewType == k.ADHESION
  );
  s && We.setAd(s, s.ad), t.filter((l) => l.viewType == k.EMBED).forEach((l) => new zt(l, l.ad));
}
let De = window.location.pathname;
function Gt() {
  De != window.location.pathname && (a.debug("Path changed, restarting ads", { from: De, to: window.location.pathname }), D.clearAllSlots(), fe && fe.handleOnCloseButton(), We.onAdFinish(), Se());
}
window.addEventListener("locationchange", function() {
  Gt();
});
(() => {
  let n = history.pushState;
  history.pushState = function() {
    let r = n.apply(this, arguments);
    return window.dispatchEvent(new Event("pushstate")), window.dispatchEvent(new Event("locationchange")), r;
  };
  let e = history.replaceState;
  history.replaceState = function() {
    let r = e.apply(this, arguments);
    return window.dispatchEvent(new Event("replacestate")), window.dispatchEvent(new Event("locationchange")), r;
  }, window.addEventListener("popstate", () => {
    window.dispatchEvent(new Event("locationchange"));
  });
})();
