(self.AMP=self.AMP||[]).push({n:"amp-sidebar",v:"1810052256480",f:(function(AMP,_){
function h(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a;for(var d in b)if(Object.defineProperties){var e=Object.getOwnPropertyDescriptor(b,d);e&&Object.defineProperty(a,d,e)}else a[d]=b[d]};function k(a){if(!a)return[];for(var b=Array(a.length),c=0;c<a.length;c++)b[c]=a[c];return b};self.log=self.log||{user:null,dev:null,userForEmbed:null};var m=self.log;function n(){var a="\u200b\u200b\u200b";throw Error("failed to call initLogConstructor");};function r(a,b){if(a.nodeType){var c=(a.ownerDocument||a).defaultView;if(c=c!=(c.__AMP_TOP||c)&&t(c,b)?u(c,b):null)return c}c=v(a);c=w(c);return u(c,b)}function y(a,b){a=a.__AMP_TOP||a;return u(a,b)}function z(a){var b=v(a),b=w(b);return u(b,"history")}function v(a){return a.nodeType?y((a.ownerDocument||a).defaultView,"ampdoc").getAmpDoc(a):a}function w(a){a=v(a);return a.isSingleDoc()?a.win:a}
function u(a,b){t(a,b);var c=a.services;c||(c=a.services={});var d=c;a=d[b];a.obj||(a.obj=new a.ctor(a.context),a.ctor=null,a.context=null,a.resolve&&a.resolve(a.obj));return a.obj}function t(a,b){a=a.services&&a.services[b];return!(!a||!a.ctor&&!a.obj)};/*
 https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
function A(a,b){for(var c,d=a;d&&d!==c;d=d.parentElement)if(b(d))return d;return null}function B(a){var b="A";if(a.closest)return a.closest(b);b=b.toUpperCase();return A(a,function(a){return a.tagName==b})}function C(a){var b=a.body.getAttribute("dir")||a.documentElement.getAttribute("dir")||"ltr";return"rtl"==b};function D(a){var b=a.indexOf("#");return-1==b?a:a.substring(0,b)};var E,F="Webkit webkit Moz moz ms O o".split(" ");function H(a,b){void 0===b&&(b=a.hasAttribute("hidden"));b?a.removeAttribute("hidden"):a.setAttribute("hidden","")};function I(a,b){this.J=b;this.c=a;this.F=b.getAmpDoc();this.S=this.c.getAttribute("toolbar");this.C=null;this.h=void 0;this.D=!1;this.c.classList.add("amp-sidebar-toolbar-target-hidden");J(this)}I.prototype.onLayoutChange=function(){var a=this.F.win.matchMedia(this.S).matches;a?K(this):L(this)};
function J(a){a.C=a.c.cloneNode(!0);m.user||(m.user=n());var b=m.user.assert(a.c.getAttribute("toolbar-target"),'"toolbar-target" is required',a.c);a.F.whenReady().then(function(){var c=a.F.getElementById(b);if(c)a.h=c,a.C.classList.add("i-amphtml-toolbar"),H(a.h,!1);else throw Error("Could not find the toolbar-target element with an id: "+b);})}
function K(a){a.D?Promise.resolve():a.J.mutateElement(function(){a.h&&(H(a.h,!0),a.h.contains(a.C)||a.h.appendChild(a.C),a.c.classList.add("amp-sidebar-toolbar-target-shown"),a.c.classList.remove("amp-sidebar-toolbar-target-hidden"),a.D=!0)})}function L(a){a.D&&a.J.mutateElement(function(){a.h&&(H(a.h,!1),a.c.classList.add("amp-sidebar-toolbar-target-hidden"),a.c.classList.remove("amp-sidebar-toolbar-target-shown"),a.D=!1)})};function M(a){a=AMP.BaseElement.call(this,a)||this;a.m=null;a.H=null;a.N=null;a.o=null;a.l=a.win.document;a.O=a.l.documentElement;a.w=null;a.M=[];var b=y(a.win,"platform");a.L=b.isIos();a.P=b.isSafari();a.A=-1;a.I=!1;a.G=null;a.K=0;return a}h(M,AMP.BaseElement);
M.prototype.buildCallback=function(){var a=this,b=this.element;b.classList.add("i-amphtml-overlay");b.classList.add("i-amphtml-scrollable");this.w=b.getAttribute("side");this.m=this.getViewport();this.H=r(b,"action");"left"!=this.w&&"right"!=this.w&&(this.w=C(this.l)?"right":"left",b.setAttribute("side",this.w));var c=k(b.querySelectorAll("nav[toolbar]"));c.forEach(function(b){try{a.M.push(new I(b,a))}catch(f){a.user().error("amp-sidebar toolbar","Failed to instantiate toolbar",f)}});this.L&&N(this);
O(this)?this.B():b.setAttribute("aria-hidden","true");b.hasAttribute("role")||b.setAttribute("role","menu");b.tabIndex=-1;this.O.addEventListener("keydown",function(b){27==b.keyCode&&a.j()});var d=b.getAttribute("data-close-button-aria-label")||"Close the sidebar",e=this.l.createElement("button");e.textContent=d;e.classList.add("i-amphtml-screen-reader");e.tabIndex=-1;e.addEventListener("click",function(){a.j()});b.appendChild(e);this.registerAction("toggle",this.R.bind(this));this.registerAction("open",
this.B.bind(this));this.registerAction("close",this.j.bind(this));b.addEventListener("click",function(c){if((c=B(c.target))&&c.href){var d=r(b,"url").parse(c.href),e=a.getAmpDoc().win.location.href;D(c.href)==D(e)&&d.hash&&a.j()}},!0)};M.prototype.activate=function(a){this.B(a)};M.prototype.onLayoutMeasure=function(){var a=this;this.getAmpDoc().whenReady().then(function(){a.M.forEach(function(a){a.onLayoutChange()})})};function O(a){return a.element.hasAttribute("open")}
M.prototype.R=function(a){O(this)?this.j():this.B(a)};function P(a,b,c){function d(){a.N===b&&a.mutateElement(b)}a.N=b;c?y(a.win,"timer").delay(d,c):d()}function Q(a){H(a.element,!0);a.m.addToFixedLayer(a.element,!0);a.L&&a.P&&R(a);a.element.scrollTop=1;P(a,function(){return S(a)})}
function S(a){T(a);a.element.setAttribute("open","");a.element.setAttribute("aria-hidden","false");P(a,function(){var b=a.getRealChildren();a.scheduleLayout(b);a.scheduleResume(b);try{a.element.focus()}catch(c){}U(a,"sidebarOpen")},350)}function V(a){a.o&&H(a.o,!1);a.element.removeAttribute("open");a.element.setAttribute("aria-hidden","true");P(a,function(){H(a.element,!1);a.schedulePause(a.getRealChildren());U(a,"sidebarClose")},350)}
M.prototype.B=function(a){var b=this;O(this)||(this.m.enterOverlayMode(),P(this,function(){return Q(b)}),z(this.getAmpDoc()).push(this.j.bind(this)).then(function(a){b.A=a}),a&&(this.G=a.caller,this.K=this.m.getScrollTop()))};M.prototype.j=function(){var a=this;if(O(this)){this.m.leaveOverlayMode();var b=this.K==this.m.getScrollTop(),c=this.element.contains(this.l.activeElement);P(this,function(){return V(a)});-1!=this.A&&(z(this.getAmpDoc()).pop(this.A),this.A=-1);if(this.G&&c&&b)try{this.G.focus()}catch(d){}}};
function T(a){if(!a.o){var b=a.l.createElement("div");b.classList.add("i-amphtml-sidebar-mask");b.addEventListener("click",function(){a.j()});a.element.ownerDocument.body.appendChild(b);b.addEventListener("touchmove",function(a){a.preventDefault()});a.o=b}H(a.o,!0)}
function N(a){a.element.addEventListener("scroll",function(b){O(a)&&(1>a.element.scrollTop?(a.element.scrollTop=1,b.preventDefault()):a.element.scrollHeight==a.element.scrollTop+a.element.offsetHeight&&(--a.element.scrollTop,b.preventDefault()))})}
function R(a){if(!a.I){var b=a.l.createElement("div"),c={height:"29px",width:"100%","background-color":"transparent"},d;for(d in c){var e=b,l=c[d],f;f=e.style;var g=d;if(2>g.length?0:0==g.lastIndexOf("--",0))f=g;else{E||(E=Object.create(null));var p=E[g];if(!p){p=g;if(void 0===f[g]){var q=g.charAt(0).toUpperCase()+g.slice(1);b:{for(var x=0;x<F.length;x++){var G=F[x]+q;if(void 0!==f[G]){q=G;break b}}q=""}void 0!==f[q]&&(p=q)}E[g]=p}f=p}f&&(e.style[f]=l)}a.element.appendChild(b);a.I=!0}}
function U(a,b){var c;var d=a.win;c="amp-sidebar toolbar."+b;var e;e={};var l={detail:e};Object.assign(l,void 0);"function"==typeof d.CustomEvent?c=new d.CustomEvent(c,l):(d=d.document.createEvent("CustomEvent"),d.initCustomEvent(c,!!l.bubbles,!!l.cancelable,e),c=d);a.H.trigger(a.element,b,c,100)}(function(a){a.registerElement("amp-sidebar",M,"amp-sidebar{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;-webkit-transform:translateX(-100%)!important;transform:translateX(-100%)!important}amp-sidebar[side=right]{right:0!important;-webkit-transform:translateX(100%)!important;transform:translateX(100%)!important}amp-sidebar[side][open]{-webkit-transform:translateX(0)!important;transform:translateX(0)!important}amp-sidebar[side]{-webkit-transition:-webkit-transform 233ms cubic-bezier(0,0,.21,1);transition:-webkit-transform 233ms cubic-bezier(0,0,.21,1);transition:transform 233ms cubic-bezier(0,0,.21,1);transition:transform 233ms cubic-bezier(0,0,.21,1),-webkit-transform 233ms cubic-bezier(0,0,.21,1)}.i-amphtml-toolbar>ul{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-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}.i-amphtml-sidebar-mask{position:fixed!important;top:0!important;left:0!important;width:100vw!important;height:100vh!important;opacity:0.2;background-image:none!important;background-color:#000;z-index:2147483646}\n/*# sourceURL=/extensions/amp-sidebar/0.1/amp-sidebar.css*/")})(self.AMP);
})});
//# sourceMappingURL=amp-sidebar-0.1.js.map
