lighthouse 8.3.0-dev.20210907 → 8.3.0

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.
Files changed (196) hide show
  1. package/changelog.md +1 -1
  2. package/dist/report/standalone.js +196 -0
  3. package/jest.config.js +0 -4
  4. package/lighthouse-cli/cli-flags.js +6 -14
  5. package/lighthouse-cli/run.js +1 -1
  6. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +3 -9
  7. package/lighthouse-cli/test/smokehouse/report-assert.js +16 -36
  8. package/lighthouse-core/audits/large-javascript-libraries.js +166 -0
  9. package/lighthouse-core/audits/seo/http-status-code.js +6 -2
  10. package/lighthouse-core/audits/viewport.js +1 -2
  11. package/lighthouse-core/config/config-helpers.js +75 -9
  12. package/lighthouse-core/config/config.js +50 -6
  13. package/lighthouse-core/config/constants.js +0 -1
  14. package/lighthouse-core/config/default-config.js +0 -3
  15. package/lighthouse-core/config/experimental-config.js +8 -0
  16. package/lighthouse-core/config/metrics-to-audits.js +0 -1
  17. package/lighthouse-core/fraggle-rock/config/config.js +4 -3
  18. package/lighthouse-core/fraggle-rock/config/default-config.js +1 -3
  19. package/lighthouse-core/fraggle-rock/config/validation.js +0 -201
  20. package/lighthouse-core/fraggle-rock/gather/base-artifacts.js +0 -4
  21. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +8 -16
  22. package/lighthouse-core/fraggle-rock/gather/runner-helpers.js +0 -4
  23. package/lighthouse-core/fraggle-rock/gather/session.js +5 -30
  24. package/lighthouse-core/gather/driver/navigation.js +6 -7
  25. package/lighthouse-core/gather/driver/wait-for-condition.js +0 -27
  26. package/lighthouse-core/gather/fetcher.js +7 -17
  27. package/lighthouse-core/gather/gather-runner.js +0 -1
  28. package/lighthouse-core/gather/gatherers/seo/robots-txt.js +6 -2
  29. package/lighthouse-core/gather/gatherers/seo/tap-targets.js +2 -2
  30. package/lighthouse-core/gather/gatherers/stacks.js +1 -1
  31. package/lighthouse-core/lib/asset-saver.js +2 -2
  32. package/lighthouse-core/lib/cdt/SDK.js +0 -1
  33. package/lighthouse-core/lib/csp-evaluator.js +4 -17
  34. package/{report/generator → lighthouse-core/lib}/file-namer.js +0 -0
  35. package/lighthouse-core/lib/i18n/README.md +1 -1
  36. package/lighthouse-core/lib/i18n/i18n.js +7 -7
  37. package/lighthouse-core/lib/i18n/locales/ar-XB.json +18 -0
  38. package/lighthouse-core/lib/i18n/locales/ar.json +18 -0
  39. package/lighthouse-core/lib/i18n/locales/bg.json +18 -0
  40. package/lighthouse-core/lib/i18n/locales/ca.json +18 -0
  41. package/lighthouse-core/lib/i18n/locales/cs.json +18 -0
  42. package/lighthouse-core/lib/i18n/locales/da.json +18 -0
  43. package/lighthouse-core/lib/i18n/locales/de.json +18 -0
  44. package/lighthouse-core/lib/i18n/locales/el.json +18 -0
  45. package/lighthouse-core/lib/i18n/locales/en-GB.json +18 -0
  46. package/lighthouse-core/lib/i18n/locales/en-US.json +18 -18
  47. package/lighthouse-core/lib/i18n/locales/en-XA.json +18 -0
  48. package/lighthouse-core/lib/i18n/locales/en-XL.json +18 -18
  49. package/lighthouse-core/lib/i18n/locales/es-419.json +18 -0
  50. package/lighthouse-core/lib/i18n/locales/es.json +18 -0
  51. package/lighthouse-core/lib/i18n/locales/fi.json +18 -0
  52. package/lighthouse-core/lib/i18n/locales/fil.json +18 -0
  53. package/lighthouse-core/lib/i18n/locales/fr.json +18 -0
  54. package/lighthouse-core/lib/i18n/locales/he.json +18 -0
  55. package/lighthouse-core/lib/i18n/locales/hi.json +18 -0
  56. package/lighthouse-core/lib/i18n/locales/hr.json +18 -0
  57. package/lighthouse-core/lib/i18n/locales/hu.json +18 -0
  58. package/lighthouse-core/lib/i18n/locales/id.json +18 -0
  59. package/lighthouse-core/lib/i18n/locales/it.json +18 -0
  60. package/lighthouse-core/lib/i18n/locales/ja.json +18 -0
  61. package/lighthouse-core/lib/i18n/locales/ko.json +18 -0
  62. package/lighthouse-core/lib/i18n/locales/lt.json +18 -0
  63. package/lighthouse-core/lib/i18n/locales/lv.json +18 -0
  64. package/lighthouse-core/lib/i18n/locales/nl.json +18 -0
  65. package/lighthouse-core/lib/i18n/locales/no.json +18 -0
  66. package/lighthouse-core/lib/i18n/locales/pl.json +18 -0
  67. package/lighthouse-core/lib/i18n/locales/pt-PT.json +18 -0
  68. package/lighthouse-core/lib/i18n/locales/pt.json +18 -0
  69. package/lighthouse-core/lib/i18n/locales/ro.json +18 -0
  70. package/lighthouse-core/lib/i18n/locales/ru.json +18 -0
  71. package/lighthouse-core/lib/i18n/locales/sk.json +18 -0
  72. package/lighthouse-core/lib/i18n/locales/sl.json +18 -0
  73. package/lighthouse-core/lib/i18n/locales/sr-Latn.json +18 -0
  74. package/lighthouse-core/lib/i18n/locales/sr.json +18 -0
  75. package/lighthouse-core/lib/i18n/locales/sv.json +18 -0
  76. package/lighthouse-core/lib/i18n/locales/ta.json +18 -0
  77. package/lighthouse-core/lib/i18n/locales/te.json +18 -0
  78. package/lighthouse-core/lib/i18n/locales/th.json +18 -0
  79. package/lighthouse-core/lib/i18n/locales/tr.json +18 -0
  80. package/lighthouse-core/lib/i18n/locales/uk.json +18 -0
  81. package/lighthouse-core/lib/i18n/locales/vi.json +18 -0
  82. package/lighthouse-core/lib/i18n/locales/zh-HK.json +18 -0
  83. package/lighthouse-core/lib/i18n/locales/zh-TW.json +18 -0
  84. package/lighthouse-core/lib/i18n/locales/zh.json +18 -0
  85. package/lighthouse-core/lib/large-javascript-libraries/bundlephobia-database.json +62 -0
  86. package/lighthouse-core/lib/large-javascript-libraries/library-suggestions.js +20 -0
  87. package/lighthouse-core/lib/network-request.js +1 -3
  88. package/lighthouse-core/lib/traces/pwmetrics-events.js +2 -2
  89. package/lighthouse-core/lib/url-shim.js +1 -7
  90. package/lighthouse-core/runner.js +1 -4
  91. package/lighthouse-core/util-commonjs.js +2 -2
  92. package/now.json +1 -1
  93. package/package.json +13 -20
  94. package/report/README.md +2 -2
  95. package/report/assets/standalone-template.html +1 -0
  96. package/report/assets/styles.css +27 -23
  97. package/report/assets/templates.html +40 -37
  98. package/report/clients/bundle.js +0 -1
  99. package/report/{package.json → clients/package.json} +0 -0
  100. package/report/clients/psi.js +3 -13
  101. package/report/clients/standalone.js +1 -1
  102. package/report/{types/buffer.d.ts → clients/treemap.js} +13 -11
  103. package/report/renderer/category-renderer.js +2 -2
  104. package/report/renderer/components.js +48 -46
  105. package/report/renderer/crc-details-renderer.js +16 -16
  106. package/report/renderer/details-renderer.js +1 -1
  107. package/report/renderer/dom.js +0 -17
  108. package/report/renderer/element-screenshot-renderer.js +9 -9
  109. package/{flow-report/test/setup/global-setup.ts → report/renderer/file-namer.js} +2 -5
  110. package/report/renderer/logger.js +4 -4
  111. package/report/renderer/package.json +4 -0
  112. package/report/renderer/report-renderer.js +11 -4
  113. package/report/renderer/report-ui-features.js +656 -43
  114. package/report/renderer/text-encoding.js +1 -1
  115. package/report/renderer/util.js +2 -2
  116. package/report/{generator/report-assets.js → report-assets.js} +3 -9
  117. package/report/{generator/report-generator.js → report-generator.js} +9 -37
  118. package/report/test/clients/package.json +4 -0
  119. package/report/test/clients/psi-test.js +1 -3
  120. package/report/test/renderer/category-renderer-test.js +3 -8
  121. package/report/test/renderer/components-test.js +0 -35
  122. package/report/test/renderer/crc-details-renderer-test.js +4 -5
  123. package/report/test/renderer/details-renderer-test.js +1 -3
  124. package/report/test/renderer/dom-test.js +6 -8
  125. package/report/test/renderer/i18n-test.js +0 -1
  126. package/report/test/renderer/package.json +4 -0
  127. package/report/test/renderer/performance-category-renderer-test.js +27 -30
  128. package/report/test/renderer/pwa-category-renderer-test.js +1 -2
  129. package/report/test/renderer/report-renderer-test.js +0 -1
  130. package/report/test/renderer/report-ui-features-test.js +28 -20
  131. package/report/test/renderer/snippet-renderer-test.js +0 -1
  132. package/report/test/renderer/text-encoding-test.js +0 -2
  133. package/report/test/renderer/util-test.js +0 -1
  134. package/report/test/{generator/report-generator-test.js → report-generator-test.js} +7 -9
  135. package/third-party/chromium-synchronization/installability-errors-test.js +27 -28
  136. package/third-party/snyk/snapshot.json +0 -2
  137. package/tsconfig.json +5 -24
  138. package/types/artifacts.d.ts +18 -5
  139. package/types/{lhr/audit-details.d.ts → audit-details.d.ts} +3 -18
  140. package/types/audit.d.ts +58 -7
  141. package/types/{lhr/budget.d.ts → budget.d.ts} +0 -0
  142. package/types/bundle-phobia-cli/index.d.ts +40 -0
  143. package/types/config.d.ts +8 -3
  144. package/types/externs.d.ts +119 -5
  145. package/types/gatherer.d.ts +2 -3
  146. package/types/global-lh.d.ts +14 -16
  147. package/{report/types/report-result.d.ts → types/html-renderer.d.ts} +17 -8
  148. package/types/{lhr/i18n.d.ts → i18n.d.ts} +25 -2
  149. package/types/{lhr/lhr.d.ts → lhr.d.ts} +9 -41
  150. package/types/smokehouse.d.ts +3 -3
  151. package/types/{lhr/treemap.d.ts → treemap.d.ts} +3 -3
  152. package/flow-report/assets/standalone-flow-template.html +0 -38
  153. package/flow-report/assets/styles.css +0 -310
  154. package/flow-report/jest.config.js +0 -24
  155. package/flow-report/src/app.tsx +0 -40
  156. package/flow-report/src/common.tsx +0 -72
  157. package/flow-report/src/icons.tsx +0 -96
  158. package/flow-report/src/sidebar/flow.tsx +0 -72
  159. package/flow-report/src/sidebar/sidebar.tsx +0 -89
  160. package/flow-report/src/summary/summary.tsx +0 -178
  161. package/flow-report/src/util.ts +0 -160
  162. package/flow-report/src/wrappers/gauge.tsx +0 -40
  163. package/flow-report/src/wrappers/report-renderer.tsx +0 -46
  164. package/flow-report/src/wrappers/report.tsx +0 -71
  165. package/flow-report/standalone-flow.tsx +0 -23
  166. package/flow-report/test/app-test.tsx +0 -48
  167. package/flow-report/test/common-test.tsx +0 -131
  168. package/flow-report/test/setup/env-setup.ts +0 -25
  169. package/flow-report/test/sidebar/flow-test.tsx +0 -71
  170. package/flow-report/test/sidebar/sidebar-test.tsx +0 -53
  171. package/flow-report/test/summary/summary-test.tsx +0 -132
  172. package/flow-report/test/util-test.tsx +0 -109
  173. package/flow-report/tsconfig.json +0 -39
  174. package/flow-report/types/flow-report.d.ts +0 -27
  175. package/lighthouse-core/audits/lcp-lazy-loaded.js +0 -83
  176. package/report/.eslintrc.cjs +0 -33
  177. package/report/generator/README.md +0 -9
  178. package/report/generator/flow-report-assets.js +0 -20
  179. package/report/generator/package.json +0 -4
  180. package/report/generator/tsconfig.json +0 -28
  181. package/report/renderer/drop-down-menu.js +0 -215
  182. package/report/renderer/features-util.js +0 -26
  183. package/report/renderer/open-tab.js +0 -137
  184. package/report/renderer/topbar-features.js +0 -309
  185. package/report/test/generator/file-namer-test.js +0 -28
  186. package/report/test/generator/package.json +0 -4
  187. package/report/test-assets/faux-psi-template.html +0 -126
  188. package/report/test-assets/faux-psi.js +0 -92
  189. package/report/tsconfig.json +0 -39
  190. package/report/types/augment-dom.d.ts +0 -24
  191. package/report/types/html-renderer.d.ts +0 -28
  192. package/types/lhr/audit-result.d.ts +0 -59
  193. package/types/lhr/flow.d.ts +0 -16
  194. package/types/lhr/settings.d.ts +0 -105
  195. package/types/lhr/tsconfig.json +0 -24
  196. package/types/query-selector.d.ts +0 -36
