(self.AMP=self.AMP||[]).push({n:"amp-ad-exit",v:"2005012256000",f:(function(AMP,_){
var k,aa="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},l;if("function"==typeof Object.setPrototypeOf)l=Object.setPrototypeOf;else{var m;a:{var ba={a:!0},n={};try{n.__proto__=ba;m=n.a;break a}catch(a){}m=!1}l=m?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var r=l;
function t(a,b){a.prototype=aa(b.prototype);a.prototype.constructor=a;if(r)r(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.T=b.prototype};function u(a,b){b=void 0===b?"":b;try{return decodeURIComponent(a)}catch(c){return b}};var ca=/(?:^[#?]?|&)([^=&]+)(?:=([^&]*))?/g;function v(a){var b=Object.create(null);if(!a)return b;for(var c;c=ca.exec(a);){var d=u(c[1],c[1]),e=c[2]?u(c[2].replace(/\+/g," "),c[2]):"";b[d]=e}return b};var w="";
function x(){var a,b=a||self;if(b.__AMP_MODE)var c=b.__AMP_MODE;else{c=b;var d=self.AMP_CONFIG||{},e=!!d.test||!1,f=v(c.location.originalHash||c.location.hash);d=d.spt;var h=v(c.location.search);w||(w=c.AMP_CONFIG&&c.AMP_CONFIG.v?c.AMP_CONFIG.v:"012005012256000");c={localDev:!1,development:!!(0<=["1","actions","amp","amp4ads","amp4email"].indexOf(f.development)||c.AMP_DEV_MODE),examiner:"2"==f.development,esm:!1,geoOverride:f["amp-geo"],minified:!0,lite:void 0!=h.amp_lite,test:e,log:f.log,version:"2005012256000",
rtvVersion:w,singlePassType:d};c=b.__AMP_MODE=c}return c};var da=Object.prototype.toString;var y=self.AMP_CONFIG||{},ia=("string"==typeof y.cdnProxyRegex?new RegExp(y.cdnProxyRegex):y.cdnProxyRegex)||/^https:\/\/([a-zA-Z0-9_-]+\.)?cdn\.ampproject\.org$/;function z(a){if(self.document&&self.document.head&&(!self.location||!ia.test(self.location.origin))){var b=self.document.head.querySelector('meta[name="'+a+'"]');b&&b.getAttribute("content")}}y.cdnUrl||z("runtime-host");y.geoApiUrl||z("amp-geo-api");self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:null};var A=self.__AMP_LOG;function B(){if(!A.user)throw Error("failed to call initLogConstructor");return A.user}function C(){if(A.dev)return A.dev;throw Error("failed to call initLogConstructor");}function D(a,b,c,d){B().assert(a,b,c,d,void 0,void 0,void 0,void 0,void 0,void 0,void 0)};function E(a,b){this.name=a;this.type=b}E.prototype.filter=function(){};E.prototype.onLayoutMeasure=function(){};function ja(){var a,b;this.promise=new Promise(function(c,d){a=c;b=d});this.resolve=a;this.reject=b};var F=Object.prototype.hasOwnProperty;function G(){var a=100;this.N=a;this.D=this.H=0;this.o=Object.create(null)}G.prototype.has=function(a){return!!this.o[a]};G.prototype.get=function(a){var b=this.o[a];if(b)return b.access=++this.D,b.payload};G.prototype.put=function(a,b){this.has(a)||this.H++;this.o[a]={payload:b,access:this.D};if(!(this.H<=this.N)){C().warn("lru-cache","Trimming LRU cache");a=this.o;var c=this.D+1,d;for(d in a){var e=a[d].access;if(e<c){c=e;var f=d}}void 0!==f&&(delete a[f],this.H--)}};(function(a){return a||{}})({c:!0,v:!0,a:!0,ad:!0,action:!0});var H,I;
function J(a){var b;H||(H=self.document.createElement("a"),I=self.__AMP_URL_CACHE||(self.__AMP_URL_CACHE=new G));var c=b?null:I,d=H;if(c&&c.has(a))a=c.get(a);else{d.href=a;d.protocol||(d.href=d.href);var e={href:d.href,protocol:d.protocol,host:d.host,hostname:d.hostname,port:"0"==d.port?"":d.port,pathname:d.pathname,search:d.search,hash:d.hash,origin:null};"/"!==e.pathname[0]&&(e.pathname="/"+e.pathname);if("http:"==e.protocol&&80==e.port||"https:"==e.protocol&&443==e.port)e.port="",e.host=e.hostname;
e.origin=d.origin&&"null"!=d.origin?d.origin:"data:"!=e.protocol&&e.host?e.protocol+"//"+e.host:e.href;d=x().test&&Object.freeze?Object.freeze(e):e;c&&c.put(a,d);a=d}return a};function K(a,b){if(a.__AMP__EXPERIMENT_TOGGLES)var c=a.__AMP__EXPERIMENT_TOGGLES;else{a.__AMP__EXPERIMENT_TOGGLES=Object.create(null);c=a.__AMP__EXPERIMENT_TOGGLES;if(a.AMP_CONFIG)for(var d in a.AMP_CONFIG){var e=a.AMP_CONFIG[d];"number"===typeof e&&0<=e&&1>=e&&(c[d]=Math.random()<e)}if(a.AMP_CONFIG&&Array.isArray(a.AMP_CONFIG["allow-doc-opt-in"])&&0<a.AMP_CONFIG["allow-doc-opt-in"].length&&(d=a.AMP_CONFIG["allow-doc-opt-in"],e=a.document.head.querySelector('meta[name="amp-experiments-opt-in"]'))){e=
e.getAttribute("content").split(",");for(var f=0;f<e.length;f++)-1!=d.indexOf(e[f])&&(c[e[f]]=!0)}Object.assign(c,ka(a));if(a.AMP_CONFIG&&Array.isArray(a.AMP_CONFIG["allow-url-opt-in"])&&0<a.AMP_CONFIG["allow-url-opt-in"].length)for(d=a.AMP_CONFIG["allow-url-opt-in"],a=v(a.location.originalHash||a.location.hash),e=0;e<d.length;e++)f=a["e-"+d[e]],"1"==f&&(c[d[e]]=!0),"0"==f&&(c[d[e]]=!1)}var h=c;return!!h[b]}
function ka(a){var b="";try{"localStorage"in a&&(b=a.localStorage.getItem("amp-experiment-toggles"))}catch(e){C().warn("EXPERIMENTS","Failed to retrieve experiments from localStorage.")}var c=b?b.split(/\s*,\s*/g):[];a=Object.create(null);for(var d=0;d<c.length;d++)0!=c[d].length&&("-"==c[d][0]?a[c[d].substr(1)]=!1:a[c[d]]=!0);return a};var L={},M=(L["ampdoc-fie"]={isTrafficEligible:function(){return!0},branches:[["21065001"],["21065002"]]},L);function la(a){var b=a.ownerDocument.defaultView,c=N(b),d=b!=c;var e=c;if(K(e,"ampdoc-fie")){e.__AMP_EXPERIMENT_BRANCHES=e.__AMP_EXPERIMENT_BRANCHES||{};for(var f in M)if(F.call(M,f)&&!F.call(e.__AMP_EXPERIMENT_BRANCHES,f))if(M[f].isTrafficEligible&&M[f].isTrafficEligible(e)){if(!e.__AMP_EXPERIMENT_BRANCHES[f]&&K(e,f)){var h=M[f].branches;e.__AMP_EXPERIMENT_BRANCHES[f]=h[Math.floor(Math.random()*h.length)]||null}}else e.__AMP_EXPERIMENT_BRANCHES[f]=null;e="21065002"===(e.__AMP_EXPERIMENT_BRANCHES?
e.__AMP_EXPERIMENT_BRANCHES["ampdoc-fie"]:null)}else e=!1;var g=e;d&&!g?a=O(b,"url-replace")?P(b,"url-replace"):null:(a=Q(a),a=R(a),a=O(a,"url-replace")?P(a,"url-replace"):null);return a}function N(a){return a.__AMP_TOP||(a.__AMP_TOP=a)}function Q(a){if(a.nodeType){var b=(a.ownerDocument||a).defaultView;b=N(b);a=P(b,"ampdoc").getAmpDoc(a)}return a}function R(a){a=Q(a);return a.isSingleDoc()?a.win:a}
function P(a,b){O(a,b);var c=S(a);a=c[b];a.obj||(a.obj=new a.ctor(a.context),a.ctor=null,a.context=null,a.resolve&&a.resolve(a.obj));return a.obj}function ma(a){var b;(b=S(a)["host-exit"])?b.promise?b=b.promise:(P(a,"host-exit"),b=b.promise=Promise.resolve(b.obj)):b=null;var c=b;if(c)return c;a=S(a);a["host-exit"]=na();return a["host-exit"].promise}function S(a){var b=a.__AMP_SERVICES;b||(b=a.__AMP_SERVICES={});return b}
function O(a,b){a=a.__AMP_SERVICES&&a.__AMP_SERVICES[b];return!(!a||!a.ctor&&!a.obj)}function na(){var a=new ja,b=a,c=b.promise,d=b.resolve;b=b.reject;c.catch(function(){});return{obj:null,promise:c,resolve:d,reject:b,context:null,ctor:null}};/*
 https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
function T(a,b,c){var d;try{var e=a.open(b,c,d)}catch(h){C().error("DOM","Failed to open url on target: ",c,h)}if(!(c=e||"_top"==c)){c=d||"";var f;"number"!==typeof f&&(f=0);c=f+8>c.length?!1:-1!==c.indexOf("noopener",f)}c||a.open(b,"_top")};var U;function oa(a,b){var c=void 0,d=a,e=b;var f=function(a){try{return e(a)}catch(q){throw self.__AMP_REPORT_ERROR(q),q;}};var h=pa(),g=!1;c&&(g=c.capture);d.addEventListener("message",f,h?c:g);return function(){d&&d.removeEventListener("message",f,h?c:g);f=d=e=null}}function pa(){if(void 0!==U)return U;U=!1;try{var a={get capture(){U=!0}};self.addEventListener("test-options",null,a);self.removeEventListener("test-options",null,a)}catch(b){}return U};function qa(a,b){return oa(a,b)};var ra={bg:"https://tpc.googlesyndication.com/b4a/b4a-runner.html",moat:"https://z.moatads.com/ampanalytics093284/iframe.html"};Object.assign({},ra,{bg:"https://tpc.googlesyndication.com/b4a/experimental/b4a-runner.html"});function sa(a){D("object"==typeof a);if(a.filters){var b=a.filters,c=["clickDelay","clickLocation","inactiveElement"],d;for(d in b)D("object"==typeof b[d],"Filter specification '%s' is malformed",d),D(-1!=c.indexOf(b[d].type),"Supported filters: "+c.join(", "))}else a.filters={};if(a.transport){b=a.transport;for(var e in b)D("beacon"==e||"image"==e,"Unknown transport option: '"+e+"'"),D("boolean"==typeof b[e])}else a.transport={};e=a.targets;D("object"==typeof e,"'targets' must be an object");for(var f in e)ta(f,
e[f],a);return a}function ta(a,b,c){D("string"==typeof b.finalUrl,"finalUrl of target '%s' must be a string",a);b.filters&&b.filters.forEach(function(a){D(c.filters[a],"filter '%s' not defined",a)});if(b.vars){a=/^_[a-zA-Z0-9_-]+$/;for(var d in b.vars)D(a.test(d),"'%s' must match the pattern '%s'",d,a)}}function ua(a){return B().assertString(ra[a],"Unknown or invalid vendor "+a+", note that vendor must use transport: iframe")};function V(a,b,c){E.call(this,a,b.type);D("clickDelay"==b.type&&"number"==typeof b.delay&&0<b.delay,"Invalid ClickDelay spec");this.spec=b;this.intervalStart=Date.now();b.startTimingEvent&&(c.performance&&c.performance.timing?void 0==c.performance.timing[b.startTimingEvent]?C().warn("amp-ad-exit","Invalid performance timing event type "+b.startTimingEvent+", falling back to now"):this.intervalStart=c.performance.timing[b.startTimingEvent]:C().warn("amp-ad-exit","Browser does not support performance timing, falling back to now"))}
t(V,E);V.prototype.filter=function(){return Date.now()-this.intervalStart>=this.spec.delay};function va(a){var b=1E3;return{type:"clickDelay",delay:b,startTimingEvent:a}};function W(a,b,c){E.call(this,a,b.type);D("clickLocation"==b.type&&("undefined"===typeof b.left||"number"===typeof b.left)&&("undefined"===typeof b.right||"number"===typeof b.right)&&("undefined"===typeof b.top||"number"===typeof b.top)&&("undefined"===typeof b.bottom||"number"===typeof b.bottom)&&("undefined"===typeof b.relativeTo||"string"===typeof b.relativeTo),"Invaid ClickLocation spec");this.O=b.left||0;this.P=b.right||0;this.S=b.top||0;this.M=b.bottom||0;this.G=b.relativeTo;this.J=c;this.h=
{top:0,right:0,bottom:0,left:0}}t(W,E);W.prototype.filter=function(a){return a.clientX>=this.h.left&&a.clientX<=this.h.right&&a.clientY>=this.h.top&&a.clientY<=this.h.bottom?!0:!1};
W.prototype.onLayoutMeasure=function(){var a=this;this.J.getVsync().measure(function(){var b=a.J.win;if(a.G){var c=b.document.querySelector(a.G);D(c,"relativeTo element "+a.G+" not found.");var d=c.getBoundingClientRect();a.h.left=d.left;a.h.top=d.top;a.h.bottom=d.bottom;a.h.right=d.right}else a.h.left=0,a.h.top=0,a.h.bottom=b.innerHeight,a.h.right=b.innerWidth;a.h.left+=a.O;a.h.top+=a.S;a.h.right-=a.P;a.h.bottom-=a.M})};function X(a,b){E.call(this,a,b.type);D("inactiveElement"==b.type&&"string"==typeof b.selector,"Invalid InactiveElementspec");this.R=b.selector}t(X,E);X.prototype.filter=function(a){a=a.target;var b=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector;return!(b&&b.call(a,this.R))};function Y(a,b,c){switch(b.type){case "clickDelay":return new V(a,b,c.win);case "clickLocation":return new W(a,b,c);case "inactiveElement":return new X(a,b)}};function wa(a,b){try{a:{var c=(a.ownerDocument||a).defaultView,d=b||N(c);if(c&&c!=d&&N(c)==d)try{var e=c.frameElement;break a}catch(h){}e=null}var f=e.parentElement;if("AMP-AD"==f.nodeName)return String(f.getResourceId())}catch(h){}return null};function Z(a){a=AMP.BaseElement.call(this,a)||this;a.I={};a.K={};a.w=[];a.A={beacon:!0,image:!0};a.C={};a.registerAction("exit",a.exit.bind(a));a.registerAction("setVariable",a.setVariable.bind(a),1);a.L={};a.B=null;a.m=null;a.F={};return a}t(Z,AMP.BaseElement);k=Z.prototype;
k.exit=function(a){var b=this,c=a.args,d=a.event;D("variable"in c!="target"in c,"One and only one of 'target' and 'variable' must be specified");var e;"variable"in c?((e=this.K[c.variable])||(e=c["default"]),D(e,"Variable target not found, variable:'"+c.variable+"', default:'"+c["default"]+"'"),delete c["default"]):e=c.target;var f=this.I[e];D(f,"Exit target not found: '"+e+"'");D(d,"Unexpected null event");d.preventDefault();if(xa(this.w,d)&&xa(f.filters,d)){var h=ya(this,c,d,f);f.trackingUrls&&
f.trackingUrls.map(h).forEach(function(a){b.A.beacon&&b.win.navigator.sendBeacon&&b.win.navigator.sendBeacon(a,"")||!b.A.image||(b.win.document.createElement("img").src=a)});var g=h(f.finalUrl);if(Q(this.getAmpDoc()).getHeadNode().querySelector("script[host-service]"))ma(R(this.getAmpDoc())).then(function(a){return a.openUrl(g)}).catch(function(a){a.fallback&&T(b.win,g,"_blank")});else{var p=f.behaviors&&f.behaviors.clickTarget&&"_top"==f.behaviors.clickTarget?"_top":"_blank";T(this.win,g,p)}}};
k.setVariable=function(a){a=a.args;var b=this.I[a.target];D(b,"Exit target not found: '"+a.target+"'");this.K[a.name]=a.target};
function ya(a,b,c,d){var e={CLICK_X:function(){return c.clientX},CLICK_Y:function(){return c.clientY}},f=la(a.element),h={RANDOM:!0,CLICK_X:!0,CLICK_Y:!0};if(d.vars){var g={},p;for(p in d.vars)g.j=p,"_"==g.j[0]&&(g.l=d.vars[g.j],g.l&&(e[g.j]=function(c){return function(){if(c.l.iframeTransportSignal){var d=f.expandStringSync(c.l.iframeTransportSignal,{IFRAME_TRANSPORT_SIGNAL:function(b,c){if(!b||!c)return"";var d=a.L[b];if(d&&c in d)return d[c]}});if(c.l.iframeTransportSignal=="IFRAME_TRANSPORT_SIGNAL"+
d)C().error("amp-ad-exit","Invalid IFRAME_TRANSPORT_SIGNAL format:"+d+" (perhaps there is a space after a comma?)");else if(""!=d)return d}return c.j in b?b[c.j]:c.l.defaultValue}}(g),h[g.j]=!0)),g={l:g.l,j:g.j}}return function(a){return f.expandUrlSync(a,e,void 0,h)}}function xa(a,b){return a.every(function(a){var c=a.filter(b);B().info("amp-ad-exit","Filter '"+a.name+"': "+(c?"pass":"fail"));return c})}
k.buildCallback=function(){var a=this;this.element.setAttribute("aria-hidden","true");this.w.push(Y("minDelay",va(),this));this.w.push(Y("carouselBtns",{type:"inactiveElement",selector:".amp-carousel-button"},this));var b=this.element.children;D(1==b.length,"The tag should contain exactly one <script> child.");b=b[0];D("SCRIPT"==b.tagName&&b.hasAttribute("type")&&"APPLICATION/JSON"==b.getAttribute("type").toUpperCase(),'The amp-ad-exit config should be inside a <script> tag with type="application/json"');
try{var c=sa(JSON.parse(b.textContent));if("[object Object]"===da.call(c.options)&&"string"===typeof c.options.startTimingEvent){var d=c.options.startTimingEvent;this.w.splice(0,1,Y("minDelay",va(c.options.startTimingEvent),this))}for(var e in c.filters){var f=c.filters[e];"clickDelay"==f.type&&(f.startTimingEvent=f.startTimingEvent||d);this.C[e]=Y(e,f,this)}for(var h in c.targets){var g=c.targets[h];this.I[h]={finalUrl:g.finalUrl,trackingUrls:g.trackingUrls||[],vars:g.vars||{},filters:(g.filters||
[]).map(function(b){return a.C[b]}).filter(function(a){return a}),behaviors:g.behaviors||{}};for(var p in g.vars)if(g.vars[p].iframeTransportSignal){var q=g.vars[p].iframeTransportSignal.match(/IFRAME_TRANSPORT_SIGNAL\(([^,]+)/);if(q&&!(2>q.length)){var ha=q[1],ea=J(ua(ha)).origin;this.F[ea]=this.F[ea]||ha}}}this.A.beacon=!1!==c.transport.beacon;this.A.image=!1!==c.transport.image}catch(fa){throw this.user().error("amp-ad-exit","Invalid JSON config",fa),fa;}za(this)};k.resumeCallback=function(){za(this)};
k.unlayoutCallback=function(){this.B&&(this.B(),this.B=null);return AMP.BaseElement.prototype.unlayoutCallback.call(this)};
function za(a){"inabox"!=x().runtime&&(a.m=a.m||wa(a.element,N(a.win)),a.m?a.B=qa(a.getAmpDoc().win,function(b){if(a.F[b.origin]){var c=b.data;if("string"==typeof c&&0==c.indexOf("amp-")&&-1!=c.indexOf("{")){var d=c.indexOf("{");try{var e=JSON.parse(c.substr(d))}catch(h){C().error("MESSAGING","Failed to parse message: "+c,h),e=null}}else e=null;var f=e;f&&"iframe-transport-response"==f.type&&(e=f,b=b.origin,D(e.message,"Received empty response from 3p analytics frame"),D(e.creativeId,"Received malformed message from 3p analytics frame: creativeId missing"),
D(e.vendor,"Received malformed message from 3p analytics frame: vendor missing"),c=J(ua(e.vendor)),D(c&&c.origin==b,"Invalid origin for vendor "+(e.vendor+": "+b)),f.creativeId==a.m&&(a.L[f.vendor]=f.message))}}):B().warn("amp-ad-exit","No friendly parent amp-ad element was found for amp-ad-exit; not in inabox case."))}k.isLayoutSupported=function(){return!0};k.onLayoutMeasure=function(){for(var a in this.C)this.C[a].onLayoutMeasure()};(function(a){a.registerElement("amp-ad-exit",Z)})(self.AMP);
})});

//# sourceMappingURL=amp-ad-exit-0.1.js.map
