ble+adLoaded instead of adNoBid?
      fireAdEvent("adNoBid", adObj);
    });
  };

  const off = (type, targetId, cb) => {
    gEventHandlers[type]?.[targetId]?.delete(cb);
  };

  const on = (type, targetId, cb) => {
    gEventHandlers[type] = gEventHandlers[type] || {};
    gEventHandlers[type][targetId] =
      gEventHandlers[type][targetId] || new Set();
    gEventHandlers[type][targetId].add(cb);
  };

  const Tag = class {
    static #nextId = 0;
    debug = undefined;
    displayed = false;
    initialHeight = 1;
    initialWidth = 1;
    keywords = {};
    member = 0;
    showTagCalled = false;
    sizes = [];
    targetId = "";
    utCalled = true;
    utDivId = "";
    utiframeId = "";
    uuid = "";

    constructor(raw) {
      const { keywords, sizes, targetId } = raw;
      this.tagId = Tag.#nextId++;
      this.keywords = keywords || {};
      this.sizes = sizes || [];
      this.targetId = targetId || "";
    }
    modifyTag() {}
    off(type, cb) {
      off(type, this.targetId, cb);
    }
    on(type, cb) {
      on(type, this.targetId, cb);
    }
    setKeywords(kw) {
      this.keywords = kw;
    }
  };

  window.apntag = {
    anq,
    attachClickTrackers() {},
    checkAdAvailable() {},
    clearPageTargeting() {},
    clearRequest() {},
    collapseAd() {},
    debug: false,
    defineTag(dfn) {
      const { targetId } = dfn;
      if (!targetId) {
        return;
      }
      gTags.set(targetId, new Tag(dfn));
    },
    disableDebug() {},
    dongle: undefined,
    emitEvent(adObj, type) {
      fireAdEvent(type, adObj);
    },
    enableCookieSet() {},
    enableDebug() {},
    fireImpressionTrackers() {},
    getAdMarkup: () => "",
    getAdWrap() {},
    getAstVersion: () => "0.49.0",
    getPageTargeting() {},
    getTag(targetId) {
      return gTags.get(targetId);
    },
    handleCb() {},
    handleMediationBid() {},
    highlightAd() {},
    loaded: true,
    loadTags() {
      for (const tagName of gTags.keys()) {
        refreshTag(tagName);
      }
    },
    modifyTag() {},
    notify() {},
    offEvent(type, target, cb) {
      off(type, target, cb);
    },
    onEvent(type, target, cb) {
      on(type, target, cb);
    },
    recordErrorEvent() {},
    refresh() {},
    registerRenderer() {},
    requests: {},
    resizeAd() {},
    setEndpoint() {},
    setKeywords() {},
    setPageOpts() {},
    setPageTargeting() {},
    setSafeFrameConfig() {},
    setSizes() {},
    showTag() {},
  };

  const push = function (fn) {
    if (typeof fn === "function") {
      try {
        fn();
      } catch (e) {
        console.trace(e);
      }
    }
  };

  anq.push = push;

  anq.forEach(push);
}
PK