/*! amazon-dtb-javascript-api - apstag - v7.24.00 - 2019-01-09 17:25:26 */ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=14)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.shouldSample=function(e){try{var t=parseInt(e,10);if(!isNaN(t)){if(t<=0)return!1;if(t>=100)return!0;if(100*Math.random()<=t)return!0}return!1}catch(e){return!1}},t.getRandomArrayElement=function(e){return i(e)[0]},t.shuffleArray=i,t.getRand=function(){return""+Math.round(1e12*Math.random())+Date.now()},t.isObject=a,t.isArray=s,t.safeObjectHasProp=c,t.hasLocalStorage=d,t.checkAllPossibleBidCacheIds=function(e,t,r){return e.amzniid===t||e[r+"amzniid"]===t||e.amzniid_sp===t},t.inArray=u,t.isDebugEnabled=function(e){return u(l(),e)},t.setDebugMode=function(e,t){if(!d())return!1;var r=l();return t&&-1===r.indexOf(e)?r.push(e):t||(r=r.filter(function(t){return t!==e})),0===r.length?window.localStorage.removeItem(o.DEBUG_LOCAL_STORAGE_KEY):window.localStorage.setItem(o.DEBUG_LOCAL_STORAGE_KEY,JSON.stringify(r)),!0},t.getDebugValue=function(e){return"undefined"!=typeof window&&c(window,o.DEBUG_GLOBAL)&&c(window[o.DEBUG_GLOBAL],e)?window[o.DEBUG_GLOBAL][e]:""};var o=r(1);function i(e){var t=e.length,r=void 0,n=void 0;for(e=[].concat(function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t=5});default:return n({},e)}}(e.config,t),displayAdServer:function(){var e=arguments.length<=0||void 0===arguments[0]?{noBidSlotIDs:[]}:arguments[0],t=arguments[1];switch(t.type){case"SLOT_RENDER_ENDED_SET":return n({},e,{slotRenderEndedSet:!0});case"NO_BID_ON_ADSERVER_SLOTS":return n({},e,{noBidSlotIDs:e.noBidSlotIDs.concat(t.slotIDs)});case"REQUESTED_BID_FOR_ADSERVER_SLOTS":return n({},e,{noBidSlotIDs:e.noBidSlotIDs.filter(function(e){return!(0,i.inArray)(t.slotIDs,e)})});default:return n({},e,{noBidSlotIDs:[].concat(s(e.noBidSlotIDs))})}}(e.displayAdServer,t),eventLog:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1];switch(t.type){case"LOG_EVENT":return[].concat(s(e),[n({},t.event)]);default:return[].concat(s(e))}}(e.eventLog,t),experiments:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];switch(t.type){case"SHOULD_CHUNK_REQUESTS":return n({chunkRequests:!0===e.shouldSampleLatency&&t.value},e);case"SHOULD_SAMPLE_LATENCY":return n({},e,{shouldSampleLatency:t.value});default:return n({},e)}}(e.experiments,t),gdpr:function(){var e=arguments.length<=0||void 0===arguments[0]?null:arguments[0],t=arguments[1];switch(t.type){case"SET_GDPR_CONFIG":return null===t.config?null:n({},t.config);default:return null===e?e:n({},e)}}(e.gdpr,t),gdprQue:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1];switch(t.type){case"ADD_GDPR_QUE_ITEM":return[].concat(s(e),[t.func]);case"CLEAR_GDPR_QUE":return[];default:return[].concat(s(e))}}(e.gdprQue,t),Q:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1];switch(t.type){case"SET_Q":return[].concat(s(t.Q));default:return[].concat(s(e))}}(e.Q,t),slotBids:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];switch(t.type){case"BID_STATE_CHANGE":return n({},e,a({},t.slotID,e[t.slotID].map(function(e){var r={};return(0,i.checkAllPossibleBidCacheIds)(e,t.bidID,t.dealId)&&(r.bidState=t.bidState,t.bidState===o.BID_STATES.rendered?r.renderTime=t.ts:t.bidState===o.BID_STATES.set&&(r.setAtTimes=(0,i.safeObjectHasProp)(e,"setAtTimes")?[].concat(s(e.setAtTimes),[t.ts]):[t.ts])),n({},e,r)})));case"UPDATE_BID_INFO_PROP":return void 0===e[t.slotID]||e[t.slotID].filter(function(e){return(0,i.checkAllPossibleBidCacheIds)(e,t.iid,t.dealId)}).length<1?n({},e):n({},e,a({},t.slotID,e[t.slotID].map(function(e){return e=n({},e),(0,i.checkAllPossibleBidCacheIds)(e,t.iid,t.dealId)&&(e[t.key]=t.value),e})));case"UPDATE_SLOT_BIDS":return n({},e,t.bids.reduce(function(t,r){return(0,i.safeObjectHasProp)(t,r.slotID)?t[r.slotID]=[].concat(s(t[r.slotID]),[n({},r)]):(0,i.safeObjectHasProp)(e,r.slotID)?t[r.slotID]=[].concat(s(e[r.slotID]),[n({},r)]):t[r.slotID]=[n({},r)],t},{}));default:return n({},e)}}(e.slotBids,t),sync917:function(){var e=!(arguments.length<=0||void 0===arguments[0])&&arguments[0],t=arguments[1];switch(t.type){case"SET_SYNC_917":return t.value;default:return e}}(e.sync917,t),targetingKeys:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];switch(t.type){case"UPDATE_SLOT_BIDS":return n({},e,t.bids.reduce(function(t,r){return(0,i.safeObjectHasProp)(e,r.slotID)?t[r.slotID]=[].concat(s(e[r.slotID]),s((r.targeting?r.targeting:o.DISPLAY_TARGETING_KEYS).filter(function(t){return-1===e[r.slotID].indexOf(t)}))):t[r.slotID]=r.targeting?r.targeting:o.DISPLAY_TARGETING_KEYS,t},{}));default:return n({},e)}}(e.targetingKeys,t),tests:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];switch(t.type){case"UPDATE_TEST":return n({},e,a({},t.id,{name:t.name,status:t.status,case:t.case}));default:return n({},e)}}(e.tests,t)}}var l={getState:function(){return c},dispatch:function(e){c=u(c,e),d.forEach(function(e){return e()})},subscribe:function(e){d.push(e)}};(0,i.isDebugEnabled)("redux")&&(0,i.hasLocalStorage)()&&(0,i.safeObjectHasProp)(window,"__REDUX_DEVTOOLS_EXTENSION__")&&(t.store=l=window.__REDUX_DEVTOOLS_EXTENSION__(u)),l.dispatch({type:"NOOP"}),t.store=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pixels=t.pixelQueue=void 0,t.noBidCacheIdPixel=function(e){return u(d()+"p/PH/"+c(e))},t.bidCacheIdPixel=function(e,t){return u(""+d()+e+"/"+c(t))},t.sendPixels=function(){a||(a=!0,i.forEach(u))},t.resetSendPixels=function(){a=!1,t.pixels=s=[],t.pixelQueue=i=[]};var n=r(1),o=r(2),i=t.pixelQueue=[],a=!1,s=t.pixels=[];function c(e){e._tl="aps-tag";var t=JSON.stringify(e);return t=t.replace(/\\.{1}/g,""),encodeURIComponent(t)}function d(){var e=o.store.getState().cfg,t=e.DEFAULT_AAX_HOST,r=e.PIXEL_PATH;return""+n.PROTOCOL+t+r}function u(e){if(a){var t=new Image;return t.src=e,s.push(t),t}return i.push(e),e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportError=p,t.wrapFunction=function(e,t){return function(){try{return e.apply(null,arguments)}catch(e){return p(e,t),null}}},t.consoleWarn=function(e){(!(arguments.length<=1||void 0===arguments[1])&&arguments[1]||(0,n.isDebugEnabled)("errors"))&&window[c][u](e)};var n=r(0),o=r(1),i=r(3),a=r(2),s=(0,n.shouldSample)(10),c="console",d="error",u="warn",l=void 0,f=void 0;function p(e,t,r){try{if((r||(0,n.isDebugEnabled)("errors"))&&window[c][d](e),!s)return!1;var u={lv:o.LIBRARY_VERSION,ts:Date.now(),url:encodeURIComponent(window.document.documentURI),r:encodeURIComponent(window.document.referrer),_type:"apstagError",e:{et:e.name,el:t,msg:e.message}};if(void 0===l){var p=a.store.getState();void 0!==p&&void 0!==p.config&&(l=p.config.isSelfServePub,f=p.config.pubID)}return void 0!==l&&(l?(u.src=o.SELF_SERVE_PUB_SRC,u.pubid=f):u.src=f),(0,i.noBidCacheIdPixel)(u),!0}catch(e){}return!1}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GDPR=t.cmpLocalStorageChanged=t.cmpResponseKey=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=Object.assign||function(e){for(var t=1;t1&&(e._case=encodeURIComponent(t.runningCase)),(0,a.noBidCacheIdPixel)(e),_("done")},_=function(e){t.status=e,o.store.dispatch({type:"UPDATE_TEST",id:t.testId,status:t.status,name:t.name,case:t.runningCase})};this.name=c,this.sampleRate=u,this.runningCase="",this.status="",_("config"),_("waiting"),setTimeout(function(){"string"==typeof u&&(u=o.store.getState().cfg[u]),(0,i.shouldSample)(u)?(_("setup"),t.runningCase=(0,i.getRandomArrayElement)(Object.keys(s)),_("running"),r(m,s[t.runningCase])):_("nosample")},f)};var o=r(2),i=r(0),a=r(3)},function(e,t,r){"use strict";var n=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var y={},I;try{var O=(I=!1,(0,d.safeObjectHasProp)(window,"apstag")&&(0,d.safeObjectHasProp)(window.apstag,"debug")&&(I=!0,(0,p.reportError)(new Error("apstag has already loaded - preventing duplicate load"),"__error-apstag_duplicate_load__",!0)),I);O||function(){var e=(0,l.getWindowPerformanceMetric)(window,"navigationStart"),t=(0,d.getRand)(),r=(0,d.isDebugEnabled)("console");function i(){try{return window.top!==window.self?encodeURIComponent(document.referrer):""}catch(e){return(0,p.reportError)(e,"__error-detectIframeAndGetURL__"),encodeURIComponent(document.documentURI)}}function E(){var e,t;try{try{t=window.top.document.referrer}catch(e){(0,p.reportError)(e,"__error-getPageReferrerURL-1__"),t=window.document.referrer}e=encodeURIComponent(t)}catch(e){(0,p.reportError)(e,"__error-getPageReferrerURL-2__")}return e}function I(){var e=(0,d.getDebugValue)("url");if(""!==e)return encodeURIComponent(e);var t=encodeURIComponent(document.documentURI);try{(t=encodeURIComponent(window.top.location.href))&&void 0!==t||(t=i())}catch(e){(0,p.reportError)(e,"__error-getReferrerURL__"),t=i()}return t}function O(){if(!(0,d.hasLocalStorage)())return u.NO_LOCAL_STORAGE_SUPPORT_MAGIC_NUMBER_FOR_AAX;var e=c.store.getState();return(0,d.safeObjectHasProp)(e,"cfg")&&(0,d.safeObjectHasProp)(e.cfg,"v")?e.cfg.v:null}function D(e){return encodeURIComponent(JSON.stringify(e))}!function(){if((0,d.hasLocalStorage)()){var e=localStorage.getItem(u.CFG_LOCAL_STORAGE_KEY);if(e&&"undefined"!==e){var t=JSON.parse(e);c.store.dispatch({type:"SET_CFG",cfg:t})}}}();var T=(R={},w=Date.now(),A=0,{addTimer:function(e,t){t||(t=Date.now()),R[e]=t-w},set:function(e,t){R[e]=t},schedule:function(e,t){e||(e=5e3),t||(t="PH"),t+="/",setTimeout(function(){var e;R.i=A,R.t0=w,R.site=((e=decodeURIComponent(I())).indexOf("://")>-1?e.split("/")[2]:e.split("/")[0]).split(":")[0],(0,f.noBidCacheIdPixel)(R),R={},w=Date.now(),A++},e)}}),R,w,A,P;function C(e){e.ts=Date.now(),c.store.dispatch({type:"LOG_EVENT",event:e})}function z(e){function t(e){if(!c.store.getState().cmpFired){c.store.dispatch({type:"CMP_FIRED"});var t=document.createElement("iframe");t.style.display="none",t.src=e,document.body.appendChild(t)}}document.readyState&&"loading"===document.readyState?document.addEventListener?document.addEventListener("DOMContentLoaded",function(){t(e)},!1):document.attachEvent&&document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&t(e)}):t(e)}function L(e){try{var t=c.store.getState().cfg.COOKIE_MATCH_DELAY;window.setTimeout(function(){try{e&&e.cmp&&""!==e.cmp&&void 0!==e.cmp?z(e.cmp):e&&e.cmpjs&&""!==e.cmpjs&&void 0!==e.cmpjs&&(0,m.loadScriptTag)(e.cmpjs)}catch(e){(0,p.reportError)(e,"__error-tryCookieMatch-1__")}},t)}catch(e){(0,p.reportError)(e,"__error-tryCookieMatch-2__")}}function B(e){if(!e)return!1;try{var t=Math.floor(Number(e));if(t>u.MINIMUM_BID_TIMEOUT)return t}catch(e){return(0,p.reportError)(e,"__error-getValidMilliseconds__",!0),!1}return!1}function j(e){return!c.store.getState().experiments.chunkRequests||0===c.store.getState().bidReqs[e.split("-")[0]].networkReqs.filter(function(e){return e.inFlight}).length}function x(e,t){!c.store.getState().bidReqs[e[0]].hasCallbackExecuted&&j(e[0])&&(c.store.dispatch({type:"RECORD_CALLBACK",fid:e[0]}),t())}function N(e){c.store.getState().experiments.chunkRequests&&c.store.dispatch({type:"RECORD_NETWORK_EXCHANGE",fid:e[0],timestamp:Date.now(),exchangeType:"response",networkID:e[1]})}function M(e,t,r){var n=r.split("-"),o={url:e,withCredentials:!0};try{o.onload=function(e){N(n),eval(e.responseText),x(n,t)},o.onerror=function(){N(n),x(n,t)},(0,m.xhrGet)(o)}catch(e){(0,p.reportError)(e,"__error-xhrBid__"),N(n),x(n,t)}}function q(){var e,t={},r=document.cookie.split("; ");return t.cookiesParams="",r.forEach(function(r){if((e=r.split("="))[0]in u.FIRST_PARTY_COOKIE_KEYS)switch(e[0]){case"aps_ext_917":t.fb=e[1];break;default:t.cookiesParams+="&"+u.FIRST_PARTY_COOKIE_KEYS[e[0]].urlParam+"="+e[1]}}),t.fb||c.store.getState().sync917||c.store.dispatch({type:"SET_SYNC_917",value:!0}),t}function k(e){var t=new Date;return t.setTime(t.getTime()+1e3*e),t.toGMTString()}function U(e){if(e[u.AAX_RESP_REMAP_COOKIE_KEY])try{e[u.AAX_RESP_REMAP_COOKIE_KEY].forEach(function(e){document.cookie=e.k+"="+e.v+";expires="+k(e.exp)+";"})}catch(e){(0,p.reportError)(e,"__error-setFirstPartyCookies__")}}function G(e){(0,d.safeObjectHasProp)(e,"cb")&&(c.store.dispatch({type:"RECORD_AAX_RESPONSE_PROP",bidReqID:e.cb,key:"resTs",value:Date.now()}),c.store.dispatch({type:"RECORD_AAX_RESPONSE_PROP",bidReqID:e.cb,key:"perf",value:(0,l.getResourcePerformanceObject)(window,e.cb)})),(0,d.safeObjectHasProp)(e,"cfg")&&c.store.dispatch({type:"SET_CFG",cfg:e.cfg}),T.addTimer("br"),T.set("brs",e.punt?"0":"1"),(0,d.safeObjectHasProp)(e,"rm")&&T.schedule(e.to,e.id),Ne(e)}function H(e){if(L(e),U(e),(0,d.safeObjectHasProp)(e,"cfg")&&localStorage.setItem(u.CFG_LOCAL_STORAGE_KEY,JSON.stringify(e.cfg)),(0,d.safeObjectHasProp)(e,"st")&&e.st.includes(917)&&c.store.getState().sync917){c.store.dispatch({type:"SET_SYNC_917",value:!1});try{Se()}catch(e){(0,p.reportError)(e,"__error-doFbSync__")}}e.punt||(0,f.sendPixels)()}function F(e,t){var r=!1,n=null,o=function(t){if(!r){try{e(t),n&&clearTimeout(n)}catch(e){(0,p.reportError)(e,"__error-wrapCallback__",!0)}r=!0}};return n=window.setTimeout(o.bind(null,!0),t||c.store.getState().cfg.DEFAULT_TIMEOUT),o.bind(null,!1)}function K(){try{return(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+"x"+(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)}catch(e){(0,p.reportError)(e,"__error-getWindowsDimensions__")}return"x"}function X(e){if("string"==typeof e&&e.length>0)return!0;if(Array.isArray(e)){for(var t=0;t0&&y.clearTargeting(e,r)})}}catch(e){(0,p.reportError)(e,"__error-clearTargetingFromSlot__")}}function ne(e){var t;try{var r=c.store.getState().slotBids;(0,d.safeObjectHasProp)(r,e)&&r[e].forEach(function(e){e.bidState===u.BID_STATES.set&&(t=te(e))})}catch(e){(0,p.reportError)(e,"__error-findBidIDSetBySlotID__")}return t}function oe(e){try{if((0,d.safeObjectHasProp)(c.store.getState().slotBids,e)){var t=c.store.getState().slotBids[e].filter(function(e){return e.bidState===u.BID_STATES.set})[0];t&&t.bidState===u.BID_STATES.set&&c.store.dispatch({type:"BID_STATE_CHANGE",slotID:e,bidID:ne(e),bidState:u.BID_STATES.exposed})}}catch(e){(0,p.reportError)(e,"__error-clearbidSetOnSlot__")}}function ie(e,t){return decodeURIComponent(e).split("?")[0].split("#")[0]===decodeURIComponent(t).split("?")[0].split("#")[0]}function ae(e,t){return e.map(function(e){return(0,d.inArray)(t,e)}).filter(function(e){return e}).length===e.length}function se(){var e=[];try{y.hasAdServerObjectLoaded()&&(e=y.getSlots())}catch(e){(0,p.reportError)(e,"__error-getAdServerSlots__")}return e}function ce(){var e={};try{Object.keys(c.store.getState().slotBids).forEach(function(t){if(-1===c.store.getState().displayAdServer.noBidSlotIDs.indexOf(t)){var r=c.store.getState().slotBids[t];if(!(r.filter(function(e){return e.bidState===u.BID_STATES.set}).length>0)){var o=r.filter(function(e){return Date.now()-c.store.getState().AAXReqs.filter(function(t){return t.bidReqID===e.bidReqID})[0].rqTs<24e4}).filter(function(e){return ie(I(),c.store.getState().AAXReqs.filter(function(t){return t.bidReqID===e.bidReqID})[0].url)}).filter(function(e){return e.bidState!==u.BID_STATES.rendered});o.length>0&&(e[t]=o.map(function(e){var t=c.store.getState().AAXReqs.filter(function(t){return t.bidReqID===e.bidReqID})[0].rqTs;return n({},e,{rqTs:t})}).reduce(function(e,t){return e.rqTs>t.rqTs?e:t}))}}})}catch(e){(0,p.reportError)(e,"__error-getCurrentSlotBids__")}return e}function de(e,t){return(0,d.isArray)(c.store.getState().targetingKeys[e])?t?["amzniid_sp"]:c.store.getState().targetingKeys[e].filter(function(e){return e.indexOf("amzniid")>-1&&e.indexOf("amzniid_sp")<0}):["amzniid"]}function ue(e,t){var r,n;try{var o=c.store.getState().slotBids;Object.keys(o).forEach(function(i){o[i].forEach(function(o){de(i,t).forEach(function(t){o[t]===e&&(r=o,"amzniid_sp"===t?n="sp":"amzniid"!==t&&(n=t.substr(0,t.indexOf("amzniid"))))})})})}catch(e){(0,p.reportError)(e,"__error-findSlotBidByBidID__")}return{slotBid:r,dealId:n}}function le(e,t,r){var n;return t[r+"amzniid"]===e&&(n=r.split("_").pop().trim()),n}function fe(e){var t={};return e.slots.forEach(function(e){"video"!==e.mediaType?t[e.slotID]=e:(e.slotID.indexOf("rsv-")>=0&&(e={slotID:e.slotID.substring(4),r_amznbid:e.amznbid,r_amzniid:e.amzniid,r_amznp:e.amznp,mediaType:"video",targeting:["r_amznbid","r_amzniid","r_amznp"]}),t[e.slotID]?(e.targeting=e.targeting.concat(t[e.slotID].targeting),t[e.slotID]=n({},t[e.slotID],e)):t[e.slotID]=e)}),Object.keys(t).map(function(e){return t[e]})}function pe(e){var t,r=fe(e),o=["host","ev","cb","cmp","cfe"];try{t=r.map(function(t){var r={bidState:u.BID_STATES.new};return(0,d.safeObjectHasProp)(t,"amznsz")||(r.amznsz=t.size),o.forEach(function(t){if((0,d.safeObjectHasProp)(e,t)){var n=e[t],o=t;"cb"===t&&(o="bidReqID"),r[o]=n}}),n({},t,r)})}catch(e){(0,p.reportError)(e,"__error-convertAAXResponse__")}return t}function ge(e){try{var t,r=e.slotID,n=te(e),o=e.targeting?e.targeting:Ct("display");(t=ee(r))&&(Object.keys(e).filter(function(e){return(0,d.inArray)(o,e)}).forEach(function(r){return y.setTargeting(r,e[r],t)}),c.store.dispatch({type:"BID_STATE_CHANGE",slotID:r,bidID:n,bidState:u.BID_STATES.set,ts:Date.now()}))}catch(e){(0,p.reportError)(e,"__error-applyTargetingToAdServerSlot__")}}function me(e){var t=ce();e.forEach(function(e){t[e]&&$(t[e])})}function _e(){var e=ce();Object.keys(e).forEach(function(t){$(e[t])})}function be(e){try{e?me(e):_e(),c.store.getState().displayAdServer.slotRenderEndedSet||(y.cmdQueuePush(function(){y.slotRenderEndedEvent(function(e){re(y.getSlotElementId(e.slot)),oe(y.getSlotElementId(e.slot))})}),c.store.dispatch({type:"SLOT_RENDER_ENDED_SET"}))}catch(e){(0,p.reportError)(e,"__error-applySlotTargeting__")}}function Se(){var e=197,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="1881141382166183",n="https://www.facebook.com/audiencenetwork/token/update";function o(e){var t=JSON.parse(e),r=t.fbToken,n=new Date(parseInt(t.expAfter,10)).toUTCString();document.cookie="aps_ext_917="+r+"; expires="+n}function i(r){!function(e,t,r){var o;!function(e,t){var r={url:e,withCredentials:!0};try{r.onload=function(e){t(e.responseText)},r.onerror=function(){},(0,m.xhrGet)(r)}catch(e){(0,p.reportError)(e,"__error-fbTokenRequest__")}}((o=t,n+"?partner="+encodeURIComponent(e)+"&vr_token="+encodeURIComponent(o)),r)}(r,function(){for(var r="VR_",n=0;n50?"

apstag Test Creative

":"")+"

amzniid - "+e.bidID+" | amznbid: "+e.pp+" | size: "+e.sizes.join("x")+"

";r.src="javascript:'"+o+"'"}else r.src=ve(e);e.isAmp?(n.doc=e.doc,n.amzniid=e.bidID,n.slotID="amp"):(n=ue(e.bidID,e.isSharedPMP).slotBid).doc=e.doc,Ee(e.doc,r),e.viewabilityParams=e.viewabilityParams||{states:{}},e.viewabilityParams.iframe=r,r.onload=function(){e.viewabilityParams.states.iframeLoaded=!0,t&&t()}}catch(e){(0,p.reportError)(e,"__error-loadAdIntoUnfriendlyIframe__")}}function Te(e){var t,r=e.states,n=e.doc,o=e.bidID,i=e.iframe;st(r)||(r.shouldRunViewability=!1,(0,d.safeObjectHasProp)(window,"amzncsm")?t=window.amzncsm:(0,d.safeObjectHasProp)(n.defaultView,"amzncsm")&&(t=n.defaultView.amzncsm),t&&(0,d.safeObjectHasProp)(t,"rmD")&&(t.host=c.store.getState().cfg.DEFAULT_AAX_HOST,t.rmD(i,o,n.defaultView,n,c.store.getState().config.pubID)))}function Re(e){var t=e.map(xe),r={};return Object.keys(c.store.getState().slotBids).forEach(function(e){var n=c.store.getState().slotBids[e].filter(function(e){return e.bidState===u.BID_STATES.new})[0];n&&(0,d.inArray)(t,e)&&(r[e]=n,c.store.dispatch({type:"BID_STATE_CHANGE",slotID:e,bidID:te(n),bidState:u.BID_STATES.exposed}))}),r}function we(e,t){var r="0x0";return Z()?{slotID:e,size:r,mediaType:"banner",targeting:{amznbid:t,amzniid:"",amznp:t,amznsz:r},helpers:{targetingKeys:["amznbid","amzniid","amznp","amznsz"]}}:{slotID:e,amzniid:"",amznbid:t,amznp:t,amznsz:r,size:r}}function Ae(e,t){var r="";return e.targeting.forEach(function(t){r+="&"+t+"="+e[t]}),!0===t&&(r=encodeURIComponent(r)),r}function Pe(e,t,r){var n,o=t.slots.filter(dt).map(xe),i=e.map(xe);return n=r?o.map(function(e){return we(e,u.SLOT_STATES.bidInFlight)}):o.reduce(function(e,t){return(0,d.inArray)(i,t)||e.push(we(t,u.SLOT_STATES.noBid)),e},[]),e.concat(n)}function Ce(e,t){return function(r){var n=Re(t.slots),o=Object.keys(n),i=[];r&&(c.store.dispatch({type:"RECORD_AAX_RESPONSE_PROP",bidReqID:t.bidReqID,key:"timedOutAt",value:Date.now()}),c.store.getState().experiments.chunkRequests&&c.store.dispatch({type:"RECORD_TIMEOUT",fid:t.bidReqID,timeOut:Date.now()})),o.forEach(function(e){if((0,d.safeObjectHasProp)(n,e)){var t=n[e],r={};if(Z())t.meta.forEach(function(e){r[e]=t[e]}),r.targeting={},t.targeting.forEach(function(e){r.targeting[e]=t[e]}),r.helpers={targetingKeys:t.targeting,qsParams:Ae.bind(null,t,!1),encodedQsParams:Ae.bind(null,t,!0)};else if((0,d.safeObjectHasProp)(t,"amznbid")){if((0,d.safeObjectHasProp)(t,"amznp")||(t.amznp=""),r={amzniid:t.amzniid,amznbid:t.amznbid,amznp:t.amznp,slotID:e},(0,d.safeObjectHasProp)(t,"size")&&(r.size=t.size,r.amznsz=t.amznsz),"video"===t.mediaType){r.mediaType="video";var o="";t.amznbid?o+="&amzniid="+t.amzniid+"&amznbid="+t.amznbid+"&amznp="+t.amznp:(r.amznbid="",r.amzniid=""),t.r_amznbid?(r.r_amznbid=t.r_amznbid,r.r_amzniid=t.r_amzniid,r.r_amznp=t.r_amznp,o+="&r_amzniid="+t.r_amzniid+"&r_amznbid="+t.r_amznbid+"&r_amznp="+t.r_amznp):(r.r_amznbid="",r.r_amzniid="",r.r_amznp=""),r.qsParams=o,r.encodedQsParams=encodeURIComponent(o)}}else r=we(t.slotID,u.SLOT_STATES.noBid);i.push(r)}}),y.isSupported&&(i=Pe(i,t,r)),e(i,{fromTimeout:r})}}function ze(e,t){try{var r;(r=e.defaultView&&e.defaultView.frameElement?e.defaultView.frameElement:window.frameElement).width=t[0],r.height=t[1]}catch(e){(0,p.reportError)(e,"__error-resizeIframe__")}}function Le(e){return e[0]+"x"+e[1]}function Be(e){return 1===e.length?Le(e[0]):Le(e[Math.floor(e.length*Math.random())])}function je(e,t){var r,n=c.store.getState().cfg.DEFAULT_AAX_HOST,o=I(),i=e.bidReqID,a=K(),s=(0,d.getDebugValue)("testBidTimeout")||200;c.store.dispatch({type:"RECORD_AAX_REQUEST",data:{bidConfig:e,timeout:s,bidReqID:i,ws:a,url:o,rqTs:Date.now()}}),r=e.slots.map(function(e){var t={slotID:e.slotID,amzniid:u.MOCKBID.amzniid+"-"+(0,d.getRand)(),amznbid:u.MOCKBID.amznbid,amznp:u.MOCKBID.amznp,crid:u.MOCKBID.crid+"-"+(0,d.getRand)()};if((0,d.safeObjectHasProp)(e,"sizes")){var r=Be(e.sizes);t.size=r,t.amznsz=r}else"video"===e.mediaType&&(t.mediaType="video",t.amznbid="v_"+t.amznbid);if(Z()){t.mediaType="banner",t.meta=["slotID","mediaType","size"],t.amznbid_sp=u.MOCKBID.amznbid+"SP",t.amznp_sp=u.MOCKBID.amznp+"SP",t.amznsz_sp=t.size;var n="testDeal"+(0,d.getRand)()+"_"+t.size,o="testDealImpression-"+(0,d.getRand)();t.amzndeal_sp=n,t.amzndeals=[n],t[n+"amzniid"]=o,t.amzniid_sp=o,t.targeting=["amzniid","amznbid","amznp","amznsz","amzniid_sp","amznbid_sp","amznp_sp","amznsz_sp","amzndeal_sp","amzndeals",n+"amzniid"]}return t}),window.setTimeout(function(){window.apstag.bids({slots:r,host:n,status:"ok",cb:i}),t(!0)},s)}function xe(e){return e.slotID}function Ne(e){var t=c.store.getState().AAXReqs.filter(function(t){return t.bidReqID===e.cb})[0];if(t&&t.bidConfig&&t.bidConfig.slots){var r=t.bidConfig.slots.filter(dt).map(function(e){return e.slotID}),n=(0,d.safeObjectHasProp)(e,"slots")?e.slots.map(function(e){return e.slotID}):[],o=r.filter(function(e){return!(0,d.inArray)(n,e)});c.store.dispatch({type:"NO_BID_ON_ADSERVER_SLOTS",slotIDs:o}),y.hasAdServerObjectLoaded()?ke():y.isCommandQueueDefined()&&y.cmdQueuePush(function(){ke()})}}function Me(e){return(0,d.inArray)(c.store.getState().AAXReqs.filter(function(e){return!e.resTs}).map(function(e){return e.bidConfig.slots}).reduce(function(e,t){return e.concat(t)},[]).map(xe),e)}function qe(e){var t=y.getTargeting("amznbid",e);return t.length>0&&t[0].length>2}function ke(){y.hasAdServerObjectLoaded()&&"1"===y.getTargeting("amznbid")[0]&&Ge(),se().forEach(function(e){!(0,d.inArray)(c.store.getState().displayAdServer.noBidSlotIDs,y.getSlotElementId(e))||Me(y.getSlotElementId(e))||qe(e)||"2"===y.getTargeting("amznbid",e)[0]||Ue("noBid",e)})}function Ue(e,t){u.SLOT_STATE_KEYS.forEach(function(r){return y.setTargeting(r,u.SLOT_STATES[e],t)})}function Ge(){u.SLOT_STATE_KEYS.forEach(function(e){return y.clearTargeting(e)})}function He(e){var t={_type:"dupePixel",dd:Date.now()-e.renderTime};(0,f.bidCacheIdPixel)(e.amzniid,t)}function Fe(){var r=(0,l.getResourcePerformanceObject)(window,"aax2/apstag.js"),n={pid:t,ns:e,fs:(0,l.getMetricFromPerformanceObject)(r,"fetchStart"),re:(0,l.getMetricFromPerformanceObject)(r,"responseEnd")},o=(0,l.isResourceCached)(r);null!==o&&(n.c=o?1:0),window.setTimeout(f.noBidCacheIdPixel,1e3,n)}function Ke(){try{window.setTimeout(function(){var e=Ve().filter(function(e){return!(0,d.safeObjectHasProp)(c.store.getState().bsPixels,e.iid)||e.state!==c.store.getState().bsPixels[e.iid]});e&&e.length&&e.length>0&&(e.forEach(function(e){var t=e.iid,r=v(e,["iid"]);(0,f.bidCacheIdPixel)(t,Qe(r))}),Xe(e));var r={fetchStart:"a",domainLookupStart:"b",domainLookupEnd:"c",connectStart:"d",secureConnectionStart:"e",connectEnd:"f",requestStart:"g",responseStart:"h",responseEnd:"i",resTs:"j"};Object.keys(c.store.getState().slotBids).forEach(function(e){c.store.getState().slotBids[e].filter(function(e){return void 0!==e.amzniid}).forEach(function(n){if(!n.pixelSent){var i=c.store.getState().AAXReqs.filter(function(e){return e.bidReqID===n.bidReqID})[0];if("object"===(void 0===i?"undefined":o(i))&&null!==i){var a=i.rqTs-(0,l.getTimeOrigin)(),s={pid:t,lv:u.LIBRARY_VERSION,ns:i.bidConfig.slots.length,fid:n.bidReqID,fbrq:i.rqTs,_type:"latencyBd"};"object"===o(i.perf)&&null!==i.perf&&Object.keys(r).forEach(function(e){0!==(0,l.getMetricFromPerformanceObject)(i.perf,e)&&(s[r[e]]=(0,l.getMetricFromPerformanceObject)(i.perf,e)-a)}),s[r.resTs]=i.resTs-i.rqTs,(0,f.bidCacheIdPixel)(n.amzniid,s),c.store.dispatch({type:"UPDATE_BID_INFO_PROP",slotID:e,iid:n.amzniid,key:"pixelSent",value:!0})}}})}),Ke()},5e3)}catch(e){(0,p.reportError)(e,"__error-bidSetPixel__")}}function Xe(e){e.forEach(function(e){return c.store.dispatch({type:"RECORD_BID_INFO_SENT",bidInfo:e})})}function Qe(e){var t={};try{var r=Ye(e.fid);(t={status:e.state,pubid:c.store.getState().config.pubID,lv:u.LIBRARY_VERSION,_type:"bidSetPixel"}).toa=(0,d.safeObjectHasProp)(r.req,"timedOutAt")?r.req.timedOutAt:"0",t.fbrq=r.req.rqTs,t.pto=r.req.timeout,t.ns=r.req.bidConfig.slots.length,t.bla=r.req.resTs-r.req.rqTs,t.reqindex=r.index,t.fid=e.fid,c.store.getState().cfg.CHUNK_BID_REQUESTS_PROPORTION&&(t.eid=c.store.getState().experiments.chunkRequests?2:1,t.fbindex=r.fbIndex,t.fbns=c.store.getState().bidConfigs[e.fid.split("-")[0]].slots.length),e.delta&&(t.delay=e.delta)}catch(e){(0,p.reportError)(e,"__error-mapBidInfoToPixel__")}return t}function Ye(e){var t={req:c.store.getState().AAXReqs.filter(function(t){return t.bidReqID===e})[0]};return t.index=c.store.getState().AAXReqs.indexOf(t.req)+1,c.store.getState().experiments.chunkRequests?t.fbIndex=c.store.getState().AAXReqs.filter(function(e){return-1===e.bidReqID.indexOf("-")||"0"===e.bidReqID.split("-")[1]}).map(function(e){return e.bidReqID.split("-")[0]}).indexOf(e.split("-")[0])+1:t.fbIndex=t.index,t}function Ve(){var e=$e(),t=[];return e?(Object.keys(c.store.getState().slotBids).forEach(function(r){"video"!==c.store.getState().slotBids[r][0].mediaType&&c.store.getState().slotBids[r].filter(function(e){return void 0!==e.amzniid}).forEach(function(n){var o={slotID:r,iid:n.amzniid,fid:n.bidReqID},i=[],a=[];if(r in e&&(i=e[r].fetchedAt.filter(function(e){return e.AAXReqInfo&&e.AAXReqInfo.bidReqID===n.bidReqID}),a=e[r].targetedAt.filter(function(e){return e.targeting===n.amzniid})),i.length>0?i.length>0&&a.length>=i.length&&i.slice(i.length-1)[0].ts>a.slice(i.length-1)[0].ts?1===e[r].fetchWithIID.filter(function(e){return e===n.amzniid}).length?o.state=1:o.state=4:-1!==e[r].fetchWithIID.indexOf(n.amzniid)?o.state=3:o.state=2:o.state=0,1===o.state||2===o.state){var s=c.store.getState().AAXReqs.filter(function(e){return e.bidReqID===n.bidReqID})[0].resTs,u=We(s,e[r].fetchedAt,2===o.state);u&&(0,d.safeObjectHasProp)(u,"ts")&&(o.delta=s-u.ts)}t.push(o)})}),t):t}function We(e,t,r){return t[Je(t.map(function(t){var n=e-t.ts;return r?n>=0?n:null:n<=0?-n:null}))]}function Je(e){for(var t,r,n,o=0;o-1})[e]}function $e(){if(!y.hasAdServerObjectLoaded()||googletag&&void 0===googletag.debug_log)return null;var e=googletag.debug_log.getAllEvents().map(function(e){var t=e.getMessage(),r=e.getSlot();return{id:t.getMessageId(),args:t.getMessageArgs(),slotID:r?y.getSlotElementId(r):null,ts:e.getTimestamp().getTime()}}).filter(function(e){return 17===e.id&&"amzniid"===e.args[0]||103===e.id&&"amzniid"===e.args[0]||3===e.id}).reduce(function(e,t){(0,d.safeObjectHasProp)(e,t.slotID)||(e[t.slotID]={fetchedAt:[],targetedAt:[]});var r=e[t.slotID];return 3===t.id?r.fetchedAt.push({ts:t.ts,AAXReqInfo:Ze(e[t.slotID].fetchedAt.length,t.slotID)}):17===t.id?r.targetedAt.push({ts:t.ts,targeting:t.args[1]}):103===t.id&&r.targetedAt.push({ts:t.ts,targeting:""}),e},{});return Object.keys(e).forEach(function(t){var r=e[t];r.fetchWithIID=r.fetchedAt.map(function(e){var t=We(e.ts,r.targetedAt,!0);return t?t.targeting:0}),e[t]=r}),e}function et(){tt(),rt()}function tt(){"http://"===u.PROTOCOL&&new a.default({run:nt.bind(null,["http","https"]),cases:{aax:["http://aax.amazon-adsystem.com/dtb-ping","https://aax.amazon-adsystem.com/dtb-ping"],cf:["http://c.amazon-adsystem.com/aax2/dtb-ping.txt","https://c.amazon-adsystem.com/aax2/dtb-ping.txt"]},name:"https",sample:"EXPERIMENT_HTTPS"})}function rt(){new a.default({run:nt.bind(null,["aax","cf"]),cases:{tst:[u.PROTOCOL+"aax.amazon-adsystem.com/dtb-ping",u.PROTOCOL+"c.amazon-adsystem.com/dtb-ping"]},name:"edge-server",pixelTemplate:{env:u.PROTOCOL.replace(/[\W]/g,"")},sample:"EXPERIMENT_EDGE"})}function nt(e,t,r){r=ot(r),at((0,d.shuffleArray)(r),function(){var n;return t((h(n={pubID:c.store.getState().config?c.store.getState().config.pubID:null},e[0],it(r[0])),h(n,e[1],it(r[1])),n))})}function ot(e){return e.map(function(e){return e+(-1===e.indexOf("?")?"?":"&")+"cb="+(0,d.getRand)()})}function it(e){try{var t=(0,l.getResourcePerformanceObject)(window,e);return(0,l.getMetricFromPerformanceObject)(t,"responseEnd")-(0,l.getMetricFromPerformanceObject)(t,"fetchStart")}catch(e){return(0,p.reportError)(e,"__getRoundTripTime-error__"),0}}function at(e,t){var r={requests:{},callback:!1};e.map(function(e){r.requests[e]=!1});var n=function(e){r.requests[e]=!0,!r.callback&&st(r.requests)&&t()};e.map(function(e){(0,m.xhrGet)({url:e,onload:n.bind(null,e),onerror:n.bind(null,e,!0)})})}function st(e){var t=Object.keys(e);return t.map(function(t){return e[t]}).filter(function(e){return e}).length===t.length}function ct(){y.hasAdServerObjectLoaded()?Ue("noRequest"):y.isCommandQueueDefined()&&y.cmdQueuePush(function(){Ue("noRequest")})}function dt(e){return"video"!==e.mediaType}function ut(e){y.isCommandQueueDefined()&&(c.store.dispatch({type:"REQUESTED_BID_FOR_ADSERVER_SLOTS",slotIDs:e}),c.store.dispatch({type:"REQUESTED_BID_FOR_PMP_ONLY_DFP_SLOTS",slotIDs:e}),y.cmdQueuePush(function(){var t=se();"0"===y.getTargeting("amznbid")[0]&&Ge(),ae(e,t.map(function(e){return y.getSlotElementId(e)}))?t.forEach(function(t){(0,d.inArray)(e,y.getSlotElementId(t))&&!qe(t)&&Ue("bidInFlight",t)}):y.cmdQueuePush(function(){Ue("bidInFlight")})}))}function lt(e,t,r){switch(e){case"getLog":return c.store.getState().eventLog;case"getState":return c.store.getState();case"enable":return(0,d.setDebugMode)("fake_bids",!0),"DEBUG MODE ENABLED";case"disable":return(0,d.setDebugMode)("fake_bids",!1),"DEBUG MODE DISABLED";case"enableConsole":return(0,g.enableDebugConsole)(),"Debug console enabled";case"disableConsole":return(0,g.disableDebugConsole)(),"Debug console disabled";case"setDebug":return(0,d.setDebugMode)(t,r)?"Set debug mode '"+t+"' to '"+r+"'":"Failed to set debug mode '"+t+"'";default:return"unknown debug argument"}}function ft(e){return e.split("x").map(function(e){return parseInt(e,10)})}function pt(e,t){try{(0,f.sendPixels)()}catch(e){(0,p.reportError)(e,"__sendPixels-renderImp__")}if(e.type&&"amp"===e.type)Ie(e);else{var r=!1;t&&"string"==typeof t&&0===t.indexOf("sp|")&&(t=t.substring(3),r=!0);var n,o=t||e.amzniid,i=ue(o,r),a=i.slotBid,s=i.dealId;if(n=s&&s.length>=1?ft("sp"===s?a.amznsz_sp:le(o,a,s)):ft(a.size),1!==arguments.length)if(a){a.bidState===u.BID_STATES.rendered&&He(a),c.store.dispatch({type:"BID_STATE_CHANGE",slotID:a.slotID,bidID:t,bidState:u.BID_STATES.rendered,dealId:s,ts:Date.now()}),T.addTimer("imp");var d=a.host,l="amznad"+Math.round(1e6*Math.random()),g={bidID:t,doc:e,pp:gt("amznbid",a,s),host:d,adID:l,sizes:n,amznp:gt("amznp",a,s),crID:gt("crid",a,s),fif:!1,dealId:s,isSharedPMP:r,cfe:a.cfe};"1"===a.fif?(g.fif="1",c.store.dispatch({type:"UPDATE_BID_INFO_PROP",slotID:a.slotID,iid:t,key:"doc",value:e,dealId:s}),(0,m.loadScriptTag)(ve(g),null,document)):c.store.getState().aaxViewabilityEnabled?mt(g,e):De(g),ze(e,n)}else(0,p.reportError)(new Error("Invalid bid ID tried to render"),"__error-invalid_bid_id_render__");else Oe({doc:a.doc,bidID:a.amzniid,sizes:n,html:e.html})}}function gt(e,t,r){return r&&r.length>=1?"sp"===r?t[e+"_sp"]:"":t[e]?t[e]:""}function mt(e,t){var r=t.createElement("script");r.type="text/javascript",r.async=!0,e.viewabilityParams={doc:t,bidID:e.bidID,states:{csmLoaded:!1,iframeLoaded:!1,shouldRunViewability:!0}};var n=Te.bind(null,e.viewabilityParams);(0,m.addOnLoadFunction)(r,function(){e.viewabilityParams.states.csmLoaded=!0,n()});try{r.onerror=function(e){return(0,f.noBidCacheIdPixel)({_type:"csm_fail",ts:Date.now(),msg:e.message})}}catch(e){(0,p.reportError)(e,"__error-csm_onerror__")}De(e,n),r.src=c.store.getState().cfg.CSM_JS,Ee(t,r)}function _t(e){G(e),c.store.dispatch({type:"UPDATE_SLOT_BIDS",bids:pe(e)}),(0,d.safeObjectHasProp)(e,"ev")&&c.store.dispatch({type:"SET_VIEWABILITY",viewability:e.ev}),(0,d.safeObjectHasProp)(e,"cfn")&&c.store.dispatch({type:"SET_CFG",cfg:{CSM_JS:"//"===e.cfn.substring(0,2)?e.cfn:"//c.amazon-adsystem.com/"+e.cfn}}),H(e)}function bt(){return"number"==typeof c.store.getState().cfg.MAX_SLOTS_PER_REQUEST&&c.store.getState().cfg.MAX_SLOTS_PER_REQUEST>0}function St(e,t){var r=Dt.bind(null,e,t);void 0===c.store.getState().gdpr||null===c.store.getState().gdpr?(c.store.dispatch({type:"ADD_GDPR_QUE_ITEM",func:r}),1===c.store.getState().gdprQue.length&&(0,s.GDPR)(c.store.getState().config.gdpr,Et)):r()}function Et(e){c.store.dispatch({type:"SET_GDPR_CONFIG",config:e}),c.store.getState().gdprQue.map(function(e){try{e()}catch(e){(0,p.reportError)(e,"__gdpr_que__")}}),c.store.dispatch({type:"CLEAR_GDPR_QUE"})}function ht(e){var t=["300,250","300,600","160,600","320,50","728,90","970,250"],r="";return e.filter(function(e){return r=e.join(","),t.indexOf(r)>=0})}function vt(e){var t=e.filter(function(e){return"fluid"!==e}).map(function(e){return[e.getWidth(),e.getHeight()]});return c.store.getState().config.isSelfServePub?ht(t):t}function yt(e){var t=K().split("x");return{slotID:e.getSlotElementId(),slotName:e.getAdUnitPath(),sizes:vt(e.getSizes(Number(t[0]),Number(t[1])))}}function It(e){return e.filter(function(e){return 0!==e.sizes.length})}function Ot(e){return e||(e=se()),It(e.map(function(e){return yt(e)}))}function Dt(e,t){var r=!1;!0===c.store.getState().config.simplerGPT&&(!(0,d.safeObjectHasProp)(e,"slots")||e.slots.length>0&&!(0,d.safeObjectHasProp)(e.slots[0],"slotID"))&&(0===se().length?((0,p.reportError)(new Error("fetchBids was called in simplerGPT mode before any slots were defined in GPT"),!0),r=!0,e.slots=[]):(e.slots=Ot(e.slots),0===e.slots.length&&((0,p.consoleWarn)(new Error("No GPT slots provided to apstag.fetchBids() had valid sizes"),!0),r=!0)));var n,o,i=Rt(e.slots);i&&(e.slots=i);try{(n=B(n=e.timeout||c.store.getState().config.bidTimeout||c.store.getState().cfg.DEFAULT_TIMEOUT))||(n=c.store.getState().cfg.DEFAULT_TIMEOUT),"function"!=typeof t&&(void 0!==t&&(0,p.reportError)(new Error("Invalid callback function provided to apstag.fetchBids"),"__error-invalid_callback_fetchbids_",!0),t=function(){}),e.bidReqID=(0,d.getRand)(),t=F(Ce(t,e),n)}catch(e){(0,p.reportError)(e,"__error-fetchBids__")}if(0===e.slots.length)return!1===r&&(0,p.reportError)(new Error("No slots provided to apstag.fetchBids"),"__error-no_slots_provided_bid_request__",!0),void setTimeout(t.bind(null,[]),10);if(ut(e.slots.filter(dt).map(xe)),c.store.dispatch({type:"NEW_FETCH_BID_REQUEST",fid:e.bidReqID,pto:n}),c.store.dispatch({type:"RECORD_ORIGINAL_BID_CONFIG",bidConfig:e}),(0,d.isDebugEnabled)("fake_bids"))je(e,t);else if(u.HAS_XHR_SUPPORT)if(c.store.dispatch({type:"SHOULD_CHUNK_REQUESTS",value:(0,d.shouldSample)(c.store.getState().cfg.CHUNK_BID_REQUESTS_PROPORTION)}),c.store.getState().experiments.chunkRequests&&bt()){o=Tt(e);for(var a=0;a0&&c.store.dispatch({type:"SET_Q",Q:window.apstag._Q})}catch(e){(0,p.reportError)(e,"__error-storeApstagQ__")}window.apstag=(P={punt:wt,init:Pt,debug:lt,targetingKeys:Ct,fetchBids:St,setDisplayBids:At,renderImp:pt,bids:_t},r&&(Object.keys(P).forEach(function(e){P[e]=zt(e,P[e])}),(0,g.enableDebugConsole)(!0)),Object.keys(P).forEach(function(e){P[e]=Lt(P[e])}),P),function(){try{c.store.dispatch({type:"SHOULD_SAMPLE_LATENCY",value:(0,d.shouldSample)(c.store.getState().cfg.LATENCY_SAMPLING_RATE)}),c.store.getState().experiments.shouldSampleLatency&&(Fe(),Ke()),et()}catch(e){(0,p.reportError)(e,"__error-sampleLatency__")}try{W()}catch(e){(0,p.reportError)(e,"__error-doLast__")}try{var e={};e.url=c.store.getState().cfg.CSM_RTB_COMMUNICATOR_JS;var t=function(e){e&&"object"!==(void 0===e?"undefined":o(e))||(e="Request Timeout or Error"),(0,p.reportError)({message:"csm-rtb-comm-js loading failed",name:e},"__csm-rtb-comm-js__")};e.onload=function(e){e.readyState===XMLHttpRequest.DONE&&200===e.status?eval(e.responseText):t(JSON.stringify({status:e.statusText,response:e.responseXML}))},e.onerror=t,e.ontimeout=t,(0,m.xhrGet)(e)}catch(e){(0,p.reportError)(e,"__load-csm-rtb-comm-js__")}}()}()}catch(e){(0,p.reportError)(e,"__error-global__")}},function(e,t,r){e.exports=r(13)}]); //# sourceMappingURL=apstag.js.map