;
(self.AMP=self.AMP||[]).push({m:1,v:"2603032146000",n:"amp-consent",ev:"0.1",l:!0,f:function(t,n){(()=>{var n;function e(){return n||(n=Promise.resolve(void 0))}var i=class{constructor(){this.promise=new Promise(((t,n)=>{this.resolve=t,this.reject=n}))}},{isArray:s}=Array;function o(t,n){const e=t.length-n.length;return e>=0&&t.indexOf(n,e)==e}var r,{hasOwnProperty:h,toString:c}=Object.prototype;function a(t){return"[object Object]"===c.call(t)}function l(t){const n=Object.create(null);return t&&Object.assign(n,t),n}function u(t,n){return h.call(t,n)}function p(t,n,e=10){const i=[],s=[];for(s.push({t:t,s:n,d:0});s.length>0;){const{d:t,s:n,t:o}=s.shift();if(i.includes(n))throw new Error("Source object has a circular reference.");if(i.push(n),o!==n)if(t>e)Object.assign(o,n);else for(const e of Object.keys(n)){const i=n[e];if(u(o,e)){const n=o[e];if(a(i)&&a(n)){s.push({t:n,s:i,d:t+1});continue}}o[e]=i}}return t}function d(t,n,e,i,s,o,r,h,c,a,l){return t}function f(t,n){return t.replace(/^|,/g,`$&${n} `)}function m(t){d(/^[\w-]+$/.test(t))}var _=["Webkit","webkit","Moz","moz","ms","O","o"];function P(t){const n=t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()));return _.some((t=>n.startsWith(t+"-")))?`-${n}`:n}function g(t,n,e){if(n.startsWith("--"))return n;r||(r=l());let i=r[n];if(!i||e){if(i=n,void 0===t[n]){const e=function(t){return t.charAt(0).toUpperCase()+t.slice(1)}(n),s=function(t,n){for(let e=0;e<_.length;e++){const i=_[e]+n;if(void 0!==t[i])return i}return""}(t,e);void 0!==t[s]&&(i=s)}e||(r[n]=i)}return i}function v(t,n,e,i,s){const o=g(t.style,n,s);if(!o)return;const r=i?e+i:e;t.style.setProperty(P(o),r)}function A(t,n){for(const e in n)v(t,e,n[e])}function I(t,n){void 0===n&&(n=t.hasAttribute("hidden")),n?t.removeAttribute("hidden"):t.setAttribute("hidden","")}function b(t,n,e=5){if(!isFinite(e)||e<0)throw new Error("Invalid depth: "+e);if(t===n)return!0;const i=[{a:t,b:n,depth:e}];for(;i.length>0;){const{a:t,b:n,depth:e}=i.shift();if(e>0){if(typeof t!=typeof n)return!1;if(s(t)&&s(n)){if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++)i.push({a:t[s],b:n[s],depth:e-1});continue}if(t&&n&&"object"==typeof t&&"object"==typeof n){const s=Object.keys(t),o=Object.keys(n);if(s.length!==o.length)return!1;for(const o of s)i.push({a:t[o],b:n[o],depth:e-1});continue}}if(t!==n)return!1}return!0}function y(t){var n;null===(n=t.parentElement)||void 0===n||n.removeChild(t)}function R(t,n){t.insertBefore(n,t.firstChild)}function E(t){try{t.focus()}catch(t){}}var M=/(?:^[#?]?|&)([^=&]+)(?:=([^&]*))?/g;function C(t,n=""){try{return decodeURIComponent(t)}catch(t){return n}}function T(t){const n=l();if(!t)return n;let e;for(;e=M.exec(t);){const t=C(e[1],e[1]),i=e[2]?C(e[2].replace(/\+/g," "),e[2]):"";n[t]=i}return n}function w(t){const{location:n}=t||self;return T(n.originalHash||n.hash)}var V="";function k(t){var n;return V||(V=(null===(n=t.AMP_CONFIG)||void 0===n?void 0:n.v)||"012603032146000"),V}function S(t,n){const e=n||w(t);return["1","actions","amp","amp4ads","amp4email"].includes(e.development)||!!t.AMP_DEV_MODE}self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:null};var O=self.__AMP_LOG;function x(t,n){throw new Error("failed to call initLogConstructor")}function U(t){return O.user||(O.user=j()),function(t,n){return n&&n.ownerDocument.defaultView!=t}(O.user.win,t)?O.userForEmbed||(O.userForEmbed=j()):O.user}function j(t){return x()}function D(){return O.dev||(O.dev=x())}function N(t,n,e,i,s,o,r,h,c,a,l){return t}function L(t,n,e,i,s,o,r,h,c,a,l){return U().assert(t,n,e,i,s,o,r,h,c,a,l)}function H(t,n){return W(t=function(t){return t.__AMP_TOP||(t.__AMP_TOP=t)}(t),n)}function F(t,n){return W(z(B(t)),n)}function q(t,n){const e=z(B(t));return Q(e,n)?W(e,n):null}function G(t,n){return function(t,n){const e=J(t,n);if(e)return e;const s=K(t);return s[n]=function(){const t=new i,{promise:n,reject:e,resolve:s}=t;return n.catch((()=>{})),{obj:null,promise:n,resolve:s,reject:e,context:null,ctor:null}}(),s[n].promise}(z(t),n)}function $(t,n){return J(z(t),n)}function B(t){return t.nodeType?(e=t,n=(e.ownerDocument||e).defaultView,H(n,"ampdoc")).getAmpDoc(t):t;var n,e}function z(t){const n=B(t);return n.isSingleDoc()?n.win:n}function W(t,n){N(Q(t,n));const e=K(t)[n];return e.obj||(N(e.ctor),N(e.context),e.obj=new e.ctor(e.context),N(e.obj),e.context=null,e.resolve&&e.resolve(e.obj)),e.obj}function J(t,n){const e=K(t)[n];return e?e.promise?e.promise:(W(t,n),e.promise=Promise.resolve(e.obj)):null}function K(t){let n=t.__AMP_SERVICES;return n||(n=t.__AMP_SERVICES={}),n}function Q(t,n){const e=t.__AMP_SERVICES&&t.__AMP_SERVICES[n];return!(!e||!e.ctor)}var Y=t=>F(t,"owners"),Z=t=>q(t,"url-replace"),X=t=>H(t,"xhr"),tt="notificationUIManager";function nt(t){return t.data}function et(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function it(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,i)}return e}function st(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?it(Object(e),!0).forEach((function(n){et(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):it(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}var ot={};function rt(t){const n=new Uint8Array(t.length);for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);d(i<=255),n[e]=i}return n}function ht(t){const n=new Array(t.length);for(let e=0;e<t.length;e++)n[e]=String.fromCharCode(t[e]);return n.join("")}ot.appconsent={"consentInstanceId":"appconsent","checkConsentHref":"https://collector.appconsent.io/amp/check-consent","promptUISrc":"https://cdn.appconsent.io/loader.html"},ot.ConsentManager={"consentInstanceId":"ConsentManager","checkConsentHref":"https://delivery.consentmanager.net/delivery/ampcheck.php","promptUISrc":"https://delivery.consentmanager.net/delivery/ampui.php"},ot.didomi={"consentInstanceId":"didomi","checkConsentHref":"https://api.privacy-center.org/amp/check-consent","promptUISrc":"https://sdk-amp.privacy-center.org/loader.html"},ot.iubenda={"consentInstanceId":"iubenda","checkConsentHref":"https://amp.iubenda.com/checkConsent","promptUISrc":"https://www.iubenda.com/en/help/22135-cookie-solution-amp"},ot.sirdata={"consentInstanceId":"sirdata","checkConsentHref":"https://choices.consentframework.com/api/v1/public/amp/check","promptUISrc":"https://ui.consentframework.com/amp/loader.html"},ot.Marfeel={"consentInstanceId":"Marfeel","checkConsentHref":"https://live.mrf.io/cmp/marfeel/amp/check-consent","promptUISrc":"https://live.mrf.io/cmp/marfeel/amp/index.html"},ot.Ogury={"consentInstanceId":"Ogury","checkConsentHref":"https://api.ogury.mgr.consensu.org/v1/check-for-consent","promptUISrc":"https://www.ogury.mgr.consensu.org/amp.html"},ot.onetrust={"consentInstanceId":"onetrust","checkConsentHref":"https://cdn.cookielaw.org/amp/consent/check","promptUISrc":" https://amp.onetrust.mgr.consensu.org/"},ot.opencmp={"consentInstanceId":"opencmp","checkConsentHref":"https://amp.opencmp.net/consent/check","promptUISrc":"https://cdn.opencmp.net/tcf-v2/amp/cmp.html"},ot.pubtech={"consentInstanceId":"pubtech","checkConsentHref":"https://amp.pubtech.it/cmp-amp-check-consent","promptUISrc":"https://cdn.pubtech.ai/amp/index.html"},ot.quantcast={"consentInstanceId":"quantcast","checkConsentHref":"https://apis.quantcast.mgr.consensu.org/amp/check-consent","promptUISrc":"https://quantcast.mgr.consensu.org/tcfv2/amp.html"},ot.SourcePoint={"consentInstanceId":"SourcePoint","checkConsentHref":"https://sourcepoint.mgr.consensu.org/consent/v2/amp","promptUISrc":"https://amp.pm.sourcepoint.mgr.consensu.org/"},ot.UniConsent={"consentInstanceId":"UniConsent","checkConsentHref":"https://edge.uniconsent.com/amp/check-consent","promptUISrc":"https://cmp.uniconsent.com/amp/index.html"},ot.Usercentrics={"consentInstanceId":"Usercentrics","checkConsentHref":"https://consents.usercentrics.eu/amp/checkConsent","promptUISrc":"https://amp.usercentrics.eu/amp.html"},ot.LiveRamp={"consentInstanceId":"LiveRamp","checkConsentHref":"https://api.privacymanager.io/amp/check-consent","promptUISrc":"https://amp-consent-tool.privacymanager.io/1/index.html"},ot.googlefc={"consentInstanceId":"googlefc","checkConsentHref":"https://fundingchoicesmessages.google.com/amp/consent/check?pvid=PAGE_VIEW_ID_64&anonid=CONSENT_PAGE_VIEW_ID_64&href=SOURCE_URL","promptUISrc":"https://fundingchoicesmessages.google.com/amp/consent/message?pvid=PAGE_VIEW_ID_64&anonid=CONSENT_PAGE_VIEW_ID_64&href=SOURCE_URL&clientConfig=CONSENT_INFO(clientConfig)","xssiPrefix":")]}'","uiConfig":{"overlay":!0},"clearDirtyBitOnResponse_dontUseThisItMightBeRemoved":!0};var ct,at={"-":"+","_":"/",".":"="},lt={"+":"-","/":"_","=":"."},ut=(()=>self.AMP.config.urls)(),pt=new Set(["c","v","a","ad"]),dt=t=>"string"==typeof t?ft(t):t;function ft(t,n){return ct||(ct=self.document.createElement("a")),function(t,n,e){return t.href="",new URL(n,t.href)}(ct,t)}function mt(t,n,e="source"){var i;return L(null!=t,"%s %s must be available",n,e),L("https:"==(i=dt(i=t)).protocol||"localhost"==i.hostname||"127.0.0.1"==i.hostname||o(i.hostname,".localhost")||/^\/\//.test(t),'%s %s must start with "https://" or "//" or be relative and served from either https or from localhost. Invalid value: %s',n,e,t),t}function _t(t){return ut.cdnProxyRegex.test(dt(t).origin)}function Pt(t){if(!_t(t=dt(t)))return t.href;const n=t.pathname.split("/"),e=n[1];L(pt.has(e),"Unknown path prefix in url %s",t.href);const i=n[2],s="s"==i?"https://"+decodeURIComponent(n[3]):"http://"+decodeURIComponent(i);return L(s.indexOf(".")>0,"Expected a . in origin %s",s),n.splice(1,"s"==i?3:2),s+n.join("/")+function(t,n){if(!t||"?"==t)return"";const e=new RegExp("[?&](amp_(js[^&=]*|gsa|r|kit)|usqp)\\b[^&]*","g"),i=t.replace(e,"").replace(/^[?&]/,"");return i?"?"+i:""}(t.search)+(t.hash||"")}var gt=class{static getTop(t){return t.top}static getLocation(t){return t.location}static getDocumentReferrer(t){return t.document.referrer}static getHostname(t){return t.location.hostname}static getUserAgent(t){return t.navigator.userAgent}static getUserLanguage(t){return t.navigator.userLanguage||t.navigator.language}static getDevicePixelRatio(){return self.devicePixelRatio||1}static getSendBeacon(t){if(t.navigator.sendBeacon)return t.navigator.sendBeacon.bind(t.navigator)}static getXMLHttpRequest(t){return t.XMLHttpRequest}static getImage(t){return t.Image}},vt=(()=>self.AMP.config.urls)(),At="-test-amp-cookie-tmp";function It(t,n){const e=function(t){try{return t.document.cookie}catch(t){return""}}(t);if(!e)return null;const i=e.split(";");for(let t=0;t<i.length;t++){const e=i[t].trim(),s=e.indexOf("=");if(-1!=s&&C(e.substring(0,s).trim())==n){const t=e.substring(s+1).trim();return C(t,t)}}return null}function bt(t,n,e,i,s,o,r){"ampproject.org"==s&&(e="delete",i=0);const h=encodeURIComponent(n)+"="+encodeURIComponent(e)+"; path=/"+(s?"; domain="+s:"")+"; expires="+new Date(i).toUTCString()+function(t,n){return n?`; SameSite=${n}`:""}(0,o)+(r?"; Secure":"");try{t.document.cookie=h}catch(t){}}var yt=31536e6;var Rt="removeEventListener";function Et(t){return!!t&&!(!u(t,"isDirty")||1!=t.isDirty)}function Mt(t){return 1==t||2!=t&&null}function Ct(t,n,e){if(!t&&!n)return!0;if(t&&n){const i=Mt(t.consentState)===Mt(n.consentState),s=(t.consentString||"")===(n.consentString||"");let o;o=e?!!t.isDirty==!!e:!!t.isDirty==!!n.isDirty;const r=b(t.consentMetadata,n.consentMetadata),h=b(t.purposeConsents,n.purposeConsents),c=t.tcfPolicyVersion==n.tcfPolicyVersion;return i&&s&&r&&h&&o&&c}return!1}function Tt(t,n,e,i,s,o){return{"consentState":t,"consentString":n,"consentMetadata":e,"purposeConsents":i,"isDirty":s,"tcfPolicyVersion":o}}function wt(t,n,e,i,s){return{"consentStringType":t,"additionalConsent":n,"gdprApplies":e,"purposeOne":i,"gppSectionId":s}}function Vt(t){return!0===t||1===t?1:!1===t||0===t?2:5}function kt(t){return!!t.consentString||1===t.consentState||2===t.consentState}function St(t){return 1===t?"accepted":2===t?"rejected":"unknown"}var Ot="CONSENT-STATE-MANAGER";function xt(t){return G(t,"consentStateManager")}var Ut="amp-consent/consent-config",jt="amp-story-consent",Dt={"promptUI":!0,"checkConsentHref":!0,"promptIfUnknownForGeoGroup":!0,"onUpdateHref":!0},Nt={"CANONICAL_URL":!0,"PAGE_VIEW_ID":!0,"PAGE_VIEW_ID_64":!0,"SOURCE_URL":!0};function Lt(t,n,e){const i=st({"CLIENT_ID":Ht(t),"CONSENT_PAGE_VIEW_ID_64":()=>xt(t).then((t=>t.consentPageViewId64()))},e);return Z(t).expandUrlAsync(n,i,st(st({},i),Nt))}function Ht(t){return(n=t,G(n,"cid")).then((t=>t.get({scope:"AMP-CONSENT",createCookieIfNotPresent:!0},e())));var n}var Ft,qt="consent-policy-manager",Gt={"default":!0,"_till_responded":!0,"_till_accepted":!0,"_auto_reject":!0};function $t(t){const n=t.tagName;return n.startsWith("AMP-")&&!("AMP-STICKY-AD-TOP-PADDING"==n||"AMP-BODY"==n)}function Bt(t){return function(t,n){if(d(1===n.length),d(Array.isArray(n)||u(n,"raw")),self.trustedTypes&&self.trustedTypes.createPolicy){const e=self.trustedTypes.createPolicy("static-template#createNode",{createHTML:function(t){return n[0]}});t.innerHTML=e.createHTML("ignored")}else t.innerHTML=n[0];const e=t.firstElementChild;return d(e),d(!e.nextElementSibling),t.removeChild(e),e}(Ft,t)}var zt=['<svg viewBox="0 0 40 40"><defs><linearGradient id=grad><stop stop-color="rgb(105, 105, 105)"></stop><stop offset=100% stop-color="rgb(105, 105, 105)" stop-opacity=0></stop></linearGradient></defs><path d="M11,4.4 A18,18, 0,1,0, 38,20" stroke=url(#grad)></path></svg>'],Wt="amp-consent-ui",Jt=["allow-popups-to-escape-sandbox","allow-top-navigation-by-user-activation"],Kt=["geolocation","payment"],Qt="i-amphtml-consent-ui-iframe-fullscreen",Yt="i-amphtml-consent-ui-iframe-active",Zt="i-amphtml-consent-ui-modal",Xt="i-amphtml-consent-ui-in",tn="i-amphtml-consent-ui-loading",nn="i-amphtml-consent-ui-border-enabled",en=class{constructor(t,n,e){this.S1=t,this.ont=!1,this.hnt=!1,this.ps=!1,this.cnt=!1,this.AP=!1,this.ant=null,this.lnt=n.uiConfig&&!0===n.uiConfig.overlay,this.unt=n.captions&&n.captions.consentPromptCaption||"User Consent Prompt",this.pnt=n.captions&&n.captions.buttonActionCaption||"Focus Prompt",this.dnt=!1,this.fnt=!0,this.Iz=null,this.mnt=null,this._nt=null,this.ji=t.getAmpDoc(),this.Al=F(this.ji,"viewport"),this.Qe=(t=>F(this.ji,"viewer"))(),this.si=t.element,this.i=t.win,this.Co=this.i.document,this.Pnt=null,this.mA=!1,this.gnt=null,this.tb=null,this.vnt="30vh",this.Ant=!0,this.Int=!1,this.bnt=!1,this.ynt=this.Rnt.bind(this),this.lk=n,this.Yu(n,e)}Yu(t,n){if(n){const t=this.ji.getElementById(n);return t||U().error(Wt,"postPromptUI element with id=%s not found",n),this.ant=t,void(this.hnt=!0)}const e=t.promptUI,i=t.promptUISrc;if(e){const t=this.ji.getElementById(e);t&&this.si.contains(t)||U().error(Wt,"child element of <amp-consent> with promptUI id %s not found",e),this.ant=t}else i&&(this.ont=!0,mt(i,this.si),this.ant=this.Ent(i),this.tb=this.Mnt(),this.gnt=t.clientConfig||null)}show(t){if(!this.ant)return;if(this.hnt&&!this.si.contains(this.ant))return void I(this.ant,!0);I(this.si,!0);const{classList:n}=this.si;if(n.add("amp-active"),n.remove("amp-hidden"),this.S1.getViewport().addToFixedLayer(this.si,!0),this.ont)this.bnt=t,this.Cnt().then((()=>{this.S1.mutateElement((()=>{this.hnt||(this._nt=this.Co.activeElement),this.Tnt(),this.wnt(),this.Vnt()}))}));else{const t=()=>{this.ant&&(I(this.ant,!0),this.hnt||(this._nt=this.Co.activeElement,this.Tnt(),this.resume(),this.ant.focus()))};$t(this.ant)?function(t){if(d($t(t)),t.createdCallback)return Promise.resolve(t);if(!t.__AMP_UPG_PRM){const n=new i;t.__AMP_UPG_PRM=n.promise,t.__AMP_UPG_RES=n.resolve}const n=t.__AMP_UPG_PRM;return d(n),n}(this.ant).then((()=>this.ant.build())).then((()=>t())):t()}this.ps=!0}hide(){this.ant&&(this.pause(),this.S1.mutateElement((()=>{if(this.ont&&this.knt(),!this.hnt){const{classList:t}=this.si;t.remove("amp-active"),t.add("amp-hidden")}this.Snt(),this.Ont(),this.xnt(),this.Unt(),this.S1.getViewport().removeFromFixedLayer(this.si),I(this.ant,!1),this.ps=!1,this._nt?(this._nt.focus(),this._nt=null):this.i.document.body.children.length>0&&this.i.document.body.children[0].focus()})))}pause(){this.ant&&Y(this.S1.element).schedulePause(this.S1.element,this.ant)}resume(){this.ant&&(Y(this.S1.element).scheduleLayout(this.S1.element,this.ant),Y(this.S1.element).scheduleResume(this.S1.element,this.ant))}jnt(t){if(this.vnt="30vh",this.Ant=!0,this.Int=!1,t.initialHeight)if("string"==typeof t.initialHeight&&t.initialHeight.indexOf("vh")>=0){const n=parseInt(t.initialHeight,10);this.vnt=n>=80?"80vh":this.vnt,n>=10&&n<=80?(this.vnt=`${n}vh`,this.Int=n>60,this.lnt=this.Int||this.lnt):U().error(Wt,`Inavlid initial height: ${t.initialHeight}.Minimum: 10vh. Maximum: 80vh.`)}else U().error(Wt,`Inavlid initial height: ${t.initialHeight}.Must be a string in "vh" units.`);!1!==t.border||this.Int||(this.Ant=!1),this.Pnt.resolve()}Dnt(){if(!this.ant||!this.ps||this.AP)return;this.Unt(),this.Nnt("requestFullOverlay");const{classList:t}=this.si;t.add(Qt),this.a1(),this.AP=!0}Nnt(t){this.Qe.sendMessage(t,{},!0)}Ent(t){const n=this.si.ownerDocument.createElement("iframe"),e=this.Lnt(t);n.setAttribute("title",this.si.title||"Consent Banner"),n.setAttribute("sandbox",e),n.setAttribute("allow",Kt.join("; "));const{classList:i}=n;return i.add("i-amphtml-consent-ui-fill"),n}Lnt(t){const n=["allow-scripts","allow-popups"];this.Hnt(t)&&n.push("allow-same-origin");const e=this.Fnt();return Array.prototype.push.apply(n,e),n.join(" ")}Hnt(t){const n=q(this.si,"url"),e=n.parse(t),i=n.parse(this.ji.getUrl());return e.origin!=i.origin}Fnt(){return(this.lk.sandbox||"").split(" ").filter(Boolean).filter((t=>{const n=-1!==Jt.indexOf(t);return n||U().error(Wt,`The sandbox attribute "${t}" is not allowed`),n}))}Mnt(){const t=this.si.ownerDocument.createElement("placeholder");I(t,!1),t.classList.add("i-amphtml-consent-ui-placeholder");const n=function(t){const n=t.ownerDocument||t;return Ft&&Ft.ownerDocument===n||(Ft=n.createElement("div")),Bt}(t)(zt);return t.appendChild(n),t}qnt(){return xt(this.ji).then((t=>t.getLastConsentInstanceInfo().then((t=>({"clientConfig":this.gnt,"consentState":St(t.consentState),"consentStateValue":St(t.consentState),"tcfPolicyVersion":t.tcfPolicyVersion,"consentMetadata":t.consentMetadata,"consentString":t.consentString,"promptTrigger":this.bnt?"action":"load","isDirty":!!t.isDirty,"purposeConsents":t.purposeConsents})))))}Cnt(){this.Pnt=new i;const{classList:t}=this.si;var n;n=this.si,m("placeholder"),n.querySelector("placeholder")||R(this.si,this.tb),t.add(tn),I(this.ant,!1),this.mA=!1;const e=this.qnt().then((t=>Lt(this.si,this.lk.promptUISrc,{"CONSENT_INFO":n=>JSON.stringify(t[n])}).then((n=>{this.ant.src=n,this.ant.setAttribute("name",JSON.stringify(t)),this.i.addEventListener("message",this.ynt),R(this.si,this.ant)}))));return Promise.all([e,this.Pnt.promise,this.S1.mutateElement((()=>{I(this.tb,!0)}))])}Vnt(){const{classList:t}=this.si;t.add(Yt),I(this.tb,!1),I(this.ant,!0),this.Int&&(t.add(Zt),E(this.ant)),this.Unt(),this.S1.mutateElement((()=>{t.remove(tn),this.S1.mutateElement((()=>{t.add(Xt),this.cnt=!0,this.Gnt()}))}))}knt(){const{classList:t}=this.si;t.remove(Yt),t.remove(Zt),t.remove(nn),this.i.removeEventListener("message",this.ynt),t.remove(Qt),this.AP?this.Nnt("cancelFullOverlay"):this.Int&&this.Al.leaveLightboxMode(),this.AP=!1,t.remove(Xt),this.cnt=!1,this.ant.removeAttribute("name"),I(this.tb,!1),this.mA=!0,this.i.setTimeout((()=>{this.mA&&y(this.ant)}),1e3)}wnt(){if(this.dnt||this.Int)return;const t=this.Co.createElement("div"),n=this.Co.createElement("button"),e=this.Co.createElement("div");t.setAttribute("role","alertdialog"),e.textContent=this.unt,n.textContent=this.pnt,n.onclick=()=>{E(this.ant)},t.appendChild(e),t.appendChild(n);const{classList:i}=t;i.add("i-amphtml-consent-alertdialog"),this.S1.element.appendChild(t),E(n),this.dnt=!0,this.mnt=t}Ont(){this.mnt&&(y(this.mnt),delete this.mnt)}Unt(){A(this.si,{transform:"",transition:""})}Gnt(){const{classList:t}=this.si;this.ant&&A(this.ant,{height:this.vnt}),function(t,n){const{style:e}=t;for(const t in n)e.setProperty(P(g(e,t)),String(n[t]),"important")}(this.si,{"--i-amphtml-modal-height":`${this.vnt}`}),t.add("i-amphtml-consent-ui-iframe-transform"),(this.Ant||this.Int)&&t.add(nn),this.Int&&this.Al.enterLightboxMode()}Tnt(){if(this.lnt){if(!this.Iz){const t=this.i.document.createElement("div");t.classList.add("i-amphtml-consent-ui-mask"),this.si.ownerDocument.body.appendChild(t),this.Iz=t}I(this.Iz,!0),this.a1()}}Snt(){this.lnt&&(this.Iz&&I(this.Iz,!1),this.xnt())}a1(){this.fnt&&(this.Al.enterOverlayMode(),this.fnt=!1)}xnt(){this.fnt||(this.Al.leaveOverlayMode(),this.fnt=!0)}Rnt(t){if(this.ant.contentWindow!==t.source)return;const n=nt(t);if(!n||"consent-ui"!=n.type)return;const e=n.action,i=n.type;if("ready"===e&&this.jnt(n),"enter-fullscreen"===e){if(!this.cnt||this.Int||this.Co.activeElement!==this.ant&&!this.bnt)return void this.$nt(i,e,!0);this.$nt(i,e),this.S1.mutateElement((()=>{this.Dnt()}))}}$nt(t,n,e=!1){this.Bnt("amp-consent-response",t,n,e?"error":"success",e?"Could not enter fullscreen. Fullscreen is only supported when the iframe is visible as a bottom sheet and after user interaction.":"Entering fullscreen.")}Bnt(t,n,e,i,s){const o=this.ant.contentWindow;o&&o.postMessage({type:t,requestType:n,requestAction:e,state:i,info:s},"*")}},sn=null,on="*",rn=/^[a-zA-Z0-9\-_.]+$/,hn="amp-analytics/linker";function cn(t,n){const e=n||0;return function(t){sn||(sn=function(){const t=new Array(256);for(let n=0;n<256;n++){let e=n;for(let t=0;t<8;t++)1&e?e=e>>>1^3988292384:e>>>=1;t[n]=e}return t}());const n=(e=t,"undefined"!=typeof TextEncoder?(new TextEncoder).encode(e):rt(unescape(encodeURIComponent(e))));var e;let i=-1>>>0;for(let t=0;t<n.length;t++){const e=255&(i^n[t]);i=i>>>8^sn[e]}return(-1^i)>>>0}([function(){const t=(new Date).getTimezoneOffset(),n=gt.getUserLanguage(window);return[gt.getUserAgent(window),t,n].join(on)}(),Math.floor(Date.now()/6e4)-e,t].join(on)).toString(36)}function an(t){return function(t){const n=function(t){return rt(atob(t.replace(/[-_.]/g,(t=>at[t]))))}(t);return function(t){if("undefined"!=typeof TextDecoder)return new TextDecoder("utf-8").decode(t);const n=ht(new Uint8Array(t.buffer||t));return decodeURIComponent(escape(n))}(n)}(String(t))}var ln="amp-consent/cookie-writer",un={"referrerDomains":!0,"enabled":!0,"cookiePath":!0,"cookieMaxAge":!0,"cookieSecure":!0,"cookieDomain":!0},pn={"LINKER_PARAM":!0},dn="amp-consent",fn="loaded",mn=t=>"accept"===t||"reject"===t||"dismiss"===t,_n="consentStateManager",Pn="consentPolicyManager",gn="amp-consent",vn="accept",An="reject",In="dismiss",bn=class extends t.BaseElement{constructor(t){super(t),this.znt=null,this.Wnt=null,this.Jnt=null,this.Knt=null,this.Qnt=null,this.hM=null,this.Ynt=null,this.Znt=null,this.Xnt=null,this.tet=!1,this.net=!1,this.eet=!1,this.Gr=this.getVsync(),this.iet=null,this.oet=null,this.ret=null,this.het=null}getConsentPolicy(){return null}buildCallback(){L(this.element.getAttribute("id"),"amp-consent should have an id");const t=new class{constructor(t){this.el=t,this.ret=null,this.fC=null}getConsentConfigPromise(){return this.fC||(this.fC=this.cet()),this.fC}getMatchedGeoGroup(){return this.ret}aet(t){const n=t.consents;if(!t.consents)return t;const e=Object.keys(n);if(L(e.length<=1,"%s: only single consent instance is supported",Ut),e.length>0){t.consentInstanceId=e[0];const n=t.consents[e[0]],i=Object.keys(n);for(let e=0;e<i.length;e++){const s=i[e];!t[s]&&Dt[s]&&(t[i[e]]=n[i[e]])}}return delete t.consents,t}cet(){const t=this.aet(L(this.Ltt(),"%s: Inline config not found")),n=p(this.let()||{},t||{},1);if(L(n.consentInstanceId,"%s: consentInstanceId to store consent info is required",Ut),n.policy){const t=Object.keys(n.policy);for(let e=0;e<t.length;e++)"default"!=t[e]&&delete n.policy[t[e]]}const e=n.promptIfUnknownForGeoGroup;return"string"==typeof e?(n.consentRequired=!1,n.geoOverride={[e]:{"consentRequired":!0}}):void 0===n.consentRequired&&n.checkConsentHref&&(n.consentRequired="remote"),this.uet(n).then((t=>this.pet(t))).then((t=>this.det(t)))}uet(t){return t.geoOverride?(n=this.el,function(t,n,e,i){const s=$(t,n);if(s)return s;const o=B(t);return o.whenExtensionsKnown().then((()=>{const t=o.getExtensionVersion(e);return t?H(o.win,"extensions").waitForExtension(e,t):null})).then((e=>e?$(t,n):null))}(n,"geo","amp-geo")).then((n=>{L(n,"%s: requires <amp-geo> to use `geoOverride`",Ut);const e=l(t),i=Object.keys(t.geoOverride);for(let s=0;s<i.length;s++)if(2===n.isInCountryGroup(i[s])){const n=t.geoOverride[i[s]];u(n,"consentInstanceId")&&(U().error(Ut,"consentInstanceId cannot be overriden in geoGroup:",i[s]),delete n.consentInstanceId),p(e,n,1),this.ret=i[s];break}return delete e.geoOverride,e})):Promise.resolve(t);var n}pet(t){const n=t.consentRequired;return L("boolean"==typeof n||"remote"===n,"`consentRequired` is required",Ut),"remote"===n&&L(t.checkConsentHref,"%s: `checkConsentHref` must be specified if `consentRequired` is remote",Ut),t}det(t){return n=this.el,m(jt),"> amp-story-consent",n.querySelector(f("> amp-story-consent",":scope"))&&L(!t.promptUISrc,"%s: `promptUiSrc` cannot be specified while using %s.",Ut,jt),t;var n}Ltt(){try{return function(t){const n=(i=t,m("script"),i.querySelectorAll(f("> script",":scope"))),{length:e}=n;var i;if(1!==e)throw new Error(`Found ${e} <script> children. Expected 1.`);const s=n[0];if(!function(t){var n;return"SCRIPT"==t.tagName&&"APPLICATION/JSON"==(null===(n=t.getAttribute("type"))||void 0===n?void 0:n.toUpperCase())}(s))throw new Error('<script> child must have type="application/json"');try{var o;return r=null!==(o=s.textContent)&&void 0!==o?o:"",JSON.parse(r)}catch(t){throw new Error("Failed to parse <script> contents. Is it valid JSON?")}var r}(this.el)}catch(t){throw U(this.el).createError(Ut,t)}}let(){const t=this.el.getAttribute("type");if(!t)return null;L(ot[t],"%s: invalid CMP type %s",Ut,t);const n=ot[t];return this.fet(n),n}fet(t){const n=["consentInstanceId","checkConsentHref","promptUISrc"];for(let e=0;e<n.length;e++)N(t[n[e]])}}(this.element);return t.getConsentConfigPromise().then((n=>{this.ret=t.getMatchedGeoGroup(),this.Me(n)}))}pauseCallback(){this.Qnt&&this.Qnt.pause()}resumeCallback(){this.Qnt&&this.Qnt.resume()}Me(t){this.hM=t,this.oet=this.hM.consentInstanceId,this.hM.postPromptUI&&(this.Znt=new en(this,{},this.hM.postPromptUI));const n=this.hM.policy||{};this.Ynt=function(t,n){const e={};e[n]=void 0;const i={"waitFor":e},s=[4,1,2,3],o={"waitFor":e,"unblockOn":s},r={"waitFor":e,"timeout":{"seconds":0,"fallbackAction":"reject"},"unblockOn":s};return t._till_responded=o,t._till_accepted=i,t._auto_reject=r,t&&t.default||(t.default=i),t}(n,this.oet);const i=function(t,n){const e=[];for(let n=t.firstElementChild;n;n=n.nextElementSibling)!(function(t){let n;var e;return"string"==typeof t?n=t:1==(null==(e=t)?void 0:e.nodeType)&&(n=t.tagName),!!n&&n.toLowerCase().startsWith("i-")}(i=n)||i.nodeType===Node.ELEMENT_NODE&&(i.hasAttribute("placeholder")||i.hasAttribute("fallback")||i.hasAttribute("overflow")))&&e.push(n);var i;return e}(this.element);for(let t=0;t<i.length;t++){const n=i[t];I(n,!1),Y(this.element).setOwner(n,this.element)}const s=G(this.getAmpDoc(),Pn).then((t=>{this.Wnt=t,this.Wnt.setLegacyConsentInstanceId(this.oet);const n=Object.keys(this.Ynt);for(let t=0;t<n.length;t++)this.Wnt.registerConsentPolicyInstance(n[t],this.Ynt[n[t]])})),r=G(this.getAmpDoc(),_n).then((t=>{t.registerConsentInstance(this.oet,this.hM),this.znt=t})),h=G(this.getAmpDoc(),tt).then((t=>{this.Knt=t})),c=this.hM.cookies?new class{constructor(t,n,e){this.i=t,this.el=n,this.met=null,this.lk=e,this._et=new class{constructor(t){this.i=t,this.Pet={}}get(t,n){return t&&n?(u(this.Pet,t)||(this.Pet[t]=this.vet(t)),this.Pet[t]&&this.Pet[t][n]?this.Pet[t][n]:null):(U().error("amp-consent/linker-reader","LINKER_PARAM requires two params, name and id"),null)}vet(t){const n=T(this.i.location.search);return u(n,t)?function(t){const n=function(t){const n=t.split(on),e=n.length%2==0;if(n.length<4||!e)return U().error(hn,`Invalid linker_param value ${t}`),null;const i=Number(n.shift());return 1!==i?(U().error(hn,`Invalid version number ${i}`),null):{checksum:n.shift(),serializedIds:n.join(on)}}(t);if(!n)return null;const{checksum:e,serializedIds:i}=n;return function(t,n){for(let e=0;e<=1;e++)if(cn(t,e)==n)return!0;return!1}(i,e)?function(t){const n={},e=t.split(on);for(let t=0;t<e.length;t+=2){const i=e[t];if(!rn.test(i)){U().error(hn,`Invalid linker key ${i}, value ignored`);continue}const s=an(e[t+1]);n[i]=s}return n}(i):(U().error(hn,"LINKER_PARAM value checksum not valid"),null)}(n[t]):null}}(t)}write(){return this.met||(this.met=this.Yu()),this.met}Yu(){if(!this.Aet(this.i,this.el))return e();if(!u(this.lk,"cookies"))return e();if(!a(this.lk.cookies))return U().error(ln,"cookies config must be an object"),e();const t=this.lk.cookies;if(!1===t.enabled)return e();const n=this.Iet(t),i=Object.keys(t),s=[];for(let e=0;e<i.length;e++){const o=i[e],r=t[o];this.bet(o,r)&&s.push(this.yet(o,r.value,n))}return Promise.all(s)}Iet(t){if(!u(t,"cookieMaxAge"))return yt;const n=Number(t.cookieMaxAge);return n||0===n?1e3*n:(U().error(ln,"invalid cookieMaxAge %s, falling back to default value (1 year)",t.cookieMaxAge),yt)}bet(t,n){return!(un[t]||(a(n)?!u(n,"value")&&(U().error(ln,"value is required in the cookieValue object"),1):(U().error(ln,"cookieValue must be configured in an object"),1)))}yet(t,n,e){return Z(this.el).expandStringAsync(n,{"LINKER_PARAM":(t,n)=>this._et.get(t,n)},pn).then((n=>{if(n){const i=Date.now()+e;!function(t,n,e,i,s={}){let r;!function(t,n,e){if(n.allowOnProxyOrigin)return void L(!n.highestAvailableDomain,"Could not support highestAvailable Domain on proxy origin, specify domain explicitly");L(!_t(t.location.href),`Should never attempt to set cookie on proxy origin: ${e}`);const i=ft(t.location.href).hostname.toLowerCase(),s=ft(vt.cdn).hostname.toLowerCase();L(!(i==s||o(i,"."+s)),"Should never attempt to set cookie on proxy origin. (in depth check): "+e)}(t,s,n),s.domain?r=s.domain:s.highestAvailableDomain&&(r=function(t){const n=t.document.head&&t.document.head.querySelector("meta[name='amp-cookie-scope']");if(n){const e=n.getAttribute("content")||"",i=ft(Pt(t.location.href)).origin;return o(i,"."+e)?e:i.split("://")[1]}if(!_t(t.location.href)){const n=t.location.hostname.split(".");let e=n[n.length-1];const i=function(t){let n=At,e=0;for(;It(t,n);)n=At+e++;return n}(t);for(let s=n.length-2;s>=0;s--)if(e=n[s]+"."+e,bt(t,i,"delete",Date.now()+1e3,e),"delete"==It(t,i))return bt(t,i,"delete",Date.now()-1e3,e),e}return null}(t)),bt(t,n,e,i,r,s.sameSite,s.secure)}(this.i,t,n,i,{highestAvailableDomain:!0})}})).catch((t=>{U().error(ln,"Error expanding cookie string",t)}))}Aet(){return!((t=this.el).classList.contains("i-amphtml-fie")||function(t,n){return t.closest(".i-amphtml-fie")}(t)||_t(this.i.location)||"inabox"==function(t){const n=t||self;return n.__AMP_MODE?n.__AMP_MODE:n.__AMP_MODE=function(t){return{localDev:!1,development:S(t,w(t)),esm:!0,test:!1,rtvVersion:k(t),ssrReady:!1}}(n)}(this.i).runtime);var t}}(this.win,this.element,this.hM).write():e();Promise.all([r,h,s,c]).then((()=>{this.Yu()}))}Ret(){this.registerAction("accept",(t=>{this.Eet(vn,t)})),this.registerAction("reject",(t=>{this.Eet(An,t)})),this.registerAction("dismiss",(()=>{this.Eet(In)})),this.registerAction("setPurpose",(t=>{this.Met(t)})),this.registerAction("prompt",(t=>this.Cet(t))),this.Tet()}Eet(t,n){this.wet()&&this.Vet(t,n).then((()=>{this.BH(t)}))}Tet(){this.win.addEventListener("message",(t=>{if(!this.tet)return;let n,e,i;const s=nt(t);if(!s||"consent-response"!=s.type)return;if(!s.action)return void U().error(gn,"consent-response message missing required info");void 0!==s.info&&("string"!=typeof s.info&&(U().error(gn,"consent-response info only supports string, %s, treated as undefined",s.info),s.info=void 0),s.action===In&&(s.info&&this.user().error(gn,"Consent string value %s not applicable on user dismiss, stored value will be kept and used",s.info),s.info=void 0),n=s.info,e=this.ket(s.tcfPolicyVersion),i=this.Oet(s.consentMetadata));const o=this.element.querySelectorAll("iframe");for(let r=0;r<o.length;r++)if(o[r].contentWindow===t.source){const{action:t,purposeConsents:o}=s;if(!mn(t)||!this.wet())continue;o&&Object.keys(o).length&&t!==In&&(this.xet(o),this.znt.updateConsentInstancePurposes(o)),this.BH(t,n,i,e)}}))}Uet(t){this.Knt||D().error(gn,"notification ui manager not found"),this.eet||this.Qnt&&(this.eet=!0,this.Knt.registerUI(this.P2.bind(this,t)))}P2(t){this.tet&&D().error(gn,"Attempt to show an already displayed prompt UI"),this.Gr.mutate((()=>{this.Qnt.show(t),this.tet=!0}));const n=new i;return this.Xnt=n.resolve,n.promise}r5(){this.tet||D().error(gn,"%s no consent ui to hide"),this.Qnt.hide(),this.tet=!1,this.Xnt&&(this.Xnt(),this.Xnt=null),this.eet=!1}wet(){return this.znt?this.tet:(D().error(gn,"No consent state manager"),!1)}BH(t,n,i,s){(mn(t)&&this.hM.clearDirtyBitOnResponse_dontUseThisItMightBeRemoved?this.znt.setDirtyBit(!1):e()).then((()=>{this.jet(t,n,i,s)}))}jet(t,n,e,i){this.net=!0,t==vn?this.znt.updateConsentInstanceState(1,n,e,i):t==An?this.znt.updateConsentInstanceState(2,n,e,i):t==In&&this.znt.updateConsentInstanceState(3),this.r5()}Vet(t,n){var i;return"boolean"!=typeof(null==n||null===(i=n.args)||void 0===i?void 0:i.purposeConsentDefault)?e():t===In?(D.warn(gn,"Dismiss cannot have a `purposeConsentDefault` parameter."),e()):this.Det().then((t=>{if(!t||!t.length)return;const e={},i=n.args.purposeConsentDefault;t.forEach((t=>{e[t]=i})),this.znt.updateConsentInstancePurposes(e,!0)}))}Cet(t){const{args:n}=t;(!0===(null==n?void 0:n.expireCache)?this.znt.setDirtyBit():e()).then((()=>{this.Uet(!0)}))}Met(t){if(!t||!t.args||!Object.keys(t.args).length)return void D().error(gn,"Must have arugments for `setPurpose`.");const{args:n}=t;this.wet()&&(this.xet(n),this.znt.updateConsentInstancePurposes(n))}Yu(){this.Net(),this.Let(),this.Het(),this.Fet().then((t=>this.qet(t))).then((t=>{t&&this.Get(),this.Wnt.enableTimeout()})).catch((t=>{})),this.Ret()}Fet(){return this.znt.getConsentInstanceInfo().then((t=>{if(kt(t))return Promise.resolve(!0);const n=this.hM.consentRequired;return"boolean"==typeof n?Promise.resolve(n):this.$et().then((t=>!!t&&(void 0!==t.consentRequired?!!t.consentRequired:!!t.promptIfUnknown)))}))}Net(){const t=this.$et().then((t=>t&&void 0!==t.sharedData?t.sharedData:null));this.znt.setConsentInstanceSharedData(t)}Let(){this.$et().then((t=>{t&&((t.expireCache||t.forcePromptOnNext)&&this.znt.setDirtyBit(),t.consentRequired&&!this.net&&this.Bet(t.consentStateValue,t.consentString||void 0,t.consentMetadata,t.purposeConsents,t.tcfPolicyVersion))}))}Bet(t,n,e,i,s){const o="accepted"===(r=t)?1:"rejected"===r?2:"unknown"===r?5:null;var r;null!==o&&(i&&a(i)&&Object.keys(i).length&&(this.xet(i),this.znt.updateConsentInstancePurposes(i)),this.znt.updateConsentInstanceState(o,n,this.Oet(e),s))}$et(){if(this.iet)return this.iet;const{"checkConsentHref":t}=this.hM;if(t){const n=this.znt.getLastConsentInstanceInfo();this.iet=n.then((n=>{const e={credentials:"include",method:"POST",body:{"consentInstanceId":this.oet,"consentStateValue":St(n.consentState),"consentMetadata":n.consentMetadata,"consentString":n.consentString,"tcfPolicyVersion":n.tcfPolicyVersion,"isDirty":!!n.isDirty,"matchedGeoGroup":this.ret,"purposeConsents":n.purposeConsents,"clientConfig":this.hM.clientConfig}};mt(t,this.element);const i=this.getAmpDoc(),s=Pt(i.getUrl()),o=(h=t,c=dt(c=s),new URL(h,c.href).toString()),r=X(this.win);var h,c;return i.whenFirstVisible().then((()=>Lt(this.element,o).then((t=>r.fetchJson(t,e).then((t=>r.xssiJson(t,this.hM.xssiPrefix).catch((t=>{U().error(gn,"Could not parse the `checkConsentHref` response.",t)}))))))))}))}else this.iet=Promise.resolve(null);return this.iet}zet(t){return this.Det().then((n=>{if(null==n||!n.length)return this.znt.hasAllPurposeConsents(),!0;const e=t.purposeConsents;if(!e||Object.keys(e).length<n.length)return!1;for(let t=0;t<n.length;t++)if(!u(e,n[t]))return!1;return this.znt.hasAllPurposeConsents(),!0}))}Det(){if(this.het)return this.het;const t=this.hM.purposeConsentRequired;return s(t)?this.het=Promise.resolve(t):this.het=this.$et().then((t=>t&&s(t.purposeConsentRequired)?t.purposeConsentRequired:null)),this.het}Wet(){return this.znt.getConsentInstanceInfo().then((t=>kt(t)?this.zet(t):Promise.resolve(!1)))}qet(t){return this.Qnt=new en(this,N(this.hM)),this.Wet().then((n=>!!n||(t?(this.Uet(!1),!0):(this.znt.updateConsentInstanceState(4),!1))))}Get(){this.Znt&&(this.Knt.onQueueEmpty((()=>{this.Gr.mutate((()=>{this.Znt.show(!1)}))})),this.Knt.onQueueNotEmpty((()=>{this.Gr.mutate((()=>{this.Znt.hide()}))})))}getConsentStateManagerForTesting(){return this.znt}getConsentRequiredPromiseForTesting(){return this.Fet()}getIsPromptUiOnForTesting(){return this.tet}xet(t){Object.keys(t).forEach((n=>{t[n]}))}ket(t){if("number"==typeof t){if(!(isNaN(t)||!isFinite(t)||t.toString().split(".").length>1))return t;U().error(gn,"CMP tcfPolicyVersion must be a valid number (integer).")}}Oet(t){if(t){if(a(t))return function(t){const n=t.consentStringType,e=t.additionalConsent,i=t.gdprApplies,s=t.purposeOne,o=t.gppSectionId,r=[];var h;n&&1!==(h=n)&&2!==h&&3!==h&&4!==h&&(delete t.consentStringType,r.push("consentStringType")),e&&"string"!=typeof e&&(delete t.additionalConsent,r.push("additionalConsent")),i&&"boolean"!=typeof i&&(delete t.gdprApplies,r.push("gdprApplies")),s&&"boolean"!=typeof s&&(delete t.purposeOne,r.push("purposeOne")),o&&"string"!=typeof o&&(delete t.gppSectionId,r.push("gppSectionId"));for(let t=0;t<r.length;t++)U().error("amp-consent",'Consent metadata value "%s" is invalid.',r[t])}(t),wt(t.consentStringType,t.additionalConsent,t.gdprApplies,t.purposeOne,t.gppSectionId);U().error(gn,"CMP metadata is not an object.")}}Het(){if(!this.hM.exposesTcfApi)return;if(this.win.frames.__tcfapiLocator)return;this.Jnt=new class{constructor(t){this.Jet=t,this.Ket=l(),this.Qet=null,this.Yet=0,t.setOnPolicyChange((()=>{this.Zet()}))}handleTcfCommand(t,n){if(!this.Xet(t.__tcfapiCall))return;const e=t.__tcfapiCall,{command:i}=e;switch(i){case"ping":this.tit(e,n);break;case"getTCData":this.nit(e,n);break;case"addEventListener":this.eit(e,n);break;case Rt:this.iit(e,n);break;default:return}}eit(t,n){this.Ket[this.Yet]||(this.Ket[this.Yet]={payload:t,win:n},this.Yet++)}iit(t,n){const{callId:e,parameter:i}=t,s=!!this.Ket[i];s&&delete this.Ket[i],this.sit(n,void 0,e,s)}Zet(){Object.keys(this.Ket).length&&this.oit().then((t=>{const n=t[2];if(!n||n===this.Qet)return;this.Qet=n;const e=Object.keys(this.Ket);for(let i=0;i<e.length;i++){const s=Number(e[i]);if(!u(this.Ket,s))continue;const{payload:o,win:r}=this.Ket[s],{callId:h}=o,c=this.rit(t[0],t[1],n,s,t[3]);this.sit(r,c,h,!0)}}))}oit(){const t=this.Jet.getConsentStringInfo("default"),n=this.Jet.getConsentMetadataInfo("default"),e=this.Jet.getMergedSharedData("default"),i=this.Jet.getTcfPolicyVersion("default");return Promise.all([n,e,t,i])}nit(t,n){this.oit().then((e=>{const i=this.rit(e[0],e[1],e[2],void 0,e[3]),{callId:s}=t;this.sit(n,i,s,!0)}))}rit(t,n,e,i,s){const o=t?t.purposeOne:void 0,r=t?t.gdprApplies:void 0,h=t?t.additionalConsent:void 0,c=st(st({},n),{},{additionalConsent:h});return{tcfPolicyVersion:"number"==typeof s?s:2,gdprApplies:r,tcString:e,listenerId:i,cmpStatus:fn,eventStatus:"tcloaded",purposeOneTreatment:o,additionalData:c}}tit(t,n){const e=this.Jet.getConsentMetadataInfo("default"),i=this.Jet.getTcfPolicyVersion("default");Promise.all([e,i]).then((e=>{const i=this.hit(e[0],e[1]),{callId:s}=t;this.sit(n,i,s)}))}hit(t,n){return{gdprApplies:t?t.gdprApplies:void 0,cmpLoaded:!0,cmpStatus:fn,tcfPolicyVersion:"number"==typeof n?n:2}}sit(t,n,e,i){if(!t)return;const s={returnValue:n,callId:e,success:i};t.postMessage({__tcfapiReturn:s},"*")}Xet(t){if(!a(t))return U().error(dn,`"tcfapiCall" is not an object: ${t}`),!1;const{command:n,parameter:e,version:i}=t;return"getTCData"!==(s=n)&&"ping"!==s&&"addEventListener"!==s&&"removeEventListener"!==s?(U().error(dn,`Unsupported command found in "tcfapiCall": ${n}`),!1):e&&n!=Rt?(U().error(dn,`Unsupported parameter found in "tcfapiCall": ${e}`),!1):2==i||(U().error(dn,`Found incorrect version in "tcfapiCall": ${i}`),!1);var s}getMinimalPingReturnForTesting(t,n){return this.hit(t,n)}getMinimalTcDataForTesting(t,n,e,i,s){return this.rit(t,n,e,i,s)}}(this.Wnt),this.win.addEventListener("message",(t=>this.cit(t)));const t=this.element.ownerDocument.createElement("iframe");t.setAttribute("name","__tcfapiLocator"),t.setAttribute("aria-hidden","true"),I(t,!1),this.element.appendChild(t)}cit(t){const n=nt(t);n&&n.__tcfapiCall&&this.Jnt.handleTcfCommand(n,t.source)}};t.registerElement("amp-consent",bn,"amp-consent{position:fixed!important;bottom:0;left:0;overflow:hidden!important;background:hsla(0,0%,100%,.7);width:100%;z-index:2147483645}amp-consent[i-amphtml-notbuilt]>*{display:none!important}amp-consent>*{max-height:100vh!important}amp-consent.amp-active{visibility:visible}amp-consent.amp-hidden{visibility:hidden}@keyframes amp-consent-ui-placeholder-spin{0%{transform:rotate(0deg)}to{transform:rotate(360deg)}}.i-amphtml-consent-ui-placeholder{width:100%;height:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}.i-amphtml-consent-ui-placeholder>svg{width:30px;height:30px;fill:none;stroke-width:1.5px;transform-origin:50% 50%;animation:amp-consent-ui-placeholder-spin 1000ms linear infinite}.i-amphtml-consent-alertdialog{overflow:hidden;position:absolute;height:1px;width:1px;top:auto;left:auto}.i-amphtml-consent-ui-fill{position:absolute;top:0;left:0;width:100%}iframe.i-amphtml-consent-ui-fill{border:none}amp-consent.i-amphtml-consent-ui-iframe-active{width:100%!important;height:100%!important;padding:0px!important;margin:0px!important;overflow:auto!important;transform:translate3d(0px,100vh,0px)!important}amp-consent.i-amphtml-consent-ui-iframe-active.i-amphtml-consent-ui-modal{box-sizing:border-box;top:0;right:0;animation:i-amphtml-modal-appear 0.5s;animation-fill-mode:forwards;height:var(--i-amphtml-modal-height)!important;width:90vw!important;margin:auto!important;max-width:760px}amp-consent.i-amphtml-consent-ui-border-enabled{border-top-left-radius:8px!important;border-top-right-radius:8px!important;box-shadow:0 0 5px 0 rgba(0,0,0,.2)!important}amp-consent.i-amphtml-consent-ui-modal.i-amphtml-consent-ui-border-enabled{border-radius:8px!important;box-shadow:0 0 5px 0 rgba(0,0,0,.2)!important}amp-consent.i-amphtml-consent-ui-iframe-active.i-amphtml-consent-ui-iframe-transform{transform:translate3d(0px,calc(100% - var(--i-amphtml-modal-height)),0px)!important}amp-consent.i-amphtml-consent-ui-iframe-active.i-amphtml-consent-ui-in{transition:transform 0.5s ease-out!important}amp-consent.i-amphtml-consent-ui-iframe-active.i-amphtml-consent-ui-in.i-amphtml-consent-ui-iframe-fullscreen{top:0px!important;transform:translateZ(0px)!important;border-top-left-radius:0px!important;border-top-right-radius:0px!important}amp-consent.i-amphtml-consent-ui-in.i-amphtml-consent-ui-iframe-fullscreen>.i-amphtml-consent-ui-fill{height:100%!important}@keyframes i-amphtml-consent-ui-mask{0%{opacity:0.0}to{opacity:0.2}}@keyframes i-amphtml-modal-appear{0%{transform:translateY(100vh);opacity:0}to{transform:translate(0);opacity:1}}.i-amphtml-consent-ui-mask{position:fixed!important;top:0!important;left:0!important;width:100vw!important;height:100vh!important;opacity:0.2;animation:i-amphtml-consent-ui-mask 0.25s ease-in;background-image:none!important;background-color:#000;z-index:2147483644}\n/*# sourceURL=/extensions/amp-consent/0.1/amp-consent.css*/"),t.registerServiceForDoc(tt,class{constructor(){this.ait=0,this.lit=e(),this.uit=()=>{},this.pit=()=>{}}onQueueEmpty(t){this.uit=t,0==this.ait&&t()}onQueueNotEmpty(t){this.pit=t,this.ait>0&&t()}registerUI(t){0==this.ait&&this.pit(),this.ait++;const n=this.lit.then((()=>t().then((()=>{this.ait--,0==this.ait&&this.uit()}))));return this.lit=n,n}}),t.registerServiceForDoc(_n,class{constructor(t){this.ji=t,this.dit=null,this.fit=null,this.mit=null,this._it=null,this.Pit=null,this.git=void 0;const n=new i;this.vit=n.resolve,this.Ait=n.promise,this.consentPageViewId64=function(t){let n=!1,e=null,i=t;return(...t)=>(n||(e=i.apply(self,t),n=!0,i=null),e)}((()=>function(t){const n=function(t){const n=function(t,n){let{crypto:e}=t;const i=new Uint8Array(16);return e.getRandomValues(i),i}(t);return n||String(t.location.href+Date.now()+t.Math.random()+t.screen.width+t.screen.height)}(t);if("string"==typeof n)return(e=t,H(e,"crypto")).sha384Base64(n);var e,i;{const t=n;return i=()=>function(t){const n=ht(t);return btoa(n).replace(/[+/=]/g,(t=>lt[t]))}(t).replace(/\.+$/,""),new Promise((t=>{t(i())}))}}(this.ji.win)))}registerConsentInstance(t,n){this.fit?D().error(Ot,"Cannot register consent instance %s, instance %s has already been registered.",t,this.dit):(this.dit=t,this.fit=new class{constructor(t,n,e){this.ji=t,this.vi=n,this.sharedDataPromise=null,this.Iit=(t=>{const n=B(t),e=H(n.win,"ampdoc"),i=e.isSingleDoc()?e.getSingleDoc():null;return G(i&&i.win==n.win?i:n,"storage")})(t),this.bit=null,this.yit=null,this.Rit="amp-consent:"+n,this.Eit=e.onUpdateHref||null,this.Eit&&mt(this.Eit,"AMP-CONSENT"),this.Mit=void 0}setDirtyBit(t=!0){return this.Mit=t,this.get().then((n=>{Et(n)!==t&&this.update(n.consentState,n.consentString,n.purposeConsents,n.consentMetadata,t)}))}update(t,n,e,i,s,o){const r=(c=this.bit&&this.bit.consentState,1!==(a=h=t)&&2!==a&&3!==a&&4!==a&&5!==a&&(h=5),3==h?c||5:4==h&&c&&5!=c?c:h);var h,c,a,l,u,p,d;if(3===t)return void(this.bit=Tt(r,null===(l=this.bit)||void 0===l?void 0:l.consentString,null===(u=this.bit)||void 0===u?void 0:u.consentMetadata,null===(p=this.bit)||void 0===p?void 0:p.purposeConsents,void 0,null===(d=this.bit)||void 0===d?void 0:d.tcfPolicyVersion));const f=this.bit;s&&Et(f)?this.bit=Tt(r,n,i,e,!0,o):this.bit=Tt(r,n,i,e,void 0,o);const m=Tt(r,n,i,e,this.Mit,o);Ct(m,this.yit)||this.Cit(m)}Cit(t){this.Iit.then((n=>{if(!Ct(t,this.bit,this.Mit))return;if(5===t.consentState)return void n.remove(this.Rit);const e=function(t){const n=l(),e=t.consentState;if(1==e)n.s=1;else{if(2!=e)return null;n.s=0}return t.consentString&&(n.r=t.consentString),t.tcfPolicyVersion&&(n.e=t.tcfPolicyVersion),!0===t.isDirty&&(n.d=1),t.consentMetadata&&(n.m=function(t){const n=l();return t.consentStringType&&(n.cst=t.consentStringType),t.additionalConsent&&(n.ac=t.additionalConsent),null!=t.gdprApplies&&(n.ga=t.gdprApplies),null!=t.purposeOne&&(n.po=t.purposeOne),null!=t.gppSectionId&&(n.gsi=t.gppSectionId),n}(t.consentMetadata)),t.purposeConsents&&(n.pc=t.purposeConsents),0==Object.keys(n)?null:n}(t);null!=e&&(this.yit=t,n.setNonBoolean(this.Rit,e),this.Tit(t))}))}get(){if(this.bit)return Promise.resolve(this.bit);let t;return this.Iit.then((n=>(t=n,t.get(this.Rit)))).then((n=>{if(this.bit)return this.bit;const e=function(t){if(void 0===t)return Tt(5);if("boolean"==typeof t)return function(t){return Tt(Vt(t))}(t);if(!a(t))throw D().createError("Invalid stored consent value");return Tt(Vt(t.s),t.r,(n=t.m)?wt(n.cst,n.ac,n.ga,n.po,n.gsi):wt(),t.pc,t.d&&1===t.d,t.e);var n}(n);return this.yit=e,Et(e)&&(this.Tit(Tt(5)),t.remove(this.Rit),this.yit=null),this.bit=e,this.bit})).catch((t=>(D().error(Ot,"Failed to read storage",t),Tt(5))))}Tit(t){if(!this.Eit)return;if(Et(t))return;const n=Mt(t.consentState);Ht(this.ji).then((e=>{const i={"consentInstanceId":this.vi,"ampUserId":e};null!=n&&(i.consentState=n),i.consentStateValue=St(t.consentState),t.consentString&&(i.consentString=t.consentString),t.consentMetadata&&(i.consentMetadata=t.consentMetadata),t.purposeConsents&&(i.purposeConsents=t.purposeConsents),t.tcfPolicyVersion&&(i.tcfPolicyVersion=t.tcfPolicyVersion);const s={credentials:"include",method:"POST",body:i,ampCors:!1};this.ji.whenFirstVisible().then((()=>{Lt(this.ji.getHeadNode(),this.Eit).then((t=>{X(this.ji.win).fetchJson(t,s)}))}))}))}}(this.ji,t,n),this.Pit&&(this.Pit(),this.Pit=null))}updateConsentInstanceState(t,n,e,i){this.fit?(this.fit.update(t,n,this.git,e,!1,i),this.mit&&(this.mit(Tt(t,n,e,this.git,void 0,i)),this.hasAllPurposeConsents())):D().error(Ot,"instance not registered")}updateConsentInstancePurposes(t,n=!1){this.git||(this.git={}),Object.keys(t).forEach((e=>{if(n&&u(this.git,e))return;const i=t[e]?1:2;this.git[e]=i}))}getLastConsentInstanceInfo(){return N(this.fit),this.fit.get()}getConsentInstanceInfo(){return N(this.fit),this.fit.get().then((t=>Et(t)?Tt(5):t))}onConsentStateChange(t){N(this.fit),N(!this.mit),this.mit=t,this.getConsentInstanceInfo().then((n=>{t(n)}))}setConsentInstanceSharedData(t){N(this.fit),this.fit.sharedDataPromise=t}hasAllPurposeConsents(){this.vit()}whenHasAllPurposeConsents(){return this.Ait}setDirtyBit(t=!0){return this.fit.setDirtyBit(t)}getConsentInstanceSharedData(){return N(this.fit),this.fit.sharedDataPromise}whenConsentReady(){if(this.fit)return e();if(!this._it){const t=new i;this._it=t.promise,this.Pit=t.resolve}return this._it}getSavedInstanceForTesting(){return this.fit.yit}}),t.registerServiceForDoc(Pn,class{constructor(t){this.ji=t,this.wit=l(),this.Vit=l(),this.kit=G(this.ji,"consentStateManager"),this.Sit=new i;const n=new i;this.Oit=n.promise,this.xit=n.resolve,this.Uit=new class{constructor(){this.un=null}add(t){return this.un||(this.un=[]),this.un.push(t),()=>{this.remove(t)}}remove(t){this.un&&function(t,n){const e=t.indexOf(n);-1!=e&&t.splice(e,1)}(this.un,t)}removeAll(){this.un&&(this.un.length=0)}fire(t){if(this.un)for(const n of this.un.slice())n(t)}getHandlerCount(){var t,n;return null!==(t=null===(n=this.un)||void 0===n?void 0:n.length)&&void 0!==t?t:0}},this.jit=null,this.hP=null,this.dP=null,this.Dit=null,this.Dk=null,this.git=null,this.Nit=null}setLegacyConsentInstanceId(t){this.jit=t,this.Yu()}registerConsentPolicyInstance(t,n){if(this.Vit[t])return;const e=Object.keys(n.waitFor||{});if(1!==e.length||e[0]!==this.jit)return void U().error(qt,"invalid waitFor value, consent policy will never resolve");const s=new class{constructor(t){this.lk=t;const n=new i;this.fi=n.promise,this.Pi=n.resolve,this.Lit=4,this.Hit=t.unblockOn||[1,3]}startTimeout(t){const n=this.lk.timeout;let e,i=null;var s;null!=n&&(a(n)?(n.fallbackAction&&"reject"==n.fallbackAction?e=2:n.fallbackAction&&"dismiss"!=n.fallbackAction&&U().error(qt,"unsupported fallbackAction %s",n.fallbackAction),i=n.seconds):i=n,L("number"==typeof(s=i)&&isFinite(s),"invalid timeout value %s",i)),null!=i&&t.setTimeout((()=>{e=e||5,this.evaluate(e,!0)}),1e3*i)}evaluate(t,n=!1){t&&(n&&!this.Pi||(this.Lit=1===t?1:2===t?2:4===t?3:4,this.Pi&&(this.Pi(),this.Pi=null)))}getReadyPromise(){return this.fi}getCurrentPolicyStatus(){return this.Lit}shouldUnblock(){return this.Hit.indexOf(this.Lit)>-1}}(n);this.Vit[t]=s,this.wit[t]&&(this.wit[t].resolve(),this.wit[t]=null),this.Oit.then((()=>{this.hP&&s.evaluate(this.hP),this.Uit.add((t=>{s.evaluate(t)})),this.Sit.promise.then((()=>{s.startTimeout(this.ji.win)}))}))}Yu(){this.kit.then((t=>{t.whenConsentReady().then((()=>{t.onConsentStateChange((t=>{this.Fit(t),this.xit&&(this.xit(),this.xit=null)}))}))}))}enableTimeout(){this.Sit.resolve()}Fit(t){const n=t.consentState,e=t.consentString,i=t.tcfPolicyVersion,s=t.consentMetadata,o=t.purposeConsents,{Dk:r,dP:h,git:c,Dit:a}=this;this.dP=e,this.Dit=i,this.Dk=s,this.git=o,5!==n&&(4==n?1!=this.hP&&2!=this.hP&&(this.hP=4):3==n?(null===this.hP&&(this.hP=5),this.dP=h,this.Dit=a,this.Dk=r,this.git=c):this.hP=n,this.Uit.fire(this.hP),this.Nit&&this.Nit())}setOnPolicyChange(t){this.Nit||(this.Nit=t)}whenPolicyResolved(t){return Gt[t]?this.qit(t).then((()=>this.Vit[t].getReadyPromise().then((()=>this.Vit[t].getCurrentPolicyStatus())))):(U().error(qt,"can not find policy %s, only predefined policies are supported",t),Promise.resolve(4))}whenPolicyUnblock(t){return Gt[t]?this.qit(t).then((()=>this.Vit[t].getReadyPromise().then((()=>this.Vit[t].shouldUnblock())))):(U().error(qt,"can not find policy %s, only predefined policies are supported",t),Promise.resolve(!1))}getMergedSharedData(t){return this.whenPolicyResolved(t).then((()=>this.kit)).then((t=>t.getConsentInstanceSharedData()))}getConsentStringInfo(t){return this.whenPolicyResolved(t).then((()=>this.dP))}getTcfPolicyVersion(t){return this.whenPolicyResolved(t).then((()=>this.Dit))}getConsentMetadataInfo(t){return this.whenPolicyResolved(t).then((()=>this.Dk))}whenPurposesUnblock(t){return this.kit.then((t=>t.whenHasAllPurposeConsents())).then((()=>!!this.git&&t.every((t=>u(this.git,t)&&1===this.git[t]))))}qit(t){return this.Vit[t]?e():(this.wit[t]||(this.wit[t]=new i),this.wit[t].promise)}})})();
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */}});
//# sourceMappingURL=amp-consent-0.1.mjs.map