;
(self.AMP=self.AMP||[]).push({m:1,v:"2601162341000",n:"amp-fx-flying-carpet",ev:"0.1",l:!0,f:function(t,i){(()=>{var i,n,{isArray:e}=Array,{hasOwnProperty:r,toString:o}=Object.prototype;function s(t){return!!function(t){let i;var n;return"string"==typeof t?i=t:1==(null==(n=t)?void 0:n.nodeType)&&(i=t.tagName),!!i&&i.toLowerCase().startsWith("i-")}(t)||t.nodeType===Node.ELEMENT_NODE&&(t.hasAttribute("placeholder")||t.hasAttribute("fallback")||t.hasAttribute("overflow"))}var l=["Webkit","webkit","Moz","moz","ms","O","o"];self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:null};var a=self.__AMP_LOG;function c(t){return function(t,i){throw new Error("failed to call initLogConstructor")}()}function f(t,i,n,e,r,o,s,l,a,c,f){return t}function p(t,i,n,e,r,o,s,l,f,p,h){return(a.user||(a.user=c()),void a.user.win?a.userForEmbed||(a.userForEmbed=c()):a.user).assert(t,i,n,e,r,o,s,l,f,p,h)}function h(t){return t.nodeType?(n=t,i=(n.ownerDocument||n).defaultView,function(t,i){return u(t=function(t){return t.__AMP_TOP||(t.__AMP_TOP=t)}(t),"ampdoc")}(i)).getAmpDoc(t):t;var i,n}function u(t,i){f(function(t,i){const n=t.__AMP_SERVICES&&t.__AMP_SERVICES[i];return!(!n||!n.ctor)}(t,i));const n=function(t){let i=t.__AMP_SERVICES;return i||(i=t.__AMP_SERVICES={}),i}(t)[i];return n.obj||(f(n.ctor),f(n.context),n.obj=new n.ctor(n.context),f(n.obj),n.context=null,n.resolve&&n.resolve(n.obj)),n.obj}var m=t=>function(t,i){return u(function(t){const i=h(t);return i.isSingleDoc()?i.win:i}(h(t)),i)}(t,"owners"),d=class extends t.BaseElement{constructor(t){super(t),this.q2=[],this.L5=0,this.v_=null,this.N5=!1}isLayoutSupported(t){return"fixed-height"==t}isRelayoutNeeded(){return!0}buildCallback(){const t=this.element.ownerDocument,i=t.createElement("div");this.q2=function(t,i){const n=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)!s(i)&&n.push(i);return n}(this.element),this.v_=i;const n=function(t,i){const n=[];for(let i=t.firstChild;i;i=i.nextSibling)!s(i)&&n.push(i);return n}(this.element);this.L5=this.S5(n).length;const e=m(this.element);this.q2.forEach((t=>e.setOwner(t,this.element)));const r=t.createElement("div");r.setAttribute("class","i-amphtml-fx-flying-carpet-clip"),i.setAttribute("class","i-amphtml-fx-flying-carpet-container"),n.forEach((t=>i.appendChild(t))),r.appendChild(i),this.element.appendChild(r),this.getViewport().addToFixedLayer(i,!1)}Xg(){const t=this.element.getLayoutBox(),i=this.getViewport(),n=i.getHeight(),e=.75*n,r=i.getScrollHeight()-.95*n;p(t.top>=e,"<amp-fx-flying-carpet> elements must be positioned after the 75% of first viewport: %s Current position: %s. Min: %s",this.element,t.top,e),p(t.top<=r,"<amp-fx-flying-carpet> elements must be positioned before the last viewport: %s Current position: %s. Max: %s",this.element,t.top,r)}layoutCallback(){if(!this.N5){try{this.Xg()}catch(t){throw this.collapse(),t}this.N5=!0}const{width:t}=this.element.getLayoutSize();return function(t,i,e,r,o){const s=function(t,i,e){if(i.startsWith("--"))return i;n||(n=Object.create(null));let r=n[i];if(!r||e){if(r=i,void 0===t[i]){const n=function(t){return t.charAt(0).toUpperCase()+t.slice(1)}(i),e=function(t,i){for(let n=0;n<l.length;n++){const e=l[n]+i;if(void 0!==t[e])return e}return""}(t,n);void 0!==t[e]&&(r=e)}e||(n[i]=r)}return r}(t.style,i,o);if(!s)return;const a=r?e+r:e;t.style.setProperty(function(t){const i=t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()));return l.some((t=>i.startsWith(t+"-")))?`-${i}`:i}(s),a)}(this.v_,"width",t,"px"),m(this.element).scheduleLayout(this.element,this.q2),this.Z5(),this.U5(),i||(i=Promise.resolve(void 0))}U5(){new this.win.IntersectionObserver((t=>{const i=t[t.length-1];this.v_.classList.toggle("i-amphtml-fx-flying-carpet-container-fix",i.isIntersecting)}),{threshold:.01}).observe(this.element)}Z5(){new MutationObserver((t=>{for(let i=0;i<t.length;i++){const{addedNodes:n}=t[i];if(n)for(let t=0;t<n.length;t++){const i=n[t];i.signals&&i.signals().whenSignal("built").then(this.W5.bind(this,i))}}})).observe(this.element,{childList:!0,subtree:!0})}W5(t){const i=t;i.getOwner()===this.element&&m(this.element).scheduleLayout(this.element,i)}collapsedCallback(t){const i=this.q2.indexOf(t);if(i>-1&&(this.q2.splice(i,1),this.L5--,0==this.L5))return this.attemptCollapse().catch((()=>{}))}getChildren(){return this.q2}S5(t){return t.filter((t=>1===t.nodeType||3===t.nodeType&&/\S/.test(t.textContent)))}};t.registerElement("amp-fx-flying-carpet",d,"amp-fx-flying-carpet{position:relative!important;box-sizing:border-box!important}amp-fx-flying-carpet>.i-amphtml-fx-flying-carpet-clip{position:absolute!important;top:0!important;left:0!important;width:100%!important;height:100%!important;border:0!important;margin:0!important;padding:0!important;clip:rect(0,auto,auto,0)!important;clip-path:polygon(0px 0px,100% 0px,100% 100%,0px 100%)!important}amp-fx-flying-carpet>.i-amphtml-fx-flying-carpet-clip>.i-amphtml-fx-flying-carpet-container{position:fixed!important;top:0!important;width:100%;height:100%;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}amp-fx-flying-carpet>.i-amphtml-fx-flying-carpet-clip>.i-amphtml-fx-flying-carpet-container.i-amphtml-fx-flying-carpet-container-fix{-webkit-transform:translateZ(0)!important}.i-amphtml-fx-flying-carpet-container>.i-amphtml-layout-fixed-height,.i-amphtml-fx-flying-carpet-container>.i-amphtml-layout-responsive{-ms-flex-item-align:stretch;align-self:stretch}\n/*# sourceURL=/extensions/amp-fx-flying-carpet/0.1/amp-fx-flying-carpet.css*/")})();
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */}});
//# sourceMappingURL=amp-fx-flying-carpet-0.1.mjs.map