lighthouse 9.5.0-dev.20230112 → 9.5.0-dev.20230113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/cli-flags.js +5 -1
- package/cli/test/smokehouse/core-tests.js +2 -0
- package/cli/test/smokehouse/report-assert.js +11 -7
- package/core/config/constants.js +1 -0
- package/core/config/default-config.js +0 -1
- package/core/config/filters.js +8 -4
- package/core/gather/gatherers/accessibility.js +15 -1
- package/core/gather/gatherers/full-page-screenshot.js +51 -40
- package/core/gather/gatherers/seo/tap-targets.js +39 -19
- package/core/legacy/config/config.js +8 -10
- package/core/legacy/gather/driver.js +0 -17
- package/core/legacy/gather/gather-runner.js +0 -6
- package/core/runner.js +2 -0
- package/core/util.cjs +30 -0
- package/dist/report/bundle.esm.js +40 -19
- package/dist/report/flow.js +5 -5
- package/dist/report/standalone.js +4 -4
- package/flow-report/src/common.tsx +3 -3
- package/flow-report/src/util.ts +0 -11
- package/flow-report/test/common-test.tsx +4 -7
- package/flow-report/test/summary/summary-test.tsx +1 -1
- package/package.json +1 -1
- package/readme.md +1 -0
- package/report/renderer/details-renderer.js +1 -2
- package/report/renderer/element-screenshot-renderer.js +4 -4
- package/report/renderer/report-renderer.js +3 -7
- package/report/renderer/report-ui-features.js +3 -7
- package/report/renderer/util.js +30 -0
- package/report/test/renderer/util-test.js +20 -0
- package/report/test-assets/faux-psi.js +3 -3
- package/types/artifacts.d.ts +1 -11
- package/types/lhr/audit-details.d.ts +0 -17
- package/types/lhr/lhr.d.ts +13 -0
- package/types/lhr/settings.d.ts +2 -0
- package/types/smokehouse.d.ts +2 -1
- package/core/audits/full-page-screenshot.js +0 -42
package/dist/report/flow.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/const oe="…",re="data:image/jpeg;base64,",se={label:"pass",minScore:.9},le={label:"average",minScore:.5},pe={label:"fail"},ue={label:"error"},ce=["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 de{static i18n=null;static get PASS_THRESHOLD(){return.9}static get MS_DISPLAY_VALUE(){return"%10d ms"}static getFinalDisplayedUrl(e){if(e.finalDisplayedUrl)return e.finalDisplayedUrl;if(e.finalUrl)return e.finalUrl;throw new Error("Could not determine final displayed URL")}static getMainDocumentUrl(e){return e.mainDocumentUrl||e.finalUrl}static prepareReportResult(e){const a=JSON.parse(JSON.stringify(e));a.configSettings.locale||(a.configSettings.locale="en"),a.configSettings.formFactor||(a.configSettings.formFactor=a.configSettings.emulatedFormFactor),a.finalDisplayedUrl=this.getFinalDisplayedUrl(a),a.mainDocumentUrl=this.getMainDocumentUrl(a);for(const e of Object.values(a.audits))if("not_applicable"!==e.scoreDisplayMode&&"not-applicable"!==e.scoreDisplayMode||(e.scoreDisplayMode="notApplicable"),e.details){if(void 0!==e.details.type&&"diagnostic"!==e.details.type||(e.details.type="debugdata"),"filmstrip"===e.details.type)for(const a of e.details.items)a.data.startsWith(re)||(a.data=re+a.data);if("table"===e.details.type)for(const a of e.details.headings){const{itemType:e,text:n}=a;void 0!==e&&(a.valueType=e,delete a.itemType),void 0!==n&&(a.label=n,delete a.text);const t=a.subItemsHeading?.itemType;a.subItemsHeading&&void 0!==t&&(a.subItemsHeading.valueType=t,delete a.subItemsHeading.itemType)}}if("object"!=typeof a.categories)throw new Error("No categories provided.");const n=new Map,[t]=a.lighthouseVersion.split(".").map(Number),i=a.categories.performance;if(t<9&&i){a.categoryGroups||(a.categoryGroups={}),a.categoryGroups.hidden={title:""};for(const e of i.auditRefs)e.group?["load-opportunities","diagnostics"].includes(e.group)&&delete e.group:e.group="hidden"}for(const e of Object.values(a.categories))e.auditRefs.forEach((e=>{e.relevantAudits&&e.relevantAudits.forEach((a=>{const t=n.get(a)||[];t.push(e),n.set(a,t)}))})),e.auditRefs.forEach((e=>{const t=a.audits[e.id];e.result=t,n.has(e.id)&&(e.relevantMetrics=n.get(e.id)),a.stackPacks&&a.stackPacks.forEach((a=>{a.descriptions[e.id]&&(e.stackPacks=e.stackPacks||[],e.stackPacks.push({title:a.title,iconDataURL:a.iconDataURL,description:a.descriptions[e.id]}))}))}));return a}static showAsPassed(e){switch(e.scoreDisplayMode){case"manual":case"notApplicable":return!0;case"error":case"informative":return!1;case"numeric":case"binary":default:return Number(e.score)>=se.minScore}}static calculateRating(e,a){if("manual"===a||"notApplicable"===a)return se.label;if("error"===a)return ue.label;if(null===e)return pe.label;let n=pe.label;return e>=se.minScore?n=se.label:e>=le.minScore&&(n=le.label),n}static splitMarkdownCodeSpans(e){const a=[],n=e.split(/`(.*?)`/g);for(let e=0;e<n.length;e++){const t=n[e];if(!t)continue;const i=e%2!=0;a.push({isCode:i,text:t})}return a}static splitMarkdownLink(e){const a=[],n=e.split(/\[([^\]]+?)\]\((https?:\/\/.*?)\)/g);for(;n.length;){const[e,t,i]=n.splice(0,3);e&&a.push({isLink:!1,text:e}),t&&i&&a.push({isLink:!0,text:t,linkHref:i})}return a}static getURLDisplayName(e,a){const n=void 0!==(a=a||{numPathParts:void 0,preserveQuery:void 0,preserveHost:void 0}).numPathParts?a.numPathParts:2,t=void 0===a.preserveQuery||a.preserveQuery,i=a.preserveHost||!1;let o;if("about:"===e.protocol||"data:"===e.protocol)o=e.href;else{o=e.pathname;const a=o.split("/").filter((e=>e.length));n&&a.length>n&&(o=oe+a.slice(-1*n).join("/")),i&&(o=`${e.host}/${o.replace(/^\//,"")}`),t&&(o=`${o}${e.search}`)}if("data:"!==e.protocol&&(o=o.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g,"$1…"),o=o.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,"$1…"),o=o.replace(/(\d{3})\d{6,}/g,"$1…"),o=o.replace(/\u2026+/g,oe),o.length>64&&o.includes("?")&&(o=o.replace(/\?([^=]*)(=)?.*/,"?$1$2…"),o.length>64&&(o=o.replace(/\?.*/,"?…")))),o.length>64){const e=o.lastIndexOf(".");o=e>=0?o.slice(0,63-(o.length-e))+`…${o.slice(e)}`:o.slice(0,63)+oe}return o}static parseURL(e){const a=new URL(e);return{file:de.getURLDisplayName(a),hostname:a.hostname,origin:a.origin}}static createOrReturnURL(e){return e instanceof URL?e:new URL(e)}static getTld(e){const a=e.split(".").slice(-2);return ce.includes(a[0])?`.${a.join(".")}`:`.${a[a.length-1]}`}static getRootDomain(e){const a=de.createOrReturnURL(e).hostname,n=de.getTld(a).split(".");return a.split(".").slice(-n.length).join(".")}static getEmulationDescriptions(e){let a,n,t;const i=e.throttling;switch(e.throttlingMethod){case"provided":t=n=a=de.i18n.strings.throttlingProvided;break;case"devtools":{const{cpuSlowdownMultiplier:e,requestLatencyMs:o}=i;a=`${de.i18n.formatNumber(e)}x slowdown (DevTools)`,n=`${de.i18n.formatMilliseconds(o)} HTTP RTT, ${de.i18n.formatKbps(i.downloadThroughputKbps)} down, ${de.i18n.formatKbps(i.uploadThroughputKbps)} up (DevTools)`;t=(()=>562.5===o&&i.downloadThroughputKbps===1638.4*.9&&675===i.uploadThroughputKbps)()?de.i18n.strings.runtimeSlow4g:de.i18n.strings.runtimeCustom;break}case"simulate":{const{cpuSlowdownMultiplier:e,rttMs:o,throughputKbps:r}=i;a=`${de.i18n.formatNumber(e)}x slowdown (Simulated)`,n=`${de.i18n.formatMilliseconds(o)} TCP RTT, ${de.i18n.formatKbps(r)} throughput (Simulated)`;t=(()=>150===o&&1638.4===r)()?de.i18n.strings.runtimeSlow4g:de.i18n.strings.runtimeCustom;break}default:t=a=n=de.i18n.strings.runtimeUnknown}const o="devtools"!==e.channel&&e.screenEmulation.disabled,r="devtools"===e.channel?"mobile"===e.formFactor:e.screenEmulation.mobile;let s=de.i18n.strings.runtimeMobileEmulation;o?s=de.i18n.strings.runtimeNoEmulation:r||(s=de.i18n.strings.runtimeDesktopEmulation);return{deviceEmulation:s,screenEmulation:o?void 0:`${e.screenEmulation.width}x${e.screenEmulation.height}, DPR ${e.screenEmulation.deviceScaleFactor}`,cpuThrottling:a,networkThrottling:n,summary:t}}static filterRelevantLines(e,a,n){if(0===a.length)return e.slice(0,2*n+1);const t=new Set;return(a=a.sort(((e,a)=>(e.lineNumber||0)-(a.lineNumber||0)))).forEach((({lineNumber:e})=>{let a=e-n,i=e+n;for(;a<1;)a++,i++;t.has(a-3-1)&&(a-=3);for(let e=a;e<=i;e++){const a=e;t.add(a)}})),e.filter((e=>t.has(e.lineNumber)))}static isPluginCategory(e){return e.startsWith("lighthouse-plugin-")}static shouldDisplayAsFraction(e){return"timespan"===e||"snapshot"===e}static calculateCategoryFraction(e){let a=0,n=0,t=0,i=0;for(const o of e.auditRefs){const e=de.showAsPassed(o.result);"hidden"!==o.group&&"manual"!==o.result.scoreDisplayMode&&"notApplicable"!==o.result.scoreDisplayMode&&("informative"!==o.result.scoreDisplayMode?(++a,i+=o.weight,e&&n++):e||++t)}return{numPassed:n,numPassableAudits:a,numInformative:t,totalWeight:i}}}de.reportJson=null;let me=0;de.getUniqueSuffix=()=>me++,de.resetUniqueSuffix=()=>{me=0};de.UIStrings={varianceDisclaimer:"Values are estimated and may vary. The [performance score is calculated](https://developer.chrome.com/docs/lighthouse/performance/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",viewTraceLabel:"View Trace",viewOriginalTraceLabel:"View Original Trace",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",runtimeSettingsDevice:"Device",runtimeSettingsNetworkThrottling:"Network throttling",runtimeSettingsCPUThrottling:"CPU throttling",runtimeSettingsUANetwork:"User agent (network)",runtimeSettingsBenchmark:"CPU/Memory Power",runtimeSettingsAxeVersion:"Axe version",runtimeSettingsScreenEmulation:"Screen emulation",footerIssue:"File an issue",runtimeNoEmulation:"No emulation",runtimeMobileEmulation:"Emulated Moto G4",runtimeDesktopEmulation:"Emulated Desktop",runtimeUnknown:"Unknown",runtimeSingleLoad:"Single page load",runtimeAnalysisWindow:"Initial page load",runtimeSingleLoadTooltip:"This data is taken from a single page load, as opposed to field data summarizing many sessions.",throttlingProvided:"Provided by environment",show:"Show",hide:"Hide",expandView:"Expand view",collapseView:"Collapse view",runtimeSlow4g:"Slow 4G throttling",runtimeCustom:"Custom throttling"};const he=()=>R("svg",{width:"14",viewBox:"0 0 18 16",fill:"none",role:"img",children:R("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0 2C0 1.17 0.67 0.5 1.5 0.5C2.33 0.5 3 1.17 3 2C3 2.83 2.33 3.5 1.5 3.5C0.67 3.5 0 2.83 0 2ZM0 8C0 7.17 0.67 6.5 1.5 6.5C2.33 6.5 3 7.17 3 8C3 8.83 2.33 9.5 1.5 9.5C0.67 9.5 0 8.83 0 8ZM1.5 12.5C0.67 12.5 0 13.18 0 14C0 14.82 0.68 15.5 1.5 15.5C2.32 15.5 3 14.82 3 14C3 13.18 2.33 12.5 1.5 12.5ZM18 15H5V13H18V15ZM5 9H18V7H5V9ZM5 3V1H18V3H5Z",fill:"currentColor"})}),ge=()=>R("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a navigation report",children:R("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor","stroke-width":"2"})}),ve=()=>R("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a timespan report",children:[R("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor","stroke-width":"2"}),R("path",{d:"m 8,4 v 4 l 4,1.9999998",stroke:"currentColor","stroke-width":"1.5"})]}),fe=()=>R("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a snapshot report",children:R("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M 12.2038,12.2812 C 11.1212,13.3443 9.6372,14 8,14 7.81038,14 7.62281,13.9912 7.43768,13.974 L 10.3094,9 Z M 12.8925,11.4741 10.0207,6.5 H 13.811 C 13.9344,6.97943 14,7.48205 14,8 c 0,1.2947 -0.4101,2.4937 -1.1075,3.4741 z M 13.456,5.5 H 7.71135 L 9.6065,2.21749 C 11.3203,2.69259 12.7258,3.90911 13.456,5.5 Z M 8.5624,2.02601 C 8.3772,2.0088 8.1896,2 8,2 6.36282,2 4.8788,2.65572 3.79622,3.71885 L 5.69061,7.00002 Z M 3.10749,4.52594 C 2.4101,5.5063 2,6.70526 2,8 2,8.5179 2.06563,9.0206 2.18903,9.5 H 5.97927 Z M 2.54404,10.5 c 0.73017,1.5909 2.1357,2.8074 3.84949,3.2825 L 8.2887,10.5 Z M 16,8 c 0,4.4183 -3.5817,8 -8,8 C 3.58172,16 0,12.4183 0,8 0,3.58172 3.58172,0 8,0 c 4.4183,0 8,3.58172 8,8 z",fill:"currentColor"})}),be=()=>R("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"currentColor",role:"img","aria-label":"Icon representing a close action",children:[R("path",{d:"M0 0h24v24H0V0z",fill:"none"}),R("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})]}),ye=()=>R("svg",{width:"15",height:"12",viewBox:"0 0 15 12",fill:"none",role:"img",children:R("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.33317 2.00008H13.9998V0.666748H3.33317C2.59984 0.666748 1.99984 1.26675 1.99984 2.00008V9.33341H0.666504V11.3334H7.99984V9.33341H3.33317V2.00008ZM13.9998 3.33341H9.99984C9.63317 3.33341 9.33317 3.63341 9.33317 4.00008V10.6667C9.33317 11.0334 9.63317 11.3334 9.99984 11.3334H13.9998C14.3665 11.3334 14.6665 11.0334 14.6665 10.6667V4.00008C14.6665 3.63341 14.3665 3.33341 13.9998 3.33341ZM10.6665 9.33341H13.3332V4.66675H10.6665V9.33341Z",fill:"currentColor"})}),_e=()=>R("svg",{width:"16",height:"11",viewBox:"0 0 16 11",fill:"none",role:"img",children:R("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.666687 3.26663L2.00002 4.59997C3.92002 2.67997 6.52669 1.87997 9.02002 2.18663L9.81335 0.399966C6.59335 -0.173367 3.16002 0.779966 0.666687 3.26663ZM10.6 0.599966C10.4867 0.599966 10.3867 0.659966 10.3267 0.753299L10.28 0.853299L6.82669 8.61996C6.72002 8.8133 6.65335 9.02663 6.65335 9.25996C6.65335 9.99996 7.25335 10.6 7.99335 10.6C8.63335 10.6 9.17335 10.1466 9.30002 9.53996L9.30669 9.51997L10.9334 0.933299C10.9334 0.746633 10.7867 0.599966 10.6 0.599966ZM15.3334 3.26663L14 4.59997C13.1867 3.78663 12.2534 3.17997 11.2534 2.76663L11.6067 0.886633C12.9667 1.38663 14.24 2.1733 15.3334 3.26663ZM11.3334 7.26663L12.6667 5.9333C12.1334 5.39997 11.5334 4.98663 10.8934 4.6733L10.5267 6.61997C10.8067 6.79997 11.08 7.0133 11.3334 7.26663ZM4.66669 7.26663L3.33335 5.9333C4.67335 4.5933 6.45335 3.95997 8.20669 4.0133L7.35335 5.9333C6.37335 6.0733 5.42002 6.5133 4.66669 7.26663Z",fill:"currentColor"})}),Ce=()=>R("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img",children:R("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.5 7.16667V5.5H13.8333V3.83333C13.8333 2.91667 13.0833 2.16667 12.1667 2.16667H10.5V0.5H8.83333V2.16667H7.16667V0.5H5.5V2.16667H3.83333C2.91667 2.16667 2.16667 2.91667 2.16667 3.83333V5.5H0.5V7.16667H2.16667V8.83333H0.5V10.5H2.16667V12.1667C2.16667 13.0833 2.91667 13.8333 3.83333 13.8333H5.5V15.5H7.16667V13.8333H8.83333V15.5H10.5V13.8333H12.1667C13.0833 13.8333 13.8333 13.0833 13.8333 12.1667V10.5H15.5V8.83333H13.8333V7.16667H15.5ZM10.5 5.5H5.5V10.5H10.5V5.5ZM3.83333 12.1667H12.1667V3.83333H3.83333V12.1667Z",fill:"currentColor"})}),we=()=>R("svg",{viewBox:"0 0 18 12",width:"18",height:"12",role:"img",children:[R("rect",{width:"18",height:"2",fill:"currentColor"}),R("rect",{y:"5",width:"18",height:"2",fill:"currentColor"}),R("rect",{y:"10",width:"18",height:"2",fill:"currentColor"})]}),ke=()=>R("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:R("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13 7C13 10.3137 10.3137 13 7 13C3.68629 13 1 10.3137 1 7C1 3.68629 3.68629 1 7 1C10.3137 1 13 3.68629 13 7ZM14 7C14 10.866 10.866 14 7 14C3.13401 14 0 10.866 0 7C0 3.13401 3.13401 0 7 0C10.866 0 14 3.13401 14 7ZM7.66658 11H6.33325V9.66667H7.66658V11ZM4.33325 5.66667C4.33325 4.19333 5.52659 3 6.99992 3C8.47325 3 9.66658 4.19333 9.66658 5.66667C9.66658 6.52194 9.1399 6.98221 8.62709 7.43036C8.1406 7.85551 7.66658 8.26975 7.66658 9H6.33325C6.33325 7.78582 6.96133 7.30439 7.51355 6.88112C7.94674 6.54907 8.33325 6.25281 8.33325 5.66667C8.33325 4.93333 7.73325 4.33333 6.99992 4.33333C6.26658 4.33333 5.66658 4.93333 5.66658 5.66667H4.33325Z",fill:"currentColor"})}),Ae=T(void 0),Se=T({});function Pe(e){return new URLSearchParams(location.hash.replace("#","?")).get(e)}function Ue(...e){const a=[];for(const n of e){if(!n)continue;if("string"==typeof n){a.push(n);continue}const e=Object.entries(n).filter((([e,a])=>a)).map((([e])=>e));a.push(...e)}return a.join(" ")}function xe(e,a){switch(e){case"navigation":return a.navigationDescription;case"timespan":return a.timespanDescription;case"snapshot":return a.snapshotDescription}}function Le(){const e=X(Ae);if(!e)throw Error("useFlowResult must be called in the FlowResultContext");return e}function ze(){const e=Le(),[a,n]=function(...e){const[a,n]=J(e.map(Pe));return q((()=>{function t(){const t=e.map(Pe);t.every(((e,n)=>e===a[n]))||n(t)}return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}),[a]),a}("index","anchor");return Y((()=>{if(!a)return null;const t=Number(a);if(!Number.isFinite(t))return console.warn(`Invalid hash index: ${a}`),null;const i=e.steps[t];return i?{currentLhr:i.lhr,index:t,anchor:n}:(console.warn(`No flow step at index ${t}`),null)}),[a,e,n])}function Ne(e,a){const n=Z(null);return K((()=>{if(!n.current)return;const a=e();return n.current.append(a),()=>{n.current?.contains(a)&&n.current.removeChild(a)}}),a),n}const Ie=()=>R("div",{className:"Separator",role:"separator"}),Te=({mode:e})=>R(h,{children:["navigation"===e&&R(ge,{}),"timespan"===e&&R(ve,{}),"snapshot"===e&&R(fe,{})]}),De=({mode:e})=>R("div",{className:"FlowSegment",children:[R("div",{className:"FlowSegment__top-line"}),e&&R(Te,{mode:e}),R("div",{className:"FlowSegment__bottom-line"})]}),Re=({frames:e,width:a,height:n})=>{const[t,i]=J(0),o=t%e.length;return q((()=>{const a=setInterval((()=>i((a=>(a+1)%e.length))),500);return()=>clearInterval(a)}),[e.length]),R("img",{className:"FlowStepThumbnail","data-testid":"FlowStepAnimatedThumbnail",src:e[o].data,style:{width:a,height:n},alt:"Animated screenshots of a page tested by Lighthouse"})},Ee=({lhr:e,width:a,height:n})=>{const t=function(e){const a=e.audits["full-page-screenshot"];return a?.details&&"full-page-screenshot"===a.details.type&&a.details||null}(e),i=function(e){const a=e.audits["screenshot-thumbnails"];if(!a)return;return a.details&&"filmstrip"===a.details.type&&a.details.items||void 0}(e),o=function(e){const{width:a,height:n}=e.configSettings.screenEmulation;return{width:a,height:n}}(e);if(a&&void 0===n?n=o.height*a/o.width:n&&void 0===a&&(a=o.width*n/o.height),!a||!n)return console.warn(new Error("FlowStepThumbnail requested without any dimensions").stack),R(h,{});let r;if(i?.length){if(r=i[i.length-1].data,"timespan"===e.gatherMode)return R(Re,{frames:i,width:a,height:n})}else r=t?.screenshot.data;return R(h,{children:r&&R("img",{className:"FlowStepThumbnail",src:r,style:{width:a,height:n},alt:"Screenshot of a page tested by Lighthouse"})})};var je,Me=function(){function e(a,n,t,i){this.message=a,this.expected=n,this.found=t,this.location=i,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,a){function n(){this.constructor=e}n.prototype=a.prototype,e.prototype=new n}(e,Error),e.buildMessage=function(e,a){var n={literal:function(e){return'"'+i(e.text)+'"'},class:function(e){var a,n="";for(a=0;a<e.parts.length;a++)n+=e.parts[a]instanceof Array?o(e.parts[a][0])+"-"+o(e.parts[a][1]):o(e.parts[a]);return"["+(e.inverted?"^":"")+n+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function t(e){return e.charCodeAt(0).toString(16).toUpperCase()}function i(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+t(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+t(e)}))}function o(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+t(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+t(e)}))}return"Expected "+function(e){var a,t,i,o=new Array(e.length);for(a=0;a<e.length;a++)o[a]=(i=e[a],n[i.type](i));if(o.sort(),o.length>0){for(a=1,t=1;a<o.length;a++)o[a-1]!==o[a]&&(o[t]=o[a],t++);o.length=t}switch(o.length){case 1:return o[0];case 2:return o[0]+" or "+o[1];default:return o.slice(0,-1).join(", ")+", or "+o[o.length-1]}}(e)+" but "+function(e){return e?'"'+i(e)+'"':"end of input"}(a)+" found."},{SyntaxError:e,parse:function(a,n){n=void 0!==n?n:{};var t,i={},o={start:pe},r=pe,s=function(e){return e.join("")},l=te("{",!1),p=",",u=te(",",!1),c=te("}",!1),d="number",m=te("number",!1),h="date",g=te("date",!1),v="time",f=te("time",!1),b="plural",y=te("plural",!1),_="selectordinal",C=te("selectordinal",!1),w="select",k=te("select",!1),A=te("=",!1),S="offset:",P=te("offset:",!1),U=oe("whitespace"),x=/^[ \t\n\r]/,L=ie([" ","\t","\n","\r"],!1,!1),z=oe("optionalWhitespace"),N=/^[0-9]/,I=ie([["0","9"]],!1,!1),T=/^[0-9a-f]/i,D=ie([["0","9"],["a","f"]],!1,!0),R=te("0",!1),E=/^[1-9]/,j=ie([["1","9"]],!1,!1),M="'",F=te("'",!1),B=/^[ \t\n\r,.+={}#]/,H=ie([" ","\t","\n","\r",",",".","+","=","{","}","#"],!1,!1),O={type:"any"},W=/^[^{}\\\0-\x1F\x7F \t\n\r]/,G=ie(["{","}","\\",["\0",""],""," ","\t","\n","\r"],!0,!1),V=te("\\\\",!1),$=te("\\#",!1),J=te("\\{",!1),q=te("\\}",!1),K=te("\\u",!1),Z=0,Y=0,X=[{line:1,column:1}],Q=0,ee=[],ae=0;if("startRule"in n){if(!(n.startRule in o))throw new Error("Can't start parsing from rule \""+n.startRule+'".');r=o[n.startRule]}function ne(){return se(Y,Z)}function te(e,a){return{type:"literal",text:e,ignoreCase:a}}function ie(e,a,n){return{type:"class",parts:e,inverted:a,ignoreCase:n}}function oe(e){return{type:"other",description:e}}function re(e){var n,t=X[e];if(t)return t;for(n=e-1;!X[n];)n--;for(t={line:(t=X[n]).line,column:t.column};n<e;)10===a.charCodeAt(n)?(t.line++,t.column=1):t.column++,n++;return X[e]=t,t}function se(e,a){var n=re(e),t=re(a);return{start:{offset:e,line:n.line,column:n.column},end:{offset:a,line:t.line,column:t.column}}}function le(e){Z<Q||(Z>Q&&(Q=Z,ee=[]),ee.push(e))}function pe(){return ue()}function ue(){var e,a,n;for(e=Z,a=[],n=ce();n!==i;)a.push(n),n=ce();return a!==i&&(Y=e,a={type:"messageFormatPattern",elements:a,location:ne()}),e=a}function ce(){var e;return(e=function(){var e,n;e=Z,(n=function(){var e,n,t,o,r,s;e=Z,n=[],t=Z,(o=ge())!==i&&(r=we())!==i&&(s=ge())!==i?t=o=[o,r,s]:(Z=t,t=i);if(t!==i)for(;t!==i;)n.push(t),t=Z,(o=ge())!==i&&(r=we())!==i&&(s=ge())!==i?t=o=[o,r,s]:(Z=t,t=i);else n=i;n!==i&&(Y=e,n=n.reduce((function(e,a){return e.concat(a)}),[]).join(""));(e=n)===i&&(e=Z,e=(n=he())!==i?a.substring(e,Z):n);return e}())!==i&&(Y=e,n={type:"messageTextElement",value:n,location:ne()});return e=n}())===i&&(e=function(){var e,n,t,o,r,A,S;e=Z,123===a.charCodeAt(Z)?(n="{",Z++):(n=i,0===ae&&le(l));n!==i&&ge()!==i&&(t=function(){var e,a,n;if((e=be())===i){for(e=Z,a=[],n=ye();n!==i;)a.push(n),n=ye();a!==i&&(Y=e,a=s(a)),e=a}return e}())!==i&&ge()!==i?(o=Z,44===a.charCodeAt(Z)?(r=p,Z++):(r=i,0===ae&&le(u)),r!==i&&(A=ge())!==i&&(S=function(){var e;(e=function(){var e,n,t,o,r,s;e=Z,a.substr(Z,6)===d?(n=d,Z+=6):(n=i,0===ae&&le(m));n===i&&(a.substr(Z,4)===h?(n=h,Z+=4):(n=i,0===ae&&le(g)),n===i&&(a.substr(Z,4)===v?(n=v,Z+=4):(n=i,0===ae&&le(f))));n!==i&&ge()!==i?(t=Z,44===a.charCodeAt(Z)?(o=p,Z++):(o=i,0===ae&&le(u)),o!==i&&(r=ge())!==i&&(s=we())!==i?t=o=[o,r,s]:(Z=t,t=i),t===i&&(t=null),t!==i?(Y=e,e=n={type:n+"Format",style:(l=t)&&l[2],location:ne()}):(Z=e,e=i)):(Z=e,e=i);var l;return e}())===i&&(e=function(){var e,n,t,o;e=Z,a.substr(Z,6)===b?(n=b,Z+=6):(n=i,0===ae&&le(y));n!==i&&ge()!==i?(44===a.charCodeAt(Z)?(t=p,Z++):(t=i,0===ae&&le(u)),t!==i&&ge()!==i&&(o=me())!==i?(Y=e,e=n={type:(r=o).type,ordinal:!1,offset:r.offset||0,options:r.options,location:ne()}):(Z=e,e=i)):(Z=e,e=i);var r;return e}())===i&&(e=function(){var e,n,t,o;e=Z,a.substr(Z,13)===_?(n=_,Z+=13):(n=i,0===ae&&le(C));n!==i&&ge()!==i?(44===a.charCodeAt(Z)?(t=p,Z++):(t=i,0===ae&&le(u)),t!==i&&ge()!==i&&(o=me())!==i?(Y=e,e=n={type:(r=o).type,ordinal:!0,offset:r.offset||0,options:r.options,location:ne()}):(Z=e,e=i)):(Z=e,e=i);var r;return e}())===i&&(e=function(){var e,n,t,o,r;e=Z,a.substr(Z,6)===w?(n=w,Z+=6):(n=i,0===ae&&le(k));if(n!==i)if(ge()!==i)if(44===a.charCodeAt(Z)?(t=p,Z++):(t=i,0===ae&&le(u)),t!==i)if(ge()!==i){if(o=[],(r=de())!==i)for(;r!==i;)o.push(r),r=de();else o=i;o!==i?(Y=e,e=n=function(e){return{type:"selectFormat",options:e,location:ne()}}(o)):(Z=e,e=i)}else Z=e,e=i;else Z=e,e=i;else Z=e,e=i;else Z=e,e=i;return e}());return e}())!==i?o=r=[r,A,S]:(Z=o,o=i),o===i&&(o=null),o!==i&&(r=ge())!==i?(125===a.charCodeAt(Z)?(A="}",Z++):(A=i,0===ae&&le(c)),A!==i?(Y=e,e=n={type:"argumentElement",id:t,format:(P=o)&&P[2],location:ne()}):(Z=e,e=i)):(Z=e,e=i)):(Z=e,e=i);var P;return e}()),e}function de(){var e,n,t,o,r;return e=Z,ge()!==i&&(n=function(){var e,n,t,o;return e=Z,n=Z,61===a.charCodeAt(Z)?(t="=",Z++):(t=i,0===ae&&le(A)),t!==i&&(o=be())!==i?n=t=[t,o]:(Z=n,n=i),(e=n!==i?a.substring(e,Z):n)===i&&(e=we()),e}())!==i&&ge()!==i?(123===a.charCodeAt(Z)?(t="{",Z++):(t=i,0===ae&&le(l)),t!==i&&(o=ue())!==i?(125===a.charCodeAt(Z)?(r="}",Z++):(r=i,0===ae&&le(c)),r!==i?(Y=e,e={type:"optionalFormatPattern",selector:n,value:o,location:ne()}):(Z=e,e=i)):(Z=e,e=i)):(Z=e,e=i),e}function me(){var e,n,t,o;if(e=Z,(n=function(){var e,n,t;return e=Z,a.substr(Z,7)===S?(n=S,Z+=7):(n=i,0===ae&&le(P)),n!==i&&ge()!==i&&(t=be())!==i?(Y=e,e=n=t):(Z=e,e=i),e}())===i&&(n=null),n!==i)if(ge()!==i){if(t=[],(o=de())!==i)for(;o!==i;)t.push(o),o=de();else t=i;t!==i?(Y=e,e=n=function(e,a){return{type:"pluralFormat",offset:e,options:a,location:ne()}}(n,t)):(Z=e,e=i)}else Z=e,e=i;else Z=e,e=i;return e}function he(){var e,n;if(ae++,e=[],x.test(a.charAt(Z))?(n=a.charAt(Z),Z++):(n=i,0===ae&&le(L)),n!==i)for(;n!==i;)e.push(n),x.test(a.charAt(Z))?(n=a.charAt(Z),Z++):(n=i,0===ae&&le(L));else e=i;return ae--,e===i&&(n=i,0===ae&&le(U)),e}function ge(){var e,n,t;for(ae++,e=Z,n=[],t=he();t!==i;)n.push(t),t=he();return e=n!==i?a.substring(e,Z):n,ae--,e===i&&(n=i,0===ae&&le(z)),e}function ve(){var e;return N.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(I)),e}function fe(){var e;return T.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(D)),e}function be(){var e,n,t,o,r,s;if(e=Z,48===a.charCodeAt(Z)?(n="0",Z++):(n=i,0===ae&&le(R)),n===i){if(n=Z,t=Z,E.test(a.charAt(Z))?(o=a.charAt(Z),Z++):(o=i,0===ae&&le(j)),o!==i){for(r=[],s=ve();s!==i;)r.push(s),s=ve();r!==i?t=o=[o,r]:(Z=t,t=i)}else Z=t,t=i;n=t!==i?a.substring(n,Z):t}return n!==i&&(Y=e,n=parseInt(n,10)),e=n}function ye(){var e,n,t;return e=Z,n=Z,ae++,39===a.charCodeAt(Z)?(t=M,Z++):(t=i,0===ae&&le(F)),t===i&&(B.test(a.charAt(Z))?(t=a.charAt(Z),Z++):(t=i,0===ae&&le(H))),ae--,t===i?n=void 0:(Z=n,n=i),n!==i?(a.length>Z?(t=a.charAt(Z),Z++):(t=i,0===ae&&le(O)),t!==i?(Y=e,e=n=t):(Z=e,e=i)):(Z=e,e=i),e===i&&(e=Z,39===a.charCodeAt(Z)?(n=M,Z++):(n=i,0===ae&&le(F)),n!==i&&(t=function(){var e;B.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(H));e===i&&(e=_e());return e}())!==i?(Y=e,e=n=t):(Z=e,e=i)),e}function _e(){var e;return 39===a.charCodeAt(Z)?(e=M,Z++):(e=i,0===ae&&le(F)),e}function Ce(){var e,n,t,o,r,s,l,p,u;return e=Z,39===a.charCodeAt(Z)?(n=M,Z++):(n=i,0===ae&&le(F)),n!==i&&(t=_e())!==i?(Y=e,e=n=t):(Z=e,e=i),e===i&&(W.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(G)),e===i&&(e=Z,"\\\\"===a.substr(Z,2)?(n="\\\\",Z+=2):(n=i,0===ae&&le(V)),n!==i&&(Y=e,n="\\"),(e=n)===i&&(e=Z,"\\#"===a.substr(Z,2)?(n="\\#",Z+=2):(n=i,0===ae&&le($)),n!==i&&(Y=e,n="\\#"),(e=n)===i&&(e=Z,"\\{"===a.substr(Z,2)?(n="\\{",Z+=2):(n=i,0===ae&&le(J)),n!==i&&(Y=e,n="{"),(e=n)===i&&(e=Z,"\\}"===a.substr(Z,2)?(n="\\}",Z+=2):(n=i,0===ae&&le(q)),n!==i&&(Y=e,n="}"),(e=n)===i&&(e=Z,"\\u"===a.substr(Z,2)?(n="\\u",Z+=2):(n=i,0===ae&&le(K)),n!==i?(t=Z,o=Z,(r=fe())!==i&&(s=fe())!==i&&(l=fe())!==i&&(p=fe())!==i?o=r=[r,s,l,p]:(Z=o,o=i),(t=o!==i?a.substring(t,Z):o)!==i?(Y=e,u=t,e=n=String.fromCharCode(parseInt(u,16))):(Z=e,e=i)):(Z=e,e=i))))))),e}function we(){var e,a,n;if(e=Z,a=[],(n=Ce())!==i)for(;n!==i;)a.push(n),n=Ce();else a=i;return a!==i&&(Y=e,a=s(a)),e=a}if((t=r())!==i&&Z===a.length)return t;throw t!==i&&Z<a.length&&le({type:"end"}),function(a,n,t){return new e(e.buildMessage(a,n),a,n,t)}(ee,Q<a.length?a.charAt(Q):null,Q<a.length?se(Q,Q+1):se(Q,Q))}}}(),Fe=(je=function(e,a){return(je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var n in a)a.hasOwnProperty(n)&&(e[n]=a[n])})(e,a)},function(e,a){function n(){this.constructor=e}je(e,a),e.prototype=null===a?Object.create(a):(n.prototype=a.prototype,new n)}),Be=function(){function e(e,a,n){this.locales=[],this.formats={number:{},date:{},time:{}},this.pluralNumberFormat=null,this.currentPlural=null,this.pluralStack=[],this.locales=e,this.formats=a,this.formatters=n}return e.prototype.compile=function(e){return this.pluralStack=[],this.currentPlural=null,this.pluralNumberFormat=null,this.compileMessage(e)},e.prototype.compileMessage=function(e){var a=this;if(!e||"messageFormatPattern"!==e.type)throw new Error('Message AST is not of type: "messageFormatPattern"');var n=e.elements,t=n.filter((function(e){return"messageTextElement"===e.type||"argumentElement"===e.type})).map((function(e){return"messageTextElement"===e.type?a.compileMessageText(e):a.compileArgument(e)}));if(t.length!==n.length)throw new Error("Message element does not have a valid type");return t},e.prototype.compileMessageText=function(e){return this.currentPlural&&/(^|[^\\])#/g.test(e.value)?(this.pluralNumberFormat||(this.pluralNumberFormat=new Intl.NumberFormat(this.locales)),new Ge(this.currentPlural.id,this.currentPlural.format.offset,this.pluralNumberFormat,e.value)):e.value.replace(/\\#/g,"#")},e.prototype.compileArgument=function(e){var a=e.format,n=e.id,t=this.formatters;if(!a)return new Oe(n);var i=this.formats,o=this.locales;switch(a.type){case"numberFormat":return{id:n,format:t.getNumberFormat(o,i.number[a.style]).format};case"dateFormat":return{id:n,format:t.getDateTimeFormat(o,i.date[a.style]).format};case"timeFormat":return{id:n,format:t.getDateTimeFormat(o,i.time[a.style]).format};case"pluralFormat":return new We(n,a.offset,this.compileOptions(e),t.getPluralRules(o,{type:a.ordinal?"ordinal":"cardinal"}));case"selectFormat":return new Ve(n,this.compileOptions(e));default:throw new Error("Message element does not have a valid format type")}},e.prototype.compileOptions=function(e){var a=this,n=e.format,t=n.options;this.pluralStack.push(this.currentPlural),this.currentPlural="pluralFormat"===n.type?e:null;var i=t.reduce((function(e,n){return e[n.selector]=a.compileMessage(n.value),e}),{});return this.currentPlural=this.pluralStack.pop(),i},e}(),He=function(e){this.id=e},Oe=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return Fe(a,e),a.prototype.format=function(e){return e||"number"==typeof e?"string"==typeof e?e:String(e):""},a}(He),We=function(){function e(e,a,n,t){this.id=e,this.offset=a,this.options=n,this.pluralRules=t}return e.prototype.getOption=function(e){var a=this.options;return a["="+e]||a[this.pluralRules.select(e-this.offset)]||a.other},e}(),Ge=function(e){function a(a,n,t,i){var o=e.call(this,a)||this;return o.offset=n,o.numberFormat=t,o.string=i,o}return Fe(a,e),a.prototype.format=function(e){var a=this.numberFormat.format(e-this.offset);return this.string.replace(/(^|[^\\])#/g,"$1"+a).replace(/\\#/g,"#")},a}(He),Ve=function(){function e(e,a){this.id=e,this.options=a}return e.prototype.getOption=function(e){var a=this.options;return a[e]||a.other},e}();function $e(e){return!!e.options}var Je=function(){var e=function(a,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var n in a)a.hasOwnProperty(n)&&(e[n]=a[n])})(a,n)};return function(a,n){function t(){this.constructor=a}e(a,n),a.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}}(),qe=function(){return(qe=Object.assign||function(e){for(var a,n=1,t=arguments.length;n<t;n++)for(var i in a=arguments[n])Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i]);return e}).apply(this,arguments)};function Ke(e){"string"==typeof e&&(e=[e]);try{return Intl.NumberFormat.supportedLocalesOf(e,{localeMatcher:"best fit"})[0]}catch(e){return Qe.defaultLocale}}function Ze(e,a){for(var n="",t=0,i=e;t<i.length;t++){var o=i[t];if("string"!=typeof o){var r=o.id;if(!a||!(r in a))throw new Xe("A value must be provided for: "+r,r);var s=a[r];$e(o)?n+=Ze(o.getOption(s),a):n+=o.format(s)}else n+=o}return n}function Ye(e,a){return a?Object.keys(e).reduce((function(n,t){var i,o;return n[t]=(i=e[t],(o=a[t])?qe({},i||{},o||{},Object.keys(i).reduce((function(e,a){return e[a]=qe({},i[a],o[a]||{}),e}),{})):i),n}),qe({},e)):e}var Xe=function(e){function a(a,n){var t=e.call(this,a)||this;return t.variableId=n,t}return Je(a,e),a}(Error);var Qe=function(){function e(a,n,t,i){var o=this;if(void 0===n&&(n=e.defaultLocale),this.format=function(e){try{return Ze(o.pattern,e)}catch(e){throw e.variableId?new Error("The intl string context variable '"+e.variableId+"' was not provided to the string '"+o.message+"'"):e}},"string"==typeof a){if(!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=e.__parse(a)}else this.ast=a;if(this.message=a,!this.ast||"messageFormatPattern"!==this.ast.type)throw new TypeError("A message must be provided as a String or AST.");var r=Ye(e.formats,t);this.locale=Ke(n||[]);var s=i&&i.formatters||{getNumberFormat:function(){for(var e,a=[],n=0;n<arguments.length;n++)a[n]=arguments[n];return new((e=Intl.NumberFormat).bind.apply(e,[void 0].concat(a)))},getDateTimeFormat:function(){for(var e,a=[],n=0;n<arguments.length;n++)a[n]=arguments[n];return new((e=Intl.DateTimeFormat).bind.apply(e,[void 0].concat(a)))},getPluralRules:function(){for(var e,a=[],n=0;n<arguments.length;n++)a[n]=arguments[n];return new((e=Intl.PluralRules).bind.apply(e,[void 0].concat(a)))}};this.pattern=new Be(n,r,s).compile(this.ast)}return e.prototype.resolvedOptions=function(){return{locale:this.locale}},e.prototype.getAst=function(){return this.ast},e.defaultLocale="en",e.__parse=void 0,e.formats={number:{currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}();Qe.__parse=Me.parse,
|
|
17
|
+
*/const oe="…",re="data:image/jpeg;base64,",se={label:"pass",minScore:.9},le={label:"average",minScore:.5},pe={label:"fail"},ue={label:"error"},ce=["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 de{static i18n=null;static get PASS_THRESHOLD(){return.9}static get MS_DISPLAY_VALUE(){return"%10d ms"}static getFinalDisplayedUrl(e){if(e.finalDisplayedUrl)return e.finalDisplayedUrl;if(e.finalUrl)return e.finalUrl;throw new Error("Could not determine final displayed URL")}static getMainDocumentUrl(e){return e.mainDocumentUrl||e.finalUrl}static prepareReportResult(e){const a=JSON.parse(JSON.stringify(e));a.configSettings.locale||(a.configSettings.locale="en"),a.configSettings.formFactor||(a.configSettings.formFactor=a.configSettings.emulatedFormFactor),a.finalDisplayedUrl=this.getFinalDisplayedUrl(a),a.mainDocumentUrl=this.getMainDocumentUrl(a);for(const e of Object.values(a.audits))if("not_applicable"!==e.scoreDisplayMode&&"not-applicable"!==e.scoreDisplayMode||(e.scoreDisplayMode="notApplicable"),e.details){if(void 0!==e.details.type&&"diagnostic"!==e.details.type||(e.details.type="debugdata"),"filmstrip"===e.details.type)for(const a of e.details.items)a.data.startsWith(re)||(a.data=re+a.data);if("table"===e.details.type)for(const a of e.details.headings){const{itemType:e,text:n}=a;void 0!==e&&(a.valueType=e,delete a.itemType),void 0!==n&&(a.label=n,delete a.text);const t=a.subItemsHeading?.itemType;a.subItemsHeading&&void 0!==t&&(a.subItemsHeading.valueType=t,delete a.subItemsHeading.itemType)}}if("object"!=typeof a.categories)throw new Error("No categories provided.");const n=new Map,[t]=a.lighthouseVersion.split(".").map(Number),i=a.categories.performance;if(t<9&&i){a.categoryGroups||(a.categoryGroups={}),a.categoryGroups.hidden={title:""};for(const e of i.auditRefs)e.group?["load-opportunities","diagnostics"].includes(e.group)&&delete e.group:e.group="hidden"}for(const e of Object.values(a.categories))e.auditRefs.forEach((e=>{e.relevantAudits&&e.relevantAudits.forEach((a=>{const t=n.get(a)||[];t.push(e),n.set(a,t)}))})),e.auditRefs.forEach((e=>{const t=a.audits[e.id];e.result=t,n.has(e.id)&&(e.relevantMetrics=n.get(e.id)),a.stackPacks&&a.stackPacks.forEach((a=>{a.descriptions[e.id]&&(e.stackPacks=e.stackPacks||[],e.stackPacks.push({title:a.title,iconDataURL:a.iconDataURL,description:a.descriptions[e.id]}))}))}));if(a.audits["full-page-screenshot"]){const e=a.audits["full-page-screenshot"].details;a.fullPageScreenshot=e?{screenshot:e.screenshot,nodes:e.nodes}:null,delete a.audits["full-page-screenshot"]}return a}static getFullPageScreenshot(e){if(e.fullPageScreenshot)return e.fullPageScreenshot;return e.audits["full-page-screenshot"]?.details}static showAsPassed(e){switch(e.scoreDisplayMode){case"manual":case"notApplicable":return!0;case"error":case"informative":return!1;case"numeric":case"binary":default:return Number(e.score)>=se.minScore}}static calculateRating(e,a){if("manual"===a||"notApplicable"===a)return se.label;if("error"===a)return ue.label;if(null===e)return pe.label;let n=pe.label;return e>=se.minScore?n=se.label:e>=le.minScore&&(n=le.label),n}static splitMarkdownCodeSpans(e){const a=[],n=e.split(/`(.*?)`/g);for(let e=0;e<n.length;e++){const t=n[e];if(!t)continue;const i=e%2!=0;a.push({isCode:i,text:t})}return a}static splitMarkdownLink(e){const a=[],n=e.split(/\[([^\]]+?)\]\((https?:\/\/.*?)\)/g);for(;n.length;){const[e,t,i]=n.splice(0,3);e&&a.push({isLink:!1,text:e}),t&&i&&a.push({isLink:!0,text:t,linkHref:i})}return a}static getURLDisplayName(e,a){const n=void 0!==(a=a||{numPathParts:void 0,preserveQuery:void 0,preserveHost:void 0}).numPathParts?a.numPathParts:2,t=void 0===a.preserveQuery||a.preserveQuery,i=a.preserveHost||!1;let o;if("about:"===e.protocol||"data:"===e.protocol)o=e.href;else{o=e.pathname;const a=o.split("/").filter((e=>e.length));n&&a.length>n&&(o=oe+a.slice(-1*n).join("/")),i&&(o=`${e.host}/${o.replace(/^\//,"")}`),t&&(o=`${o}${e.search}`)}if("data:"!==e.protocol&&(o=o.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g,"$1…"),o=o.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,"$1…"),o=o.replace(/(\d{3})\d{6,}/g,"$1…"),o=o.replace(/\u2026+/g,oe),o.length>64&&o.includes("?")&&(o=o.replace(/\?([^=]*)(=)?.*/,"?$1$2…"),o.length>64&&(o=o.replace(/\?.*/,"?…")))),o.length>64){const e=o.lastIndexOf(".");o=e>=0?o.slice(0,63-(o.length-e))+`…${o.slice(e)}`:o.slice(0,63)+oe}return o}static parseURL(e){const a=new URL(e);return{file:de.getURLDisplayName(a),hostname:a.hostname,origin:a.origin}}static createOrReturnURL(e){return e instanceof URL?e:new URL(e)}static getTld(e){const a=e.split(".").slice(-2);return ce.includes(a[0])?`.${a.join(".")}`:`.${a[a.length-1]}`}static getRootDomain(e){const a=de.createOrReturnURL(e).hostname,n=de.getTld(a).split(".");return a.split(".").slice(-n.length).join(".")}static getEmulationDescriptions(e){let a,n,t;const i=e.throttling;switch(e.throttlingMethod){case"provided":t=n=a=de.i18n.strings.throttlingProvided;break;case"devtools":{const{cpuSlowdownMultiplier:e,requestLatencyMs:o}=i;a=`${de.i18n.formatNumber(e)}x slowdown (DevTools)`,n=`${de.i18n.formatMilliseconds(o)} HTTP RTT, ${de.i18n.formatKbps(i.downloadThroughputKbps)} down, ${de.i18n.formatKbps(i.uploadThroughputKbps)} up (DevTools)`;t=(()=>562.5===o&&i.downloadThroughputKbps===1638.4*.9&&675===i.uploadThroughputKbps)()?de.i18n.strings.runtimeSlow4g:de.i18n.strings.runtimeCustom;break}case"simulate":{const{cpuSlowdownMultiplier:e,rttMs:o,throughputKbps:r}=i;a=`${de.i18n.formatNumber(e)}x slowdown (Simulated)`,n=`${de.i18n.formatMilliseconds(o)} TCP RTT, ${de.i18n.formatKbps(r)} throughput (Simulated)`;t=(()=>150===o&&1638.4===r)()?de.i18n.strings.runtimeSlow4g:de.i18n.strings.runtimeCustom;break}default:t=a=n=de.i18n.strings.runtimeUnknown}const o="devtools"!==e.channel&&e.screenEmulation.disabled,r="devtools"===e.channel?"mobile"===e.formFactor:e.screenEmulation.mobile;let s=de.i18n.strings.runtimeMobileEmulation;o?s=de.i18n.strings.runtimeNoEmulation:r||(s=de.i18n.strings.runtimeDesktopEmulation);return{deviceEmulation:s,screenEmulation:o?void 0:`${e.screenEmulation.width}x${e.screenEmulation.height}, DPR ${e.screenEmulation.deviceScaleFactor}`,cpuThrottling:a,networkThrottling:n,summary:t}}static filterRelevantLines(e,a,n){if(0===a.length)return e.slice(0,2*n+1);const t=new Set;return(a=a.sort(((e,a)=>(e.lineNumber||0)-(a.lineNumber||0)))).forEach((({lineNumber:e})=>{let a=e-n,i=e+n;for(;a<1;)a++,i++;t.has(a-3-1)&&(a-=3);for(let e=a;e<=i;e++){const a=e;t.add(a)}})),e.filter((e=>t.has(e.lineNumber)))}static isPluginCategory(e){return e.startsWith("lighthouse-plugin-")}static shouldDisplayAsFraction(e){return"timespan"===e||"snapshot"===e}static calculateCategoryFraction(e){let a=0,n=0,t=0,i=0;for(const o of e.auditRefs){const e=de.showAsPassed(o.result);"hidden"!==o.group&&"manual"!==o.result.scoreDisplayMode&&"notApplicable"!==o.result.scoreDisplayMode&&("informative"!==o.result.scoreDisplayMode?(++a,i+=o.weight,e&&n++):e||++t)}return{numPassed:n,numPassableAudits:a,numInformative:t,totalWeight:i}}}de.reportJson=null;let me=0;de.getUniqueSuffix=()=>me++,de.resetUniqueSuffix=()=>{me=0};de.UIStrings={varianceDisclaimer:"Values are estimated and may vary. The [performance score is calculated](https://developer.chrome.com/docs/lighthouse/performance/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",viewTraceLabel:"View Trace",viewOriginalTraceLabel:"View Original Trace",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",runtimeSettingsDevice:"Device",runtimeSettingsNetworkThrottling:"Network throttling",runtimeSettingsCPUThrottling:"CPU throttling",runtimeSettingsUANetwork:"User agent (network)",runtimeSettingsBenchmark:"CPU/Memory Power",runtimeSettingsAxeVersion:"Axe version",runtimeSettingsScreenEmulation:"Screen emulation",footerIssue:"File an issue",runtimeNoEmulation:"No emulation",runtimeMobileEmulation:"Emulated Moto G4",runtimeDesktopEmulation:"Emulated Desktop",runtimeUnknown:"Unknown",runtimeSingleLoad:"Single page load",runtimeAnalysisWindow:"Initial page load",runtimeSingleLoadTooltip:"This data is taken from a single page load, as opposed to field data summarizing many sessions.",throttlingProvided:"Provided by environment",show:"Show",hide:"Hide",expandView:"Expand view",collapseView:"Collapse view",runtimeSlow4g:"Slow 4G throttling",runtimeCustom:"Custom throttling"};const he=()=>R("svg",{width:"14",viewBox:"0 0 18 16",fill:"none",role:"img",children:R("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0 2C0 1.17 0.67 0.5 1.5 0.5C2.33 0.5 3 1.17 3 2C3 2.83 2.33 3.5 1.5 3.5C0.67 3.5 0 2.83 0 2ZM0 8C0 7.17 0.67 6.5 1.5 6.5C2.33 6.5 3 7.17 3 8C3 8.83 2.33 9.5 1.5 9.5C0.67 9.5 0 8.83 0 8ZM1.5 12.5C0.67 12.5 0 13.18 0 14C0 14.82 0.68 15.5 1.5 15.5C2.32 15.5 3 14.82 3 14C3 13.18 2.33 12.5 1.5 12.5ZM18 15H5V13H18V15ZM5 9H18V7H5V9ZM5 3V1H18V3H5Z",fill:"currentColor"})}),ge=()=>R("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a navigation report",children:R("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor","stroke-width":"2"})}),ve=()=>R("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a timespan report",children:[R("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor","stroke-width":"2"}),R("path",{d:"m 8,4 v 4 l 4,1.9999998",stroke:"currentColor","stroke-width":"1.5"})]}),fe=()=>R("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a snapshot report",children:R("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M 12.2038,12.2812 C 11.1212,13.3443 9.6372,14 8,14 7.81038,14 7.62281,13.9912 7.43768,13.974 L 10.3094,9 Z M 12.8925,11.4741 10.0207,6.5 H 13.811 C 13.9344,6.97943 14,7.48205 14,8 c 0,1.2947 -0.4101,2.4937 -1.1075,3.4741 z M 13.456,5.5 H 7.71135 L 9.6065,2.21749 C 11.3203,2.69259 12.7258,3.90911 13.456,5.5 Z M 8.5624,2.02601 C 8.3772,2.0088 8.1896,2 8,2 6.36282,2 4.8788,2.65572 3.79622,3.71885 L 5.69061,7.00002 Z M 3.10749,4.52594 C 2.4101,5.5063 2,6.70526 2,8 2,8.5179 2.06563,9.0206 2.18903,9.5 H 5.97927 Z M 2.54404,10.5 c 0.73017,1.5909 2.1357,2.8074 3.84949,3.2825 L 8.2887,10.5 Z M 16,8 c 0,4.4183 -3.5817,8 -8,8 C 3.58172,16 0,12.4183 0,8 0,3.58172 3.58172,0 8,0 c 4.4183,0 8,3.58172 8,8 z",fill:"currentColor"})}),be=()=>R("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"currentColor",role:"img","aria-label":"Icon representing a close action",children:[R("path",{d:"M0 0h24v24H0V0z",fill:"none"}),R("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})]}),ye=()=>R("svg",{width:"15",height:"12",viewBox:"0 0 15 12",fill:"none",role:"img",children:R("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.33317 2.00008H13.9998V0.666748H3.33317C2.59984 0.666748 1.99984 1.26675 1.99984 2.00008V9.33341H0.666504V11.3334H7.99984V9.33341H3.33317V2.00008ZM13.9998 3.33341H9.99984C9.63317 3.33341 9.33317 3.63341 9.33317 4.00008V10.6667C9.33317 11.0334 9.63317 11.3334 9.99984 11.3334H13.9998C14.3665 11.3334 14.6665 11.0334 14.6665 10.6667V4.00008C14.6665 3.63341 14.3665 3.33341 13.9998 3.33341ZM10.6665 9.33341H13.3332V4.66675H10.6665V9.33341Z",fill:"currentColor"})}),_e=()=>R("svg",{width:"16",height:"11",viewBox:"0 0 16 11",fill:"none",role:"img",children:R("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.666687 3.26663L2.00002 4.59997C3.92002 2.67997 6.52669 1.87997 9.02002 2.18663L9.81335 0.399966C6.59335 -0.173367 3.16002 0.779966 0.666687 3.26663ZM10.6 0.599966C10.4867 0.599966 10.3867 0.659966 10.3267 0.753299L10.28 0.853299L6.82669 8.61996C6.72002 8.8133 6.65335 9.02663 6.65335 9.25996C6.65335 9.99996 7.25335 10.6 7.99335 10.6C8.63335 10.6 9.17335 10.1466 9.30002 9.53996L9.30669 9.51997L10.9334 0.933299C10.9334 0.746633 10.7867 0.599966 10.6 0.599966ZM15.3334 3.26663L14 4.59997C13.1867 3.78663 12.2534 3.17997 11.2534 2.76663L11.6067 0.886633C12.9667 1.38663 14.24 2.1733 15.3334 3.26663ZM11.3334 7.26663L12.6667 5.9333C12.1334 5.39997 11.5334 4.98663 10.8934 4.6733L10.5267 6.61997C10.8067 6.79997 11.08 7.0133 11.3334 7.26663ZM4.66669 7.26663L3.33335 5.9333C4.67335 4.5933 6.45335 3.95997 8.20669 4.0133L7.35335 5.9333C6.37335 6.0733 5.42002 6.5133 4.66669 7.26663Z",fill:"currentColor"})}),Ce=()=>R("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img",children:R("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.5 7.16667V5.5H13.8333V3.83333C13.8333 2.91667 13.0833 2.16667 12.1667 2.16667H10.5V0.5H8.83333V2.16667H7.16667V0.5H5.5V2.16667H3.83333C2.91667 2.16667 2.16667 2.91667 2.16667 3.83333V5.5H0.5V7.16667H2.16667V8.83333H0.5V10.5H2.16667V12.1667C2.16667 13.0833 2.91667 13.8333 3.83333 13.8333H5.5V15.5H7.16667V13.8333H8.83333V15.5H10.5V13.8333H12.1667C13.0833 13.8333 13.8333 13.0833 13.8333 12.1667V10.5H15.5V8.83333H13.8333V7.16667H15.5ZM10.5 5.5H5.5V10.5H10.5V5.5ZM3.83333 12.1667H12.1667V3.83333H3.83333V12.1667Z",fill:"currentColor"})}),we=()=>R("svg",{viewBox:"0 0 18 12",width:"18",height:"12",role:"img",children:[R("rect",{width:"18",height:"2",fill:"currentColor"}),R("rect",{y:"5",width:"18",height:"2",fill:"currentColor"}),R("rect",{y:"10",width:"18",height:"2",fill:"currentColor"})]}),ke=()=>R("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:R("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13 7C13 10.3137 10.3137 13 7 13C3.68629 13 1 10.3137 1 7C1 3.68629 3.68629 1 7 1C10.3137 1 13 3.68629 13 7ZM14 7C14 10.866 10.866 14 7 14C3.13401 14 0 10.866 0 7C0 3.13401 3.13401 0 7 0C10.866 0 14 3.13401 14 7ZM7.66658 11H6.33325V9.66667H7.66658V11ZM4.33325 5.66667C4.33325 4.19333 5.52659 3 6.99992 3C8.47325 3 9.66658 4.19333 9.66658 5.66667C9.66658 6.52194 9.1399 6.98221 8.62709 7.43036C8.1406 7.85551 7.66658 8.26975 7.66658 9H6.33325C6.33325 7.78582 6.96133 7.30439 7.51355 6.88112C7.94674 6.54907 8.33325 6.25281 8.33325 5.66667C8.33325 4.93333 7.73325 4.33333 6.99992 4.33333C6.26658 4.33333 5.66658 4.93333 5.66658 5.66667H4.33325Z",fill:"currentColor"})}),Ae=T(void 0),Se=T({});function Pe(e){return new URLSearchParams(location.hash.replace("#","?")).get(e)}function Ue(...e){const a=[];for(const n of e){if(!n)continue;if("string"==typeof n){a.push(n);continue}const e=Object.entries(n).filter((([e,a])=>a)).map((([e])=>e));a.push(...e)}return a.join(" ")}function xe(e,a){switch(e){case"navigation":return a.navigationDescription;case"timespan":return a.timespanDescription;case"snapshot":return a.snapshotDescription}}function Le(){const e=X(Ae);if(!e)throw Error("useFlowResult must be called in the FlowResultContext");return e}function ze(){const e=Le(),[a,n]=function(...e){const[a,n]=J(e.map(Pe));return q((()=>{function t(){const t=e.map(Pe);t.every(((e,n)=>e===a[n]))||n(t)}return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}),[a]),a}("index","anchor");return Y((()=>{if(!a)return null;const t=Number(a);if(!Number.isFinite(t))return console.warn(`Invalid hash index: ${a}`),null;const i=e.steps[t];return i?{currentLhr:i.lhr,index:t,anchor:n}:(console.warn(`No flow step at index ${t}`),null)}),[a,e,n])}function Ne(e,a){const n=Z(null);return K((()=>{if(!n.current)return;const a=e();return n.current.append(a),()=>{n.current?.contains(a)&&n.current.removeChild(a)}}),a),n}const Ie=()=>R("div",{className:"Separator",role:"separator"}),Te=({mode:e})=>R(h,{children:["navigation"===e&&R(ge,{}),"timespan"===e&&R(ve,{}),"snapshot"===e&&R(fe,{})]}),De=({mode:e})=>R("div",{className:"FlowSegment",children:[R("div",{className:"FlowSegment__top-line"}),e&&R(Te,{mode:e}),R("div",{className:"FlowSegment__bottom-line"})]}),Re=({frames:e,width:a,height:n})=>{const[t,i]=J(0),o=t%e.length;return q((()=>{const a=setInterval((()=>i((a=>(a+1)%e.length))),500);return()=>clearInterval(a)}),[e.length]),R("img",{className:"FlowStepThumbnail","data-testid":"FlowStepAnimatedThumbnail",src:e[o].data,style:{width:a,height:n},alt:"Animated screenshots of a page tested by Lighthouse"})},Ee=({lhr:e,width:a,height:n})=>{const t=function(e){const a=e.audits["screenshot-thumbnails"];if(!a)return;return a.details&&"filmstrip"===a.details.type&&a.details.items||void 0}(e),i=function(e){const{width:a,height:n}=e.configSettings.screenEmulation;return{width:a,height:n}}(e);if(a&&void 0===n?n=i.height*a/i.width:n&&void 0===a&&(a=i.width*n/i.height),!a||!n)return console.warn(new Error("FlowStepThumbnail requested without any dimensions").stack),R(h,{});let o;if(t?.length){if(o=t[t.length-1].data,"timespan"===e.gatherMode)return R(Re,{frames:t,width:a,height:n})}else o=de.getFullPageScreenshot(e)?.screenshot.data;return R(h,{children:o&&R("img",{className:"FlowStepThumbnail",src:o,style:{width:a,height:n},alt:"Screenshot of a page tested by Lighthouse"})})};var je,Me=function(){function e(a,n,t,i){this.message=a,this.expected=n,this.found=t,this.location=i,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,a){function n(){this.constructor=e}n.prototype=a.prototype,e.prototype=new n}(e,Error),e.buildMessage=function(e,a){var n={literal:function(e){return'"'+i(e.text)+'"'},class:function(e){var a,n="";for(a=0;a<e.parts.length;a++)n+=e.parts[a]instanceof Array?o(e.parts[a][0])+"-"+o(e.parts[a][1]):o(e.parts[a]);return"["+(e.inverted?"^":"")+n+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function t(e){return e.charCodeAt(0).toString(16).toUpperCase()}function i(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+t(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+t(e)}))}function o(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+t(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+t(e)}))}return"Expected "+function(e){var a,t,i,o=new Array(e.length);for(a=0;a<e.length;a++)o[a]=(i=e[a],n[i.type](i));if(o.sort(),o.length>0){for(a=1,t=1;a<o.length;a++)o[a-1]!==o[a]&&(o[t]=o[a],t++);o.length=t}switch(o.length){case 1:return o[0];case 2:return o[0]+" or "+o[1];default:return o.slice(0,-1).join(", ")+", or "+o[o.length-1]}}(e)+" but "+function(e){return e?'"'+i(e)+'"':"end of input"}(a)+" found."},{SyntaxError:e,parse:function(a,n){n=void 0!==n?n:{};var t,i={},o={start:pe},r=pe,s=function(e){return e.join("")},l=te("{",!1),p=",",u=te(",",!1),c=te("}",!1),d="number",m=te("number",!1),h="date",g=te("date",!1),v="time",f=te("time",!1),b="plural",y=te("plural",!1),_="selectordinal",C=te("selectordinal",!1),w="select",k=te("select",!1),A=te("=",!1),S="offset:",P=te("offset:",!1),U=oe("whitespace"),x=/^[ \t\n\r]/,L=ie([" ","\t","\n","\r"],!1,!1),z=oe("optionalWhitespace"),N=/^[0-9]/,I=ie([["0","9"]],!1,!1),T=/^[0-9a-f]/i,D=ie([["0","9"],["a","f"]],!1,!0),R=te("0",!1),E=/^[1-9]/,j=ie([["1","9"]],!1,!1),M="'",F=te("'",!1),B=/^[ \t\n\r,.+={}#]/,H=ie([" ","\t","\n","\r",",",".","+","=","{","}","#"],!1,!1),O={type:"any"},W=/^[^{}\\\0-\x1F\x7F \t\n\r]/,G=ie(["{","}","\\",["\0",""],""," ","\t","\n","\r"],!0,!1),V=te("\\\\",!1),$=te("\\#",!1),J=te("\\{",!1),q=te("\\}",!1),K=te("\\u",!1),Z=0,Y=0,X=[{line:1,column:1}],Q=0,ee=[],ae=0;if("startRule"in n){if(!(n.startRule in o))throw new Error("Can't start parsing from rule \""+n.startRule+'".');r=o[n.startRule]}function ne(){return se(Y,Z)}function te(e,a){return{type:"literal",text:e,ignoreCase:a}}function ie(e,a,n){return{type:"class",parts:e,inverted:a,ignoreCase:n}}function oe(e){return{type:"other",description:e}}function re(e){var n,t=X[e];if(t)return t;for(n=e-1;!X[n];)n--;for(t={line:(t=X[n]).line,column:t.column};n<e;)10===a.charCodeAt(n)?(t.line++,t.column=1):t.column++,n++;return X[e]=t,t}function se(e,a){var n=re(e),t=re(a);return{start:{offset:e,line:n.line,column:n.column},end:{offset:a,line:t.line,column:t.column}}}function le(e){Z<Q||(Z>Q&&(Q=Z,ee=[]),ee.push(e))}function pe(){return ue()}function ue(){var e,a,n;for(e=Z,a=[],n=ce();n!==i;)a.push(n),n=ce();return a!==i&&(Y=e,a={type:"messageFormatPattern",elements:a,location:ne()}),e=a}function ce(){var e;return(e=function(){var e,n;e=Z,(n=function(){var e,n,t,o,r,s;e=Z,n=[],t=Z,(o=ge())!==i&&(r=we())!==i&&(s=ge())!==i?t=o=[o,r,s]:(Z=t,t=i);if(t!==i)for(;t!==i;)n.push(t),t=Z,(o=ge())!==i&&(r=we())!==i&&(s=ge())!==i?t=o=[o,r,s]:(Z=t,t=i);else n=i;n!==i&&(Y=e,n=n.reduce((function(e,a){return e.concat(a)}),[]).join(""));(e=n)===i&&(e=Z,e=(n=he())!==i?a.substring(e,Z):n);return e}())!==i&&(Y=e,n={type:"messageTextElement",value:n,location:ne()});return e=n}())===i&&(e=function(){var e,n,t,o,r,A,S;e=Z,123===a.charCodeAt(Z)?(n="{",Z++):(n=i,0===ae&&le(l));n!==i&&ge()!==i&&(t=function(){var e,a,n;if((e=be())===i){for(e=Z,a=[],n=ye();n!==i;)a.push(n),n=ye();a!==i&&(Y=e,a=s(a)),e=a}return e}())!==i&&ge()!==i?(o=Z,44===a.charCodeAt(Z)?(r=p,Z++):(r=i,0===ae&&le(u)),r!==i&&(A=ge())!==i&&(S=function(){var e;(e=function(){var e,n,t,o,r,s;e=Z,a.substr(Z,6)===d?(n=d,Z+=6):(n=i,0===ae&&le(m));n===i&&(a.substr(Z,4)===h?(n=h,Z+=4):(n=i,0===ae&&le(g)),n===i&&(a.substr(Z,4)===v?(n=v,Z+=4):(n=i,0===ae&&le(f))));n!==i&&ge()!==i?(t=Z,44===a.charCodeAt(Z)?(o=p,Z++):(o=i,0===ae&&le(u)),o!==i&&(r=ge())!==i&&(s=we())!==i?t=o=[o,r,s]:(Z=t,t=i),t===i&&(t=null),t!==i?(Y=e,e=n={type:n+"Format",style:(l=t)&&l[2],location:ne()}):(Z=e,e=i)):(Z=e,e=i);var l;return e}())===i&&(e=function(){var e,n,t,o;e=Z,a.substr(Z,6)===b?(n=b,Z+=6):(n=i,0===ae&&le(y));n!==i&&ge()!==i?(44===a.charCodeAt(Z)?(t=p,Z++):(t=i,0===ae&&le(u)),t!==i&&ge()!==i&&(o=me())!==i?(Y=e,e=n={type:(r=o).type,ordinal:!1,offset:r.offset||0,options:r.options,location:ne()}):(Z=e,e=i)):(Z=e,e=i);var r;return e}())===i&&(e=function(){var e,n,t,o;e=Z,a.substr(Z,13)===_?(n=_,Z+=13):(n=i,0===ae&&le(C));n!==i&&ge()!==i?(44===a.charCodeAt(Z)?(t=p,Z++):(t=i,0===ae&&le(u)),t!==i&&ge()!==i&&(o=me())!==i?(Y=e,e=n={type:(r=o).type,ordinal:!0,offset:r.offset||0,options:r.options,location:ne()}):(Z=e,e=i)):(Z=e,e=i);var r;return e}())===i&&(e=function(){var e,n,t,o,r;e=Z,a.substr(Z,6)===w?(n=w,Z+=6):(n=i,0===ae&&le(k));if(n!==i)if(ge()!==i)if(44===a.charCodeAt(Z)?(t=p,Z++):(t=i,0===ae&&le(u)),t!==i)if(ge()!==i){if(o=[],(r=de())!==i)for(;r!==i;)o.push(r),r=de();else o=i;o!==i?(Y=e,e=n=function(e){return{type:"selectFormat",options:e,location:ne()}}(o)):(Z=e,e=i)}else Z=e,e=i;else Z=e,e=i;else Z=e,e=i;else Z=e,e=i;return e}());return e}())!==i?o=r=[r,A,S]:(Z=o,o=i),o===i&&(o=null),o!==i&&(r=ge())!==i?(125===a.charCodeAt(Z)?(A="}",Z++):(A=i,0===ae&&le(c)),A!==i?(Y=e,e=n={type:"argumentElement",id:t,format:(P=o)&&P[2],location:ne()}):(Z=e,e=i)):(Z=e,e=i)):(Z=e,e=i);var P;return e}()),e}function de(){var e,n,t,o,r;return e=Z,ge()!==i&&(n=function(){var e,n,t,o;return e=Z,n=Z,61===a.charCodeAt(Z)?(t="=",Z++):(t=i,0===ae&&le(A)),t!==i&&(o=be())!==i?n=t=[t,o]:(Z=n,n=i),(e=n!==i?a.substring(e,Z):n)===i&&(e=we()),e}())!==i&&ge()!==i?(123===a.charCodeAt(Z)?(t="{",Z++):(t=i,0===ae&&le(l)),t!==i&&(o=ue())!==i?(125===a.charCodeAt(Z)?(r="}",Z++):(r=i,0===ae&&le(c)),r!==i?(Y=e,e={type:"optionalFormatPattern",selector:n,value:o,location:ne()}):(Z=e,e=i)):(Z=e,e=i)):(Z=e,e=i),e}function me(){var e,n,t,o;if(e=Z,(n=function(){var e,n,t;return e=Z,a.substr(Z,7)===S?(n=S,Z+=7):(n=i,0===ae&&le(P)),n!==i&&ge()!==i&&(t=be())!==i?(Y=e,e=n=t):(Z=e,e=i),e}())===i&&(n=null),n!==i)if(ge()!==i){if(t=[],(o=de())!==i)for(;o!==i;)t.push(o),o=de();else t=i;t!==i?(Y=e,e=n=function(e,a){return{type:"pluralFormat",offset:e,options:a,location:ne()}}(n,t)):(Z=e,e=i)}else Z=e,e=i;else Z=e,e=i;return e}function he(){var e,n;if(ae++,e=[],x.test(a.charAt(Z))?(n=a.charAt(Z),Z++):(n=i,0===ae&&le(L)),n!==i)for(;n!==i;)e.push(n),x.test(a.charAt(Z))?(n=a.charAt(Z),Z++):(n=i,0===ae&&le(L));else e=i;return ae--,e===i&&(n=i,0===ae&&le(U)),e}function ge(){var e,n,t;for(ae++,e=Z,n=[],t=he();t!==i;)n.push(t),t=he();return e=n!==i?a.substring(e,Z):n,ae--,e===i&&(n=i,0===ae&&le(z)),e}function ve(){var e;return N.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(I)),e}function fe(){var e;return T.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(D)),e}function be(){var e,n,t,o,r,s;if(e=Z,48===a.charCodeAt(Z)?(n="0",Z++):(n=i,0===ae&&le(R)),n===i){if(n=Z,t=Z,E.test(a.charAt(Z))?(o=a.charAt(Z),Z++):(o=i,0===ae&&le(j)),o!==i){for(r=[],s=ve();s!==i;)r.push(s),s=ve();r!==i?t=o=[o,r]:(Z=t,t=i)}else Z=t,t=i;n=t!==i?a.substring(n,Z):t}return n!==i&&(Y=e,n=parseInt(n,10)),e=n}function ye(){var e,n,t;return e=Z,n=Z,ae++,39===a.charCodeAt(Z)?(t=M,Z++):(t=i,0===ae&&le(F)),t===i&&(B.test(a.charAt(Z))?(t=a.charAt(Z),Z++):(t=i,0===ae&&le(H))),ae--,t===i?n=void 0:(Z=n,n=i),n!==i?(a.length>Z?(t=a.charAt(Z),Z++):(t=i,0===ae&&le(O)),t!==i?(Y=e,e=n=t):(Z=e,e=i)):(Z=e,e=i),e===i&&(e=Z,39===a.charCodeAt(Z)?(n=M,Z++):(n=i,0===ae&&le(F)),n!==i&&(t=function(){var e;B.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(H));e===i&&(e=_e());return e}())!==i?(Y=e,e=n=t):(Z=e,e=i)),e}function _e(){var e;return 39===a.charCodeAt(Z)?(e=M,Z++):(e=i,0===ae&&le(F)),e}function Ce(){var e,n,t,o,r,s,l,p,u;return e=Z,39===a.charCodeAt(Z)?(n=M,Z++):(n=i,0===ae&&le(F)),n!==i&&(t=_e())!==i?(Y=e,e=n=t):(Z=e,e=i),e===i&&(W.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(G)),e===i&&(e=Z,"\\\\"===a.substr(Z,2)?(n="\\\\",Z+=2):(n=i,0===ae&&le(V)),n!==i&&(Y=e,n="\\"),(e=n)===i&&(e=Z,"\\#"===a.substr(Z,2)?(n="\\#",Z+=2):(n=i,0===ae&&le($)),n!==i&&(Y=e,n="\\#"),(e=n)===i&&(e=Z,"\\{"===a.substr(Z,2)?(n="\\{",Z+=2):(n=i,0===ae&&le(J)),n!==i&&(Y=e,n="{"),(e=n)===i&&(e=Z,"\\}"===a.substr(Z,2)?(n="\\}",Z+=2):(n=i,0===ae&&le(q)),n!==i&&(Y=e,n="}"),(e=n)===i&&(e=Z,"\\u"===a.substr(Z,2)?(n="\\u",Z+=2):(n=i,0===ae&&le(K)),n!==i?(t=Z,o=Z,(r=fe())!==i&&(s=fe())!==i&&(l=fe())!==i&&(p=fe())!==i?o=r=[r,s,l,p]:(Z=o,o=i),(t=o!==i?a.substring(t,Z):o)!==i?(Y=e,u=t,e=n=String.fromCharCode(parseInt(u,16))):(Z=e,e=i)):(Z=e,e=i))))))),e}function we(){var e,a,n;if(e=Z,a=[],(n=Ce())!==i)for(;n!==i;)a.push(n),n=Ce();else a=i;return a!==i&&(Y=e,a=s(a)),e=a}if((t=r())!==i&&Z===a.length)return t;throw t!==i&&Z<a.length&&le({type:"end"}),function(a,n,t){return new e(e.buildMessage(a,n),a,n,t)}(ee,Q<a.length?a.charAt(Q):null,Q<a.length?se(Q,Q+1):se(Q,Q))}}}(),Fe=(je=function(e,a){return(je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var n in a)a.hasOwnProperty(n)&&(e[n]=a[n])})(e,a)},function(e,a){function n(){this.constructor=e}je(e,a),e.prototype=null===a?Object.create(a):(n.prototype=a.prototype,new n)}),Be=function(){function e(e,a,n){this.locales=[],this.formats={number:{},date:{},time:{}},this.pluralNumberFormat=null,this.currentPlural=null,this.pluralStack=[],this.locales=e,this.formats=a,this.formatters=n}return e.prototype.compile=function(e){return this.pluralStack=[],this.currentPlural=null,this.pluralNumberFormat=null,this.compileMessage(e)},e.prototype.compileMessage=function(e){var a=this;if(!e||"messageFormatPattern"!==e.type)throw new Error('Message AST is not of type: "messageFormatPattern"');var n=e.elements,t=n.filter((function(e){return"messageTextElement"===e.type||"argumentElement"===e.type})).map((function(e){return"messageTextElement"===e.type?a.compileMessageText(e):a.compileArgument(e)}));if(t.length!==n.length)throw new Error("Message element does not have a valid type");return t},e.prototype.compileMessageText=function(e){return this.currentPlural&&/(^|[^\\])#/g.test(e.value)?(this.pluralNumberFormat||(this.pluralNumberFormat=new Intl.NumberFormat(this.locales)),new Ge(this.currentPlural.id,this.currentPlural.format.offset,this.pluralNumberFormat,e.value)):e.value.replace(/\\#/g,"#")},e.prototype.compileArgument=function(e){var a=e.format,n=e.id,t=this.formatters;if(!a)return new Oe(n);var i=this.formats,o=this.locales;switch(a.type){case"numberFormat":return{id:n,format:t.getNumberFormat(o,i.number[a.style]).format};case"dateFormat":return{id:n,format:t.getDateTimeFormat(o,i.date[a.style]).format};case"timeFormat":return{id:n,format:t.getDateTimeFormat(o,i.time[a.style]).format};case"pluralFormat":return new We(n,a.offset,this.compileOptions(e),t.getPluralRules(o,{type:a.ordinal?"ordinal":"cardinal"}));case"selectFormat":return new Ve(n,this.compileOptions(e));default:throw new Error("Message element does not have a valid format type")}},e.prototype.compileOptions=function(e){var a=this,n=e.format,t=n.options;this.pluralStack.push(this.currentPlural),this.currentPlural="pluralFormat"===n.type?e:null;var i=t.reduce((function(e,n){return e[n.selector]=a.compileMessage(n.value),e}),{});return this.currentPlural=this.pluralStack.pop(),i},e}(),He=function(e){this.id=e},Oe=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return Fe(a,e),a.prototype.format=function(e){return e||"number"==typeof e?"string"==typeof e?e:String(e):""},a}(He),We=function(){function e(e,a,n,t){this.id=e,this.offset=a,this.options=n,this.pluralRules=t}return e.prototype.getOption=function(e){var a=this.options;return a["="+e]||a[this.pluralRules.select(e-this.offset)]||a.other},e}(),Ge=function(e){function a(a,n,t,i){var o=e.call(this,a)||this;return o.offset=n,o.numberFormat=t,o.string=i,o}return Fe(a,e),a.prototype.format=function(e){var a=this.numberFormat.format(e-this.offset);return this.string.replace(/(^|[^\\])#/g,"$1"+a).replace(/\\#/g,"#")},a}(He),Ve=function(){function e(e,a){this.id=e,this.options=a}return e.prototype.getOption=function(e){var a=this.options;return a[e]||a.other},e}();function $e(e){return!!e.options}var Je=function(){var e=function(a,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var n in a)a.hasOwnProperty(n)&&(e[n]=a[n])})(a,n)};return function(a,n){function t(){this.constructor=a}e(a,n),a.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}}(),qe=function(){return(qe=Object.assign||function(e){for(var a,n=1,t=arguments.length;n<t;n++)for(var i in a=arguments[n])Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i]);return e}).apply(this,arguments)};function Ke(e){"string"==typeof e&&(e=[e]);try{return Intl.NumberFormat.supportedLocalesOf(e,{localeMatcher:"best fit"})[0]}catch(e){return Qe.defaultLocale}}function Ze(e,a){for(var n="",t=0,i=e;t<i.length;t++){var o=i[t];if("string"!=typeof o){var r=o.id;if(!a||!(r in a))throw new Xe("A value must be provided for: "+r,r);var s=a[r];$e(o)?n+=Ze(o.getOption(s),a):n+=o.format(s)}else n+=o}return n}function Ye(e,a){return a?Object.keys(e).reduce((function(n,t){var i,o;return n[t]=(i=e[t],(o=a[t])?qe({},i||{},o||{},Object.keys(i).reduce((function(e,a){return e[a]=qe({},i[a],o[a]||{}),e}),{})):i),n}),qe({},e)):e}var Xe=function(e){function a(a,n){var t=e.call(this,a)||this;return t.variableId=n,t}return Je(a,e),a}(Error);var Qe=function(){function e(a,n,t,i){var o=this;if(void 0===n&&(n=e.defaultLocale),this.format=function(e){try{return Ze(o.pattern,e)}catch(e){throw e.variableId?new Error("The intl string context variable '"+e.variableId+"' was not provided to the string '"+o.message+"'"):e}},"string"==typeof a){if(!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=e.__parse(a)}else this.ast=a;if(this.message=a,!this.ast||"messageFormatPattern"!==this.ast.type)throw new TypeError("A message must be provided as a String or AST.");var r=Ye(e.formats,t);this.locale=Ke(n||[]);var s=i&&i.formatters||{getNumberFormat:function(){for(var e,a=[],n=0;n<arguments.length;n++)a[n]=arguments[n];return new((e=Intl.NumberFormat).bind.apply(e,[void 0].concat(a)))},getDateTimeFormat:function(){for(var e,a=[],n=0;n<arguments.length;n++)a[n]=arguments[n];return new((e=Intl.DateTimeFormat).bind.apply(e,[void 0].concat(a)))},getPluralRules:function(){for(var e,a=[],n=0;n<arguments.length;n++)a[n]=arguments[n];return new((e=Intl.PluralRules).bind.apply(e,[void 0].concat(a)))}};this.pattern=new Be(n,r,s).compile(this.ast)}return e.prototype.resolvedOptions=function(){return{locale:this.locale}},e.prototype.getAst=function(){return this.ast},e.defaultLocale="en",e.__parse=void 0,e.formats={number:{currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}();Qe.__parse=Me.parse,
|
|
18
18
|
/**
|
|
19
19
|
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
20
20
|
* 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
|
|
@@ -101,7 +101,7 @@ class Ca{constructor(e,a){this._document=e,this._lighthouseChannel="unknown",thi
|
|
|
101
101
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
102
102
|
* See the License for the specific language governing permissions and
|
|
103
103
|
* limitations under the License.
|
|
104
|
-
*/const Ua=["http://","https://","data:"];class xa{constructor(e,a={}){this._dom=e,this._fullPageScreenshot=a.fullPageScreenshot}render(e){switch(e.type){case"filmstrip":return this._renderFilmstrip(e);case"list":return this._renderList(e);case"table":case"opportunity":return this._renderTable(e);case"criticalrequestchain":return ka.render(this._dom,e,this);case"screenshot":case"debugdata":case"
|
|
104
|
+
*/const Ua=["http://","https://","data:"];class xa{constructor(e,a={}){this._dom=e,this._fullPageScreenshot=a.fullPageScreenshot}render(e){switch(e.type){case"filmstrip":return this._renderFilmstrip(e);case"list":return this._renderList(e);case"table":case"opportunity":return this._renderTable(e);case"criticalrequestchain":return ka.render(this._dom,e,this);case"screenshot":case"debugdata":case"treemap-data":return null;default:return this._renderUnknown(e.type,e)}}_renderBytes(e){const a=de.i18n.formatBytesToKiB(e.value,e.granularity||.1),n=this._renderText(a);return n.title=de.i18n.formatBytes(e.value),n}_renderMilliseconds(e){let a;return a="duration"===e.displayUnit?de.i18n.formatDuration(e.value):de.i18n.formatMilliseconds(e.value,e.granularity||10),this._renderText(a)}renderTextURL(e){const a=e;let n,t,i;try{const e=de.parseURL(a);n="/"===e.file?e.origin:e.file,t="/"===e.file||""===e.hostname?"":`(${e.hostname})`,i=a}catch(e){n=a}const o=this._dom.createElement("div","lh-text__url");if(o.append(this._renderLink({text:n,url:a})),t){const e=this._renderText(t);e.classList.add("lh-text__url-host"),o.append(e)}return i&&(o.title=a,o.dataset.url=a),o}_renderLink(e){const a=this._dom.createElement("a");if(this._dom.safelySetHref(a,e.url),!a.href){const a=this._renderText(e.text);return a.classList.add("lh-link"),a}return a.rel="noopener",a.target="_blank",a.textContent=e.text,a.classList.add("lh-link"),a}_renderText(e){const a=this._dom.createElement("div","lh-text");return a.textContent=e,a}_renderNumeric(e){const a=de.i18n.formatNumber(e.value,e.granularity||.1),n=this._dom.createElement("div","lh-numeric");return n.textContent=a,n}_renderThumbnail(e){const a=this._dom.createElement("img","lh-thumbnail"),n=e;return a.src=n,a.title=n,a.alt="",a}_renderUnknown(e,a){console.error(`Unknown details type: ${e}`,a);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(a,null,2),n}_renderTableValue(e,a){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(a.valueType){case"bytes":{const n=Number(e);return this._renderBytes({value:n,granularity:a.granularity})}case"code":{const a=String(e);return this._renderCode(a)}case"ms":{const n={value:Number(e),granularity:a.granularity,displayUnit:a.displayUnit};return this._renderMilliseconds(n)}case"numeric":{const n=Number(e);return this._renderNumeric({value:n,granularity:a.granularity})}case"text":{const a=String(e);return this._renderText(a)}case"thumbnail":{const a=String(e);return this._renderThumbnail(a)}case"timespanMs":{const a=Number(e);return this._renderMilliseconds({value:a})}case"url":{const a=String(e);return Ua.some((e=>a.startsWith(e)))?this.renderTextURL(a):this._renderCode(a)}default:return this._renderUnknown(a.valueType,e)}}_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,a){const n=this._dom.createElement("tr");for(const t of a){if(!t||!t.key){this._dom.createChildOf(n,"td","lh-table-column--empty");continue}const a=e[t.key];let i;if(null!=a&&(i=this._renderTableValue(a,t)),i){const e=`lh-table-column--${t.valueType}`;this._dom.createChildOf(n,"td",e).append(i)}else this._dom.createChildOf(n,"td","lh-table-column--empty")}return n}_renderTableRowsFromItem(e,a){const n=this._dom.createFragment();if(n.append(this._renderTableRow(e,a)),!e.subItems)return n;const t=a.map(this._getDerivedSubItemsHeading);if(!t.some(Boolean))return n;for(const a of e.subItems.items){const e=this._renderTableRow(a,t);e.classList.add("lh-sub-item-row"),n.append(e)}return n}_renderTable(e){if(!e.items.length)return this._dom.createElement("span");const a=this._dom.createElement("table","lh-table"),n=this._dom.createChildOf(a,"thead"),t=this._dom.createChildOf(n,"tr");for(const a of e.headings){const e=`lh-table-column--${a.valueType||"text"}`,n=this._dom.createElement("div","lh-text");n.textContent=a.label,this._dom.createChildOf(t,"th",e).append(n)}const i=this._dom.createChildOf(a,"tbody");let o=!0;for(const a of e.items){const n=this._renderTableRowsFromItem(a,e.headings);for(const e of this._dom.findAll("tr",n))e.classList.add(o?"lh-row--even":"lh-row--odd");o=!o,i.append(n)}return a}_renderList(e){const a=this._dom.createElement("div","lh-list");return e.items.forEach((e=>{const n=this.render(e);n&&a.append(n)})),a}renderNode(e){const a=this._dom.createElement("span","lh-node");if(e.nodeLabel){const n=this._dom.createElement("div");n.textContent=e.nodeLabel,a.append(n)}if(e.snippet){const n=this._dom.createElement("div");n.classList.add("lh-node__snippet"),n.textContent=e.snippet,a.append(n)}if(e.selector&&(a.title=e.selector),e.path&&a.setAttribute("data-path",e.path),e.selector&&a.setAttribute("data-selector",e.selector),e.snippet&&a.setAttribute("data-snippet",e.snippet),!this._fullPageScreenshot)return a;const n=e.lhId&&this._fullPageScreenshot.nodes[e.lhId];if(!n||0===n.width||0===n.height)return a;const t=Pa.render(this._dom,this._fullPageScreenshot.screenshot,n,{width:147,height:100});return t&&a.prepend(t),a}renderSourceLocation(e){if(!e.url)return null;const a=`${e.url}:${e.line+1}:${e.column}`;let n,t;if(e.original){n=`${e.original.file||"<unmapped>"}:${e.original.line+1}:${e.original.column}`}if("network"===e.urlProvider&&n)t=this._renderLink({url:e.url,text:n}),t.title=`maps to generated location ${a}`;else if("network"!==e.urlProvider||n)if("comment"===e.urlProvider&&n)t=this._renderText(`${n} (from source map)`),t.title=`${a} (from sourceURL)`;else{if("comment"!==e.urlProvider||n)return null;t=this._renderText(`${a} (from sourceURL)`)}else t=this.renderTextURL(e.url),this._dom.find(".lh-link",t).textContent+=`:${e.line+1}:${e.column}`;return t.classList.add("lh-source-location"),t.setAttribute("data-source-url",e.url),t.setAttribute("data-source-line",String(e.line)),t.setAttribute("data-source-column",String(e.column)),t}_renderFilmstrip(e){const a=this._dom.createElement("div","lh-filmstrip");for(const n of e.items){const e=this._dom.createChildOf(a,"div","lh-filmstrip__frame"),t=this._dom.createChildOf(e,"img","lh-filmstrip__thumbnail");t.src=n.data,t.alt="Screenshot"}return a}_renderCode(e){const a=this._dom.createElement("pre","lh-code");return a.textContent=e,a}}
|
|
105
105
|
/**
|
|
106
106
|
* @license
|
|
107
107
|
* Copyright 2018 The Lighthouse Authors. All Rights Reserved.
|
|
@@ -152,7 +152,7 @@ class Ca{constructor(e,a){this._document=e,this._lighthouseChannel="unknown",thi
|
|
|
152
152
|
*
|
|
153
153
|
* Dummy text for ensuring report robustness: <\/script> pre$`post %%LIGHTHOUSE_JSON%%
|
|
154
154
|
* (this is handled by terser)
|
|
155
|
-
*/class Na{constructor(e){this._dom=e,this._opts={}}renderReport(e,a,n){if(!this._dom.rootEl&&a){console.warn("Please adopt the new report API in renderer/api.js.");const e=a.closest(".lh-root");e?this._dom.rootEl=e:(a.classList.add("lh-root","lh-vars"),this._dom.rootEl=a)}else this._dom.rootEl&&a&&(this._dom.rootEl=a);n&&(this._opts=n),this._dom.setLighthouseChannel(e.configSettings.channel||"unknown");const t=de.prepareReportResult(e);return this._dom.rootEl.textContent="",this._dom.rootEl.append(this._renderReport(t)),this._dom.rootEl}_renderReportTopbar(e){const a=this._dom.createComponent("topbar"),n=this._dom.find("a.lh-topbar__url",a);return n.textContent=e.finalDisplayedUrl,n.title=e.finalDisplayedUrl,this._dom.safelySetHref(n,e.finalDisplayedUrl),a}_renderReportHeader(){const e=this._dom.createComponent("heading"),a=this._dom.createComponent("scoresWrapper");return this._dom.find(".lh-scores-wrapper-placeholder",e).replaceWith(a),e}_renderReportFooter(e){const a=this._dom.createComponent("footer");return this._renderMetaBlock(e,a),this._dom.find(".lh-footer__version_issue",a).textContent=de.i18n.strings.footerIssue,this._dom.find(".lh-footer__version",a).textContent=e.lighthouseVersion,a}_renderMetaBlock(e,a){const n=de.getEmulationDescriptions(e.configSettings||{}),t=e.userAgent.match(/(\w*Chrome\/[\d.]+)/),i=Array.isArray(t)?t[1].replace("/"," ").replace("Chrome","Chromium"):"Chromium",o=e.configSettings.channel,r=e.environment.benchmarkIndex.toFixed(0),s=e.environment.credits?.["axe-core"],l=[`${de.i18n.strings.runtimeSettingsBenchmark}: ${r}`,`${de.i18n.strings.runtimeSettingsCPUThrottling}: ${n.cpuThrottling}`];n.screenEmulation&&l.push(`${de.i18n.strings.runtimeSettingsScreenEmulation}: ${n.screenEmulation}`),s&&l.push(`${de.i18n.strings.runtimeSettingsAxeVersion}: ${s}`);const p=[["date",`Captured at ${de.i18n.formatDateTime(e.fetchTime)}`],["devices",`${n.deviceEmulation} with Lighthouse ${e.lighthouseVersion}`,l.join("\n")],["samples-one",de.i18n.strings.runtimeSingleLoad,de.i18n.strings.runtimeSingleLoadTooltip],["stopwatch",de.i18n.strings.runtimeAnalysisWindow],["networkspeed",`${n.summary}`,`${de.i18n.strings.runtimeSettingsNetworkThrottling}: ${n.networkThrottling}`],["chrome",`Using ${i}`+(o?` with ${o}`:""),`${de.i18n.strings.runtimeSettingsUANetwork}: "${e.environment.networkUserAgent}"`]],u=this._dom.find(".lh-meta__items",a);for(const[e,a,n]of p){const t=this._dom.createChildOf(u,"li","lh-meta__item");if(t.textContent=a,n){t.classList.add("lh-tooltip-boundary");this._dom.createChildOf(t,"div","lh-tooltip").textContent=n}t.classList.add("lh-report-icon",`lh-report-icon--${e}`)}}_renderReportWarnings(e){if(!e.runWarnings||0===e.runWarnings.length)return this._dom.createElement("div");const a=this._dom.createComponent("warningsToplevel");this._dom.find(".lh-warnings__msg",a).textContent=de.i18n.strings.toplevelWarningsMessage;const n=[];for(const a of e.runWarnings){const e=this._dom.createElement("li");e.append(this._dom.convertMarkdownLinkSnippets(a)),n.push(e)}return this._dom.find("ul",a).append(...n),a}_renderScoreGauges(e,a,n){const t=[],i=[],o=[];for(const r of Object.values(e.categories)){const s=n[r.id]||a,l=s.renderCategoryScore(r,e.categoryGroups||{},{gatherMode:e.gatherMode}),p=this._dom.find("a.lh-gauge__wrapper, a.lh-fraction__wrapper",l);p&&(this._dom.safelySetHref(p,`#${r.id}`),p.addEventListener("click",(e=>{if(!p.matches('[href^="#"]'))return;const a=p.getAttribute("href"),n=this._dom.rootEl;if(!a||!n)return;const t=this._dom.find(a,n);e.preventDefault(),t.scrollIntoView()})),this._opts.onPageAnchorRendered?.(p)),de.isPluginCategory(r.id)?o.push(l):s.renderCategoryScore===a.renderCategoryScore?t.push(l):i.push(l)}return[...t,...i,...o]}_renderReport(e){const a=new oa(e.configSettings.locale,{...de.UIStrings,...e.i18n.rendererFormattedStrings});de.i18n=a,de.reportJson=e;const n=
|
|
155
|
+
*/class Na{constructor(e){this._dom=e,this._opts={}}renderReport(e,a,n){if(!this._dom.rootEl&&a){console.warn("Please adopt the new report API in renderer/api.js.");const e=a.closest(".lh-root");e?this._dom.rootEl=e:(a.classList.add("lh-root","lh-vars"),this._dom.rootEl=a)}else this._dom.rootEl&&a&&(this._dom.rootEl=a);n&&(this._opts=n),this._dom.setLighthouseChannel(e.configSettings.channel||"unknown");const t=de.prepareReportResult(e);return this._dom.rootEl.textContent="",this._dom.rootEl.append(this._renderReport(t)),this._dom.rootEl}_renderReportTopbar(e){const a=this._dom.createComponent("topbar"),n=this._dom.find("a.lh-topbar__url",a);return n.textContent=e.finalDisplayedUrl,n.title=e.finalDisplayedUrl,this._dom.safelySetHref(n,e.finalDisplayedUrl),a}_renderReportHeader(){const e=this._dom.createComponent("heading"),a=this._dom.createComponent("scoresWrapper");return this._dom.find(".lh-scores-wrapper-placeholder",e).replaceWith(a),e}_renderReportFooter(e){const a=this._dom.createComponent("footer");return this._renderMetaBlock(e,a),this._dom.find(".lh-footer__version_issue",a).textContent=de.i18n.strings.footerIssue,this._dom.find(".lh-footer__version",a).textContent=e.lighthouseVersion,a}_renderMetaBlock(e,a){const n=de.getEmulationDescriptions(e.configSettings||{}),t=e.userAgent.match(/(\w*Chrome\/[\d.]+)/),i=Array.isArray(t)?t[1].replace("/"," ").replace("Chrome","Chromium"):"Chromium",o=e.configSettings.channel,r=e.environment.benchmarkIndex.toFixed(0),s=e.environment.credits?.["axe-core"],l=[`${de.i18n.strings.runtimeSettingsBenchmark}: ${r}`,`${de.i18n.strings.runtimeSettingsCPUThrottling}: ${n.cpuThrottling}`];n.screenEmulation&&l.push(`${de.i18n.strings.runtimeSettingsScreenEmulation}: ${n.screenEmulation}`),s&&l.push(`${de.i18n.strings.runtimeSettingsAxeVersion}: ${s}`);const p=[["date",`Captured at ${de.i18n.formatDateTime(e.fetchTime)}`],["devices",`${n.deviceEmulation} with Lighthouse ${e.lighthouseVersion}`,l.join("\n")],["samples-one",de.i18n.strings.runtimeSingleLoad,de.i18n.strings.runtimeSingleLoadTooltip],["stopwatch",de.i18n.strings.runtimeAnalysisWindow],["networkspeed",`${n.summary}`,`${de.i18n.strings.runtimeSettingsNetworkThrottling}: ${n.networkThrottling}`],["chrome",`Using ${i}`+(o?` with ${o}`:""),`${de.i18n.strings.runtimeSettingsUANetwork}: "${e.environment.networkUserAgent}"`]],u=this._dom.find(".lh-meta__items",a);for(const[e,a,n]of p){const t=this._dom.createChildOf(u,"li","lh-meta__item");if(t.textContent=a,n){t.classList.add("lh-tooltip-boundary");this._dom.createChildOf(t,"div","lh-tooltip").textContent=n}t.classList.add("lh-report-icon",`lh-report-icon--${e}`)}}_renderReportWarnings(e){if(!e.runWarnings||0===e.runWarnings.length)return this._dom.createElement("div");const a=this._dom.createComponent("warningsToplevel");this._dom.find(".lh-warnings__msg",a).textContent=de.i18n.strings.toplevelWarningsMessage;const n=[];for(const a of e.runWarnings){const e=this._dom.createElement("li");e.append(this._dom.convertMarkdownLinkSnippets(a)),n.push(e)}return this._dom.find("ul",a).append(...n),a}_renderScoreGauges(e,a,n){const t=[],i=[],o=[];for(const r of Object.values(e.categories)){const s=n[r.id]||a,l=s.renderCategoryScore(r,e.categoryGroups||{},{gatherMode:e.gatherMode}),p=this._dom.find("a.lh-gauge__wrapper, a.lh-fraction__wrapper",l);p&&(this._dom.safelySetHref(p,`#${r.id}`),p.addEventListener("click",(e=>{if(!p.matches('[href^="#"]'))return;const a=p.getAttribute("href"),n=this._dom.rootEl;if(!a||!n)return;const t=this._dom.find(a,n);e.preventDefault(),t.scrollIntoView()})),this._opts.onPageAnchorRendered?.(p)),de.isPluginCategory(r.id)?o.push(l):s.renderCategoryScore===a.renderCategoryScore?t.push(l):i.push(l)}return[...t,...i,...o]}_renderReport(e){const a=new oa(e.configSettings.locale,{...de.UIStrings,...e.i18n.rendererFormattedStrings});de.i18n=a,de.reportJson=e;const n=new xa(this._dom,{fullPageScreenshot:e.fullPageScreenshot??void 0}),t=new wa(this._dom,n),i={performance:new La(this._dom,n),pwa:new za(this._dom,n)},o=this._dom.createElement("div");o.append(this._renderReportHeader());const r=this._dom.createElement("div","lh-container"),s=this._dom.createElement("div","lh-report");let l;s.append(this._renderReportWarnings(e));1===Object.keys(e.categories).length?o.classList.add("lh-header--solo-category"):l=this._dom.createElement("div","lh-scores-header");const p=this._dom.createElement("div");if(p.classList.add("lh-scorescale-wrap"),p.append(this._dom.createComponent("scorescale")),l){const a=this._dom.find(".lh-scores-container",o);l.append(...this._renderScoreGauges(e,t,i)),a.append(l,p);const n=this._dom.createElement("div","lh-sticky-header");n.append(...this._renderScoreGauges(e,t,i)),r.append(n)}const u=this._dom.createElement("div","lh-categories");s.append(u);const c={gatherMode:e.gatherMode};for(const a of Object.values(e.categories)){const n=i[a.id]||t;n.dom.createChildOf(u,"div","lh-category-wrapper").append(n.render(a,e.categoryGroups,c))}t.injectFinalScreenshot(u,e.audits,p);const d=this._dom.createFragment();return this._opts.omitGlobalStyles||d.append(this._dom.createComponent("styles")),this._opts.omitTopbar||d.append(this._renderReportTopbar(e)),d.append(r),s.append(this._renderReportFooter(e)),r.append(o,s),e.fullPageScreenshot&&Pa.installFullPageScreenshot(this._dom.rootEl,e.fullPageScreenshot.screenshot),d}}
|
|
156
156
|
/**
|
|
157
157
|
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
158
158
|
* 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
|
|
@@ -194,7 +194,7 @@ class Ba{constructor(e){this._dom=e,this._toggleEl,this._menuEl,this.onDocumentK
|
|
|
194
194
|
* @license Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
195
195
|
* 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
|
|
196
196
|
* 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.
|
|
197
|
-
*/function Oa(e,a){const n=a?new Date(a):new Date,t=n.toLocaleTimeString("en-US",{hour12:!1}),i=n.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}).split("/");i.unshift(i.pop());return`${e}_${i.join("-")}_${t}`.replace(/[/?<>\\:*|"]/g,"-")}class Wa{constructor(e,a={}){this.json,this._dom=e,this._opts=a,this._topbar=a.omitTopbar?null:new Ha(this,e),this.onMediaQueryChange=this.onMediaQueryChange.bind(this)}initFeatures(e){this.json=e,this._topbar&&(this._topbar.enable(e),this._topbar.resetUIState()),this._setupMediaQueryListeners(),this._setupThirdPartyFilter(),this._setupElementScreenshotOverlay(this._dom.rootEl);const a=this._dom.isDevTools()||this._opts.disableDarkMode||this._opts.disableAutoDarkModeAndFireworks;!a&&window.matchMedia("(prefers-color-scheme: dark)").matches&&Ia(this._dom,!0);const n=["performance","accessibility","best-practices","seo"].every((a=>{const n=e.categories[a];return n&&1===n.score})),t=this._opts.disableFireworks||this._opts.disableAutoDarkModeAndFireworks;n&&!t&&(this._enableFireworks(),a||Ia(this._dom,!0));if(e.categories.performance&&e.categories.performance.auditRefs.some((a=>Boolean("metrics"===a.group&&e.audits[a.id].errorMessage)))){this._dom.find("input.lh-metrics-toggle__input",this._dom.rootEl).checked=!0}this.json.audits["script-treemap-data"]&&this.json.audits["script-treemap-data"].details&&this.addButton({text:de.i18n.strings.viewTreemapLabel,icon:"treemap",onClick:()=>function(e){if(!e.audits["script-treemap-data"].details)throw new Error("no script treemap data found");Ma({lhr:{mainDocumentUrl:e.mainDocumentUrl,finalUrl:e.finalUrl,finalDisplayedUrl:e.finalDisplayedUrl,audits:{"script-treemap-data":e.audits["script-treemap-data"]},configSettings:{locale:e.configSettings.locale}}},Ea()+"/treemap/","treemap-"+ja(e))}(this.json)}),this._opts.onViewTrace&&this.addButton({text:"simulate"===e.configSettings.throttlingMethod?de.i18n.strings.viewOriginalTraceLabel:de.i18n.strings.viewTraceLabel,onClick:()=>this._opts.onViewTrace?.()}),this._opts.getStandaloneReportHTML&&this._dom.find('a[data-action="save-html"]',this._dom.rootEl).classList.remove("lh-hidden");for(const e of this._dom.findAll("[data-i18n]",this._dom.rootEl)){const a=e.getAttribute("data-i18n");e.textContent=de.i18n.strings[a]}}addButton(e){const a=this._dom.rootEl.querySelector(".lh-audit-group--metrics");if(!a)return;let n=a.querySelector(".lh-buttons");n||(n=this._dom.createChildOf(a,"div","lh-buttons"));const t=["lh-button"];e.icon&&(t.push("lh-report-icon"),t.push(`lh-report-icon--${e.icon}`));const i=this._dom.createChildOf(n,"button",t.join(" "));return i.textContent=e.text,i.addEventListener("click",e.onClick),i}resetUIState(){this._topbar&&this._topbar.resetUIState()}getReportHtml(){if(!this._opts.getStandaloneReportHTML)throw new Error("`getStandaloneReportHTML` is not set");return this.resetUIState(),this._opts.getStandaloneReportHTML()}saveAsGist(){throw new Error("Cannot save as gist from base report")}_enableFireworks(){this._dom.find(".lh-scores-container",this._dom.rootEl).classList.add("lh-score100")}_setupMediaQueryListeners(){const e=self.matchMedia("(max-width: 500px)");e.addListener(this.onMediaQueryChange),this.onMediaQueryChange(e)}_resetUIState(){this._topbar&&this._topbar.resetUIState()}onMediaQueryChange(e){this._dom.rootEl.classList.toggle("lh-narrow",e.matches)}_setupThirdPartyFilter(){const e=["uses-rel-preconnect","third-party-facades"],a=["legacy-javascript"];Array.from(this._dom.rootEl.querySelectorAll("table.lh-table")).filter((e=>e.querySelector("td.lh-table-column--url, td.lh-table-column--source-location"))).filter((a=>{const n=a.closest(".lh-audit");if(!n)throw new Error(".lh-table not within audit");return!e.includes(n.id)})).forEach((e=>{const n=
|
|
197
|
+
*/function Oa(e,a){const n=a?new Date(a):new Date,t=n.toLocaleTimeString("en-US",{hour12:!1}),i=n.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}).split("/");i.unshift(i.pop());return`${e}_${i.join("-")}_${t}`.replace(/[/?<>\\:*|"]/g,"-")}class Wa{constructor(e,a={}){this.json,this._dom=e,this._opts=a,this._topbar=a.omitTopbar?null:new Ha(this,e),this.onMediaQueryChange=this.onMediaQueryChange.bind(this)}initFeatures(e){this.json=e,this._fullPageScreenshot=de.getFullPageScreenshot(e),this._topbar&&(this._topbar.enable(e),this._topbar.resetUIState()),this._setupMediaQueryListeners(),this._setupThirdPartyFilter(),this._setupElementScreenshotOverlay(this._dom.rootEl);const a=this._dom.isDevTools()||this._opts.disableDarkMode||this._opts.disableAutoDarkModeAndFireworks;!a&&window.matchMedia("(prefers-color-scheme: dark)").matches&&Ia(this._dom,!0);const n=["performance","accessibility","best-practices","seo"].every((a=>{const n=e.categories[a];return n&&1===n.score})),t=this._opts.disableFireworks||this._opts.disableAutoDarkModeAndFireworks;n&&!t&&(this._enableFireworks(),a||Ia(this._dom,!0));if(e.categories.performance&&e.categories.performance.auditRefs.some((a=>Boolean("metrics"===a.group&&e.audits[a.id].errorMessage)))){this._dom.find("input.lh-metrics-toggle__input",this._dom.rootEl).checked=!0}this.json.audits["script-treemap-data"]&&this.json.audits["script-treemap-data"].details&&this.addButton({text:de.i18n.strings.viewTreemapLabel,icon:"treemap",onClick:()=>function(e){if(!e.audits["script-treemap-data"].details)throw new Error("no script treemap data found");Ma({lhr:{mainDocumentUrl:e.mainDocumentUrl,finalUrl:e.finalUrl,finalDisplayedUrl:e.finalDisplayedUrl,audits:{"script-treemap-data":e.audits["script-treemap-data"]},configSettings:{locale:e.configSettings.locale}}},Ea()+"/treemap/","treemap-"+ja(e))}(this.json)}),this._opts.onViewTrace&&this.addButton({text:"simulate"===e.configSettings.throttlingMethod?de.i18n.strings.viewOriginalTraceLabel:de.i18n.strings.viewTraceLabel,onClick:()=>this._opts.onViewTrace?.()}),this._opts.getStandaloneReportHTML&&this._dom.find('a[data-action="save-html"]',this._dom.rootEl).classList.remove("lh-hidden");for(const e of this._dom.findAll("[data-i18n]",this._dom.rootEl)){const a=e.getAttribute("data-i18n");e.textContent=de.i18n.strings[a]}}addButton(e){const a=this._dom.rootEl.querySelector(".lh-audit-group--metrics");if(!a)return;let n=a.querySelector(".lh-buttons");n||(n=this._dom.createChildOf(a,"div","lh-buttons"));const t=["lh-button"];e.icon&&(t.push("lh-report-icon"),t.push(`lh-report-icon--${e.icon}`));const i=this._dom.createChildOf(n,"button",t.join(" "));return i.textContent=e.text,i.addEventListener("click",e.onClick),i}resetUIState(){this._topbar&&this._topbar.resetUIState()}getReportHtml(){if(!this._opts.getStandaloneReportHTML)throw new Error("`getStandaloneReportHTML` is not set");return this.resetUIState(),this._opts.getStandaloneReportHTML()}saveAsGist(){throw new Error("Cannot save as gist from base report")}_enableFireworks(){this._dom.find(".lh-scores-container",this._dom.rootEl).classList.add("lh-score100")}_setupMediaQueryListeners(){const e=self.matchMedia("(max-width: 500px)");e.addListener(this.onMediaQueryChange),this.onMediaQueryChange(e)}_resetUIState(){this._topbar&&this._topbar.resetUIState()}onMediaQueryChange(e){this._dom.rootEl.classList.toggle("lh-narrow",e.matches)}_setupThirdPartyFilter(){const e=["uses-rel-preconnect","third-party-facades"],a=["legacy-javascript"];Array.from(this._dom.rootEl.querySelectorAll("table.lh-table")).filter((e=>e.querySelector("td.lh-table-column--url, td.lh-table-column--source-location"))).filter((a=>{const n=a.closest(".lh-audit");if(!n)throw new Error(".lh-table not within audit");return!e.includes(n.id)})).forEach((e=>{const n=
|
|
198
198
|
/**
|
|
199
199
|
* @license
|
|
200
200
|
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
@@ -211,7 +211,7 @@ class Ba{constructor(e){this._dom=e,this._toggleEl,this._menuEl,this.onDocumentK
|
|
|
211
211
|
* See the License for the specific language governing permissions and
|
|
212
212
|
* limitations under the License.
|
|
213
213
|
*/
|
|
214
|
-
function(e){return Array.from(e.tBodies[0].rows)}(e),t=this._getThirdPartyRows(n,de.getFinalDisplayedUrl(this.json)),i=this._dom.createComponent("3pFilter"),o=this._dom.find("input",i);o.addEventListener("change",(e=>{const a=e.target instanceof HTMLInputElement&&!e.target.checked;let i=!0,o=n[0];for(;o;){const e=a&&t.includes(o);do{o.classList.toggle("lh-row--hidden",e),o.classList.toggle("lh-row--even",!e&&i),o.classList.toggle("lh-row--odd",!e&&!i),o=o.nextElementSibling}while(o&&o.classList.contains("lh-sub-item-row"));e||(i=!i)}})),this._dom.find(".lh-3p-filter-count",i).textContent=`${t.length}`,this._dom.find(".lh-3p-ui-string",i).textContent=de.i18n.strings.thirdPartyResourcesLabel;const r=t.length===n.length,s=!t.length;if((r||s)&&(this._dom.find("div.lh-3p-filter",i).hidden=!0),!e.parentNode)return;e.parentNode.insertBefore(i,e);const l=e.closest(".lh-audit");if(!l)throw new Error(".lh-table not within audit");a.includes(l.id)&&!r&&o.click()}))}_setupElementScreenshotOverlay(e){
|
|
214
|
+
function(e){return Array.from(e.tBodies[0].rows)}(e),t=this._getThirdPartyRows(n,de.getFinalDisplayedUrl(this.json)),i=this._dom.createComponent("3pFilter"),o=this._dom.find("input",i);o.addEventListener("change",(e=>{const a=e.target instanceof HTMLInputElement&&!e.target.checked;let i=!0,o=n[0];for(;o;){const e=a&&t.includes(o);do{o.classList.toggle("lh-row--hidden",e),o.classList.toggle("lh-row--even",!e&&i),o.classList.toggle("lh-row--odd",!e&&!i),o=o.nextElementSibling}while(o&&o.classList.contains("lh-sub-item-row"));e||(i=!i)}})),this._dom.find(".lh-3p-filter-count",i).textContent=`${t.length}`,this._dom.find(".lh-3p-ui-string",i).textContent=de.i18n.strings.thirdPartyResourcesLabel;const r=t.length===n.length,s=!t.length;if((r||s)&&(this._dom.find("div.lh-3p-filter",i).hidden=!0),!e.parentNode)return;e.parentNode.insertBefore(i,e);const l=e.closest(".lh-audit");if(!l)throw new Error(".lh-table not within audit");a.includes(l.id)&&!r&&o.click()}))}_setupElementScreenshotOverlay(e){this._fullPageScreenshot&&Pa.installOverlayFeature({dom:this._dom,rootEl:e,overlayContainerEl:e,fullPageScreenshot:this._fullPageScreenshot})}_getThirdPartyRows(e,a){const n=[],t=de.getRootDomain(a);for(const a of e){if(a.classList.contains("lh-sub-item-row"))continue;const e=a.querySelector("div.lh-text__url");if(!e)continue;const i=e.dataset.url;if(!i)continue;de.getRootDomain(i)!==t&&n.push(a)}return n}_saveFile(e){const a=e.type.match("json")?".json":".html",n=(t={finalDisplayedUrl:de.getFinalDisplayedUrl(this.json),fetchTime:this.json.fetchTime},Oa(new URL(t.finalDisplayedUrl).hostname,t.fetchTime)+a);var t;this._opts.onSaveFileOverride?this._opts.onSaveFileOverride(e,n):this._dom.saveFile(e,n)}}
|
|
215
215
|
/**
|
|
216
216
|
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
217
217
|
* 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
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/const e="…",t="data:image/jpeg;base64,",n={label:"pass",minScore:.9},r={label:"average",minScore:.5},o={label:"fail"},i={label:"error"},a=["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 l{static i18n=null;static get PASS_THRESHOLD(){return.9}static get MS_DISPLAY_VALUE(){return"%10d ms"}static getFinalDisplayedUrl(e){if(e.finalDisplayedUrl)return e.finalDisplayedUrl;if(e.finalUrl)return e.finalUrl;throw new Error("Could not determine final displayed URL")}static getMainDocumentUrl(e){return e.mainDocumentUrl||e.finalUrl}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),n.finalDisplayedUrl=this.getFinalDisplayedUrl(n),n.mainDocumentUrl=this.getMainDocumentUrl(n);for(const e of Object.values(n.audits))if("not_applicable"!==e.scoreDisplayMode&&"not-applicable"!==e.scoreDisplayMode||(e.scoreDisplayMode="notApplicable"),e.details){if(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("table"===e.details.type)for(const t of e.details.headings){const{itemType:e,text:n}=t;void 0!==e&&(t.valueType=e,delete t.itemType),void 0!==n&&(t.label=n,delete t.text);const r=t.subItemsHeading?.itemType;t.subItemsHeading&&void 0!==r&&(t.subItemsHeading.valueType=r,delete t.subItemsHeading.itemType)}}if("object"!=typeof n.categories)throw new Error("No categories provided.");const r=new Map,[o]=n.lighthouseVersion.split(".").map(Number),i=n.categories.performance;if(o<9&&i){n.categoryGroups||(n.categoryGroups={}),n.categoryGroups.hidden={title:""};for(const e of i.auditRefs)e.group?["load-opportunities","diagnostics"].includes(e.group)&&delete e.group:e.group="hidden"}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 i.label;if(null===e)return o.label;let a=o.label;return e>=n.minScore?a=n.label:e>=r.minScore&&(a=r.label),a}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 o=e%2!=0;t.push({isCode:o,text:r})}return t}static splitMarkdownLink(e){const t=[],n=e.split(/\[([^\]]+?)\]\((https?:\/\/.*?)\)/g);for(;n.length;){const[e,r,o]=n.splice(0,3);e&&t.push({isLink:!1,text:e}),r&&o&&t.push({isLink:!0,text:r,linkHref:o})}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,o=void 0===n.preserveQuery||n.preserveQuery,i=n.preserveHost||!1;let a;if("about:"===t.protocol||"data:"===t.protocol)a=t.href;else{a=t.pathname;const n=a.split("/").filter((e=>e.length));r&&n.length>r&&(a=e+n.slice(-1*r).join("/")),i&&(a=`${t.host}/${a.replace(/^\//,"")}`),o&&(a=`${a}${t.search}`)}if("data:"!==t.protocol&&(a=a.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g,"$1…"),a=a.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,"$1…"),a=a.replace(/(\d{3})\d{6,}/g,"$1…"),a=a.replace(/\u2026+/g,e),a.length>64&&a.includes("?")&&(a=a.replace(/\?([^=]*)(=)?.*/,"?$1$2…"),a.length>64&&(a=a.replace(/\?.*/,"?…")))),a.length>64){const t=a.lastIndexOf(".");a=t>=0?a.slice(0,63-(a.length-t))+`…${a.slice(t)}`:a.slice(0,63)+e}return a}static parseURL(e){const t=new URL(e);return{file:l.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 a.includes(t[0])?`.${t.join(".")}`:`.${t[t.length-1]}`}static getRootDomain(e){const t=l.createOrReturnURL(e).hostname,n=l.getTld(t).split(".");return t.split(".").slice(-n.length).join(".")}static getEmulationDescriptions(e){let t,n,r;const o=e.throttling;switch(e.throttlingMethod){case"provided":r=n=t=l.i18n.strings.throttlingProvided;break;case"devtools":{const{cpuSlowdownMultiplier:e,requestLatencyMs:i}=o;t=`${l.i18n.formatNumber(e)}x slowdown (DevTools)`,n=`${l.i18n.formatMilliseconds(i)} HTTP RTT, ${l.i18n.formatKbps(o.downloadThroughputKbps)} down, ${l.i18n.formatKbps(o.uploadThroughputKbps)} up (DevTools)`;r=(()=>562.5===i&&o.downloadThroughputKbps===1638.4*.9&&675===o.uploadThroughputKbps)()?l.i18n.strings.runtimeSlow4g:l.i18n.strings.runtimeCustom;break}case"simulate":{const{cpuSlowdownMultiplier:e,rttMs:i,throughputKbps:a}=o;t=`${l.i18n.formatNumber(e)}x slowdown (Simulated)`,n=`${l.i18n.formatMilliseconds(i)} TCP RTT, ${l.i18n.formatKbps(a)} throughput (Simulated)`;r=(()=>150===i&&1638.4===a)()?l.i18n.strings.runtimeSlow4g:l.i18n.strings.runtimeCustom;break}default:r=t=n=l.i18n.strings.runtimeUnknown}const i="devtools"!==e.channel&&e.screenEmulation.disabled,a="devtools"===e.channel?"mobile"===e.formFactor:e.screenEmulation.mobile;let s=l.i18n.strings.runtimeMobileEmulation;i?s=l.i18n.strings.runtimeNoEmulation:a||(s=l.i18n.strings.runtimeDesktopEmulation);return{deviceEmulation:s,screenEmulation:i?void 0:`${e.screenEmulation.width}x${e.screenEmulation.height}, DPR ${e.screenEmulation.deviceScaleFactor}`,cpuThrottling:t,networkThrottling:n,summary:r}}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,o=e+n;for(;t<1;)t++,o++;r.has(t-3-1)&&(t-=3);for(let e=t;e<=o;e++){const t=e;r.add(t)}})),e.filter((e=>r.has(e.lineNumber)))}static isPluginCategory(e){return e.startsWith("lighthouse-plugin-")}static shouldDisplayAsFraction(e){return"timespan"===e||"snapshot"===e}static calculateCategoryFraction(e){let t=0,n=0,r=0,o=0;for(const i of e.auditRefs){const e=l.showAsPassed(i.result);"hidden"!==i.group&&"manual"!==i.result.scoreDisplayMode&&"notApplicable"!==i.result.scoreDisplayMode&&("informative"!==i.result.scoreDisplayMode?(++t,o+=i.weight,e&&n++):e||++r)}return{numPassed:n,numPassableAudits:t,numInformative:r,totalWeight:o}}}l.reportJson=null;let s=0;l.getUniqueSuffix=()=>s++,l.resetUniqueSuffix=()=>{s=0};l.UIStrings={varianceDisclaimer:"Values are estimated and may vary. The [performance score is calculated](https://developer.chrome.com/docs/lighthouse/performance/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",viewTraceLabel:"View Trace",viewOriginalTraceLabel:"View Original Trace",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",runtimeSettingsDevice:"Device",runtimeSettingsNetworkThrottling:"Network throttling",runtimeSettingsCPUThrottling:"CPU throttling",runtimeSettingsUANetwork:"User agent (network)",runtimeSettingsBenchmark:"CPU/Memory Power",runtimeSettingsAxeVersion:"Axe version",runtimeSettingsScreenEmulation:"Screen emulation",footerIssue:"File an issue",runtimeNoEmulation:"No emulation",runtimeMobileEmulation:"Emulated Moto G4",runtimeDesktopEmulation:"Emulated Desktop",runtimeUnknown:"Unknown",runtimeSingleLoad:"Single page load",runtimeAnalysisWindow:"Initial page load",runtimeSingleLoadTooltip:"This data is taken from a single page load, as opposed to field data summarizing many sessions.",throttlingProvided:"Provided by environment",show:"Show",hide:"Hide",expandView:"Expand view",collapseView:"Collapse view",runtimeSlow4g:"Slow 4G throttling",runtimeCustom:"Custom throttling"};
|
|
17
|
+
*/const e="…",t="data:image/jpeg;base64,",n={label:"pass",minScore:.9},r={label:"average",minScore:.5},o={label:"fail"},i={label:"error"},a=["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 l{static i18n=null;static get PASS_THRESHOLD(){return.9}static get MS_DISPLAY_VALUE(){return"%10d ms"}static getFinalDisplayedUrl(e){if(e.finalDisplayedUrl)return e.finalDisplayedUrl;if(e.finalUrl)return e.finalUrl;throw new Error("Could not determine final displayed URL")}static getMainDocumentUrl(e){return e.mainDocumentUrl||e.finalUrl}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),n.finalDisplayedUrl=this.getFinalDisplayedUrl(n),n.mainDocumentUrl=this.getMainDocumentUrl(n);for(const e of Object.values(n.audits))if("not_applicable"!==e.scoreDisplayMode&&"not-applicable"!==e.scoreDisplayMode||(e.scoreDisplayMode="notApplicable"),e.details){if(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("table"===e.details.type)for(const t of e.details.headings){const{itemType:e,text:n}=t;void 0!==e&&(t.valueType=e,delete t.itemType),void 0!==n&&(t.label=n,delete t.text);const r=t.subItemsHeading?.itemType;t.subItemsHeading&&void 0!==r&&(t.subItemsHeading.valueType=r,delete t.subItemsHeading.itemType)}}if("object"!=typeof n.categories)throw new Error("No categories provided.");const r=new Map,[o]=n.lighthouseVersion.split(".").map(Number),i=n.categories.performance;if(o<9&&i){n.categoryGroups||(n.categoryGroups={}),n.categoryGroups.hidden={title:""};for(const e of i.auditRefs)e.group?["load-opportunities","diagnostics"].includes(e.group)&&delete e.group:e.group="hidden"}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]}))}))}));if(n.audits["full-page-screenshot"]){const e=n.audits["full-page-screenshot"].details;n.fullPageScreenshot=e?{screenshot:e.screenshot,nodes:e.nodes}:null,delete n.audits["full-page-screenshot"]}return n}static getFullPageScreenshot(e){if(e.fullPageScreenshot)return e.fullPageScreenshot;return e.audits["full-page-screenshot"]?.details}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 i.label;if(null===e)return o.label;let a=o.label;return e>=n.minScore?a=n.label:e>=r.minScore&&(a=r.label),a}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 o=e%2!=0;t.push({isCode:o,text:r})}return t}static splitMarkdownLink(e){const t=[],n=e.split(/\[([^\]]+?)\]\((https?:\/\/.*?)\)/g);for(;n.length;){const[e,r,o]=n.splice(0,3);e&&t.push({isLink:!1,text:e}),r&&o&&t.push({isLink:!0,text:r,linkHref:o})}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,o=void 0===n.preserveQuery||n.preserveQuery,i=n.preserveHost||!1;let a;if("about:"===t.protocol||"data:"===t.protocol)a=t.href;else{a=t.pathname;const n=a.split("/").filter((e=>e.length));r&&n.length>r&&(a=e+n.slice(-1*r).join("/")),i&&(a=`${t.host}/${a.replace(/^\//,"")}`),o&&(a=`${a}${t.search}`)}if("data:"!==t.protocol&&(a=a.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g,"$1…"),a=a.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,"$1…"),a=a.replace(/(\d{3})\d{6,}/g,"$1…"),a=a.replace(/\u2026+/g,e),a.length>64&&a.includes("?")&&(a=a.replace(/\?([^=]*)(=)?.*/,"?$1$2…"),a.length>64&&(a=a.replace(/\?.*/,"?…")))),a.length>64){const t=a.lastIndexOf(".");a=t>=0?a.slice(0,63-(a.length-t))+`…${a.slice(t)}`:a.slice(0,63)+e}return a}static parseURL(e){const t=new URL(e);return{file:l.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 a.includes(t[0])?`.${t.join(".")}`:`.${t[t.length-1]}`}static getRootDomain(e){const t=l.createOrReturnURL(e).hostname,n=l.getTld(t).split(".");return t.split(".").slice(-n.length).join(".")}static getEmulationDescriptions(e){let t,n,r;const o=e.throttling;switch(e.throttlingMethod){case"provided":r=n=t=l.i18n.strings.throttlingProvided;break;case"devtools":{const{cpuSlowdownMultiplier:e,requestLatencyMs:i}=o;t=`${l.i18n.formatNumber(e)}x slowdown (DevTools)`,n=`${l.i18n.formatMilliseconds(i)} HTTP RTT, ${l.i18n.formatKbps(o.downloadThroughputKbps)} down, ${l.i18n.formatKbps(o.uploadThroughputKbps)} up (DevTools)`;r=(()=>562.5===i&&o.downloadThroughputKbps===1638.4*.9&&675===o.uploadThroughputKbps)()?l.i18n.strings.runtimeSlow4g:l.i18n.strings.runtimeCustom;break}case"simulate":{const{cpuSlowdownMultiplier:e,rttMs:i,throughputKbps:a}=o;t=`${l.i18n.formatNumber(e)}x slowdown (Simulated)`,n=`${l.i18n.formatMilliseconds(i)} TCP RTT, ${l.i18n.formatKbps(a)} throughput (Simulated)`;r=(()=>150===i&&1638.4===a)()?l.i18n.strings.runtimeSlow4g:l.i18n.strings.runtimeCustom;break}default:r=t=n=l.i18n.strings.runtimeUnknown}const i="devtools"!==e.channel&&e.screenEmulation.disabled,a="devtools"===e.channel?"mobile"===e.formFactor:e.screenEmulation.mobile;let s=l.i18n.strings.runtimeMobileEmulation;i?s=l.i18n.strings.runtimeNoEmulation:a||(s=l.i18n.strings.runtimeDesktopEmulation);return{deviceEmulation:s,screenEmulation:i?void 0:`${e.screenEmulation.width}x${e.screenEmulation.height}, DPR ${e.screenEmulation.deviceScaleFactor}`,cpuThrottling:t,networkThrottling:n,summary:r}}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,o=e+n;for(;t<1;)t++,o++;r.has(t-3-1)&&(t-=3);for(let e=t;e<=o;e++){const t=e;r.add(t)}})),e.filter((e=>r.has(e.lineNumber)))}static isPluginCategory(e){return e.startsWith("lighthouse-plugin-")}static shouldDisplayAsFraction(e){return"timespan"===e||"snapshot"===e}static calculateCategoryFraction(e){let t=0,n=0,r=0,o=0;for(const i of e.auditRefs){const e=l.showAsPassed(i.result);"hidden"!==i.group&&"manual"!==i.result.scoreDisplayMode&&"notApplicable"!==i.result.scoreDisplayMode&&("informative"!==i.result.scoreDisplayMode?(++t,o+=i.weight,e&&n++):e||++r)}return{numPassed:n,numPassableAudits:t,numInformative:r,totalWeight:o}}}l.reportJson=null;let s=0;l.getUniqueSuffix=()=>s++,l.resetUniqueSuffix=()=>{s=0};l.UIStrings={varianceDisclaimer:"Values are estimated and may vary. The [performance score is calculated](https://developer.chrome.com/docs/lighthouse/performance/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",viewTraceLabel:"View Trace",viewOriginalTraceLabel:"View Original Trace",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",runtimeSettingsDevice:"Device",runtimeSettingsNetworkThrottling:"Network throttling",runtimeSettingsCPUThrottling:"CPU throttling",runtimeSettingsUANetwork:"User agent (network)",runtimeSettingsBenchmark:"CPU/Memory Power",runtimeSettingsAxeVersion:"Axe version",runtimeSettingsScreenEmulation:"Screen emulation",footerIssue:"File an issue",runtimeNoEmulation:"No emulation",runtimeMobileEmulation:"Emulated Moto G4",runtimeDesktopEmulation:"Emulated Desktop",runtimeUnknown:"Unknown",runtimeSingleLoad:"Single page load",runtimeAnalysisWindow:"Initial page load",runtimeSingleLoadTooltip:"This data is taken from a single page load, as opposed to field data summarizing many sessions.",throttlingProvided:"Provided by environment",show:"Show",hide:"Hide",expandView:"Expand view",collapseView:"Collapse view",runtimeSlow4g:"Slow 4G throttling",runtimeCustom:"Custom throttling"};
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
@@ -84,7 +84,7 @@ class c{constructor(e,t){this._document=e,this._lighthouseChannel="unknown",this
|
|
|
84
84
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
85
85
|
* See the License for the specific language governing permissions and
|
|
86
86
|
* limitations under the License.
|
|
87
|
-
*/const m=["http://","https://","data:"];class f{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":case"opportunity":return this._renderTable(e);case"criticalrequestchain":return h.render(this._dom,e,this);case"screenshot":case"debugdata":case"
|
|
87
|
+
*/const m=["http://","https://","data:"];class f{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":case"opportunity":return this._renderTable(e);case"criticalrequestchain":return h.render(this._dom,e,this);case"screenshot":case"debugdata":case"treemap-data":return null;default:return this._renderUnknown(e.type,e)}}_renderBytes(e){const t=l.i18n.formatBytesToKiB(e.value,e.granularity||.1),n=this._renderText(t);return n.title=l.i18n.formatBytes(e.value),n}_renderMilliseconds(e){let t;return t="duration"===e.displayUnit?l.i18n.formatDuration(e.value):l.i18n.formatMilliseconds(e.value,e.granularity||10),this._renderText(t)}renderTextURL(e){const t=e;let n,r,o;try{const e=l.parseURL(t);n="/"===e.file?e.origin:e.file,r="/"===e.file||""===e.hostname?"":`(${e.hostname})`,o=t}catch(e){n=t}const i=this._dom.createElement("div","lh-text__url");if(i.append(this._renderLink({text:n,url:t})),r){const e=this._renderText(r);e.classList.add("lh-text__url-host"),i.append(e)}return o&&(i.title=t,i.dataset.url=t),i}_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=l.i18n.formatNumber(e.value,e.granularity||.1),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 m.some((e=>t.startsWith(e)))?this.renderTextURL(t):this._renderCode(t)}default:return this._renderUnknown(t.valueType,e)}}_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 o;if(null!=t&&(o=this._renderTableValue(t,r)),o){const e=`lh-table-column--${r.valueType}`;this._dom.createChildOf(n,"td",e).append(o)}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");for(const t of e.headings){const e=`lh-table-column--${t.valueType||"text"}`,n=this._dom.createElement("div","lh-text");n.textContent=t.label,this._dom.createChildOf(r,"th",e).append(n)}const o=this._dom.createChildOf(t,"tbody");let i=!0;for(const t of e.items){const n=this._renderTableRowsFromItem(t,e.headings);for(const e of this._dom.findAll("tr",n))e.classList.add(i?"lh-row--even":"lh-row--odd");i=!i,o.append(n)}return t}_renderList(e){const t=this._dom.createElement("div","lh-list");return e.items.forEach((e=>{const n=this.render(e);n&&t.append(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.append(n)}if(e.snippet){const n=this._dom.createElement("div");n.classList.add("lh-node__snippet"),n.textContent=e.snippet,t.append(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=g.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}}
|
|
88
88
|
/**
|
|
89
89
|
* @license Copyright 2020 The Lighthouse Authors. All Rights Reserved.
|
|
90
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
|
|
@@ -140,7 +140,7 @@ class c{constructor(e,t){this._document=e,this._lighthouseChannel="unknown",this
|
|
|
140
140
|
*
|
|
141
141
|
* Dummy text for ensuring report robustness: <\/script> pre$`post %%LIGHTHOUSE_JSON%%
|
|
142
142
|
* (this is handled by terser)
|
|
143
|
-
*/class x{constructor(e){this._dom=e,this._opts={}}renderReport(e,t,n){if(!this._dom.rootEl&&t){console.warn("Please adopt the new report API in renderer/api.js.");const e=t.closest(".lh-root");e?this._dom.rootEl=e:(t.classList.add("lh-root","lh-vars"),this._dom.rootEl=t)}else this._dom.rootEl&&t&&(this._dom.rootEl=t);n&&(this._opts=n),this._dom.setLighthouseChannel(e.configSettings.channel||"unknown");const r=l.prepareReportResult(e);return this._dom.rootEl.textContent="",this._dom.rootEl.append(this._renderReport(r)),this._dom.rootEl}_renderReportTopbar(e){const t=this._dom.createComponent("topbar"),n=this._dom.find("a.lh-topbar__url",t);return n.textContent=e.finalDisplayedUrl,n.title=e.finalDisplayedUrl,this._dom.safelySetHref(n,e.finalDisplayedUrl),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");return this._renderMetaBlock(e,t),this._dom.find(".lh-footer__version_issue",t).textContent=l.i18n.strings.footerIssue,this._dom.find(".lh-footer__version",t).textContent=e.lighthouseVersion,t}_renderMetaBlock(e,t){const n=l.getEmulationDescriptions(e.configSettings||{}),r=e.userAgent.match(/(\w*Chrome\/[\d.]+)/),o=Array.isArray(r)?r[1].replace("/"," ").replace("Chrome","Chromium"):"Chromium",i=e.configSettings.channel,a=e.environment.benchmarkIndex.toFixed(0),s=e.environment.credits?.["axe-core"],c=[`${l.i18n.strings.runtimeSettingsBenchmark}: ${a}`,`${l.i18n.strings.runtimeSettingsCPUThrottling}: ${n.cpuThrottling}`];n.screenEmulation&&c.push(`${l.i18n.strings.runtimeSettingsScreenEmulation}: ${n.screenEmulation}`),s&&c.push(`${l.i18n.strings.runtimeSettingsAxeVersion}: ${s}`);const d=[["date",`Captured at ${l.i18n.formatDateTime(e.fetchTime)}`],["devices",`${n.deviceEmulation} with Lighthouse ${e.lighthouseVersion}`,c.join("\n")],["samples-one",l.i18n.strings.runtimeSingleLoad,l.i18n.strings.runtimeSingleLoadTooltip],["stopwatch",l.i18n.strings.runtimeAnalysisWindow],["networkspeed",`${n.summary}`,`${l.i18n.strings.runtimeSettingsNetworkThrottling}: ${n.networkThrottling}`],["chrome",`Using ${o}`+(i?` with ${i}`:""),`${l.i18n.strings.runtimeSettingsUANetwork}: "${e.environment.networkUserAgent}"`]],h=this._dom.find(".lh-meta__items",t);for(const[e,t,n]of d){const r=this._dom.createChildOf(h,"li","lh-meta__item");if(r.textContent=t,n){r.classList.add("lh-tooltip-boundary");this._dom.createChildOf(r,"div","lh-tooltip").textContent=n}r.classList.add("lh-report-icon",`lh-report-icon--${e}`)}}_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=l.i18n.strings.toplevelWarningsMessage;const n=[];for(const t of e.runWarnings){const e=this._dom.createElement("li");e.append(this._dom.convertMarkdownLinkSnippets(t)),n.push(e)}return this._dom.find("ul",t).append(...n),t}_renderScoreGauges(e,t,n){const r=[],o=[],i=[];for(const a of Object.values(e.categories)){const s=n[a.id]||t,c=s.renderCategoryScore(a,e.categoryGroups||{},{gatherMode:e.gatherMode}),d=this._dom.find("a.lh-gauge__wrapper, a.lh-fraction__wrapper",c);d&&(this._dom.safelySetHref(d,`#${a.id}`),d.addEventListener("click",(e=>{if(!d.matches('[href^="#"]'))return;const t=d.getAttribute("href"),n=this._dom.rootEl;if(!t||!n)return;const r=this._dom.find(t,n);e.preventDefault(),r.scrollIntoView()})),this._opts.onPageAnchorRendered?.(d)),l.isPluginCategory(a.id)?i.push(c):s.renderCategoryScore===t.renderCategoryScore?r.push(c):o.push(c)}return[...r,...o,...i]}_renderReport(e){const t=new _(e.configSettings.locale,{...l.UIStrings,...e.i18n.rendererFormattedStrings});l.i18n=t,l.reportJson=e;const n=
|
|
143
|
+
*/class x{constructor(e){this._dom=e,this._opts={}}renderReport(e,t,n){if(!this._dom.rootEl&&t){console.warn("Please adopt the new report API in renderer/api.js.");const e=t.closest(".lh-root");e?this._dom.rootEl=e:(t.classList.add("lh-root","lh-vars"),this._dom.rootEl=t)}else this._dom.rootEl&&t&&(this._dom.rootEl=t);n&&(this._opts=n),this._dom.setLighthouseChannel(e.configSettings.channel||"unknown");const r=l.prepareReportResult(e);return this._dom.rootEl.textContent="",this._dom.rootEl.append(this._renderReport(r)),this._dom.rootEl}_renderReportTopbar(e){const t=this._dom.createComponent("topbar"),n=this._dom.find("a.lh-topbar__url",t);return n.textContent=e.finalDisplayedUrl,n.title=e.finalDisplayedUrl,this._dom.safelySetHref(n,e.finalDisplayedUrl),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");return this._renderMetaBlock(e,t),this._dom.find(".lh-footer__version_issue",t).textContent=l.i18n.strings.footerIssue,this._dom.find(".lh-footer__version",t).textContent=e.lighthouseVersion,t}_renderMetaBlock(e,t){const n=l.getEmulationDescriptions(e.configSettings||{}),r=e.userAgent.match(/(\w*Chrome\/[\d.]+)/),o=Array.isArray(r)?r[1].replace("/"," ").replace("Chrome","Chromium"):"Chromium",i=e.configSettings.channel,a=e.environment.benchmarkIndex.toFixed(0),s=e.environment.credits?.["axe-core"],c=[`${l.i18n.strings.runtimeSettingsBenchmark}: ${a}`,`${l.i18n.strings.runtimeSettingsCPUThrottling}: ${n.cpuThrottling}`];n.screenEmulation&&c.push(`${l.i18n.strings.runtimeSettingsScreenEmulation}: ${n.screenEmulation}`),s&&c.push(`${l.i18n.strings.runtimeSettingsAxeVersion}: ${s}`);const d=[["date",`Captured at ${l.i18n.formatDateTime(e.fetchTime)}`],["devices",`${n.deviceEmulation} with Lighthouse ${e.lighthouseVersion}`,c.join("\n")],["samples-one",l.i18n.strings.runtimeSingleLoad,l.i18n.strings.runtimeSingleLoadTooltip],["stopwatch",l.i18n.strings.runtimeAnalysisWindow],["networkspeed",`${n.summary}`,`${l.i18n.strings.runtimeSettingsNetworkThrottling}: ${n.networkThrottling}`],["chrome",`Using ${o}`+(i?` with ${i}`:""),`${l.i18n.strings.runtimeSettingsUANetwork}: "${e.environment.networkUserAgent}"`]],h=this._dom.find(".lh-meta__items",t);for(const[e,t,n]of d){const r=this._dom.createChildOf(h,"li","lh-meta__item");if(r.textContent=t,n){r.classList.add("lh-tooltip-boundary");this._dom.createChildOf(r,"div","lh-tooltip").textContent=n}r.classList.add("lh-report-icon",`lh-report-icon--${e}`)}}_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=l.i18n.strings.toplevelWarningsMessage;const n=[];for(const t of e.runWarnings){const e=this._dom.createElement("li");e.append(this._dom.convertMarkdownLinkSnippets(t)),n.push(e)}return this._dom.find("ul",t).append(...n),t}_renderScoreGauges(e,t,n){const r=[],o=[],i=[];for(const a of Object.values(e.categories)){const s=n[a.id]||t,c=s.renderCategoryScore(a,e.categoryGroups||{},{gatherMode:e.gatherMode}),d=this._dom.find("a.lh-gauge__wrapper, a.lh-fraction__wrapper",c);d&&(this._dom.safelySetHref(d,`#${a.id}`),d.addEventListener("click",(e=>{if(!d.matches('[href^="#"]'))return;const t=d.getAttribute("href"),n=this._dom.rootEl;if(!t||!n)return;const r=this._dom.find(t,n);e.preventDefault(),r.scrollIntoView()})),this._opts.onPageAnchorRendered?.(d)),l.isPluginCategory(a.id)?i.push(c):s.renderCategoryScore===t.renderCategoryScore?r.push(c):o.push(c)}return[...r,...o,...i]}_renderReport(e){const t=new _(e.configSettings.locale,{...l.UIStrings,...e.i18n.rendererFormattedStrings});l.i18n=t,l.reportJson=e;const n=new f(this._dom,{fullPageScreenshot:e.fullPageScreenshot??void 0}),r=new d(this._dom,n),o={performance:new w(this._dom,n),pwa:new y(this._dom,n)},i=this._dom.createElement("div");i.append(this._renderReportHeader());const a=this._dom.createElement("div","lh-container"),s=this._dom.createElement("div","lh-report");let c;s.append(this._renderReportWarnings(e));1===Object.keys(e.categories).length?i.classList.add("lh-header--solo-category"):c=this._dom.createElement("div","lh-scores-header");const h=this._dom.createElement("div");if(h.classList.add("lh-scorescale-wrap"),h.append(this._dom.createComponent("scorescale")),c){const t=this._dom.find(".lh-scores-container",i);c.append(...this._renderScoreGauges(e,r,o)),t.append(c,h);const n=this._dom.createElement("div","lh-sticky-header");n.append(...this._renderScoreGauges(e,r,o)),a.append(n)}const p=this._dom.createElement("div","lh-categories");s.append(p);const u={gatherMode:e.gatherMode};for(const t of Object.values(e.categories)){const n=o[t.id]||r;n.dom.createChildOf(p,"div","lh-category-wrapper").append(n.render(t,e.categoryGroups,u))}r.injectFinalScreenshot(p,e.audits,h);const m=this._dom.createFragment();return this._opts.omitGlobalStyles||m.append(this._dom.createComponent("styles")),this._opts.omitTopbar||m.append(this._renderReportTopbar(e)),m.append(a),s.append(this._renderReportFooter(e)),a.append(i,s),e.fullPageScreenshot&&g.installFullPageScreenshot(this._dom.rootEl,e.fullPageScreenshot.screenshot),m}}
|
|
144
144
|
/**
|
|
145
145
|
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
146
146
|
* 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
|
|
@@ -198,7 +198,7 @@ class F{constructor(e){this._dom=e,this._toggleEl,this._menuEl,this.onDocumentKe
|
|
|
198
198
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
199
|
* See the License for the specific language governing permissions and
|
|
200
200
|
* limitations under the License.
|
|
201
|
-
*/class T{constructor(e,t={}){this.json,this._dom=e,this._opts=t,this._topbar=t.omitTopbar?null:new D(this,e),this.onMediaQueryChange=this.onMediaQueryChange.bind(this)}initFeatures(e){this.json=e,this._topbar&&(this._topbar.enable(e),this._topbar.resetUIState()),this._setupMediaQueryListeners(),this._setupThirdPartyFilter(),this._setupElementScreenshotOverlay(this._dom.rootEl);const t=this._dom.isDevTools()||this._opts.disableDarkMode||this._opts.disableAutoDarkModeAndFireworks;!t&&window.matchMedia("(prefers-color-scheme: dark)").matches&&k(this._dom,!0);const n=["performance","accessibility","best-practices","seo"].every((t=>{const n=e.categories[t];return n&&1===n.score})),r=this._opts.disableFireworks||this._opts.disableAutoDarkModeAndFireworks;n&&!r&&(this._enableFireworks(),t||k(this._dom,!0));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._dom.rootEl).checked=!0}this.json.audits["script-treemap-data"]&&this.json.audits["script-treemap-data"].details&&this.addButton({text:l.i18n.strings.viewTreemapLabel,icon:"treemap",onClick:()=>function(e){if(!e.audits["script-treemap-data"].details)throw new Error("no script treemap data found");L({lhr:{mainDocumentUrl:e.mainDocumentUrl,finalUrl:e.finalUrl,finalDisplayedUrl:e.finalDisplayedUrl,audits:{"script-treemap-data":e.audits["script-treemap-data"]},configSettings:{locale:e.configSettings.locale}}},S()+"/treemap/","treemap-"+C(e))}(this.json)}),this._opts.onViewTrace&&this.addButton({text:"simulate"===e.configSettings.throttlingMethod?l.i18n.strings.viewOriginalTraceLabel:l.i18n.strings.viewTraceLabel,onClick:()=>this._opts.onViewTrace?.()}),this._opts.getStandaloneReportHTML&&this._dom.find('a[data-action="save-html"]',this._dom.rootEl).classList.remove("lh-hidden");for(const e of this._dom.findAll("[data-i18n]",this._dom.rootEl)){const t=e.getAttribute("data-i18n");e.textContent=l.i18n.strings[t]}}addButton(e){const t=this._dom.rootEl.querySelector(".lh-audit-group--metrics");if(!t)return;let n=t.querySelector(".lh-buttons");n||(n=this._dom.createChildOf(t,"div","lh-buttons"));const r=["lh-button"];e.icon&&(r.push("lh-report-icon"),r.push(`lh-report-icon--${e.icon}`));const o=this._dom.createChildOf(n,"button",r.join(" "));return o.textContent=e.text,o.addEventListener("click",e.onClick),o}resetUIState(){this._topbar&&this._topbar.resetUIState()}getReportHtml(){if(!this._opts.getStandaloneReportHTML)throw new Error("`getStandaloneReportHTML` is not set");return this.resetUIState(),this._opts.getStandaloneReportHTML()}saveAsGist(){throw new Error("Cannot save as gist from base report")}_enableFireworks(){this._dom.find(".lh-scores-container",this._dom.rootEl).classList.add("lh-score100")}_setupMediaQueryListeners(){const e=self.matchMedia("(max-width: 500px)");e.addListener(this.onMediaQueryChange),this.onMediaQueryChange(e)}_resetUIState(){this._topbar&&this._topbar.resetUIState()}onMediaQueryChange(e){this._dom.rootEl.classList.toggle("lh-narrow",e.matches)}_setupThirdPartyFilter(){const e=["uses-rel-preconnect","third-party-facades"],t=["legacy-javascript"];Array.from(this._dom.rootEl.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=>{const n=function(e){return Array.from(e.tBodies[0].rows)}(e),r=this._getThirdPartyRows(n,l.getFinalDisplayedUrl(this.json)),o=this._dom.createComponent("3pFilter"),i=this._dom.find("input",o);i.addEventListener("change",(e=>{const t=e.target instanceof HTMLInputElement&&!e.target.checked;let o=!0,i=n[0];for(;i;){const e=t&&r.includes(i);do{i.classList.toggle("lh-row--hidden",e),i.classList.toggle("lh-row--even",!e&&o),i.classList.toggle("lh-row--odd",!e&&!o),i=i.nextElementSibling}while(i&&i.classList.contains("lh-sub-item-row"));e||(o=!o)}})),this._dom.find(".lh-3p-filter-count",o).textContent=`${r.length}`,this._dom.find(".lh-3p-ui-string",o).textContent=l.i18n.strings.thirdPartyResourcesLabel;const a=r.length===n.length,s=!r.length;if((a||s)&&(this._dom.find("div.lh-3p-filter",o).hidden=!0),!e.parentNode)return;e.parentNode.insertBefore(o,e);const c=e.closest(".lh-audit");if(!c)throw new Error(".lh-table not within audit");t.includes(c.id)&&!a&&i.click()}))}_setupElementScreenshotOverlay(e){
|
|
201
|
+
*/class T{constructor(e,t={}){this.json,this._dom=e,this._opts=t,this._topbar=t.omitTopbar?null:new D(this,e),this.onMediaQueryChange=this.onMediaQueryChange.bind(this)}initFeatures(e){this.json=e,this._fullPageScreenshot=l.getFullPageScreenshot(e),this._topbar&&(this._topbar.enable(e),this._topbar.resetUIState()),this._setupMediaQueryListeners(),this._setupThirdPartyFilter(),this._setupElementScreenshotOverlay(this._dom.rootEl);const t=this._dom.isDevTools()||this._opts.disableDarkMode||this._opts.disableAutoDarkModeAndFireworks;!t&&window.matchMedia("(prefers-color-scheme: dark)").matches&&k(this._dom,!0);const n=["performance","accessibility","best-practices","seo"].every((t=>{const n=e.categories[t];return n&&1===n.score})),r=this._opts.disableFireworks||this._opts.disableAutoDarkModeAndFireworks;n&&!r&&(this._enableFireworks(),t||k(this._dom,!0));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._dom.rootEl).checked=!0}this.json.audits["script-treemap-data"]&&this.json.audits["script-treemap-data"].details&&this.addButton({text:l.i18n.strings.viewTreemapLabel,icon:"treemap",onClick:()=>function(e){if(!e.audits["script-treemap-data"].details)throw new Error("no script treemap data found");L({lhr:{mainDocumentUrl:e.mainDocumentUrl,finalUrl:e.finalUrl,finalDisplayedUrl:e.finalDisplayedUrl,audits:{"script-treemap-data":e.audits["script-treemap-data"]},configSettings:{locale:e.configSettings.locale}}},S()+"/treemap/","treemap-"+C(e))}(this.json)}),this._opts.onViewTrace&&this.addButton({text:"simulate"===e.configSettings.throttlingMethod?l.i18n.strings.viewOriginalTraceLabel:l.i18n.strings.viewTraceLabel,onClick:()=>this._opts.onViewTrace?.()}),this._opts.getStandaloneReportHTML&&this._dom.find('a[data-action="save-html"]',this._dom.rootEl).classList.remove("lh-hidden");for(const e of this._dom.findAll("[data-i18n]",this._dom.rootEl)){const t=e.getAttribute("data-i18n");e.textContent=l.i18n.strings[t]}}addButton(e){const t=this._dom.rootEl.querySelector(".lh-audit-group--metrics");if(!t)return;let n=t.querySelector(".lh-buttons");n||(n=this._dom.createChildOf(t,"div","lh-buttons"));const r=["lh-button"];e.icon&&(r.push("lh-report-icon"),r.push(`lh-report-icon--${e.icon}`));const o=this._dom.createChildOf(n,"button",r.join(" "));return o.textContent=e.text,o.addEventListener("click",e.onClick),o}resetUIState(){this._topbar&&this._topbar.resetUIState()}getReportHtml(){if(!this._opts.getStandaloneReportHTML)throw new Error("`getStandaloneReportHTML` is not set");return this.resetUIState(),this._opts.getStandaloneReportHTML()}saveAsGist(){throw new Error("Cannot save as gist from base report")}_enableFireworks(){this._dom.find(".lh-scores-container",this._dom.rootEl).classList.add("lh-score100")}_setupMediaQueryListeners(){const e=self.matchMedia("(max-width: 500px)");e.addListener(this.onMediaQueryChange),this.onMediaQueryChange(e)}_resetUIState(){this._topbar&&this._topbar.resetUIState()}onMediaQueryChange(e){this._dom.rootEl.classList.toggle("lh-narrow",e.matches)}_setupThirdPartyFilter(){const e=["uses-rel-preconnect","third-party-facades"],t=["legacy-javascript"];Array.from(this._dom.rootEl.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=>{const n=function(e){return Array.from(e.tBodies[0].rows)}(e),r=this._getThirdPartyRows(n,l.getFinalDisplayedUrl(this.json)),o=this._dom.createComponent("3pFilter"),i=this._dom.find("input",o);i.addEventListener("change",(e=>{const t=e.target instanceof HTMLInputElement&&!e.target.checked;let o=!0,i=n[0];for(;i;){const e=t&&r.includes(i);do{i.classList.toggle("lh-row--hidden",e),i.classList.toggle("lh-row--even",!e&&o),i.classList.toggle("lh-row--odd",!e&&!o),i=i.nextElementSibling}while(i&&i.classList.contains("lh-sub-item-row"));e||(o=!o)}})),this._dom.find(".lh-3p-filter-count",o).textContent=`${r.length}`,this._dom.find(".lh-3p-ui-string",o).textContent=l.i18n.strings.thirdPartyResourcesLabel;const a=r.length===n.length,s=!r.length;if((a||s)&&(this._dom.find("div.lh-3p-filter",o).hidden=!0),!e.parentNode)return;e.parentNode.insertBefore(o,e);const c=e.closest(".lh-audit");if(!c)throw new Error(".lh-table not within audit");t.includes(c.id)&&!a&&i.click()}))}_setupElementScreenshotOverlay(e){this._fullPageScreenshot&&g.installOverlayFeature({dom:this._dom,rootEl:e,overlayContainerEl:e,fullPageScreenshot:this._fullPageScreenshot})}_getThirdPartyRows(e,t){const n=[],r=l.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 o=e.dataset.url;if(!o)continue;l.getRootDomain(o)!==r&&n.push(t)}return n}_saveFile(e){const t=e.type.match("json")?".json":".html",n=N({finalDisplayedUrl:l.getFinalDisplayedUrl(this.json),fetchTime:this.json.fetchTime})+t;this._opts.onSaveFileOverride?this._opts.onSaveFileOverride(e,n):this._dom.saveFile(e,n)}}
|
|
202
202
|
/**
|
|
203
203
|
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
204
204
|
* 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
|
|
@@ -8,7 +8,8 @@ import {FunctionComponent} from 'preact';
|
|
|
8
8
|
import {useEffect, useState} from 'preact/hooks';
|
|
9
9
|
|
|
10
10
|
import {NavigationIcon, SnapshotIcon, TimespanIcon} from './icons';
|
|
11
|
-
import {getFilmstripFrames, getScreenDimensions
|
|
11
|
+
import {getFilmstripFrames, getScreenDimensions} from './util';
|
|
12
|
+
import {Util} from '../../report/renderer/util.js';
|
|
12
13
|
|
|
13
14
|
const ANIMATION_FRAME_DURATION_MS = 500;
|
|
14
15
|
|
|
@@ -76,7 +77,6 @@ const FlowStepThumbnail: FunctionComponent<{
|
|
|
76
77
|
width?: number,
|
|
77
78
|
height?: number,
|
|
78
79
|
}> = ({lhr, width, height}) => {
|
|
79
|
-
const fullPageScreenshot = getFullPageScreenshot(lhr);
|
|
80
80
|
const frames = getFilmstripFrames(lhr);
|
|
81
81
|
|
|
82
82
|
// Resize the image to fit the viewport aspect ratio.
|
|
@@ -99,7 +99,7 @@ const FlowStepThumbnail: FunctionComponent<{
|
|
|
99
99
|
return <FlowStepAnimatedThumbnail frames={frames} width={width} height={height} />;
|
|
100
100
|
}
|
|
101
101
|
} else {
|
|
102
|
-
thumbnail =
|
|
102
|
+
thumbnail = Util.getFullPageScreenshot(lhr)?.screenshot.data;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
return <>
|
package/flow-report/src/util.ts
CHANGED
|
@@ -41,16 +41,6 @@ function getScreenDimensions(reportResult: LH.Result) {
|
|
|
41
41
|
return {width, height};
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function getFullPageScreenshot(reportResult: LH.Result) {
|
|
45
|
-
const fullPageScreenshotAudit = reportResult.audits['full-page-screenshot'];
|
|
46
|
-
const fullPageScreenshot =
|
|
47
|
-
fullPageScreenshotAudit?.details &&
|
|
48
|
-
fullPageScreenshotAudit.details.type === 'full-page-screenshot' &&
|
|
49
|
-
fullPageScreenshotAudit.details;
|
|
50
|
-
|
|
51
|
-
return fullPageScreenshot || null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
44
|
function getFilmstripFrames(
|
|
55
45
|
reportResult: LH.Result
|
|
56
46
|
): Array<{data: string}> | undefined {
|
|
@@ -156,7 +146,6 @@ export {
|
|
|
156
146
|
OptionsContext,
|
|
157
147
|
classNames,
|
|
158
148
|
getScreenDimensions,
|
|
159
|
-
getFullPageScreenshot,
|
|
160
149
|
getFilmstripFrames,
|
|
161
150
|
getModeDescription,
|
|
162
151
|
useFlowResult,
|
|
@@ -23,13 +23,6 @@ describe('FlowStepThumbnail', () => {
|
|
|
23
23
|
gatherMode: 'navigation',
|
|
24
24
|
configSettings: {screenEmulation: {width: 400, height: 600}},
|
|
25
25
|
audits: {
|
|
26
|
-
'full-page-screenshot': {
|
|
27
|
-
details: {
|
|
28
|
-
type: 'full-page-screenshot',
|
|
29
|
-
screenshot: {data: 'FPS', width: 400, height: 600},
|
|
30
|
-
nodes: {},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
26
|
'screenshot-thumbnails': {
|
|
34
27
|
details: {
|
|
35
28
|
type: 'filmstrip',
|
|
@@ -40,6 +33,10 @@ describe('FlowStepThumbnail', () => {
|
|
|
40
33
|
},
|
|
41
34
|
},
|
|
42
35
|
},
|
|
36
|
+
fullPageScreenshot: {
|
|
37
|
+
screenshot: {data: 'FPS', width: 400, height: 600},
|
|
38
|
+
nodes: {},
|
|
39
|
+
},
|
|
43
40
|
} as any;
|
|
44
41
|
});
|
|
45
42
|
|
|
@@ -107,7 +107,7 @@ describe('SummaryFlowStep', () => {
|
|
|
107
107
|
|
|
108
108
|
const screenshot =
|
|
109
109
|
root.getByAltText('Screenshot of a page tested by Lighthouse') as HTMLImageElement;
|
|
110
|
-
expect(screenshot.src).toMatch(/data:image\/
|
|
110
|
+
expect(screenshot.src).toMatch(/data:image\/webp;base64/);
|
|
111
111
|
|
|
112
112
|
const gauges = root.getAllByTestId('CategoryScore');
|
|
113
113
|
expect(gauges).toHaveLength(4);
|