+<script>(()=>{"use strict";const e="Prebid Event",n=(()=>{const e={frameBorder:0,scrolling:"no",marginHeight:0,marginWidth:0,topMargin:0,leftMargin:0,allowTransparency:"true"};return(n,t)=>{const r=n.createElement("iframe");return Object.entries(Object.assign({},t,e)).forEach(e=>{let[n,t]=e;return r.setAttribute(n,t)}),r}})();function t(e){return!!e.frames.__pb_locator__}window.pbRender=function(r){let o=r.parent;try{for(;o!==r.top&&!t(o);)o=o.parent;t(o)||(o=r.parent)}catch(e){}return function(t){let{adId:s,pubUrl:i,clickUrl:c}=t;const a=new URL(i,window.location).origin;function d(e,n,t){const r=new MessageChannel;r.port1.onmessage=u(t),o.postMessage(JSON.stringify(Object.assign({message:e,adId:s},n)),a,[r.port2])}function l(n){d(e,{event:"adRenderFailed",info:{reason:(null==n?void 0:n.reason)||"exception",message:null==n?void 0:n.message}}),(null==n?void 0:n.stack)&&console.error(n)}function u(e){return function(){try{return e.apply(this,arguments)}catch(e){l(e)}}}d("Prebid Request",{options:{clickUrl:c}},function(t){let o;try{o=JSON.parse(t.data)}catch(e){return}if("Prebid Response"===o.message&&o.adId===s){const t=n(r.document,{width:0,height:0,style:"display: none"});t.onload=u(function(){const s=t.contentWindow;s.Promise.resolve(s.render(o,{sendMessage:d,mkFrame:n},r)).then(()=>d(e,{event:"adRenderSucceeded"}),l)}),t.srcdoc="<script>".concat(o.renderer,"<\/script>"),r.document.body.appendChild(t)}})}}(window)})();</script>
0 commit comments