;
(self.AMP=self.AMP||[]).push({m:1,v:"2608131752000",n:"amp-sidebar",ev:"0.1",l:!0,f:function(t,i){(()=>{function i(t){return t?Array.prototype.slice.call(t):[]}var s,{isArray:e}=Array,{hasOwnProperty:n,toString:h}=Object.prototype;function r(t){return 1==(null==t?void 0:t.nodeType)}function o(t,i,s,e,n,h,r,o,a,l,c){return t}function a(t){return(t.ownerDocument||t).defaultView}function l(t,i){return t.closest(i)}function c(t){return function(t,i){const s=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)!(function(t){let i;return"string"==typeof t?i=t:r(t)&&(i=t.tagName),!!i&&i.toLowerCase().startsWith("i-")}(e=i)||e.nodeType===Node.ELEMENT_NODE&&(e.hasAttribute("placeholder")||e.hasAttribute("fallback")||e.hasAttribute("overflow")))&&s.push(i);var e;return s}(t)}function u(t){const i=t.isConnected;if(void 0!==i)return i;let s=t;for(;s=d(s),s.host;)s=s.host;return s.nodeType===Node.DOCUMENT_NODE}function d(t){if(Node.prototype.getRootNode)return t.getRootNode();let i;for(i=t;i.parentNode&&(!(s=i)||"I-AMPHTML-SHADOW-ROOT"!=s.tagName&&(11!=s.nodeType||"[object ShadowRoot]"!==Object.prototype.toString.call(s)));i=i.parentNode);var s;return i}function f(t){try{t.focus()}catch(t){}}function m(t){const i=Object.getOwnPropertyDescriptor(t,"message");if(null!=i&&i.writable)return t;const{message:s,stack:e}=t,n=new Error(s);for(const i in t)n[i]=t[i];return n.stack=e,n}function p(t){let i=null,s="";for(const t of arguments)t instanceof Error&&!i?i=m(t):(s&&(s+=" "),s+=t);return i?s&&(i.message=s+": "+i.message):i=new Error(s),i}function _(t){var i,s;null===(i=(s=self).__AMP_REPORT_ERROR)||void 0===i||i.call(s,t)}function b(t,...i){try{return t.apply(null,i)}catch(t){!function(t){const i=p.apply(null,arguments);setTimeout((()=>{throw _(i),i}))}(t)}}var A=["Webkit","webkit","Moz","moz","ms","O","o"],P={"getPropertyPriority":()=>"","getPropertyValue":()=>""};function v(t,i,e,n,h){const r=function(t,i,e){if(i.startsWith("--"))return i;s||(s=Object.create(null));let n=s[i];if(!n||e){if(n=i,void 0===t[i]){const s=function(t){return t.charAt(0).toUpperCase()+t.slice(1)}(i),e=function(t,i){for(let s=0;s<A.length;s++){const e=A[s]+i;if(void 0!==t[e])return e}return""}(t,s);void 0!==t[e]&&(n=e)}e||(s[i]=n)}return n}(t.style,i,h);if(!r)return;const o=n?e+n:e;t.style.setProperty(function(t){const i=t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()));return A.some((t=>i.startsWith(t+"-")))?`-${i}`:i}(r),o)}function g(t,i){for(const s in i)v(t,s,i[s])}function E(t,i){void 0===i&&(i=t.hasAttribute("hidden")),i?t.removeAttribute("hidden"):t.setAttribute("hidden","")}function M(t,i){return t.getComputedStyle(i)||P}var w=/vertical/,T=new WeakMap,I=new WeakMap,R=new WeakMap;function y(t){let i=T.get(t);return i||(i=new t.ResizeObserver(V),T.set(t,i)),i}function V(t){const i=new Set;for(let s=t.length-1;s>=0;s--){const e=t[s],{target:n}=e;if(i.has(n))continue;i.add(n);const h=I.get(n);if(h){R.set(n,e);for(let t=0;t<h.length;t++){const{callback:i,type:s}=h[t];k(s,i,e)}}}}function k(t,i,s){if(0==t){const{contentRect:t}=s,{height:e,width:n}=t;b(i,{width:n,height:e})}else if(1==t){const{borderBoxSize:t}=s;let e;if(t)e=t.length>0?t[0]:{inlineSize:0,blockSize:0};else{const{target:t}=s,i=a(t),n=w.test(M(i,t).writingMode),{offsetHeight:h,offsetWidth:r}=t;let o,l;n?(l=r,o=h):(o=r,l=h),e={inlineSize:o,blockSize:l}}b(i,e)}}var x=[],S="__AMP_MODAL_SAVED_TAB_INDEX";function D(t){const i=[];for(let s=t;s;s=s.parentNode||s.host)i.push(s);return i}function X(t,i,s){null===s||null==s?t.removeAttribute(i):t.setAttribute(i,s)}var C="i-amphtml-element",$=t=>t.unmount();function O(t,i,s,e){if(i&&t.classList.contains(C)){const i=t;if(b(e,i),!s){const t=i.getPlaceholder();return void(t&&O(t,!0,!1,e))}}const n=t.getElementsByClassName(C);let h=null;for(let t=0;t<n.length;t++){const i=n[t];if(s)b(e,i);else{h=h||[];let t=!1;for(let s=0;s<h.length;s++)if(h[s].contains(i)){t=!0;break}t||(h.push(i),b(e,i))}}}self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:null};var z,F=self.__AMP_LOG;function j(t){return F.user||(F.user=B()),function(t,i){return i&&i.ownerDocument.defaultView!=t}(F.user.win,t)?F.userForEmbed||(F.userForEmbed=B()):F.user}function B(t){return function(t,i){throw new Error("failed to call initLogConstructor")}()}function L(t,i,s,e,n,h,r,o,a,l,c){return t}function W(t,i){return q(t=function(t){return t.__AMP_TOP||(t.__AMP_TOP=t)}(t),i)}function Y(t,i){return q(G(N(t)),i)}function H(t,i){const s=G(N(t));return U(s,i)?q(s,i):null}function N(t){return t.nodeType?(i=a(t),W(i,"ampdoc")).getAmpDoc(t):t;var i}function G(t){const i=N(t);return i.isSingleDoc()?i.win:i}function q(t,i){L(U(t,i));const s=function(t){let i=t.__AMP_SERVICES;return i||(i=t.__AMP_SERVICES={}),i}(t)[i];return s.obj||(L(s.ctor),L(s.context),s.obj=new s.ctor(s.context),L(s.obj),s.context=null,s.resolve&&s.resolve(s.obj)),s.obj}function U(t,i){const s=t.__AMP_SERVICES&&t.__AMP_SERVICES[i];return!(!s||!s.ctor)}var Z,J=t=>Y(t,"owners"),K=t=>q(t,"timer");function Q(t,i){const s=(":not([toolbar]) [autoscroll]",i.querySelector(function(t,i){return t.replace(/^|,/g,"$&:scope ")}(":not([toolbar]) [autoscroll]")));if(!s)return;const e=M(t.win,i)["overflow-y"];var n;"scroll"==e||"auto"==e?(n=t,Y(n,"viewport")).animateScrollWithinParent(s,i,"center",0):j().error("AMP-SIDEBAR","for 'autoscroll', 'nav [toolbar]' element must be set to overflow\n        'scroll' or 'auto' for 'autoscroll' to work.")}function tt(t,i){const s=K(t);return s.promise(1).then((()=>s.promise(i)))}var it=class{constructor(){this.At=null}add(t){return this.At||(this.At=[]),this.At.push(t),()=>{this.remove(t)}}remove(t){this.At&&function(t,i){const s=t.indexOf(i);-1!=s&&t.splice(s,1)}(this.At,t)}removeAll(){this.At&&(this.At.length=0)}fire(t){if(this.At)for(const i of this.At.slice())i(t)}getHandlerCount(){var t,i;return null!==(t=null===(i=this.At)||void 0===i?void 0:i.length)&&void 0!==t?t:0}},st="__AMP_Gestures",et=class t{static get(i,s=!1,e=!1){let n=i[st];return n||(n=new t(i,s,e),i[st]=n),n}constructor(t,i=!1,s=!1){this.mf=t,this.wk=[],this.t_=[],this.Xt=[],this.Ik=[],this.Rk=null;const e=function(t){if(void 0!==Z)return Z;Z=!1;try{const i={get passive(){return Z=!0,!1}};t.addEventListener("test-options",null,i),t.removeEventListener("test-options",null,i)}catch(t){}return Z}(t.ownerDocument.defaultView);this.Vk=i||e,this.kk=s,this.Sk=!1,this.ge=new class{constructor(t,i,s){this.ae=K(t),this.de=i,this.fe=s||0,this.pe=-1,this.me=0,this._e=!1,this.Ae=()=>{this.ge()}}isPending(){return-1!=this.pe}schedule(t){let i=t||this.fe;this._e&&i<10&&(i=10);const s=Date.now()+i;return(!this.isPending()||s-this.me<-10)&&(this.cancel(),this.me=s,this.pe=this.ae.delay(this.Ae,i),!0)}ge(){this.pe=-1,this.me=0,this._e=!0,this.de(),this._e=!1}cancel(){this.isPending()&&(this.ae.cancel(this.pe),this.pe=-1)}}(a(t),this.Cm.bind(this)),this.Ok=new it,this.Ck=Object.create(null),this.zk=this.gp.bind(this),this.Nk=this.Pp.bind(this),this.Lk=this.vp.bind(this),this.Dk=this.h_.bind(this),this.mf.addEventListener("touchstart",this.zk,!!e&&{passive:!0}),this.mf.addEventListener("touchend",this.Nk),this.mf.addEventListener("touchmove",this.Lk,!!e&&{passive:!0}),this.mf.addEventListener("touchcancel",this.Dk),this.Uk=!1}cleanup(){this.mf.removeEventListener("touchstart",this.zk),this.mf.removeEventListener("touchend",this.Nk),this.mf.removeEventListener("touchmove",this.Lk),this.mf.removeEventListener("touchcancel",this.Dk),delete this.mf[st],this.ge.cancel()}onGesture(t,i){const s=new t(this),e=s.getType();let n=this.Ck[e];return n||(this.wk.push(s),n=new it,this.Ck[e]=n),n.add(i)}removeGesture(t){const i=new t(this).getType(),s=this.Ck[i];if(s){s.removeAll();const t=function(t,s){for(let s=0;s<t.length;s++)if(t[s].getType()==i)return s;return-1}(this.wk);return!(t<0||(this.wk.splice(t,1),this.Xt.splice(t,1),this.Ik.splice(t,1),this.t_.splice(t,1),delete this.Ck[i],0))}return!1}onPointerDown(t){return this.Ok.add(t)}gp(t){const i=Date.now();this.Sk=!1,this.Ok.fire(t);for(let s=0;s<this.wk.length;s++)this.Xt[s]||(this.Ik[s]&&this.Ik[s]<i&&this.o_(s),this.wk[s].onTouchStart(t)&&this.u_(s));this.$k(t)}vp(t){const i=Date.now();for(let s=0;s<this.wk.length;s++)this.t_[s]&&(this.Ik[s]&&this.Ik[s]<i?this.o_(s):this.wk[s].onTouchMove(t)||this.o_(s));this.$k(t)}Pp(t){const i=Date.now();for(let s=0;s<this.wk.length;s++){if(!this.t_[s])continue;if(this.Ik[s]&&this.Ik[s]<i){this.o_(s);continue}this.wk[s].onTouchEnd(t);const e=!this.Ik[s],n=this.Ik[s]<i;this.Rk==this.wk[s]||!e&&!n||this.o_(s)}this.$k(t)}h_(t){for(let t=0;t<this.wk.length;t++)this.jk(t);this.$k(t)}pp(t,i){if(this.Rk)return void t.acceptCancel();const s=Date.now();for(let e=0;e<this.wk.length;e++)this.wk[e]==t&&(this.Xt[e]=s+i,this.Ik[e]=0);this.Uk=!0}Fk(t,i){if(this.Rk)return void t.acceptCancel();const s=Date.now();for(let e=0;e<this.wk.length;e++)this.wk[e]==t&&(this.Ik[e]=s+i)}Hk(t){this.Rk==t&&(this.Rk=null,this.Sk=!0)}Bk(t,i,s){o(this.Rk==t);const e=this.Ck[t.getType()];e&&e.fire(new class{constructor(t,i,s,e){this.type=t,this.data=i,this.time=s,this.event=e}}(t.getType(),i,Date.now(),s))}$k(t){let i=!!this.Rk||this.Sk;if(this.Sk=!1,!i){const t=Date.now();for(let s=0;s<this.wk.length;s++)if(this.Xt[s]||this.Ik[s]&&this.Ik[s]>=t){i=!0;break}}i?(t.stopPropagation(),this.Vk||t.preventDefault()):this.kk&&t.stopPropagation(),this.Uk&&(this.Uk=!1,this.Cm())}Cm(){const t=Date.now();let i=-1;for(let s=0;s<this.wk.length;s++)this.Xt[s]?(-1==i||this.Xt[s]>this.Xt[i])&&(i=s):this.Ik[s]&&this.Ik[s]<t&&this.o_(s);if(-1==i)return;let s=0;for(let i=0;i<this.wk.length;i++)!this.Xt[i]&&this.t_[i]&&(s=Math.max(s,this.Ik[i]-t));s<2?this.Yk(i):this.ge.schedule(s)}Yk(t){const i=this.wk[t];for(let i=0;i<this.wk.length;i++)i!=t&&this.jk(i);this.Xt[t]=0,this.Ik[t]=0,this.Rk=i,i.acceptStart()}u_(t){this.t_[t]=!0,this.Ik[t]=0}o_(t){this.t_[t]=!1,this.Ik[t]=0,this.Xt[t]||this.wk[t].acceptCancel()}jk(t){this.Xt[t]=0,this.o_(t)}};function nt(t,i,s){i<1&&(i=1);const e=t/i,n=.5+Math.min(i/33.34,.5);return e*n+s*(1-n)}Math.round(-16.67/Math.log(.95));var ht="backward",rt="horizontal";function ot(t){const i=t.indexOf("#");return-1==i?t:t.substring(0,i)}var at="amp-sidebar toolbar",lt="left",ct="right",ut=class extends t.BaseElement{constructor(t){super(t),this.Uu=null,this.tc=null,this.VW=null,this.gK=null,this.Zh=this.win.document,this._K=this.Zh.documentElement,this.eX=null,this.XW=[];const i=W(this.win,"platform");this.mY=i.isIos(),this.nv=i.isSafari(),this.IY=-1,this.WW=!1,this.fY=null,this.eY=null,this.YW=0,this.GW=!1,this.HW=null,this.qW=new class{constructor(t,i,s){this.i=t,this.OE=i,this.JW=s,this.ZW=ht,this.KW=rt,this.QW=null,this._J=null}AJ(){return this.KW==rt?this.QW.offsetWidth:this.QW.offsetHeight}PJ(t,i){const s=this.KW==rt?t:i;return this.ZW==ht?-Math.min(s,0):Math.max(s,0)}gJ(t,i=""){const s=this.ZW==ht?-t:t;return`translate(${this.KW==rt?`${s}${i}`:0}, ${this.KW==rt?0:`${s}${i}`})`}startSwipe(t){const{direction:i,mask:s,orientation:e,swipeElement:n}=t;this.QW=n,this._J=s,this.ZW=i,this.KW=e}swipeMove(t){this.EJ(t,!1)}endSwipe(t){this.EJ(t,!0)}MJ(t,i){const s=.75*i;return g(this.QW,{transform:this.gJ(t,"px"),transition:`${s}ms transform cubic-bezier(0.15, .55, .3, 0.95)`}),tt(this.i,s)}wJ(t){const i=.8*t;return this.OE((()=>{g(this.QW,{transform:this.gJ(0),transition:`${i}ms transform ease-in`}),g(this._J,{opacity:"",transition:`${i}ms opacity ease-in`})})).then((()=>tt(this.i,i)))}TJ(t){const i=.75*(this.AJ()-t);return this.OE((()=>{g(this.QW,{transform:this.gJ(100,"%"),transition:`${i}ms transform ease-out`}),g(this._J,{opacity:0,transition:`${i}ms opacity ease-out`})})).then((()=>tt(this.i,i))).then((()=>this.JW()))}IJ(t="",i=""){g(this.QW,{transform:t,transition:""}),g(this._J,{opacity:i,transition:""})}RJ(t,i,s,e){const n=22.5*t+s,h=22.5*i+e,r=this.PJ(n,h),o=this.PJ(t,i),a=.5*this.AJ();return r<a&&o<.65?this.MJ(r,o).then((()=>this.wJ(r))):this.TJ(r)}EJ(t,i){const{deltaX:s,deltaY:e,velocityX:n,velocityY:h}=t;this.OE((()=>{if(i)return void this.RJ(n,h,s,e).then((()=>{this.IJ()}));const t=this.PJ(s,e),r=t/this.AJ(),o=Math.max(0,1-r);this.IJ(this.gJ(t,"px"),o)}))}}(this.win,(t=>this.mutateElement(t)),(()=>this.VJ(!0,3))),this.a1=!1,this.u1=!1,this.nI=this.nI.bind(this),this.kJ=null}buildCallback(){const{element:t}=this;var s;t.classList.add("i-amphtml-overlay"),t.classList.add("i-amphtml-scrollable"),this.eX=t.getAttribute("side"),this.u1=t.hasAttribute("data-disable-swipe-close"),this.Uu=this.getViewport(),this.tc=(t=>H(t,"action"))(t),this.element.parentNode!=this.element.ownerDocument.body&&this.element.parentNode!=this.getAmpDoc().getBody()&&this.user().warn(at,`${at} is recommended to be a direct child of the <body> element to preserve a logical DOM order.`),this.eX!=lt&&this.eX!=ct&&(this.eX=this.xJ("rtl"==((s=this.Zh).body.getAttribute("dir")||s.documentElement.getAttribute("dir")||"ltr")?ct:lt),t.setAttribute("side",this.eX)),this.BJ(),t.addEventListener("amp:dom-update",(()=>{this.BJ()})),this.getAmpDoc().whenReady().then((()=>{i(t.querySelectorAll("nav[toolbar]")).forEach((t=>{try{this.XW.push(new class{constructor(t,i){this.Rj=i,this.SJ=t,this.Ri=i.getAmpDoc(),this.OJ=this.SJ.getAttribute("toolbar"),this.jJ=null,this.DJ=void 0,this.XJ=!1,this.SJ.classList.add("amp-sidebar-toolbar-target-hidden"),this.CJ()}onLayoutChange(){this.Ri.win.matchMedia(this.OJ).matches?this.$J():this.zJ()}CJ(){this.jJ=this.SJ.cloneNode(!0);const t=(s=this.SJ.getAttribute("toolbar-target"),'"toolbar-target" is required',e=this.SJ,j().assert(s,'"toolbar-target" is required',e,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined)),i=this.Ri.getElementById(t);var s,e;if(!i)throw j().createError(`Could not find the toolbar-target element with an id: ${t}`);this.DJ=i,this.jJ.classList.add("i-amphtml-toolbar"),E(this.DJ,!1)}FJ(){return this.XJ}$J(){return this.FJ()?z||(z=Promise.resolve(void 0)):this.Rj.mutateElement((()=>{this.DJ&&(E(this.DJ,!0),this.DJ.contains(this.jJ)||this.DJ.appendChild(this.jJ),this.SJ.classList.add("amp-sidebar-toolbar-target-shown"),this.SJ.classList.remove("amp-sidebar-toolbar-target-hidden"),this.XJ=!0,Q(this.Ri,this.jJ))}))}zJ(){this.FJ()&&this.Rj.mutateElement((()=>{this.DJ&&(E(this.DJ,!1),this.SJ.classList.add("amp-sidebar-toolbar-target-hidden"),this.SJ.classList.remove("amp-sidebar-toolbar-target-shown"),this.XJ=!1)}))}}(t,this))}catch(t){this.user().error(at,"Failed to instantiate toolbar",t)}})),this.nI()})),this.mY&&this.LJ(),t.hasAttribute("role")||t.setAttribute("role","menu"),t.tabIndex=-1,this._K.addEventListener("keydown",(t=>{"Escape"==t.key&&this.zS(3)&&t.preventDefault()})),this.fY=this.jY(),this.fY||(this.fY=this.createScreenReaderCloseButton(),t.insertBefore(this.fY,this.element.firstChild)),t.appendChild(this.createScreenReaderCloseButton()),this.registerDefaultAction((t=>{const{caller:i,trust:s}=t;this.mX(s,i)}),"open"),this.registerAction("close",(t=>{this.zS(t.trust)})),this.registerAction("toggle",(t=>{const{caller:i,trust:s}=t;this.GW?this.zS(s):this.mX(s,i)})),this.tc.addToAllowlist("amp-sidebar",["open","close","toggle"],["email"]),t.addEventListener("click",(i=>{const s=l(i.target,"A");if(s&&s.href){const i=(t=>H(t,"url"))(t).parse(s.href),e=this.getAmpDoc().getUrl();if(ot(s.href)!=ot(e))return;i.hash&&this.zS(3)}}),!0),this.NJ(this.element)}attachedCallback(){this.kJ=this.Uu.onResize(function(t,i,s){let e=0,n=0,h=null;function r(){e=0;const s=100-(t.Date.now()-n);var o;s>0?e=t.setTimeout(r,s):(o=h,h=null,i.apply(null,o))}return function(...i){n=t.Date.now(),h=i,e||(e=t.setTimeout(r,100))}}(this.win,this.nI)),this.nI()}detachedCallback(){this.kJ&&(this.kJ(),this.kJ=null)}BJ(){if(this.HW)return;const t=this.element.querySelector("amp-nested-menu");var i;t&&((i=this.win,W(i,"extensions")).installExtensionForDoc(this.getAmpDoc(),"amp-nested-menu"),this.HW=t)}jY(){const t=this.element.querySelectorAll("[on]");for(let i=0;i<t.length;i++){const s=t[i],e=this.tc.hasResolvableActionForTarget(s,"tap",this.element,L(s.parentElement)),n=l(s,"[toolbar]");if(e&&!n)return s}return null}createScreenReaderCloseButton(){const t=this.element.getAttribute("data-close-button-aria-label")||"Close the sidebar",i=this.Zh.createElement("button");return i.textContent=t,i.classList.add("i-amphtml-screen-reader"),i.tabIndex=-1,i.addEventListener("click",(()=>{this.zS(3)})),i}nI(){this.getAmpDoc().whenReady().then((()=>{this.XW.forEach((t=>{t.onLayoutChange()}))}))}WJ(t,i){this.VW=t;const s=()=>{this.VW===t&&this.mutateElement(t)};i?K(this.win).delay(s,i):s()}YJ(t){E(this.element,!0),E(this.GJ(),!0),this.Uu.addToFixedLayer(this.element,!0),this.mutateElement((()=>{!function(t){o(x.every((i=>i.element!==t))),o(u(t));const s=function(t){const s=[],e=D(t);for(let t=0;t<e.length;t++){const n=e[t];n.parentNode&&i(n.parentNode.children).filter((t=>t!=n)).forEach((t=>s.push(t)))}return s}(t),e=D(t).filter(r),n=function(t){const i=[];let s=t;for(;s;){const t=d(s),e=t.querySelectorAll(["a[href]","area[href]","button","details summary","iframe","input","select","textarea","[contenteditable]","[draggable]","[tabindex]"].join(","));Array.prototype.push.apply(i,e),s=t.host}return i}(t),h=n.filter((i=>t.contains(i)&&void 0!==i[S])),a=n.filter((i=>!t.contains(i)&&void 0===i[S])),l=s.concat(e).map((t=>({element:t,prevValue:t.getAttribute("aria-hidden")})));e.forEach((t=>t.removeAttribute("aria-hidden"))),s.forEach((t=>t.setAttribute("aria-hidden","true"))),a.forEach((t=>{t[S]=t.getAttribute("tabindex"),t.setAttribute("tabindex","-1")})),h.forEach((t=>{o(void 0!==t[S]),X(t,"tabindex",t[S])})),x.push({element:t,hiddenElementInfos:l,focusableExternalElements:a,focusableInternalElements:h})}(this.element)})),this.mY&&this.nv&&this.HJ(),this.element.scrollTop=1,this.element.setAttribute("open",""),this.GJ().setAttribute("open",""),this.WJ((()=>this.UJ(t)),350),Q(this.getAmpDoc(),this.element)}UJ(t){const i=c(this.element),s=J(this.element);s.scheduleLayout(this.element,i),s.scheduleResume(this.element,i),this.qJ()||f(L(this.fY)),this.oO("sidebarOpen",t),this.element.setAttribute("i-amphtml-sidebar-opened",""),this.GJ().setAttribute("i-amphtml-sidebar-opened",""),this.setAsContainer()}JJ(t,i){this.GJ().removeAttribute("open"),this.GJ().removeAttribute("i-amphtml-sidebar-opened"),this.mutateElement((()=>{!function(t){const i=x.pop();o(i);const{element:s,focusableExternalElements:e,focusableInternalElements:n,hiddenElementInfos:h}=i;o(u(t)),o(s===t),h.forEach((({element:t,prevValue:i})=>X(t,"aria-hidden",i))),n.forEach((t=>t.setAttribute("tabindex","-1"))),e.forEach((t=>{o(void 0!==t[S]),X(t,"tabindex",t[S]),t[S]=void 0}))}(this.element)})),this.element.removeAttribute("open"),this.element.removeAttribute("i-amphtml-sidebar-opened"),this.WJ((()=>this.ZJ(i)),t?0:350)}ZJ(t){E(this.element,!1),E(this.GJ(),!1),J(this.element).schedulePause(this.element,c(this.element)),this.oO("sidebarClose",t),this.removeAsContainer(),function(t,i=!0){!function(t,i,s,n){const h=e(r=t)?r:[r];var r;for(let t=0;t<h.length;t++)O(h[t],i,!0,n)}(t,i,0,$)}(this.element,!1)}mX(t,i){this.GW||(this.GW=!0,this.Uu.enterOverlayMode(),this.WJ((()=>this.YJ(t))),this.KJ().push((()=>{this.mY?this.VJ(!0,t):this.zS(t)})).then((t=>{this.IY=t})),i&&(this.eY=i,this.YW=this.Uu.getScrollTop()),function(t,i,s){const e=t.ownerDocument.defaultView;if(!e)return;let n=I.get(t);if(n||(n=[],I.set(t,n),y(e).observe(t)),!n.some((t=>t.callback===s&&0===t.type))){n.push({type:0,callback:s});const i=R.get(t);i&&setTimeout((()=>k(0,s,i)))}}(this.element,0,this.nI))}zS(t){return this.VJ(!1,t)}VJ(t,i){if(!this.GW)return!1;this.GW=!1,this.Uu.leaveOverlayMode();const s=this.YW==this.Uu.getScrollTop(),e=this.element.contains(this.Zh.activeElement);return this.WJ((()=>this.JJ(t,i))),t&&(E(this.element,!1),E(this.GJ(),!1)),-1!=this.IY&&(this.KJ().pop(this.IY),this.IY=-1),this.eY&&e&&s&&(this.qJ()||f(this.eY)),function(t,i,s){const e=I.get(t);if(e&&(function(t,i){const e=[];let n=0;for(let i=0;i<t.length;i++){const r=t[i];(h=r).callback===s&&0===h.type?e.push(r):(n<i&&(t[n]=r),n++)}var h;n<t.length&&(t.length=n)}(e),0==e.length)){I.delete(t),R.delete(t);const i=t.ownerDocument.defaultView;i&&y(i).unobserve(t)}}(this.element,0,this.nI),!0}NJ(t){this.u1||et.get(t,!0,!0).onGesture(class extends class extends class{constructor(t,i){this.gC=t,this.Dv=i}getType(){return this.gC}signalReady(t){this.Dv.pp(this,t)}signalPending(t){this.Dv.Fk(this,t)}signalEnd(){this.Dv.Hk(this)}signalEmit(t,i){this.Dv.Bk(this,t,i)}acceptStart(){}acceptCancel(){}onTouchStart(t){return!1}onTouchMove(t){return!1}onTouchEnd(t){}}{constructor(t,i,s,e){super(t,i),this.yC=s,this.AC=e,this.Rk=!1,this.PC=0,this.bC=0,this.vC=0,this.TC=0,this.EC=0,this.xC=0,this.zn=0,this.MC=0,this.wC=0,this.IC=0,this.RC=0}onTouchStart(t){const{touches:i}=t;return!!(this.Rk&&i&&i.length>1)||!(!i||1!=i.length)&&(this.zn=Date.now(),this.PC=i[0].clientX,this.bC=i[0].clientY,!0)}onTouchMove(t){const{touches:i}=t;if(i&&i.length>=1){const{clientX:s,clientY:e}=i[0];if(this.vC=s,this.TC=e,this.Rk)this.VC(!1,!1,t);else{const t=Math.abs(s-this.PC),i=Math.abs(e-this.bC);if(this.yC&&this.AC)(t>=8||i>=8)&&this.signalReady(-10);else if(this.yC){if(t>=8&&t>i)this.signalReady(-10);else if(i>=8)return!1}else{if(!this.AC)return!1;if(i>=8&&i>t)this.signalReady(-10);else if(t>=8)return!1}}return!0}return!1}onTouchEnd(t){const{touches:i}=t;i&&0==i.length&&this.kC(t)}acceptStart(){this.Rk=!0,this.EC=this.PC,this.xC=this.bC,this.wC=this.zn,this.PC=this.vC,this.bC=this.TC,this.VC(!0,!1,null)}acceptCancel(){this.Rk=!1}VC(t,i,s){this.MC=Date.now();const e=this.MC-this.wC;if(!i&&e>4||i&&e>16){const t=nt(this.vC-this.EC,e,this.IC),s=nt(this.TC-this.xC,e,this.RC);(!i||e>32||0!=t||0!=s)&&(this.IC=Math.abs(t)>1e-4?t:0,this.RC=Math.abs(s)>1e-4?s:0),this.EC=this.vC,this.xC=this.TC,this.wC=this.MC}this.signalEmit({first:t,last:i,time:this.MC,deltaX:this.vC-this.PC,deltaY:this.TC-this.bC,startX:this.PC,startY:this.bC,lastX:this.vC,lastY:this.TC,velocityX:this.IC,velocityY:this.RC},s)}kC(t){this.Rk&&(this.Rk=!1,this.VC(!1,!0,t),this.signalEnd())}}{constructor(t){super("swipe-x",t,!0,!1)}},(t=>{const{data:i,event:s}=t;this.QJ(i,s)}))}QJ(t,i){var s;if(!t.first)return t.last?(this.a1&&this.qW.endSwipe(t),void(this.a1=!1)):void(i&&i.target&&(s=i.target,"input"!==s.nodeName.toLowerCase()||"range"!==s.getAttribute("type"))&&(this.a1=!0,this.qW.swipeMove(t)));this.qW.startSwipe({swipeElement:this.element,mask:this.gK,direction:this.eX==lt?ht:"forward",orientation:rt})}xJ(t){return l(this.element,"amp-story")?t==lt?ct:lt:t}GJ(){if(!this.gK){const t=this.Zh.createElement("div");t.classList.add("amp-sidebar-mask","i-amphtml-sidebar-mask"),t.addEventListener("click",(()=>{this.zS(3)})),this.getAmpDoc().getBody().appendChild(t),t.addEventListener("touchmove",(t=>{t.preventDefault()})),this.NJ(t),this.gK=t}return this.gK}LJ(){this.element.addEventListener("scroll",(t=>{this.GW&&(this.element.scrollTop<1?(this.element.scrollTop=1,t.preventDefault()):this.element.scrollHeight==this.element.scrollTop+this.element.offsetHeight&&(this.element.scrollTop=this.element.scrollTop-1,t.preventDefault()))}))}HJ(){if(!this.WW){const t=this.Zh.createElement("div");g(t,{"height":"54px","width":"100%","background-color":"transparent"}),this.element.appendChild(t),this.WW=!0}}KJ(){return Y(this.getAmpDoc(),"history")}oO(t,i){const s=function(t,i,s,e){const n={detail:{}};return Object.assign(n,void 0),new t.CustomEvent(i,n)}(this.win,`${at}.${t}`);this.tc.trigger(this.element,t,s,i)}qJ(){return this.mY&&(t=this.element,Y(t,"viewer")).isEmbedded();var t}};t.registerElement("amp-sidebar",ut,"amp-sidebar{--story-page-vh:1vh;position:fixed!important;top:0;max-height:100vh!important;height:100vh;max-width:80vw;background-color:#efefef;min-width:45px!important;outline:none;overflow-x:hidden!important;overflow-y:auto!important;z-index:2147483647;-webkit-overflow-scrolling:touch;will-change:transform}amp-sidebar[side=left]{left:0!important;transform:translateX(-100%);animation-name:i-amphtml-sidebar-slide-out-left}amp-sidebar[side=left][open]{animation-name:i-amphtml-sidebar-slide-in-left}amp-sidebar[side=right]{right:0!important;transform:translateX(100%);animation-name:i-amphtml-sidebar-slide-out-right}amp-sidebar[side=right][open]{animation-name:i-amphtml-sidebar-slide-in-right}amp-sidebar[side][i-amphtml-sidebar-opened]{transform:none;animation:none}.i-amphtml-sidebar-mask,amp-sidebar[side]{animation-duration:233ms;animation-timing-function:cubic-bezier(0,0,.21,1);animation-fill-mode:forwards}.i-amphtml-toolbar>ol,.i-amphtml-toolbar>ul{display:-ms-flexbox;display:flex;-ms-flex-pack:start;justify-content:flex-start;-ms-flex-wrap:wrap;flex-wrap:wrap;overflow:auto;list-style-type:none;padding:0;margin:0}.amp-sidebar-mask{background-color:rgba(0,0,0,.5)}.i-amphtml-sidebar-mask{position:fixed!important;top:0!important;left:0!important;width:100vw!important;height:100vh!important;background-image:none!important;animation-name:i-amphtml-sidebar-mask-fade-out;z-index:2147483646}.i-amphtml-sidebar-mask[open]{animation-name:i-amphtml-sidebar-mask-fade-in}.i-amphtml-sidebar-mask[i-amphtml-sidebar-opened]{animation:none}@keyframes i-amphtml-sidebar-slide-in-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes i-amphtml-sidebar-slide-out-left{0%{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes i-amphtml-sidebar-slide-in-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes i-amphtml-sidebar-slide-out-right{0%{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes i-amphtml-sidebar-mask-fade-in{0%{opacity:0}to{opacity:1}}@keyframes i-amphtml-sidebar-mask-fade-out{0%{opacity:1}to{opacity:0}}\n/*# sourceURL=/extensions/amp-sidebar/0.1/amp-sidebar.css*/")})();
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */}});
//# sourceMappingURL=amp-sidebar-0.1.mjs.map