;
(self.AMP=self.AMP||[]).push({m:1,v:"2603032146000",n:"amp-auto-ads",ev:"0.1",l:!0,f:function(t,n){(()=>{function n(t,n,i){return n in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}function i(t,n){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),i.push.apply(i,e)}return i}function e(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{};e%2?i(Object(s),!0).forEach((function(i){n(t,i,s[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):i(Object(s)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(s,n))}))}return t}var s,{isArray:r}=Array;function o(t,n){const i=t.length-n.length;return i>=0&&t.indexOf(n,i)==i}var{hasOwnProperty:a,toString:u}=Object.prototype;function c(t){const n=Object.create(null);return t&&Object.assign(n,t),n}function h(t,n,i,e,s,r,o,a,u,c,h){return t}function l(t){return JSON.parse(t)}var d=/(?:^[#?]?|&)([^=&]+)(?:=([^&]*))?/g;function f(t,n=""){try{return decodeURIComponent(t)}catch(t){return n}}function g(t){const n=c();if(!t)return n;let i;for(;i=d.exec(t);){const t=f(i[1],i[1]),e=i[2]?f(i[2].replace(/\+/g," "),i[2]):"";n[t]=e}return n}self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:null};var p=self.__AMP_LOG;function m(t){return p.user||(p.user=A()),function(t,n){return n&&n.ownerDocument.defaultView!=t}(p.user.win,t)?p.userForEmbed||(p.userForEmbed=A()):p.user}function A(t){return function(t,n){throw new Error("failed to call initLogConstructor")}()}function b(t,n,i,e,s,r,o,a,u,c,h){return t}function v(t,n,i,e,s,r,o,a,u,c,h){return m().assert(t,n,i,e,s,r,o,a,u,c,h)}function w(t){return(t.ownerDocument||t).defaultView}function P(t,n){return C(t=function(t){return t.__AMP_TOP||(t.__AMP_TOP=t)}(t),n)}function _(t,n){return C(function(t){const n=y(t);return n.isSingleDoc()?n.win:n}(y(t)),n)}function y(t){return t.nodeType?(n=w(t),P(n,"ampdoc")).getAmpDoc(t):t;var n}function C(t,n){b(function(t,n){const i=t.__AMP_SERVICES&&t.__AMP_SERVICES[n];return!(!i||!i.ctor)}(t,n));const i=function(t){let n=t.__AMP_SERVICES;return n||(n=t.__AMP_SERVICES={}),n}(t)[n];return i.obj||(b(i.ctor),b(i.context),i.obj=new i.ctor(i.context),b(i.obj),i.context=null,i.resolve&&i.resolve(i.obj)),i.obj}var M="__AMP__EXPERIMENT_TOGGLES";function E(t,n,i){return function(t,n){for(const i in n)t.setAttribute(i,n[i]);return t}(t.createElement(n),i)}var S=t=>_(t,"documentInfo").get(),R=t=>P(t,"extensions"),I=t=>_(t,"viewport");function k(t,n,i,e){const s=[],r=e&&null!=e.value&&""!==e.value?encodeURIComponent(e.name)+"="+encodeURIComponent(String(e.value)):null;let o=i-t.length;r&&(o-=r.length+1);const a=Object.keys(n);for(let t=0;t<a.length;t++){const i=a[t],e=n[i];if(null==e||""===e)continue;const u=encodeURIComponent(i)+"=",c=encodeURIComponent(String(e)),h=u.length+c.length+1;if(h>o){const t=c.substr(0,o-u.length-1).replace(/%\w?$/,"");t&&s.push(u+t),r&&s.push(r);break}s.push(u+c),o-=h}return s.length?t+"?"+s.join("&"):t}var x,O={"type":!0,"rtc-config":!0,"layout":!0,"height":!0,"width":!0,"sticky":!0,"json":!0},j="attributes";function T(t,n){return t[n]?(i=t[n],"[object Object]"!==u.call(i)||r(t[n])?{}:function(t){const n={};for(const i in t){if(!O[i]&&!i.startsWith("data-"))continue;const e=typeof t[i];"number"!=e&&"string"!=e&&"boolean"!=e||(n[i]=String(t[i]))}return n}(t[n])):{};var i}function V(t,n){return x||(x=self.document.createElement("a")),function(t,n,i){return t.href="",new URL(n,t.href)}(x,t)}function D(t){if(h(function(t){const n=t.tagName;return n.startsWith("AMP-")&&!("AMP-STICKY-AD-TOP-PADDING"==n||"AMP-BODY"==n)}(t)),t.createdCallback)return Promise.resolve(t);if(!t.__AMP_UPG_PRM){const n=new class{constructor(){this.promise=new Promise(((t,n)=>{this.resolve=t,this.reject=n}))}};t.__AMP_UPG_PRM=n.promise,t.__AMP_UPG_RES=n.resolve}const n=t.__AMP_UPG_PRM;return h(n),n}function N(t){return(n=w(t),P(n,"vsync")).measurePromise((()=>function(t){const n=t.ownerDocument.body;let i=0,e=0;for(let s=t;s&&s!=n;s=s.offsetParent)i+=s.offsetLeft,e+=s.offsetTop;const{offsetHeight:s,offsetWidth:r}=t;return function(t,n,i,e){return{left:t,top:n,width:i,height:e,bottom:n+e,right:t+i,x:t,y:n}}(i,e,r,s)}(t)));var n}var U=["AMP-SIDEBAR","AMP-APP-BANNER"],z={};function q(t,n){const i=n.placements;if(!i)return[];const s=[];return i.forEach((n=>{!function(t,n,i){const s=z[n.pos];if(!s)return;const r=n.anchor;if(!r)return;const o=L(t.getRootNode(),r);if(!o.length)return;let a;if(n.style){const t=parseInt(n.style.top_m,10),i=parseInt(n.style.bot_m,10);(t||i)&&(a={top:t||void 0,bottom:i||void 0})}o.forEach((r=>{if(!function(t,n){const i=1==n||4==n?t.parentElement:t;if(!i)return!1;const e=i;return!U.some((t=>{return n=t,!!e.closest(n);var n}))}(r,n.pos))return;const o=T(n,j);i.push(new class{constructor(t,n,i,e,s,r){this.ampdoc=t,this.$c=_(n,"mutator"),this.tC=n,this.nC=i,this.iC=e,this.eC=s,this.sC=r,this.rC=null,this.Mi=0}getAdElement(){return this.rC}getEstimatedPosition(){return N(this.tC).then((t=>this.oC(t)))}oC(t){switch(this.nC){case 1:case 2:return t.top;case 3:case 4:return t.bottom;default:throw new Error("Unknown position")}}placeAd(t,n,i,e){return this.getEstimatedPosition().then((s=>this.ampdoc.win.scrollY>s?(this.Mi=0,this.Mi):i.isTooNearAnAd(s).then((i=>{if(i)return this.Mi=3,this.Mi;const s=e&&this.aC(this.tC);return this.rC=s?this.uC(t):this.cC(t,n.width),this.iC(this.tC,this.getAdElement()),s?D(this.getAdElement()).then((()=>this.getAdElement().build())).then((()=>{const t=!this.getAdElement().classList.contains("i-amphtml-layout-awaiting-size");return this.Mi=t?2:1,this.Mi})):this.hC(n).then((t=>D(this.getAdElement()).then((()=>this.getAdElement().build())).then((()=>this.$c.requestChangeSize(this.getAdElement(),t.height,t.width,t.margins))).then((()=>(this.Mi=2,this.Mi)),(()=>(this.Mi=1,this.Mi)))))}))))}hC(t){return Promise.resolve({height:t.height||250,margins:this.sC})}cC(t,n){const i=e(e({"layout":n?"fixed":"fixed-height","height":"0","width":n||"auto","class":"i-amphtml-layout-awaiting-size"},t),this.eC);return E(this.ampdoc.win.document,"amp-ad",i)}uC(t){const n=e(e({"width":"100vw","height":"0","layout":"fixed","class":"i-amphtml-layout-awaiting-size","data-auto-format":"rspv","data-full-width":""},t),this.eC);return E(this.ampdoc.win.document,"amp-ad",n)}aC(t){return I(t).getSize().width<488}}(t,r,n.pos,s,o,a))}))}(t,n,s)})),s}function L(t,n){const i=n.selector;if(!i)return[];let e=[].slice.call(function(t,n){return t.querySelectorAll(function(t,n){return t.replace(/^|,/g,"$&:scope ")}(n))}(t.documentElement||t,i));const s=n.min_c||0;if(s>0&&(e=e.filter((t=>t.textContent.length>=s))),"number"==typeof n.index||!n.all){const t=e[n.index||0];e=t?[t]:[]}if(0==e.length)return[];if(n.sub){let t=[];return e.forEach((i=>{t=t.concat(L(i,n.sub))})),t}return e}function $(t,n){if(!t)return null;const i=parseFloat(t);return isNaN(i)||i<0?null:o(t,"px")?i:o(t,"vp")?i*n:null}z[1]=(t,n)=>{t.parentNode.insertBefore(n,t)},z[4]=(t,n)=>{t.parentNode.insertBefore(n,t.nextSibling)},z[2]=(t,n)=>{t.insertBefore(n,t.firstChild)},z[3]=(t,n)=>{t.appendChild(n)};var F="amp-auto-ads",G=class extends t.BaseElement{buildCallback(){const t=this.element.getAttribute("type");if(v(t,"Missing type attribute"),this.lC=function(t,n){return"adsense"==t?new class{constructor(t){this.dC=t}isEnabled(){return!0}isResponsiveEnabled(){return!0}getConfigUrl(){const t=S(this.dC),n=V(t.canonicalUrl).hostname,i=w(this.dC);return k("//pagead2.googlesyndication.com/getconfig/ama",{"client":this.dC.getAttribute("data-ad-client"),"plah":n,"ama_t":"amp","url":t.canonicalUrl,"debug_experiment_id":(/(?:#|,)deid=([\d,]+)/i.exec(i.location.hash)||[])[1]||null},4096)}filterConfig(t){return w(this.dC).adsbygoogle&&t.stickyAdAttributes&&(t.stickyAdAttributes["data-no-fill"]="true"),t}getAttributes(){const t={"type":"adsense","data-ad-client":this.dC.getAttribute("data-ad-client")},n=this.dC.getAttribute("data-ad-host"),i=this.dC.getAttribute("data-ad-host-channel");return n&&(t["data-ad-host"]=n,i&&(t["data-ad-host-channel"]=i)),t}getDefaultAdConstraints(){const t=I(this.dC).getSize().height;return{initialMinSpacing:t,subsequentMinSpacing:[{adCount:3,spacing:2*t},{adCount:6,spacing:3*t}],maxAdCount:8}}getSizing(){return{}}}(n):"alright"==t?new class{constructor(t){this.dC=t}isEnabled(){return!0}isResponsiveEnabled(){return!1}getConfigUrl(){const t=S(this.dC);return k("//analytics.alright.network/amp/",{"p":this.dC.getAttribute("data-publisher-id"),"t":this.dC.getAttribute("data-page-type"),"c":this.dC.getAttribute("data-content-category")||"","u":t.canonicalUrl,"w":window.screen.width,"h":window.screen.height},4096)}filterConfig(t){return t}getAttributes(){return{"width":300,"height":250,"layout":"responsive","data-multi-size-validation":"false","type":"doubleclick","data-ad":"alright"}}getDefaultAdConstraints(){const t=I(this.dC).getSize().height;return{initialMinSpacing:t,subsequentMinSpacing:[{adCount:3,spacing:2*t},{adCount:6,spacing:3*t}],maxAdCount:8}}getSizing(){return{width:300,height:250}}}(n):"denakop"==t?new class{constructor(t){this.dC=t}isEnabled(t){return!0}isResponsiveEnabled(){return!0}getConfigUrl(){const t=S(this.dC),n=this.dC.getAttribute("data-account-id");return n?k("https://v3.denakop.com/ad-request",{"a":n,"v":"amp","u":t.canonicalUrl},4096):k("//v2.denakop.com/ad-request/amp",{"p":this.dC.getAttribute("data-publisher-id"),"t":this.dC.getAttribute("data-tag-id"),"u":t.canonicalUrl},4096)}filterConfig(t){return t}getAttributes(){return{"data-multi-size-validation":"false","type":"doubleclick","data-ad":"denakop","style":"position:relative !important"}}getDefaultAdConstraints(){const t=I(this.dC).getSize().height;return{initialMinSpacing:t,subsequentMinSpacing:[{adCount:4,spacing:2*t},{adCount:8,spacing:3*t}],maxAdCount:20}}getSizing(){return{}}}(n):"doubleclick"==t?new class{constructor(t){this.dC=t}isEnabled(t){return!0}isResponsiveEnabled(){return!1}getConfigUrl(){const t=S(this.dC),n=V(t.canonicalUrl).hostname;return k("//pagead2.googlesyndication.com/getconfig/ama",{"client":this.dC.getAttribute("data-ad-legacy-client"),"plah":n,"ama_t":"amp","url":t.canonicalUrl},4096)}filterConfig(t){return t}getAttributes(){return{"type":"doubleclick","data-slot":this.dC.getAttribute("data-slot"),"json":this.dC.getAttribute("data-json")}}getDefaultAdConstraints(){const t=I(this.dC).getSize().height;return{initialMinSpacing:t,subsequentMinSpacing:[{adCount:3,spacing:2*t},{adCount:6,spacing:3*t}],maxAdCount:8}}getSizing(){const t=function(t,n){try{return l(t)}catch(t){return null}}(this.dC.getAttribute("data-experiment"));return t?{height:t.height?Number(t.height):250,width:t.width?Number(t.width):void 0}:{}}}(n):"firstimpression.io"==t?new class{constructor(t){this.dC=t,this.pvid64=0}isEnabled(t){return!0}isResponsiveEnabled(){return!1}getConfigUrl(){let t=0;S(this.dC).pageViewId64.then((t=>{this.pvid64=t}));const{hash:n,host:i,pathname:e,search:s}=window.location,r=Object.assign(g(n),g(s)),o=S(this.dC),a=e.match(/amp\/fi\/(\d+)\//);null!=a&&2==a.length&&(t=a[1]);const u=r.fi_reveal,c=r.fi_demand,h=r.fi_geo,l=r.disable_fi,d=r.fi_cdnhost||(t?i:"cdn.firstimpression.io"),f=r.fi_cdnpath||(t?"/amp-preview.php":"/delivery/amp.php"),p=this.dC.getAttribute("data-website-id"),m=this.dC.getAttribute("data-targeting"),A={"id":p,"url":o.canonicalUrl,"w":window.screen.width,"h":window.screen.height};return m&&(A.targeting=m),void 0!==u&&(A.fi_reveal=u),void 0!==c&&(A.fi_demand=c),h&&(A.fi_geo=h),l&&(A.disable_fi=l),t&&(A.preview_id=t),k("https://"+d+f,A,4096)}filterConfig(t){return t}getAttributes(){return{"type":"firstimpression","data-pvid64":this.pvid64}}getDefaultAdConstraints(){const t=I(this.dC).getSize().height;return{initialMinSpacing:t,subsequentMinSpacing:[{adCount:3,spacing:2*t},{adCount:6,spacing:3*t}],maxAdCount:8}}getSizing(){return{height:1}}}(n):"premiumads"==t?new class{constructor(t){this.dC=t}isEnabled(){return!0}isResponsiveEnabled(){return!1}getConfigUrl(){const t=this.dC.dataset;return k(`${t.host||"https://tags.premiumads.com.br"}/autoads/${t.publisher}`,t.json?{"json":t.json}:{},4096)}filterConfig(t){return t}getAttributes(){const t=this.dC.dataset;return{"type":"doubleclick","data-ad":"premiumads","json":t.json||"","layout":t.layout||"fixed","style":t.style||"margin: 0 auto; position: relative !important; display: block !important;"}}getDefaultAdConstraints(){const t=I(this.dC).getSize().height;return{initialMinSpacing:t,subsequentMinSpacing:[{adCount:3,spacing:2*t},{adCount:6,spacing:3*t}],maxAdCount:8}}getSizing(){return{}}}(n):"wunderkind"==t?new class{constructor(t){this.dC=t}isEnabled(t){const n=this.dC.getAttribute("data-website-id");return!(!n||!n.match(/^[0-9]+$/))}isResponsiveEnabled(){return!0}getConfigUrl(){const t=S(this.dC);return k("https://api.bounceexchange.com/bounce/amp",{"w_id":this.dC.getAttribute("data-website-id"),"calling_url":t.sourceUrl},4096)}filterConfig(t){return t}getAttributes(){return{"type":"wunderkind","data-ad":"wunderkind","layout":"responsive","height":"75vw","width":"100vw"}}getDefaultAdConstraints(){return{initialMinSpacing:I(this.dC).getSize().height,subsequentMinSpacing:[],maxAdCount:10}}getSizing(){return{}}}(n):null}(t,this.element),v(this.lC,"No AdNetworkConfig for type: "+t),!this.lC.isEnabled(this.win))return;const n=this.getAmpDoc();R(this.win).installExtensionForDoc(n,"amp-ad"),this.fC=this.getAmpDoc().whenFirstVisible().then((()=>this.lC.filterConfig(this.gC(this.lC.getConfigUrl())))),this.pC()||this.mC()}isLayoutSupported(){return!0}layoutCallback(){return this.pC()?this.mC():s||(s=Promise.resolve(void 0))}gC(t){return(n=this.win,P(n,"xhr")).fetchJson(t,{mode:"cors",method:"GET",credentials:"omit"}).then((t=>t.json())).catch((t=>(this.user().error(F,"amp-auto-ads config xhr failed: "+t),null)));var n}pC(){return function(t,n){const i=function(t){var n,i,s,o,a;if(t[M])return t[M];t[M]=c();const u=t[M];h(u);const d=e(e({},null!==(n=t.AMP_CONFIG)&&void 0!==n?n:{}),null!==(i=t.AMP_EXP)&&void 0!==i?i:l((null===(s=t.__AMP_EXP)||void 0===s?void 0:s.textContent)||"{}"));for(const t in d){const n=d[t];"number"==typeof n&&n>=0&&n<=1&&(u[t]=Math.random()<n)}const f=null===(o=t.AMP_CONFIG)||void 0===o?void 0:o["allow-doc-opt-in"];if(r(f)&&f.length){const n=t.document.head.querySelector('meta[name="amp-experiments-opt-in"]');if(n){var p;const t=(null===(p=n.getAttribute("content"))||void 0===p?void 0:p.split(","))||[];for(const n of t)f.includes(n)&&(u[n]=!0)}}Object.assign(u,function(t){var n;let i="";try{var e;"localStorage"in t&&(i=null!==(e=t.localStorage.getItem("amp-experiment-toggles"))&&void 0!==e?e:"")}catch(t){}const s=(null===(n=i)||void 0===n?void 0:n.split(/\s*,\s*/g))||[],r=c();for(const t of s)t&&("-"==t[0]?r[t.substr(1)]=!1:r[t]=!0);return r}(t));const m=null===(a=t.AMP_CONFIG)||void 0===a?void 0:a["allow-url-opt-in"];if(r(m)&&m.length){const n=g(t.location.originalHash||t.location.hash);for(const t of m){const i=n[`e-${t}`];"1"==i&&(u[t]=!0),"0"==i&&(u[t]=!1)}}return u}(t);return!!i["auto-ads-layout-callback"]}(this.win)}mC(){const t=this.getAmpDoc();return this.fC.then((n=>{if(!n)return;const i=n.noConfigReason;i&&this.user().warn(F,i);const s=q(t,n),r=e(e({},this.lC.getAttributes()),T(n,j)),o=this.lC.getSizing(),a=function(t,n){const i=n.adConstraints;if(!i)return null;const e=I(t).getHeight(),s=$(i.initialMinSpacing,e);if(null==s)return null;const r=(i.subsequentMinSpacing||[]).map((t=>{const n=t.adCount;if(null==n)return null;const i=$(t.spacing,e);return null==i?null:{adCount:n,spacing:i}}));return-1!=r.indexOf(null)||null==i.maxAdCount?null:{initialMinSpacing:s,subsequentMinSpacing:r,maxAdCount:i.maxAdCount}}(t,n)||this.lC.getDefaultAdConstraints(),u=new class{constructor(t,n){this.AC=t,this.bC=n.initialMinSpacing,this.vC=n.subsequentMinSpacing.slice(0).sort(((t,n)=>t.adCount-n.adCount)),this.wC=n.maxAdCount,this.PC=this._C()}addAd(t){this.AC.push(t),this.PC=this._C()}getAdCount(){return this.AC.length}isMaxAdCountReached(){return this.getAdCount()>=this.wC}isTooNearAnAd(t){return this.yC(t,0)}yC(t,n){return n>=this.AC.length?Promise.resolve(!1):this.CC(t,this.AC[n]).then((i=>i<this.PC||this.yC(t,n+1)))}CC(t,n){return N(n).then((n=>t>=n.top&&t<=n.bottom?0:Math.min(Math.abs(t-n.top),Math.abs(t-n.bottom))))}_C(){const t=this.getAdCount();let n=this.bC;for(let i=0;i<this.vC.length;i++){const e=this.vC[i];e.adCount<=t&&(n=e.spacing)}return n}}(function(t){return[].slice.call(t.getRootNode().querySelectorAll("AMP-AD")).filter((t=>!t.parentElement||"AMP-STICKY-AD"!=t.parentElement.tagName))}(t),a);new class{constructor(t,n,i,e,s=!1){this.MC=t.slice(0),this.EC=n,this.SC=i,this.RC=e,this.IC=0,this.kC=s}run(){return this.RC.isMaxAdCountReached()?(t=()=>this.xC(),new Promise((n=>{n(t())}))):this.OC().then((t=>t?this.run():this.xC()));var t}xC(){return{adsPlaced:this.IC,totalAdsOnPage:this.RC.getAdCount()}}OC(){const t=this.MC.shift();return t?t.placeAd(this.EC,this.SC,this.RC,this.kC).then((n=>2==n?(this.RC.addAd(t.getAdElement()),this.IC++,!0):this.OC())):Promise.resolve(!1)}}(s,r,o,u,this.lC.isResponsiveEnabled()).run();const c=e(e({},r),T(n,"stickyAdAttributes"));new class{constructor(t,n,i){this.ampdoc=t,this.EC=n,this.jC=i}run(){return this.TC()?Promise.resolve(!1):this.VC()?("top"===this.EC.sticky?(R(this.ampdoc.win).installExtensionForDoc(this.ampdoc,"amp-ad","0.1"),this.DC()):(R(this.ampdoc.win).installExtensionForDoc(this.ampdoc,"amp-sticky-ad","1.0"),this.NC()),Promise.resolve(!0)):Promise.resolve(!1)}TC(){return!!this.ampdoc.getRootNode().querySelector("amp-sticky-ad, amp-ad[sticky]")}VC(){return m().assertArray(this.jC.optInStatus||[]).includes(2)}DC(){const t=I(this.ampdoc).getWidth(),n=e(e({},this.EC),{},{"width":String(t),"height":this.EC.height||"100"}),i=E(this.ampdoc.win.document,"amp-ad",n),s=this.ampdoc.getBody();s.insertBefore(i,s.firstChild)}NC(){const t=this.EC,n=I(this.ampdoc).getWidth(),i=e(e({},t),{},{"width":String(n),"height":t.height||"100"});delete i.sticky;const s=this.ampdoc.win.document,r=E(s,"amp-ad",i),o=E(s,"amp-sticky-ad",{"layout":"nodisplay"});o.appendChild(r);const a=this.ampdoc.getBody();a.insertBefore(o,a.firstChild)}}(t,c,n).run()}))}};t.registerElement(F,G)})();
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */}});
//# sourceMappingURL=amp-auto-ads-0.1.mjs.map