!function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){t.exports=n(1)},function(module,exports){!function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=8)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=function(){function t(){}return t.getTagData=function(){var t;try{t=document.currentScript,(null===t||void 0===t?void 0:t.getAttribute("data-siteKey"))&&(null===t||void 0===t?void 0:t.getAttribute("data-pubKey"))||(t=document.getElementById("browsi-tag"))}catch(e){t=document.getElementById("browsi-tag")}if(!t)throw new Error("no tag");var e=this.getSessionStorage("__browsienv")||t.getAttribute("data-browsidomain")||".browsiprod.com",n="";try{var i=t.getAttribute("src")||"";n=new URL(i).host}catch(t){n="NA"}return{tag:t,sk:t.getAttribute("data-siteKey")||"error",pk:t.getAttribute("data-pubKey")||"error",ds:e,y:"yield-manager"+e,es:"//events"+e+"/events/",fp:t.hasAttribute("prebidbpt"),mt:t.hasAttribute("master"),pd:t.prebidData,so:n}},t.getSessionStorage=function(t){var e;try{e=sessionStorage.getItem(t)}catch(t){}return e||""},t.setSessionStorage=function(t,e){sessionStorage[t]="string"==typeof e?e:JSON.stringify(e)},t.getBIAgentDebugConfig=function(){var t=this.getSessionStorage("__brwsibad"),e={};return t&&(e=JSON.parse(t)),e},t.getD=function(){var t=this.getSessionStorage("__brwsidbg"),e={};return t&&(e=JSON.parse(t)),e},t.isD=function(){var e=t.getD();return!!(null===e||void 0===e?void 0:e.hasOwnProperty("debug"))},t.getLiveConfig=function(){var t=this.getSessionStorage("__brwsilc"),e={};return t&&(e=JSON.parse(t)),e},t.isLiveConfigExtensionEnabled=function(){return!!i.Context.window.__brw_lc},t.isTestMode=function(){var e=t.getD();return!(!e||!e.hasOwnProperty("test"))},t.isObject=function(t){return t&&"object"==typeof t&&!Array.isArray(t)},t.mergeDeep=function(t,e){var n,i;if(this.isObject(t)&&this.isObject(e))for(var o in e)e.hasOwnProperty(o)&&this.isObject(e[o])?(t[o]||Object.assign(t,(n={},n[o]={},n)),this.mergeDeep(t[o],e[o])):Object.assign(t,(i={},i[o]=e[o],i));return t},t.generateToken=function(){var t="abcdefghijklmnopqrstuvwxyz";t+=t.toUpperCase()+"_!@#$";for(var e="",n=0;n<20;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},t.getCookie=function(t){var e=i.Context.document.cookie.split(/\s*;\s*/).map(function(t){var e=t.split(/\s*=\s*/);if(2===(null===e||void 0===e?void 0:e.length))return{key:e[0],value:e[1]}}).find(function(e){return(null===e||void 0===e?void 0:e.key)===t});return e?e.value:""},t.setCookie=function(t,e,n,o){void 0===e&&(e=""),void 0===n&&(n=0),void 0===o&&(o="d");var r=6e4;"d"===o&&(r*=1440);var s=new Date(+new Date+n*r);i.Context.document.cookie=t+"="+e+"; expires="+s.toUTCString()+"; path=/"},t.setLocalStorage=function(t,e){try{localStorage.setItem(t,e)}catch(t){}},t.getLocalStorage=function(t){try{return i.Context.windowType.localStorage.getItem(t)||""}catch(t){}return""},t.toUrlParams=function(t){return Object.keys(t).map(function(e){return e+"="+("object"==typeof t[e]?encodeURIComponent(JSON.stringify(t[e])):encodeURIComponent(t[e]))}).join("&")},t.getHead=function(t){return t.head||t.getElementsByTagName("head")[0]},t.getResolution=function(){return i.Context.windowType.screen.width+"x"+i.Context.windowType.screen.height},t.isPositionContained=function(t,e){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)},t.isVisible=function(t){return this.isCssVisible(t)&&this.hasValidSize(t)},t.isCssVisible=function(t){var e=i.Context.windowType.getComputedStyle(t);return!!e&&("visible"===e.getPropertyValue("visibility")&&"none"!==e.getPropertyValue("display")&&"0"!==e.getPropertyValue("opacity"))},t.hasValidSize=function(t){var e=t.getBoundingClientRect();return e.height>0&&e.width>0},t.getUrlParams=function(){var t=i.Context.document.location.search.substring(1);if(0===t.length)return{};var e={};return t.split("&").forEach(function(t){var n=t.split("=");2===n.length&&n[0]&&(e[n[0]]=n[1])}),e},t.xhrPromise=function(t){return new Promise(function(e,n){var i=new XMLHttpRequest;i.open("GET",t,!0),i.onreadystatechange=function(){i.readyState==(i.DONE||4)&&(200===i.status||204===i.status?e(i):n(i.status))},i.send()})},t.isPromise=function(t){return t instanceof Promise},t.dispatchDOMEvent=function(t,e,n){var i=new CustomEvent(t,{detail:e});n.dispatchEvent(i)},t.generateUUIDIfSupported=function(){return window.crypto&&window.crypto.randomUUID?window.crypto.randomUUID()||"":""},t.getStoredPvid=function(){try{return i.Context.window.browsitag.pvid}catch(t){return}},t.setStoredPvid=function(t){try{i.Context.window.browsitag.pvid=t}catch(t){}},t.getStoredBpvid=function(){try{return i.Context.window.browsitag.bpvid}catch(t){}},t.setStoredBpvid=function(t){try{i.Context.window.browsitag.bpvid=t}catch(t){}},t.setIsBptLoaded=function(t){try{i.Context.window.browsitag.ibl=t}catch(t){}},t.getIsBptLoaded=function(){try{return!!i.Context.window.browsitag.ibl}catch(t){}},t.onReInject=function(){t.setStoredPvid(""),t.setStoredBpvid(""),t.setIsBptLoaded(!1),i.Context.window._middyo=null,i.Context.window.browsitag.st=null,i.Context.window.browsitag.__ori=null,i.Context.window.browsitag.mt.ex=null},t.getMetaDataLanguage=function(){var t;return(null===(t=i.Context.document.querySelector('meta[property="og:locale"]'))||void 0===t?void 0:t.content)||i.Context.document.documentElement.lang},t.isEngagingUser=function(){var t,e;return(window.scrollY||("CSS1Compat"===document.compatMode?null===(t=document.documentElement)||void 0===t?void 0:t.scrollTop:null===(e=document.body)||void 0===e?void 0:e.scrollTop))>0},t.getDaysDifference=function(e,n){return Math.abs(e-n)/t.millisecondsPerDay},t.getTimestamp=function(){return Date.now()},t.isObjectDefined=function(t){return!(!t||"object"!=typeof t||!Object.keys(t).length)},t.millisecondsPerDay=864e5,t}();e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Context=void 0;var i=function(){function t(){}return Object.defineProperty(t,"windowType",{get:function(){return this._window||(this._window=window.top),this._window},enumerable:!1,configurable:!0}),Object.defineProperty(t,"window",{get:function(){return this.windowType},enumerable:!1,configurable:!0}),Object.defineProperty(t,"topMostWindow",{get:function(){return this.getTopWindow()||this.windowType},enumerable:!1,configurable:!0}),Object.defineProperty(t,"document",{get:function(){return this._document||(this._document=this.windowType.document),this._document},enumerable:!1,configurable:!0}),t.isIframe=function(){return this.windowType!==this.getTopWindow()},t.getTopWindow=function(){try{return window.top.document,window.top}catch(t){return null}},t}();e.Context=i},function(t,e,n){"use strict";var i=this&&this.__spreadArray||function(t,e){for(var n=0,i=e.length,o=t.length;n<i;n++,o++)t[o]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.Logger=e.LogTypes=void 0;var o=n(0);!function(t){t.INFO="info",t.ERROR="error",t.CUSTOM="custom",t.DEBUG="debug"}(e.LogTypes||(e.LogTypes={}));var r=function(){function t(t){this.className=t,this.isActive=!!o.default.getD().debug}return t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.logMessage("info",t)},t.prototype.verbose=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.logMessage("debug",t)},t.prototype.custom=function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var o=[{msg:t,style:e,args:n}];this.logMessage("custom",o)},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.logMessage("error",t)},t.prototype.logMessage=function(t,e){this.isActive&&("custom"!==t?console[t].apply(console,i(["["+this.className+"]"],e)):console.info("%c["+this.className+"] "+e[0].msg,e[0].style,e[0].args))},t}();e.Logger=r},function(t,e,n){"use strict";var i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.Events=void 0;var o=n(0),r=n(2),s=n(4),a=n(1),u=function(){function t(){this.tagData=o.default.getTagData(),this.eventsHost=this.tagData.es,this.logger=new r.Logger("Events"),this.staticData={},this.staticFields={}}return t.get=function(){return t._instance||(this._instance=new t),t._instance},t.prototype.getStaticFields=function(){if(!Object.keys(this.staticFields||{}).length&&this.loaderParams){var t=a.Context.document.location;this.staticFields=Object.assign({},this.buildStaticData(),{url:encodeURIComponent(t.protocol+"//"+t.host+t.pathname),res:a.Context.window.screen.width+"x"+a.Context.window.screen.height})}return this.staticFields},t.prototype.buildStaticData=function(){var t=this.loaderParams.dt||{};return{sk:this.loaderParams.i.sk,pk:this.loaderParams.i.pk,pvid:this.loaderParams.i.pv,bpvid:this.loaderParams.bpvi,aid:this.loaderParams.i.aid,scid:this.loaderParams.i.sc,db:t.b||"",dbt:t.bt||"",d:t.d||"",dp:t.p||"",dos:t.os||"",dosv:t.osv||"",sid:this.loaderParams.i.s,ibpv:this.loaderParams.r.b,geo:this.loaderParams.r.cc,ts:this.loaderParams.r.ts,mv:this.loaderParams.ses.v,iru:this.loaderParams.r.ru}},t.prototype.sendInitialHit=function(t,e,n,r,s){var a=i({uid:t.uid,sk:t.sk,pk:t.pk,sid:t.sid,bpvid:t.bpvid,mv:t.mv,url:encodeURIComponent(t.url)},t.pvid?{pvid:t.pvid}:{}),u=i({now:Math.floor(Date.now()/1e3),et:"initial_hit",to:+new Date-e,res:o.default.getResolution(),ua:n,src:function(t,e){return t?"pb":e?"mt":"bpt"}(this.tagData.fp,this.tagData.mt)+"_"+this.tagData.so,ex:s}),d=i({events:[u]},a);this.send(d,"supply",u.et,a.bpvid)},t.prototype.sendVideoOnLoad=function(t,e){var n=this.getStaticFields(),o={pvid:n.pvid,mv:n.mv,dos:n.dos,sk:n.sk,scid:n.scid,dp:n.dp,geo:n.geo,pk:n.pk},r=i({et:"on_load",il:e,to:+new Date-t}),s=i({events:[r]},o);this.send(s,"supply",r.et,n.pvid)},t.prototype.sendVideoPlayerLoaded=function(t){var e=this.getStaticFields(),n={pvid:e.pvid,bpvid:e.bpvid,url:e.url,sid:e.sid,mv:e.mv,dos:e.dos,db:e.db,sk:e.sk,scid:e.scid,dp:e.dp,geo:e.geo,pk:e.pk},o=i({et:"player_loaded",to:+new Date-t}),r=i({events:[o]},n);this.send(r,"inframe",o.et,e.pvid)},t.prototype.sendLayoutMatchedEvent=function(t){var e=this.getStaticFields(),n={pvid:e.pvid,scid:e.scid,sk:e.sk,pk:e.pk,dp:e.dp,bpvid:e.bpvid,mv:e.mv,url:e.url,geo:e.geo},o=i({now:Math.floor(Date.now()/1e3),et:"layout_matched",to:+new Date-t,vid:!!this.loaderParams.ly.inf}),r=i({events:[o]},n);this.send(r,"supply",o.et,e.pvid)},t.prototype.sendSelectedPubEvent=function(t){var e,n,o,r=this.getStaticFields(),s={pvid:r.pvid,scid:r.scid,sk:r.sk,pk:r.pk,bpvid:r.bpvid,mv:r.mv,url:r.url,geo:r.geo},a=i({et:"selected_pub",to:+new Date-t,spk:null===(e=this.loaderParams.spub)||void 0===e?void 0:e.pk,ssk:null===(n=this.loaderParams.spub)||void 0===n?void 0:n.sk,sscid:null===(o=this.loaderParams.spub)||void 0===o?void 0:o.scid}),u=i({events:[a]},s);this.send(u,"supply",a.et,r.pvid)},t.prototype.send=function(t,e,n,i){var r=new XMLHttpRequest;if(r.open("POST",this.eventsHost+"v2/"+e+"?p="+i,!0),r.send(JSON.stringify([t])),this.logger.custom("("+n+", "+e+")","background: #2ecc40; color: #0E3E14; font-weight: bold; text-decoration: underline; font-size: 18px;",t.events[0]?t.events[0]:t),o.default.isD()){s.Output.getValue("firedEvents",[]).push(t)}this.testEvents(t)},t.prototype.testEvents=function(t){if(o.default.isTestMode()){var e=a.Context.window.browsitag;e&&(e.tee=e.tee||[],e.tee.push(t))}},t.prototype.sendError=function(t,e,n,i){var r=a.Context.document.location,s=Object.assign({},{now:Math.floor(Date.now()/1e3),to:+new Date-n,et:"crash",bpvid:e.bpvid,sk:e.sk,pk:e.pk,uid:e.uid,sid:e.sid,file:t.filename,lineNo:t.lineno||-1,columnNo:t.colno||-1,msg:t.message?t.message+"; "+i:i,error:t.error,url:encodeURIComponent(r.protocol+"//"+r.host+r.pathname),res:o.default.getResolution(),pvid:"",ibpv:!1,geo:"",ts:"",db:"",dbt:"",d:"",dp:"",dv:"",dos:"",dosv:"",mv:"",iru:!1,scid:""});if(this.loaderParams&&(s=Object.assign(s,this.getErrorData())),o.default.getD().debug)this.logger.error(s);else{var u=new XMLHttpRequest;u.open("POST",this.tagData.es+"v2/engineError",!0),u.send(JSON.stringify([{events:[s]}])),this.testEvents(s)}},t.prototype.getErrorData=function(){var t=this.loaderParams.dt;return{pvid:this.loaderParams.i.pv,ibpv:this.loaderParams.r.b,geo:this.loaderParams.r.cc,ts:this.loaderParams.r.ts,db:t.b,dbt:t.bt,d:t.d,dp:t.p,dv:t.v,dos:t.os,dosv:t.osv,mv:this.loaderParams.ses.v,iru:this.loaderParams.r.ru,scid:this.loaderParams.i.sc}},t.prototype.setLoaderParams=function(t){this.loaderParams=t},t.prototype.setStaticData=function(t){this.staticData=t},t}();e.Events=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Output=void 0;var i=n(1),o=function(){function t(){}return t.setKeyValues=function(t){this.getBptOut(),Object.assign(i.Context.window[this.bptOutKey],t)},t.getBptOut=function(){return i.Context.window.hasOwnProperty(this.bptOutKey)||(i.Context.window[this.bptOutKey]={}),i.Context.window[this.bptOutKey]},t.getValue=function(t,e){var n=this.getBptOut();return n[t]||(n[t]=e),n[t]},t.bptOutKey="bptOut",t}();e.Output=o},function(t,e,n){"use strict";function i(t){w=t}function o(t){for(var e,n,i=t.length;i;)n=Math.random()*i-->>>0,e=[t[n],t[i]],t[i]=e[0],t[n]=e[1];return t}function r(){return!!C.Context.window.browsitag.vl_loaded}function s(){C.Context.window.browsitag.vl_loaded=!0}function a(t){var e=-1!==(t.dt.b||"").search(/Internet Explorer/i);return t.ly.inf&&!t.r.b&&!t.ly.am&&!e&&!r()}function u(){return _(this,void 0,void 0,function(){var t,e,n;return b(this,function(i){switch(i.label){case 0:return[4,D.default.xhrPromise("https://static.avantisvideo.com/data/abc.txt")];case 1:if(t=i.sent(),!(e=200===t.status?t.responseText:null))throw n="Failed retrieving ab-config.txt (video script group config)",S.error(n),new Error(n);return[2,JSON.parse(atob(e.slice(3)))]}})})}function d(t){var e=o(t.masterDistribution),n=e.find(function(){var t=Math.floor(100*Math.random()+1);return function(e){return(t-=e.weight)<=0}}());if(!n){var i="Failed getting random script group name";throw S.error(i),new Error(i)}return n.groupId}function l(t){var e=D.default.getSessionStorage("avnts_group");if(e in t.groups)return e}function c(t,e){var n=e.ly.inf.sgn in t.groups?e.ly.inf.sgn:null;if(n)return n;if(e.ly.inf.sgn){var i="Invalid video custom script group name";throw S.error(i),new Error(i)}var o=l(t);if(o)return o;var r=d(t);return D.default.setSessionStorage("avnts_group",r),r}function p(t,e){return t+="?id="+e.publisherId+"&tagId="+e.tagId+"&partnerId="+e.supplyConfigId+"&callback=browsitag.avCallback"}function g(t,e,n){return{pubKey:t.i.pk,siteKey:t.i.sk,pvid:t.i.pv,browser:(t.dt.b||"").toLowerCase(),device:(t.dt.p||"").toLowerCase(),os:t.dt.os||"",osVersion:t.dt.osv||"",sid:t.i.s,country:t.r.cc.toUpperCase(),city:t.r.ct||"",eu:"eu"===t.r.cl,uid:t.i.u,publisherId:t.ly.inf.id,tagId:t.ly.inf.tid,url:e.url+C.Context.document.location.search,referrer:C.Context.document.referrer||"",supplyConfigId:t.i.sc,testGroup:n,newUser:w}}function f(t){var e=t.loaderParams,n=t.staticData,i=t.startTime;return _(this,void 0,void 0,function(){var t,o,r,d,l;return b(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),a(e)?(s(),S.info("Injecting video script"),h(e.ly.inf.id,i),[4,u()]):(S.info("Avoiding video engine injection"),[2]);case 1:return t=f.sent(),o=c(t,e),r=g(e,n,o),d=p(t.groups[o],r),y(r,d,n,i),v(window,e),[3,3];case 2:return l=f.sent(),E.Events.get().sendError(l,n,i,l.message),[3,3];case 3:return[2]}})})}function v(t,e){C.Context.window.browsitag=Object.assign(C.Context.window.browsitag,{av:{scid:e.i.sc,pvid:e.i.pv,country:e.r.cc,device:e.dt.p,os:e.dt.os,browser:e.dt.b}})}function h(t,e){C.Context.window.browsitag.avCallback=function(n){"playerLoaded"===n?E.Events.get().sendVideoPlayerLoaded(e):"impression"===n&&D.default.dispatchDOMEvent("video_ad_impression",{inframeId:t},window)}}function y(t,e,n,i){var o=C.Context.document.createElement("script");o.async=!0,o.id="browsiJS",o.loaderParams=m({},t),o.src=e,o.onerror=function(t){E.Events.get().sendVideoOnLoad(i,!1),E.Events.get().sendError(t,n,i,"onerror "+e)},o.onload=function(){E.Events.get().sendVideoOnLoad(i,!0)};try{D.default.getHead(C.Context.document).appendChild(o)}catch(t){E.Events.get().sendError(t,n,i,"Failed injecting video script")}}var m=this&&this.__assign||function(){return m=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},m.apply(this,arguments)},_=this&&this.__awaiter||function(t,e,n,i){function o(t){return t instanceof n?t:new n(function(e){e(t)})}return new(n||(n=Promise))(function(n,r){function s(t){try{u(i.next(t))}catch(t){r(t)}}function a(t){try{u(i.throw(t))}catch(t){r(t)}}function u(t){t.done?n(t.value):o(t.value).then(s,a)}u((i=i.apply(t,e||[])).next())})},b=this&&this.__generator||function(t,e){function n(t){return function(e){return i([t,e])}}function i(n){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,r&&(s=2&n[0]?r.return:n[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,n[1])).done)return s;switch(r=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,r=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=e.call(t,u)}catch(t){n=[6,t],r=0}finally{o=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var o,r,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(e,"__esModule",{value:!0}),e.init=e.setIsNewUserVideoLoaderParam=void 0;var w,C=n(1),D=n(0),E=n(3),P=n(2),S=new P.Logger("VL-Service");e.setIsNewUserVideoLoaderParam=i,e.init=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TagType=void 0;!function(t){t[t.SHADOW=0]="SHADOW",t[t.LEAD=1]="LEAD"}(e.TagType||(e.TagType={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GetSupplyFlowResult=void 0;!function(t){t.SUPPLY_REQ_NO_CONTENT="204",t.BOOTSTRAP_LOADED_ERROR="bootstrap already loaded",t.UNEXPECTED_BOOTSTRAP_ON_PAGE="bootstrap already loaded unexpectedly",t.FLOW_ENDED_MANUALLY="flow ended manually"}(e.GetSupplyFlowResult||(e.GetSupplyFlowResult={}))},function(t,e,n){t.exports=n(9)},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},__assign.apply(this,arguments)},__awaiter=this&&this.__awaiter||function(t,e,n,i){function o(t){return t instanceof n?t:new n(function(e){e(t)})}return new(n||(n=Promise))(function(n,r){function s(t){try{u(i.next(t))}catch(t){r(t)}}function a(t){try{u(i.throw(t))}catch(t){r(t)}}function u(t){t.done?n(t.value):o(t.value).then(s,a)}u((i=i.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){function n(t){return function(e){return i([t,e])}}function i(n){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,r&&(s=2&n[0]?r.return:n[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,n[1])).done)return s;switch(r=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,r=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=e.call(t,u)}catch(t){n=[6,t],r=0}finally{o=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var o,r,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};Object.defineProperty(exports,"__esModule",{value:!0}),exports.mainApp=void 0;var Events_1=__webpack_require__(3),Utils_1=__webpack_require__(0),Logger_1=__webpack_require__(2),Output_1=__webpack_require__(4);__webpack_require__(10);var ConsentManager_1=__webpack_require__(11),Context_1=__webpack_require__(1),EngineDelayService_1=__webpack_require__(12),VideoLoaderService=__webpack_require__(5),ShadowLeadTag_1=__webpack_require__(13),VideoLoaderService_1=__webpack_require__(5),ShadowLeadTag_2=__webpack_require__(6),GetSupplyFlowResult_1=__webpack_require__(7),BIAgentService_1=__webpack_require__(14),AvgHighestBid_1=__webpack_require__(15),mainApp=function(){function mainApp(){this.tagData=Utils_1.default.getTagData(),this.initBrowsiTag(),this.startTime=this.getStartTime(),this.logger=new Logger_1.Logger("app"),this.listenToErrors(),this.debugConfiguration=Utils_1.default.getD(),this.staticData=this.buildStaticData(this.debugConfiguration.siteKey),Events_1.Events.get().setStaticData(this.staticData),this.consentManager=new ConsentManager_1.ConsentManager,this.timingData={}}return mainApp.prototype.getStartTime=function(){var t,e;return(null===(t=Context_1.Context.window.browsitag)||void 0===t?void 0:t.st)||(null===(e=this.tagData.pd)||void 0===e?void 0:e.t)||+new Date},mainApp.prototype.run=function(){var t=this;this.isInvalidMultiTagInjection()?Events_1.Events.get().sendInitialHit(this.staticData,this.startTime,this.getUserAgent(),this.findTagPosition(this.tagData.tag),!0):(this.setPubKeyOnPage(),Events_1.Events.get().sendInitialHit(this.staticData,this.startTime,this.getUserAgent(),this.findTagPosition(this.tagData.tag),!1),this.waitForPromise(function(){return t.getSupply()}))},mainApp.prototype.findTagPosition=function(t){for(var e=t,n=Context_1.Context.isIframe();e;)switch(e.tagName){case"HEAD":return n?"iframe.head":"head";case"BODY":return n?"iframe.body":"body";default:e=e.parentElement}return"NA"},mainApp.prototype.getSupply=function(){var t=this;return this.sendGetSupplyRequest().then(function(e){return t.processSupplyResponse(e)}).then(function(e){return t.sendBillableEvent(e)}).then(function(e){return t.processConditionalLayouts(e)}).then(function(e){return t.sendParamsToLiveConfigExtension(e)}).then(function(e){return t.mergeDebugOptions(e)}).then(function(e){return t.sendLayoutMatchedEvent(e)}).then(function(e){return t.handleShadowLeadTag(e)}).then(function(e){return t.runBootstrapDelay(e)}).then(function(e){return t.injectEngines(e)}).catch(function(e){if(e===GetSupplyFlowResult_1.GetSupplyFlowResult.SUPPLY_REQ_NO_CONTENT)return void t.logger.info("GetSupply flow result: ",e);if(e===GetSupplyFlowResult_1.GetSupplyFlowResult.FLOW_ENDED_MANUALLY)return t.logger.info("GetSupply flow result: ",e),void Context_1.Context.windowType.removeEventListener("error",t.errorListener);throw t.logger.error("Error in get supply",e),new ErrorEvent(e.toString())}).catch(function(e){var n="get supply: "+e.type;Events_1.Events.get().sendError(e,t.staticData,t.startTime,n)})},mainApp.prototype.initBrowsiTag=function(){var t,e,n,i,o,r,s,a,u,d;(t=Context_1.Context.window)[e="browsitag"]||(t[e]={}),(n=Context_1.Context.window.browsitag)[i="st"]||(n[i]=this.getStartTime()),(o=Context_1.Context.window.browsitag)[r="__ori"]||(o[r]=Utils_1.default.onReInject),(s=Context_1.Context.window.browsitag)[a="mt"]||(s[a]={}),(u=Context_1.Context.window.browsitag.mt)[d="ex"]||(u[d]=[])},mainApp.prototype.isConditionalLayoutMatched=function(t){var e;return(null===(e=t.lyd)||void 0===e?void 0:e.lys)&&t.ly},mainApp.prototype.processConditionalLayouts=function(t){var e=this;return new Promise(function(n,i){var o=Utils_1.default.mergeDeep(t.lyd,e.debugConfiguration.lyd||{});e.getSelectedLayout(o,t).then(function(e){return e?(t.ly=e,t.i.sc=e.id,n(t)):i("fail on conditional layout - no layout selected")}).catch(function(t){return i(t)})})},mainApp.prototype.errorIfBootstrapLoaded=function(){if(Utils_1.default.getIsBptLoaded())throw new Error(GetSupplyFlowResult_1.GetSupplyFlowResult.UNEXPECTED_BOOTSTRAP_ON_PAGE)},mainApp.prototype.handleShadowLeadTag=function(t){var e,n,i,o,r;return __awaiter(this,void 0,void 0,function(){var s,a;return __generator(this,function(u){switch(u.label){case 0:if(Utils_1.default.getIsBptLoaded())return[2,Promise.reject(GetSupplyFlowResult_1.GetSupplyFlowResult.BOOTSTRAP_LOADED_ERROR)];switch(this.shadowLeadHandler=t.si.sd?new ShadowLeadTag_1.ShadowLead(t.si.sd,t.i.pk):void 0,s=Date.now(),a=null===(e=this.shadowLeadHandler)||void 0===e?void 0:e.tagType){case ShadowLeadTag_2.TagType.LEAD:return[3,1];case ShadowLeadTag_2.TagType.SHADOW:return[3,3]}return[3,5];case 1:return[4,this.shadowLeadHandler.actAsLeadTag()];case 2:return u.sent(),[3,6];case 3:return[4,this.shadowLeadHandler.actAsShadowTag(t)];case 4:return u.sent(),[3,6];case 5:return[3,6];case 6:return null===(n=this.shadowLeadHandler)||void 0===n||n.recordTimeWaited(Date.now()-s),this.errorIfBootstrapLoaded(),Utils_1.default.setIsBptLoaded(!0),null===(i=this.shadowLeadHandler)||void 0===i||i.mergeSupplyConfigs(t),null===(o=this.shadowLeadHandler)||void 0===o||o.cleanMultiTagAPI(),null===(r=this.shadowLeadHandler)||void 0===r||r.sendSelectedPubEvent(this.startTime),[2,t]}})})},mainApp.prototype.getSelectedLayout=function(layoutsDataObject,loaderParams){return new Promise(function(resolve,reject){if(layoutsDataObject.ly)return resolve(layoutsDataObject.ly);try{var layoutFunction=eval("("+layoutsDataObject.js+")"),layoutFunctionResult=layoutFunction(loaderParams);if(!Utils_1.default.isPromise(layoutFunctionResult))return resolve(layoutsDataObject.lys[layoutFunctionResult]);layoutFunctionResult.then(function(t){return resolve(layoutsDataObject.lys[t])})}catch(t){return reject("fail on conditional layout evaluation "+t)}})},mainApp.prototype.mergeDebugOptions=function(t){var e=this;return new Promise(function(n,i){if(Utils_1.default.mergeDeep(t,e.debugConfiguration),Utils_1.default.isLiveConfigExtensionEnabled()){var o=Utils_1.default.getLiveConfig();Utils_1.default.mergeDeep(t,o)}Events_1.Events.get().setLoaderParams(t),n(t)})},mainApp.prototype.injectBrowsiLogger=function(t){var e=this;if(t.lp){var n=this.buildScriptTag(t.lp);n.id="browsiLogger",n.loaderParams=Object.assign(t,{tagPosition:this.findTagPosition(this.tagData.tag),yieldHost:this.tagData.y}),n.addEventListener("error",function(t){Events_1.Events.get().sendError(t,e.staticData,e.startTime,"script error_browsi logger_"+n.src)}),Utils_1.default.getHead(Context_1.Context.document).appendChild(n)}},mainApp.prototype.sendParamsToLiveConfigExtension=function(t){return new Promise(function(e,n){var i,o;return(i=window).__brw_lc||(i.__brw_lc={}),window.__brw_lc.bpt=!0,(o=window.__brw_lc).que||(o.que=[]),window.__brw_lc.que.push(function(){return Utils_1.default.dispatchDOMEvent("brw_lc_ux",{data:t.sec.ux},Context_1.Context.window)}),e(t)})},mainApp.prototype.sendLayoutMatchedEvent=function(t){var e=this;return new Promise(function(n,i){return e.isConditionalLayoutMatched(t)&&Events_1.Events.get().sendLayoutMatchedEvent(e.startTime),n(t)})},mainApp.prototype.sendBillableEvent=function(t){return new Promise(function(e,n){var i;return"bootstrap_pageview"===(null===(i=t.si)||void 0===i?void 0:i.be)&&Context_1.Context.window.dispatchEvent(new CustomEvent("browsi_pageview",{})),e(t)})},mainApp.prototype.runBootstrapDelay=function(t){var e=this;return new Promise(function(n,i){var o;try{if(!t.ly.bptd)return n(t);var r=t.dt.p,s=t.ly.bptd;new EngineDelayService_1.EngineDelayService({device:r,delayConfig:s},null===(o=e.shadowLeadHandler)||void 0===o?void 0:o.timeWaited).delayEngineByConfig().then(function(){return n(t)})}catch(t){i("delay error "+t.msg||"")}})},mainApp.prototype.waitForPromise=function(t){var e=this;if(Context_1.Context.window.Promise)t();else{this.logger.info("fetching Promise polyfill");var n=this.buildScriptTag("//cdn.browsiprod.com/tag/promise.js");n.onload=function(){t()},n.addEventListener("error",function(t){Events_1.Events.get().sendError(t,e.staticData,e.startTime,"script error_polyfill")}),Utils_1.default.getHead(Context_1.Context.document).appendChild(n)}},mainApp.prototype.executeRule=function(t){var e=this;Context_1.Context.window.__browsiLoadFunc=this.getMiddy.bind(this),Context_1.Context.window.__browsiLoadObject=t;var n=this.buildScriptTag(t.js);this.setTiming("rul"),n.addEventListener("load",function(){e.setTiming("rul")}),n.addEventListener("error",function(t){Events_1.Events.get().sendError(t,e.staticData,e.startTime,"script error_rules_"+n.src)}),Utils_1.default.getHead(Context_1.Context.document).appendChild(n)},mainApp.prototype.buildLoader=function(t){var e=t&&t.i&&t.i.s,n=t&&t.i&&t.i.u;t&&(t.i&&(t.i.sk=t.i.sk||this.tagData.sk,t=Object.assign({},t,{bpvi:this.staticData.pvid,yhn:this.tagData.y,rmd:this.extractRTDModuleData(),to:this.startTime})),t=Object.assign({},t,{h:t.e&&t.e.h,version:t.e&&t.e.v}),t.td=this.timingData),Utils_1.default.setCookie("__browsiSessionID",e,30,"m"),Utils_1.default.setCookie("__browsiUID",n,365,"d"),Utils_1.default.setLocalStorage("__browsiUID",n);var i={sid:e,uid:n};return Utils_1.default.setLocalStorage("__brtd",JSON.stringify(i)),t},mainApp.prototype.setPubKeyOnPage=function(){var t,e,n=null===(e=null===(t=Context_1.Context.window.browsitag)||void 0===t?void 0:t.mt)||void 0===e?void 0:e.ex,i=this.tagData.pk;null===n||void 0===n||n.push(i)},mainApp.prototype.isInvalidMultiTagInjection=function(){var t,e,n=null===(e=null===(t=Context_1.Context.window.browsitag)||void 0===t?void 0:t.mt)||void 0===e?void 0:e.ex,i=this.tagData.pk;return Utils_1.default.getIsBptLoaded()||(null===n||void 0===n?void 0:n.includes(i))},mainApp.prototype.sendGetSupplyRequest=function(){if("error"===this.staticData.sk)return Promise.reject("no site key");this.handleSpecialUsersSession();var t=this.buildGetSupplyUrl();return Utils_1.default.isD()&&Output_1.Output.setKeyValues({supplyRequest:t}),this.setTiming("s"),this.logger.info("getSupply sent"),Utils_1.default.xhrPromise(t)},mainApp.prototype.handleSpecialUsersSession=function(){var t=this.getUserAgent(),e=Utils_1.default.getLocalStorage("__brw_ua"),n=!e;n||t===e||(this.logger.custom("revoking session","background: orange; color: black; font-weight: bold; font-size: 18px;"),Utils_1.default.setCookie("__browsiSessionID"),this.staticData.sid="",Utils_1.default.setLocalStorage("__brw_ua",t)),n&&Utils_1.default.setLocalStorage("__brw_ua",t)},mainApp.prototype.processSupplyResponse=function(t){var e=this;return new Promise(function(n,i){if(Utils_1.default.isD()&&Output_1.Output.setKeyValues({supplyLoaded:!0}),204===t.status)e.logger.info("Supply response is empty (204)"),i(GetSupplyFlowResult_1.GetSupplyFlowResult.SUPPLY_REQ_NO_CONTENT);else if(200===t.status){var o=JSON.parse(t.responseText);if(o&&!o.error){e.setTiming("s"),Utils_1.default.isD()&&Output_1.Output.setKeyValues({supplyResponse:o});var r=e.buildLoader(o);e.staticData.pvid=r.i.pv,Utils_1.default.setStoredPvid(r.i.pv),n(r)}else i(-1)}else i(t.status)})},mainApp.prototype.buildScriptTag=function(t){var e=this,n=Context_1.Context.document.createElement("script");return n.src=t,n.async=!0,n.setAttribute("crossorigin","anonymous"),n.onerror=function(n){Events_1.Events.get().sendError(n,e.staticData,e.startTime,"onerror "+t)},n},mainApp.prototype.injectBIAgent=function(t){var e=this;this.logger.info("Injecting BI Agent script");var n=BIAgentService_1.getBIAgentLoaderParams(t);Context_1.Context.window._brw_bia=n;var i=BIAgentService_1.getBIAgentUrl(t),o=this.buildScriptTag(i);o.addEventListener("error",function(t){Events_1.Events.get().sendError(t,e.staticData,e.startTime,"script error_BIAgent script_"+i)});try{Utils_1.default.getHead(Context_1.Context.document).appendChild(o)}catch(t){Events_1.Events.get().sendError(t,this.staticData,this.startTime,"catch; "+i+" bodyExists: "+!!Context_1.Context.document.body)}},mainApp.prototype.getMiddy=function(t,e){var n=this;this.setTiming("mdy"),e&&"function"==typeof e.preEngineJS&&(t.externalFlowHandler={preEngine:e.preEngineJS}),Context_1.Context.window._middyo=t;var i=this.buildMiddyUrl(t),o=this.buildScriptTag(i);o.addEventListener("load",function(){n.setTiming("mdy")}),o.addEventListener("error",function(t){Events_1.Events.get().sendError(t,n.staticData,n.startTime,"script error_middy script_"+i)});try{Utils_1.default.getHead(Context_1.Context.document).appendChild(o)}catch(t){Events_1.Events.get().sendError(t,this.staticData,this.startTime,"catch; "+i+" bodyExists: "+!!Context_1.Context.document.body)}},mainApp.prototype.buildMiddyUrl=function(t){return this.debugConfiguration.middyHost?this.debugConfiguration.middyHost:"//"+(this.debugConfiguration.h||t.si.h)+"/sd/apps/middy/middy-"+(this.debugConfiguration.version||t.ses.v)+".js"},mainApp.prototype.getWeightedAvg=function(t,e,n,i){var o=e+i;return o>0?parseFloat(((t*e+n*i)/o).toFixed(2)):0},mainApp.prototype.getAvgOof=function(){var t=JSON.parse(Utils_1.default.getLocalStorage("__bus")||"{}");if(t.aof){var e=0,n=0,i=t.aof.sd;for(var o in i)i.hasOwnProperty(o)&&(i[o].arb?n++:i[o].ar&&e++);var r=n/(n+e)||0,s=e+n;return this.getWeightedAvg(t.aof.t_a||0,t.aof.t_i||0,r||0,s)}},mainApp.prototype.getQueryParams=function(){var t=[],e=/^(?:\?)(.*)/.exec(Context_1.Context.window.location.search);if(2===(null===e||void 0===e?void 0:e.length)){var n=e[1].split(/&/);t=n.splice(0,Math.min(n.length,10))}return t},mainApp.prototype.buildGetSupplyUrl=function(){return"//"+this.tagData.y+"/supply/v5?"+Utils_1.default.toUrlParams(this.getSupplyParams())},mainApp.prototype.getSupplyParams=function(){var t=Context_1.Context.window.screen,e={sk:this.staticData.sk,pk:this.staticData.pk,url:this.staticData.url,bid:this.staticData.bpvid,at:Context_1.Context.document.title||null,sw:(null===t||void 0===t?void 0:t.width)||-1,sh:(null===t||void 0===t?void 0:t.height)||-1},n=this.getQueryParams();n.length&&(e.qp=n.join("&"));var i=JSON.parse(Utils_1.default.getLocalStorage("__bus")||"{}");if(Object.keys(i).length>0){var o={bi:i.bi,bv:i.bv,pi:i.pi,pv:i.pv,b_ativ:i.tiv?this.getWeightedAvg(i.tiv.b_ativ||0,i.tiv.b_ai||0,i.tiv.b_pv_ativ||0,i.tiv.b_pv_ai||0):void 0,uva:i.uv?this.getWeightedAvg(i.uv.t_a||0,i.uv.t_i||0,i.uv.pv_a||0,i.uv.pv_i||0):void 0,uvsp:i.uv?this.getWeightedAvg(i.uv.t_sp||0,i.uv.t_si||0,i.uv.pv_sp||0,i.uv.pv_si||0):void 0,oofu:this.getAvgOof()};Object.keys(o).forEach(function(t){return void 0===o[t]?delete o[t]:""}),e.us=o}if(this.staticData.sid&&(e.sid=this.staticData.sid),Context_1.Context.document.referrer&&(e.r=Context_1.Context.document.referrer),this.staticData.uid&&(e.uid=this.staticData.uid),this.tagData.fp)this.logger.info("bootstrap was injected by prebid"),e.rp=!1;else{var r=AvgHighestBid_1.getHighestBidMetrics(i)||{},s=r.uahb,a=r.rahb,u=r.lahb,d=r.lbsa;e.ga=__assign(__assign(__assign(__assign({t:Date.now(),eu:Utils_1.default.isEngagingUser()},s?{uahb:s}:{}),a?{rahb:a}:{}),u?{lahb:u}:{}),d?{lbsa:d}:{})}Utils_1.default.isD()&&Output_1.Output.setKeyValues({supplyParams:e});var l=Utils_1.default.getStoredPvid();l&&(e.pvid=l);var c=Utils_1.default.getMetaDataLanguage();return c&&(e.l=c),e},mainApp.prototype.getPageViewId=function(t){var e=t||Utils_1.default.getStoredPvid()||Utils_1.default.generateUUIDIfSupported();return Utils_1.default.setStoredPvid(e),e},mainApp.prototype.buildStaticData=function(t){var e,n=this.getPageViewId(null===(e=this.tagData.pd)||void 0===e?void 0:e.pvid),i=Utils_1.default.getStoredBpvid();i||(i=Utils_1.default.generateToken(),Utils_1.default.setStoredBpvid(i));var o=Context_1.Context.document.location,r=Utils_1.default.getLocalStorage("__browsiUID")||Utils_1.default.getCookie("__browsiUID");return VideoLoaderService_1.setIsNewUserVideoLoaderParam(!r),{to:+new Date-this.startTime,sk:t||this.tagData.sk,pk:this.tagData.pk,pvid:n||"",bpvid:i,url:o.protocol+"//"+o.host+o.pathname,sid:Utils_1.default.getCookie("__browsiSessionID"),uid:r,mv:"3.6.331"}},mainApp.prototype.listenToErrors=function(){var t=this;this.errorListener=function(e){var n=(null===e||void 0===e?void 0:e.target)&&e.target.src&&"SCRIPT"===e.target.tagName?e.target.src:"";(/.*browsiprod.*/.test(e.filename)||/.*browsiprod.*/.test(n))&&Events_1.Events.get().sendError(e,t.staticData,t.startTime,n+","+e.filename)},Context_1.Context.windowType.addEventListener("error",this.errorListener,!0),this.logger.info("listening to errors")},mainApp.prototype.getUserAgent=function(){var t;return(null===(t=Context_1.Context.window.navigator)||void 0===t?void 0:t.userAgent)||""},mainApp.prototype.setTiming=function(t){this.timingData[t]?this.timingData[t]=Number((Date.now()-this.timingData[t]).toFixed(2)):this.timingData[t]=Date.now()},mainApp.prototype.extractRTDModuleData=function(){return this.buildLegacyRTDModuleData()||this.tagData.pd||{}},mainApp.prototype.buildLegacyRTDModuleData=function(){var t,e;if(null===(t=this.tagData.pd)||void 0===t?void 0:t.p){var n=Object.entries(this.tagData.pd.p).reduce(function(t,e){var n=e[0],i=e[1];return t[n]=__assign({},i.ps),t},{});return{kn:(null===(e=this.tagData.pd)||void 0===e?void 0:e.kn)||"",p:n}}},mainApp.prototype.injectVideoLoader=function(t){var e=this,n=e.staticData,i=e.startTime;VideoLoaderService.init({loaderParams:t,staticData:n,startTime:i})},mainApp.prototype.injectDisplayEngine=function(t){this.logger.info("Injecting Display script");try{t.js&&"string"==typeof t.js?this.executeRule(t):this.getMiddy(t)}catch(t){this.logger.error(t),Events_1.Events.get().sendError(t,this.staticData,this.startTime,"Display engine injection error")}},mainApp.prototype.injectEngines=function(t){var e;this.injectVideoLoader(t),this.injectBrowsiLogger(t),(null===(e=t.ly.inf)||void 0===e?void 0:e.ad)||this.injectDisplayEngine(t),t.bbi&&this.injectBIAgent(t)},mainApp}();exports.mainApp=mainApp,(new mainApp).run()},function(t,e){Array.prototype.filter||(Array.prototype.filter=function(t){"use strict";if(void 0===this||null===this)throw new TypeError;var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var i=[],o=arguments.length>=2?arguments[1]:void 0,r=0;r<n;r++)if(r in e){var s=e[r];t.call(o,s,r,e)&&i.push(s)}return i}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],o=0;o<n;){var r=e[o];if(t.call(i,r,o,e))return r;o++}}}),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){"use strict";if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(t),i=1;i<arguments.length;i++){var o=arguments[i];if(null!=o)for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])}return n},writable:!0,configurable:!0}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),i=n.length>>>0;if(0===i)return!1;for(var o=0|e,r=Math.max(o>=0?o:i-Math.abs(o),0);r<i;){if(function(t,e){return t===e||"number"==typeof t&&"number"==typeof e&&isNaN(t)&&isNaN(e)}(n[r],t))return!0;r++}return!1}})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConsentManager=void 0;var i=n(2),o=n(1),r=n(0),s=function(){function t(){var t=this;this.checkConsentInterval=1e3,this.checkConsentTimeout=1e4,this.gdprTracker={isConsent:!1,interval:-1},this.ccpaTracker={isConsent:!0,interval:-1},this.logger=new i.Logger("ConsentManager");var e={gdpr:function(){return t.getGDPRConsent()},ccpa:function(){return t.getCCPAConsent()}};o.Context.window.browsitag=Object.assign(o.Context.window.browsitag||{},{__cs:e}),this.checkConsentStatus()}return t.prototype.checkConsentStatus=function(){var t=this,e=[["getVendorConsents",null,this.setGDPRConsentCmp.bind(this)]],n=[["getTCData",2,this.setGDPRConsentTcf.bind(this)],["addEventListener",2,this.setGDPRConsentTcf.bind(this)]];this.gdprTracker.interval=setInterval(function(){t.initializeApi("__tcfapi",t.gdprTracker,n),t.initializeApi("__cmp",t.gdprTracker,e)},this.checkConsentInterval),this.initializeApi("__tcfapi",this.gdprTracker,n),this.initializeApi("__cmp",this.gdprTracker,e),setTimeout(function(){clearInterval(t.gdprTracker.interval)},this.checkConsentTimeout),this.checkUsapiConsent()},t.prototype.checkUsapiConsent=function(){var t=[["getUSPData",1,this.setCCPAConsent.bind(this)]];this.initializeApi("__uspapi",this.ccpaTracker,t)},t.prototype.initializeApi=function(t,e,n){var i=o.Context.topMostWindow[t];if(!i||"function"!=typeof i)return void this.logger.verbose("function "+t+" wasn't found");try{clearInterval(e.interval),this.logger.verbose("Found "+t+" function, invoking it..."),n.forEach(function(t){i.apply(void 0,t)})}catch(e){this.logger.error("Error running "+t+" function",e)}},t.prototype.setGDPRConsentCmp=function(t,e){if(e&&t){if("boolean"==typeof t.gdprApplies&&t.gdprApplies){if(!t.metadata)return;if(t.purposeConsents&&!t.purposeConsents[1])return}this.logger.verbose("User has given consent (GDPR CMP)"),this.setGdprConsentValue(!0)}else this.logger.error("Error in __cmp response")},t.prototype.setGDPRConsentTcf=function(t,e){var n,i=this;if(e&&t){if("boolean"==typeof t.gdprApplies&&t.gdprApplies&&(null===(n=t.purpose)||void 0===n?void 0:n.consents)&&!t.purpose.consents[1])return;this.logger.verbose("User has given consent (GDPR TCF)"),this.setGdprConsentValue(!0),o.Context.topMostWindow.__tcfapi("removeEventListener",2,function(e){e&&i.logger.verbose("remove __tcfapi listener",t.listenerId)},t.listenerId)}else this.logger.error("Error in __tcfapi response")},t.prototype.setCCPAConsent=function(t,e){if(e&&t){var n=t.uspString;return 4===(null===n||void 0===n?void 0:n.length)&&"Y"===n.charAt(2)?(this.logger.verbose("User has opted out consent (CCPA)"),this.setCcpConsentValue(!1)):this.setCcpConsentValue(!0)}this.logger.error("Error in __uspapi response")},t.prototype.getGDPRConsent=function(){var t=this.getLocalStorageConsent().gdpr;return void 0!==t?t:this.gdprTracker.isConsent},t.prototype.getCCPAConsent=function(){this.checkUsapiConsent();var t=this.getLocalStorageConsent().ccpa;return void 0!==t?t:this.ccpaTracker.isConsent},t.prototype.setLocalStorageConsent=function(t){var e=Object.assign(this.getLocalStorageConsent(),t);r.default.setLocalStorage("__broesiUc",JSON.stringify(e))},t.prototype.getLocalStorageConsent=function(){var t=r.default.getLocalStorage("__broesiUc");return t?JSON.parse(t):{}},t.prototype.setCcpConsentValue=function(t){this.ccpaTracker.isConsent=t,this.setLocalStorageConsent({ccpa:t})},t.prototype.setGdprConsentValue=function(t){this.gdprTracker.isConsent=t,this.setLocalStorageConsent({gdpr:t})},t}();e.ConsentManager=s},function(t,e,n){"use strict";var i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.EngineDelayService=void 0;var o=n(2),r=function(){function t(t,e){this.readyStateMap={interactive:"DOMContentLoaded",complete:"load"},this.loaderObject=t,this.userEngagementEventsNames=["scroll"],this.userEngagementEventsNames.push("MOBILE"===this.loaderObject.device?"touchstart":"mousedown"),this.logger=new o.Logger("EngineDelay"),this.listenerEvents={},this.delayPromises=[],this.engineDelayTimeoutId=0,this.timeoutToDeduct=e||0}return t.prototype.delayEngineByConfig=function(){var t=this;return this.initDelays(),Promise.race(this.delayPromises).then(function(){t.clearAllDelays()})},t.prototype.initDelays=function(){var t=this.loaderObject.delayConfig,e=t.tod,n=t.rsd,o=t.ued,r=e?Math.max(1e3*e-this.timeoutToDeduct,0)/1e3:void 0,s=i(i(i({},r?{timeoutDelay:r}:{}),n?{readyState:n}:{}),o?{shouldWaitForUserEngagement:o}:{});this.logger.verbose("Engine delay triggers: ",s),r&&this.delayPromises.push(this.setEngineDelayTimeout(r));var a=this.readyStateMap[n]||"";a&&this.delayPromises.push(this.setReadyStateDelay(n,a)),o&&this.delayPromises.push(this.setUserEngagementDelay())},t.prototype.setEngineDelayTimeout=function(t){var e=this;return new Promise(function(n){e.engineDelayTimeoutId=setTimeout(function(){e.logger.verbose("timeout triggered engine"),n()},1e3*t)})},t.prototype.setReadyStateDelay=function(t,e){var n=this;return new Promise(function(i){var o=function(){n.logger.verbose("readyState triggered engine"),i()};if(n.listenerEvents[e]=o,document.readyState===t||"complete"===document.readyState)return o();document.addEventListener(e,o),window.addEventListener(e,o)})},t.prototype.setUserEngagementDelay=function(){var t=this;return new Promise(function(e){var n=function(){t.logger.verbose("User engagement triggered engine"),e()};if(window.pageYOffset>0)return void n();t.userEngagementEventsNames.forEach(function(e){t.listenerEvents[e]=n,document.addEventListener(e,n,{once:!0})})})},t.prototype.clearAllDelays=function(){var t=this;clearTimeout(this.engineDelayTimeoutId),Object.keys(this.listenerEvents).forEach(function(e){window.removeEventListener(e,t.listenerEvents[e])})},t}();e.EngineDelayService=r},function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){function o(t){return t instanceof n?t:new n(function(e){e(t)})}return new(n||(n=Promise))(function(n,r){function s(t){try{u(i.next(t))}catch(t){r(t)}}function a(t){try{u(i.throw(t))}catch(t){r(t)}}function u(t){t.done?n(t.value):o(t.value).then(s,a)}u((i=i.apply(t,e||[])).next())})},o=this&&this.__generator||function(t,e){function n(t){return function(e){return i([t,e])}}function i(n){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,r&&(s=2&n[0]?r.return:n[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,n[1])).done)return s;switch(r=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,r=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=e.call(t,u)}catch(t){n=[6,t],r=0}finally{o=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var o,r,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a},r=this&&this.__spreadArray||function(t,e){for(var n=0,i=e.length,o=t.length;n<i;n++,o++)t[o]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.ShadowLead=void 0;var s=n(1),a=n(6),u=n(7),d=n(3),l=n(2),c=function(){function t(t,e){this.multiTagAPI=s.Context.window.browsitag.mt,this.timeoutId=null,this._tagType=t.ty,this.timeoutConfigured=t.t,this.timeWaited=0,this.logger=new l.Logger(this._tagType===a.TagType.LEAD?"Lead tag - "+e:"Shadow tag - "+e)}return Object.defineProperty(t.prototype,"tagType",{get:function(){return this._tagType},enumerable:!1,configurable:!0}),t.prototype.recordTimeWaited=function(t){this.timeWaited||(this.timeWaited=t)},t.prototype.generateTimeoutPromise=function(){var t=this;return new Promise(function(e){t.timeoutId=setTimeout(function(){t.logger.info("Timeout ended! this tag proceeds as Lead tag"),e()},t.timeoutConfigured)})},t.prototype.cleanMultiTagAPI=function(){delete this.multiTagAPI.sr,delete this.multiTagAPI.lr,delete this.multiTagAPI.sd},t.prototype.mergeSupplyConfigs=function(t){var e;if(this.tagType===a.TagType.LEAD&&this.multiTagAPI.sd){var n=this.multiTagAPI.sd;t.spub={scid:n.scid,pk:n.pk,sk:n.sk};var i=null===(e=t.ly.in)||void 0===e?void 0:e.ds,o=n.ds;if((null===i||void 0===i?void 0:i.length)&&(null===o||void 0===o?void 0:o.length)){var s={};r(r([],i),o).forEach(function(t){s[t.w+"x"+t.h]=t}),t.ly.in.ds=Object.values(s)}}},t.prototype.waitForShadowGetSupply=function(){return i(this,void 0,void 0,function(){var t,e,n=this;return o(this,function(i){return this.logger.info("Waiting for shadow tag get supply"),t=new Promise(function(t){n.multiTagAPI.lr=function(){n.logger.info("Shadow tag signaled it got supply"),n.timeoutId&&clearTimeout(n.timeoutId),t()}}),e=this.generateTimeoutPromise(),[2,Promise.race([e,t])]})})},t.prototype.actAsLeadTag=function(){return i(this,void 0,void 0,function(){return o(this,function(t){return this.logger.info("Init lead tag flow"),"function"==typeof this.multiTagAPI.sr&&this.multiTagAPI.sd?(this.multiTagAPI.sr(),this.logger.info("Signaling a shadow tag to end its flow"),[2]):[2,this.waitForShadowGetSupply()]})})},t.prototype.exposeShadowTagConfig=function(t){var e,n,i,o,r;this.logger.info("Expose shadow tag data on page"),this.multiTagAPI.sd={scid:null===(e=t.i)||void 0===e?void 0:e.sc,sk:null===(n=t.i)||void 0===n?void 0:n.sk,pk:null===(i=t.i)||void 0===i?void 0:i.pk,ds:(null===(r=null===(o=t.ly)||void 0===o?void 0:o.in)||void 0===r?void 0:r.ds)||[]}},t.prototype.waitForLeadGetSupply=function(){var t=this;this.logger.info("Waiting for lead tag get supply");var e=new Promise(function(e,n){t.multiTagAPI.sr=function(){t.timeoutId&&clearTimeout(t.timeoutId),n(u.GetSupplyFlowResult.FLOW_ENDED_MANUALLY),t.logger.info("Lead tag signaled it got supply")}}),n=this.generateTimeoutPromise();return Promise.race([n,e])},t.prototype.actAsShadowTag=function(t){return i(this,void 0,void 0,function(){return o(this,function(e){return this.logger.info("Init shadow tag flow"),this.exposeShadowTagConfig(t),this.multiTagAPI.lr&&"function"==typeof this.multiTagAPI.lr?(this.multiTagAPI.lr(),this.logger.info("BPT flow ended manually"),[2,Promise.reject(u.GetSupplyFlowResult.FLOW_ENDED_MANUALLY)]):[2,this.waitForLeadGetSupply()]})})},t.prototype.sendSelectedPubEvent=function(t){d.Events.get().sendSelectedPubEvent(t)},t}();e.ShadowLead=c},function(t,e,n){"use strict";function i(t){var e,n,i=r.default.getBIAgentDebugConfig();return i.agentHost?i.agentHost:"//"+(i.h||(null===(e=t.si)||void 0===e?void 0:e.h))+"/sd/apps/bi-agent/bi-agent-"+(i.version||(null===(n=t.bbi)||void 0===n?void 0:n.v))+".js"}function o(t){var e,n,i,o,r,s,a;return{v:null===(e=t.bbi)||void 0===e?void 0:e.v,s:null===(n=t.bbi)||void 0===n?void 0:n.s,b:null===(i=t.bbi)||void 0===i?void 0:i.b,dp:null===(o=t.dt)||void 0===o?void 0:o.p,aid:null===(r=t.i)||void 0===r?void 0:r.aid,es:null===(s=t.r)||void 0===s?void 0:s.es,mc:null===(a=t.sec)||void 0===a?void 0:a.mc}}Object.defineProperty(e,"__esModule",{value:!0}),e.getBIAgentLoaderParams=e.getBIAgentUrl=void 0;var r=n(0);e.getBIAgentUrl=i,e.getBIAgentLoaderParams=o},function(t,e,n){"use strict";function i(t){var e,n,i,r;if(a.default.isObjectDefined(t)){var u=a.default.isObjectDefined(t.uahb)?t.uahb:void 0,d=s(t.lahb),l=o(t.rahb);return{uahb:(null===u||void 0===u?void 0:u.avg)&&Number(null===(e=null===u||void 0===u?void 0:u.avg)||void 0===e?void 0:e.toFixed(3)),rahb:(null===l||void 0===l?void 0:l.avg)&&Number(null===(n=null===l||void 0===l?void 0:l.avg)||void 0===n?void 0:n.toFixed(3)),lahb:(null===d||void 0===d?void 0:d.avg)&&Number(null===(i=null===d||void 0===d?void 0:d.avg)||void 0===i?void 0:i.toFixed(3)),lbsa:(null===d||void 0===d?void 0:d.age)&&Number(null===(r=null===d||void 0===d?void 0:d.age)||void 0===r?void 0:r.toFixed(3))}}}function o(t){var e=r(t)||{};if(a.default.isObjectDefined(e)){var n=Object.keys(e).reduce(function(t,n){var i=parseInt(n);return t.sum+=e[i].sum,t.smp+=e[i].smp,t},{sum:0,smp:0});return{avg:n.sum/n.smp,smp:n.smp}}}function r(t){if(a.default.isObjectDefined(t)){var e=a.default.getTimestamp()-7*a.default.millisecondsPerDay;return Object.keys(t).forEach(function(n){var i=parseInt(n);i<e&&delete t[i]}),t}}function s(t){if(a.default.isObjectDefined(t))return{avg:t.avg,smp:t.smp,age:a.default.getDaysDifference(a.default.getTimestamp(),t.time)}}Object.defineProperty(e,"__esModule",{value:!0}),e.getLatestAvgHighestBid=e.getRecentAvgBidByTimestamp=e.getRecentAvgHighestBid=e.getHighestBidMetrics=void 0;var a=n(0);e.getHighestBidMetrics=i,e.getRecentAvgHighestBid=o,e.getRecentAvgBidByTimestamp=r,e.getLatestAvgHighestBid=s}])}]);