#!/usr/bin/env node /*! For license information please see 12.22120.js.LICENSE.txt */ "use strict";exports.id=12,exports.ids=[12],exports.modules={4534:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.win32=t.wsl=t.linux=t.darwin=t.darwinFast=void 0;const s=r(7147),o=r(1017),n=r(2037),i=r(2081),a=r(3150),c=r(8269),h=r(5317),l=/\r?\n/;function u(){const e=["/Contents/MacOS/Google Chrome Canary","/Contents/MacOS/Google Chrome"],t=[],r=p();r&&t.push(r),i.execSync("/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep -i 'google chrome\\( canary\\)\\?\\.app' | awk '{$1=\"\"; print $0}'").toString().split(l).forEach((r=>{e.forEach((e=>{const s=o.join(r.substring(0,r.indexOf(".app")+4).trim(),e);m(s)&&-1===t.indexOf(s)&&t.push(s)}))}));const s=a(process.env.HOME||n.homedir()),c=[{regex:new RegExp(`^${s}/Applications/.*Chrome\\.app`),weight:50},{regex:new RegExp(`^${s}/Applications/.*Chrome Canary\\.app`),weight:51},{regex:/^\/Applications\/.*Chrome.app/,weight:100},{regex:/^\/Applications\/.*Chrome Canary.app/,weight:101},{regex:/^\/Volumes\/.*Chrome.app/,weight:-2},{regex:/^\/Volumes\/.*Chrome Canary.app/,weight:-1}];return process.env.LIGHTHOUSE_CHROMIUM_PATH&&c.unshift({regex:new RegExp(a(process.env.LIGHTHOUSE_CHROMIUM_PATH)),weight:150}),process.env.CHROME_PATH&&c.unshift({regex:new RegExp(a(process.env.CHROME_PATH)),weight:151}),g(t,c)}function p(){return m(process.env.CHROME_PATH)?process.env.CHROME_PATH:m(process.env.LIGHTHOUSE_CHROMIUM_PATH)?(c.warn("ChromeLauncher","LIGHTHOUSE_CHROMIUM_PATH is deprecated, use CHROME_PATH env variable instead."),process.env.LIGHTHOUSE_CHROMIUM_PATH):void 0}function d(){const e=[],t=[`${o.sep}Google${o.sep}Chrome SxS${o.sep}Application${o.sep}chrome.exe`,`${o.sep}Google${o.sep}Chrome${o.sep}Application${o.sep}chrome.exe`],r=[process.env.LOCALAPPDATA,process.env.PROGRAMFILES,process.env["PROGRAMFILES(X86)"]].filter(Boolean),s=p();return s&&e.push(s),r.forEach((r=>t.forEach((t=>{const s=o.join(r,t);m(s)&&e.push(s)})))),e}function g(e,t){return e.map((e=>{for(const r of t)if(r.regex.test(e))return{path:e,weight:r.weight};return{path:e,weight:10}})).sort(((e,t)=>t.weight-e.weight)).map((e=>e.path))}function m(e){if(!e)return!1;try{return s.accessSync(e),!0}catch(e){return!1}}t.darwinFast=function(){const e=[process.env.CHROME_PATH,process.env.LIGHTHOUSE_CHROMIUM_PATH,"/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary","/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"];for(const t of e)if(t&&m(t))return t;return u()[0]},t.darwin=u,t.linux=function(){let e=[];const t=p();if(t&&e.push(t),[o.join(n.homedir(),".local/share/applications/"),"/usr/share/applications/"].forEach((t=>{e=e.concat(function(e){const t=/(^[^ ]+).*/,r="^Exec=/.*/(google-chrome|chrome|chromium)-.*";let s=[];if(m(e)){let o;try{o=i.execSync(`grep -ER "${r}" ${e} | awk -F '=' '{print $2}'`,{stdio:"pipe"})}catch(t){o=i.execSync(`grep -Er "${r}" ${e} | awk -F '=' '{print $2}'`,{stdio:"pipe"})}o=o.toString().split(l).map((e=>e.replace(t,"$1"))),o.forEach((e=>m(e)&&s.push(e)))}return s}(t))})),["google-chrome-stable","google-chrome","chromium-browser","chromium"].forEach((t=>{try{const r=i.execFileSync("which",[t],{stdio:"pipe"}).toString().split(l)[0];m(r)&&e.push(r)}catch(e){}})),!e.length)throw new h.ChromePathNotSetError;const r=[{regex:/chrome-wrapper$/,weight:51},{regex:/google-chrome-stable$/,weight:50},{regex:/google-chrome$/,weight:49},{regex:/chromium-browser$/,weight:48},{regex:/chromium$/,weight:47}];return process.env.LIGHTHOUSE_CHROMIUM_PATH&&r.unshift({regex:new RegExp(a(process.env.LIGHTHOUSE_CHROMIUM_PATH)),weight:100}),process.env.CHROME_PATH&&r.unshift({regex:new RegExp(a(process.env.CHROME_PATH)),weight:101}),g((s=e.filter(Boolean),Array.from(new Set(s))),r);var s},t.wsl=function(){return process.env.LOCALAPPDATA=h.getLocalAppDataPath(`${process.env.PATH}`),process.env.PROGRAMFILES="/mnt/c/Program Files",process.env["PROGRAMFILES(X86)"]="/mnt/c/Program Files (x86)",d()},t.win32=d},1723:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.killAll=t.launch=t.Launcher=void 0;const s=r(2081),o=r(7147),n=r(1808),i=r(4534),a=r(5022),c=r(1578),h=r(5317),l=r(8269),u=s.spawn,p=s.execSync,d="wsl"===h.getPlatform(),g="win32"===h.getPlatform(),m="SIGINT",f=new Set(["darwin","linux","win32","wsl"]),w=new Set,y=async()=>{await v(),process.exit(130)};async function v(){let e=[];for(const t of w)try{await t.kill(),w.delete(t)}catch(t){e.push(t)}return e}t.launch=async function(e={}){e.handleSIGINT=h.defaults(e.handleSIGINT,!0);const t=new E(e);return e.handleSIGINT&&0===w.size&&process.on(m,y),w.add(t),await t.launch(),{pid:t.pid,port:t.port,kill:async()=>(w.delete(t),0===w.size&&process.removeListener(m,y),t.kill()),process:t.chrome}},t.killAll=v;class E{constructor(e={},t={}){if(this.opts=e,this.tmpDirandPidFileReady=!1,this.fs=t.fs||o,this.spawn=t.spawn||u,l.setLevel(h.defaults(this.opts.logLevel,"silent")),this.startingUrl=h.defaults(this.opts.startingUrl,"about:blank"),this.chromeFlags=h.defaults(this.opts.chromeFlags,[]),this.prefs=h.defaults(this.opts.prefs,{}),this.requestedPort=h.defaults(this.opts.port,0),this.chromePath=this.opts.chromePath,this.ignoreDefaultFlags=h.defaults(this.opts.ignoreDefaultFlags,!1),this.connectionPollInterval=h.defaults(this.opts.connectionPollInterval,500),this.maxConnectionRetries=h.defaults(this.opts.maxConnectionRetries,50),this.envVars=h.defaults(e.envVars,Object.assign({},process.env)),"boolean"==typeof this.opts.userDataDir){if(this.opts.userDataDir)throw new h.InvalidUserDataDirectoryError;this.useDefaultProfile=!0,this.userDataDir=void 0}else this.useDefaultProfile=!1,this.userDataDir=this.opts.userDataDir}get flags(){const e=this.ignoreDefaultFlags?[]:c.DEFAULT_FLAGS.slice();return e.push(`--remote-debugging-port=${this.port}`),this.ignoreDefaultFlags||"linux"!==h.getPlatform()||e.push("--disable-setuid-sandbox"),this.useDefaultProfile||e.push(`--user-data-dir=${d?h.toWinDirFormat(this.userDataDir):this.userDataDir}`),e.push(...this.chromeFlags),e.push(this.startingUrl),e}static defaultFlags(){return c.DEFAULT_FLAGS.slice()}static getFirstInstallation(){return"darwin"===h.getPlatform()?i.darwinFast():i[h.getPlatform()]()[0]}static getInstallations(){return i[h.getPlatform()]()}makeTmpDir(){return h.makeTmpDir()}prepare(){const e=h.getPlatform();if(!f.has(e))throw new h.UnsupportedPlatformError;this.userDataDir=this.userDataDir||this.makeTmpDir(),this.outFile=this.fs.openSync(`${this.userDataDir}/chrome-out.log`,"a"),this.errFile=this.fs.openSync(`${this.userDataDir}/chrome-err.log`,"a"),this.setBrowserPrefs(),this.pidFile=`${this.userDataDir}/chrome.pid`,l.verbose("ChromeLauncher",`created ${this.userDataDir}`),this.tmpDirandPidFileReady=!0}setBrowserPrefs(){if(0===Object.keys(this.prefs).length)return;const e=`${this.userDataDir}/Preferences`;try{if(this.fs.existsSync(e)){const t=this.fs.readFileSync(e,"utf-8"),r=JSON.parse(t);this.fs.writeFileSync(e,JSON.stringify({...r,...this.prefs}),"utf-8")}else this.fs.writeFileSync(e,JSON.stringify({...this.prefs}),"utf-8")}catch(e){l.log("ChromeLauncher",`Failed to set browser prefs: ${e.message}`)}}async launch(){if(0!==this.requestedPort){this.port=this.requestedPort;try{return await this.isDebuggerReady()}catch(e){l.log("ChromeLauncher",`No debugging port found on port ${this.port}, launching a new Chrome.`)}}if(void 0===this.chromePath){const e=E.getFirstInstallation();if(!e)throw new h.ChromeNotInstalledError;this.chromePath=e}return this.tmpDirandPidFileReady||this.prepare(),this.pid=await this.spawnProcess(this.chromePath),Promise.resolve()}async spawnProcess(e){const t=(async()=>{if(this.chrome)return l.log("ChromeLauncher",`Chrome already running with pid ${this.chrome.pid}.`),this.chrome.pid;0===this.requestedPort&&(this.port=await a.getRandomPort()),l.verbose("ChromeLauncher",`Launching with command:\n"${e}" ${this.flags.join(" ")}`);const t=this.spawn(e,this.flags,{detached:!0,stdio:["ignore",this.outFile,this.errFile],env:this.envVars});return this.chrome=t,t.pid&&this.fs.writeFileSync(this.pidFile,t.pid.toString()),l.verbose("ChromeLauncher",`Chrome running with pid ${t.pid} on port ${this.port}.`),t.pid})(),r=await t;return await this.waitUntilReady(),r}cleanup(e){e&&(e.removeAllListeners(),e.end(),e.destroy(),e.unref())}isDebuggerReady(){return new Promise(((e,t)=>{const r=n.createConnection(this.port);r.once("error",(e=>{this.cleanup(r),t(e)})),r.once("connect",(()=>{this.cleanup(r),e()}))}))}waitUntilReady(){const e=this;return new Promise(((t,r)=>{let s=0,o="Waiting for browser.";const n=()=>{0===s&&l.log("ChromeLauncher",o),s++,o+="..",l.log("ChromeLauncher",o),e.isDebuggerReady().then((()=>{l.log("ChromeLauncher",o+`${l.greenify(l.tick)}`),t()})).catch((t=>{if(s>e.maxConnectionRetries){l.error("ChromeLauncher",t.message);const e=this.fs.readFileSync(`${this.userDataDir}/chrome-err.log`,{encoding:"utf-8"});return l.error("ChromeLauncher",`Logging contents of ${this.userDataDir}/chrome-err.log`),l.error("ChromeLauncher",e),r(t)}h.delay(e.connectionPollInterval).then(n)}))};n()}))}kill(){return new Promise(((e,t)=>{if(this.chrome){this.chrome.on("close",(()=>{delete this.chrome,this.destroyTmp().then(e)})),l.log("ChromeLauncher",`Killing Chrome instance ${this.chrome.pid}`);try{g?p(`taskkill /pid ${this.chrome.pid} /T /F`,{stdio:"pipe"}):this.chrome.pid&&process.kill(-this.chrome.pid)}catch(e){const r=`Chrome could not be killed ${e.message}`;l.warn("ChromeLauncher",r),t(new Error(r))}}else e()}))}destroyTmp(){return new Promise((e=>{if(void 0===this.userDataDir||void 0!==this.opts.userDataDir)return e();this.outFile&&(this.fs.closeSync(this.outFile),delete this.outFile),this.errFile&&(this.fs.closeSync(this.errFile),delete this.errFile),this.fs.rmdir(this.userDataDir,{recursive:!0},(()=>e()))}))}}t.Launcher=E,t.default=E},1578:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_FLAGS=void 0,t.DEFAULT_FLAGS=["--disable-features=Translate","--disable-extensions","--disable-component-extensions-with-background-pages","--disable-background-networking","--disable-component-update","--disable-client-side-phishing-detection","--disable-sync","--metrics-recording-only","--disable-default-apps","--mute-audio","--no-default-browser-check","--no-first-run","--disable-backgrounding-occluded-windows","--disable-renderer-backgrounding","--disable-background-timer-throttling","--disable-ipc-flooding-protection","--password-store=basic","--use-mock-keychain","--force-fieldtrials=*BackgroundTracing/default/"]},8012:function(e,t,r){var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||s(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(1723),t)},5022:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRandomPort=void 0;const s=r(3685);t.getRandomPort=function(){return new Promise(((e,t)=>{const r=s.createServer();r.listen(0),r.once("listening",(()=>{const{port:t}=r.address();r.close((()=>e(t)))})),r.once("error",t)}))}},5317:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalAppDataPath=t.toWinDirFormat=t.makeTmpDir=t.getPlatform=t.ChromeNotInstalledError=t.UnsupportedPlatformError=t.InvalidUserDataDirectoryError=t.ChromePathNotSetError=t.LauncherError=t.delay=t.defaults=void 0;const s=r(1017),o=r(2081),n=r(7147),i=r(2818);t.defaults=function(e,t){return void 0===e?t:e},t.delay=async function(e){return new Promise((t=>setTimeout(t,e)))};class a extends Error{constructor(e="Unexpected error",t){return super(),this.message=e,this.code=t,this.stack=(new Error).stack,this}}t.LauncherError=a,t.ChromePathNotSetError=class extends a{constructor(){super(...arguments),this.message="The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable.",this.code="ERR_LAUNCHER_PATH_NOT_SET"}},t.InvalidUserDataDirectoryError=class extends a{constructor(){super(...arguments),this.message="userDataDir must be false or a path.",this.code="ERR_LAUNCHER_INVALID_USER_DATA_DIRECTORY"}};class c extends a{constructor(){super(...arguments),this.message=`Platform ${h()} is not supported.`,this.code="ERR_LAUNCHER_UNSUPPORTED_PLATFORM"}}function h(){return i?"wsl":process.platform}function l(e){const t=/\/mnt\/([a-z])\/Users\/([^\/:]+)\/AppData\//.exec(e)||[];return`/mnt/${t[1]}/Users/${t[2]}/AppData/Local`}t.UnsupportedPlatformError=c,t.ChromeNotInstalledError=class extends a{constructor(){super(...arguments),this.message="No Chrome installations found.",this.code="ERR_LAUNCHER_NOT_INSTALLED"}},t.getPlatform=h,t.makeTmpDir=function(){switch(h()){case"darwin":case"linux":return o.execSync("mktemp -d -t lighthouse.XXXXXXX").toString().trim();case"wsl":process.env.TEMP=l(`${process.env.PATH}`);case"win32":return function(){const e=process.env.TEMP||process.env.TMP||(process.env.SystemRoot||process.env.windir)+"\\temp",t=Math.floor(9e7*Math.random()+1e7),r=s.join(e,"lighthouse."+t);return n.mkdirSync(r,{recursive:!0}),r}();default:throw new c}},t.toWinDirFormat=function(e=""){const t=/\/mnt\/([a-z])\//.exec(e);if(!t)return e;const r=t[1];return e.replace(`/mnt/${r}/`,`${r.toUpperCase()}:\\`).replace(/\//g,"\\")},t.getLocalAppDataPath=l},3150:e=>{e.exports=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}},1595:(e,t,r)=>{const s=r(7147);let o;e.exports=()=>(void 0===o&&(o=function(){try{return s.statSync("/.dockerenv"),!0}catch(e){return!1}}()||function(){try{return s.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch(e){return!1}}()),o)},2818:(e,t,r)=>{const s=r(2037),o=r(7147),n=r(1595),i=()=>{if("linux"!==process.platform)return!1;if(s.release().toLowerCase().includes("microsoft"))return!n();try{return!!o.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")&&!n()}catch(e){return!1}};process.env.__IS_WSL_TEST__?e.exports=i:e.exports=i()},8269:(e,t,r)=>{const s=r(5158),o=r(1738),n=r(2361).EventEmitter,i="win32"===process.platform,a=process.browser,c={red:a?"crimson":1,yellow:a?"gold":3,cyan:a?"darkturquoise":6,green:a?"forestgreen":2,blue:a?"steelblue":4,magenta:a?"palevioletred":5};s.colors=[c.cyan,c.green,c.blue,c.magenta];const h={};let l;class u{static _logToStdErr(e,t){u.loggerfn(e)(...t)}static loggerfn(e){let t=h[e=`LH:${e}`];return t||(t=s(e),h[e]=t,e.endsWith("error")?t.color=c.red:e.endsWith("warn")&&(t.color=c.yellow)),t}static setLevel(e){switch(l=e,e){case"silent":s.enable("-LH:*");break;case"verbose":s.enable("LH:*");break;case"error":s.enable("-LH:*, LH:*:error");break;default:s.enable("LH:*, -LH:*:verbose")}}static formatProtocol(e,t,r){const s=!process||process.browser?1/0:process.stdout.columns,o=t.method||"?????",n=s-o.length-e.length-25,i=t.params&&"IO.read"!==o?JSON.stringify(t.params).substr(0,n):"";u._logToStdErr(`${e}:${r||""}`,[o,i])}static isVerbose(){return"verbose"===l}static time({msg:e,id:t,args:r=[]},s="log"){o.mark(t),u[s]("status",e,...r)}static timeEnd({msg:e,id:t,args:r=[]},s="verbose"){u[s]("statusEnd",e,...r),o.stop(t)}static log(e,...t){return u.events.issueStatus(e,t),u._logToStdErr(e,t)}static warn(e,...t){return u.events.issueWarning(e,t),u._logToStdErr(`${e}:warn`,t)}static error(e,...t){return u._logToStdErr(`${e}:error`,t)}static verbose(e,...t){return u.events.issueStatus(e,t),u._logToStdErr(`${e}:verbose`,t)}static greenify(e){return`${u.green}${e}${u.reset}`}static redify(e){return`${u.red}${e}${u.reset}`}static get green(){return""}static get red(){return""}static get yellow(){return""}static get purple(){return""}static get reset(){return""}static get bold(){return""}static get dim(){return""}static get tick(){return i?"√":"✓"}static get cross(){return i?"×":"✘"}static get whiteSmallSquare(){return i?"·":"▫"}static get heavyHorizontal(){return i?"─":"━"}static get heavyVertical(){return i?"│ ":"┃ "}static get heavyUpAndRight(){return i?"└":"┗"}static get heavyVerticalAndRight(){return i?"├":"┣"}static get heavyDownAndHorizontal(){return i?"┬":"┳"}static get doubleLightHorizontal(){return"──"}}u.events=new class extends n{issueStatus(e,t){"status"!==e&&"statusEnd"!==e||this.emit(e,[e,...t])}issueWarning(e,t){this.emit("warning",[e,...t])}},u.takeTimeEntries=()=>{const e=o.getEntries();return o.clear(),e},u.getTimeEntries=()=>o.getEntries(),e.exports=u},1738:(e,t,r)=>{r.r(t),r.d(t,{clear:()=>i,getEntries:()=>n,mark:()=>s,stop:()=>o});var s,o,n,i,a="undefined"!=typeof performance&&performance,c=process.hrtime,h=function(){var e=c();return 1e9*e[0]+e[1]},l=h(),u=function(){return(h()-l)/1e6};function p(e){if(!e)throw new Error("name must be non-empty")}if(a&&a.mark&&a.getEntriesByName&&a.getEntriesByType&&a.clearMeasures)s=function(e){p(e),a.mark("start "+e)},o=function(e){p(e),a.mark("end "+e),a.measure(e,"start "+e,"end "+e);var t=a.getEntriesByName(e);return t[t.length-1]},n=function(){return a.getEntriesByType("measure")},i=function(){a.clearMarks(),a.clearMeasures()};else{var d={},g=[];s=function(e){p(e);var t=u();d["$"+e]=t},o=function(e){p(e);var t=u(),r=d["$"+e];if(!r)throw new Error("no known mark: "+e);var s={startTime:r,name:e,duration:t-r,entryType:"measure"};return function(e,t){for(var r,s=0,o=e.length;s>>1].startTime