; (self.AMP=self.AMP||[]).push({m:0,v:"2410292120000",n:"amp-font",ev:"0.1",l:!0,f:function(n,t){!function(){function t(n,i){return(t=Object.setPrototypeOf||function(n,t){return n.__proto__=t,n})(n,i)}function i(n){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)})(n)}function r(n){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function e(n,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(n)}Array.isArray;var o=Object.prototype;o.hasOwnProperty,o.toString,self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:null};var u=self.__AMP_LOG;function f(n){return u.user||(u.user=s()),function(n,t){return t&&t.ownerDocument.defaultView!=n}(u.user.win,n)?u.userForEmbed||(u.userForEmbed=s()):u.user}function s(n){return function(n,t){throw new Error("failed to call initLogConstructor")}()}function c(n,t,i,r,e,o,u,f,s,c,a){return n}function a(n,t){c(function(n,t){var i=n.__AMP_SERVICES&&n.__AMP_SERVICES[t];return!(!i||!i.ctor)}(n,t));var i=function(n){var t=n.__AMP_SERVICES;return t||(t=n.__AMP_SERVICES={}),t}(n)[t];return i.obj||(c(i.ctor),c(i.context),i.obj=new i.ctor(i.context),c(i.obj),i.context=null,i.resolve&&i.resolve(i.obj)),i.obj}var h,l=function(n){return a(n,"timer")},d=["Webkit","webkit","Moz","moz","ms","O","o"];function v(n,t,i,r,e){var o=function(n,t,i){if(t.startsWith("--"))return t;h||(h=Object.create(null));var r=h[t];if(!r||i){if(r=t,void 0===n[t]){var e=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(t),o=function(n,t){for(var i=0;i2,t=Math.abs(this.YF.offsetHeight-this.GF.offsetHeight)>2;return n||t},n}(),w="amp-font",g=function(n){!function(n,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(i&&i.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),i&&t(n,i)}(s,n);var r,o,u=(r=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(n){return!1}}(),function(){var n,t=i(r);if(o){var u=i(this).constructor;n=Reflect.construct(t,arguments,u)}else n=t.apply(this,arguments);return e(this,n)});function s(n){var t;return(t=u.call(this,n)).JF="",t.KF="",t.NF="",t.UF="",t.XF=null,t}s.prerenderAllowed=function(){return!0};var c=s.prototype;return c.buildCallback=function(){var n,t;this.JF=(n=this.element.getAttribute("font-family"),"The font-family attribute is required for %s",t=this.element,f().assert(n,"The font-family attribute is required for %s",t,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined)),this.KF=this.element.getAttribute("font-weight")||"400",this.NF=this.element.getAttribute("font-style")||"normal",this.UF=this.element.getAttribute("font-variant")||"normal",this.XF=new b(this.getAmpDoc()),this._F()},c._F=function(){var n=this,t={fontStyle:this.NF,variant:this.UF,weight:this.KF,size:"medium",family:this.JF};this.XF.load(t,this.iz()).then((function(){n.rz()})).catch((function(t){n.ez(),f().warn(w,"Font download timed out for "+n.JF)}))},c.rz=function(){var n=this.element.getAttribute("on-load-add-class"),t=this.element.getAttribute("on-load-remove-class");this.oz(n,t)},c.ez=function(){var n=this.element.getAttribute("on-error-add-class"),t=this.element.getAttribute("on-error-remove-class");this.oz(n,t)},c.oz=function(n,t){var i=this.getAmpDoc(),r=i.getRootNode().documentElement||i.getBody();n&&r.classList.add(n),t&&r.classList.remove(t),this.HF()},c.HF=function(){this.XF=null},c.iz=function(){var n,t=parseInt(this.element.getAttribute("timeout"),10);return t="number"!=typeof(n=t)||!isFinite(n)||t<0?3e3:t,Math.max(t-l(this.win).timeSinceStart(),100)},s}(n.BaseElement);n.registerElement(w,g)}(); /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */}}); //# sourceMappingURL=amp-font-0.1.js.map