lighthouse 8.4.0 → 8.5.0-dev.20210921
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +79 -0
- package/flow-report/assets/styles.css +85 -61
- package/flow-report/src/app.tsx +6 -2
- package/flow-report/src/common.tsx +0 -41
- package/flow-report/src/icons.tsx +11 -0
- package/flow-report/src/summary/summary.tsx +32 -25
- package/flow-report/src/topbar.tsx +60 -0
- package/flow-report/src/util.ts +0 -1
- package/flow-report/src/wrappers/{gauge.tsx → category-score.tsx} +11 -5
- package/flow-report/test/summary/summary-test.tsx +3 -3
- package/flow-report/tsconfig.json +6 -22
- package/{lighthouse-core/gather/gatherers/gather-context.js → lighthouse-cli/.eslintrc.cjs} +20 -18
- package/lighthouse-cli/bin.js +31 -21
- package/lighthouse-cli/cli-flags.js +12 -7
- package/lighthouse-cli/commands/commands.js +2 -7
- package/lighthouse-cli/commands/list-audits.js +2 -2
- package/lighthouse-cli/commands/list-trace-categories.js +2 -2
- package/lighthouse-cli/index.js +3 -1
- package/lighthouse-cli/package.json +4 -0
- package/lighthouse-cli/printer.js +4 -3
- package/lighthouse-cli/run.js +14 -15
- package/lighthouse-cli/sentry-prompt.js +5 -6
- package/lighthouse-cli/test/smokehouse/frontends/back-compat-util.js +1 -1
- package/lighthouse-cli/test/smokehouse/frontends/lib.js +5 -4
- package/lighthouse-cli/test/smokehouse/frontends/node.js +1 -1
- package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +93 -14
- package/lighthouse-cli/test/smokehouse/lib/child-process-error.js +1 -1
- package/lighthouse-cli/test/smokehouse/lib/concurrent-mapper.js +1 -1
- package/lighthouse-cli/test/smokehouse/lib/local-console.js +1 -1
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +20 -16
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +15 -12
- package/lighthouse-cli/test/smokehouse/report-assert.js +23 -13
- package/lighthouse-cli/test/smokehouse/smokehouse.js +32 -11
- package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +0 -2
- package/lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js +6 -1
- package/lighthouse-core/audits/dobetterweb/js-libraries.js +5 -0
- package/lighthouse-core/audits/dobetterweb/uses-http2.js +1 -0
- package/lighthouse-core/audits/lcp-lazy-loaded.js +1 -0
- package/lighthouse-core/audits/oopif-iframe-test-audit.js +30 -0
- package/lighthouse-core/computed/metrics/metric.js +2 -1
- package/lighthouse-core/config/config-helpers.js +47 -3
- package/lighthouse-core/config/config.js +3 -46
- package/lighthouse-core/config/default-config.js +0 -1
- package/lighthouse-core/fraggle-rock/config/config.js +22 -4
- package/lighthouse-core/fraggle-rock/config/default-config.js +0 -9
- package/lighthouse-core/fraggle-rock/config/filters.js +3 -0
- package/lighthouse-core/fraggle-rock/config/validation.js +19 -1
- package/lighthouse-core/fraggle-rock/gather/base-artifacts.js +8 -3
- package/lighthouse-core/fraggle-rock/gather/driver.js +10 -0
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +40 -19
- package/lighthouse-core/fraggle-rock/gather/runner-helpers.js +3 -0
- package/lighthouse-core/fraggle-rock/gather/session.js +44 -1
- package/lighthouse-core/fraggle-rock/gather/snapshot-runner.js +4 -1
- package/lighthouse-core/fraggle-rock/gather/timespan-runner.js +5 -1
- package/lighthouse-core/gather/devtools-log.js +9 -3
- package/lighthouse-core/gather/driver/network-monitor.js +57 -13
- package/lighthouse-core/gather/driver/prepare.js +43 -17
- package/lighthouse-core/gather/driver/target-manager.js +125 -0
- package/lighthouse-core/gather/driver.js +20 -0
- package/lighthouse-core/gather/fetcher.js +2 -2
- package/lighthouse-core/gather/gather-runner.js +1 -1
- package/lighthouse-core/gather/gatherers/css-usage.js +0 -2
- package/lighthouse-core/gather/gatherers/devtools-log.js +11 -9
- package/lighthouse-core/gather/gatherers/js-usage.js +0 -1
- package/lighthouse-core/gather/gatherers/script-elements.js +4 -5
- package/lighthouse-core/gather/gatherers/seo/robots-txt.js +3 -3
- package/lighthouse-core/gather/gatherers/trace.js +4 -5
- package/lighthouse-core/index.js +4 -0
- package/lighthouse-core/lib/emulation.js +0 -1
- package/lighthouse-core/lib/i18n/locales/en-US.json +6 -0
- package/lighthouse-core/lib/i18n/locales/en-XL.json +6 -0
- package/lighthouse-core/lib/network-recorder.js +8 -0
- package/lighthouse-core/lib/proto-preprocessor.js +5 -10
- package/lighthouse-core/runner.js +1 -3
- package/package.json +12 -9
- package/readme.md +2 -0
- package/report/assets/styles.css +120 -12
- package/report/assets/templates.html +13 -0
- package/report/clients/psi.js +5 -1
- package/report/generator/tsconfig.json +5 -16
- package/report/renderer/category-renderer.js +58 -5
- package/report/renderer/components.js +25 -5
- package/report/renderer/performance-category-renderer.js +5 -5
- package/report/renderer/pwa-category-renderer.js +10 -0
- package/report/renderer/report-renderer.js +12 -3
- package/report/renderer/report-ui-features.js +1 -4
- package/report/test/renderer/category-renderer-test.js +19 -0
- package/report/tsconfig.json +6 -21
- package/report/types/report-result.d.ts +1 -1
- package/root.js +3 -1
- package/third-party/snyk/snapshot.json +2 -2
- package/tsconfig-all.json +15 -0
- package/tsconfig-base.json +24 -0
- package/tsconfig.json +8 -18
- package/types/artifacts.d.ts +7 -7
- package/types/config.d.ts +1 -1
- package/types/gatherer.d.ts +7 -1
- package/types/lhr/flow.d.ts +0 -1
- package/types/lhr/lhr.d.ts +5 -1
- package/types/lhr/tsconfig.json +4 -14
- package/types/protocol.d.ts +2 -0
- package/types/smokehouse.d.ts +2 -1
- package/dist/report/flow.js +0 -149
- package/dist/report/standalone.js +0 -228
- package/flow-report/test/common-test.tsx +0 -131
- package/lighthouse-core/gather/gatherers/host-form-factor.js +0 -31
- package/lighthouse-core/gather/gatherers/host-user-agent.js +0 -29
package/dist/report/flow.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
!function(){"use strict";var e,t,n,r,i,o,a,s={},l=[],d=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function c(e,t){for(var n in t)e[n]=t[n];return e}function p(e){var t=e.parentNode;t&&t.removeChild(e)}function h(e,r,i,o,a){var s={type:e,props:r,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==a?++n:a};return null!=t.vnode&&t.vnode(s),s}function u(e){return e.children}function m(e,t){this.props=e,this.context=t}function g(e,t){if(null==t)return e.__?g(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?g(e):null}function _(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return _(e)}}function f(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!v.__r++||o!==t.debounceRendering)&&((o=t.debounceRendering)||i)(v)}function v(){for(var e;v.__r=r.length;)e=r.sort((function(e,t){return e.__v.__b-t.__v.__b})),r=[],e.some((function(e){var t,n,r,i,o,a;e.__d&&(o=(i=(t=e).__v).__e,(a=t.__P)&&(n=[],(r=c({},i)).__v=i.__v+1,E(a,i,r,t.__n,void 0!==a.ownerSVGElement,null!=i.__h?[o]:null,n,null==o?g(i):o,i.__h),k(n,i),i.__e!=o&&_(i)))}))}function b(e,t,n,r,i,o,a,d,c,p){var m,_,f,v,b,x,S,C=r&&r.__k||l,A=C.length;for(n.__k=[],m=0;m<t.length;m++)if(null!=(v=n.__k[m]=null==(v=t[m])||"boolean"==typeof v?null:"string"==typeof v||"number"==typeof v||"bigint"==typeof v?h(null,v,null,null,v):Array.isArray(v)?h(u,{children:v},null,null,null):v.__b>0?h(v.type,v.props,v.key,null,v.__v):v)){if(v.__=n,v.__b=n.__b+1,null===(f=C[m])||f&&v.key==f.key&&v.type===f.type)C[m]=void 0;else for(_=0;_<A;_++){if((f=C[_])&&v.key==f.key&&v.type===f.type){C[_]=void 0;break}f=null}E(e,v,f=f||s,i,o,a,d,c,p),b=v.__e,(_=v.ref)&&f.ref!=_&&(S||(S=[]),f.ref&&S.push(f.ref,null,v),S.push(_,v.__c||b,v)),null!=b?(null==x&&(x=b),"function"==typeof v.type&&null!=v.__k&&v.__k===f.__k?v.__d=c=w(v,c,e):c=y(e,v,f,C,b,c),p||"option"!==n.type?"function"==typeof n.type&&(n.__d=c):e.value=""):c&&f.__e==c&&c.parentNode!=e&&(c=g(f))}for(n.__e=x,m=A;m--;)null!=C[m]&&("function"==typeof n.type&&null!=C[m].__e&&C[m].__e==n.__d&&(n.__d=g(r,m+1)),M(C[m],C[m]));if(S)for(m=0;m<S.length;m++)L(S[m],S[++m],S[++m])}function w(e,t,n){var r,i;for(r=0;r<e.__k.length;r++)(i=e.__k[r])&&(i.__=e,t="function"==typeof i.type?w(i,t,n):y(n,i,i,e.__k,i.__e,t));return t}function y(e,t,n,r,i,o){var a,s,l;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(null==n||i!=o||null==i.parentNode)e:if(null==o||o.parentNode!==e)e.appendChild(i),a=null;else{for(s=o,l=0;(s=s.nextSibling)&&l<r.length;l+=2)if(s==i)break e;e.insertBefore(i,o),a=o}return void 0!==a?a:i.nextSibling}function x(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||d.test(t)?n:n+"px"}function S(e,t,n,r,i){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||x(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||x(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r||e.addEventListener(t,o?A:C,o):e.removeEventListener(t,o?A:C,o);else if("dangerouslySetInnerHTML"!==t){if(i)t=t.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null!=n&&(!1!==n||"a"===t[0]&&"r"===t[1])?e.setAttribute(t,n):e.removeAttribute(t))}}function C(e){this.l[e.type+!1](t.event?t.event(e):e)}function A(e){this.l[e.type+!0](t.event?t.event(e):e)}function E(e,n,r,i,o,a,s,l,d){var p,h,g,_,f,v,w,y,x,S,C,A=n.type;if(void 0!==n.constructor)return null;null!=r.__h&&(d=r.__h,l=n.__e=r.__e,n.__h=null,a=[l]),(p=t.__b)&&p(n);try{e:if("function"==typeof A){if(y=n.props,x=(p=A.contextType)&&i[p.__c],S=p?x?x.props.value:p.__:i,r.__c?w=(h=n.__c=r.__c).__=h.__E:("prototype"in A&&A.prototype.render?n.__c=h=new A(y,S):(n.__c=h=new m(y,S),h.constructor=A,h.render=H),x&&x.sub(h),h.props=y,h.state||(h.state={}),h.context=S,h.__n=i,g=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=A.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=c({},h.__s)),c(h.__s,A.getDerivedStateFromProps(y,h.__s))),_=h.props,f=h.state,g)null==A.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==A.getDerivedStateFromProps&&y!==_&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(y,S),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(y,h.__s,S)||n.__v===r.__v){h.props=y,h.state=h.__s,n.__v!==r.__v&&(h.__d=!1),h.__v=n,n.__e=r.__e,n.__k=r.__k,n.__k.forEach((function(e){e&&(e.__=n)})),h.__h.length&&s.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(y,h.__s,S),null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(_,f,v)}))}h.context=S,h.props=y,h.state=h.__s,(p=t.__r)&&p(n),h.__d=!1,h.__v=n,h.__P=e,p=h.render(h.props,h.state,h.context),h.state=h.__s,null!=h.getChildContext&&(i=c(c({},i),h.getChildContext())),g||null==h.getSnapshotBeforeUpdate||(v=h.getSnapshotBeforeUpdate(_,f)),C=null!=p&&p.type===u&&null==p.key?p.props.children:p,b(e,Array.isArray(C)?C:[C],n,r,i,o,a,s,l,d),h.base=n.__e,n.__h=null,h.__h.length&&s.push(h),w&&(h.__E=h.__=null),h.__e=!1}else null==a&&n.__v===r.__v?(n.__k=r.__k,n.__e=r.__e):n.__e=N(r.__e,n,r,i,o,a,s,d);(p=t.diffed)&&p(n)}catch(e){n.__v=null,(d||null!=a)&&(n.__e=l,n.__h=!!d,a[a.indexOf(l)]=null),t.__e(e,n,r)}}function k(e,n){t.__c&&t.__c(n,e),e.some((function(n){try{e=n.__h,n.__h=[],e.some((function(e){e.call(n)}))}catch(e){t.__e(e,n.__v)}}))}function N(t,n,r,i,o,a,l,d){var c,h,u,m=r.props,_=n.props,f=n.type,v=0;if("svg"===f&&(o=!0),null!=a)for(;v<a.length;v++)if((c=a[v])&&(c===t||(f?c.localName==f:3==c.nodeType))){t=c,a[v]=null;break}if(null==t){if(null===f)return document.createTextNode(_);t=o?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,_.is&&_),a=null,d=!1}if(null===f)m===_||d&&t.data===_||(t.data=_);else{if(a=a&&e.call(t.childNodes),h=(m=r.props||s).dangerouslySetInnerHTML,u=_.dangerouslySetInnerHTML,!d){if(null!=a)for(m={},v=0;v<t.attributes.length;v++)m[t.attributes[v].name]=t.attributes[v].value;(u||h)&&(u&&(h&&u.__html==h.__html||u.__html===t.innerHTML)||(t.innerHTML=u&&u.__html||""))}if(function(e,t,n,r,i){var o;for(o in n)"children"===o||"key"===o||o in t||S(e,o,null,n[o],r);for(o in t)i&&"function"!=typeof t[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===t[o]||S(e,o,t[o],n[o],r)}(t,_,m,o,d),u)n.__k=[];else if(v=n.props.children,b(t,Array.isArray(v)?v:[v],n,r,i,o&&"foreignObject"!==f,a,l,a?a[0]:r.__k&&g(r,0),d),null!=a)for(v=a.length;v--;)null!=a[v]&&p(a[v]);d||("value"in _&&void 0!==(v=_.value)&&(v!==t.value||"progress"===f&&!v)&&S(t,"value",v,m.value,!1),"checked"in _&&void 0!==(v=_.checked)&&v!==t.checked&&S(t,"checked",v,m.checked,!1))}return t}function L(e,n,r){try{"function"==typeof e?e(n):e.current=n}catch(e){t.__e(e,r)}}function M(e,n,r){var i,o;if(t.unmount&&t.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||L(i,null,n)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){t.__e(e,n)}i.base=i.__P=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&M(i[o],n,"function"!=typeof e.type);r||null==e.__e||p(e.__e),e.__e=e.__d=void 0}function H(e,t,n){return this.constructor(e,n)}function T(n,r,i){var o,a,l;t.__&&t.__(n,r),a=(o="function"==typeof i)?null:i&&i.__k||r.__k,l=[],E(r,n=(!o&&i||r).__k=function(t,n,r){var i,o,a,s={};for(a in n)"key"==a?i=n[a]:"ref"==a?o=n[a]:s[a]=n[a];if(arguments.length>2&&(s.children=arguments.length>3?e.call(arguments,2):r),"function"==typeof t&&null!=t.defaultProps)for(a in t.defaultProps)void 0===s[a]&&(s[a]=t.defaultProps[a]);return h(t,s,i,o,null)}(u,null,[n]),a||s,s,void 0!==r.ownerSVGElement,!o&&i?[i]:a?null:r.firstChild?e.call(r.childNodes):null,l,!o&&i?i:a?a.__e:r.firstChild,o),k(l,n)}function F(e,t){var n={__c:t="__cC"+a++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some(f)},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}e=l.slice,t={__e:function(e,t){for(var n,r,i;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),i=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),i=n.__d),i)return n.__E=n}catch(t){e=t}throw e}},n=0,m.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=c({},this.state),"function"==typeof e&&(e=e(c({},n),this.props)),e&&c(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),f(this))},m.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),f(this))},m.prototype.render=u,r=[],i="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,v.__r=0,a=0;var R=0;function D(e,n,r,i,o){var a,s,l={};for(s in n)"ref"==s?a=n[s]:l[s]=n[s];var d={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--R,__source:i,__self:o};if("function"==typeof e&&(a=e.defaultProps))for(s in a)void 0===l[s]&&(l[s]=a[s]);return t.vnode&&t.vnode(d),d}var $,O,P,U=0,z=[],V=t.__b,j=t.__r,I=t.diffed,G=t.__c,B=t.unmount;function W(e,n){t.__h&&t.__h(O,e,U||n),U=0;var r=O.__H||(O.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function q(e){return U=1,function(e,t,n){var r=W($++,2);return r.t=e,r.__c||(r.__=[n?n(t):ie(void 0,t),function(e){var t=r.t(r.__[0],e);r.__[0]!==t&&(r.__=[t,r.__[1]],r.__c.setState({}))}],r.__c=O),r.__}(ie,e)}function Z(e,n){var r=W($++,3);!t.__s&&re(r.__H,n)&&(r.__=e,r.__H=n,O.__H.__h.push(r))}function J(e,n){var r=W($++,4);!t.__s&&re(r.__H,n)&&(r.__=e,r.__H=n,O.__h.push(r))}function K(e){return U=5,Q((function(){return{current:e}}),[])}function Q(e,t){var n=W($++,7);return re(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Y(e){var t=O.context[e.__c],n=W($++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(O)),t.props.value):e.__}function X(){z.forEach((function(e){if(e.__P)try{e.__H.__h.forEach(te),e.__H.__h.forEach(ne),e.__H.__h=[]}catch(n){e.__H.__h=[],t.__e(n,e.__v)}})),z=[]}t.__b=function(e){O=null,V&&V(e)},t.__r=function(e){j&&j(e),$=0;var t=(O=e.__c).__H;t&&(t.__h.forEach(te),t.__h.forEach(ne),t.__h=[])},t.diffed=function(e){I&&I(e);var n=e.__c;n&&n.__H&&n.__H.__h.length&&(1!==z.push(n)&&P===t.requestAnimationFrame||((P=t.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),ee&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ee&&(t=requestAnimationFrame(n))})(X)),O=void 0},t.__c=function(e,n){n.some((function(e){try{e.__h.forEach(te),e.__h=e.__h.filter((function(e){return!e.__||ne(e)}))}catch(r){n.some((function(e){e.__h&&(e.__h=[])})),n=[],t.__e(r,e.__v)}})),G&&G(e,n)},t.unmount=function(e){B&&B(e);var n=e.__c;if(n&&n.__H)try{n.__H.__.forEach(te)}catch(e){t.__e(e,n.__v)}};var ee="function"==typeof requestAnimationFrame;function te(e){var t=O;"function"==typeof e.__c&&e.__c(),O=t}function ne(e){var t=O;e.__c=e.__(),O=t}function re(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function ie(e,t){return"function"==typeof t?t(e):t}
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/const oe="…",ae="data:image/jpeg;base64,",se={label:"pass",minScore:.9},le={label:"average",minScore:.5},de={label:"fail"},ce={label:"error"},pe=["com","co","gov","edu","ac","org","go","gob","or","net","in","ne","nic","gouv","web","spb","blog","jus","kiev","mil","wi","qc","ca","bel","on"];class he{static get PASS_THRESHOLD(){return.9}static get MS_DISPLAY_VALUE(){return"%10d ms"}static prepareReportResult(e){const t=JSON.parse(JSON.stringify(e));t.configSettings.locale||(t.configSettings.locale="en"),t.configSettings.formFactor||(t.configSettings.formFactor=t.configSettings.emulatedFormFactor);for(const e of Object.values(t.audits))if("not_applicable"!==e.scoreDisplayMode&&"not-applicable"!==e.scoreDisplayMode||(e.scoreDisplayMode="notApplicable"),e.details&&(void 0!==e.details.type&&"diagnostic"!==e.details.type||(e.details.type="debugdata"),"filmstrip"===e.details.type))for(const t of e.details.items)t.data.startsWith(ae)||(t.data=ae+t.data);if("object"!=typeof t.categories)throw new Error("No categories provided.");const n=new Map;for(const e of Object.values(t.categories))e.auditRefs.forEach((e=>{e.relevantAudits&&e.relevantAudits.forEach((t=>{const r=n.get(t)||[];r.push(e),n.set(t,r)}))})),e.auditRefs.forEach((e=>{const r=t.audits[e.id];e.result=r,n.has(e.id)&&(e.relevantMetrics=n.get(e.id)),t.stackPacks&&t.stackPacks.forEach((t=>{t.descriptions[e.id]&&(e.stackPacks=e.stackPacks||[],e.stackPacks.push({title:t.title,iconDataURL:t.iconDataURL,description:t.descriptions[e.id]}))}))}));return t}static showAsPassed(e){switch(e.scoreDisplayMode){case"manual":case"notApplicable":return!0;case"error":case"informative":return!1;case"numeric":case"binary":default:return Number(e.score)>=se.minScore}}static calculateRating(e,t){if("manual"===t||"notApplicable"===t)return se.label;if("error"===t)return ce.label;if(null===e)return de.label;let n=de.label;return e>=se.minScore?n=se.label:e>=le.minScore&&(n=le.label),n}static splitMarkdownCodeSpans(e){const t=[],n=e.split(/`(.*?)`/g);for(let e=0;e<n.length;e++){const r=n[e];if(!r)continue;const i=e%2!=0;t.push({isCode:i,text:r})}return t}static splitMarkdownLink(e){const t=[],n=e.split(/\[([^\]]+?)\]\((https?:\/\/.*?)\)/g);for(;n.length;){const[e,r,i]=n.splice(0,3);e&&t.push({isLink:!1,text:e}),r&&i&&t.push({isLink:!0,text:r,linkHref:i})}return t}static getURLDisplayName(e,t){const n=void 0!==(t=t||{numPathParts:void 0,preserveQuery:void 0,preserveHost:void 0}).numPathParts?t.numPathParts:2,r=void 0===t.preserveQuery||t.preserveQuery,i=t.preserveHost||!1;let o;if("about:"===e.protocol||"data:"===e.protocol)o=e.href;else{o=e.pathname;const t=o.split("/").filter((e=>e.length));n&&t.length>n&&(o=oe+t.slice(-1*n).join("/")),i&&(o=`${e.host}/${o.replace(/^\//,"")}`),r&&(o=`${o}${e.search}`)}if(o=o.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g,"$1…"),o=o.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,"$1…"),o=o.replace(/(\d{3})\d{6,}/g,"$1…"),o=o.replace(/\u2026+/g,oe),o.length>64&&o.includes("?")&&(o=o.replace(/\?([^=]*)(=)?.*/,"?$1$2…"),o.length>64&&(o=o.replace(/\?.*/,"?…"))),o.length>64){const e=o.lastIndexOf(".");o=e>=0?o.slice(0,63-(o.length-e))+`…${o.slice(e)}`:o.slice(0,63)+oe}return o}static parseURL(e){const t=new URL(e);return{file:he.getURLDisplayName(t),hostname:t.hostname,origin:t.origin}}static createOrReturnURL(e){return e instanceof URL?e:new URL(e)}static getTld(e){const t=e.split(".").slice(-2);return pe.includes(t[0])?`.${t.join(".")}`:`.${t[t.length-1]}`}static getRootDomain(e){const t=he.createOrReturnURL(e).hostname,n=he.getTld(t).split(".");return t.split(".").slice(-n.length).join(".")}static getEnvironmentDisplayValues(e){const t=he.getEmulationDescriptions(e);return[{name:he.i18n.strings.runtimeSettingsDevice,description:t.deviceEmulation},{name:he.i18n.strings.runtimeSettingsNetworkThrottling,description:t.networkThrottling},{name:he.i18n.strings.runtimeSettingsCPUThrottling,description:t.cpuThrottling}]}static getEmulationDescriptions(e){let t,n;const r=e.throttling;switch(e.throttlingMethod){case"provided":t=he.i18n.strings.throttlingProvided,n=he.i18n.strings.throttlingProvided;break;case"devtools":{const{cpuSlowdownMultiplier:e,requestLatencyMs:i}=r;t=`${he.i18n.formatNumber(e)}x slowdown (DevTools)`,n=`${he.i18n.formatNumber(i)} ms HTTP RTT, ${he.i18n.formatNumber(r.downloadThroughputKbps)} Kbps down, ${he.i18n.formatNumber(r.uploadThroughputKbps)} Kbps up (DevTools)`;break}case"simulate":{const{cpuSlowdownMultiplier:e,rttMs:i,throughputKbps:o}=r;t=`${he.i18n.formatNumber(e)}x slowdown (Simulated)`,n=`${he.i18n.formatNumber(i)} ms TCP RTT, ${he.i18n.formatNumber(o)} Kbps throughput (Simulated)`;break}default:t=he.i18n.strings.runtimeUnknown,n=he.i18n.strings.runtimeUnknown}return{deviceEmulation:{mobile:he.i18n.strings.runtimeMobileEmulation,desktop:he.i18n.strings.runtimeDesktopEmulation}[e.formFactor]||he.i18n.strings.runtimeNoEmulation,cpuThrottling:t,networkThrottling:n}}static filterRelevantLines(e,t,n){if(0===t.length)return e.slice(0,2*n+1);const r=new Set;return(t=t.sort(((e,t)=>(e.lineNumber||0)-(t.lineNumber||0)))).forEach((({lineNumber:e})=>{let t=e-n,i=e+n;for(;t<1;)t++,i++;r.has(t-3-1)&&(t-=3);for(let e=t;e<=i;e++){const t=e;r.add(t)}})),e.filter((e=>r.has(e.lineNumber)))}static isPluginCategory(e){return e.startsWith("lighthouse-plugin-")}}he.reportJson=null,he.getUniqueSuffix=(()=>{let e=0;return function(){return e++}})(),he.i18n=null,he.UIStrings={varianceDisclaimer:"Values are estimated and may vary. The [performance score is calculated](https://web.dev/performance-scoring/) directly from these metrics.",calculatorLink:"See calculator.",showRelevantAudits:"Show audits relevant to:",opportunityResourceColumnLabel:"Opportunity",opportunitySavingsColumnLabel:"Estimated Savings",errorMissingAuditInfo:"Report error: no audit information",errorLabel:"Error!",warningHeader:"Warnings: ",warningAuditsGroupTitle:"Passed audits but with warnings",passedAuditsGroupTitle:"Passed audits",notApplicableAuditsGroupTitle:"Not applicable",manualAuditsGroupTitle:"Additional items to manually check",toplevelWarningsMessage:"There were issues affecting this run of Lighthouse:",crcInitialNavigation:"Initial Navigation",crcLongestDurationLabel:"Maximum critical path latency:",snippetExpandButtonLabel:"Expand snippet",snippetCollapseButtonLabel:"Collapse snippet",lsPerformanceCategoryDescription:"[Lighthouse](https://developers.google.com/web/tools/lighthouse/) analysis of the current page on an emulated mobile network. Values are estimated and may vary.",labDataTitle:"Lab Data",thirdPartyResourcesLabel:"Show 3rd-party resources",viewTreemapLabel:"View Treemap",dropdownPrintSummary:"Print Summary",dropdownPrintExpanded:"Print Expanded",dropdownCopyJSON:"Copy JSON",dropdownSaveHTML:"Save as HTML",dropdownSaveJSON:"Save as JSON",dropdownViewer:"Open in Viewer",dropdownSaveGist:"Save as Gist",dropdownDarkTheme:"Toggle Dark Theme",runtimeSettingsTitle:"Runtime Settings",runtimeSettingsUrl:"URL",runtimeSettingsFetchTime:"Fetch Time",runtimeSettingsDevice:"Device",runtimeSettingsNetworkThrottling:"Network throttling",runtimeSettingsCPUThrottling:"CPU throttling",runtimeSettingsChannel:"Channel",runtimeSettingsUA:"User agent (host)",runtimeSettingsUANetwork:"User agent (network)",runtimeSettingsBenchmark:"CPU/Memory Power",runtimeSettingsAxeVersion:"Axe version",footerIssue:"File an issue",runtimeNoEmulation:"No emulation",runtimeMobileEmulation:"Emulated Moto G4",runtimeDesktopEmulation:"Emulated Desktop",runtimeUnknown:"Unknown",throttlingProvided:"Provided by environment"},he.UIStrings;
|
|
18
|
-
/**
|
|
19
|
-
* @license
|
|
20
|
-
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
21
|
-
*
|
|
22
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
23
|
-
* you may not use this file except in compliance with the License.
|
|
24
|
-
* You may obtain a copy of the License at
|
|
25
|
-
*
|
|
26
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
-
*
|
|
28
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
29
|
-
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
30
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
31
|
-
* See the License for the specific language governing permissions and
|
|
32
|
-
* limitations under the License.
|
|
33
|
-
*/
|
|
34
|
-
class ue{constructor(e,t){this.dom=e,this.detailsRenderer=t}get _clumpTitles(){return{warning:he.i18n.strings.warningAuditsGroupTitle,manual:he.i18n.strings.manualAuditsGroupTitle,passed:he.i18n.strings.passedAuditsGroupTitle,notApplicable:he.i18n.strings.notApplicableAuditsGroupTitle}}renderAudit(e){const t=this.dom.createComponent("audit");return this.populateAuditValues(e,t)}populateAuditValues(e,t){const n=he.i18n.strings,r=this.dom.find(".lh-audit",t);r.id=e.result.id;const i=e.result.scoreDisplayMode;e.result.displayValue&&(this.dom.find(".lh-audit__display-text",r).textContent=e.result.displayValue);const o=this.dom.find(".lh-audit__title",r);o.appendChild(this.dom.convertMarkdownCodeSnippets(e.result.title));const a=this.dom.find(".lh-audit__description",r);a.appendChild(this.dom.convertMarkdownLinkSnippets(e.result.description));for(const t of e.relevantMetrics||[]){const e=this.dom.createChildOf(a,"span","lh-audit__adorn");e.title=`Relevant to ${t.result.title}`,e.textContent=t.acronym||t.id}e.stackPacks&&e.stackPacks.forEach((e=>{const t=this.dom.createElement("div");t.classList.add("lh-audit__stackpack");const n=this.dom.createElement("img");n.classList.add("lh-audit__stackpack__img"),n.src=e.iconDataURL,n.alt=e.title,t.appendChild(n),t.appendChild(this.dom.convertMarkdownLinkSnippets(e.description)),this.dom.find(".lh-audit__stackpacks",r).appendChild(t)}));const s=this.dom.find("details",r);if(e.result.details){const t=this.detailsRenderer.render(e.result.details);t&&(t.classList.add("lh-details"),s.appendChild(t))}if(this.dom.find(".lh-chevron-container",r).appendChild(this._createChevron()),this._setRatingClass(r,e.result.score,i),"error"===e.result.scoreDisplayMode){r.classList.add("lh-audit--error");const t=this.dom.find(".lh-audit__display-text",r);t.textContent=n.errorLabel,t.classList.add("lh-tooltip-boundary");this.dom.createChildOf(t,"div","lh-tooltip lh-tooltip--error").textContent=e.result.errorMessage||n.errorMissingAuditInfo}else if(e.result.explanation){this.dom.createChildOf(o,"div","lh-audit-explanation").textContent=e.result.explanation}const l=e.result.warnings;if(!l||0===l.length)return r;const d=this.dom.find("summary",s),c=this.dom.createChildOf(d,"div","lh-warnings");if(this.dom.createChildOf(c,"span").textContent=n.warningHeader,1===l.length)c.appendChild(this.dom.document().createTextNode(l.join("")));else{const e=this.dom.createChildOf(c,"ul");for(const t of l){this.dom.createChildOf(e,"li").textContent=t}}return r}_createChevron(){const e=this.dom.createComponent("chevron");return this.dom.find("svg.lh-chevron",e)}_setRatingClass(e,t,n){const r=he.calculateRating(t,n);return e.classList.add(`lh-audit--${n.toLowerCase()}`),"informative"!==n&&e.classList.add(`lh-audit--${r}`),e}renderCategoryHeader(e,t){const n=this.dom.createComponent("categoryHeader"),r=this.dom.find(".lh-score__gauge",n),i=this.renderScoreGauge(e,t);if(r.appendChild(i),e.description){const t=this.dom.convertMarkdownLinkSnippets(e.description);this.dom.find(".lh-category-header__description",n).appendChild(t)}return n}renderAuditGroup(e){const t=this.dom.createElement("div","lh-audit-group"),n=this.dom.createElement("div","lh-audit-group__header");if(this.dom.createChildOf(n,"span","lh-audit-group__title").textContent=e.title,e.description){const t=this.dom.convertMarkdownLinkSnippets(e.description);t.classList.add("lh-audit-group__description"),n.appendChild(t)}return t.appendChild(n),t}_renderGroupedAudits(e,t){const n=new Map,r="NotAGroup";n.set(r,[]);for(const t of e){const e=t.group||r,i=n.get(e)||[];i.push(t),n.set(e,i)}const i=[];for(const[e,o]of n){if(e===r){for(const e of o)i.push(this.renderAudit(e));continue}const n=t[e],a=this.renderAuditGroup(n);for(const e of o)a.appendChild(this.renderAudit(e));a.classList.add(`lh-audit-group--${e}`),i.push(a)}return i}renderUnexpandableClump(e,t){const n=this.dom.createElement("div");return this._renderGroupedAudits(e,t).forEach((e=>n.appendChild(e))),n}renderClump(e,{auditRefs:t,description:n}){const r=this.dom.createComponent("clump"),i=this.dom.find(".lh-clump",r);"warning"===e&&i.setAttribute("open","");this.dom.find("div.lh-audit-group__summary",i).appendChild(this._createChevron());const o=this.dom.find(".lh-audit-group__header",i),a=this._clumpTitles[e];if(this.dom.find(".lh-audit-group__title",o).textContent=a,n){const e=this.dom.convertMarkdownLinkSnippets(n);e.classList.add("lh-audit-group__description"),o.appendChild(e)}this.dom.find(".lh-audit-group__itemcount",i).textContent=`(${t.length})`;const s=t.map(this.renderAudit.bind(this));return i.append(...s),i.classList.add(`lh-clump--${e.toLowerCase()}`),i}renderScoreGauge(e,t){const n=this.dom.createComponent("gauge"),r=this.dom.find("a.lh-gauge__wrapper",n);this.dom.safelySetHref(r,`#${e.id}`),he.isPluginCategory(e.id)&&r.classList.add("lh-gauge__wrapper--plugin");const i=Number(e.score),o=this.dom.find(".lh-gauge",n),a=this.dom.find("circle.lh-gauge-arc",o);a&&this._setGaugeArc(a,i);const s=Math.round(100*i),l=this.dom.find("div.lh-gauge__percentage",n);return l.textContent=s.toString(),null===e.score&&(l.textContent="?",l.title=he.i18n.strings.errorLabel),0===e.auditRefs.length||this.hasApplicableAudits(e)?r.classList.add(`lh-gauge__wrapper--${he.calculateRating(e.score)}`):(r.classList.add("lh-gauge__wrapper--not-applicable"),l.textContent="-",l.title=he.i18n.strings.notApplicableAuditsGroupTitle),this.dom.find(".lh-gauge__label",n).textContent=e.title,n}hasApplicableAudits(e){return e.auditRefs.some((e=>"notApplicable"!==e.result.scoreDisplayMode))}_setGaugeArc(e,t){const n=2*Math.PI*Number(e.getAttribute("r")),r=Number(e.getAttribute("stroke-width")),i=.25*r/n;e.style.transform=`rotate(${360*i-90}deg)`;let o=t*n-r/2;0===t&&(e.style.opacity="0"),1===t&&(o=n),e.style.strokeDasharray=`${Math.max(o,0)} ${n}`}_auditHasWarning(e){return Boolean(e.result.warnings&&e.result.warnings.length)}_getClumpIdForAuditRef(e){const t=e.result.scoreDisplayMode;return"manual"===t||"notApplicable"===t?t:he.showAsPassed(e.result)?this._auditHasWarning(e)?"warning":"passed":"failed"}render(e,t={}){const n=this.dom.createElement("div","lh-category");this.createPermalinkSpan(n,e.id),n.appendChild(this.renderCategoryHeader(e,t));const r=new Map;r.set("failed",[]),r.set("warning",[]),r.set("manual",[]),r.set("passed",[]),r.set("notApplicable",[]);for(const t of e.auditRefs){const e=this._getClumpIdForAuditRef(t),n=r.get(e);n.push(t),r.set(e,n)}for(const[i,o]of r){if(0===o.length)continue;if("failed"===i){const e=this.renderUnexpandableClump(o,t);e.classList.add("lh-clump--failed"),n.appendChild(e);continue}const r="manual"===i?e.manualDescription:void 0,a=this.renderClump(i,{auditRefs:o,description:r});n.appendChild(a)}return n}createPermalinkSpan(e,t){this.dom.createChildOf(e,"span","lh-permalink").id=t}}
|
|
35
|
-
/**
|
|
36
|
-
* @license
|
|
37
|
-
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
38
|
-
*
|
|
39
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
40
|
-
* you may not use this file except in compliance with the License.
|
|
41
|
-
* You may obtain a copy of the License at
|
|
42
|
-
*
|
|
43
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
44
|
-
*
|
|
45
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
46
|
-
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
47
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
48
|
-
* See the License for the specific language governing permissions and
|
|
49
|
-
* limitations under the License.
|
|
50
|
-
*/class me{static initTree(e){let t=0;const n=Object.keys(e);if(n.length>0){t=e[n[0]].request.startTime}return{tree:e,startTime:t,transferSize:0}}static createSegment(e,t,n,r,i,o){const a=e[t],s=Object.keys(e),l=s.indexOf(t)===s.length-1,d=!!a.children&&Object.keys(a.children).length>0,c=Array.isArray(i)?i.slice(0):[];return void 0!==o&&c.push(!o),{node:a,isLastChild:l,hasChildren:d,startTime:n,transferSize:r+a.request.transferSize,treeMarkers:c}}static createChainNode(e,t,n){const r=e.createComponent("crcChain");e.find(".lh-crc-node",r).setAttribute("title",t.node.request.url);const i=e.find(".lh-crc-node__tree-marker",r);t.treeMarkers.forEach((t=>{t?(i.appendChild(e.createElement("span","lh-tree-marker lh-vert")),i.appendChild(e.createElement("span","lh-tree-marker"))):(i.appendChild(e.createElement("span","lh-tree-marker")),i.appendChild(e.createElement("span","lh-tree-marker")))})),t.isLastChild?(i.appendChild(e.createElement("span","lh-tree-marker lh-up-right")),i.appendChild(e.createElement("span","lh-tree-marker lh-right"))):(i.appendChild(e.createElement("span","lh-tree-marker lh-vert-right")),i.appendChild(e.createElement("span","lh-tree-marker lh-right"))),t.hasChildren?i.appendChild(e.createElement("span","lh-tree-marker lh-horiz-down")):i.appendChild(e.createElement("span","lh-tree-marker lh-right"));const o=t.node.request.url,a=n.renderTextURL(o),s=e.find(".lh-crc-node__tree-value",r);if(s.appendChild(a),!t.hasChildren){const{startTime:n,endTime:r,transferSize:i}=t.node.request,o=e.createElement("span","lh-crc-node__chain-duration");o.textContent=" - "+he.i18n.formatMilliseconds(1e3*(r-n))+", ";const a=e.createElement("span","lh-crc-node__chain-duration");a.textContent=he.i18n.formatBytesToKiB(i,.01),s.appendChild(o),s.appendChild(a)}return r}static buildTree(e,t,n,r,i,o){if(r.appendChild(ge.createChainNode(e,n,o)),n.node.children)for(const a of Object.keys(n.node.children)){const s=ge.createSegment(n.node.children,a,n.startTime,n.transferSize,n.treeMarkers,n.isLastChild);ge.buildTree(e,t,s,r,i,o)}}static render(e,t,n){const r=e.createComponent("crc"),i=e.find(".lh-crc",r);e.find(".lh-crc-initial-nav",r).textContent=he.i18n.strings.crcInitialNavigation,e.find(".lh-crc__longest_duration_label",r).textContent=he.i18n.strings.crcLongestDurationLabel,e.find(".lh-crc__longest_duration",r).textContent=he.i18n.formatMilliseconds(t.longestChain.duration);const o=ge.initTree(t.chains);for(const a of Object.keys(o.tree)){const s=ge.createSegment(o.tree,a,o.startTime,o.transferSize);ge.buildTree(e,r,s,i,t,n)}return e.find(".lh-crc-container",r)}}const ge=me,_e=0,fe=1,ve=2,be=0,we=1,ye=2,xe=3,Se={[be]:["lh-snippet__line--content"],[we]:["lh-snippet__line--content","lh-snippet__line--content-highlighted"],[ye]:["lh-snippet__line--placeholder"],[xe]:["lh-snippet__line--message"]};
|
|
51
|
-
/**
|
|
52
|
-
* @license Copyright 2019 The Lighthouse Authors. All Rights Reserved.
|
|
53
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
54
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
55
|
-
*/function Ce(e,t){return{line:e.find((e=>e.lineNumber===t)),previousLine:e.find((e=>e.lineNumber===t-1))}}function Ae(e,t){return e.filter((e=>e.lineNumber===t))}function Ee(e){return he.filterRelevantLines(e.lines,e.lineMessages,2)}class ke{static renderHeader(e,t,n,r){const i=Ee(t).length<t.lines.length,o=e.createComponent("snippetHeader");e.find(".lh-snippet__title",o).textContent=t.title;const{snippetCollapseButtonLabel:a,snippetExpandButtonLabel:s}=he.i18n.strings;e.find(".lh-snippet__btn-label-collapse",o).textContent=a,e.find(".lh-snippet__btn-label-expand",o).textContent=s;const l=e.find(".lh-snippet__toggle-expand",o);if(i?l.addEventListener("click",(()=>r())):l.remove(),t.node&&e.isDevTools()){e.find(".lh-snippet__node",o).appendChild(n.renderNode(t.node))}return o}static renderSnippetLine(e,t,{content:n,lineNumber:r,truncated:i,contentType:o,visibility:a}){const s=e.createComponent("snippetLine"),l=e.find(".lh-snippet__line",s),{classList:d}=l;Se[o].forEach((e=>d.add(e))),a===fe?d.add("lh-snippet__show-if-collapsed"):a===ve&&d.add("lh-snippet__show-if-expanded");const c=n+(i?"…":""),p=e.find(".lh-snippet__line code",l);return o===xe?p.appendChild(e.convertMarkdownLinkSnippets(c)):p.textContent=c,e.find(".lh-snippet__line-number",l).textContent=r.toString(),l}static renderMessage(e,t,n){return ke.renderSnippetLine(e,t,{lineNumber:" ",content:n.message,contentType:xe})}static renderOmittedLinesPlaceholder(e,t,n){return ke.renderSnippetLine(e,t,{lineNumber:"…",content:"",visibility:n,contentType:ye})}static renderSnippetContent(e,t,n){const r=e.createComponent("snippetContent"),i=e.find(".lh-snippet__snippet-inner",r);return n.generalMessages.forEach((n=>i.append(ke.renderMessage(e,t,n)))),i.append(ke.renderSnippetLines(e,t,n)),r}static renderSnippetLines(e,t,n){const{lineMessages:r,generalMessages:i,lineCount:o,lines:a}=n,s=Ee(n),l=i.length>0&&0===r.length,d=e.createFragment();let c=!1;for(let n=1;n<=o;n++){const{line:i,previousLine:o}=Ce(a,n),{line:p,previousLine:h}=Ce(s,n),u=!!p;!!h&&!u&&(c=!0),u&&c&&(d.append(ke.renderOmittedLinesPlaceholder(e,t,fe)),c=!1);const m=!i&&1===n;if(!i&&!!o||m){const r=!s.some((e=>e.lineNumber>n))||1===n;d.append(ke.renderOmittedLinesPlaceholder(e,t,r?ve:_e)),c=!1}if(!i)continue;const g=Ae(r,n),_=g.length>0||l,f=Object.assign({},i,{contentType:_?we:be,visibility:p?_e:ve});d.append(ke.renderSnippetLine(e,t,f)),g.forEach((n=>{d.append(ke.renderMessage(e,t,n))}))}return d}static render(e,t,n){const r=e.createComponent("snippet"),i=e.find(".lh-snippet",r),o=ke.renderHeader(e,t,n,(()=>i.classList.toggle("lh-snippet--expanded"))),a=ke.renderSnippetContent(e,r,t);return i.append(o,a),i}}
|
|
56
|
-
/**
|
|
57
|
-
* @license Copyright 2020 The Lighthouse Authors. All Rights Reserved.
|
|
58
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
59
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
60
|
-
*/function Ne(e,t,n){return e<t?t:e>n?n:e}class Le{static getScreenshotPositions(e,t,n){const r={x:(i=e).left+i.width/2,y:i.top+i.height/2};var i;const o=Ne(r.x-t.width/2,0,n.width-t.width),a=Ne(r.y-t.height/2,0,n.height-t.height);return{screenshot:{left:o,top:a},clip:{left:e.left-o,top:e.top-a}}}static renderClipPathInScreenshot(e,t,n,r,i){const o=e.find("clipPath",t),a=`clip-${he.getUniqueSuffix()}`;o.id=a,t.style.clipPath=`url(#${a})`;const s=n.top/i.height,l=s+r.height/i.height,d=n.left/i.width,c=d+r.width/i.width,p=[`0,0 1,0 1,${s} 0,${s}`,`0,${l} 1,${l} 1,1 0,1`,`0,${s} ${d},${s} ${d},${l} 0,${l}`,`${c},${s} 1,${s} 1,${l} ${c},${l}`];for(const t of p){const n=e.createElementNS("http://www.w3.org/2000/svg","polygon");n.setAttribute("points",t),o.append(n)}}static installFullPageScreenshot(e,t){e.style.setProperty("--element-screenshot-url",`url(${t.data})`)}static installOverlayFeature(e){const{dom:t,reportEl:n,overlayContainerEl:r,fullPageScreenshot:i}=e,o="lh-screenshot-overlay--enabled";n.classList.contains(o)||(n.classList.add(o),n.addEventListener("click",(e=>{const n=e.target;if(!n)return;const o=n.closest(".lh-node > .lh-element-screenshot");if(!o)return;const a=t.createElement("div","lh-element-screenshot__overlay");r.append(a);const s={width:.95*a.clientWidth,height:.8*a.clientHeight},l={width:Number(o.dataset.rectWidth),height:Number(o.dataset.rectHeight),left:Number(o.dataset.rectLeft),right:Number(o.dataset.rectLeft)+Number(o.dataset.rectWidth),top:Number(o.dataset.rectTop),bottom:Number(o.dataset.rectTop)+Number(o.dataset.rectHeight)},d=Le.render(t,i.screenshot,l,s);d?(a.appendChild(d),a.addEventListener("click",(()=>a.remove()))):a.remove()})))}static _computeZoomFactor(e,t){const n={x:t.width/e.width,y:t.height/e.height},r=.75*Math.min(n.x,n.y);return Math.min(1,r)}static render(e,t,n,r){if(!function(e,t){return t.left<=e.width&&0<=t.right&&t.top<=e.height&&0<=t.bottom}(t,n))return null;const i=e.createComponent("elementScreenshot"),o=e.find("div.lh-element-screenshot",i);o.dataset.rectWidth=n.width.toString(),o.dataset.rectHeight=n.height.toString(),o.dataset.rectLeft=n.left.toString(),o.dataset.rectTop=n.top.toString();const a=this._computeZoomFactor(n,r),s={width:r.width/a,height:r.height/a};s.width=Math.min(t.width,s.width);const l=s.width*a,d=s.height*a,c=Le.getScreenshotPositions(n,s,{width:t.width,height:t.height});e.find("div.lh-element-screenshot__content",o).style.top=`-${d}px`;const p=e.find("div.lh-element-screenshot__image",o);p.style.width=l+"px",p.style.height=d+"px",p.style.backgroundPositionY=-c.screenshot.top*a+"px",p.style.backgroundPositionX=-c.screenshot.left*a+"px",p.style.backgroundSize=`${t.width*a}px ${t.height*a}px`;const h=e.find("div.lh-element-screenshot__element-marker",o);h.style.width=n.width*a+"px",h.style.height=n.height*a+"px",h.style.left=c.clip.left*a+"px",h.style.top=c.clip.top*a+"px";const u=e.find("div.lh-element-screenshot__mask",o);return u.style.width=l+"px",u.style.height=d+"px",Le.renderClipPathInScreenshot(e,u,c.clip,n,s),o}}
|
|
61
|
-
/**
|
|
62
|
-
* @license
|
|
63
|
-
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
64
|
-
*
|
|
65
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
66
|
-
* you may not use this file except in compliance with the License.
|
|
67
|
-
* You may obtain a copy of the License at
|
|
68
|
-
*
|
|
69
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
70
|
-
*
|
|
71
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
72
|
-
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
73
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
74
|
-
* See the License for the specific language governing permissions and
|
|
75
|
-
* limitations under the License.
|
|
76
|
-
*/const Me=["http://","https://","data:"];class He{constructor(e,t={}){this._dom=e,this._fullPageScreenshot=t.fullPageScreenshot}render(e){switch(e.type){case"filmstrip":return this._renderFilmstrip(e);case"list":return this._renderList(e);case"table":return this._renderTable(e);case"criticalrequestchain":return me.render(this._dom,e,this);case"opportunity":return this._renderTable(e);case"screenshot":case"debugdata":case"full-page-screenshot":case"treemap-data":return null;default:return this._renderUnknown(e.type,e)}}_renderBytes(e){const t=he.i18n.formatBytesToKiB(e.value,e.granularity),n=this._renderText(t);return n.title=he.i18n.formatBytes(e.value),n}_renderMilliseconds(e){let t=he.i18n.formatMilliseconds(e.value,e.granularity);return"duration"===e.displayUnit&&(t=he.i18n.formatDuration(e.value)),this._renderText(t)}renderTextURL(e){const t=e;let n,r,i;try{const e=he.parseURL(t);n="/"===e.file?e.origin:e.file,r="/"===e.file||""===e.hostname?"":`(${e.hostname})`,i=t}catch(e){n=t}const o=this._dom.createElement("div","lh-text__url");if(o.appendChild(this._renderLink({text:n,url:t})),r){const e=this._renderText(r);e.classList.add("lh-text__url-host"),o.appendChild(e)}return i&&(o.title=t,o.dataset.url=t),o}_renderLink(e){const t=this._dom.createElement("a");if(this._dom.safelySetHref(t,e.url),!t.href){const t=this._renderText(e.text);return t.classList.add("lh-link"),t}return t.rel="noopener",t.target="_blank",t.textContent=e.text,t.classList.add("lh-link"),t}_renderText(e){const t=this._dom.createElement("div","lh-text");return t.textContent=e,t}_renderNumeric(e){const t=he.i18n.formatNumber(e.value,e.granularity),n=this._dom.createElement("div","lh-numeric");return n.textContent=t,n}_renderThumbnail(e){const t=this._dom.createElement("img","lh-thumbnail"),n=e;return t.src=n,t.title=n,t.alt="",t}_renderUnknown(e,t){console.error(`Unknown details type: ${e}`,t);const n=this._dom.createElement("details","lh-unknown");return this._dom.createChildOf(n,"summary").textContent=`We don't know how to render audit details of type \`${e}\`. The Lighthouse version that collected this data is likely newer than the Lighthouse version of the report renderer. Expand for the raw JSON.`,this._dom.createChildOf(n,"pre").textContent=JSON.stringify(t,null,2),n}_renderTableValue(e,t){if(null==e)return null;if("object"==typeof e)switch(e.type){case"code":return this._renderCode(e.value);case"link":return this._renderLink(e);case"node":return this.renderNode(e);case"numeric":return this._renderNumeric(e);case"source-location":return this.renderSourceLocation(e);case"url":return this.renderTextURL(e.value);default:return this._renderUnknown(e.type,e)}switch(t.valueType){case"bytes":{const n=Number(e);return this._renderBytes({value:n,granularity:t.granularity})}case"code":{const t=String(e);return this._renderCode(t)}case"ms":{const n={value:Number(e),granularity:t.granularity,displayUnit:t.displayUnit};return this._renderMilliseconds(n)}case"numeric":{const n=Number(e);return this._renderNumeric({value:n,granularity:t.granularity})}case"text":{const t=String(e);return this._renderText(t)}case"thumbnail":{const t=String(e);return this._renderThumbnail(t)}case"timespanMs":{const t=Number(e);return this._renderMilliseconds({value:t})}case"url":{const t=String(e);return Me.some((e=>t.startsWith(e)))?this.renderTextURL(t):this._renderCode(t)}default:return this._renderUnknown(t.valueType,e)}}_getCanonicalizedHeadingsFromTable(e){return"opportunity"===e.type?e.headings:e.headings.map((e=>this._getCanonicalizedHeading(e)))}_getCanonicalizedHeading(e){let t;return e.subItemsHeading&&(t=this._getCanonicalizedsubItemsHeading(e.subItemsHeading,e)),{key:e.key,valueType:e.itemType,subItemsHeading:t,label:e.text,displayUnit:e.displayUnit,granularity:e.granularity}}_getCanonicalizedsubItemsHeading(e,t){return e.key||console.warn("key should not be null"),{key:e.key||"",valueType:e.itemType||t.itemType,granularity:e.granularity||t.granularity,displayUnit:e.displayUnit||t.displayUnit}}_getDerivedsubItemsHeading(e){return e.subItemsHeading?{key:e.subItemsHeading.key||"",valueType:e.subItemsHeading.valueType||e.valueType,granularity:e.subItemsHeading.granularity||e.granularity,displayUnit:e.subItemsHeading.displayUnit||e.displayUnit,label:""}:null}_renderTableRow(e,t){const n=this._dom.createElement("tr");for(const r of t){if(!r||!r.key){this._dom.createChildOf(n,"td","lh-table-column--empty");continue}const t=e[r.key];let i;if(null!=t&&(i=this._renderTableValue(t,r)),i){const e=`lh-table-column--${r.valueType}`;this._dom.createChildOf(n,"td",e).appendChild(i)}else this._dom.createChildOf(n,"td","lh-table-column--empty")}return n}_renderTableRowsFromItem(e,t){const n=this._dom.createFragment();if(n.append(this._renderTableRow(e,t)),!e.subItems)return n;const r=t.map(this._getDerivedsubItemsHeading);if(!r.some(Boolean))return n;for(const t of e.subItems.items){const e=this._renderTableRow(t,r);e.classList.add("lh-sub-item-row"),n.append(e)}return n}_renderTable(e){if(!e.items.length)return this._dom.createElement("span");const t=this._dom.createElement("table","lh-table"),n=this._dom.createChildOf(t,"thead"),r=this._dom.createChildOf(n,"tr"),i=this._getCanonicalizedHeadingsFromTable(e);for(const e of i){const t=`lh-table-column--${e.valueType||"text"}`,n=this._dom.createElement("div","lh-text");n.textContent=e.label,this._dom.createChildOf(r,"th",t).appendChild(n)}const o=this._dom.createChildOf(t,"tbody");let a=!0;for(const t of e.items){const e=this._renderTableRowsFromItem(t,i);for(const t of this._dom.findAll("tr",e))t.classList.add(a?"lh-row--even":"lh-row--odd");a=!a,o.append(e)}return t}_renderList(e){const t=this._dom.createElement("div","lh-list");return e.items.forEach((e=>{const n=ke.render(this._dom,e,this);t.appendChild(n)})),t}renderNode(e){const t=this._dom.createElement("span","lh-node");if(e.nodeLabel){const n=this._dom.createElement("div");n.textContent=e.nodeLabel,t.appendChild(n)}if(e.snippet){const n=this._dom.createElement("div");n.classList.add("lh-node__snippet"),n.textContent=e.snippet,t.appendChild(n)}if(e.selector&&(t.title=e.selector),e.path&&t.setAttribute("data-path",e.path),e.selector&&t.setAttribute("data-selector",e.selector),e.snippet&&t.setAttribute("data-snippet",e.snippet),!this._fullPageScreenshot)return t;const n=e.lhId&&this._fullPageScreenshot.nodes[e.lhId];if(!n||0===n.width||0===n.height)return t;const r=Le.render(this._dom,this._fullPageScreenshot.screenshot,n,{width:147,height:100});return r&&t.prepend(r),t}renderSourceLocation(e){if(!e.url)return null;const t=`${e.url}:${e.line+1}:${e.column}`;let n,r;if(e.original){n=`${e.original.file||"<unmapped>"}:${e.original.line+1}:${e.original.column}`}if("network"===e.urlProvider&&n)r=this._renderLink({url:e.url,text:n}),r.title=`maps to generated location ${t}`;else if("network"!==e.urlProvider||n)if("comment"===e.urlProvider&&n)r=this._renderText(`${n} (from source map)`),r.title=`${t} (from sourceURL)`;else{if("comment"!==e.urlProvider||n)return null;r=this._renderText(`${t} (from sourceURL)`)}else r=this.renderTextURL(e.url),this._dom.find(".lh-link",r).textContent+=`:${e.line+1}:${e.column}`;return r.classList.add("lh-source-location"),r.setAttribute("data-source-url",e.url),r.setAttribute("data-source-line",String(e.line)),r.setAttribute("data-source-column",String(e.column)),r}_renderFilmstrip(e){const t=this._dom.createElement("div","lh-filmstrip");for(const n of e.items){const e=this._dom.createChildOf(t,"div","lh-filmstrip__frame"),r=this._dom.createChildOf(e,"img","lh-filmstrip__thumbnail");r.src=n.data,r.alt="Screenshot"}return t}_renderCode(e){const t=this._dom.createElement("pre","lh-code");return t.textContent=e,t}}
|
|
77
|
-
/**
|
|
78
|
-
* @license
|
|
79
|
-
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
80
|
-
*
|
|
81
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
82
|
-
* you may not use this file except in compliance with the License.
|
|
83
|
-
* You may obtain a copy of the License at
|
|
84
|
-
*
|
|
85
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
86
|
-
*
|
|
87
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
88
|
-
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
89
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
90
|
-
* See the License for the specific language governing permissions and
|
|
91
|
-
* limitations under the License.
|
|
92
|
-
*/
|
|
93
|
-
class Te{constructor(e){this._document=e,this._lighthouseChannel="unknown",this._componentCache=new Map}createElement(e,t){const n=this._document.createElement(e);if(t)for(const e of t.split(/\s+/))e&&n.classList.add(e);return n}createElementNS(e,t,n){const r=this._document.createElementNS(e,t);if(n)for(const e of n.split(/\s+/))e&&r.classList.add(e);return r}createFragment(){return this._document.createDocumentFragment()}createChildOf(e,t,n){const r=this.createElement(t,n);return e.appendChild(r),r}createComponent(e){let t=this._componentCache.get(e);if(t){const e=t.cloneNode(!0);return this.findAll("style",e).forEach((e=>e.remove())),e}t=function(e,t){switch(t){case"3pFilter":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("style");n.append("\n .lh-3p-filter {\n background-color: var(--table-higlight-background-color);\n color: var(--color-gray-600);\n float: right;\n padding: 6px;\n }\n .lh-3p-filter-label, .lh-3p-filter-input {\n vertical-align: middle;\n user-select: none;\n }\n .lh-3p-filter-input:disabled + .lh-3p-ui-string {\n text-decoration: line-through;\n }\n "),t.append(n);const r=e.createElement("div","lh-3p-filter"),i=e.createElement("label","lh-3p-filter-label"),o=e.createElement("input","lh-3p-filter-input");o.setAttribute("type","checkbox"),o.setAttribute("checked","");const a=e.createElement("span","lh-3p-ui-string");a.append("Show 3rd party resources");const s=e.createElement("span","lh-3p-filter-count");return i.append(" ",o," ",a," (",s,") "),r.append(" ",i," "),t.append(r),t}(e);case"audit":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-audit"),r=e.createElement("details","lh-expandable-details"),i=e.createElement("summary"),o=e.createElement("div","lh-audit__header lh-expandable-details__summary"),a=e.createElement("span","lh-audit__score-icon"),s=e.createElement("span","lh-audit__title-and-text"),l=e.createElement("span","lh-audit__title"),d=e.createElement("span","lh-audit__display-text");s.append(" ",l," ",d," ");const c=e.createElement("div","lh-chevron-container");o.append(" ",a," ",s," ",c," "),i.append(" ",o," ");const p=e.createElement("div","lh-audit__description"),h=e.createElement("div","lh-audit__stackpacks");return r.append(" ",i," ",p," ",h," "),n.append(" ",r," "),t.append(n),t}(e);case"categoryHeader":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-category-header"),r=e.createElement("div","lh-score__gauge");r.setAttribute("role","heading"),r.setAttribute("aria-level","2");const i=e.createElement("div","lh-category-header__description");return n.append(" ",r," ",i," "),t.append(n),t}(e);case"chevron":return function(e){const t=e.document().createDocumentFragment(),n=e.createElementNS("http://www.w3.org/2000/svg","svg","lh-chevron");n.setAttribute("viewBox","0 0 100 100");const r=e.createElementNS("http://www.w3.org/2000/svg","g","lh-chevron__lines"),i=e.createElementNS("http://www.w3.org/2000/svg","path","lh-chevron__line lh-chevron__line-left");i.setAttribute("d","M10 50h40");const o=e.createElementNS("http://www.w3.org/2000/svg","path","lh-chevron__line lh-chevron__line-right");return o.setAttribute("d","M90 50H50"),r.append(" ",i," ",o," "),n.append(" ",r," "),t.append(n),t}(e);case"clump":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("details","lh-clump lh-audit-group"),r=e.createElement("summary"),i=e.createElement("div","lh-audit-group__summary"),o=e.createElement("div","lh-audit-group__header"),a=e.createElement("span","lh-audit-group__title"),s=e.createElement("span","lh-audit-group__itemcount");return o.append(" ",a," ",s," "," "," "),i.append(" ",o," "),r.append(" ",i," "),n.append(" ",r," "),t.append(n),t}(e);case"crc":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-crc-container"),r=e.createElement("style");r.append('\n .lh-crc .lh-tree-marker {\n width: 12px;\n height: 26px;\n display: block;\n float: left;\n background-position: top left;\n }\n .lh-crc .lh-horiz-down {\n background: url(\'data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><g fill="%23D8D8D8" fill-rule="evenodd"><path d="M16 12v2H-2v-2z"/><path d="M9 12v14H7V12z"/></g></svg>\');\n }\n .lh-crc .lh-right {\n background: url(\'data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><path d="M16 12v2H0v-2z" fill="%23D8D8D8" fill-rule="evenodd"/></svg>\');\n }\n .lh-crc .lh-up-right {\n background: url(\'data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><path d="M7 0h2v14H7zm2 12h7v2H9z" fill="%23D8D8D8" fill-rule="evenodd"/></svg>\');\n }\n .lh-crc .lh-vert-right {\n background: url(\'data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><path d="M7 0h2v27H7zm2 12h7v2H9z" fill="%23D8D8D8" fill-rule="evenodd"/></svg>\');\n }\n .lh-crc .lh-vert {\n background: url(\'data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><path d="M7 0h2v26H7z" fill="%23D8D8D8" fill-rule="evenodd"/></svg>\');\n }\n .lh-crc .lh-crc-tree {\n font-size: 14px;\n width: 100%;\n overflow-x: auto;\n }\n .lh-crc .lh-crc-node {\n height: 26px;\n line-height: 26px;\n white-space: nowrap;\n }\n .lh-crc .lh-crc-node__tree-value {\n margin-left: 10px;\n }\n .lh-crc .lh-crc-node__tree-value div {\n display: inline;\n }\n .lh-crc .lh-crc-node__chain-duration {\n font-weight: 700;\n }\n .lh-crc .lh-crc-initial-nav {\n color: #595959;\n font-style: italic;\n }\n .lh-crc__summary-value {\n margin-bottom: 10px;\n }\n ');const i=e.createElement("div"),o=e.createElement("div","lh-crc__summary-value"),a=e.createElement("span","lh-crc__longest_duration_label"),s=e.createElement("b","lh-crc__longest_duration");o.append(" ",a," ",s," "),i.append(" ",o," ");const l=e.createElement("div","lh-crc"),d=e.createElement("div","lh-crc-initial-nav");return l.append(" ",d," "," "),n.append(" ",r," ",i," ",l," "),t.append(n),t}(e);case"crcChain":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-crc-node"),r=e.createElement("span","lh-crc-node__tree-marker"),i=e.createElement("span","lh-crc-node__tree-value");return n.append(" ",r," ",i," "),t.append(n),t}(e);case"elementScreenshot":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-element-screenshot"),r=e.createElement("div","lh-element-screenshot__content"),i=e.createElement("div","lh-element-screenshot__mask"),o=e.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("height","0"),o.setAttribute("width","0");const a=e.createElementNS("http://www.w3.org/2000/svg","defs"),s=e.createElementNS("http://www.w3.org/2000/svg","clipPath");s.setAttribute("clipPathUnits","objectBoundingBox"),a.append(" ",s," "," "),o.append(" ",a," "),i.append(" ",o," ");const l=e.createElement("div","lh-element-screenshot__image"),d=e.createElement("div","lh-element-screenshot__element-marker");return r.append(" ",i," ",l," ",d," "),n.append(" ",r," "),t.append(n),t}(e);case"envItem":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("li","lh-env__item"),r=e.createElement("span","lh-env__name"),i=e.createElement("span","lh-env__description");return n.append(" ",r," ",i," "),t.append(n),t}(e);case"footer":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("style");n.append("\n .lh-footer {\n padding: var(--footer-padding-vertical) calc(var(--default-padding) * 2);\n max-width: var(--report-width);\n margin: 0 auto;\n }\n .lh-footer .lh-generated {\n text-align: center;\n }\n .lh-env__title {\n font-size: var(--env-item-font-size-big);\n line-height: var(--env-item-line-height-big);\n text-align: center;\n padding: var(--score-container-padding);\n }\n .lh-env {\n padding: var(--default-padding) 0;\n }\n .lh-env__items {\n padding-left: 16px;\n margin: 0 0 var(--audits-margin-bottom);\n padding: 0;\n }\n .lh-env__items .lh-env__item:nth-child(2n) {\n background-color: var(--env-item-background-color);\n }\n .lh-env__item {\n display: flex;\n padding: var(--env-item-padding);\n position: relative;\n }\n span.lh-env__name {\n font-weight: bold;\n min-width: var(--env-name-min-width);\n flex: 0.5;\n padding: 0 8px;\n }\n span.lh-env__description {\n text-align: left;\n flex: 1;\n }\n "),t.append(n);const r=e.createElement("footer","lh-footer"),i=e.createElement("div","lh-env"),o=e.createElement("div","lh-env__title");o.append("Runtime Settings");const a=e.createElement("ul","lh-env__items");a.append(" "," "),i.append(" ",o," ",a," ");const s=e.createElement("div","lh-generated"),l=e.createElement("b");l.append("Lighthouse");const d=e.createElement("span","lh-footer__version"),c=e.createElement("a","lh-footer__version_issue");return c.setAttribute("href","https://github.com/GoogleChrome/Lighthouse/issues"),c.setAttribute("target","_blank"),c.setAttribute("rel","noopener"),c.append("File an issue"),s.append(" "," Generated by ",l," ",d," | ",c," "),r.append(" "," ",i," ",s," "),t.append(r),t}(e);case"gauge":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("a","lh-gauge__wrapper");n.setAttribute("href","#");const r=e.createElement("div","lh-gauge__svg-wrapper"),i=e.createElementNS("http://www.w3.org/2000/svg","svg","lh-gauge");i.setAttribute("viewBox","0 0 120 120");const o=e.createElementNS("http://www.w3.org/2000/svg","circle","lh-gauge-base");o.setAttribute("r","56"),o.setAttribute("cx","60"),o.setAttribute("cy","60"),o.setAttribute("stroke-width","8");const a=e.createElementNS("http://www.w3.org/2000/svg","circle","lh-gauge-arc");a.setAttribute("r","56"),a.setAttribute("cx","60"),a.setAttribute("cy","60"),a.setAttribute("stroke-width","8"),i.append(" ",o," ",a," "),r.append(" ",i," ");const s=e.createElement("div","lh-gauge__percentage"),l=e.createElement("div","lh-gauge__label");return n.append(" "," ",r," ",s," "," ",l," "),t.append(n),t}(e);case"gaugePwa":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("style");n.append("\n .lh-gauge--pwa .lh-gauge--pwa__component {\n display: none;\n }\n .lh-gauge--pwa__wrapper:not(.lh-badged--all) .lh-gauge--pwa__logo > path {\n /* Gray logo unless everything is passing. */\n fill: #B0B0B0;\n }\n\n .lh-gauge--pwa__disc {\n fill: var(--color-gray-200);\n }\n\n .lh-gauge--pwa__logo--primary-color {\n fill: #304FFE;\n }\n\n .lh-gauge--pwa__logo--secondary-color {\n fill: #3D3D3D;\n }\n .lh-dark .lh-gauge--pwa__logo--secondary-color {\n fill: #D8B6B6;\n }\n\n /* No passing groups. */\n .lh-gauge--pwa__wrapper:not([class*='lh-badged--']) .lh-gauge--pwa__na-line {\n display: inline;\n }\n /* Just optimized. Same n/a line as no passing groups. */\n .lh-gauge--pwa__wrapper.lh-badged--pwa-optimized:not(.lh-badged--pwa-installable) .lh-gauge--pwa__na-line {\n display: inline;\n }\n\n /* Just installable. */\n .lh-gauge--pwa__wrapper.lh-badged--pwa-installable .lh-gauge--pwa__installable-badge {\n display: inline;\n }\n\n /* All passing groups. */\n .lh-gauge--pwa__wrapper.lh-badged--all .lh-gauge--pwa__check-circle {\n display: inline;\n }\n "),t.append(n);const r=e.createElement("a","lh-gauge__wrapper lh-gauge--pwa__wrapper");r.setAttribute("href","#");const i=e.createElementNS("http://www.w3.org/2000/svg","svg","lh-gauge lh-gauge--pwa");i.setAttribute("viewBox","0 0 60 60");const o=e.createElementNS("http://www.w3.org/2000/svg","defs"),a=e.createElementNS("http://www.w3.org/2000/svg","linearGradient");a.setAttribute("id","lh-gauge--pwa__check-circle__gradient"),a.setAttribute("x1","50%"),a.setAttribute("y1","0%"),a.setAttribute("x2","50%"),a.setAttribute("y2","100%");const s=e.createElementNS("http://www.w3.org/2000/svg","stop");s.setAttribute("stop-color","#00C852"),s.setAttribute("offset","0%");const l=e.createElementNS("http://www.w3.org/2000/svg","stop");l.setAttribute("stop-color","#009688"),l.setAttribute("offset","100%"),a.append(" ",s," ",l," ");const d=e.createElementNS("http://www.w3.org/2000/svg","linearGradient");d.setAttribute("id","lh-gauge--pwa__installable__shadow-gradient"),d.setAttribute("x1","76.056%"),d.setAttribute("x2","24.111%"),d.setAttribute("y1","82.995%"),d.setAttribute("y2","24.735%");const c=e.createElementNS("http://www.w3.org/2000/svg","stop");c.setAttribute("stop-color","#A5D6A7"),c.setAttribute("offset","0%");const p=e.createElementNS("http://www.w3.org/2000/svg","stop");p.setAttribute("stop-color","#80CBC4"),p.setAttribute("offset","100%"),d.append(" ",c," ",p," ");const h=e.createElementNS("http://www.w3.org/2000/svg","g");h.setAttribute("id","lh-gauge--pwa__installable-badge");const u=e.createElementNS("http://www.w3.org/2000/svg","circle");u.setAttribute("fill","#FFFFFF"),u.setAttribute("cx","10"),u.setAttribute("cy","10"),u.setAttribute("r","10");const m=e.createElementNS("http://www.w3.org/2000/svg","path");m.setAttribute("fill","#009688"),m.setAttribute("d","M10 4.167A5.835 5.835 0 0 0 4.167 10 5.835 5.835 0 0 0 10 15.833 5.835 5.835 0 0 0 15.833 10 5.835 5.835 0 0 0 10 4.167zm2.917 6.416h-2.334v2.334H9.417v-2.334H7.083V9.417h2.334V7.083h1.166v2.334h2.334v1.166z"),h.append(" ",u," ",m," "),o.append(" ",a," ",d," ",h," ");const g=e.createElementNS("http://www.w3.org/2000/svg","g");g.setAttribute("stroke","none"),g.setAttribute("fill-rule","nonzero");const _=e.createElementNS("http://www.w3.org/2000/svg","circle","lh-gauge--pwa__disc");_.setAttribute("cx","30"),_.setAttribute("cy","30"),_.setAttribute("r","30");const f=e.createElementNS("http://www.w3.org/2000/svg","g","lh-gauge--pwa__logo"),v=e.createElementNS("http://www.w3.org/2000/svg","path","lh-gauge--pwa__logo--secondary-color");v.setAttribute("d","M35.66 19.39l.7-1.75h2L37.4 15 38.6 12l3.4 9h-2.51l-.58-1.61z");const b=e.createElementNS("http://www.w3.org/2000/svg","path","lh-gauge--pwa__logo--primary-color");b.setAttribute("d","M33.52 21l3.65-9h-2.42l-2.5 5.82L30.5 12h-1.86l-1.9 5.82-1.35-2.65-1.21 3.72L25.4 21h2.38l1.72-5.2 1.64 5.2z");const w=e.createElementNS("http://www.w3.org/2000/svg","path","lh-gauge--pwa__logo--secondary-color");w.setAttribute("fill-rule","nonzero"),w.setAttribute("d","M20.3 17.91h1.48c.45 0 .85-.05 1.2-.15l.39-1.18 1.07-3.3a2.64 2.64 0 0 0-.28-.37c-.55-.6-1.36-.91-2.42-.91H18v9h2.3V17.9zm1.96-3.84c.22.22.33.5.33.87 0 .36-.1.65-.29.87-.2.23-.59.35-1.15.35h-.86v-2.41h.87c.52 0 .89.1 1.1.32z"),f.append(" ",v," ",b," ",w," ");const y=e.createElementNS("http://www.w3.org/2000/svg","rect","lh-gauge--pwa__component lh-gauge--pwa__na-line");y.setAttribute("fill","#FFFFFF"),y.setAttribute("x","20"),y.setAttribute("y","32"),y.setAttribute("width","20"),y.setAttribute("height","4"),y.setAttribute("rx","2");const x=e.createElementNS("http://www.w3.org/2000/svg","g","lh-gauge--pwa__component lh-gauge--pwa__installable-badge");x.setAttribute("transform","translate(20, 29)");const S=e.createElementNS("http://www.w3.org/2000/svg","path");S.setAttribute("fill","url(#lh-gauge--pwa__installable__shadow-gradient)"),S.setAttribute("d","M33.629 19.487c-4.272 5.453-10.391 9.39-17.415 10.869L3 17.142 17.142 3 33.63 19.487z");const C=e.createElementNS("http://www.w3.org/2000/svg","use");C.setAttribute("href","#lh-gauge--pwa__installable-badge"),x.append(" ",S," ",C," ");const A=e.createElementNS("http://www.w3.org/2000/svg","g","lh-gauge--pwa__component lh-gauge--pwa__check-circle");A.setAttribute("transform","translate(18, 28)");const E=e.createElementNS("http://www.w3.org/2000/svg","circle");E.setAttribute("fill","#FFFFFF"),E.setAttribute("cx","12"),E.setAttribute("cy","12"),E.setAttribute("r","12");const k=e.createElementNS("http://www.w3.org/2000/svg","path");k.setAttribute("fill","url(#lh-gauge--pwa__check-circle__gradient)"),k.setAttribute("d","M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"),A.append(" ",E," ",k," "),g.append(" "," ",_," ",f," "," ",y," "," ",x," "," ",A," "),i.append(" ",o," ",g," ");const N=e.createElement("div","lh-gauge__label");return r.append(" ",i," ",N," "),t.append(r),t}(e);case"heading":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("style");n.append("\n /* CSS Fireworks. Originally by Eddie Lin\n https://codepen.io/paulirish/pen/yEVMbP\n */\n .lh-pyro {\n display: none;\n z-index: 1;\n pointer-events: none;\n }\n .lh-score100 .lh-pyro {\n display: block;\n }\n .lh-score100 .lh-lighthouse stop:first-child {\n stop-color: hsla(200, 12%, 95%, 0);\n }\n .lh-score100 .lh-lighthouse stop:last-child {\n stop-color: hsla(65, 81%, 76%, 1);\n }\n\n .lh-pyro > .lh-pyro-before, .lh-pyro > .lh-pyro-after {\n position: absolute;\n width: 5px;\n height: 5px;\n border-radius: 2.5px;\n box-shadow: 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff;\n animation: 1s bang ease-out infinite backwards, 1s gravity ease-in infinite backwards, 5s position linear infinite backwards;\n animation-delay: 1s, 1s, 1s;\n }\n\n .lh-pyro > .lh-pyro-after {\n animation-delay: 2.25s, 2.25s, 2.25s;\n animation-duration: 1.25s, 1.25s, 6.25s;\n }\n .lh-fireworks-paused .lh-pyro > div {\n animation-play-state: paused;\n }\n\n @keyframes bang {\n to {\n box-shadow: -70px -115.67px #47ebbc, -28px -99.67px #eb47a4, 58px -31.67px #7eeb47, 13px -141.67px #eb47c5, -19px 6.33px #7347eb, -2px -74.67px #ebd247, 24px -151.67px #eb47e0, 57px -138.67px #b4eb47, -51px -104.67px #479eeb, 62px 8.33px #ebcf47, -93px 0.33px #d547eb, -16px -118.67px #47bfeb, 53px -84.67px #47eb83, 66px -57.67px #eb47bf, -93px -65.67px #91eb47, 30px -13.67px #86eb47, -2px -59.67px #83eb47, -44px 1.33px #eb47eb, 61px -58.67px #47eb73, 5px -22.67px #47e8eb, -66px -28.67px #ebe247, 42px -123.67px #eb5547, -75px 26.33px #7beb47, 15px -52.67px #a147eb, 36px -51.67px #eb8347, -38px -12.67px #eb5547, -46px -59.67px #47eb81, 78px -114.67px #eb47ba, 15px -156.67px #eb47bf, -36px 1.33px #eb4783, -72px -86.67px #eba147, 31px -46.67px #ebe247, -68px 29.33px #47e2eb, -55px 19.33px #ebe047, -56px 27.33px #4776eb, -13px -91.67px #eb5547, -47px -138.67px #47ebc7, -18px -96.67px #eb47ac, 11px -88.67px #4783eb, -67px -28.67px #47baeb, 53px 10.33px #ba47eb, 11px 19.33px #5247eb, -5px -11.67px #eb4791, -68px -4.67px #47eba7, 95px -37.67px #eb478b, -67px -162.67px #eb5d47, -54px -120.67px #eb6847, 49px -12.67px #ebe047, 88px 8.33px #47ebda, 97px 33.33px #eb8147, 6px -71.67px #ebbc47;\n }\n }\n @keyframes gravity {\n to {\n transform: translateY(80px);\n opacity: 0;\n }\n }\n @keyframes position {\n 0%, 19.9% {\n margin-top: 4%;\n margin-left: 47%;\n }\n 20%, 39.9% {\n margin-top: 7%;\n margin-left: 30%;\n }\n 40%, 59.9% {\n margin-top: 6%;\n margin-left: 70%;\n }\n 60%, 79.9% {\n margin-top: 3%;\n margin-left: 20%;\n }\n 80%, 99.9% {\n margin-top: 3%;\n margin-left: 80%;\n }\n }\n "),t.append(n);const r=e.createElement("div","lh-header-container"),i=e.createElement("div","lh-scores-wrapper-placeholder");return r.append(" ",i," "),t.append(r),t}(e);case"metric":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-metric"),r=e.createElement("div","lh-metric__innerwrap"),i=e.createElement("span","lh-metric__title"),o=e.createElement("div","lh-metric__value"),a=e.createElement("div","lh-metric__description");return r.append(" ",i," ",o," ",a," "),n.append(" ",r," "),t.append(n),t}(e);case"metricsToggle":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-metrics-toggle"),r=e.createElement("input","lh-metrics-toggle__input");r.setAttribute("type","checkbox"),r.setAttribute("id","toggle-metric-descriptions"),r.setAttribute("aria-label","Toggle the display of metric descriptions");const i=e.createElement("label","lh-metrics-toggle__label");i.setAttribute("for","toggle-metric-descriptions");const o=e.createElement("div","lh-metrics-toggle__icon lh-metrics-toggle__icon--less");o.setAttribute("aria-hidden","true");const a=e.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("width","24"),a.setAttribute("height","24"),a.setAttribute("viewBox","0 0 24 24");const s=e.createElementNS("http://www.w3.org/2000/svg","path","lh-metrics-toggle__lines");s.setAttribute("d","M4 9h16v2H4zm0 4h10v2H4z"),a.append(" ",s," "),o.append(" ",a," ");const l=e.createElement("div","lh-metrics-toggle__icon lh-metrics-toggle__icon--more");l.setAttribute("aria-hidden","true");const d=e.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("width","24"),d.setAttribute("height","24"),d.setAttribute("viewBox","0 0 24 24");const c=e.createElementNS("http://www.w3.org/2000/svg","path","lh-metrics-toggle__lines");return c.setAttribute("d","M3 18h12v-2H3v2zM3 6v2h18V6H3zm0 7h18v-2H3v2z"),d.append(" ",c," "),l.append(" ",d," "),i.append(" ",o," ",l," "),n.append(" ",r," ",i," "),t.append(n),t}(e);case"opportunity":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-audit lh-audit--load-opportunity"),r=e.createElement("details","lh-expandable-details"),i=e.createElement("summary"),o=e.createElement("div","lh-audit__header lh-expandable-details__summary"),a=e.createElement("div","lh-load-opportunity__cols"),s=e.createElement("div","lh-load-opportunity__col lh-load-opportunity__col--one"),l=e.createElement("span","lh-audit__score-icon"),d=e.createElement("div","lh-audit__title");s.append(" ",l," ",d," ");const c=e.createElement("div","lh-load-opportunity__col lh-load-opportunity__col--two"),p=e.createElement("div","lh-load-opportunity__sparkline"),h=e.createElement("div","lh-sparkline"),u=e.createElement("div","lh-sparkline__bar");h.append(u),p.append(" ",h," ");const m=e.createElement("div","lh-audit__display-text"),g=e.createElement("div","lh-chevron-container");c.append(" ",p," ",m," ",g," "),a.append(" ",s," ",c," "),o.append(" ",a," "),i.append(" ",o," ");const _=e.createElement("div","lh-audit__description"),f=e.createElement("div","lh-audit__stackpacks");return r.append(" ",i," ",_," ",f," "),n.append(" ",r," "),t.append(n),t}(e);case"opportunityHeader":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-load-opportunity__header lh-load-opportunity__cols"),r=e.createElement("div","lh-load-opportunity__col lh-load-opportunity__col--one"),i=e.createElement("div","lh-load-opportunity__col lh-load-opportunity__col--two");return n.append(" ",r," ",i," "),t.append(n),t}(e);case"scorescale":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-scorescale"),r=e.createElement("span","lh-scorescale-range lh-scorescale-range--fail");r.append("0–49");const i=e.createElement("span","lh-scorescale-range lh-scorescale-range--average");i.append("50–89");const o=e.createElement("span","lh-scorescale-range lh-scorescale-range--pass");return o.append("90–100"),n.append(" ",r," ",i," ",o," "),t.append(n),t}(e);case"scoresWrapper":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("style");n.append("\n .lh-scores-container {\n display: flex;\n flex-direction: column;\n padding: var(--scores-container-padding);\n position: relative;\n width: 100%;\n }\n\n .lh-sticky-header {\n --gauge-circle-size: 36px;\n --plugin-badge-size: 18px;\n --plugin-icon-size: 75%;\n --gauge-wrapper-width: 60px;\n --gauge-percentage-font-size: 13px;\n position: fixed;\n left: 0;\n right: 0;\n top: var(--topbar-height);\n font-weight: 700;\n display: none;\n justify-content: center;\n background-color: var(--sticky-header-background-color);\n border-bottom: 1px solid var(--color-gray-200);\n padding-top: var(--score-container-padding);\n padding-bottom: 4px;\n z-index: 1;\n pointer-events: none;\n }\n\n .lh-devtools .lh-sticky-header {\n /* The report within DevTools is placed in a container with overflow, which changes the placement of this header unless we change `position` to `sticky.` */\n position: sticky;\n }\n\n .lh-sticky-header--visible {\n display: grid;\n grid-auto-flow: column;\n pointer-events: auto;\n }\n\n /* Disable the gauge arc animation for the sticky header, so toggling display: none\n does not play the animation. */\n .lh-sticky-header .lh-gauge-arc {\n animation: none;\n }\n\n .lh-sticky-header .lh-gauge__label {\n display: none;\n }\n\n .lh-highlighter {\n width: var(--gauge-wrapper-width);\n height: 1px;\n background-color: var(--highlighter-background-color);\n /* Position at bottom of first gauge in sticky header. */\n position: absolute;\n grid-column: 1;\n bottom: -1px;\n }\n\n .lh-gauge__wrapper:first-of-type {\n contain: none;\n }\n "),t.append(n);const r=e.createElement("div","lh-scores-wrapper"),i=e.createElement("div","lh-scores-container"),o=e.createElement("div","lh-pyro"),a=e.createElement("div","lh-before"),s=e.createElement("div","lh-after");return o.append(" ",a," ",s," "),i.append(" ",o," "),r.append(" ",i," "),t.append(r),t}(e);case"snippet":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-snippet"),r=e.createElement("style");return r.append('\n :root {\n --snippet-highlight-light: #fbf1f2;\n --snippet-highlight-dark: #ffd6d8;\n }\n\n .lh-snippet__header {\n position: relative;\n overflow: hidden;\n padding: 10px;\n border-bottom: none;\n color: var(--snippet-color);\n background-color: var(--snippet-background-color);\n border: 1px solid var(--report-border-color-secondary);\n }\n .lh-snippet__title {\n font-weight: bold;\n float: left;\n }\n .lh-snippet__node {\n float: left;\n margin-left: 4px;\n }\n .lh-snippet__toggle-expand {\n padding: 1px 7px;\n margin-top: -1px;\n margin-right: -7px;\n float: right;\n background: transparent;\n border: none;\n cursor: pointer;\n font-size: 14px;\n color: #0c50c7;\n }\n\n .lh-snippet__snippet {\n overflow: auto;\n border: 1px solid var(--report-border-color-secondary);\n }\n /* Container needed so that all children grow to the width of the scroll container */\n .lh-snippet__snippet-inner {\n display: inline-block;\n min-width: 100%;\n }\n\n .lh-snippet:not(.lh-snippet--expanded) .lh-snippet__show-if-expanded {\n display: none;\n }\n .lh-snippet.lh-snippet--expanded .lh-snippet__show-if-collapsed {\n display: none;\n }\n\n .lh-snippet__line {\n background: white;\n white-space: pre;\n display: flex;\n }\n .lh-snippet__line:not(.lh-snippet__line--message):first-child {\n padding-top: 4px;\n }\n .lh-snippet__line:not(.lh-snippet__line--message):last-child {\n padding-bottom: 4px;\n }\n .lh-snippet__line--content-highlighted {\n background: var(--snippet-highlight-dark);\n }\n .lh-snippet__line--message {\n background: var(--snippet-highlight-light);\n }\n .lh-snippet__line--message .lh-snippet__line-number {\n padding-top: 10px;\n padding-bottom: 10px;\n }\n .lh-snippet__line--message code {\n padding: 10px;\n padding-left: 5px;\n color: var(--color-fail);\n font-family: var(--report-font-family);\n }\n .lh-snippet__line--message code {\n white-space: normal;\n }\n .lh-snippet__line-icon {\n padding-top: 10px;\n display: none;\n }\n .lh-snippet__line--message .lh-snippet__line-icon {\n display: block;\n }\n .lh-snippet__line-icon:before {\n content: "";\n display: inline-block;\n vertical-align: middle;\n margin-right: 4px;\n width: var(--score-icon-size);\n height: var(--score-icon-size);\n background-image: var(--fail-icon-url);\n }\n .lh-snippet__line-number {\n flex-shrink: 0;\n width: 40px;\n text-align: right;\n font-family: monospace;\n padding-right: 5px;\n margin-right: 5px;\n color: var(--color-gray-600);\n user-select: none;\n }\n '),n.append(" ",r," "),t.append(n),t}(e);case"snippetContent":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-snippet__snippet"),r=e.createElement("div","lh-snippet__snippet-inner");return n.append(" ",r," "),t.append(n),t}(e);case"snippetHeader":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-snippet__header"),r=e.createElement("div","lh-snippet__title"),i=e.createElement("div","lh-snippet__node"),o=e.createElement("button","lh-snippet__toggle-expand"),a=e.createElement("span","lh-snippet__btn-label-collapse lh-snippet__show-if-expanded"),s=e.createElement("span","lh-snippet__btn-label-expand lh-snippet__show-if-collapsed");return o.append(" ",a," ",s," "),n.append(" ",r," ",i," ",o," "),t.append(n),t}(e);case"snippetLine":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-snippet__line"),r=e.createElement("div","lh-snippet__line-number"),i=e.createElement("div","lh-snippet__line-icon"),o=e.createElement("code");return n.append(" ",r," ",i," ",o," "),t.append(n),t}(e);case"topbar":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("style");n.append("\n .lh-topbar {\n position: sticky;\n top: 0;\n left: 0;\n right: 0;\n z-index: 1000;\n display: flex;\n align-items: center;\n height: var(--topbar-height);\n background-color: var(--topbar-background-color);\n padding: var(--topbar-padding);\n }\n\n .lh-topbar__logo {\n width: var(--topbar-logo-size);\n height: var(--topbar-logo-size);\n user-select: none;\n flex: none;\n }\n\n .lh-topbar__url {\n margin: var(--topbar-padding);\n text-decoration: none;\n color: var(--report-text-color);\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n\n .lh-tools {\n margin-left: auto;\n will-change: transform;\n min-width: var(--report-icon-size);\n }\n .lh-tools__button {\n width: var(--report-icon-size);\n height: var(--report-icon-size);\n cursor: pointer;\n margin-right: 5px;\n /* This is actually a button element, but we want to style it like a transparent div. */\n display: flex;\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n font: inherit;\n outline: inherit;\n }\n .lh-tools__button svg {\n fill: var(--tools-icon-color);\n }\n .lh-dark .lh-tools__button svg {\n filter: invert(1);\n }\n .lh-tools__button.lh-active + .lh-tools__dropdown {\n opacity: 1;\n clip: rect(-1px, 194px, 242px, -3px);\n visibility: visible;\n }\n .lh-tools__dropdown {\n position: absolute;\n background-color: var(--report-background-color);\n border: 1px solid var(--report-border-color);\n border-radius: 3px;\n padding: calc(var(--default-padding) / 2) 0;\n cursor: pointer;\n top: 36px;\n right: 0;\n box-shadow: 1px 1px 3px #ccc;\n min-width: 125px;\n clip: rect(0, 164px, 0, 0);\n visibility: hidden;\n opacity: 0;\n transition: all 200ms cubic-bezier(0,0,0.2,1);\n }\n .lh-tools__dropdown a {\n color: currentColor;\n text-decoration: none;\n white-space: nowrap;\n padding: 0 12px;\n line-height: 2;\n }\n .lh-tools__dropdown a:hover,\n .lh-tools__dropdown a:focus {\n background-color: var(--color-gray-200);\n outline: none;\n }\n /* save-gist option hidden in report. */\n .lh-tools__dropdown a[data-action='save-gist'] {\n display: none;\n }\n\n @media screen and (max-width: 964px) {\n .lh-tools__dropdown {\n right: 0;\n left: initial;\n }\n }\n @media print {\n .lh-topbar {\n position: static;\n margin-left: 0;\n }\n\n .lh-tools__dropdown {\n display: none;\n }\n }\n "),t.append(n);const r=e.createElement("div","lh-topbar"),i=e.createElementNS("http://www.w3.org/2000/svg","svg","lh-topbar__logo");i.setAttribute("viewBox","0 0 24 24");const o=e.createElementNS("http://www.w3.org/2000/svg","defs"),a=e.createElementNS("http://www.w3.org/2000/svg","linearGradient");a.setAttribute("x1","57.456%"),a.setAttribute("y1","13.086%"),a.setAttribute("x2","18.259%"),a.setAttribute("y2","72.322%"),a.setAttribute("id","lh-topbar__logo--a");const s=e.createElementNS("http://www.w3.org/2000/svg","stop");s.setAttribute("stop-color","#262626"),s.setAttribute("stop-opacity",".1"),s.setAttribute("offset","0%");const l=e.createElementNS("http://www.w3.org/2000/svg","stop");l.setAttribute("stop-color","#262626"),l.setAttribute("stop-opacity","0"),l.setAttribute("offset","100%"),a.append(" ",s," ",l," ");const d=e.createElementNS("http://www.w3.org/2000/svg","linearGradient");d.setAttribute("x1","100%"),d.setAttribute("y1","50%"),d.setAttribute("x2","0%"),d.setAttribute("y2","50%"),d.setAttribute("id","lh-topbar__logo--b");const c=e.createElementNS("http://www.w3.org/2000/svg","stop");c.setAttribute("stop-color","#262626"),c.setAttribute("stop-opacity",".1"),c.setAttribute("offset","0%");const p=e.createElementNS("http://www.w3.org/2000/svg","stop");p.setAttribute("stop-color","#262626"),p.setAttribute("stop-opacity","0"),p.setAttribute("offset","100%"),d.append(" ",c," ",p," ");const h=e.createElementNS("http://www.w3.org/2000/svg","linearGradient");h.setAttribute("x1","58.764%"),h.setAttribute("y1","65.756%"),h.setAttribute("x2","36.939%"),h.setAttribute("y2","50.14%"),h.setAttribute("id","lh-topbar__logo--c");const u=e.createElementNS("http://www.w3.org/2000/svg","stop");u.setAttribute("stop-color","#262626"),u.setAttribute("stop-opacity",".1"),u.setAttribute("offset","0%");const m=e.createElementNS("http://www.w3.org/2000/svg","stop");m.setAttribute("stop-color","#262626"),m.setAttribute("stop-opacity","0"),m.setAttribute("offset","100%"),h.append(" ",u," ",m," ");const g=e.createElementNS("http://www.w3.org/2000/svg","linearGradient");g.setAttribute("x1","41.635%"),g.setAttribute("y1","20.358%"),g.setAttribute("x2","72.863%"),g.setAttribute("y2","85.424%"),g.setAttribute("id","lh-topbar__logo--d");const _=e.createElementNS("http://www.w3.org/2000/svg","stop");_.setAttribute("stop-color","#FFF"),_.setAttribute("stop-opacity",".1"),_.setAttribute("offset","0%");const f=e.createElementNS("http://www.w3.org/2000/svg","stop");f.setAttribute("stop-color","#FFF"),f.setAttribute("stop-opacity","0"),f.setAttribute("offset","100%"),g.append(" ",_," ",f," "),o.append(" ",a," ",d," ",h," ",g," ");const v=e.createElementNS("http://www.w3.org/2000/svg","g");v.setAttribute("fill","none"),v.setAttribute("fill-rule","evenodd");const b=e.createElementNS("http://www.w3.org/2000/svg","path");b.setAttribute("d","M12 3l4.125 2.625v3.75H18v2.25h-1.688l1.5 9.375H6.188l1.5-9.375H6v-2.25h1.875V5.648L12 3zm2.201 9.938L9.54 14.633 9 18.028l5.625-2.062-.424-3.028zM12.005 5.67l-1.88 1.207v2.498h3.75V6.86l-1.87-1.19z"),b.setAttribute("fill","#F44B21");const w=e.createElementNS("http://www.w3.org/2000/svg","path");w.setAttribute("fill","#FFF"),w.setAttribute("d","M14.201 12.938L9.54 14.633 9 18.028l5.625-2.062z");const y=e.createElementNS("http://www.w3.org/2000/svg","path");y.setAttribute("d","M6 18c-2.042 0-3.95-.01-5.813 0l1.5-9.375h4.326L6 18z"),y.setAttribute("fill","url(#lh-topbar__logo--a)"),y.setAttribute("fill-rule","nonzero"),y.setAttribute("transform","translate(6 3)");const x=e.createElementNS("http://www.w3.org/2000/svg","path");x.setAttribute("fill","#FFF176"),x.setAttribute("fill-rule","nonzero"),x.setAttribute("d","M13.875 9.375v-2.56l-1.87-1.19-1.88 1.207v2.543z");const S=e.createElementNS("http://www.w3.org/2000/svg","path");S.setAttribute("fill","url(#lh-topbar__logo--b)"),S.setAttribute("fill-rule","nonzero"),S.setAttribute("d","M0 6.375h6v2.25H0z"),S.setAttribute("transform","translate(6 3)");const C=e.createElementNS("http://www.w3.org/2000/svg","path");C.setAttribute("fill","url(#lh-topbar__logo--c)"),C.setAttribute("fill-rule","nonzero"),C.setAttribute("d","M6 6.375H1.875v-3.75L6 0z"),C.setAttribute("transform","translate(6 3)");const A=e.createElementNS("http://www.w3.org/2000/svg","path");A.setAttribute("fill","url(#lh-topbar__logo--d)"),A.setAttribute("fill-rule","nonzero"),A.setAttribute("d","M6 0l4.125 2.625v3.75H12v2.25h-1.688l1.5 9.375H.188l1.5-9.375H0v-2.25h1.875V2.648z"),A.setAttribute("transform","translate(6 3)"),v.append(" ",b," ",w," ",y," ",x," ",S," ",C," ",A," "),i.append(" ",o," ",v," ");const E=e.createElement("a","lh-topbar__url");E.setAttribute("href",""),E.setAttribute("target","_blank"),E.setAttribute("rel","noopener");const k=e.createElement("div","lh-tools"),N=e.createElement("button","lh-tools__button");N.setAttribute("id","lh-tools-button"),N.setAttribute("title","Tools menu"),N.setAttribute("aria-label","Toggle report tools menu"),N.setAttribute("aria-haspopup","menu"),N.setAttribute("aria-expanded","false"),N.setAttribute("aria-controls","lh-tools-dropdown");const L=e.createElementNS("http://www.w3.org/2000/svg","svg");L.setAttribute("width","100%"),L.setAttribute("height","100%"),L.setAttribute("viewBox","0 0 24 24");const M=e.createElementNS("http://www.w3.org/2000/svg","path");M.setAttribute("d","M0 0h24v24H0z"),M.setAttribute("fill","none");const H=e.createElementNS("http://www.w3.org/2000/svg","path");H.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),L.append(" ",M," ",H," "),N.append(" ",L," ");const T=e.createElement("div","lh-tools__dropdown");T.setAttribute("id","lh-tools-dropdown"),T.setAttribute("role","menu"),T.setAttribute("aria-labelledby","lh-tools-button");const F=e.createElement("a","lh-report-icon lh-report-icon--print");F.setAttribute("role","menuitem"),F.setAttribute("tabindex","-1"),F.setAttribute("href","#"),F.setAttribute("data-i18n","dropdownPrintSummary"),F.setAttribute("data-action","print-summary");const R=e.createElement("a","lh-report-icon lh-report-icon--print");R.setAttribute("role","menuitem"),R.setAttribute("tabindex","-1"),R.setAttribute("href","#"),R.setAttribute("data-i18n","dropdownPrintExpanded"),R.setAttribute("data-action","print-expanded");const D=e.createElement("a","lh-report-icon lh-report-icon--copy");D.setAttribute("role","menuitem"),D.setAttribute("tabindex","-1"),D.setAttribute("href","#"),D.setAttribute("data-i18n","dropdownCopyJSON"),D.setAttribute("data-action","copy");const $=e.createElement("a","lh-report-icon lh-report-icon--download");$.setAttribute("role","menuitem"),$.setAttribute("tabindex","-1"),$.setAttribute("href","#"),$.setAttribute("data-i18n","dropdownSaveHTML"),$.setAttribute("data-action","save-html");const O=e.createElement("a","lh-report-icon lh-report-icon--download");O.setAttribute("role","menuitem"),O.setAttribute("tabindex","-1"),O.setAttribute("href","#"),O.setAttribute("data-i18n","dropdownSaveJSON"),O.setAttribute("data-action","save-json");const P=e.createElement("a","lh-report-icon lh-report-icon--open");P.setAttribute("role","menuitem"),P.setAttribute("tabindex","-1"),P.setAttribute("href","#"),P.setAttribute("data-i18n","dropdownViewer"),P.setAttribute("data-action","open-viewer");const U=e.createElement("a","lh-report-icon lh-report-icon--open");U.setAttribute("role","menuitem"),U.setAttribute("tabindex","-1"),U.setAttribute("href","#"),U.setAttribute("data-i18n","dropdownSaveGist"),U.setAttribute("data-action","save-gist");const z=e.createElement("a","lh-report-icon lh-report-icon--dark");return z.setAttribute("role","menuitem"),z.setAttribute("tabindex","-1"),z.setAttribute("href","#"),z.setAttribute("data-i18n","dropdownDarkTheme"),z.setAttribute("data-action","toggle-dark"),T.append(" ",F," ",R," ",D," ",$," ",O," ",P," ",U," ",z," "),k.append(" ",N," ",T," "),r.append(" "," ",i," ",E," ",k," "),t.append(r),t}(e);case"warningsToplevel":return function(e){const t=e.document().createDocumentFragment(),n=e.createElement("div","lh-warnings lh-warnings--toplevel"),r=e.createElement("p","lh-warnings__msg"),i=e.createElement("ul");return n.append(" ",r," ",i," "),t.append(n),t}(e)}throw new Error("unexpected component: "+t)}(this,e),this._componentCache.set(e,t);return t.cloneNode(!0)}clearComponentCache(){this._componentCache.clear()}convertMarkdownLinkSnippets(e){const t=this.createElement("span");for(const n of he.splitMarkdownLink(e)){if(!n.isLink){t.appendChild(this._document.createTextNode(n.text));continue}const e=new URL(n.linkHref);["https://developers.google.com","https://web.dev"].includes(e.origin)&&(e.searchParams.set("utm_source","lighthouse"),e.searchParams.set("utm_medium",this._lighthouseChannel));const r=this.createElement("a");r.rel="noopener",r.target="_blank",r.textContent=n.text,this.safelySetHref(r,e.href),t.appendChild(r)}return t}safelySetHref(e,t){if((t=t||"").startsWith("#"))return void(e.href=t);let n;try{n=new URL(t)}catch(e){}n&&["https:","http:"].includes(n.protocol)&&(e.href=n.href)}safelySetBlobHref(e,t){if("text/html"!==t.type&&"application/json"!==t.type)throw new Error("Unsupported blob type");const n=URL.createObjectURL(t);e.href=n}convertMarkdownCodeSnippets(e){const t=this.createElement("span");for(const n of he.splitMarkdownCodeSpans(e))if(n.isCode){const e=this.createElement("code");e.textContent=n.text,t.appendChild(e)}else t.appendChild(this._document.createTextNode(n.text));return t}setLighthouseChannel(e){this._lighthouseChannel=e}document(){return this._document}isDevTools(){return!!this._document.querySelector(".lh-devtools")}find(e,t){const n=t.querySelector(e);if(null===n)throw new Error(`query ${e} not found`);return n}findAll(e,t){return Array.from(t.querySelectorAll(e))}fireEventOn(e,t=this._document,n){const r=new CustomEvent(e,n?{detail:n}:void 0);t.dispatchEvent(r)}}
|
|
94
|
-
/**
|
|
95
|
-
* @license Copyright 2020 The Lighthouse Authors. All Rights Reserved.
|
|
96
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
97
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
98
|
-
*/const Fe=1024;class Re{constructor(e,t){"en-XA"===e&&(e="de"),this._numberDateLocale=e,this._numberFormatter=new Intl.NumberFormat(e),this._percentFormatter=new Intl.NumberFormat(e,{style:"percent"}),this._strings=t}get strings(){return this._strings}formatNumber(e,t=.1){const n=Math.round(e/t)*t;return this._numberFormatter.format(n)}formatPercent(e){return this._percentFormatter.format(e)}formatBytesToKiB(e,t=.1){return`${this._byteFormatterForGranularity(t).format(Math.round(e/1024/t)*t)} KiB`}formatBytesToMiB(e,t=.1){return`${this._byteFormatterForGranularity(t).format(Math.round(e/1048576/t)*t)} MiB`}formatBytes(e,t=1){return`${this._byteFormatterForGranularity(t).format(Math.round(e/t)*t)} bytes`}formatBytesWithBestUnit(e,t=.1){return e>=1048576?this.formatBytesToMiB(e,t):e>=Fe?this.formatBytesToKiB(e,t):this.formatNumber(e,t)+" B"}_byteFormatterForGranularity(e){let t=0;return e<1&&(t=-Math.floor(Math.log10(e))),new Intl.NumberFormat(this._numberDateLocale,{...this._numberFormatter.resolvedOptions(),maximumFractionDigits:t,minimumFractionDigits:t})}formatMilliseconds(e,t=10){const n=Math.round(e/t)*t;return 0===n?`${this._numberFormatter.format(0)} ms`:`${this._numberFormatter.format(n)} ms`}formatSeconds(e,t=.1){const n=Math.round(e/1e3/t)*t;return`${this._numberFormatter.format(n)} s`}formatDateTime(e){const t={month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"numeric",timeZoneName:"short"};let n;try{n=new Intl.DateTimeFormat(this._numberDateLocale,t)}catch(e){t.timeZone="UTC",n=new Intl.DateTimeFormat(this._numberDateLocale,t)}return n.format(new Date(e))}formatDuration(e){let t=e/1e3;if(0===Math.round(t))return"None";const n=[],r={d:86400,h:3600,m:60,s:1};return Object.keys(r).forEach((e=>{const i=r[e],o=Math.floor(t/i);o>0&&(t-=o*i,n.push(`${o} ${e}`))})),n.join(" ")}}
|
|
99
|
-
/**
|
|
100
|
-
* @license
|
|
101
|
-
* Copyright 2018 The Lighthouse Authors. All Rights Reserved.
|
|
102
|
-
*
|
|
103
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
104
|
-
* you may not use this file except in compliance with the License.
|
|
105
|
-
* You may obtain a copy of the License at
|
|
106
|
-
*
|
|
107
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
108
|
-
*
|
|
109
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
110
|
-
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
111
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
112
|
-
* See the License for the specific language governing permissions and
|
|
113
|
-
* limitations under the License.
|
|
114
|
-
*/class De extends ue{_renderMetric(e){const t=this.dom.createComponent("metric"),n=this.dom.find(".lh-metric",t);n.id=e.result.id;const r=he.calculateRating(e.result.score,e.result.scoreDisplayMode);n.classList.add(`lh-metric--${r}`);this.dom.find(".lh-metric__title",t).textContent=e.result.title;const i=this.dom.find(".lh-metric__value",t);i.textContent=e.result.displayValue||"";const o=this.dom.find(".lh-metric__description",t);if(o.appendChild(this.dom.convertMarkdownLinkSnippets(e.result.description)),"error"===e.result.scoreDisplayMode){o.textContent="",i.textContent="Error!";this.dom.createChildOf(o,"span").textContent=e.result.errorMessage||"Report error: no metric information"}return n}_renderOpportunity(e,t){const n=this.dom.createComponent("opportunity"),r=this.populateAuditValues(e,n);if(r.id=e.result.id,!e.result.details||"error"===e.result.scoreDisplayMode)return r;const i=e.result.details;if("opportunity"!==i.type)return r;const o=this.dom.find("span.lh-audit__display-text, div.lh-audit__display-text",r),a=i.overallSavingsMs/t*100+"%";if(this.dom.find("div.lh-sparkline__bar",r).style.width=a,o.textContent=he.i18n.formatSeconds(i.overallSavingsMs,.01),e.result.displayValue){const t=e.result.displayValue;this.dom.find("div.lh-load-opportunity__sparkline",r).title=t,o.title=t}return r}_getWastedMs(e){if(e.result.details&&"opportunity"===e.result.details.type){const t=e.result.details;if("number"!=typeof t.overallSavingsMs)throw new Error("non-opportunity details passed to _getWastedMs");return t.overallSavingsMs}return Number.MIN_VALUE}_getScoringCalculatorHref(e){const t=e.filter((e=>"metrics"===e.group)),n=e.find((e=>"first-cpu-idle"===e.id)),r=e.find((e=>"first-meaningful-paint"===e.id));n&&t.push(n),r&&t.push(r);const i=[...t.map((e=>{let t;var n;return"number"==typeof e.result.numericValue?(t="cumulative-layout-shift"===e.id?(n=e.result.numericValue,Math.round(100*n)/100):Math.round(e.result.numericValue),t=t.toString()):t="null",[e.acronym||e.id,t]}))];he.reportJson&&(i.push(["device",he.reportJson.configSettings.formFactor]),i.push(["version",he.reportJson.lighthouseVersion]));const o=new URLSearchParams(i),a=new URL("https://googlechrome.github.io/lighthouse/scorecalc/");return a.hash=o.toString(),a.href}render(e,t,n){const r=he.i18n.strings,i=this.dom.createElement("div","lh-category");if("PSI"===n){const n=this.dom.createElement("div","lh-score__gauge");n.appendChild(this.renderScoreGauge(e,t)),i.appendChild(n)}else this.createPermalinkSpan(i,e.id),i.appendChild(this.renderCategoryHeader(e,t));const o=this.renderAuditGroup(t.metrics),a=this.dom.createComponent("metricsToggle"),s=this.dom.find(".lh-metrics-toggle",a);o.append(...s.childNodes);const l=e.auditRefs.filter((e=>"metrics"===e.group)),d=this.dom.createChildOf(o,"div","lh-metrics-container");l.forEach((e=>{d.appendChild(this._renderMetric(e))}));const c=this.dom.createChildOf(o,"div","lh-metrics__disclaimer"),p=this.dom.convertMarkdownLinkSnippets(r.varianceDisclaimer);c.appendChild(p);const h=this.dom.createChildOf(c,"a","lh-calclink");h.target="_blank",h.textContent=r.calculatorLink,this.dom.safelySetHref(h,this._getScoringCalculatorHref(e.auditRefs)),o.classList.add("lh-audit-group--metrics"),i.appendChild(o);const u=this.dom.createChildOf(i,"div","lh-filmstrip-container"),m=e.auditRefs.find((e=>"screenshot-thumbnails"===e.id)),g=m&&m.result;if(g&&g.details){u.id=g.id;const e=this.detailsRenderer.render(g.details);e&&u.appendChild(e)}const _=e.auditRefs.filter((e=>"load-opportunities"===e.group&&!he.showAsPassed(e.result))).sort(((e,t)=>this._getWastedMs(t)-this._getWastedMs(e))),f=l.filter((e=>!!e.relevantAudits));if(f.length&&this.renderMetricAuditFilter(f,i),_.length){const e=2e3,n=_.map((e=>this._getWastedMs(e))),o=Math.max(...n),a=Math.max(1e3*Math.ceil(o/1e3),e),s=this.renderAuditGroup(t["load-opportunities"]),l=this.dom.createComponent("opportunityHeader");this.dom.find(".lh-load-opportunity__col--one",l).textContent=r.opportunityResourceColumnLabel,this.dom.find(".lh-load-opportunity__col--two",l).textContent=r.opportunitySavingsColumnLabel;const d=this.dom.find(".lh-load-opportunity__header",l);s.appendChild(d),_.forEach((e=>s.appendChild(this._renderOpportunity(e,a)))),s.classList.add("lh-audit-group--load-opportunities"),i.appendChild(s)}const v=e.auditRefs.filter((e=>"diagnostics"===e.group&&!he.showAsPassed(e.result))).sort(((e,t)=>("informative"===e.result.scoreDisplayMode?100:Number(e.result.score))-("informative"===t.result.scoreDisplayMode?100:Number(t.result.score))));if(v.length){const e=this.renderAuditGroup(t.diagnostics);v.forEach((t=>e.appendChild(this.renderAudit(t)))),e.classList.add("lh-audit-group--diagnostics"),i.appendChild(e)}const b=e.auditRefs.filter((e=>("load-opportunities"===e.group||"diagnostics"===e.group)&&he.showAsPassed(e.result)));if(!b.length)return i;const w={auditRefs:b,groupDefinitions:t},y=this.renderClump("passed",w);i.appendChild(y);const x=[];if(["performance-budget","timing-budget"].forEach((t=>{const n=e.auditRefs.find((e=>e.id===t));if(n&&n.result.details){const e=this.detailsRenderer.render(n.result.details);e&&(e.id=t,e.classList.add("lh-audit"),x.push(e))}})),x.length>0){const e=this.renderAuditGroup(t.budgets);x.forEach((t=>e.appendChild(t))),e.classList.add("lh-audit-group--budgets"),i.appendChild(e)}return i}renderMetricAuditFilter(e,t){const n=this.dom.createElement("div","lh-metricfilter");this.dom.createChildOf(n,"span","lh-metricfilter__text").textContent=he.i18n.strings.showRelevantAudits;const r=[{acronym:"All"},...e],i=he.getUniqueSuffix();for(const e of r){const r=`metric-${e.acronym}-${i}`,o=this.dom.createChildOf(n,"input","lh-metricfilter__radio");o.type="radio",o.name=`metricsfilter-${i}`,o.id=r;const a=this.dom.createChildOf(n,"label","lh-metricfilter__label");a.htmlFor=r,a.title=e.result&&e.result.title,a.textContent=e.acronym||e.id,"All"===e.acronym&&(o.checked=!0,a.classList.add("lh-metricfilter__label--active")),t.append(n),o.addEventListener("input",(n=>{for(const e of t.querySelectorAll("label.lh-metricfilter__label"))e.classList.toggle("lh-metricfilter__label--active",e.htmlFor===r);t.classList.toggle("lh-category--filtered","All"!==e.acronym);for(const n of t.querySelectorAll("div.lh-audit"))"All"!==e.acronym?(n.hidden=!0,e.relevantAudits&&e.relevantAudits.includes(n.id)&&(n.hidden=!1)):n.hidden=!1;const i=t.querySelectorAll("div.lh-audit-group, details.lh-audit-group");for(const e of i){e.hidden=!1;const t=Array.from(e.querySelectorAll("div.lh-audit")),n=!!t.length&&t.every((e=>e.hidden));e.hidden=n}}))}}}
|
|
115
|
-
/**
|
|
116
|
-
* @license
|
|
117
|
-
* Copyright 2018 The Lighthouse Authors. All Rights Reserved.
|
|
118
|
-
*
|
|
119
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
120
|
-
* you may not use this file except in compliance with the License.
|
|
121
|
-
* You may obtain a copy of the License at
|
|
122
|
-
*
|
|
123
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
124
|
-
*
|
|
125
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
126
|
-
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
127
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
128
|
-
* See the License for the specific language governing permissions and
|
|
129
|
-
* limitations under the License.
|
|
130
|
-
*/class $e extends ue{render(e,t={}){const n=this.dom.createElement("div","lh-category");this.createPermalinkSpan(n,e.id),n.appendChild(this.renderCategoryHeader(e,t));const r=e.auditRefs,i=r.filter((e=>"manual"!==e.result.scoreDisplayMode)),o=this._renderAudits(i,t);n.appendChild(o);const a=r.filter((e=>"manual"===e.result.scoreDisplayMode)),s=this.renderClump("manual",{auditRefs:a,description:e.manualDescription});return n.appendChild(s),n}renderScoreGauge(e,t){if(null===e.score)return super.renderScoreGauge(e,t);const n=this.dom.createComponent("gaugePwa"),r=this.dom.find("a.lh-gauge--pwa__wrapper",n);this.dom.safelySetHref(r,`#${e.id}`);const i=n.querySelector("svg");if(!i)throw new Error("no SVG element found in PWA score gauge template");$e._makeSvgReferencesUnique(i);const o=this._getGroupIds(e.auditRefs),a=this._getPassingGroupIds(e.auditRefs);if(a.size===o.size)r.classList.add("lh-badged--all");else for(const e of a)r.classList.add(`lh-badged--${e}`);return this.dom.find(".lh-gauge__label",n).textContent=e.title,r.title=this._getGaugeTooltip(e.auditRefs,t),n}_getGroupIds(e){const t=e.map((e=>e.group)).filter((e=>!!e));return new Set(t)}_getPassingGroupIds(e){const t=this._getGroupIds(e);for(const n of e)!he.showAsPassed(n.result)&&n.group&&t.delete(n.group);return t}_getGaugeTooltip(e,t){const n=this._getGroupIds(e),r=[];for(const i of n){const n=e.filter((e=>e.group===i)),o=n.length,a=n.filter((e=>he.showAsPassed(e.result))).length,s=t[i].title;r.push(`${s}: ${a}/${o}`)}return r.join(", ")}_renderAudits(e,t){const n=this.renderUnexpandableClump(e,t),r=this._getPassingGroupIds(e);for(const e of r){this.dom.find(`.lh-audit-group--${e}`,n).classList.add("lh-badged")}return n}static _makeSvgReferencesUnique(e){const t=e.querySelector("defs");if(!t)return;const n=he.getUniqueSuffix(),r=t.querySelectorAll("[id]");for(const t of r){const r=t.id,i=`${r}-${n}`;t.id=i;const o=e.querySelectorAll(`use[href="#${r}"]`);for(const e of o)e.setAttribute("href",`#${i}`);const a=e.querySelectorAll(`[fill="url(#${r})"]`);for(const e of a)e.setAttribute("fill",`url(#${i})`)}}}
|
|
131
|
-
/**
|
|
132
|
-
* @license
|
|
133
|
-
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
134
|
-
*
|
|
135
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
136
|
-
* you may not use this file except in compliance with the License.
|
|
137
|
-
* You may obtain a copy of the License at
|
|
138
|
-
*
|
|
139
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
140
|
-
*
|
|
141
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
142
|
-
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
143
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
144
|
-
* See the License for the specific language governing permissions and
|
|
145
|
-
* limitations under the License.
|
|
146
|
-
*
|
|
147
|
-
* Dummy text for ensuring report robustness: <\/script> pre$`post %%LIGHTHOUSE_JSON%%
|
|
148
|
-
* (this is handled by terser)
|
|
149
|
-
*/class Oe{constructor(e){this._dom=e}renderReport(e,t){this._dom.setLighthouseChannel(e.configSettings.channel||"unknown");const n=he.prepareReportResult(e);return t.textContent="",t.appendChild(this._renderReport(n)),t}_renderReportTopbar(e){const t=this._dom.createComponent("topbar"),n=this._dom.find("a.lh-topbar__url",t);return n.textContent=e.finalUrl,n.title=e.finalUrl,this._dom.safelySetHref(n,e.finalUrl),t}_renderReportHeader(){const e=this._dom.createComponent("heading"),t=this._dom.createComponent("scoresWrapper");return this._dom.find(".lh-scores-wrapper-placeholder",e).replaceWith(t),e}_renderReportFooter(e){const t=this._dom.createComponent("footer"),n=this._dom.find(".lh-env__items",t);n.id="runtime-settings",this._dom.find(".lh-env__title",t).textContent=he.i18n.strings.runtimeSettingsTitle;const r=he.getEnvironmentDisplayValues(e.configSettings||{}),i=[{name:he.i18n.strings.runtimeSettingsUrl,description:e.finalUrl},{name:he.i18n.strings.runtimeSettingsFetchTime,description:he.i18n.formatDateTime(e.fetchTime)},...r,{name:he.i18n.strings.runtimeSettingsChannel,description:e.configSettings.channel},{name:he.i18n.strings.runtimeSettingsUA,description:e.userAgent},{name:he.i18n.strings.runtimeSettingsUANetwork,description:e.environment&&e.environment.networkUserAgent},{name:he.i18n.strings.runtimeSettingsBenchmark,description:e.environment&&e.environment.benchmarkIndex.toFixed(0)}];e.environment.credits&&e.environment.credits["axe-core"]&&i.push({name:he.i18n.strings.runtimeSettingsAxeVersion,description:e.environment.credits["axe-core"]});for(const e of i){if(!e.description)continue;const t=this._dom.createComponent("envItem");this._dom.find(".lh-env__name",t).textContent=e.name,this._dom.find(".lh-env__description",t).textContent=e.description,n.appendChild(t)}return this._dom.find(".lh-footer__version_issue",t).textContent=he.i18n.strings.footerIssue,this._dom.find(".lh-footer__version",t).textContent=e.lighthouseVersion,t}_renderReportWarnings(e){if(!e.runWarnings||0===e.runWarnings.length)return this._dom.createElement("div");const t=this._dom.createComponent("warningsToplevel");this._dom.find(".lh-warnings__msg",t).textContent=he.i18n.strings.toplevelWarningsMessage;const n=this._dom.find("ul",t);for(const t of e.runWarnings){n.appendChild(this._dom.createElement("li")).appendChild(this._dom.convertMarkdownLinkSnippets(t))}return t}_renderScoreGauges(e,t,n){const r=[],i=[],o=[];for(const a of Object.values(e.categories)){const s=n[a.id]||t,l=s.renderScoreGauge(a,e.categoryGroups||{});he.isPluginCategory(a.id)?o.push(l):s.renderScoreGauge===t.renderScoreGauge?r.push(l):i.push(l)}return[...r,...i,...o]}_renderReport(e){const t=new Re(e.configSettings.locale,{...he.UIStrings,...e.i18n.rendererFormattedStrings});he.i18n=t,he.reportJson=e;const n=e.audits["full-page-screenshot"]&&e.audits["full-page-screenshot"].details&&"full-page-screenshot"===e.audits["full-page-screenshot"].details.type?e.audits["full-page-screenshot"].details:void 0,r=new He(this._dom,{fullPageScreenshot:n}),i=new ue(this._dom,r),o={performance:new De(this._dom,r),pwa:new $e(this._dom,r)},a=this._dom.createElement("div");a.appendChild(this._renderReportHeader());const s=this._dom.createElement("div","lh-container"),l=this._dom.createElement("div","lh-report");let d;l.appendChild(this._renderReportWarnings(e));if(1===Object.keys(e.categories).length?a.classList.add("lh-header--solo-category"):d=this._dom.createElement("div","lh-scores-header"),d){const t=this._dom.createComponent("scorescale"),n=this._dom.find(".lh-scores-container",a);d.append(...this._renderScoreGauges(e,i,o)),n.appendChild(d),n.appendChild(t);const r=this._dom.createElement("div","lh-sticky-header");r.append(...this._renderScoreGauges(e,i,o)),s.appendChild(r)}const c=l.appendChild(this._dom.createElement("div","lh-categories"));for(const t of Object.values(e.categories)){const n=o[t.id]||i;n.dom.createChildOf(c,"div","lh-category-wrapper").appendChild(n.render(t,e.categoryGroups))}const p=this._dom.createFragment(),h=this._renderReportTopbar(e);return p.appendChild(h),p.appendChild(s),s.appendChild(a),s.appendChild(l),l.appendChild(this._renderReportFooter(e)),n&&Le.installFullPageScreenshot(s,n.screenshot),p}}const Pe=F(void 0);function Ue(){const e=Y(Pe);if(!e)throw Error("Globals not defined");return e}const ze=({children:e})=>{const t=Q((()=>{const e=new Te(document),t=new He(e);return{dom:e,detailsRenderer:t,categoryRenderer:new ue(e,t),reportRenderer:new Oe(e)}}),[]);return D(Pe.Provider,Object.assign({value:t},{children:e}),void 0)},Ve=()=>D("svg",Object.assign({width:"14",viewBox:"0 0 18 16",fill:"none",role:"img"},{children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0 2C0 1.17 0.67 0.5 1.5 0.5C2.33 0.5 3 1.17 3 2C3 2.83 2.33 3.5 1.5 3.5C0.67 3.5 0 2.83 0 2ZM0 8C0 7.17 0.67 6.5 1.5 6.5C2.33 6.5 3 7.17 3 8C3 8.83 2.33 9.5 1.5 9.5C0.67 9.5 0 8.83 0 8ZM1.5 12.5C0.67 12.5 0 13.18 0 14C0 14.82 0.68 15.5 1.5 15.5C2.32 15.5 3 14.82 3 14C3 13.18 2.33 12.5 1.5 12.5ZM18 15H5V13H18V15ZM5 9H18V7H5V9ZM5 3V1H18V3H5Z",fill:"currentColor"},void 0)}),void 0),je=()=>D("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a navigation report"},{children:D("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor","stroke-width":"2"},void 0)}),void 0),Ie=()=>D("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a timespan report"},{children:[D("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor","stroke-width":"2"},void 0),D("path",{d:"m 8,4 v 4 l 4,1.9999998",stroke:"currentColor","stroke-width":"1.5"},void 0)]}),void 0),Ge=()=>D("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a snapshot report"},{children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M 12.2038,12.2812 C 11.1212,13.3443 9.6372,14 8,14 7.81038,14 7.62281,13.9912 7.43768,13.974 L 10.3094,9 Z M 12.8925,11.4741 10.0207,6.5 H 13.811 C 13.9344,6.97943 14,7.48205 14,8 c 0,1.2947 -0.4101,2.4937 -1.1075,3.4741 z M 13.456,5.5 H 7.71135 L 9.6065,2.21749 C 11.3203,2.69259 12.7258,3.90911 13.456,5.5 Z M 8.5624,2.02601 C 8.3772,2.0088 8.1896,2 8,2 6.36282,2 4.8788,2.65572 3.79622,3.71885 L 5.69061,7.00002 Z M 3.10749,4.52594 C 2.4101,5.5063 2,6.70526 2,8 2,8.5179 2.06563,9.0206 2.18903,9.5 H 5.97927 Z M 2.54404,10.5 c 0.73017,1.5909 2.1357,2.8074 3.84949,3.2825 L 8.2887,10.5 Z M 16,8 c 0,4.4183 -3.5817,8 -8,8 C 3.58172,16 0,12.4183 0,8 0,3.58172 3.58172,0 8,0 c 4.4183,0 8,3.58172 8,8 z",fill:"currentColor"},void 0)}),void 0),Be=()=>D("svg",Object.assign({width:"15",height:"12",viewBox:"0 0 15 12",fill:"none",role:"img"},{children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.33317 2.00008H13.9998V0.666748H3.33317C2.59984 0.666748 1.99984 1.26675 1.99984 2.00008V9.33341H0.666504V11.3334H7.99984V9.33341H3.33317V2.00008ZM13.9998 3.33341H9.99984C9.63317 3.33341 9.33317 3.63341 9.33317 4.00008V10.6667C9.33317 11.0334 9.63317 11.3334 9.99984 11.3334H13.9998C14.3665 11.3334 14.6665 11.0334 14.6665 10.6667V4.00008C14.6665 3.63341 14.3665 3.33341 13.9998 3.33341ZM10.6665 9.33341H13.3332V4.66675H10.6665V9.33341Z",fill:"currentColor"},void 0)}),void 0),We=()=>D("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img"},{children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.5 7.16667V5.5H13.8333V3.83333C13.8333 2.91667 13.0833 2.16667 12.1667 2.16667H10.5V0.5H8.83333V2.16667H7.16667V0.5H5.5V2.16667H3.83333C2.91667 2.16667 2.16667 2.91667 2.16667 3.83333V5.5H0.5V7.16667H2.16667V8.83333H0.5V10.5H2.16667V12.1667C2.16667 13.0833 2.91667 13.8333 3.83333 13.8333H5.5V15.5H7.16667V13.8333H8.83333V15.5H10.5V13.8333H12.1667C13.0833 13.8333 13.8333 13.0833 13.8333 12.1667V10.5H15.5V8.83333H13.8333V7.16667H15.5ZM10.5 5.5H5.5V10.5H10.5V5.5ZM3.83333 12.1667H12.1667V3.83333H3.83333V12.1667Z",fill:"currentColor"},void 0)}),void 0),qe=({category:e,audits:t,href:n})=>{const r=e.auditRefs.length;let i=0,o=0;for(const n of e.auditRefs){o+=n.weight;const e=t[n.id];e?he.showAsPassed(e)&&i++:console.warn(`Could not find score for audit '${n.id}', treating as failed.`)}const a=i/r;let s=he.calculateRating(a);return 0===o&&(s="null"),D("a",Object.assign({href:n,className:`CategoryRatio CategoryRatio--${s}`,"data-testid":"CategoryRatio"},{children:`${i}/${r}`}),void 0)},Ze=()=>D("div",{className:"Separator",role:"separator"},void 0),Je=({mode:e})=>D("div",Object.assign({className:"FlowSegment"},{children:[D("div",{className:"FlowSegment__top-line"},void 0),"navigation"===e&&D(je,{},void 0),"timespan"===e&&D(Ie,{},void 0),"snapshot"===e&&D(Ge,{},void 0),D("div",{className:"FlowSegment__bottom-line"},void 0)]}),void 0),Ke=F(void 0);function Qe(e){return new URLSearchParams(location.hash.replace("#","?")).get(e)}function Ye(e,t){const{lhrs:n}=e;if("navigation"===n[t].gatherMode)return!1;for(let e=t+1;n[e]&&"navigation"!==n[e].gatherMode;++e)if(n[e].gatherMode===n[t].gatherMode)return!0;for(let e=t-1;n[e]&&"navigation"!==n[e].gatherMode;--e)if(n[e].gatherMode===n[t].gatherMode)return!0;return!1}function Xe(...e){const t=[];for(const n of e){if(!n)continue;if("string"==typeof n){t.push(n);continue}const e=Object.entries(n).filter((([e,t])=>t)).map((([e])=>e));t.push(...e)}return t.join(" ")}function et(){const e=Y(Ke);if(!e)throw Error("useFlowResult must be called in the FlowResultContext");return e}function tt(e){const[t,n]=q(Qe(e));return Z((()=>{function r(){const r=Qe(e);r!==t&&n(r)}return window.addEventListener("hashchange",r),()=>window.removeEventListener("hashchange",r)}),[t]),t}function nt(){const e=et(),t=tt("index");return Q((()=>{if(!t)return null;const n=Number(t);if(!Number.isFinite(n))return console.warn(`Invalid hash index: ${t}`),null;const r=e.lhrs[n];return r?{value:r,index:n}:(console.warn(`No LHR at index ${n}`),null)}),[t,e])}function rt(){const e=et();return Q((()=>{let t=1,n=1;return e.lhrs.map(((r,i)=>{const o=function(e){const t=new URL(e);return`${t.hostname}${t.pathname}`}(r.finalUrl);switch(r.gatherMode){case"navigation":return t=1,n=1,`Navigation report (${o})`;case"timespan":return Ye(e,i)?`Timespan report ${t++} (${o})`:`Timespan report (${o})`;case"snapshot":return Ye(e,i)?`Snapshot report ${n++} (${o})`:`Snapshot report (${o})`}}))}),[e])}const it=({href:e,label:t,mode:n,isCurrent:r})=>D("a",Object.assign({className:Xe("SidebarFlowStep",{"Sidebar--current":r}),href:e},{children:[D("div",{children:D(Je,{mode:n},void 0)},void 0),D("div",Object.assign({className:`SidebarFlowStep__label SidebarFlowStep__label--${n}`},{children:t}),void 0)]}),void 0),ot=()=>D("div",Object.assign({className:"SidebarFlowSeparator"},{children:[D(Je,{},void 0),D(Ze,{},void 0),D(Je,{},void 0)]}),void 0),at=()=>{const e=et(),t=nt(),n=rt();return D("div",Object.assign({className:"SidebarFlow"},{children:e.lhrs.map(((e,r)=>{const i=n[r],o=new URL(location.href);return o.hash=`#index=${r}`,D(u,{children:["navigation"===e.gatherMode&&0!==r?D(ot,{},void 0):void 0,D(it,{mode:e.gatherMode,href:o.href,label:i,isCurrent:r===(t&&t.index)},e.fetchTime)]},void 0)}))}),void 0)},st=()=>{const e=nt(),t=new URL(location.href);return t.hash="#",D("a",Object.assign({href:t.href,className:Xe("SidebarSummary",{"Sidebar--current":null===e}),"data-testid":"SidebarSummary"},{children:[D("div",Object.assign({className:"SidebarSummary__icon"},{children:D(Ve,{},void 0)}),void 0),D("div",Object.assign({className:"SidebarSummary__label"},{children:"Summary"}),void 0)]}),void 0)},lt=({settings:e})=>D("div",Object.assign({className:"SidebarRuntimeSettings"},{children:[D("div",Object.assign({className:"SidebarRuntimeSettings__item"},{children:[D("div",Object.assign({className:"SidebarRuntimeSettings__item--icon"},{children:D(Be,{},void 0)}),void 0),("desktop"===e.formFactor?"Desktop":"Mobile")+" | "+`${e.screenEmulation.height}x${e.screenEmulation.width}px`]}),void 0),D("div",Object.assign({className:"SidebarRuntimeSettings__item"},{children:[D("div",Object.assign({className:"SidebarRuntimeSettings__item--icon"},{children:D(We,{},void 0)}),void 0),`${e.throttling.cpuSlowdownMultiplier}x slowdown`]}),void 0)]}),void 0),dt=({title:e,date:t})=>{const n=et().lhrs[0].configSettings.locale,r=Q((()=>new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"numeric",timeZoneName:"short"})),[n]),i=Q((()=>r.format(new Date(t))),[t,r]);return D("div",Object.assign({className:"SidebarHeader"},{children:[D("div",Object.assign({className:"SidebarHeader__title"},{children:e}),void 0),D("div",Object.assign({className:"SidebarHeader__date"},{children:i}),void 0)]}),void 0)},ct=()=>{const e=et().lhrs[0];return D("div",Object.assign({className:"Sidebar"},{children:[D(dt,{title:"Lighthouse User Flow Report",date:e.fetchTime},void 0),D(Ze,{},void 0),D(st,{},void 0),D(Ze,{},void 0),D(at,{},void 0),D(Ze,{},void 0),D(lt,{settings:e.configSettings},void 0)]}),void 0)},pt=({category:e,href:t})=>{const{categoryRenderer:n}=Ue(),r=K(null);return J((()=>{const t=n.renderScoreGauge(e,{}),i=t.querySelector(".lh-gauge__label");return i&&i.remove(),r.current&&r.current.append(t),()=>{r.current&&r.current.contains(t)&&r.current.removeChild(t)}}),[n,e]),Z((()=>{const e=r.current&&r.current.querySelector("a");e&&(e.href=t)}),[t]),D("div",{ref:r,"data-testid":"Gauge"},void 0)},ht=["performance","accessibility","best-practices","seo"],ut=({url:e})=>D("div",Object.assign({className:"SummaryNavigationHeader","data-testid":"SummaryNavigationHeader"},{children:[D(Je,{},void 0),D("div",Object.assign({className:"SummaryNavigationHeader__url"},{children:e}),void 0),D("div",Object.assign({className:"SummaryNavigationHeader__category"},{children:"Performance"}),void 0),D("div",Object.assign({className:"SummaryNavigationHeader__category"},{children:"Accessibility"}),void 0),D("div",Object.assign({className:"SummaryNavigationHeader__category"},{children:"Best Practices"}),void 0),D("div",Object.assign({className:"SummaryNavigationHeader__category"},{children:"SEO"}),void 0)]}),void 0),mt=({gatherMode:e,audits:t,category:n,href:r})=>D("div",Object.assign({className:"SummaryCategory"},{children:n?"navigation"===e?D(pt,{category:n,href:r},void 0):D(qe,{category:n,audits:t,href:r},void 0):D("div",{className:"SummaryCategory__null","data-testid":"SummaryCategory__null"},void 0)}),void 0),gt=({lhr:e,label:t,hashIndex:n})=>{const r=Q((()=>he.prepareReportResult(e)),[e]),i="timespan"!==r.gatherMode?function(e){const t=e.audits["full-page-screenshot"];return t.details&&"full-page-screenshot"===t.details.type&&t.details.screenshot.data||null}(r):null,{width:o,height:a}=function(e){const{width:t,height:n}=e.configSettings.screenEmulation;return{width:t,height:n}}(r),s=50*a/o;return D("div",Object.assign({className:"SummaryFlowStep"},{children:["navigation"===e.gatherMode||0===n?D(ut,{url:e.finalUrl},void 0):D("div",Object.assign({className:"SummaryFlowStep__divider"},{children:[D(Je,{},void 0),D("div",{className:"SummaryFlowStep__divider--line"},void 0)]}),void 0),D("img",{className:"SummaryFlowStep__screenshot","data-testid":"SummaryFlowStep__screenshot",src:i||void 0,style:{width:50,maxHeight:s}},void 0),D(Je,{mode:e.gatherMode},void 0),D("a",Object.assign({className:"SummaryFlowStep__label",href:`#index=${n}`},{children:t}),void 0),ht.map((e=>D(mt,{gatherMode:r.gatherMode,category:r.categories[e],audits:r.audits,href:`#index=${n}&anchor=${e}`},e)))]}),void 0)},_t=()=>{const e=et(),t=rt();return D("div",Object.assign({className:"SummaryFlow"},{children:e.lhrs.map(((e,n)=>D(gt,{lhr:e,label:t[n],hashIndex:n},e.fetchTime)))}),void 0)},ft=()=>{const e=et();let t=0,n=0,r=0;for(const i of e.lhrs)switch(i.gatherMode){case"navigation":t++;break;case"timespan":n++;break;case"snapshot":r++}const i=[];t&&i.push(`${t} navigation reports`),n&&i.push(`${n} timespan reports`),r&&i.push(`${r} snapshot reports`);const o=i.join(" · ");return D("div",Object.assign({className:"SummaryHeader"},{children:[D("div",Object.assign({className:"SummaryHeader__title"},{children:"Summary"}),void 0),D("div",Object.assign({className:"SummaryHeader__subtitle"},{children:o}),void 0)]}),void 0)},vt=()=>D("div",Object.assign({className:"Summary","data-testid":"Summary"},{children:[D(ft,{},void 0),D(_t,{},void 0)]}),void 0);const bt=()=>{const{dom:e,reportRenderer:t}=Ue(),n=K(null),r=tt("anchor"),i=nt();return J((()=>{if(i)return n.current&&(e.clearComponentCache(),t.renderReport(i.value,n.current),function(e,t){const n=e.querySelectorAll("a");for(const e of n){const n=new URL(location.href);n.hash="",n.search="";const r=new URL(e.href);if(r.hash="",r.search="",n.href!==r.href||!e.hash)continue;const i=e.hash.substr(1);e.hash=`#index=${t}&anchor=${i}`}}(n.current,i.index)),()=>{n.current&&(n.current.textContent="")}}),[t,i]),Z((()=>{if(r){const e=document.getElementById(r);if(e)return void e.scrollIntoView({behavior:"smooth"})}n.current&&n.current.scrollIntoView()}),[r,i]),D("div",{ref:n,className:"lh-root","data-testid":"Report"},void 0)},wt=()=>{const e=nt();return D("div",Object.assign({className:"Content"},{children:D(e?bt:vt,{},void 0)}),void 0)},yt=({flowResult:e})=>D(Ke.Provider,Object.assign({value:e},{children:D(ze,{children:D("div",Object.assign({className:"App"},{children:[D(ct,{},void 0),D(wt,{},void 0)]}),void 0)},void 0)}),void 0);window.__initLighthouseFlowReport__=function(){const e=document.body.querySelector("main");if(!e)throw Error("Root element not found");T(D(yt,{flowResult:window.__LIGHTHOUSE_FLOW_JSON__},void 0),e)}}();
|