; (self.AMP=self.AMP||[]).push({m:0,v:"2305252018001",n:"amp-iframe",ev:"0.1",l:!0,f:function(t,n){!function(){function n(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function r(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),r.push.apply(r,i)}return r}function i(t){for(var i=1;it.length)&&(n=t.length);for(var r=0,i=new Array(n);r=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u;function a(){return u||(u=Promise.resolve(void 0))}var s=function(){var t=this;this.promise=new Promise((function(n,r){t.resolve=n,t.reject=r}))};function f(t,n){return(f=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function h(t,n){if(n&&("object"===l(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}var v=Array.isArray;function m(t,n){for(var r=[],i=0,e=0;e=0&&t.indexOf(n,r)==r}var p,b,g=Object.prototype;function y(t){var n=Object.create(null);return t&&Object.assign(n,t),n}function w(t,n,r,i,e,o,u,a,s,f,c){return t}function O(t){var n=Object.getOwnPropertyDescriptor(t,"message");if(null!=n&&n.writable)return t;var r=t.message,i=t.stack,e=new Error(r);for(var o in t)e[o]=t[o];return e.stack=i,e}function j(t){for(var n,r=null,i="",e=o(arguments,!0);!(n=e()).done;){var u=n.value;u instanceof Error&&!r?r=O(u):(i&&(i+=" "),i+=u)}return r?i&&(r.message=i+": "+r.message):r=new Error(i),r}function S(t){var n,r;null===(n=(r=self).__AMP_REPORT_ERROR)||void 0===n||n.call(r,t)}function x(t){var n=j.apply(null,arguments);setTimeout((function(){throw S(n),n}))}function P(t){try{for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i=0;r--){var i=t[r],e=i.target;if(!n.has(e)){n.add(e);var o=F.get(e);if(o){B.set(e,i);for(var u=0;u0?u[0]:{inlineSize:0,blockSize:0};else{var a,s,f=r.target,c=A(f),l=G.test(C(c,f).writingMode),h=f,v=h.offsetHeight,m=h.offsetWidth;l?(s=m,a=v):(a=m,s=v),o={inlineSize:a,blockSize:s}}P(n,o)}}var J=function(){function t(t){this.zl=t,this.vb=!1,this.hb=!1,this.mb=this.mb.bind(this)}var n=t.prototype;return n.updatePlaying=function(t){t!==this.vb&&(this.vb=t,t?(this.hb=!1,function(t,n,r){var i=t.ownerDocument.defaultView;if(i){var e=F.get(t);if(e||(e=[],F.set(t,e),D(i).observe(t)),!e.some((function(t){return t.callback===r&&1===t.type}))){e.push({type:1,callback:r});var o=B.get(t);o&&setTimeout((function(){return q(1,r,o)}))}}}(this.zl,0,this.mb)):function(t,n){!function(t,n,r){var i=F.get(t);if(i&&(m(i,(function(t){return t.callback===r&&1===t.type})),0==i.length)){F.delete(t),B.delete(t);var e=t.ownerDocument.defaultView;e&&D(e).unobserve(t)}}(t,0,n)}(this.zl,this.mb))},n.mb=function(t){var n=t.blockSize,r=t.inlineSize>0&&n>0;if(r!==this.hb){this.hb=r;var i=this.zl;r||i.pause()}},t}(),U=/(?:^[#?]?|&)([^=&]+)(?:=([^&]*))?/g;function X(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";try{return decodeURIComponent(t)}catch(t){return n}}self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:null};var Y=self.__AMP_LOG;function H(t,n){throw new Error("failed to call initLogConstructor")}function W(t){return Y.user||(Y.user=K()),function(t,n){return n&&n.ownerDocument.defaultView!=t}(Y.user.win,t)?Y.userForEmbed||(Y.userForEmbed=K()):Y.user}function K(t){return H()}function V(){return Y.dev||(Y.dev=H())}function Z(t,n,r,i,e,o,u,a,s,f,c){return t}function $(t,n,r,i,e,o,u,a,s,f,c){return W().assert(t,n,r,i,e,o,u,a,s,f,c)}function Q(t,n){return et(t=function(t){return t.__AMP_TOP||(t.__AMP_TOP=t)}(t),n)}function tt(t,n){var r=it(rt(t));return at(r,n)?et(r,n):null}function nt(t,n){return ot(it(t),n)}function rt(t){return t.nodeType?(n=A(t),Q(n,"ampdoc")).getAmpDoc(t):t;var n}function it(t){var n=rt(t);return n.isSingleDoc()?n.win:n}function et(t,n){Z(at(t,n));var r=ut(t)[n];return r.obj||(Z(r.ctor),Z(r.context),r.obj=new r.ctor(r.context),Z(r.obj),r.context=null,r.resolve&&r.resolve(r.obj)),r.obj}function ot(t,n){var r=ut(t)[n];return r?r.promise?r.promise:(et(t,n),r.promise=Promise.resolve(r.obj)):null}function ut(t){var n=t.__AMP_SERVICES;return n||(n=t.__AMP_SERVICES={}),n}function at(t,n){var r=t.__AMP_SERVICES&&t.__AMP_SERVICES[n];return!(!r||!r.ctor)}var st="__AMP__EXPERIMENT_TOGGLES",ft=function(t){return et(t,"timer")},ct=function(t){return function(t,n,r,i){var e=nt(t,n);if(e)return e;var o=rt(t);return o.whenExtensionsKnown().then((function(){var t=o.getExtensionVersion(r);return t?Q(o.win,"extensions").waitForExtension(r,t):null})).then((function(r){return r?function(t,n){return function(t,n){var r=ot(t,n);if(r)return r;var i,e,o,u,a=ut(t);return a[n]=(e=(i=new s).promise,o=i.reject,u=i.resolve,e.catch((function(){})),{obj:null,promise:e,resolve:u,reject:o,context:null,ctor:null}),a[n].promise}(it(t),n)}(t,n):null}))}(t,"consentPolicyManager","amp-consent")},lt=function(t){return tt(t,"url")};function ht(t){return t.data}var vt,mt,dt=function(){function t(t){this.dr=t,this.pr=0,this.mr=0,this.yr=y()}var n=t.prototype;return n.has=function(t){return!!this.yr[t]},n.get=function(t){var n=this.yr[t];if(n)return n.access=++this.mr,n.payload},n.put=function(t,n){this.has(t)||this.pr++,this.yr[t]={payload:n,access:this.mr},this.wr()},n.wr=function(){if(!(this.pr<=this.dr)){var t,n=this.yr,r=this.mr+1;for(var i in n){var e=n[i].access;e=0;r--){var i=t[r];if(!i.frame.contentWindow){t.splice(r,1);var e=i.events;for(var o in e)e[o].splice(0,1/0).forEach((function(t){t(n)}))}}}function wt(t,n,r,i,e,o){Z(t.src),Z(!t.parentNode),Z(r);var u=t.ownerDocument.defaultView;!function(t){t.listeningFors||t.addEventListener("message",(function(n){if(ht(n)){var r=function(t){return"string"==typeof t&&(t="{"==t.charAt(0)?I(t,(function(t){V().warn("IFRAME-HELPER","Postmessage could not be parsed. Is it in a valid JSON format?",t)}))||null:M(t)?function(t){if(!M(t))return null;var n=t.indexOf("{");return w(-1!=n),I(t.substr(n),(function(n){x(new Error("MESSAGING: Failed to parse message: ".concat(t,"\n").concat(n.message)))}))}(t):null),t}(ht(n));if(r&&r.sentinel){var i=function(t,n,r,i){var e,o=bt(t,n);if(!o)return o;for(var u=0;u-1&&l.splice(t,1),h=null,l=null,r=null}}}function Ot(t,n){return n?t.getAttribute("data-amp-3p-sentinel"):"amp"}var jt=function(){function t(t,n,r,i){var e=this;this.wb=t,this.Hg=r,this.Wg=[],this.Vg=wt(this.wb,n,(function(t,n,r){e.Wg.some((function(t){return t.win==n}))||e.Wg.push({win:n,origin:r}),i(t,n,r)}),this.Hg,this.Hg)}var n=t.prototype;return n.send=function(t,n){m(this.Wg,(function(t){return!t.win.parent})),function(t,n,r,i,e){if(t.contentWindow){i.type=r,i.sentinel=Ot(t,e);var o=i;e&&(o="amp-"+JSON.stringify(i));for(var u=0;u2&&void 0!==arguments[2]?arguments[2]:"",i=this.element,e=lt(i),o=e.parse(t),u=o.hostname,a=o.origin,s=o.protocol;$(e.isSecure(t)||"data:"==s,"Invalid src. Must start with https://. Found %s",i);var f=e.parse(n);return $(!this.vO(r,"allow-same-origin")||a!=f.origin&&"data:"!=s,"Origin of must not be equal to container %s if allow-same-origin is set. See https://github.com/ampproject/amphtml/blob/main/docs/spec/amp-iframe-origin-policy.md for details.",i),$(!(d(u,".".concat(At.thirdPartyFrameHost))||d(u,".ampproject.org")),"amp-iframe does not allow embedding of frames from ampproject.*: %s",t),t},l.mO=function(){var t=this.element.getLayoutBox(),n=Math.min(600,.75*this.getViewport().getSize().height);$(t.top>=n," elements must be positioned outside the first 75% of the viewport or 600px from the top (whichever is smaller): %s Current position %s. Min: %sPositioning rules don't apply for iframes that use `placeholder`.See https://github.com/ampproject/amphtml/blob/main/extensions/amp-iframe/amp-iframe.md#iframe-with-placeholder for details.",this.element,t.top,n)},l.vO=function(t,n){return new RegExp("\\s".concat(n,"\\s"),"i").test(" "+t+" ")},l.dO=function(t){if(t){var n,r,i=lt(this.element).parse(t),e=i.hash;return"data:"==i.protocol||e&&"#"!=e?t:(-1==(r=(n=t).indexOf("#"))?n:n.substring(0,r))+"#amp=1"}},l.pO=function(t,n){if(t)return $(!(" "+n+" ").match(/\s+allow-same-origin\s+/i),"allow-same-origin is not allowed with the srcdoc attribute %s.",this.element),"data:text/html;charset=utf-8;base64,"+(i=t,r="undefined"!=typeof TextEncoder?(new TextEncoder).encode(i):function(t){for(var n=new Uint8Array(t.length),r=0;rr)&&!(o>i)&&r-u<=20&&i-o<=20)return!0}return!1}(t),this.oO=this.gO(),this.uO=this.eO&&!function(t,n){var r=!1,i=0,e=t;do{It[e.tagName]?(i++,r=!1):Mt(e,n)&&(r=!0),e=e.parentElement}while(e&&"BODY"!=e.tagName);return!r&&i<=1}(t,this.win)},l.gO=function(){return r=(n=(t=this.element).getLayoutSize()).height,!(n.width>10||r>10||function(t,n){return t.closest?t.closest(".i-amphtml-overlay"):function(t,n,r){var i;for(i=t;i&&void 0!==i;i=i.parentElement)if(n(i))return i;return null}(t,(function(t){return function(t,n){var r=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector;return!!r&&r.call(t,".i-amphtml-overlay")}(t)}))}(t));var t,n,r},l.layoutCallback=function(){var t=this;if($(!this.uO,"amp-iframe is not used for displaying fixed ad. Please use amp-sticky-ad and amp-ad instead."),this.iO||this.mO(),this.aO&&$(this.getOverflowElement(),"Overflow element must be defined for resizable frames: %s",this.element),!this.iframeSrc)return a();if(this.oO&&!this.getAmpDoc().registerSingleton(1))return console.error("Only 1 analytics/tracking iframe allowed per page. Please use amp-analytics instead or file a GitHub issue for your use case: https://github.com/ampproject/amphtml/issues/new/choose"),a();var n=this.element.ownerDocument.createElement("iframe");this.wb=n,n.classList.add("i-amphtml-fill-content"),n.name="amp_iframe"+zt++,this.iO&&N(n,"zIndex",-1),T(Tt,this.element,n);var r=n.getAttribute("allow")||"";return r=r.replace("autoplay","autoplay-disabled"),n.setAttribute("allow",r),function(t,n,r){var i=r||"";n.setAttribute("sandbox",i)}(this.element,n,this.fO),n.src=this.iframeSrc,this.oO||(this.sO=new Pt(this,n)),n.onload=function(){n.readyState="complete",t.yO(),t.oO&&(t.iframeSrc=null,ft(t.win).promise(5e3).then((function(){R(n),t.element.setAttribute("amp-removed",""),t.wb=null})))},wt(n,"embed-size",(function(n){t.wO(n.height,n.width)}),void 0,void 0,!0),this.cO=function(n,r,i,e){var o=n,u=function(n){return t.OO(n)},a=function(t){try{return u(t)}catch(t){var n,r;throw null===(n=(r=self).__AMP_REPORT_ERROR)||void 0===n||n.call(r,t),t}},s=function(){if(void 0!==p)return p;p=!1;try{var t={get capture(){return p=!0,!1}};self.addEventListener("test-options",null,t),self.removeEventListener("test-options",null,t)}catch(t){}return p}();return o.addEventListener(r,a,!!s&&e),function(){null==o||o.removeEventListener(r,a,!!s&&e),u=null,o=null,a=null}}(this.win,"message",0,void 0),this.iO&&wt(n,"embed-ready",this.yO.bind(this)),wt(n,"send-consent-data",(function(n,r,i){t.jO(r,i)})),this.rj.appendChild(n),this.loadPromise(n).then((function(){t.rj!=t.element&&ft(t.win).delay((function(){t.mutateElement((function(){t.rj.classList.add("amp-active")}))}),1e3),t.Ib.updatePlaying(!0)}))},l.OO=function(t){if(this.wb&&t.source===this.wb.contentWindow){var n=ht(t);if("string"==typeof n&&n.startsWith("pym")){var r=n.split(/xPYMx/);"height"===r[2]?this.wO(parseInt(r[3],10),void 0):"width"===r[2]?this.wO(void 0,parseInt(r[3],10)):W().warn(Rt,"Unsupported Pym.js message: ".concat(n))}}},l.jO=function(t,r){var e,o,u=this;(e=this.element,o=this.getConsentPolicy(),ct(e).then((function(t){var r={"consentMetadata":t&&t.getConsentMetadataInfo,"consentString":t&&t.getConsentStringInfo,"consentPolicyState":t&&t.whenPolicyResolved,"consentPolicySharedData":t&&t.getMergedSharedData};return t?Promise.all(Object.keys(r).map((function(i){return r[i].call(t,o||"default").then((function(t){return n({},i,t)}))}))).then((function(t){return Object.assign.apply({},t)})):r}))).then((function(n){u.SO(t,r,i({"sentinel":"amp","type":"consent-data"},n))}))},l.SO=function(t,n,r){t.postMessage(r,n)},l.unlayoutCallback=function(){return this.cO&&(this.cO(),this.cO=null),this.wb&&(R(this.wb),this.rO&&this.togglePlaceholder(!0),this.wb=null,this.sO&&(this.sO.destroy(),this.sO=null)),this.Ib.updatePlaying(!1),!0},l.getLayoutPriority=function(){return this.eO?2:this.oO?1:t.prototype.getLayoutPriority.call(this)},l.mutatedAttributesCallback=function(t){var n=t.src;void 0!==n&&(this.iframeSrc=this.dO(n),this.wb&&(this.wb.src=this.Tr(this.iframeSrc,window.location.href,this.fO))),this.wb&&t.title&&T(["title"],this.element,this.wb)},l.unlayoutOnPause=function(){return!0},l.yO=function(){var t=this;this.rO&&this.getVsync().mutate((function(){t.wb&&(N(t.wb,"zIndex",0),t.togglePlaceholder(!1))}))},l.firstLayoutCompleted=function(){},l.throwIfCannotNavigate=function(){if(!this.vO(this.fO,"allow-top-navigation"))throw W().createError('"AMP.navigateTo" is only allowed on when its "sandbox" attribute contains "allow-top-navigation".')},l.wO=function(t,n){var r,i,e=this;this.aO?t<100?this.user().error(Rt,"Ignoring embed-size request because the resize height is less than 100px. If you are using amp-iframe to display ads, consider using amp-ad instead.",this.element):(t=parseInt(t,10),isNaN(t)||(r=Math.max(t+(this.element.offsetHeight-this.wb.offsetHeight),t)),n=parseInt(n,10),isNaN(n)||(i=Math.max(n+(this.element.offsetWidth-this.wb.offsetWidth),n)),void 0!==r||void 0!==i?this.attemptChangeSize(r,i).then((function(){void 0!==r&&e.element.setAttribute("height",r),void 0!==i&&e.element.setAttribute("width",i),e.element.overflowCallback(!1,r,i)}),(function(){})):this.user().error(Rt,"Ignoring embed-size request because no width or height value is provided",this.element)):this.hO||(this.user().error(Rt,"Ignoring embed-size request because this iframe is not resizable",this.element),this.hO=!0)},l.bO=function(){var t,n=this;if("iframe-messaging",t=function(t){var n,r,e,u,a;if(t[st])return t[st];t[st]=y();var s=t[st];w(s);var f=i(i({},null!==(n=t.AMP_CONFIG)&&void 0!==n?n:{}),null!==(r=t.AMP_EXP)&&void 0!==r?r:E((null===(e=t.__AMP_EXP)||void 0===e?void 0:e.textContent)||"{}"));for(var c in f){var l=f[c];"number"==typeof l&&l>=0&&l<=1&&(s[c]=Math.random()=10&&(W().error(Rt,'Too many non-gesture-triggered "message" events; detaching event listener.'),n.win.removeEventListener("message",t)));var i,e=ht(r);try{i=E(JSON.stringify(e))}catch(t){return void W().error(Rt,'Data from "message" event must be JSON.')}var o=function(t,n,r,i){var e={detail:r};if(Object.assign(e,void 0),"function"==typeof t.CustomEvent)return new t.CustomEvent(n,e);var o=t.document.createEvent("CustomEvent");return o.initCustomEvent(n,!!e.bubbles,!!e.cancelable,r),o}(n.win,"amp-iframe:message",{"data":i});(function(t){return tt(t,"action")})(n.element).trigger(n.element,"message",o,3)}else W().error(Rt,'"message" received from unexpected origin: '+r.origin+". Only allowed from: "+n.lO)}))}}},l.xO=function(){if(this.getAmpDoc().getRootNode().activeElement!==this.wb)return!1;var t,n,r=this.win.document.createElement("audio");return t=r,(n=function(){return t.play()},new Promise((function(t){t(n())}))).catch((function(){})),!r.paused},l.setTargetOriginForTesting=function(t){this.lO=t},s}(t.BaseElement);t.registerElement(Rt,kt)}(); /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */}}); //# sourceMappingURL=amp-iframe-0.1.js.map