package/changelog.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  We expect this release to ship in the DevTools of [Chrome 94](https://chromiumdash.appspot.com/schedule), and to PageSpeed Insights within 2 weeks.
6
6
 
7
- ## New contributors
7
+ ## New Contriubutors
8
8
 
9
9
  Thanks to our new contributors 👽🐷🐰🐯🐻!
10
10
 
@@ -0,0 +1,196 @@
1
+ !function(){"use strict";
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 e="…",t="data:image/jpeg;base64,",n={label:"pass",minScore:.9},r={label:"average",minScore:.5},i={label:"fail"},o={label:"error"},s=["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 a{static get PASS_THRESHOLD(){return.9}static get MS_DISPLAY_VALUE(){return"%10d ms"}static prepareReportResult(e){const n=JSON.parse(JSON.stringify(e));n.configSettings.locale||(n.configSettings.locale="en"),n.configSettings.formFactor||(n.configSettings.formFactor=n.configSettings.emulatedFormFactor);for(const e of Object.values(n.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 n of e.details.items)n.data.startsWith(t)||(n.data=t+n.data);if("object"!=typeof n.categories)throw new Error("No categories provided.");const r=new Map;for(const e of Object.values(n.categories))e.auditRefs.forEach((e=>{e.relevantAudits&&e.relevantAudits.forEach((t=>{const n=r.get(t)||[];n.push(e),r.set(t,n)}))})),e.auditRefs.forEach((e=>{const t=n.audits[e.id];e.result=t,r.has(e.id)&&(e.relevantMetrics=r.get(e.id)),n.stackPacks&&n.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 n}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)>=n.minScore}}static calculateRating(e,t){if("manual"===t||"notApplicable"===t)return n.label;if("error"===t)return o.label;if(null===e)return i.label;let s=i.label;return e>=n.minScore?s=n.label:e>=r.minScore&&(s=r.label),s}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(t,n){const r=void 0!==(n=n||{numPathParts:void 0,preserveQuery:void 0,preserveHost:void 0}).numPathParts?n.numPathParts:2,i=void 0===n.preserveQuery||n.preserveQuery,o=n.preserveHost||!1;let s;if("about:"===t.protocol||"data:"===t.protocol)s=t.href;else{s=t.pathname;const n=s.split("/").filter((e=>e.length));r&&n.length>r&&(s=e+n.slice(-1*r).join("/")),o&&(s=`${t.host}/${s.replace(/^\//,"")}`),i&&(s=`${s}${t.search}`)}if(s=s.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g,"$1…"),s=s.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,"$1…"),s=s.replace(/(\d{3})\d{6,}/g,"$1…"),s=s.replace(/\u2026+/g,e),s.length>64&&s.includes("?")&&(s=s.replace(/\?([^=]*)(=)?.*/,"?$1$2…"),s.length>64&&(s=s.replace(/\?.*/,"?…"))),s.length>64){const t=s.lastIndexOf(".");s=t>=0?s.slice(0,63-(s.length-t))+`…${s.slice(t)}`:s.slice(0,63)+e}return s}static parseURL(e){const t=new URL(e);return{file:a.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 s.includes(t[0])?`.${t.join(".")}`:`.${t[t.length-1]}`}static getRootDomain(e){const t=a.createOrReturnURL(e).hostname,n=a.getTld(t).split(".");return t.split(".").slice(-n.length).join(".")}static getEnvironmentDisplayValues(e){const t=a.getEmulationDescriptions(e);return[{name:a.i18n.strings.runtimeSettingsDevice,description:t.deviceEmulation},{name:a.i18n.strings.runtimeSettingsNetworkThrottling,description:t.networkThrottling},{name:a.i18n.strings.runtimeSettingsCPUThrottling,description:t.cpuThrottling}]}static getEmulationDescriptions(e){let t,n;const r=e.throttling;switch(e.throttlingMethod){case"provided":t=a.i18n.strings.throttlingProvided,n=a.i18n.strings.throttlingProvided;break;case"devtools":{const{cpuSlowdownMultiplier:e,requestLatencyMs:i}=r;t=`${a.i18n.formatNumber(e)}x slowdown (DevTools)`,n=`${a.i18n.formatNumber(i)} ms HTTP RTT, ${a.i18n.formatNumber(r.downloadThroughputKbps)} Kbps down, ${a.i18n.formatNumber(r.uploadThroughputKbps)} Kbps up (DevTools)`;break}case"simulate":{const{cpuSlowdownMultiplier:e,rttMs:i,throughputKbps:o}=r;t=`${a.i18n.formatNumber(e)}x slowdown (Simulated)`,n=`${a.i18n.formatNumber(i)} ms TCP RTT, ${a.i18n.formatNumber(o)} Kbps throughput (Simulated)`;break}default:t=a.i18n.strings.runtimeUnknown,n=a.i18n.strings.runtimeUnknown}return{deviceEmulation:{mobile:a.i18n.strings.runtimeMobileEmulation,desktop:a.i18n.strings.runtimeDesktopEmulation}[e.formFactor]||a.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-")}}a.reportJson=null,a.getUniqueSuffix=(()=>{let e=0;return function(){return e++}})(),a.i18n=null,a.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"},a.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 l{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 s=e.createElement("span","lh-3p-ui-string");s.append("Show 3rd party resources");const a=e.createElement("span","lh-3p-filter-count");return i.append(" ",o," ",s," (",a,") "),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"),s=e.createElement("span","lh-audit__score-icon"),a=e.createElement("span","lh-audit__title-and-text"),l=e.createElement("span","lh-audit__title"),d=e.createElement("span","lh-audit__display-text");a.append(" ",l," ",d," ");const c=e.createElement("div","lh-chevron-container");o.append(" ",s," ",a," ",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"),s=e.createElement("span","lh-audit-group__title"),a=e.createElement("span","lh-audit-group__itemcount");return o.append(" ",s," ",a," "," "," "),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 .tree-marker {\n width: 12px;\n height: 26px;\n display: block;\n float: left;\n background-position: top left;\n }\n .lh-crc .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 .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 .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 .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 .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 .crc-tree {\n font-size: 14px;\n width: 100%;\n overflow-x: auto;\n }\n .lh-crc .crc-node {\n height: 26px;\n line-height: 26px;\n white-space: nowrap;\n }\n .lh-crc .crc-node__tree-value {\n margin-left: 10px;\n }\n .lh-crc .crc-node__tree-value div {\n display: inline;\n }\n .lh-crc .crc-node__chain-duration {\n font-weight: 700;\n }\n .lh-crc .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"),s=e.createElement("span","lh-crc__longest_duration_label"),a=e.createElement("b","lh-crc__longest_duration");o.append(" ",s," ",a," "),i.append(" ",o," ");const l=e.createElement("div","lh-crc"),d=e.createElement("div","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","crc-node"),r=e.createElement("span","crc-node__tree-marker"),i=e.createElement("span","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 s=e.createElementNS("http://www.w3.org/2000/svg","defs"),a=e.createElementNS("http://www.w3.org/2000/svg","clipPath");a.setAttribute("clipPathUnits","objectBoundingBox"),s.append(" ",a," "," "),o.append(" ",s," "),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 s=e.createElement("ul","lh-env__items");s.append(" "," "),i.append(" ",o," ",s," ");const a=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"),a.append(" "," Generated by ",l," ",d," | ",c," "),r.append(" "," ",i," ",a," "),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 s=e.createElementNS("http://www.w3.org/2000/svg","circle","lh-gauge-arc");s.setAttribute("r","56"),s.setAttribute("cx","60"),s.setAttribute("cy","60"),s.setAttribute("stroke-width","8"),i.append(" ",o," ",s," "),r.append(" ",i," ");const a=e.createElement("div","lh-gauge__percentage"),l=e.createElement("div","lh-gauge__label");return n.append(" "," ",r," ",a," "," ",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 .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"),s=e.createElementNS("http://www.w3.org/2000/svg","linearGradient");s.setAttribute("id","lh-gauge--pwa__check-circle__gradient"),s.setAttribute("x1","50%"),s.setAttribute("y1","0%"),s.setAttribute("x2","50%"),s.setAttribute("y2","100%");const a=e.createElementNS("http://www.w3.org/2000/svg","stop");a.setAttribute("stop-color","#00C852"),a.setAttribute("offset","0%");const l=e.createElementNS("http://www.w3.org/2000/svg","stop");l.setAttribute("stop-color","#009688"),l.setAttribute("offset","100%"),s.append(" ",a," ",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(" ",s," ",d," ",h," ");const g=e.createElementNS("http://www.w3.org/2000/svg","g");g.setAttribute("stroke","none"),g.setAttribute("fill-rule","nonzero");const f=e.createElementNS("http://www.w3.org/2000/svg","circle","lh-gauge--pwa__disc");f.setAttribute("cx","30"),f.setAttribute("cy","30"),f.setAttribute("r","30");const _=e.createElementNS("http://www.w3.org/2000/svg","g","lh-gauge--pwa__logo"),b=e.createElementNS("http://www.w3.org/2000/svg","path","lh-gauge--pwa__logo--secondary-color");b.setAttribute("d","M35.66 19.39l.7-1.75h2L37.4 15 38.6 12l3.4 9h-2.51l-.58-1.61z");const w=e.createElementNS("http://www.w3.org/2000/svg","path","lh-gauge--pwa__logo--primary-color");w.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 v=e.createElementNS("http://www.w3.org/2000/svg","path","lh-gauge--pwa__logo--secondary-color");v.setAttribute("fill-rule","nonzero"),v.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"),_.append(" ",b," ",w," ",v," ");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 E=e.createElementNS("http://www.w3.org/2000/svg","path");E.setAttribute("fill","url(#lh-gauge--pwa__installable__shadow-gradient)"),E.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 A=e.createElementNS("http://www.w3.org/2000/svg","use");A.setAttribute("href","#lh-gauge--pwa__installable-badge"),x.append(" ",E," ",A," ");const C=e.createElementNS("http://www.w3.org/2000/svg","g","lh-gauge--pwa__component lh-gauge--pwa__check-circle");C.setAttribute("transform","translate(18, 28)");const S=e.createElementNS("http://www.w3.org/2000/svg","circle");S.setAttribute("fill","#FFFFFF"),S.setAttribute("cx","12"),S.setAttribute("cy","12"),S.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"),C.append(" ",S," ",k," "),g.append(" "," ",f," ",_," "," ",y," "," ",x," "," ",C," "),i.append(" ",o," ",g," ");const L=e.createElement("div","lh-gauge__label");return r.append(" ",i," ",L," "),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 .pyro {\n display: none;\n z-index: 1;\n pointer-events: none;\n }\n .score100 .pyro {\n display: block;\n }\n .score100 .lh-lighthouse stop:first-child {\n stop-color: hsla(200, 12%, 95%, 0);\n }\n .score100 .lh-lighthouse stop:last-child {\n stop-color: hsla(65, 81%, 76%, 1);\n }\n\n .pyro > .before, .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 .pyro > .after {\n animation-delay: 2.25s, 2.25s, 2.25s;\n animation-duration: 1.25s, 1.25s, 6.25s;\n }\n .fireworks-paused .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"),s=e.createElement("div","lh-metric__description");return r.append(" ",i," ",o," ",s," "),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 s=e.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("width","24"),s.setAttribute("height","24"),s.setAttribute("viewBox","0 0 24 24");const a=e.createElementNS("http://www.w3.org/2000/svg","path","lh-metrics-toggle__lines");a.setAttribute("d","M4 9h16v2H4zm0 4h10v2H4z"),s.append(" ",a," "),o.append(" ",s," ");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"),s=e.createElement("div","lh-load-opportunity__cols"),a=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");a.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," "),s.append(" ",a," ",c," "),o.append(" ",s," "),i.append(" ",o," ");const f=e.createElement("div","lh-audit__description"),_=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","pyro"),s=e.createElement("div","before"),a=e.createElement("div","after");return o.append(" ",s," ",a," "),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"),s=e.createElement("span","lh-snippet__btn-label-collapse lh-snippet__show-if-expanded"),a=e.createElement("span","lh-snippet__btn-label-expand lh-snippet__show-if-collapsed");return o.append(" ",s," ",a," "),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 .lh-topbar__logo .shape {\n fill: var(--report-text-color);\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 .dark .lh-tools__button svg {\n filter: invert(1);\n }\n .lh-tools__button.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"),s=e.createElementNS("http://www.w3.org/2000/svg","linearGradient");s.setAttribute("x1","57.456%"),s.setAttribute("y1","13.086%"),s.setAttribute("x2","18.259%"),s.setAttribute("y2","72.322%"),s.setAttribute("id","lh-topbar__logo--a");const a=e.createElementNS("http://www.w3.org/2000/svg","stop");a.setAttribute("stop-color","#262626"),a.setAttribute("stop-opacity",".1"),a.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%"),s.append(" ",a," ",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 f=e.createElementNS("http://www.w3.org/2000/svg","stop");f.setAttribute("stop-color","#FFF"),f.setAttribute("stop-opacity",".1"),f.setAttribute("offset","0%");const _=e.createElementNS("http://www.w3.org/2000/svg","stop");_.setAttribute("stop-color","#FFF"),_.setAttribute("stop-opacity","0"),_.setAttribute("offset","100%"),g.append(" ",f," ",_," "),o.append(" ",s," ",d," ",h," ",g," ");const b=e.createElementNS("http://www.w3.org/2000/svg","g");b.setAttribute("fill","none"),b.setAttribute("fill-rule","evenodd");const w=e.createElementNS("http://www.w3.org/2000/svg","path");w.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"),w.setAttribute("fill","#F44B21");const v=e.createElementNS("http://www.w3.org/2000/svg","path");v.setAttribute("fill","#FFF"),v.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 E=e.createElementNS("http://www.w3.org/2000/svg","path");E.setAttribute("fill","url(#lh-topbar__logo--b)"),E.setAttribute("fill-rule","nonzero"),E.setAttribute("d","M0 6.375h6v2.25H0z"),E.setAttribute("transform","translate(6 3)");const A=e.createElementNS("http://www.w3.org/2000/svg","path");A.setAttribute("fill","url(#lh-topbar__logo--c)"),A.setAttribute("fill-rule","nonzero"),A.setAttribute("d","M6 6.375H1.875v-3.75L6 0z"),A.setAttribute("transform","translate(6 3)");const C=e.createElementNS("http://www.w3.org/2000/svg","path");C.setAttribute("fill","url(#lh-topbar__logo--d)"),C.setAttribute("fill-rule","nonzero"),C.setAttribute("d","M6 0l4.125 2.625v3.75H12v2.25h-1.688l1.5 9.375H.188l1.5-9.375H0v-2.25h1.875V2.648z"),C.setAttribute("transform","translate(6 3)"),b.append(" ",w," ",v," ",y," ",x," ",E," ",A," ",C," "),i.append(" ",o," ",b," ");const S=e.createElement("a","lh-topbar__url");S.setAttribute("href",""),S.setAttribute("target","_blank"),S.setAttribute("rel","noopener");const k=e.createElement("div","lh-tools"),L=e.createElement("button","lh-tools__button");L.setAttribute("id","lh-tools-button"),L.setAttribute("title","Tools menu"),L.setAttribute("aria-label","Toggle report tools menu"),L.setAttribute("aria-haspopup","menu"),L.setAttribute("aria-expanded","false"),L.setAttribute("aria-controls","lh-tools-dropdown");const T=e.createElementNS("http://www.w3.org/2000/svg","svg");T.setAttribute("width","100%"),T.setAttribute("height","100%"),T.setAttribute("viewBox","0 0 24 24");const D=e.createElementNS("http://www.w3.org/2000/svg","path");D.setAttribute("d","M0 0h24v24H0z"),D.setAttribute("fill","none");const M=e.createElementNS("http://www.w3.org/2000/svg","path");M.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"),T.append(" ",D," ",M," "),L.append(" ",T," ");const N=e.createElement("div","lh-tools__dropdown");N.setAttribute("id","lh-tools-dropdown"),N.setAttribute("role","menu"),N.setAttribute("aria-labelledby","lh-tools-button");const F=e.createElement("a","report-icon 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","report-icon 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 U=e.createElement("a","report-icon report-icon--copy");U.setAttribute("role","menuitem"),U.setAttribute("tabindex","-1"),U.setAttribute("href","#"),U.setAttribute("data-i18n","dropdownCopyJSON"),U.setAttribute("data-action","copy");const P=e.createElement("a","report-icon report-icon--download");P.setAttribute("role","menuitem"),P.setAttribute("tabindex","-1"),P.setAttribute("href","#"),P.setAttribute("data-i18n","dropdownSaveHTML"),P.setAttribute("data-action","save-html");const H=e.createElement("a","report-icon report-icon--download");H.setAttribute("role","menuitem"),H.setAttribute("tabindex","-1"),H.setAttribute("href","#"),H.setAttribute("data-i18n","dropdownSaveJSON"),H.setAttribute("data-action","save-json");const $=e.createElement("a","report-icon report-icon--open");$.setAttribute("role","menuitem"),$.setAttribute("tabindex","-1"),$.setAttribute("href","#"),$.setAttribute("data-i18n","dropdownViewer"),$.setAttribute("data-action","open-viewer");const O=e.createElement("a","report-icon report-icon--open");O.setAttribute("role","menuitem"),O.setAttribute("tabindex","-1"),O.setAttribute("href","#"),O.setAttribute("data-i18n","dropdownSaveGist"),O.setAttribute("data-action","save-gist");const z=e.createElement("a","report-icon 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"),N.append(" ",F," ",R," ",U," ",P," ",H," ",$," ",O," ",z," "),k.append(" ",L," ",N," "),r.append(" "," ",i," ",S," ",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)}convertMarkdownLinkSnippets(e){const t=this.createElement("span");for(const n of a.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 a.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))}}
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 d{constructor(e){this.el=e,this._id=void 0}log(e,t=!0){this._id&&clearTimeout(this._id),this.el.textContent=e,this.el.classList.add("show"),t&&(this._id=setTimeout((e=>{this.el.classList.remove("show")}),7e3))}warn(e){this.log("Warning: "+e)}error(e){this.log(e),setTimeout((t=>{throw new Error(e)}),0)}hide(){this._id&&clearTimeout(this._id),this.el.classList.remove("show")}}
51
+ /**
52
+ * @license
53
+ * Copyright 2017 The Lighthouse Authors. All Rights Reserved.
54
+ *
55
+ * Licensed under the Apache License, Version 2.0 (the "License");
56
+ * you may not use this file except in compliance with the License.
57
+ * You may obtain a copy of the License at
58
+ *
59
+ * http://www.apache.org/licenses/LICENSE-2.0
60
+ *
61
+ * Unless required by applicable law or agreed to in writing, software
62
+ * distributed under the License is distributed on an "AS-IS" BASIS,
63
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64
+ * See the License for the specific language governing permissions and
65
+ * limitations under the License.
66
+ */class c{constructor(e,t){this.dom=e,this.detailsRenderer=t}get _clumpTitles(){return{warning:a.i18n.strings.warningAuditsGroupTitle,manual:a.i18n.strings.manualAuditsGroupTitle,passed:a.i18n.strings.passedAuditsGroupTitle,notApplicable:a.i18n.strings.notApplicableAuditsGroupTitle}}renderAudit(e){const t=this.dom.createComponent("audit");return this.populateAuditValues(e,t)}populateAuditValues(e,t){const n=a.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 s=this.dom.find(".lh-audit__description",r);s.appendChild(this.dom.convertMarkdownLinkSnippets(e.result.description));for(const t of e.relevantMetrics||[]){const e=this.dom.createChildOf(s,"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 l=this.dom.find("details",r);if(e.result.details){const t=this.detailsRenderer.render(e.result.details);t&&(t.classList.add("lh-details"),l.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("tooltip-boundary");this.dom.createChildOf(t,"div","tooltip 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 d=e.result.warnings;if(!d||0===d.length)return r;const c=this.dom.find("summary",l),p=this.dom.createChildOf(c,"div","lh-warnings");if(this.dom.createChildOf(p,"span").textContent=n.warningHeader,1===d.length)p.appendChild(this.dom.document().createTextNode(d.join("")));else{const e=this.dom.createChildOf(p,"ul");for(const t of d){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=a.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],s=this.renderAuditGroup(n);for(const e of o)s.appendChild(this.renderAudit(e));s.classList.add(`lh-audit-group--${e}`),i.push(s)}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),s=this._clumpTitles[e];if(this.dom.find(".lh-audit-group__title",o).textContent=s,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 a=t.map(this.renderAudit.bind(this));return i.append(...a),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}`),a.isPluginCategory(e.id)&&r.classList.add("lh-gauge__wrapper--plugin");const i=Number(e.score),o=this.dom.find(".lh-gauge",n),s=this.dom.find("circle.lh-gauge-arc",o);s&&this._setGaugeArc(s,i);const l=Math.round(100*i),d=this.dom.find("div.lh-gauge__percentage",n);return d.textContent=l.toString(),null===e.score&&(d.textContent="?",d.title=a.i18n.strings.errorLabel),0===e.auditRefs.length||this.hasApplicableAudits(e)?r.classList.add(`lh-gauge__wrapper--${a.calculateRating(e.score)}`):(r.classList.add("lh-gauge__wrapper--not-applicable"),d.textContent="-",d.title=a.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:a.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,s=this.renderClump(i,{auditRefs:o,description:r});n.appendChild(s)}return n}createPermalinkSpan(e,t){this.dom.createChildOf(e,"span","lh-permalink").id=t}}
67
+ /**
68
+ * @license
69
+ * Copyright 2017 The Lighthouse Authors. All Rights Reserved.
70
+ *
71
+ * Licensed under the Apache License, Version 2.0 (the "License");
72
+ * you may not use this file except in compliance with the License.
73
+ * You may obtain a copy of the License at
74
+ *
75
+ * http://www.apache.org/licenses/LICENSE-2.0
76
+ *
77
+ * Unless required by applicable law or agreed to in writing, software
78
+ * distributed under the License is distributed on an "AS-IS" BASIS,
79
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
80
+ * See the License for the specific language governing permissions and
81
+ * limitations under the License.
82
+ */class p{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 s=e[t],a=Object.keys(e),l=a.indexOf(t)===a.length-1,d=!!s.children&&Object.keys(s.children).length>0,c=Array.isArray(i)?i.slice(0):[];return void 0!==o&&c.push(!o),{node:s,isLastChild:l,hasChildren:d,startTime:n,transferSize:r+s.request.transferSize,treeMarkers:c}}static createChainNode(e,t,n){const r=e.createComponent("crcChain");e.find(".crc-node",r).setAttribute("title",t.node.request.url);const i=e.find(".crc-node__tree-marker",r);t.treeMarkers.forEach((t=>{t?(i.appendChild(e.createElement("span","tree-marker vert")),i.appendChild(e.createElement("span","tree-marker"))):(i.appendChild(e.createElement("span","tree-marker")),i.appendChild(e.createElement("span","tree-marker")))})),t.isLastChild?(i.appendChild(e.createElement("span","tree-marker up-right")),i.appendChild(e.createElement("span","tree-marker right"))):(i.appendChild(e.createElement("span","tree-marker vert-right")),i.appendChild(e.createElement("span","tree-marker right"))),t.hasChildren?i.appendChild(e.createElement("span","tree-marker horiz-down")):i.appendChild(e.createElement("span","tree-marker right"));const o=t.node.request.url,s=n.renderTextURL(o),l=e.find(".crc-node__tree-value",r);if(l.appendChild(s),!t.hasChildren){const{startTime:n,endTime:r,transferSize:i}=t.node.request,o=e.createElement("span","crc-node__chain-duration");o.textContent=" - "+a.i18n.formatMilliseconds(1e3*(r-n))+", ";const s=e.createElement("span","crc-node__chain-duration");s.textContent=a.i18n.formatBytesToKiB(i,.01),l.appendChild(o),l.appendChild(s)}return r}static buildTree(e,t,n,r,i,o){if(r.appendChild(h.createChainNode(e,n,o)),n.node.children)for(const s of Object.keys(n.node.children)){const a=h.createSegment(n.node.children,s,n.startTime,n.transferSize,n.treeMarkers,n.isLastChild);h.buildTree(e,t,a,r,i,o)}}static render(e,t,n){const r=e.createComponent("crc"),i=e.find(".lh-crc",r);e.find(".crc-initial-nav",r).textContent=a.i18n.strings.crcInitialNavigation,e.find(".lh-crc__longest_duration_label",r).textContent=a.i18n.strings.crcLongestDurationLabel,e.find(".lh-crc__longest_duration",r).textContent=a.i18n.formatMilliseconds(t.longestChain.duration);const o=h.initTree(t.chains);for(const s of Object.keys(o.tree)){const a=h.createSegment(o.tree,s,o.startTime,o.transferSize);h.buildTree(e,r,a,i,t,n)}return e.find(".lh-crc-container",r)}}const h=p,u=0,m=1,g=2,f=0,_=1,b=2,w=3,v={[f]:["lh-snippet__line--content"],[_]:["lh-snippet__line--content","lh-snippet__line--content-highlighted"],[b]:["lh-snippet__line--placeholder"],[w]:["lh-snippet__line--message"]};
83
+ /**
84
+ * @license Copyright 2019 The Lighthouse Authors. All Rights Reserved.
85
+ * 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
86
+ * 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.
87
+ */function y(e,t){return{line:e.find((e=>e.lineNumber===t)),previousLine:e.find((e=>e.lineNumber===t-1))}}function x(e,t){return e.filter((e=>e.lineNumber===t))}function E(e){return a.filterRelevantLines(e.lines,e.lineMessages,2)}class A{static renderHeader(e,t,n,r){const i=E(t).length<t.lines.length,o=e.createComponent("snippetHeader");e.find(".lh-snippet__title",o).textContent=t.title;const{snippetCollapseButtonLabel:s,snippetExpandButtonLabel:l}=a.i18n.strings;e.find(".lh-snippet__btn-label-collapse",o).textContent=s,e.find(".lh-snippet__btn-label-expand",o).textContent=l;const d=e.find(".lh-snippet__toggle-expand",o);if(i?d.addEventListener("click",(()=>r())):d.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:s}){const a=e.createComponent("snippetLine"),l=e.find(".lh-snippet__line",a),{classList:d}=l;v[o].forEach((e=>d.add(e))),s===m?d.add("lh-snippet__show-if-collapsed"):s===g&&d.add("lh-snippet__show-if-expanded");const c=n+(i?"…":""),p=e.find(".lh-snippet__line code",l);return o===w?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 A.renderSnippetLine(e,t,{lineNumber:" ",content:n.message,contentType:w})}static renderOmittedLinesPlaceholder(e,t,n){return A.renderSnippetLine(e,t,{lineNumber:"…",content:"",visibility:n,contentType:b})}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(A.renderMessage(e,t,n)))),i.append(A.renderSnippetLines(e,t,n)),r}static renderSnippetLines(e,t,n){const{lineMessages:r,generalMessages:i,lineCount:o,lines:s}=n,a=E(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}=y(s,n),{line:p,previousLine:h}=y(a,n),b=!!p;!!h&&!b&&(c=!0),b&&c&&(d.append(A.renderOmittedLinesPlaceholder(e,t,m)),c=!1);const w=!i&&1===n;if(!i&&!!o||w){const r=!a.some((e=>e.lineNumber>n))||1===n;d.append(A.renderOmittedLinesPlaceholder(e,t,r?g:u)),c=!1}if(!i)continue;const v=x(r,n),E=v.length>0||l,C=Object.assign({},i,{contentType:E?_:f,visibility:p?u:g});d.append(A.renderSnippetLine(e,t,C)),v.forEach((n=>{d.append(A.renderMessage(e,t,n))}))}return d}static render(e,t,n){const r=e.createComponent("snippet"),i=e.find(".lh-snippet",r),o=A.renderHeader(e,t,n,(()=>i.classList.toggle("lh-snippet--expanded"))),s=A.renderSnippetContent(e,r,t);return i.append(o,s),i}}
88
+ /**
89
+ * @license Copyright 2020 The Lighthouse Authors. All Rights Reserved.
90
+ * 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
91
+ * 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.
92
+ */function C(e,t,n){return e<t?t:e>n?n:e}class S{static getScreenshotPositions(e,t,n){const r={x:(i=e).left+i.width/2,y:i.top+i.height/2};var i;const o=C(r.x-t.width/2,0,n.width-t.width),s=C(r.y-t.height/2,0,n.height-t.height);return{screenshot:{left:o,top:s},clip:{left:e.left-o,top:e.top-s}}}static renderClipPathInScreenshot(e,t,n,r,i){const o=e.find("clipPath",t),s=`clip-${a.getUniqueSuffix()}`;o.id=s,t.style.clipPath=`url(#${s})`;const l=n.top/i.height,d=l+r.height/i.height,c=n.left/i.width,p=c+r.width/i.width,h=[`0,0 1,0 1,${l} 0,${l}`,`0,${d} 1,${d} 1,1 0,1`,`0,${l} ${c},${l} ${c},${d} 0,${d}`,`${p},${l} 1,${l} 1,${d} ${p},${d}`];for(const t of h){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 s=t.createElement("div","lh-element-screenshot__overlay");r.append(s);const a={width:.95*s.clientWidth,height:.8*s.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=S.render(t,i.screenshot,l,a);d?(s.appendChild(d),s.addEventListener("click",(()=>s.remove()))):s.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 s=this._computeZoomFactor(n,r),a={width:r.width/s,height:r.height/s};a.width=Math.min(t.width,a.width);const l=a.width*s,d=a.height*s,c=S.getScreenshotPositions(n,a,{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*s+"px",p.style.backgroundPositionX=-c.screenshot.left*s+"px",p.style.backgroundSize=`${t.width*s}px ${t.height*s}px`;const h=e.find("div.lh-element-screenshot__element-marker",o);h.style.width=n.width*s+"px",h.style.height=n.height*s+"px",h.style.left=c.clip.left*s+"px",h.style.top=c.clip.top*s+"px";const u=e.find("div.lh-element-screenshot__mask",o);return u.style.width=l+"px",u.style.height=d+"px",S.renderClipPathInScreenshot(e,u,c.clip,n,a),o}}
93
+ /**
94
+ * @license
95
+ * Copyright 2017 The Lighthouse Authors. All Rights Reserved.
96
+ *
97
+ * Licensed under the Apache License, Version 2.0 (the "License");
98
+ * you may not use this file except in compliance with the License.
99
+ * You may obtain a copy of the License at
100
+ *
101
+ * http://www.apache.org/licenses/LICENSE-2.0
102
+ *
103
+ * Unless required by applicable law or agreed to in writing, software
104
+ * distributed under the License is distributed on an "AS-IS" BASIS,
105
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
106
+ * See the License for the specific language governing permissions and
107
+ * limitations under the License.
108
+ */const k=["http://","https://","data:"];class L{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 p.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=a.i18n.formatBytesToKiB(e.value,e.granularity),n=this._renderText(t);return n.title=a.i18n.formatBytes(e.value),n}_renderMilliseconds(e){let t=a.i18n.formatMilliseconds(e.value,e.granularity);return"duration"===e.displayUnit&&(t=a.i18n.formatDuration(e.value)),this._renderText(t)}renderTextURL(e){const t=e;let n,r,i;try{const e=a.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=a.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 k.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 s=!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(s?"lh-row--even":"lh-row--odd");s=!s,o.append(e)}return t}_renderList(e){const t=this._dom.createElement("div","lh-list");return e.items.forEach((e=>{const n=A.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=S.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}}
109
+ /**
110
+ * @license Copyright 2020 The Lighthouse Authors. All Rights Reserved.
111
+ * 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
112
+ * 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.
113
+ */const T=1024;class D{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>=T?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(" ")}}
114
+ /**
115
+ * @license
116
+ * Copyright 2018 The Lighthouse Authors. All Rights Reserved.
117
+ *
118
+ * Licensed under the Apache License, Version 2.0 (the "License");
119
+ * you may not use this file except in compliance with the License.
120
+ * You may obtain a copy of the License at
121
+ *
122
+ * http://www.apache.org/licenses/LICENSE-2.0
123
+ *
124
+ * Unless required by applicable law or agreed to in writing, software
125
+ * distributed under the License is distributed on an "AS-IS" BASIS,
126
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
127
+ * See the License for the specific language governing permissions and
128
+ * limitations under the License.
129
+ */class M extends c{_renderMetric(e){const t=this.dom.createComponent("metric"),n=this.dom.find(".lh-metric",t);n.id=e.result.id;const r=a.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),s=i.overallSavingsMs/t*100+"%";if(this.dom.find("div.lh-sparkline__bar",r).style.width=s,o.textContent=a.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]}))];a.reportJson&&(i.push(["device",a.reportJson.configSettings.formFactor]),i.push(["version",a.reportJson.lighthouseVersion]));const o=new URLSearchParams(i),s=new URL("https://googlechrome.github.io/lighthouse/scorecalc/");return s.hash=o.toString(),s.href}render(e,t,n){const r=a.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),s=this.dom.createComponent("metricsToggle"),l=this.dom.find(".lh-metrics-toggle",s);o.append(...l.childNodes);const d=e.auditRefs.filter((e=>"metrics"===e.group)),c=this.dom.createChildOf(o,"div","lh-metrics-container");d.forEach((e=>{c.appendChild(this._renderMetric(e))}));const p=this.dom.createChildOf(o,"div","lh-metrics__disclaimer"),h=this.dom.convertMarkdownLinkSnippets(r.varianceDisclaimer);p.appendChild(h);const u=this.dom.createChildOf(p,"a","lh-calclink");u.target="_blank",u.textContent=r.calculatorLink,this.dom.safelySetHref(u,this._getScoringCalculatorHref(e.auditRefs)),o.classList.add("lh-audit-group--metrics"),i.appendChild(o);const m=this.dom.createChildOf(i,"div","lh-filmstrip-container"),g=e.auditRefs.find((e=>"screenshot-thumbnails"===e.id)),f=g&&g.result;if(f&&f.details){m.id=f.id;const e=this.detailsRenderer.render(f.details);e&&m.appendChild(e)}const _=e.auditRefs.filter((e=>"load-opportunities"===e.group&&!a.showAsPassed(e.result))).sort(((e,t)=>this._getWastedMs(t)-this._getWastedMs(e))),b=d.filter((e=>!!e.relevantAudits));if(b.length&&this.renderMetricAuditFilter(b,i),_.length){const e=2e3,n=_.map((e=>this._getWastedMs(e))),o=Math.max(...n),s=Math.max(1e3*Math.ceil(o/1e3),e),a=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);a.appendChild(d),_.forEach((e=>a.appendChild(this._renderOpportunity(e,s)))),a.classList.add("lh-audit-group--load-opportunities"),i.appendChild(a)}const w=e.auditRefs.filter((e=>"diagnostics"===e.group&&!a.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(w.length){const e=this.renderAuditGroup(t.diagnostics);w.forEach((t=>e.appendChild(this.renderAudit(t)))),e.classList.add("lh-audit-group--diagnostics"),i.appendChild(e)}const v=e.auditRefs.filter((e=>("load-opportunities"===e.group||"diagnostics"===e.group)&&a.showAsPassed(e.result)));if(!v.length)return i;const y={auditRefs:v,groupDefinitions:t},x=this.renderClump("passed",y);i.appendChild(x);const E=[];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"),E.push(e))}})),E.length>0){const e=this.renderAuditGroup(t.budgets);E.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=a.i18n.strings.showRelevantAudits;const r=[{acronym:"All"},...e],i=a.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 s=this.dom.createChildOf(n,"label","lh-metricfilter__label");s.htmlFor=r,s.title=e.result&&e.result.title,s.textContent=e.acronym||e.id,"All"===e.acronym&&(o.checked=!0,s.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}}))}}}
130
+ /**
131
+ * @license
132
+ * Copyright 2018 The Lighthouse Authors. All Rights Reserved.
133
+ *
134
+ * Licensed under the Apache License, Version 2.0 (the "License");
135
+ * you may not use this file except in compliance with the License.
136
+ * You may obtain a copy of the License at
137
+ *
138
+ * http://www.apache.org/licenses/LICENSE-2.0
139
+ *
140
+ * Unless required by applicable law or agreed to in writing, software
141
+ * distributed under the License is distributed on an "AS-IS" BASIS,
142
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
143
+ * See the License for the specific language governing permissions and
144
+ * limitations under the License.
145
+ */class N extends c{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 s=r.filter((e=>"manual"===e.result.scoreDisplayMode)),a=this.renderClump("manual",{auditRefs:s,description:e.manualDescription});return n.appendChild(a),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");N._makeSvgReferencesUnique(i);const o=this._getGroupIds(e.auditRefs),s=this._getPassingGroupIds(e.auditRefs);if(s.size===o.size)r.classList.add("lh-badged--all");else for(const e of s)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)!a.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,s=n.filter((e=>a.showAsPassed(e.result))).length,l=t[i].title;r.push(`${l}: ${s}/${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=a.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 s=e.querySelectorAll(`[fill="url(#${r})"]`);for(const e of s)e.setAttribute("fill",`url(#${i})`)}}}
146
+ /**
147
+ * @license
148
+ * Copyright 2017 The Lighthouse Authors. All Rights Reserved.
149
+ *
150
+ * Licensed under the Apache License, Version 2.0 (the "License");
151
+ * you may not use this file except in compliance with the License.
152
+ * You may obtain a copy of the License at
153
+ *
154
+ * http://www.apache.org/licenses/LICENSE-2.0
155
+ *
156
+ * Unless required by applicable law or agreed to in writing, software
157
+ * distributed under the License is distributed on an "AS-IS" BASIS,
158
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
159
+ * See the License for the specific language governing permissions and
160
+ * limitations under the License.
161
+ *
162
+ * Dummy text for ensuring report robustness: <\/script> pre$`post %%LIGHTHOUSE_JSON%%
163
+ * (this is handled by terser)
164
+ */class F{constructor(e){this._dom=e}renderReport(e,t){this._dom.setLighthouseChannel(e.configSettings.channel||"unknown");const n=a.prepareReportResult(e);return t.textContent="",t.appendChild(this._renderReport(n)),t}setTemplateContext(e){}_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=a.i18n.strings.runtimeSettingsTitle;const r=a.getEnvironmentDisplayValues(e.configSettings||{}),i=[{name:a.i18n.strings.runtimeSettingsUrl,description:e.finalUrl},{name:a.i18n.strings.runtimeSettingsFetchTime,description:a.i18n.formatDateTime(e.fetchTime)},...r,{name:a.i18n.strings.runtimeSettingsChannel,description:e.configSettings.channel},{name:a.i18n.strings.runtimeSettingsUA,description:e.userAgent},{name:a.i18n.strings.runtimeSettingsUANetwork,description:e.environment&&e.environment.networkUserAgent},{name:a.i18n.strings.runtimeSettingsBenchmark,description:e.environment&&e.environment.benchmarkIndex.toFixed(0)}];e.environment.credits&&e.environment.credits["axe-core"]&&i.push({name:a.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=a.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=a.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 s of Object.values(e.categories)){const l=n[s.id]||t,d=l.renderScoreGauge(s,e.categoryGroups||{});a.isPluginCategory(s.id)?o.push(d):l.renderScoreGauge===t.renderScoreGauge?r.push(d):i.push(d)}return[...r,...i,...o]}_renderReport(e){const t=new D(e.configSettings.locale,{...a.UIStrings,...e.i18n.rendererFormattedStrings});a.i18n=t,a.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 L(this._dom,{fullPageScreenshot:n}),i=new c(this._dom,r),o={performance:new M(this._dom,r),pwa:new N(this._dom,r)},s=this._dom.createElement("div");s.appendChild(this._renderReportHeader());const l=this._dom.createElement("div","lh-container"),d=this._dom.createElement("div","lh-report");let p;d.appendChild(this._renderReportWarnings(e));if(1===Object.keys(e.categories).length?s.classList.add("lh-header--solo-category"):p=this._dom.createElement("div","lh-scores-header"),p){const t=this._dom.createComponent("scorescale"),n=this._dom.find(".lh-scores-container",s);p.append(...this._renderScoreGauges(e,i,o)),n.appendChild(p),n.appendChild(t);const r=this._dom.createElement("div","lh-sticky-header");r.append(...this._renderScoreGauges(e,i,o)),l.appendChild(r)}const h=d.appendChild(this._dom.createElement("div","lh-categories"));for(const t of Object.values(e.categories)){const n=o[t.id]||i;n.dom.createChildOf(h,"div","lh-category-wrapper").appendChild(n.render(t,e.categoryGroups))}const u=this._dom.createFragment(),m=this._renderReportTopbar(e);return u.appendChild(m),u.appendChild(l),l.appendChild(s),l.appendChild(d),d.appendChild(this._renderReportFooter(e)),n&&S.installFullPageScreenshot(l,n.screenshot),u}}
165
+ /**
166
+ * @license Copyright 2017 The Lighthouse Authors. All Rights Reserved.
167
+ * 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
168
+ * 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.
169
+ */var R=function(e){const t=new URL(e.finalUrl).hostname,n=e.fetchTime&&new Date(e.fetchTime)||new Date,r=n.toLocaleTimeString("en-US",{hour12:!1}),i=n.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}).split("/");return i.unshift(i.pop()),`${t}_${i.join("-")}_${r}`.replace(/[/?<>\\:*|"]/g,"-")};
170
+ /**
171
+ * @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
172
+ * 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
173
+ * 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.
174
+ */
175
+ const U="undefined"!=typeof btoa?btoa:e=>Buffer.from(e).toString("base64"),P="undefined"!=typeof atob?atob:e=>Buffer.from(e,"base64").toString();const H={toBase64:async function(e,t){let n=(new TextEncoder).encode(e);if(t.gzip)if("undefined"!=typeof CompressionStream){const e=new CompressionStream("gzip"),t=e.writable.getWriter();t.write(n),t.close();const r=await new Response(e.readable).arrayBuffer();n=new Uint8Array(r)}else{n=window.pako.gzip(e)}let r="";for(let e=0;e<n.length;e+=5e3)r+=String.fromCharCode(...n.subarray(e,e+5e3));return U(r)},fromBase64:function(e,t){const n=P(e),r=Uint8Array.from(n,(e=>e.charCodeAt(0)));if(t.gzip){return window.pako.ungzip(r,{to:"string"})}return(new TextDecoder).decode(r)}};
176
+ /**
177
+ * @license
178
+ * Copyright 2017 The Lighthouse Authors. All Rights Reserved.
179
+ *
180
+ * Licensed under the Apache License, Version 2.0 (the "License");
181
+ * you may not use this file except in compliance with the License.
182
+ * You may obtain a copy of the License at
183
+ *
184
+ * http://www.apache.org/licenses/LICENSE-2.0
185
+ *
186
+ * Unless required by applicable law or agreed to in writing, software
187
+ * distributed under the License is distributed on an "AS-IS" BASIS,
188
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ * See the License for the specific language governing permissions and
190
+ * limitations under the License.
191
+ */function $(){const e=window.location.host.endsWith(".vercel.app"),t=new URLSearchParams(window.location.search).has("dev");return e?`https://${window.location.host}/gh-pages`:t?"http://localhost:8000":"https://googlechrome.github.io/lighthouse"}class O{constructor(e){this.json,this._dom=e,this._document=this._dom.document(),this._dropDown=new z(this._dom),this._copyAttempt=!1,this.topbarEl,this.scoreScaleEl,this.stickyHeaderEl,this.highlightEl,this.onMediaQueryChange=this.onMediaQueryChange.bind(this),this.onCopy=this.onCopy.bind(this),this.onDropDownMenuClick=this.onDropDownMenuClick.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.collapseAllDetails=this.collapseAllDetails.bind(this),this.expandAllDetails=this.expandAllDetails.bind(this),this._toggleDarkTheme=this._toggleDarkTheme.bind(this),this._updateStickyHeaderOnScroll=this._updateStickyHeaderOnScroll.bind(this)}initFeatures(e){this.json=e,this._setupMediaQueryListeners(),this._dropDown.setup(this.onDropDownMenuClick),this._setupThirdPartyFilter(),this._setupElementScreenshotOverlay(this._dom.find(".lh-container",this._document)),this._setUpCollapseDetailsAfterPrinting(),this._resetUIState(),this._document.addEventListener("keyup",this.onKeyUp),this._document.addEventListener("copy",this.onCopy);this._dom.find(".lh-topbar__logo",this._document).addEventListener("click",(()=>this._toggleDarkTheme()));let t=!1;!this._dom.isDevTools()&&window.matchMedia("(prefers-color-scheme: dark)").matches&&(t=!0);if(["performance","accessibility","best-practices","seo"].every((t=>{const n=e.categories[t];return n&&1===n.score}))&&(t=!0,this._enableFireworks()),t&&this._toggleDarkTheme(!0),Object.keys(this.json.categories).length>=2){this._setupStickyHeaderElements();const e=this._dom.find(".lh-container",this._document);if(this._getScrollParent(e).addEventListener("scroll",this._updateStickyHeaderOnScroll),this._dom.isDevTools()){new window.ResizeObserver(this._updateStickyHeaderOnScroll).observe(e)}else window.addEventListener("resize",this._updateStickyHeaderOnScroll)}if(e.categories.performance&&e.categories.performance.auditRefs.some((t=>Boolean("metrics"===t.group&&e.audits[t.id].errorMessage)))){this._dom.find("input.lh-metrics-toggle__input",this._document).checked=!0}this.json.audits["script-treemap-data"]&&this.json.audits["script-treemap-data"].details&&this.addButton({text:a.i18n.strings.viewTreemapLabel,icon:"treemap",onClick:()=>O.openTreemap(this.json)});for(const e of this._dom.findAll("[data-i18n]",this._dom.document())){const t=e.getAttribute("data-i18n");e.textContent=a.i18n.strings[t]}}setTemplateContext(e){}addButton(e){const t=this._document.querySelector(".lh-audit-group--metrics"),n=e.container||t;if(!n)return;let r=n.querySelector(".lh-buttons");r||(r=this._dom.createChildOf(n,"div","lh-buttons"));const i=["lh-button"];e.icon&&(i.push("report-icon"),i.push(`report-icon--${e.icon}`));const o=this._dom.createChildOf(r,"button",i.join(" "));return o.textContent=e.text,o.addEventListener("click",e.onClick),o}_getScrollParent(e){const{overflowY:t}=window.getComputedStyle(e);return"visible"!==t&&"hidden"!==t?e:e.parentElement?this._getScrollParent(e.parentElement):document}_enableFireworks(){const e=this._dom.find(".lh-scores-container",this._document);e.classList.add("score100"),e.addEventListener("click",(t=>{e.classList.toggle("fireworks-paused")}))}_fireEventOn(e,t=this._document,n){const r=new CustomEvent(e,n?{detail:n}:void 0);t.dispatchEvent(r)}_setupMediaQueryListeners(){const e=self.matchMedia("(max-width: 500px)");e.addListener(this.onMediaQueryChange),this.onMediaQueryChange(e)}onMediaQueryChange(e){this._dom.find(".lh-root",this._document).classList.toggle("lh-narrow",e.matches)}_setupThirdPartyFilter(){const e=["uses-rel-preconnect","third-party-facades"],t=["legacy-javascript"];Array.from(this._document.querySelectorAll("table.lh-table")).filter((e=>e.querySelector("td.lh-table-column--url, td.lh-table-column--source-location"))).filter((t=>{const n=t.closest(".lh-audit");if(!n)throw new Error(".lh-table not within audit");return!e.includes(n.id)})).forEach(((e,n)=>{const r=function(e){return Array.from(e.tBodies[0].rows)}(e),i=this._getThirdPartyRows(r,this.json.finalUrl),o=this._dom.createComponent("3pFilter"),s=this._dom.find("input",o),l=`lh-3p-filter-label--${n}`;s.id=l,s.addEventListener("change",(e=>{const t=e.target instanceof HTMLInputElement&&!e.target.checked;let n=!0,o=r[0];for(;o;){const e=t&&i.includes(o);do{o.classList.toggle("lh-row--hidden",e),o.classList.toggle("lh-row--even",!e&&n),o.classList.toggle("lh-row--odd",!e&&!n),o=o.nextElementSibling}while(o&&o.classList.contains("lh-sub-item-row"));e||(n=!n)}})),this._dom.find("label",o).setAttribute("for",l),this._dom.find(".lh-3p-filter-count",o).textContent=`${i.length}`,this._dom.find(".lh-3p-ui-string",o).textContent=a.i18n.strings.thirdPartyResourcesLabel;const d=i.length===r.length,c=!i.length;if((d||c)&&(s.disabled=!0,s.checked=d),!e.parentNode)return;e.parentNode.insertBefore(o,e);const p=e.closest(".lh-audit");if(!p)throw new Error(".lh-table not within audit");t.includes(p.id)&&!d&&s.click()}))}_setupElementScreenshotOverlay(e){const t=this.json.audits["full-page-screenshot"]&&this.json.audits["full-page-screenshot"].details&&"full-page-screenshot"===this.json.audits["full-page-screenshot"].details.type&&this.json.audits["full-page-screenshot"].details;t&&S.installOverlayFeature({dom:this._dom,reportEl:e,overlayContainerEl:e,fullPageScreenshot:t})}_getThirdPartyRows(e,t){const n=[],r=a.getRootDomain(t);for(const t of e){if(t.classList.contains("lh-sub-item-row"))continue;const e=t.querySelector("div.lh-text__url");if(!e)continue;const i=e.dataset.url;if(!i)continue;a.getRootDomain(i)!==r&&n.push(t)}return n}_setupStickyHeaderElements(){this.topbarEl=this._dom.find("div.lh-topbar",this._document),this.scoreScaleEl=this._dom.find("div.lh-scorescale",this._document),this.stickyHeaderEl=this._dom.find("div.lh-sticky-header",this._document),this.highlightEl=this._dom.createChildOf(this.stickyHeaderEl,"div","lh-highlighter")}onCopy(e){this._copyAttempt&&e.clipboardData&&(e.preventDefault(),e.clipboardData.setData("text/plain",JSON.stringify(this.json,null,2)),this._fireEventOn("lh-log",this._document,{cmd:"log",msg:"Report JSON copied to clipboard"})),this._copyAttempt=!1}onCopyButtonClick(){this._fireEventOn("lh-analytics",this._document,{cmd:"send",fields:{hitType:"event",eventCategory:"report",eventAction:"copy"}});try{this._document.queryCommandSupported("copy")&&(this._copyAttempt=!0,this._document.execCommand("copy")||(this._copyAttempt=!1,this._fireEventOn("lh-log",this._document,{cmd:"warn",msg:"Your browser does not support copy to clipboard."})))}catch(e){this._copyAttempt=!1,this._fireEventOn("lh-log",this._document,{cmd:"log",msg:e.message})}}_resetUIState(){this._dropDown.close()}onDropDownMenuClick(e){e.preventDefault();const t=e.target;if(t&&t.hasAttribute("data-action")){switch(t.getAttribute("data-action")){case"copy":this.onCopyButtonClick();break;case"print-summary":this.collapseAllDetails(),this._print();break;case"print-expanded":this.expandAllDetails(),this._print();break;case"save-json":{const e=JSON.stringify(this.json,null,2);this._saveFile(new Blob([e],{type:"application/json"}));break}case"save-html":{const t=this.getReportHtml();try{this._saveFile(new Blob([t],{type:"text/html"}))}catch(e){this._fireEventOn("lh-log",this._document,{cmd:"error",msg:"Could not export as HTML. "+e.message})}break}case"open-viewer":if(this._dom.isDevTools())O.openViewer(this.json);else{const e="viewer-"+O.computeWindowNameSuffix(this.json),t=$()+"/viewer/";O.openTabWithUrlData({lhr:this.json},t,e)}break;case"save-gist":this.saveAsGist();break;case"toggle-dark":this._toggleDarkTheme()}this._dropDown.close()}}_print(){self.print()}onKeyUp(e){(e.ctrlKey||e.metaKey)&&80===e.keyCode&&this._dropDown.close()}static computeWindowNameSuffix(e){const t=e.generatedTime,n=e.fetchTime||t;return`${e.lighthouseVersion}-${e.requestedUrl}-${n}`}static openViewer(e){const t="viewer-"+this.computeWindowNameSuffix(e),n=$()+"/viewer/";O.openTabWithUrlData({lhr:e},n,t)}static openTreemap(e){if(!e.audits["script-treemap-data"].details)throw new Error("no script treemap data found");const t={lhr:{requestedUrl:e.requestedUrl,finalUrl:e.finalUrl,audits:{"script-treemap-data":e.audits["script-treemap-data"]},configSettings:{locale:e.configSettings.locale}}},n=$()+"/treemap/",r="treemap-"+this.computeWindowNameSuffix(e);O.openTabWithUrlData(t,n,r)}static openTabAndSendData(e,t,n){const r=new URL(t).origin;window.addEventListener("message",(function t(n){n.origin===r&&i&&n.data.opened&&(i.postMessage(e,r),window.removeEventListener("message",t))}));const i=window.open(t,n)}static async openTabWithUrlData(e,t,n){const r=new URL(t),i=Boolean(window.CompressionStream);r.hash=await H.toBase64(JSON.stringify(e),{gzip:i}),i&&r.searchParams.set("gzip","1"),window.open(r.toString(),n)}expandAllDetails(){this._dom.findAll(".lh-categories details",this._document).map((e=>e.open=!0))}collapseAllDetails(){this._dom.findAll(".lh-categories details",this._document).map((e=>e.open=!1))}_setUpCollapseDetailsAfterPrinting(){"onbeforeprint"in self?self.addEventListener("afterprint",this.collapseAllDetails):self.matchMedia("print").addListener((e=>{e.matches?this.expandAllDetails():this.collapseAllDetails()}))}getReportHtml(){return this._resetUIState(),this._document.documentElement.outerHTML}saveAsGist(){throw new Error("Cannot save as gist from base report")}_saveFile(e){const t=R({finalUrl:this.json.finalUrl,fetchTime:this.json.fetchTime}),n=e.type.match("json")?".json":".html",r=this._dom.createElement("a");r.download=`${t}${n}`,this._dom.safelySetBlobHref(r,e),this._document.body.appendChild(r),r.click(),this._document.body.removeChild(r),setTimeout((e=>URL.revokeObjectURL(r.href)),500)}_toggleDarkTheme(e){const t=this._dom.find(".lh-vars",this._document);void 0===e?t.classList.toggle("dark"):t.classList.toggle("dark",e)}_updateStickyHeaderOnScroll(){const e=this.topbarEl.getBoundingClientRect().bottom>=this.scoreScaleEl.getBoundingClientRect().top,t=Array.from(this._document.querySelectorAll(".lh-category")).filter((e=>e.getBoundingClientRect().top-window.innerHeight/2<0)),n=t.length>0?t.length-1:0,r=this.stickyHeaderEl.querySelectorAll(".lh-gauge__wrapper"),i=r[n],o=r[0].getBoundingClientRect().left,s=i.getBoundingClientRect().left-o;this.highlightEl.style.transform=`translate(${s}px)`,this.stickyHeaderEl.classList.toggle("lh-sticky-header--visible",e)}}class z{constructor(e){this._dom=e,this._toggleEl,this._menuEl,this.onDocumentKeyDown=this.onDocumentKeyDown.bind(this),this.onToggleClick=this.onToggleClick.bind(this),this.onToggleKeydown=this.onToggleKeydown.bind(this),this.onMenuFocusOut=this.onMenuFocusOut.bind(this),this.onMenuKeydown=this.onMenuKeydown.bind(this),this._getNextMenuItem=this._getNextMenuItem.bind(this),this._getNextSelectableNode=this._getNextSelectableNode.bind(this),this._getPreviousMenuItem=this._getPreviousMenuItem.bind(this)}setup(e){this._toggleEl=this._dom.find("button.lh-tools__button",this._dom.document()),this._toggleEl.addEventListener("click",this.onToggleClick),this._toggleEl.addEventListener("keydown",this.onToggleKeydown),this._menuEl=this._dom.find("div.lh-tools__dropdown",this._dom.document()),this._menuEl.addEventListener("keydown",this.onMenuKeydown),this._menuEl.addEventListener("click",e)}close(){this._toggleEl.classList.remove("active"),this._toggleEl.setAttribute("aria-expanded","false"),this._menuEl.contains(this._dom.document().activeElement)&&this._toggleEl.focus(),this._menuEl.removeEventListener("focusout",this.onMenuFocusOut),this._dom.document().removeEventListener("keydown",this.onDocumentKeyDown)}open(e){this._toggleEl.classList.contains("active")?e.focus():this._menuEl.addEventListener("transitionend",(()=>{e.focus()}),{once:!0}),this._toggleEl.classList.add("active"),this._toggleEl.setAttribute("aria-expanded","true"),this._menuEl.addEventListener("focusout",this.onMenuFocusOut),this._dom.document().addEventListener("keydown",this.onDocumentKeyDown)}onToggleClick(e){e.preventDefault(),e.stopImmediatePropagation(),this._toggleEl.classList.contains("active")?this.close():this.open(this._getNextMenuItem())}onToggleKeydown(e){switch(e.code){case"ArrowUp":e.preventDefault(),this.open(this._getPreviousMenuItem());break;case"ArrowDown":case"Enter":case" ":e.preventDefault(),this.open(this._getNextMenuItem())}}onMenuKeydown(e){const t=e.target;switch(e.code){case"ArrowUp":e.preventDefault(),this._getPreviousMenuItem(t).focus();break;case"ArrowDown":e.preventDefault(),this._getNextMenuItem(t).focus();break;case"Home":e.preventDefault(),this._getNextMenuItem().focus();break;case"End":e.preventDefault(),this._getPreviousMenuItem().focus()}}onDocumentKeyDown(e){27===e.keyCode&&this.close()}onMenuFocusOut(e){const t=e.relatedTarget;this._menuEl.contains(t)||this.close()}_getNextSelectableNode(e,t){const n=e.filter((e=>e instanceof HTMLElement&&(!e.hasAttribute("disabled")&&"none"!==window.getComputedStyle(e).display)));let r=t?n.indexOf(t)+1:0;return r>=n.length&&(r=0),n[r]}_getNextMenuItem(e){const t=Array.from(this._menuEl.childNodes);return this._getNextSelectableNode(t,e)}_getPreviousMenuItem(e){const t=Array.from(this._menuEl.childNodes).reverse();return this._getNextSelectableNode(t,e)}}
192
+ /**
193
+ * @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
194
+ * 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
195
+ * 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.
196
+ */window.__initLighthouseReport__=function(){const e=new l(document),t=new F(e),n=e.find("main",document),r=window.__LIGHTHOUSE_JSON__;t.renderReport(r,n),new O(e).initFeatures(r),document.addEventListener("lh-analytics",(e=>{window.ga&&ga(e.detail.cmd,e.detail.fields)})),document.addEventListener("lh-log",(e=>{const t=document.querySelector("#lh-log");if(!t)return;const n=new d(t),r=e.detail;switch(r.cmd){case"log":n.log(r.msg);break;case"warn":n.warn(r.msg);break;case"error":n.error(r.msg);break;case"hide":n.hide()}}))}}();
package/jest.config.js CHANGED
@@ -35,8 +35,4 @@ module.exports = {
35
35
  ],
36
36
  transform: {},
37
37
  prettierPath: null,
38
- projects: [
39
- '<rootDir>',
40
- '<rootDir>/flow-report',
41
- ],
42
38
  };
@@ -108,10 +108,6 @@ function getFlags(manualArgv, options = {}) {
108
108
  default: false,
109
109
  describe: 'Print the normalized config for the given config and options, then exit.',
110
110
  },
111
- 'debug-navigation': {
112
- type: 'boolean',
113
- describe: 'Pause after page load to wait for permission to continue the run, evaluate `continueLighthouseRun` in the console to continue.',
114
- },
115
111
  'fraggle-rock': {
116
112
  type: 'boolean',
117
113
  default: false,
@@ -366,20 +362,16 @@ function coerceOptionalStringBoolean(value) {
366
362
  */
367
363
  function coerceOutput(values) {
368
364
  const outputTypes = ['json', 'html', 'csv'];
369
- const errorHint = `Argument 'output' must be an array from choices "${outputTypes.join('", "')}"`;
365
+ const errorMsg = `Invalid values. Argument 'output' must be an array from choices "${outputTypes.join('", "')}"`;
370
366
  if (!values.every(/** @return {item is string} */ item => typeof item === 'string')) {
371
- throw new Error('Invalid values. ' + errorHint);
367
+ throw new Error(errorMsg);
372
368
  }
373
369
  // Allow parsing of comma-separated values.
374
370
  const strings = values.flatMap(value => value.split(','));
375
- const validValues = strings.filter(/** @return {str is LH.OutputMode} */ str => {
376
- if (!outputTypes.includes(str)) {
377
- throw new Error(`"${str}" is not a valid 'output' value. ` + errorHint);
378
- }
379
- return true;
380
- });
381
-
382
- return validValues;
371
+ if (!strings.every(/** @return {str is LH.OutputMode} */ str => outputTypes.includes(str))) {
372
+ throw new Error(errorMsg);
373
+ }
374
+ return strings;
383
375
  }
384
376
 
385
377
  /**
@@ -16,7 +16,7 @@ const ChromeLauncher = require('chrome-launcher');
16
16
  const yargsParser = require('yargs-parser');
17
17
  const lighthouse = require('../lighthouse-core/index.js');
18
18
  const log = require('lighthouse-logger');
19
- const getFilenamePrefix = require('../report/generator/file-namer.js').getFilenamePrefix;
19
+ const getFilenamePrefix = require('../lighthouse-core/lib/file-namer.js').getFilenamePrefix;
20
20
  const assetSaver = require('../lighthouse-core/lib/asset-saver.js');
21
21
  const URL = require('../lighthouse-core/lib/url-shim.js');
22
22
 
@@ -181,7 +181,7 @@ async function begin() {
181
181
  const invertMatch = argv.invertMatch;
182
182
  const testDefns = getDefinitionsToRun(allTestDefns, requestedTestIds, {invertMatch});
183
183
 
184
- let smokehouseResult;
184
+ let isPassing;
185
185
  let server;
186
186
  let serverForOffline;
187
187
  let takeNetworkRequestUrls = undefined;
@@ -205,19 +205,13 @@ async function begin() {
205
205
  takeNetworkRequestUrls,
206
206
  };
207
207
 
208
- smokehouseResult = (await runSmokehouse(prunedTestDefns, options));
208
+ isPassing = (await runSmokehouse(prunedTestDefns, options)).success;
209
209
  } finally {
210
210
  if (server) await server.close();
211
211
  if (serverForOffline) await serverForOffline.close();
212
212
  }
213
213
 
214
- if (!smokehouseResult.success) {
215
- const failedTestResults = smokehouseResult.testResults.filter(r => r.failed);
216
- const cmd = `yarn smoke ${failedTestResults.map(r => r.id).join(' ')}`;
217
- console.log(`rerun failures: ${cmd}`);
218
- }
219
-
220
- const exitCode = smokehouseResult.success ? 0 : 1;
214
+ const exitCode = isPassing ? 0 : 1;
221
215
  process.exit(exitCode);
222
216
  }
223
217