@testream/cypress-reporter 1.0.1 → 1.0.3
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/dist/cli/index.js +1 -1
- package/dist/cli/reporter.d.ts +0 -6
- package/dist/cli/reporter.d.ts.map +1 -1
- package/dist/cli/types.d.ts +0 -5
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/reporter.d.ts +0 -6
- package/dist/reporter.d.ts.map +1 -1
- package/dist/types.d.ts +0 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
(()=>{"use strict";var t={406:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.detectCIContext=detectCIContext;function detectCIContext(){const t=process.env;if(t.GITHUB_ACTIONS==="true"){return{branch:t.GITHUB_HEAD_REF||t.GITHUB_REF_NAME||t.GITHUB_REF?.replace("refs/heads/",""),commitSha:t.GITHUB_SHA,repositoryUrl:t.GITHUB_SERVER_URL&&t.GITHUB_REPOSITORY?`${t.GITHUB_SERVER_URL}/${t.GITHUB_REPOSITORY}`:undefined,buildNumber:t.GITHUB_RUN_NUMBER,buildUrl:t.GITHUB_SERVER_URL&&t.GITHUB_REPOSITORY&&t.GITHUB_RUN_ID?`${t.GITHUB_SERVER_URL}/${t.GITHUB_REPOSITORY}/actions/runs/${t.GITHUB_RUN_ID}`:undefined}}if(t.GITLAB_CI==="true"){return{branch:t.CI_COMMIT_BRANCH||t.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME,commitSha:t.CI_COMMIT_SHA,repositoryUrl:t.CI_PROJECT_URL,buildNumber:t.CI_PIPELINE_IID,buildUrl:t.CI_PIPELINE_URL}}if(t.TF_BUILD==="True"){return{branch:t.BUILD_SOURCEBRANCH?.replace("refs/heads/",""),commitSha:t.BUILD_SOURCEVERSION,repositoryUrl:t.BUILD_REPOSITORY_URI,buildNumber:t.BUILD_BUILDNUMBER,buildUrl:t.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI&&t.SYSTEM_TEAMPROJECT&&t.BUILD_BUILDID?`${t.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI}${t.SYSTEM_TEAMPROJECT}/_build/results?buildId=${t.BUILD_BUILDID}`:undefined}}if(t.CIRCLECI==="true"){return{branch:t.CIRCLE_BRANCH,commitSha:t.CIRCLE_SHA1,repositoryUrl:t.CIRCLE_REPOSITORY_URL,buildNumber:t.CIRCLE_BUILD_NUM,buildUrl:t.CIRCLE_BUILD_URL}}if(t.JENKINS_URL){return{branch:t.GIT_BRANCH?.replace("origin/",""),commitSha:t.GIT_COMMIT,repositoryUrl:t.GIT_URL,buildNumber:t.BUILD_NUMBER,buildUrl:t.BUILD_URL}}if(t.BITBUCKET_BUILD_NUMBER){return{branch:t.BITBUCKET_BRANCH,commitSha:t.BITBUCKET_COMMIT,repositoryUrl:t.BITBUCKET_GIT_HTTP_ORIGIN,buildNumber:t.BITBUCKET_BUILD_NUMBER,buildUrl:t.BITBUCKET_REPO_FULL_NAME&&t.BITBUCKET_BUILD_NUMBER?`https://bitbucket.org/${t.BITBUCKET_REPO_FULL_NAME}/pipelines/results/${t.BITBUCKET_BUILD_NUMBER}`:undefined}}return{}}},827:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true})},322:function(t,e,s){var i=this&&this.__createBinding||(Object.create?function(t,e,s,i){if(i===undefined)i=s;var r=Object.getOwnPropertyDescriptor(e,s);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[s]}}}Object.defineProperty(t,i,r)}:function(t,e,s,i){if(i===undefined)i=s;t[i]=e[s]});var r=this&&this.__exportStar||function(t,e){for(var s in t)if(s!=="default"&&!Object.prototype.hasOwnProperty.call(e,s))i(e,t,s)};Object.defineProperty(e,"__esModule",{value:true});e.ensureReportId=e.mapAttachmentsToTestResults=e.uploadArtifacts=e.uploadTestRun=e.detectCIContext=void 0;r(s(827),e);var n=s(406);Object.defineProperty(e,"detectCIContext",{enumerable:true,get:function(){return n.detectCIContext}});var o=s(969);Object.defineProperty(e,"uploadTestRun",{enumerable:true,get:function(){return o.uploadTestRun}});Object.defineProperty(e,"uploadArtifacts",{enumerable:true,get:function(){return o.uploadArtifacts}});Object.defineProperty(e,"mapAttachmentsToTestResults",{enumerable:true,get:function(){return o.mapAttachmentsToTestResults}});Object.defineProperty(e,"ensureReportId",{enumerable:true,get:function(){return o.ensureReportId}})},969:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.ensureReportId=ensureReportId;e.uploadTestRun=uploadTestRun;e.mapAttachmentsToTestResults=mapAttachmentsToTestResults;e.uploadArtifacts=uploadArtifacts;const i=s(406);const r="https://test-manager-backend.fly.dev";function ensureReportId(t){if(typeof t.reportId==="string"&&t.reportId.trim().length>0){return t.reportId}const e=crypto.randomUUID();t.reportId=e;return e}function resolveApiUrl(t){const e=normalizeApiUrl(t);if(e){return e}const s=getEnvApiUrl();if(s){return s}return r}function getEnvApiUrl(){if(typeof process==="undefined"||!process?.env){return undefined}return normalizeApiUrl(process.env.TESTREAM_API_URL)}function normalizeApiUrl(t){if(!t){return undefined}const e=t.trim();if(!e){return undefined}return e.replace(/\/+$/,"")}function isReportAlreadyExistsConflict(t){return t.errorCode==="report_already_exists"}function formatUploadError(t){const e=t.detail||t.title||t.rawBody||"Unknown error";const s=t.errorCode?`, code=${t.errorCode}`:"";return`Upload failed (HTTP ${t.statusCode}${s}): ${e}`}async function parseHttpError(t){const e=await t.text();const s=t.headers.get("content-type")||"";if(s.toLowerCase().includes("json")&&e.trim().length>0){try{const s=JSON.parse(e);return{statusCode:t.status,title:s.title,detail:s.detail||s.details||s.error,errorCode:s.errorCode,rawBody:e}}catch{}}return{statusCode:t.status,rawBody:e}}function resolveUploadContext(t){const e=(0,i.detectCIContext)();return{commitSha:t.commitSha??e.commitSha,branch:t.branch??e.branch,repositoryUrl:t.repositoryUrl??e.repositoryUrl,buildName:t.buildName,buildNumber:t.buildNumber??e.buildNumber,buildUrl:t.buildUrl??e.buildUrl,testEnvironment:t.testEnvironment,appName:t.appName,appVersion:t.appVersion,testType:t.testType}}async function uploadTestRun(t){const{report:e,apiKey:s}=t;const i=resolveApiUrl(t.apiUrl);const r=ensureReportId(e);const n=resolveUploadContext(t);const o={report:e,reportId:r,...n};console.log("Uploading test results...");let a;try{a=await fetch(`${i}/api/v1/ingest`,{method:"POST",headers:{"X-API-KEY":s,"Content-Type":"application/json"},body:JSON.stringify(o)})}catch(t){const e=t instanceof Error?t.message:String(t);const s=`Connection failed: ${e}`;console.error(s);return{success:false,reportId:r,error:s}}if(!a.ok){const t=await parseHttpError(a);if(a.status===409&&isReportAlreadyExistsConflict(t)){console.warn("Report already exists (workflow may have been re-run)");return{success:true,reportId:r,summary:{passed:e.results.summary.passed,failed:e.results.summary.failed,skipped:e.results.summary.skipped,total:e.results.summary.tests},alreadyExists:true,statusCode:t.statusCode,errorCode:t.errorCode}}const s=formatUploadError(t);console.error(s);return{success:false,reportId:r,error:s,statusCode:t.statusCode,errorCode:t.errorCode,errorDetail:t.detail||t.rawBody}}const h=await a.json();console.log(`✓ Test results uploaded successfully`);console.log(` Report ID: ${h.reportId}`);console.log(` Test Run ID: ${h.testRunId}`);console.log(` Tests: ${h.summary.passed}/${h.summary.total} passed`);return{success:true,reportId:h.reportId,testRunId:h.testRunId,summary:{passed:h.summary.passed,failed:h.summary.failed,skipped:h.summary.skipped,total:h.summary.total},testResults:h.testResults}}function mapAttachmentsToTestResults(t,e){const s=new Map;for(const t of e){const e=s.get(t.name)??[];e.push(t.id);s.set(t.name,e)}const i=[];for(const e of t){const t=s.get(e.name);const r=t?.shift();if(!e.attachments||e.attachments.length===0){continue}if(!r){console.warn(`Skipping artifact upload: could not match test result for "${e.name}"`);continue}i.push({testResultId:r,attachments:e.attachments})}return i}async function uploadArtifacts(t){const{reportId:e,apiKey:s,testResults:i}=t;const r=resolveApiUrl(t.apiUrl);let n=0;for(const t of i){for(const i of t.attachments){try{const o=await uploadSingleArtifact({testResultId:t.testResultId,attachment:i,reportId:e,apiKey:s,apiUrl:r});if(o)n++}catch(t){const e=t instanceof Error?t.message:String(t);console.error(`Failed to upload artifact ${i.name}: ${e}`)}}}if(n>0){console.log(`✓ Uploaded ${n} artifact(s)`)}return n}async function uploadSingleArtifact(t){const{testResultId:e,attachment:i,reportId:r,apiKey:n,apiUrl:o}=t;const a=await Promise.resolve().then(s.t.bind(s,943,23));const h=await Promise.resolve().then(s.t.bind(s,928,23));const l=h.resolve(i.path);try{await a.access(l)}catch{console.warn(`Artifact not found: ${h.basename(l)}`);return false}let c;let u;const f=h.basename(l);const d=i.contentType||"application/octet-stream";try{c=await a.readFile(l);u=c.byteLength}catch(t){const e=t instanceof Error?t.message:String(t);throw new Error(`Failed to read file: ${e}`)}try{return await uploadWithPresignedUrl({testResultId:e,reportId:r,apiKey:n,apiUrl:o,attachmentName:i.name,fileName:f,contentType:d,sizeBytes:u,fileBuffer:c})}catch(t){if(!(t instanceof LegacyUploadRequiredError)){throw t}return await uploadWithLegacyEndpoint({testResultId:e,attachmentName:i.name,reportId:r,apiKey:n,apiUrl:o,fileName:f,contentType:d,fileBuffer:c})}}class LegacyUploadRequiredError extends Error{constructor(){super("Legacy upload endpoint required")}}async function uploadWithPresignedUrl(t){const{testResultId:e,reportId:s,apiKey:i,apiUrl:r,attachmentName:n,fileName:o,contentType:a,sizeBytes:h,fileBuffer:l}=t;const c={testResultId:e,ctrfAttachmentName:n,fileName:o,contentType:a,sizeBytes:h};const u=await fetch(`${r}/api/v1/artifacts/${s}/upload-url`,{method:"POST",headers:{"X-API-KEY":i,"Content-Type":"application/json"},body:JSON.stringify(c)});if(shouldFallbackToLegacyUpload(u.status)){throw new LegacyUploadRequiredError}if(!u.ok){const t=await u.text();throw new Error(`Failed to create direct upload URL (HTTP ${u.status}): ${t}`)}const f=await u.json();const d={...f.requiredHeaders??{}};if(!hasHeaderIgnoreCase(d,"Content-Type")){d["Content-Type"]=a}const p=await fetch(f.uploadUrl,{method:"PUT",headers:d,body:l});if(!p.ok){const t=await p.text();throw new Error(`Direct artifact upload failed (HTTP ${p.status}): ${t}`)}const g={testResultId:e,ctrfAttachmentName:n,fileName:o,contentType:a,sizeBytes:h,storageKey:f.storageKey};const y=await fetch(`${r}/api/v1/artifacts/${s}/complete`,{method:"POST",headers:{"X-API-KEY":i,"Content-Type":"application/json"},body:JSON.stringify(g)});if(!y.ok){const t=await y.text();throw new Error(`Failed to finalize artifact upload (HTTP ${y.status}): ${t}`)}return true}async function uploadWithLegacyEndpoint(t){const{testResultId:e,attachmentName:s,reportId:i,apiKey:r,apiUrl:n,fileName:o,contentType:a,fileBuffer:h}=t;const l=new Blob([new Uint8Array(h)],{type:a});const c=new FormData;c.append("testResultId",e);c.append("ctrfAttachmentName",s);c.append("file",l,o);const u=await fetch(`${n}/api/v1/artifacts/${i}`,{method:"POST",headers:{"X-API-KEY":r},body:c});if(!u.ok){const t=await u.text();throw new Error(`Legacy artifact upload failed (HTTP ${u.status}): ${t}`)}return true}function shouldFallbackToLegacyUpload(t){return t===404||t===405||t===501}function hasHeaderIgnoreCase(t,e){const s=e.toLowerCase();return Object.keys(t).some((t=>t.toLowerCase()===s))}},328:function(t,e,s){var i=this&&this.__createBinding||(Object.create?function(t,e,s,i){if(i===undefined)i=s;var r=Object.getOwnPropertyDescriptor(e,s);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[s]}}}Object.defineProperty(t,i,r)}:function(t,e,s,i){if(i===undefined)i=s;t[i]=e[s]});var r=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var n=this&&this.__importStar||function(){var ownKeys=function(t){ownKeys=Object.getOwnPropertyNames||function(t){var e=[];for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s))e[e.length]=s;return e};return ownKeys(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var s=ownKeys(t),n=0;n<s.length;n++)if(s[n]!=="default")i(e,t,s[n]);r(e,t);return e}}();Object.defineProperty(e,"__esModule",{value:true});const o=s(447);const a=n(s(928));const h=n(s(943));const l=s(317);const c=s(10);function printUsage(){console.log(`\n@testream/cypress-reporter - Run Cypress tests and upload results to Testream\n\nUsage:\n npx @testream/cypress-reporter --api-key <key> [options]\n\nRequired arguments:\n --api-key, -k API key for authentication\n\nOptional arguments:\n --project <path> Path to Cypress project (defaults to current directory)\n --results-path <path> Skip running tests, use existing CTRF JSON file(s) instead\n \nGit context (auto-detected in CI):\n --branch Git branch name\n --commit-sha Git commit SHA\n --repository-url Git repository URL\n\nBuild metadata (auto-detected in CI):\n --build-name Build name/identifier\n --build-number Build number\n --build-url Build URL (CI pipeline URL)\n\nEnvironment metadata:\n --test-environment Test environment (e.g., staging, production, ci)\n --app-name Application name under test\n --app-version Application version under test\n --test-type Test type (e.g., unit, integration, e2e)\n\nUpload options:\n --no-upload Skip uploading results to backend\n --fail-on-error Fail the process if upload fails\n\nOther:\n --help, -h Show this help message\n -- <args> Additional arguments to pass to 'cypress run'\n\nExamples:\n # Run tests and upload (simplest usage)\n npx @testream/cypress-reporter -k your-api-key\n\n # Run tests for a specific project\n npx @testream/cypress-reporter -k your-api-key --project ./e2e\n\n # With environment metadata\n npx @testream/cypress-reporter -k your-api-key \\\n --test-environment staging --app-name MyApp --app-version 1.0.0\n\n # Pass additional arguments to cypress run\n npx @testream/cypress-reporter -k your-api-key -- --spec "cypress/e2e/**/*.cy.js"\n\n # Use existing CTRF results (skip running tests)\n npx @testream/cypress-reporter -k your-api-key --results-path ctrf/ctrf-report.json\n\nHow it works:\n 1. Runs 'cypress run' with cypress-ctrf-json-reporter\n 2. CTRF report is generated automatically by the reporter plugin\n 3. Uploads to Testream (project key inferred from API key)\n\nNo manual steps required - just run and upload!\n`)}function parseArgs(t){const e={uploadEnabled:true,failOnUploadError:false};const s=[];let i=false;for(let r=0;r<t.length;r++){const n=t[r];const o=t[r+1];if(n==="--"){i=true;continue}if(i){s.push(n);continue}switch(n){case"--help":case"-h":printUsage();process.exit(0);break;case"--api-key":case"-k":e.apiKey=o;r++;break;case"--project":e.projectPath=o;r++;break;case"--results-path":e.resultsPath=o;r++;break;case"--branch":e.branch=o;r++;break;case"--commit-sha":e.commitSha=o;r++;break;case"--repository-url":e.repositoryUrl=o;r++;break;case"--build-name":e.buildName=o;r++;break;case"--build-number":e.buildNumber=o;r++;break;case"--build-url":e.buildUrl=o;r++;break;case"--test-environment":e.testEnvironment=o;r++;break;case"--app-name":e.appName=o;r++;break;case"--app-version":e.appVersion=o;r++;break;case"--test-type":e.testType=o;r++;break;case"--no-upload":e.uploadEnabled=false;break;case"--fail-on-error":e.failOnUploadError=true;break}}if(s.length>0){e.cypressArgs=s}if(!e.apiKey&&e.uploadEnabled){console.error("Error: Missing required argument: --api-key");console.error("Run with --help for usage information.");return null}return e}async function findResultFiles(t){if(!t.includes("*")&&!t.includes("?")){return[a.resolve(t)]}const e=await(0,o.glob)(t,{absolute:true,nodir:true});return e}async function runCypress(t,e=[]){const s=console;const i=t?a.resolve(t):process.cwd();const r=a.join(i,"ctrf","ctrf-report.json");const n=["run"];n.push(...e);s.info("Running Cypress tests...");s.info(` Command: npx cypress ${n.join(" ")}`);s.info(` Working directory: ${i}`);s.info("");return new Promise(((t,e)=>{const s=(0,l.spawn)("npx",["cypress",...n],{cwd:i,stdio:["inherit","inherit","inherit"],shell:process.platform==="win32"});s.on("error",(t=>{e(new Error(`Failed to run Cypress: ${t.message}`))}));s.on("close",(async()=>{try{await h.access(r);t(r)}catch{e(new Error("No CTRF file generated. Make sure Cypress ran successfully."))}}))}))}async function main(){const t=process.argv.slice(2);if(t.length===0){printUsage();process.exit(1)}const e=parseArgs(t);if(!e){process.exit(1)}const s=console;try{let t;if(e.resultsPath){s.info("Using existing CTRF file(s)...");t=e.resultsPath}else{t=await runCypress(e.projectPath,e.cypressArgs);s.info("")}s.info(`Finding CTRF files: ${t}`);const i=await findResultFiles(t);if(i.length===0){throw new Error(`No CTRF files found matching: ${t}`)}s.info(` Found ${i.length} file(s):`);for(const t of i){s.info(` - ${a.basename(t)}`)}s.info("");s.info("Loading CTRF report...");const r=await h.readFile(i[0],"utf-8");const n=JSON.parse(r);s.info(` Tool: ${n.results.tool.name}`);if(n.results.tool.version){s.info(` Version: ${n.results.tool.version}`)}s.info("");if(!e.uploadEnabled){s.info("Upload disabled, skipping API upload");s.info("");s.info("=".repeat(60));s.info("Test run completed (upload skipped)");s.info(` Tests: ${n.results.summary.tests}`);s.info(` Passed: ${n.results.summary.passed}`);s.info(` Failed: ${n.results.summary.failed}`);s.info(` Skipped: ${n.results.summary.skipped}`);s.info("=".repeat(60));return}const o=await(0,c.uploadToApi)({report:n,apiKey:e.apiKey,branch:e.branch,commitSha:e.commitSha,repositoryUrl:e.repositoryUrl,buildName:e.buildName,buildNumber:e.buildNumber,buildUrl:e.buildUrl,testEnvironment:e.testEnvironment,appName:e.appName,appVersion:e.appVersion,testType:e.testType});if(!o.success){if(e.failOnUploadError){process.exit(1)}else{s.warn("Upload failed but continuing (use --fail-on-error to fail on upload errors)")}}}catch(t){const e=t instanceof Error?t.message:String(t);s.error(`Error: ${e}`);process.exit(1)}}main()},10:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.detectGitContext=void 0;e.uploadToApi=uploadToApi;const i=s(322);async function uploadToApi(t){const e=await(0,i.uploadTestRun)({report:t.report,apiKey:t.apiKey,apiUrl:t.apiUrl,commitSha:t.commitSha,branch:t.branch,repositoryUrl:t.repositoryUrl,buildName:t.buildName,buildNumber:t.buildNumber,buildUrl:t.buildUrl,testEnvironment:t.testEnvironment,appName:t.appName,appVersion:t.appVersion,testType:t.testType});if(!e.success||e.alreadyExists){return e}let s=0;if(e.testResults){const r=(0,i.mapAttachmentsToTestResults)(t.report.results.tests,e.testResults);if(r.length>0){s=await(0,i.uploadArtifacts)({reportId:e.reportId,apiKey:t.apiKey,apiUrl:t.apiUrl,testResults:r})}}return{...e,artifactCount:s}}e.detectGitContext=i.detectCIContext},317:t=>{t.exports=require("child_process")},896:t=>{t.exports=require("fs")},943:t=>{t.exports=require("fs/promises")},474:t=>{t.exports=require("node:events")},24:t=>{t.exports=require("node:fs")},455:t=>{t.exports=require("node:fs/promises")},760:t=>{t.exports=require("node:path")},75:t=>{t.exports=require("node:stream")},193:t=>{t.exports=require("node:string_decoder")},136:t=>{t.exports=require("node:url")},928:t=>{t.exports=require("path")},80:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.range=e.balanced=void 0;const balanced=(t,s,i)=>{const r=t instanceof RegExp?maybeMatch(t,i):t;const n=s instanceof RegExp?maybeMatch(s,i):s;const o=r!==null&&n!=null&&(0,e.range)(r,n,i);return o&&{start:o[0],end:o[1],pre:i.slice(0,o[0]),body:i.slice(o[0]+r.length,o[1]),post:i.slice(o[1]+n.length)}};e.balanced=balanced;const maybeMatch=(t,e)=>{const s=e.match(t);return s?s[0]:null};const range=(t,e,s)=>{let i,r,n,o=undefined,a;let h=s.indexOf(t);let l=s.indexOf(e,h+1);let c=h;if(h>=0&&l>0){if(t===e){return[h,l]}i=[];n=s.length;while(c>=0&&!a){if(c===h){i.push(c);h=s.indexOf(t,c+1)}else if(i.length===1){const t=i.pop();if(t!==undefined)a=[t,l]}else{r=i.pop();if(r!==undefined&&r<n){n=r;o=l}l=s.indexOf(e,c+1)}c=h<l&&h>=0?h:l}if(i.length&&o!==undefined){a=[n,o]}}return a};e.range=range},339:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.expand=expand;const i=s(80);const r="\0SLASH"+Math.random()+"\0";const n="\0OPEN"+Math.random()+"\0";const o="\0CLOSE"+Math.random()+"\0";const a="\0COMMA"+Math.random()+"\0";const h="\0PERIOD"+Math.random()+"\0";const l=new RegExp(r,"g");const c=new RegExp(n,"g");const u=new RegExp(o,"g");const f=new RegExp(a,"g");const d=new RegExp(h,"g");const p=/\\\\/g;const g=/\\{/g;const y=/\\}/g;const b=/\\,/g;const w=/\\./g;function numeric(t){return!isNaN(t)?parseInt(t,10):t.charCodeAt(0)}function escapeBraces(t){return t.replace(p,r).replace(g,n).replace(y,o).replace(b,a).replace(w,h)}function unescapeBraces(t){return t.replace(l,"\\").replace(c,"{").replace(u,"}").replace(f,",").replace(d,".")}function parseCommaParts(t){if(!t){return[""]}const e=[];const s=(0,i.balanced)("{","}",t);if(!s){return t.split(",")}const{pre:r,body:n,post:o}=s;const a=r.split(",");a[a.length-1]+="{"+n+"}";const h=parseCommaParts(o);if(o.length){a[a.length-1]+=h.shift();a.push.apply(a,h)}e.push.apply(e,a);return e}function expand(t){if(!t){return[]}if(t.slice(0,2)==="{}"){t="\\{\\}"+t.slice(2)}return expand_(escapeBraces(t),true).map(unescapeBraces)}function embrace(t){return"{"+t+"}"}function isPadded(t){return/^-?0\d/.test(t)}function lte(t,e){return t<=e}function gte(t,e){return t>=e}function expand_(t,e){const s=[];const r=(0,i.balanced)("{","}",t);if(!r)return[t];const n=r.pre;const a=r.post.length?expand_(r.post,false):[""];if(/\$$/.test(r.pre)){for(let t=0;t<a.length;t++){const e=n+"{"+r.body+"}"+a[t];s.push(e)}}else{const i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body);const h=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body);const l=i||h;const c=r.body.indexOf(",")>=0;if(!l&&!c){if(r.post.match(/,(?!,).*\}/)){t=r.pre+"{"+r.body+o+r.post;return expand_(t)}return[t]}let u;if(l){u=r.body.split(/\.\./)}else{u=parseCommaParts(r.body);if(u.length===1&&u[0]!==undefined){u=expand_(u[0],false).map(embrace);if(u.length===1){return a.map((t=>r.pre+u[0]+t))}}}let f;if(l&&u[0]!==undefined&&u[1]!==undefined){const t=numeric(u[0]);const e=numeric(u[1]);const s=Math.max(u[0].length,u[1].length);let i=u.length===3&&u[2]!==undefined?Math.abs(numeric(u[2])):1;let r=lte;const n=e<t;if(n){i*=-1;r=gte}const o=u.some(isPadded);f=[];for(let n=t;r(n,e);n+=i){let t;if(h){t=String.fromCharCode(n);if(t==="\\"){t=""}}else{t=String(n);if(o){const e=s-t.length;if(e>0){const s=new Array(e+1).join("0");if(n<0){t="-"+s+t.slice(1)}else{t=s+t}}}}f.push(t)}}else{f=[];for(let t=0;t<u.length;t++){f.push.apply(f,expand_(u[t],false))}}for(let t=0;t<f.length;t++){for(let i=0;i<a.length;i++){const r=n+f[t]+a[i];if(!e||l||r){s.push(r)}}}}return s}},809:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.Glob=void 0;const i=s(647);const r=s(136);const n=s(125);const o=s(841);const a=s(89);const h=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class Glob{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,e){if(!e)throw new TypeError("glob options required");this.withFileTypes=!!e.withFileTypes;this.signal=e.signal;this.follow=!!e.follow;this.dot=!!e.dot;this.dotRelative=!!e.dotRelative;this.nodir=!!e.nodir;this.mark=!!e.mark;if(!e.cwd){this.cwd=""}else if(e.cwd instanceof URL||e.cwd.startsWith("file://")){e.cwd=(0,r.fileURLToPath)(e.cwd)}this.cwd=e.cwd||"";this.root=e.root;this.magicalBraces=!!e.magicalBraces;this.nobrace=!!e.nobrace;this.noext=!!e.noext;this.realpath=!!e.realpath;this.absolute=e.absolute;this.includeChildMatches=e.includeChildMatches!==false;this.noglobstar=!!e.noglobstar;this.matchBase=!!e.matchBase;this.maxDepth=typeof e.maxDepth==="number"?e.maxDepth:Infinity;this.stat=!!e.stat;this.ignore=e.ignore;if(this.withFileTypes&&this.absolute!==undefined){throw new Error("cannot set absolute and withFileTypes:true")}if(typeof t==="string"){t=[t]}this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===false;if(this.windowsPathsNoEscape){t=t.map((t=>t.replace(/\\/g,"/")))}if(this.matchBase){if(e.noglobstar){throw new TypeError("base matching requires globstar")}t=t.map((t=>t.includes("/")?t:`./**/${t}`))}this.pattern=t;this.platform=e.platform||h;this.opts={...e,platform:this.platform};if(e.scurry){this.scurry=e.scurry;if(e.nocase!==undefined&&e.nocase!==e.scurry.nocase){throw new Error("nocase option contradicts provided scurry option")}}else{const t=e.platform==="win32"?n.PathScurryWin32:e.platform==="darwin"?n.PathScurryDarwin:e.platform?n.PathScurryPosix:n.PathScurry;this.scurry=new t(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;const s=this.platform==="darwin"||this.platform==="win32";const a={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:true,noext:this.noext,nonegate:true,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug};const l=this.pattern.map((t=>new i.Minimatch(t,a)));const[c,u]=l.reduce(((t,e)=>{t[0].push(...e.set);t[1].push(...e.globParts);return t}),[[],[]]);this.patterns=c.map(((t,e)=>{const s=u[e];if(!s)throw new Error("invalid pattern object");return new o.Pattern(t,s,0,this.platform)}))}async walk(){return[...await new a.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==Infinity?this.maxDepth+this.scurry.cwd.depth():Infinity,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new a.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==Infinity?this.maxDepth+this.scurry.cwd.depth():Infinity,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new a.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==Infinity?this.maxDepth+this.scurry.cwd.depth():Infinity,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new a.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==Infinity?this.maxDepth+this.scurry.cwd.depth():Infinity,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}e.Glob=Glob},233:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.hasMagic=void 0;const i=s(647);const hasMagic=(t,e={})=>{if(!Array.isArray(t)){t=[t]}for(const s of t){if(new i.Minimatch(s,e).hasMagic())return true}return false};e.hasMagic=hasMagic},449:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.Ignore=void 0;const i=s(647);const r=s(841);const n=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class Ignore{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:e,nocase:s,noext:i,noglobstar:r,platform:o=n}){this.relative=[];this.absolute=[];this.relativeChildren=[];this.absoluteChildren=[];this.platform=o;this.mmopts={dot:true,nobrace:e,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:o,nocomment:true,nonegate:true};for(const e of t)this.add(e)}add(t){const e=new i.Minimatch(t,this.mmopts);for(let t=0;t<e.set.length;t++){const s=e.set[t];const n=e.globParts[t];if(!s||!n){throw new Error("invalid pattern object")}while(s[0]==="."&&n[0]==="."){s.shift();n.shift()}const o=new r.Pattern(s,n,0,this.platform);const a=new i.Minimatch(o.globString(),this.mmopts);const h=n[n.length-1]==="**";const l=o.isAbsolute();if(l)this.absolute.push(a);else this.relative.push(a);if(h){if(l)this.absoluteChildren.push(a);else this.relativeChildren.push(a)}}}ignored(t){const e=t.fullpath();const s=`${e}/`;const i=t.relative()||".";const r=`${i}/`;for(const t of this.relative){if(t.match(i)||t.match(r))return true}for(const t of this.absolute){if(t.match(e)||t.match(s))return true}return false}childrenIgnored(t){const e=t.fullpath()+"/";const s=(t.relative()||".")+"/";for(const t of this.relativeChildren){if(t.match(s))return true}for(const t of this.absoluteChildren){if(t.match(e))return true}return false}}e.Ignore=Ignore},447:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.glob=e.sync=e.iterate=e.iterateSync=e.stream=e.streamSync=e.Ignore=e.hasMagic=e.Glob=e.unescape=e.escape=void 0;e.globStreamSync=globStreamSync;e.globStream=globStream;e.globSync=globSync;e.globIterateSync=globIterateSync;e.globIterate=globIterate;const i=s(647);const r=s(809);const n=s(233);var o=s(647);Object.defineProperty(e,"escape",{enumerable:true,get:function(){return o.escape}});Object.defineProperty(e,"unescape",{enumerable:true,get:function(){return o.unescape}});var a=s(809);Object.defineProperty(e,"Glob",{enumerable:true,get:function(){return a.Glob}});var h=s(233);Object.defineProperty(e,"hasMagic",{enumerable:true,get:function(){return h.hasMagic}});var l=s(449);Object.defineProperty(e,"Ignore",{enumerable:true,get:function(){return l.Ignore}});function globStreamSync(t,e={}){return new r.Glob(t,e).streamSync()}function globStream(t,e={}){return new r.Glob(t,e).stream()}function globSync(t,e={}){return new r.Glob(t,e).walkSync()}async function glob_(t,e={}){return new r.Glob(t,e).walk()}function globIterateSync(t,e={}){return new r.Glob(t,e).iterateSync()}function globIterate(t,e={}){return new r.Glob(t,e).iterate()}e.streamSync=globStreamSync;e.stream=Object.assign(globStream,{sync:globStreamSync});e.iterateSync=globIterateSync;e.iterate=Object.assign(globIterate,{sync:globIterateSync});e.sync=Object.assign(globSync,{stream:globStreamSync,iterate:globIterateSync});e.glob=Object.assign(glob_,{glob:glob_,globSync:globSync,sync:e.sync,globStream:globStream,stream:e.stream,globStreamSync:globStreamSync,streamSync:e.streamSync,globIterate:globIterate,iterate:e.iterate,globIterateSync:globIterateSync,iterateSync:e.iterateSync,Glob:r.Glob,hasMagic:n.hasMagic,escape:i.escape,unescape:i.unescape});e.glob.glob=e.glob},841:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.Pattern=void 0;const i=s(647);const isPatternList=t=>t.length>=1;const isGlobList=t=>t.length>=1;class Pattern{#t;#e;#s;length;#i;#r;#n;#o;#a;#h;#l=true;constructor(t,e,s,i){if(!isPatternList(t)){throw new TypeError("empty pattern list")}if(!isGlobList(e)){throw new TypeError("empty glob list")}if(e.length!==t.length){throw new TypeError("mismatched pattern list and glob list lengths")}this.length=t.length;if(s<0||s>=this.length){throw new TypeError("index out of range")}this.#t=t;this.#e=e;this.#s=s;this.#i=i;if(this.#s===0){if(this.isUNC()){const[t,e,s,i,...r]=this.#t;const[n,o,a,h,...l]=this.#e;if(r[0]===""){r.shift();l.shift()}const c=[t,e,s,i,""].join("/");const u=[n,o,a,h,""].join("/");this.#t=[c,...r];this.#e=[u,...l];this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){const[t,...e]=this.#t;const[s,...i]=this.#e;if(e[0]===""){e.shift();i.shift()}const r=t+"/";const n=s+"/";this.#t=[r,...e];this.#e=[n,...i];this.length=this.#t.length}}}pattern(){return this.#t[this.#s]}isString(){return typeof this.#t[this.#s]==="string"}isGlobstar(){return this.#t[this.#s]===i.GLOBSTAR}isRegExp(){return this.#t[this.#s]instanceof RegExp}globString(){return this.#n=this.#n||(this.#s===0?this.isAbsolute()?this.#e[0]+this.#e.slice(1).join("/"):this.#e.join("/"):this.#e.slice(this.#s).join("/"))}hasMore(){return this.length>this.#s+1}rest(){if(this.#r!==undefined)return this.#r;if(!this.hasMore())return this.#r=null;this.#r=new Pattern(this.#t,this.#e,this.#s+1,this.#i);this.#r.#h=this.#h;this.#r.#a=this.#a;this.#r.#o=this.#o;return this.#r}isUNC(){const t=this.#t;return this.#a!==undefined?this.#a:this.#a=this.#i==="win32"&&this.#s===0&&t[0]===""&&t[1]===""&&typeof t[2]==="string"&&!!t[2]&&typeof t[3]==="string"&&!!t[3]}isDrive(){const t=this.#t;return this.#o!==undefined?this.#o:this.#o=this.#i==="win32"&&this.#s===0&&this.length>1&&typeof t[0]==="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){const t=this.#t;return this.#h!==undefined?this.#h:this.#h=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){const t=this.#t[0];return typeof t==="string"&&this.isAbsolute()&&this.#s===0?t:""}checkFollowGlobstar(){return!(this.#s===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){if(this.#s===0||!this.isGlobstar()||!this.#l)return false;this.#l=false;return true}}e.Pattern=Pattern},999:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.Processor=e.SubWalks=e.MatchRecord=e.HasWalkedCache=void 0;const i=s(647);class HasWalkedCache{store;constructor(t=new Map){this.store=t}copy(){return new HasWalkedCache(new Map(this.store))}hasWalked(t,e){return this.store.get(t.fullpath())?.has(e.globString())}storeWalked(t,e){const s=t.fullpath();const i=this.store.get(s);if(i)i.add(e.globString());else this.store.set(s,new Set([e.globString()]))}}e.HasWalkedCache=HasWalkedCache;class MatchRecord{store=new Map;add(t,e,s){const i=(e?2:0)|(s?1:0);const r=this.store.get(t);this.store.set(t,r===undefined?i:i&r)}entries(){return[...this.store.entries()].map((([t,e])=>[t,!!(e&2),!!(e&1)]))}}e.MatchRecord=MatchRecord;class SubWalks{store=new Map;add(t,e){if(!t.canReaddir()){return}const s=this.store.get(t);if(s){if(!s.find((t=>t.globString()===e.globString()))){s.push(e)}}else this.store.set(t,[e])}get(t){const e=this.store.get(t);if(!e){throw new Error("attempting to walk unknown path")}return e}entries(){return this.keys().map((t=>[t,this.store.get(t)]))}keys(){return[...this.store.keys()].filter((t=>t.canReaddir()))}}e.SubWalks=SubWalks;class Processor{hasWalkedCache;matches=new MatchRecord;subwalks=new SubWalks;patterns;follow;dot;opts;constructor(t,e){this.opts=t;this.follow=!!t.follow;this.dot=!!t.dot;this.hasWalkedCache=e?e.copy():new HasWalkedCache}processPatterns(t,e){this.patterns=e;const s=e.map((e=>[t,e]));for(let[t,e]of s){this.hasWalkedCache.storeWalked(t,e);const s=e.root();const r=e.isAbsolute()&&this.opts.absolute!==false;if(s){t=t.resolve(s==="/"&&this.opts.root!==undefined?this.opts.root:s);const i=e.rest();if(!i){this.matches.add(t,true,false);continue}else{e=i}}if(t.isENOENT())continue;let n;let o;let a=false;while(typeof(n=e.pattern())==="string"&&(o=e.rest())){const s=t.resolve(n);t=s;e=o;a=true}n=e.pattern();o=e.rest();if(a){if(this.hasWalkedCache.hasWalked(t,e))continue;this.hasWalkedCache.storeWalked(t,e)}if(typeof n==="string"){const e=n===".."||n===""||n===".";this.matches.add(t.resolve(n),r,e);continue}else if(n===i.GLOBSTAR){if(!t.isSymbolicLink()||this.follow||e.checkFollowGlobstar()){this.subwalks.add(t,e)}const s=o?.pattern();const i=o?.rest();if(!o||(s===""||s===".")&&!i){this.matches.add(t,r,s===""||s===".")}else{if(s===".."){const e=t.parent||t;if(!i)this.matches.add(e,r,true);else if(!this.hasWalkedCache.hasWalked(e,i)){this.subwalks.add(e,i)}}}}else if(n instanceof RegExp){this.subwalks.add(t,e)}}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new Processor(this.opts,this.hasWalkedCache)}filterEntries(t,e){const s=this.subwalks.get(t);const r=this.child();for(const t of e){for(const e of s){const s=e.isAbsolute();const n=e.pattern();const o=e.rest();if(n===i.GLOBSTAR){r.testGlobstar(t,e,o,s)}else if(n instanceof RegExp){r.testRegExp(t,n,o,s)}else{r.testString(t,n,o,s)}}}return r}testGlobstar(t,e,s,i){if(this.dot||!t.name.startsWith(".")){if(!e.hasMore()){this.matches.add(t,i,false)}if(t.canReaddir()){if(this.follow||!t.isSymbolicLink()){this.subwalks.add(t,e)}else if(t.isSymbolicLink()){if(s&&e.checkFollowGlobstar()){this.subwalks.add(t,s)}else if(e.markFollowGlobstar()){this.subwalks.add(t,e)}}}}if(s){const e=s.pattern();if(typeof e==="string"&&e!==".."&&e!==""&&e!=="."){this.testString(t,e,s.rest(),i)}else if(e===".."){const e=t.parent||t;this.subwalks.add(e,s)}else if(e instanceof RegExp){this.testRegExp(t,e,s.rest(),i)}}}testRegExp(t,e,s,i){if(!e.test(t.name))return;if(!s){this.matches.add(t,i,false)}else{this.subwalks.add(t,s)}}testString(t,e,s,i){if(!t.isNamed(e))return;if(!s){this.matches.add(t,i,false)}else{this.subwalks.add(t,s)}}}e.Processor=Processor},89:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.GlobStream=e.GlobWalker=e.GlobUtil=void 0;const i=s(31);const r=s(449);const n=s(999);const makeIgnore=(t,e)=>typeof t==="string"?new r.Ignore([t],e):Array.isArray(t)?new r.Ignore(t,e):t;class GlobUtil{path;patterns;opts;seen=new Set;paused=false;aborted=false;#c=[];#u;#f;signal;maxDepth;includeChildMatches;constructor(t,e,s){this.patterns=t;this.path=e;this.opts=s;this.#f=!s.posix&&s.platform==="win32"?"\\":"/";this.includeChildMatches=s.includeChildMatches!==false;if(s.ignore||!this.includeChildMatches){this.#u=makeIgnore(s.ignore??[],s);if(!this.includeChildMatches&&typeof this.#u.add!=="function"){const t="cannot ignore child matches, ignore lacks add() method.";throw new Error(t)}}this.maxDepth=s.maxDepth||Infinity;if(s.signal){this.signal=s.signal;this.signal.addEventListener("abort",(()=>{this.#c.length=0}))}}#d(t){return this.seen.has(t)||!!this.#u?.ignored?.(t)}#p(t){return!!this.#u?.childrenIgnored?.(t)}pause(){this.paused=true}resume(){if(this.signal?.aborted)return;this.paused=false;let t=undefined;while(!this.paused&&(t=this.#c.shift())){t()}}onResume(t){if(this.signal?.aborted)return;if(!this.paused){t()}else{this.#c.push(t)}}async matchCheck(t,e){if(e&&this.opts.nodir)return undefined;let s;if(this.opts.realpath){s=t.realpathCached()||await t.realpath();if(!s)return undefined;t=s}const i=t.isUnknown()||this.opts.stat;const r=i?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){const t=await r.realpath();if(t&&(t.isUnknown()||this.opts.stat)){await t.lstat()}}return this.matchCheckTest(r,e)}matchCheckTest(t,e){return t&&(this.maxDepth===Infinity||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#d(t)?t:undefined}matchCheckSync(t,e){if(e&&this.opts.nodir)return undefined;let s;if(this.opts.realpath){s=t.realpathCached()||t.realpathSync();if(!s)return undefined;t=s}const i=t.isUnknown()||this.opts.stat;const r=i?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){const t=r.realpathSync();if(t&&(t?.isUnknown()||this.opts.stat)){t.lstatSync()}}return this.matchCheckTest(r,e)}matchFinish(t,e){if(this.#d(t))return;if(!this.includeChildMatches&&this.#u?.add){const e=`${t.relativePosix()}/**`;this.#u.add(e)}const s=this.opts.absolute===undefined?e:this.opts.absolute;this.seen.add(t);const i=this.opts.mark&&t.isDirectory()?this.#f:"";if(this.opts.withFileTypes){this.matchEmit(t)}else if(s){const e=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(e+i)}else{const e=this.opts.posix?t.relativePosix():t.relative();const s=this.opts.dotRelative&&!e.startsWith(".."+this.#f)?"."+this.#f:"";this.matchEmit(!e?"."+i:s+e+i)}}async match(t,e,s){const i=await this.matchCheck(t,s);if(i)this.matchFinish(i,e)}matchSync(t,e,s){const i=this.matchCheckSync(t,s);if(i)this.matchFinish(i,e)}walkCB(t,e,s){if(this.signal?.aborted)s();this.walkCB2(t,e,new n.Processor(this.opts),s)}walkCB2(t,e,s,i){if(this.#p(t))return i();if(this.signal?.aborted)i();if(this.paused){this.onResume((()=>this.walkCB2(t,e,s,i)));return}s.processPatterns(t,e);let r=1;const next=()=>{if(--r===0)i()};for(const[t,e,i]of s.matches.entries()){if(this.#d(t))continue;r++;this.match(t,e,i).then((()=>next()))}for(const t of s.subwalkTargets()){if(this.maxDepth!==Infinity&&t.depth()>=this.maxDepth){continue}r++;const e=t.readdirCached();if(t.calledReaddir())this.walkCB3(t,e,s,next);else{t.readdirCB(((e,i)=>this.walkCB3(t,i,s,next)),true)}}next()}walkCB3(t,e,s,i){s=s.filterEntries(t,e);let r=1;const next=()=>{if(--r===0)i()};for(const[t,e,i]of s.matches.entries()){if(this.#d(t))continue;r++;this.match(t,e,i).then((()=>next()))}for(const[t,e]of s.subwalks.entries()){r++;this.walkCB2(t,e,s.child(),next)}next()}walkCBSync(t,e,s){if(this.signal?.aborted)s();this.walkCB2Sync(t,e,new n.Processor(this.opts),s)}walkCB2Sync(t,e,s,i){if(this.#p(t))return i();if(this.signal?.aborted)i();if(this.paused){this.onResume((()=>this.walkCB2Sync(t,e,s,i)));return}s.processPatterns(t,e);let r=1;const next=()=>{if(--r===0)i()};for(const[t,e,i]of s.matches.entries()){if(this.#d(t))continue;this.matchSync(t,e,i)}for(const t of s.subwalkTargets()){if(this.maxDepth!==Infinity&&t.depth()>=this.maxDepth){continue}r++;const e=t.readdirSync();this.walkCB3Sync(t,e,s,next)}next()}walkCB3Sync(t,e,s,i){s=s.filterEntries(t,e);let r=1;const next=()=>{if(--r===0)i()};for(const[t,e,i]of s.matches.entries()){if(this.#d(t))continue;this.matchSync(t,e,i)}for(const[t,e]of s.subwalks.entries()){r++;this.walkCB2Sync(t,e,s.child(),next)}next()}}e.GlobUtil=GlobUtil;class GlobWalker extends GlobUtil{matches=new Set;constructor(t,e,s){super(t,e,s)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown()){await this.path.lstat()}await new Promise(((t,e)=>{this.walkCB(this.path,this.patterns,(()=>{if(this.signal?.aborted){e(this.signal.reason)}else{t(this.matches)}}))}));return this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown()){this.path.lstatSync()}this.walkCBSync(this.path,this.patterns,(()=>{if(this.signal?.aborted)throw this.signal.reason}));return this.matches}}e.GlobWalker=GlobWalker;class GlobStream extends GlobUtil{results;constructor(t,e,s){super(t,e,s);this.results=new i.Minipass({signal:this.signal,objectMode:true});this.results.on("drain",(()=>this.resume()));this.results.on("resume",(()=>this.resume()))}matchEmit(t){this.results.write(t);if(!this.results.flowing)this.pause()}stream(){const t=this.path;if(t.isUnknown()){t.lstat().then((()=>{this.walkCB(t,this.patterns,(()=>this.results.end()))}))}else{this.walkCB(t,this.patterns,(()=>this.results.end()))}return this.results}streamSync(){if(this.path.isUnknown()){this.path.lstatSync()}this.walkCBSync(this.path,this.patterns,(()=>this.results.end()));return this.results}}e.GlobStream=GlobStream},481:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.LRUCache=void 0;const s=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date;const i=new Set;const r=typeof process==="object"&&!!process?process:{};const emitWarning=(t,e,s,i)=>{typeof r.emitWarning==="function"?r.emitWarning(t,e,s,i):console.error(`[${s}] ${e}: ${t}`)};let n=globalThis.AbortController;let o=globalThis.AbortSignal;if(typeof n==="undefined"){o=class AbortSignal{onabort;_onabort=[];reason;aborted=false;addEventListener(t,e){this._onabort.push(e)}};n=class AbortController{constructor(){warnACPolyfill()}signal=new o;abort(t){if(this.signal.aborted)return;this.signal.reason=t;this.signal.aborted=true;for(const e of this.signal._onabort){e(t)}this.signal.onabort?.(t)}};let t=r.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1";const warnACPolyfill=()=>{if(!t)return;t=false;emitWarning("AbortController is not defined. If using lru-cache in "+"node 14, load an AbortController polyfill from the "+"`node-abort-controller` package. A minimal polyfill is "+"provided for use by LRUCache.fetch(), but it should not be "+"relied upon in other contexts (eg, passing it to other APIs that "+"use AbortController/AbortSignal might have undesirable effects). "+"You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",warnACPolyfill)}}const shouldWarn=t=>!i.has(t);const a=Symbol("type");const isPosInt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t);const getUintArray=t=>!isPosInt(t)?null:t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ZeroArray:null;class ZeroArray extends Array{constructor(t){super(t);this.fill(0)}}class Stack{heap;length;static#m=false;static create(t){const e=getUintArray(t);if(!e)return[];Stack.#m=true;const s=new Stack(t,e);Stack.#m=false;return s}constructor(t,e){if(!Stack.#m){throw new TypeError("instantiate Stack using Stack.create(n)")}this.heap=new e(t);this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class LRUCache{#g;#y;#b;#w;#S;#v;#T;#k;get perf(){return this.#k}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#x;#E;#_;#C;#R;#P;#A;#O;#L;#I;#M;#U;#B;#F;#N;#j;#D;#z;#W;static unsafeExposeInternals(t){return{starts:t.#B,ttls:t.#F,autopurgeTimers:t.#N,sizes:t.#U,keyMap:t.#_,keyList:t.#C,valList:t.#R,next:t.#P,prev:t.#A,get head(){return t.#O},get tail(){return t.#L},free:t.#I,isBackgroundFetch:e=>t.#G(e),backgroundFetch:(e,s,i,r)=>t.#$(e,s,i,r),moveToTail:e=>t.#H(e),indexes:e=>t.#q(e),rindexes:e=>t.#K(e),isStale:e=>t.#V(e)}}get max(){return this.#g}get maxSize(){return this.#y}get calculatedSize(){return this.#E}get size(){return this.#x}get fetchMethod(){return this.#v}get memoMethod(){return this.#T}get dispose(){return this.#b}get onInsert(){return this.#w}get disposeAfter(){return this.#S}constructor(t){const{max:e=0,ttl:r,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:h,allowStale:l,dispose:c,onInsert:u,disposeAfter:f,noDisposeOnSet:d,noUpdateTTL:p,maxSize:g=0,maxEntrySize:y=0,sizeCalculation:b,fetchMethod:w,memoMethod:S,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:T,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:x,ignoreFetchAbort:E,perf:_}=t;if(_!==undefined){if(typeof _?.now!=="function"){throw new TypeError("perf option must have a now() method if specified")}}this.#k=_??s;if(e!==0&&!isPosInt(e)){throw new TypeError("max option must be a nonnegative integer")}const C=e?getUintArray(e):Array;if(!C){throw new Error("invalid max value: "+e)}this.#g=e;this.#y=g;this.maxEntrySize=y||this.#y;this.sizeCalculation=b;if(this.sizeCalculation){if(!this.#y&&!this.maxEntrySize){throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize")}if(typeof this.sizeCalculation!=="function"){throw new TypeError("sizeCalculation set to non-function")}}if(S!==undefined&&typeof S!=="function"){throw new TypeError("memoMethod must be a function if defined")}this.#T=S;if(w!==undefined&&typeof w!=="function"){throw new TypeError("fetchMethod must be a function if specified")}this.#v=w;this.#D=!!w;this.#_=new Map;this.#C=new Array(e).fill(undefined);this.#R=new Array(e).fill(undefined);this.#P=new C(e);this.#A=new C(e);this.#O=0;this.#L=0;this.#I=Stack.create(e);this.#x=0;this.#E=0;if(typeof c==="function"){this.#b=c}if(typeof u==="function"){this.#w=u}if(typeof f==="function"){this.#S=f;this.#M=[]}else{this.#S=undefined;this.#M=undefined}this.#j=!!this.#b;this.#W=!!this.#w;this.#z=!!this.#S;this.noDisposeOnSet=!!d;this.noUpdateTTL=!!p;this.noDeleteOnFetchRejection=!!v;this.allowStaleOnFetchRejection=!!k;this.allowStaleOnFetchAbort=!!x;this.ignoreFetchAbort=!!E;if(this.maxEntrySize!==0){if(this.#y!==0){if(!isPosInt(this.#y)){throw new TypeError("maxSize must be a positive integer if specified")}}if(!isPosInt(this.maxEntrySize)){throw new TypeError("maxEntrySize must be a positive integer if specified")}this.#Y()}this.allowStale=!!l;this.noDeleteOnStaleGet=!!T;this.updateAgeOnGet=!!a;this.updateAgeOnHas=!!h;this.ttlResolution=isPosInt(n)||n===0?n:1;this.ttlAutopurge=!!o;this.ttl=r||0;if(this.ttl){if(!isPosInt(this.ttl)){throw new TypeError("ttl must be a positive integer if specified")}this.#J()}if(this.#g===0&&this.ttl===0&&this.#y===0){throw new TypeError("At least one of max, maxSize, or ttl is required")}if(!this.ttlAutopurge&&!this.#g&&!this.#y){const t="LRU_CACHE_UNBOUNDED";if(shouldWarn(t)){i.add(t);const e="TTL caching without ttlAutopurge, max, or maxSize can "+"result in unbounded memory consumption.";emitWarning(e,"UnboundedCacheWarning",t,LRUCache)}}}getRemainingTTL(t){return this.#_.has(t)?Infinity:0}#J(){const t=new ZeroArray(this.#g);const e=new ZeroArray(this.#g);this.#F=t;this.#B=e;const s=this.ttlAutopurge?new Array(this.#g):undefined;this.#N=s;this.#Z=(i,r,n=this.#k.now())=>{e[i]=r!==0?n:0;t[i]=r;if(s?.[i]){clearTimeout(s[i]);s[i]=undefined}if(r!==0&&s){const t=setTimeout((()=>{if(this.#V(i)){this.#X(this.#C[i],"expire")}}),r+1);if(t.unref){t.unref()}s[i]=t}};this.#Q=s=>{e[s]=t[s]!==0?this.#k.now():0};this.#tt=(s,r)=>{if(t[r]){const n=t[r];const o=e[r];if(!n||!o)return;s.ttl=n;s.start=o;s.now=i||getNow();const a=s.now-o;s.remainingTTL=n-a}};let i=0;const getNow=()=>{const t=this.#k.now();if(this.ttlResolution>0){i=t;const e=setTimeout((()=>i=0),this.ttlResolution);if(e.unref){e.unref()}}return t};this.getRemainingTTL=s=>{const r=this.#_.get(s);if(r===undefined){return 0}const n=t[r];const o=e[r];if(!n||!o){return Infinity}const a=(i||getNow())-o;return n-a};this.#V=s=>{const r=e[s];const n=t[s];return!!n&&!!r&&(i||getNow())-r>n}}#Q=()=>{};#tt=()=>{};#Z=()=>{};#V=()=>false;#Y(){const t=new ZeroArray(this.#g);this.#E=0;this.#U=t;this.#et=e=>{this.#E-=t[e];t[e]=0};this.#st=(t,e,s,i)=>{if(this.#G(e)){return 0}if(!isPosInt(s)){if(i){if(typeof i!=="function"){throw new TypeError("sizeCalculation must be a function")}s=i(e,t);if(!isPosInt(s)){throw new TypeError("sizeCalculation return invalid (expect positive integer)")}}else{throw new TypeError("invalid size value (must be positive integer). "+"When maxSize or maxEntrySize is used, sizeCalculation "+"or size must be set.")}}return s};this.#it=(e,s,i)=>{t[e]=s;if(this.#y){const s=this.#y-t[e];while(this.#E>s){this.#rt(true)}}this.#E+=t[e];if(i){i.entrySize=s;i.totalCalculatedSize=this.#E}}}#et=t=>{};#it=(t,e,s)=>{};#st=(t,e,s,i)=>{if(s||i){throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}return 0};*#q({allowStale:t=this.allowStale}={}){if(this.#x){for(let e=this.#L;true;){if(!this.#nt(e)){break}if(t||!this.#V(e)){yield e}if(e===this.#O){break}else{e=this.#A[e]}}}}*#K({allowStale:t=this.allowStale}={}){if(this.#x){for(let e=this.#O;true;){if(!this.#nt(e)){break}if(t||!this.#V(e)){yield e}if(e===this.#L){break}else{e=this.#P[e]}}}}#nt(t){return t!==undefined&&this.#_.get(this.#C[t])===t}*entries(){for(const t of this.#q()){if(this.#R[t]!==undefined&&this.#C[t]!==undefined&&!this.#G(this.#R[t])){yield[this.#C[t],this.#R[t]]}}}*rentries(){for(const t of this.#K()){if(this.#R[t]!==undefined&&this.#C[t]!==undefined&&!this.#G(this.#R[t])){yield[this.#C[t],this.#R[t]]}}}*keys(){for(const t of this.#q()){const e=this.#C[t];if(e!==undefined&&!this.#G(this.#R[t])){yield e}}}*rkeys(){for(const t of this.#K()){const e=this.#C[t];if(e!==undefined&&!this.#G(this.#R[t])){yield e}}}*values(){for(const t of this.#q()){const e=this.#R[t];if(e!==undefined&&!this.#G(this.#R[t])){yield this.#R[t]}}}*rvalues(){for(const t of this.#K()){const e=this.#R[t];if(e!==undefined&&!this.#G(this.#R[t])){yield this.#R[t]}}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(const s of this.#q()){const i=this.#R[s];const r=this.#G(i)?i.__staleWhileFetching:i;if(r===undefined)continue;if(t(r,this.#C[s],this)){return this.get(this.#C[s],e)}}}forEach(t,e=this){for(const s of this.#q()){const i=this.#R[s];const r=this.#G(i)?i.__staleWhileFetching:i;if(r===undefined)continue;t.call(e,r,this.#C[s],this)}}rforEach(t,e=this){for(const s of this.#K()){const i=this.#R[s];const r=this.#G(i)?i.__staleWhileFetching:i;if(r===undefined)continue;t.call(e,r,this.#C[s],this)}}purgeStale(){let t=false;for(const e of this.#K({allowStale:true})){if(this.#V(e)){this.#X(this.#C[e],"expire");t=true}}return t}info(t){const e=this.#_.get(t);if(e===undefined)return undefined;const s=this.#R[e];const i=this.#G(s)?s.__staleWhileFetching:s;if(i===undefined)return undefined;const r={value:i};if(this.#F&&this.#B){const t=this.#F[e];const s=this.#B[e];if(t&&s){const e=t-(this.#k.now()-s);r.ttl=e;r.start=Date.now()}}if(this.#U){r.size=this.#U[e]}return r}dump(){const t=[];for(const e of this.#q({allowStale:true})){const s=this.#C[e];const i=this.#R[e];const r=this.#G(i)?i.__staleWhileFetching:i;if(r===undefined||s===undefined)continue;const n={value:r};if(this.#F&&this.#B){n.ttl=this.#F[e];const t=this.#k.now()-this.#B[e];n.start=Math.floor(Date.now()-t)}if(this.#U){n.size=this.#U[e]}t.unshift([s,n])}return t}load(t){this.clear();for(const[e,s]of t){if(s.start){const t=Date.now()-s.start;s.start=this.#k.now()-t}this.set(e,s.value,s)}}set(t,e,s={}){if(e===undefined){this.delete(t);return this}const{ttl:i=this.ttl,start:r,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:a}=s;let{noUpdateTTL:h=this.noUpdateTTL}=s;const l=this.#st(t,e,s.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize){if(a){a.set="miss";a.maxEntrySizeExceeded=true}this.#X(t,"set");return this}let c=this.#x===0?undefined:this.#_.get(t);if(c===undefined){c=this.#x===0?this.#L:this.#I.length!==0?this.#I.pop():this.#x===this.#g?this.#rt(false):this.#x;this.#C[c]=t;this.#R[c]=e;this.#_.set(t,c);this.#P[this.#L]=c;this.#A[c]=this.#L;this.#L=c;this.#x++;this.#it(c,l,a);if(a)a.set="add";h=false;if(this.#W){this.#w?.(e,t,"add")}}else{this.#H(c);const s=this.#R[c];if(e!==s){if(this.#D&&this.#G(s)){s.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:e}=s;if(e!==undefined&&!n){if(this.#j){this.#b?.(e,t,"set")}if(this.#z){this.#M?.push([e,t,"set"])}}}else if(!n){if(this.#j){this.#b?.(s,t,"set")}if(this.#z){this.#M?.push([s,t,"set"])}}this.#et(c);this.#it(c,l,a);this.#R[c]=e;if(a){a.set="replace";const t=s&&this.#G(s)?s.__staleWhileFetching:s;if(t!==undefined)a.oldValue=t}}else if(a){a.set="update"}if(this.#W){this.onInsert?.(e,t,e===s?"update":"replace")}}if(i!==0&&!this.#F){this.#J()}if(this.#F){if(!h){this.#Z(c,i,r)}if(a)this.#tt(a,c)}if(!n&&this.#z&&this.#M){const t=this.#M;let e;while(e=t?.shift()){this.#S?.(...e)}}return this}pop(){try{while(this.#x){const t=this.#R[this.#O];this.#rt(true);if(this.#G(t)){if(t.__staleWhileFetching){return t.__staleWhileFetching}}else if(t!==undefined){return t}}}finally{if(this.#z&&this.#M){const t=this.#M;let e;while(e=t?.shift()){this.#S?.(...e)}}}}#rt(t){const e=this.#O;const s=this.#C[e];const i=this.#R[e];if(this.#D&&this.#G(i)){i.__abortController.abort(new Error("evicted"))}else if(this.#j||this.#z){if(this.#j){this.#b?.(i,s,"evict")}if(this.#z){this.#M?.push([i,s,"evict"])}}this.#et(e);if(this.#N?.[e]){clearTimeout(this.#N[e]);this.#N[e]=undefined}if(t){this.#C[e]=undefined;this.#R[e]=undefined;this.#I.push(e)}if(this.#x===1){this.#O=this.#L=0;this.#I.length=0}else{this.#O=this.#P[e]}this.#_.delete(s);this.#x--;return e}has(t,e={}){const{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=e;const r=this.#_.get(t);if(r!==undefined){const t=this.#R[r];if(this.#G(t)&&t.__staleWhileFetching===undefined){return false}if(!this.#V(r)){if(s){this.#Q(r)}if(i){i.has="hit";this.#tt(i,r)}return true}else if(i){i.has="stale";this.#tt(i,r)}}else if(i){i.has="miss"}return false}peek(t,e={}){const{allowStale:s=this.allowStale}=e;const i=this.#_.get(t);if(i===undefined||!s&&this.#V(i)){return}const r=this.#R[i];return this.#G(r)?r.__staleWhileFetching:r}#$(t,e,s,i){const r=e===undefined?undefined:this.#R[e];if(this.#G(r)){return r}const o=new n;const{signal:a}=s;a?.addEventListener("abort",(()=>o.abort(a.reason)),{signal:o.signal});const h={signal:o.signal,options:s,context:i};const cb=(i,r=false)=>{const{aborted:n}=o.signal;const a=s.ignoreFetchAbort&&i!==undefined;if(s.status){if(n&&!r){s.status.fetchAborted=true;s.status.fetchError=o.signal.reason;if(a)s.status.fetchAbortIgnored=true}else{s.status.fetchResolved=true}}if(n&&!a&&!r){return fetchFail(o.signal.reason)}const c=l;const u=this.#R[e];if(u===l||a&&r&&u===undefined){if(i===undefined){if(c.__staleWhileFetching!==undefined){this.#R[e]=c.__staleWhileFetching}else{this.#X(t,"fetch")}}else{if(s.status)s.status.fetchUpdated=true;this.set(t,i,h.options)}}return i};const eb=t=>{if(s.status){s.status.fetchRejected=true;s.status.fetchError=t}return fetchFail(t)};const fetchFail=i=>{const{aborted:r}=o.signal;const n=r&&s.allowStaleOnFetchAbort;const a=n||s.allowStaleOnFetchRejection;const h=a||s.noDeleteOnFetchRejection;const c=l;if(this.#R[e]===l){const s=!h||c.__staleWhileFetching===undefined;if(s){this.#X(t,"fetch")}else if(!n){this.#R[e]=c.__staleWhileFetching}}if(a){if(s.status&&c.__staleWhileFetching!==undefined){s.status.returnedStale=true}return c.__staleWhileFetching}else if(c.__returned===c){throw i}};const pcall=(e,i)=>{const n=this.#v?.(t,r,h);if(n&&n instanceof Promise){n.then((t=>e(t===undefined?undefined:t)),i)}o.signal.addEventListener("abort",(()=>{if(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort){e(undefined);if(s.allowStaleOnFetchAbort){e=t=>cb(t,true)}}}))};if(s.status)s.status.fetchDispatched=true;const l=new Promise(pcall).then(cb,eb);const c=Object.assign(l,{__abortController:o,__staleWhileFetching:r,__returned:undefined});if(e===undefined){this.set(t,c,{...h.options,status:undefined});e=this.#_.get(t)}else{this.#R[e]=c}return c}#G(t){if(!this.#D)return false;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof n}async fetch(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:p,forceRefresh:g=false,status:y,signal:b}=e;if(!this.#D){if(y)y.fetch="get";return this.get(t,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:y})}const w={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:n,noDisposeOnSet:o,size:a,sizeCalculation:h,noUpdateTTL:l,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:d,ignoreFetchAbort:f,status:y,signal:b};let S=this.#_.get(t);if(S===undefined){if(y)y.fetch="miss";const e=this.#$(t,S,w,p);return e.__returned=e}else{const e=this.#R[S];if(this.#G(e)){const t=s&&e.__staleWhileFetching!==undefined;if(y){y.fetch="inflight";if(t)y.returnedStale=true}return t?e.__staleWhileFetching:e.__returned=e}const r=this.#V(S);if(!g&&!r){if(y)y.fetch="hit";this.#H(S);if(i){this.#Q(S)}if(y)this.#tt(y,S);return e}const n=this.#$(t,S,w,p);const o=n.__staleWhileFetching!==undefined;const a=o&&s;if(y){y.fetch=r?"stale":"refresh";if(a&&r)y.returnedStale=true}return a?n.__staleWhileFetching:n.__returned=n}}async forceFetch(t,e={}){const s=await this.fetch(t,e);if(s===undefined)throw new Error("fetch() returned undefined");return s}memo(t,e={}){const s=this.#T;if(!s){throw new Error("no memoMethod provided to constructor")}const{context:i,forceRefresh:r,...n}=e;const o=this.get(t,n);if(!r&&o!==undefined)return o;const a=s(t,o,{options:n,context:i});this.set(t,a,n);return a}get(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:n}=e;const o=this.#_.get(t);if(o!==undefined){const e=this.#R[o];const a=this.#G(e);if(n)this.#tt(n,o);if(this.#V(o)){if(n)n.get="stale";if(!a){if(!r){this.#X(t,"expire")}if(n&&s)n.returnedStale=true;return s?e:undefined}else{if(n&&s&&e.__staleWhileFetching!==undefined){n.returnedStale=true}return s?e.__staleWhileFetching:undefined}}else{if(n)n.get="hit";if(a){return e.__staleWhileFetching}this.#H(o);if(i){this.#Q(o)}return e}}else if(n){n.get="miss"}}#ot(t,e){this.#A[e]=t;this.#P[t]=e}#H(t){if(t!==this.#L){if(t===this.#O){this.#O=this.#P[t]}else{this.#ot(this.#A[t],this.#P[t])}this.#ot(this.#L,t);this.#L=t}}delete(t){return this.#X(t,"delete")}#X(t,e){let s=false;if(this.#x!==0){const i=this.#_.get(t);if(i!==undefined){if(this.#N?.[i]){clearTimeout(this.#N?.[i]);this.#N[i]=undefined}s=true;if(this.#x===1){this.#at(e)}else{this.#et(i);const s=this.#R[i];if(this.#G(s)){s.__abortController.abort(new Error("deleted"))}else if(this.#j||this.#z){if(this.#j){this.#b?.(s,t,e)}if(this.#z){this.#M?.push([s,t,e])}}this.#_.delete(t);this.#C[i]=undefined;this.#R[i]=undefined;if(i===this.#L){this.#L=this.#A[i]}else if(i===this.#O){this.#O=this.#P[i]}else{const t=this.#A[i];this.#P[t]=this.#P[i];const e=this.#P[i];this.#A[e]=this.#A[i]}this.#x--;this.#I.push(i)}}}if(this.#z&&this.#M?.length){const t=this.#M;let e;while(e=t?.shift()){this.#S?.(...e)}}return s}clear(){return this.#at("delete")}#at(t){for(const e of this.#K({allowStale:true})){const s=this.#R[e];if(this.#G(s)){s.__abortController.abort(new Error("deleted"))}else{const i=this.#C[e];if(this.#j){this.#b?.(s,i,t)}if(this.#z){this.#M?.push([s,i,t])}}}this.#_.clear();this.#R.fill(undefined);this.#C.fill(undefined);if(this.#F&&this.#B){this.#F.fill(0);this.#B.fill(0);for(const t of this.#N??[]){if(t!==undefined)clearTimeout(t)}this.#N?.fill(undefined)}if(this.#U){this.#U.fill(0)}this.#O=0;this.#L=0;this.#I.length=0;this.#E=0;this.#x=0;if(this.#z&&this.#M){const t=this.#M;let e;while(e=t?.shift()){this.#S?.(...e)}}}}e.LRUCache=LRUCache},557:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.assertValidPattern=void 0;const s=1024*64;const assertValidPattern=t=>{if(typeof t!=="string"){throw new TypeError("invalid pattern")}if(t.length>s){throw new TypeError("pattern is too long")}};e.assertValidPattern=assertValidPattern},743:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.AST=void 0;const i=s(694);const r=s(967);const n=new Set(["!","?","+","*","@"]);const isExtglobType=t=>n.has(t);const o="(?!(?:^|/)\\.\\.?(?:$|/))";const a="(?!\\.)";const h=new Set(["[","."]);const l=new Set(["..","."]);const c=new Set("().*{}+?[]^$\\!");const regExpEscape=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");const u="[^/]";const f=u+"*?";const d=u+"+?";class AST{type;#ht;#lt;#ct=false;#ut=[];#ft;#dt;#pt;#mt=false;#gt;#yt;#bt=false;constructor(t,e,s={}){this.type=t;if(t)this.#lt=true;this.#ft=e;this.#ht=this.#ft?this.#ft.#ht:this;this.#gt=this.#ht===this?s:this.#ht.#gt;this.#pt=this.#ht===this?[]:this.#ht.#pt;if(t==="!"&&!this.#ht.#mt)this.#pt.push(this);this.#dt=this.#ft?this.#ft.#ut.length:0}get hasMagic(){if(this.#lt!==undefined)return this.#lt;for(const t of this.#ut){if(typeof t==="string")continue;if(t.type||t.hasMagic)return this.#lt=true}return this.#lt}toString(){if(this.#yt!==undefined)return this.#yt;if(!this.type){return this.#yt=this.#ut.map((t=>String(t))).join("")}else{return this.#yt=this.type+"("+this.#ut.map((t=>String(t))).join("|")+")"}}#wt(){if(this!==this.#ht)throw new Error("should only call on root");if(this.#mt)return this;this.toString();this.#mt=true;let t;while(t=this.#pt.pop()){if(t.type!=="!")continue;let e=t;let s=e.#ft;while(s){for(let i=e.#dt+1;!s.type&&i<s.#ut.length;i++){for(const e of t.#ut){if(typeof e==="string"){throw new Error("string part in extglob AST??")}e.copyIn(s.#ut[i])}}e=s;s=e.#ft}}return this}push(...t){for(const e of t){if(e==="")continue;if(typeof e!=="string"&&!(e instanceof AST&&e.#ft===this)){throw new Error("invalid part: "+e)}this.#ut.push(e)}}toJSON(){const t=this.type===null?this.#ut.slice().map((t=>typeof t==="string"?t:t.toJSON())):[this.type,...this.#ut.map((t=>t.toJSON()))];if(this.isStart()&&!this.type)t.unshift([]);if(this.isEnd()&&(this===this.#ht||this.#ht.#mt&&this.#ft?.type==="!")){t.push({})}return t}isStart(){if(this.#ht===this)return true;if(!this.#ft?.isStart())return false;if(this.#dt===0)return true;const t=this.#ft;for(let e=0;e<this.#dt;e++){const s=t.#ut[e];if(!(s instanceof AST&&s.type==="!")){return false}}return true}isEnd(){if(this.#ht===this)return true;if(this.#ft?.type==="!")return true;if(!this.#ft?.isEnd())return false;if(!this.type)return this.#ft?.isEnd();const t=this.#ft?this.#ft.#ut.length:0;return this.#dt===t-1}copyIn(t){if(typeof t==="string")this.push(t);else this.push(t.clone(this))}clone(t){const e=new AST(this.type,t);for(const t of this.#ut){e.copyIn(t)}return e}static#St(t,e,s,i){let r=false;let n=false;let o=-1;let a=false;if(e.type===null){let h=s;let l="";while(h<t.length){const s=t.charAt(h++);if(r||s==="\\"){r=!r;l+=s;continue}if(n){if(h===o+1){if(s==="^"||s==="!"){a=true}}else if(s==="]"&&!(h===o+2&&a)){n=false}l+=s;continue}else if(s==="["){n=true;o=h;a=false;l+=s;continue}if(!i.noext&&isExtglobType(s)&&t.charAt(h)==="("){e.push(l);l="";const r=new AST(s,e);h=AST.#St(t,r,h,i);e.push(r);continue}l+=s}e.push(l);return h}let h=s+1;let l=new AST(null,e);const c=[];let u="";while(h<t.length){const s=t.charAt(h++);if(r||s==="\\"){r=!r;u+=s;continue}if(n){if(h===o+1){if(s==="^"||s==="!"){a=true}}else if(s==="]"&&!(h===o+2&&a)){n=false}u+=s;continue}else if(s==="["){n=true;o=h;a=false;u+=s;continue}if(isExtglobType(s)&&t.charAt(h)==="("){l.push(u);u="";const e=new AST(s,l);l.push(e);h=AST.#St(t,e,h,i);continue}if(s==="|"){l.push(u);u="";c.push(l);l=new AST(null,e);continue}if(s===")"){if(u===""&&e.#ut.length===0){e.#bt=true}l.push(u);u="";e.push(...c,l);return h}u+=s}e.type=null;e.#lt=undefined;e.#ut=[t.substring(s-1)];return h}static fromGlob(t,e={}){const s=new AST(null,undefined,e);AST.#St(t,s,0,e);return s}toMMPattern(){if(this!==this.#ht)return this.#ht.toMMPattern();const t=this.toString();const[e,s,i,r]=this.toRegExpSource();const n=i||this.#lt||this.#gt.nocase&&!this.#gt.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase();if(!n){return s}const o=(this.#gt.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,o),{_src:e,_glob:t})}get options(){return this.#gt}toRegExpSource(t){const e=t??!!this.#gt.dot;if(this.#ht===this)this.#wt();if(!this.type){const s=this.isStart()&&this.isEnd()&&!this.#ut.some((t=>typeof t!=="string"));const i=this.#ut.map((e=>{const[i,r,n,o]=typeof e==="string"?AST.#vt(e,this.#lt,s):e.toRegExpSource(t);this.#lt=this.#lt||n;this.#ct=this.#ct||o;return i})).join("");let n="";if(this.isStart()){if(typeof this.#ut[0]==="string"){const s=this.#ut.length===1&&l.has(this.#ut[0]);if(!s){const s=h;const r=e&&s.has(i.charAt(0))||i.startsWith("\\.")&&s.has(i.charAt(2))||i.startsWith("\\.\\.")&&s.has(i.charAt(4));const l=!e&&!t&&s.has(i.charAt(0));n=r?o:l?a:""}}}let c="";if(this.isEnd()&&this.#ht.#mt&&this.#ft?.type==="!"){c="(?:$|\\/)"}const u=n+i+c;return[u,(0,r.unescape)(i),this.#lt=!!this.#lt,this.#ct]}const s=this.type==="*"||this.type==="+";const i=this.type==="!"?"(?:(?!(?:":"(?:";let n=this.#Tt(e);if(this.isStart()&&this.isEnd()&&!n&&this.type!=="!"){const t=this.toString();this.#ut=[t];this.type=null;this.#lt=undefined;return[t,(0,r.unescape)(this.toString()),false,false]}let c=!s||t||e||!a?"":this.#Tt(true);if(c===n){c=""}if(c){n=`(?:${n})(?:${c})*?`}let u="";if(this.type==="!"&&this.#bt){u=(this.isStart()&&!e?a:"")+d}else{const s=this.type==="!"?"))"+(this.isStart()&&!e&&!t?a:"")+f+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&c?")":this.type==="*"&&c?`)?`:`)${this.type}`;u=i+n+s}return[u,(0,r.unescape)(n),this.#lt=!!this.#lt,this.#ct]}#Tt(t){return this.#ut.map((e=>{if(typeof e==="string"){throw new Error("string type in extglob ast??")}const[s,i,r,n]=e.toRegExpSource(t);this.#ct=this.#ct||n;return s})).filter((t=>!(this.isStart()&&this.isEnd())||!!t)).join("|")}static#vt(t,e,s=false){let n=false;let o="";let a=false;for(let r=0;r<t.length;r++){const h=t.charAt(r);if(n){n=false;o+=(c.has(h)?"\\":"")+h;continue}if(h==="\\"){if(r===t.length-1){o+="\\\\"}else{n=true}continue}if(h==="["){const[s,n,h,l]=(0,i.parseClass)(t,r);if(h){o+=s;a=a||n;r+=h-1;e=e||l;continue}}if(h==="*"){o+=s&&t==="*"?d:f;e=true;continue}if(h==="?"){o+=u;e=true;continue}o+=regExpEscape(h)}return[o,(0,r.unescape)(t),!!e,a]}}e.AST=AST},694:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.parseClass=void 0;const s={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",true],"[:alpha:]":["\\p{L}\\p{Nl}",true],"[:ascii:]":["\\x"+"00-\\x"+"7f",false],"[:blank:]":["\\p{Zs}\\t",true],"[:cntrl:]":["\\p{Cc}",true],"[:digit:]":["\\p{Nd}",true],"[:graph:]":["\\p{Z}\\p{C}",true,true],"[:lower:]":["\\p{Ll}",true],"[:print:]":["\\p{C}",true],"[:punct:]":["\\p{P}",true],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",true],"[:upper:]":["\\p{Lu}",true],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",true],"[:xdigit:]":["A-Fa-f0-9",false]};const braceEscape=t=>t.replace(/[[\]\\-]/g,"\\$&");const regexpEscape=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");const rangesToString=t=>t.join("");const parseClass=(t,e)=>{const i=e;if(t.charAt(i)!=="["){throw new Error("not in a brace expression")}const r=[];const n=[];let o=i+1;let a=false;let h=false;let l=false;let c=false;let u=i;let f="";t:while(o<t.length){const e=t.charAt(o);if((e==="!"||e==="^")&&o===i+1){c=true;o++;continue}if(e==="]"&&a&&!l){u=o+1;break}a=true;if(e==="\\"){if(!l){l=true;o++;continue}}if(e==="["&&!l){for(const[e,[a,l,c]]of Object.entries(s)){if(t.startsWith(e,o)){if(f){return["$.",false,t.length-i,true]}o+=e.length;if(c)n.push(a);else r.push(a);h=h||l;continue t}}}l=false;if(f){if(e>f){r.push(braceEscape(f)+"-"+braceEscape(e))}else if(e===f){r.push(braceEscape(e))}f="";o++;continue}if(t.startsWith("-]",o+1)){r.push(braceEscape(e+"-"));o+=2;continue}if(t.startsWith("-",o+1)){f=e;o+=2;continue}r.push(braceEscape(e));o++}if(u<o){return["",false,0,false]}if(!r.length&&!n.length){return["$.",false,t.length-i,true]}if(n.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!c){const t=r[0].length===2?r[0].slice(-1):r[0];return[regexpEscape(t),false,u-i,false]}const d="["+(c?"^":"")+rangesToString(r)+"]";const p="["+(c?"":"^")+rangesToString(n)+"]";const g=r.length&&n.length?"("+d+"|"+p+")":r.length?d:p;return[g,h,u-i,true]};e.parseClass=parseClass},516:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.escape=void 0;const escape=(t,{windowsPathsNoEscape:e=false,magicalBraces:s=false}={})=>{if(s){return e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&")}return e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")};e.escape=escape},647:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.unescape=e.escape=e.AST=e.Minimatch=e.match=e.makeRe=e.braceExpand=e.defaults=e.filter=e.GLOBSTAR=e.sep=e.minimatch=void 0;const i=s(339);const r=s(557);const n=s(743);const o=s(516);const a=s(967);const minimatch=(t,e,s={})=>{(0,r.assertValidPattern)(e);if(!s.nocomment&&e.charAt(0)==="#"){return false}return new Minimatch(e,s).match(t)};e.minimatch=minimatch;const h=/^\*+([^+@!?\*\[\(]*)$/;const starDotExtTest=t=>e=>!e.startsWith(".")&&e.endsWith(t);const starDotExtTestDot=t=>e=>e.endsWith(t);const starDotExtTestNocase=t=>{t=t.toLowerCase();return e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)};const starDotExtTestNocaseDot=t=>{t=t.toLowerCase();return e=>e.toLowerCase().endsWith(t)};const l=/^\*+\.\*+$/;const starDotStarTest=t=>!t.startsWith(".")&&t.includes(".");const starDotStarTestDot=t=>t!=="."&&t!==".."&&t.includes(".");const c=/^\.\*+$/;const dotStarTest=t=>t!=="."&&t!==".."&&t.startsWith(".");const u=/^\*+$/;const starTest=t=>t.length!==0&&!t.startsWith(".");const starTestDot=t=>t.length!==0&&t!=="."&&t!=="..";const f=/^\?+([^+@!?\*\[\(]*)?$/;const qmarksTestNocase=([t,e=""])=>{const s=qmarksTestNoExt([t]);if(!e)return s;e=e.toLowerCase();return t=>s(t)&&t.toLowerCase().endsWith(e)};const qmarksTestNocaseDot=([t,e=""])=>{const s=qmarksTestNoExtDot([t]);if(!e)return s;e=e.toLowerCase();return t=>s(t)&&t.toLowerCase().endsWith(e)};const qmarksTestDot=([t,e=""])=>{const s=qmarksTestNoExtDot([t]);return!e?s:t=>s(t)&&t.endsWith(e)};const qmarksTest=([t,e=""])=>{const s=qmarksTestNoExt([t]);return!e?s:t=>s(t)&&t.endsWith(e)};const qmarksTestNoExt=([t])=>{const e=t.length;return t=>t.length===e&&!t.startsWith(".")};const qmarksTestNoExtDot=([t])=>{const e=t.length;return t=>t.length===e&&t!=="."&&t!==".."};const d=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";const p={win32:{sep:"\\"},posix:{sep:"/"}};e.sep=d==="win32"?p.win32.sep:p.posix.sep;e.minimatch.sep=e.sep;e.GLOBSTAR=Symbol("globstar **");e.minimatch.GLOBSTAR=e.GLOBSTAR;const g="[^/]";const y=g+"*?";const b="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";const w="(?:(?!(?:\\/|^)\\.).)*?";const filter=(t,s={})=>i=>(0,e.minimatch)(i,t,s);e.filter=filter;e.minimatch.filter=e.filter;const ext=(t,e={})=>Object.assign({},t,e);const defaults=t=>{if(!t||typeof t!=="object"||!Object.keys(t).length){return e.minimatch}const s=e.minimatch;const m=(e,i,r={})=>s(e,i,ext(t,r));return Object.assign(m,{Minimatch:class Minimatch extends s.Minimatch{constructor(e,s={}){super(e,ext(t,s))}static defaults(e){return s.defaults(ext(t,e)).Minimatch}},AST:class AST extends s.AST{constructor(e,s,i={}){super(e,s,ext(t,i))}static fromGlob(e,i={}){return s.AST.fromGlob(e,ext(t,i))}},unescape:(e,i={})=>s.unescape(e,ext(t,i)),escape:(e,i={})=>s.escape(e,ext(t,i)),filter:(e,i={})=>s.filter(e,ext(t,i)),defaults:e=>s.defaults(ext(t,e)),makeRe:(e,i={})=>s.makeRe(e,ext(t,i)),braceExpand:(e,i={})=>s.braceExpand(e,ext(t,i)),match:(e,i,r={})=>s.match(e,i,ext(t,r)),sep:s.sep,GLOBSTAR:e.GLOBSTAR})};e.defaults=defaults;e.minimatch.defaults=e.defaults;const braceExpand=(t,e={})=>{(0,r.assertValidPattern)(t);if(e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)){return[t]}return(0,i.expand)(t)};e.braceExpand=braceExpand;e.minimatch.braceExpand=e.braceExpand;const makeRe=(t,e={})=>new Minimatch(t,e).makeRe();e.makeRe=makeRe;e.minimatch.makeRe=e.makeRe;const match=(t,e,s={})=>{const i=new Minimatch(e,s);t=t.filter((t=>i.match(t)));if(i.options.nonull&&!t.length){t.push(e)}return t};e.match=match;e.minimatch.match=e.match;const S=/[?*]|[+@!]\(.*?\)|\[|\]/;const regExpEscape=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class Minimatch{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){(0,r.assertValidPattern)(t);e=e||{};this.options=e;this.pattern=t;this.platform=e.platform||d;this.isWindows=this.platform==="win32";this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===false;if(this.windowsPathsNoEscape){this.pattern=this.pattern.replace(/\\/g,"/")}this.preserveMultipleSlashes=!!e.preserveMultipleSlashes;this.regexp=null;this.negate=false;this.nonegate=!!e.nonegate;this.comment=false;this.empty=false;this.partial=!!e.partial;this.nocase=!!this.options.nocase;this.windowsNoMagicRoot=e.windowsNoMagicRoot!==undefined?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase);this.globSet=[];this.globParts=[];this.set=[];this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1){return true}for(const t of this.set){for(const e of t){if(typeof e!=="string")return true}}return false}debug(...t){}make(){const t=this.pattern;const e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=true;return}if(!t){this.empty=true;return}this.parseNegate();this.globSet=[...new Set(this.braceExpand())];if(e.debug){this.debug=(...t)=>console.error(...t)}this.debug(this.pattern,this.globSet);const s=this.globSet.map((t=>this.slashSplit(t)));this.globParts=this.preprocess(s);this.debug(this.pattern,this.globParts);let i=this.globParts.map(((t,e,s)=>{if(this.isWindows&&this.windowsNoMagicRoot){const e=t[0]===""&&t[1]===""&&(t[2]==="?"||!S.test(t[2]))&&!S.test(t[3]);const s=/^[a-z]:/i.test(t[0]);if(e){return[...t.slice(0,4),...t.slice(4).map((t=>this.parse(t)))]}else if(s){return[t[0],...t.slice(1).map((t=>this.parse(t)))]}}return t.map((t=>this.parse(t)))}));this.debug(this.pattern,i);this.set=i.filter((t=>t.indexOf(false)===-1));if(this.isWindows){for(let t=0;t<this.set.length;t++){const e=this.set[t];if(e[0]===""&&e[1]===""&&this.globParts[t][2]==="?"&&typeof e[3]==="string"&&/^[a-z]:$/i.test(e[3])){e[2]="?"}}}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar){for(let e=0;e<t.length;e++){for(let s=0;s<t[e].length;s++){if(t[e][s]==="**"){t[e][s]="*"}}}}const{optimizationLevel:e=1}=this.options;if(e>=2){t=this.firstPhasePreProcess(t);t=this.secondPhasePreProcess(t)}else if(e>=1){t=this.levelOneOptimize(t)}else{t=this.adjascentGlobstarOptimize(t)}return t}adjascentGlobstarOptimize(t){return t.map((t=>{let e=-1;while(-1!==(e=t.indexOf("**",e+1))){let s=e;while(t[s+1]==="**"){s++}if(s!==e){t.splice(e,s-e)}}return t}))}levelOneOptimize(t){return t.map((t=>{t=t.reduce(((t,e)=>{const s=t[t.length-1];if(e==="**"&&s==="**"){return t}if(e===".."){if(s&&s!==".."&&s!=="."&&s!=="**"){t.pop();return t}}t.push(e);return t}),[]);return t.length===0?[""]:t}))}levelTwoFileOptimize(t){if(!Array.isArray(t)){t=this.slashSplit(t)}let e=false;do{e=false;if(!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){const i=t[s];if(s===1&&i===""&&t[0]==="")continue;if(i==="."||i===""){e=true;t.splice(s,1);s--}}if(t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")){e=true;t.pop()}}let s=0;while(-1!==(s=t.indexOf("..",s+1))){const i=t[s-1];if(i&&i!=="."&&i!==".."&&i!=="**"){e=true;t.splice(s-1,2);s-=2}}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=false;do{e=false;for(let s of t){let i=-1;while(-1!==(i=s.indexOf("**",i+1))){let r=i;while(s[r+1]==="**"){r++}if(r>i){s.splice(i+1,r-i)}let n=s[i+1];const o=s[i+2];const a=s[i+3];if(n!=="..")continue;if(!o||o==="."||o===".."||!a||a==="."||a===".."){continue}e=true;s.splice(i,1);const h=s.slice(0);h[i]="**";t.push(h);i--}if(!this.preserveMultipleSlashes){for(let t=1;t<s.length-1;t++){const i=s[t];if(t===1&&i===""&&s[0]==="")continue;if(i==="."||i===""){e=true;s.splice(t,1);t--}}if(s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")){e=true;s.pop()}}let r=0;while(-1!==(r=s.indexOf("..",r+1))){const t=s[r-1];if(t&&t!=="."&&t!==".."&&t!=="**"){e=true;const t=r===1&&s[r+1]==="**";const i=t?["."]:[];s.splice(r-1,2,...i);if(s.length===0)s.push("");r-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++){for(let s=e+1;s<t.length;s++){const i=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(i){t[e]=[];t[s]=i;break}}}return t.filter((t=>t.length))}partsMatch(t,e,s=false){let i=0;let r=0;let n=[];let o="";while(i<t.length&&r<e.length){if(t[i]===e[r]){n.push(o==="b"?e[r]:t[i]);i++;r++}else if(s&&t[i]==="**"&&e[r]===t[i+1]){n.push(t[i]);i++}else if(s&&e[r]==="**"&&t[i]===e[r+1]){n.push(e[r]);r++}else if(t[i]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(o==="b")return false;o="a";n.push(t[i]);i++;r++}else if(e[r]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(o==="a")return false;o="b";n.push(e[r]);i++;r++}else{return false}}return t.length===e.length&&n}parseNegate(){if(this.nonegate)return;const t=this.pattern;let e=false;let s=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++){e=!e;s++}if(s)this.pattern=t.slice(s);this.negate=e}matchOne(t,s,i=false){const r=this.options;if(this.isWindows){const e=typeof t[0]==="string"&&/^[a-z]:$/i.test(t[0]);const i=!e&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]);const r=typeof s[0]==="string"&&/^[a-z]:$/i.test(s[0]);const n=!r&&s[0]===""&&s[1]===""&&s[2]==="?"&&typeof s[3]==="string"&&/^[a-z]:$/i.test(s[3]);const o=i?3:e?0:undefined;const a=n?3:r?0:undefined;if(typeof o==="number"&&typeof a==="number"){const[e,i]=[t[o],s[a]];if(e.toLowerCase()===i.toLowerCase()){s[a]=e;if(a>o){s=s.slice(a)}else if(o>a){t=t.slice(o)}}}}const{optimizationLevel:n=1}=this.options;if(n>=2){t=this.levelTwoFileOptimize(t)}this.debug("matchOne",this,{file:t,pattern:s});this.debug("matchOne",t.length,s.length);for(var o=0,a=0,h=t.length,l=s.length;o<h&&a<l;o++,a++){this.debug("matchOne loop");var c=s[a];var u=t[o];this.debug(s,c,u);if(c===false){return false}if(c===e.GLOBSTAR){this.debug("GLOBSTAR",[s,c,u]);var f=o;var d=a+1;if(d===l){this.debug("** at the end");for(;o<h;o++){if(t[o]==="."||t[o]===".."||!r.dot&&t[o].charAt(0)===".")return false}return true}while(f<h){var p=t[f];this.debug("\nglobstar while",t,f,s,d,p);if(this.matchOne(t.slice(f),s.slice(d),i)){this.debug("globstar found match!",f,h,p);return true}else{if(p==="."||p===".."||!r.dot&&p.charAt(0)==="."){this.debug("dot detected!",t,f,s,d);break}this.debug("globstar swallow a segment, and continue");f++}}if(i){this.debug("\n>>> no match, partial?",t,f,s,d);if(f===h){return true}}return false}let n;if(typeof c==="string"){n=u===c;this.debug("string match",c,u,n)}else{n=c.test(u);this.debug("pattern match",c,u,n)}if(!n)return false}if(o===h&&a===l){return true}else if(o===h){return i}else if(a===l){return o===h-1&&t[o]===""}else{throw new Error("wtf?")}}braceExpand(){return(0,e.braceExpand)(this.pattern,this.options)}parse(t){(0,r.assertValidPattern)(t);const s=this.options;if(t==="**")return e.GLOBSTAR;if(t==="")return"";let i;let o=null;if(i=t.match(u)){o=s.dot?starTestDot:starTest}else if(i=t.match(h)){o=(s.nocase?s.dot?starDotExtTestNocaseDot:starDotExtTestNocase:s.dot?starDotExtTestDot:starDotExtTest)(i[1])}else if(i=t.match(f)){o=(s.nocase?s.dot?qmarksTestNocaseDot:qmarksTestNocase:s.dot?qmarksTestDot:qmarksTest)(i)}else if(i=t.match(l)){o=s.dot?starDotStarTestDot:starDotStarTest}else if(i=t.match(c)){o=dotStarTest}const a=n.AST.fromGlob(t,this.options).toMMPattern();if(o&&typeof a==="object"){Reflect.defineProperty(a,"test",{value:o})}return a}makeRe(){if(this.regexp||this.regexp===false)return this.regexp;const t=this.set;if(!t.length){this.regexp=false;return this.regexp}const s=this.options;const i=s.noglobstar?y:s.dot?b:w;const r=new Set(s.nocase?["i"]:[]);let n=t.map((t=>{const s=t.map((t=>{if(t instanceof RegExp){for(const e of t.flags.split(""))r.add(e)}return typeof t==="string"?regExpEscape(t):t===e.GLOBSTAR?e.GLOBSTAR:t._src}));s.forEach(((t,r)=>{const n=s[r+1];const o=s[r-1];if(t!==e.GLOBSTAR||o===e.GLOBSTAR){return}if(o===undefined){if(n!==undefined&&n!==e.GLOBSTAR){s[r+1]="(?:\\/|"+i+"\\/)?"+n}else{s[r]=i}}else if(n===undefined){s[r-1]=o+"(?:\\/|\\/"+i+")?"}else if(n!==e.GLOBSTAR){s[r-1]=o+"(?:\\/|\\/"+i+"\\/)"+n;s[r+1]=e.GLOBSTAR}}));const n=s.filter((t=>t!==e.GLOBSTAR));if(this.partial&&n.length>=1){const t=[];for(let e=1;e<=n.length;e++){t.push(n.slice(0,e).join("/"))}return"(?:"+t.join("|")+")"}return n.join("/")})).join("|");const[o,a]=t.length>1?["(?:",")"]:["",""];n="^"+o+n+a+"$";if(this.partial){n="^(?:\\/|"+o+n.slice(1,-1)+a+")$"}if(this.negate)n="^(?!"+n+").+$";try{this.regexp=new RegExp(n,[...r].join(""))}catch(t){this.regexp=false}return this.regexp}slashSplit(t){if(this.preserveMultipleSlashes){return t.split("/")}else if(this.isWindows&&/^\/\/[^\/]+/.test(t)){return["",...t.split(/\/+/)]}else{return t.split(/\/+/)}}match(t,e=this.partial){this.debug("match",t,this.pattern);if(this.comment){return false}if(this.empty){return t===""}if(t==="/"&&e){return true}const s=this.options;if(this.isWindows){t=t.split("\\").join("/")}const i=this.slashSplit(t);this.debug(this.pattern,"split",i);const r=this.set;this.debug(this.pattern,"set",r);let n=i[i.length-1];if(!n){for(let t=i.length-2;!n&&t>=0;t--){n=i[t]}}for(let t=0;t<r.length;t++){const o=r[t];let a=i;if(s.matchBase&&o.length===1){a=[n]}const h=this.matchOne(a,o,e);if(h){if(s.flipNegate){return true}return!this.negate}}if(s.flipNegate){return false}return this.negate}static defaults(t){return e.minimatch.defaults(t).Minimatch}}e.Minimatch=Minimatch;var v=s(743);Object.defineProperty(e,"AST",{enumerable:true,get:function(){return v.AST}});var T=s(516);Object.defineProperty(e,"escape",{enumerable:true,get:function(){return T.escape}});var k=s(967);Object.defineProperty(e,"unescape",{enumerable:true,get:function(){return k.unescape}});e.minimatch.AST=n.AST;e.minimatch.Minimatch=Minimatch;e.minimatch.escape=o.escape;e.minimatch.unescape=a.unescape},967:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.unescape=void 0;const unescape=(t,{windowsPathsNoEscape:e=false,magicalBraces:s=true}={})=>{if(s){return e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")}return e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")};e.unescape=unescape},31:function(t,e,s){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:true});e.Minipass=e.isWritable=e.isReadable=e.isStream=void 0;const r=typeof process==="object"&&process?process:{stdout:null,stderr:null};const n=s(474);const o=i(s(75));const a=s(193);const isStream=t=>!!t&&typeof t==="object"&&(t instanceof Minipass||t instanceof o.default||(0,e.isReadable)(t)||(0,e.isWritable)(t));e.isStream=isStream;const isReadable=t=>!!t&&typeof t==="object"&&t instanceof n.EventEmitter&&typeof t.pipe==="function"&&t.pipe!==o.default.Writable.prototype.pipe;e.isReadable=isReadable;const isWritable=t=>!!t&&typeof t==="object"&&t instanceof n.EventEmitter&&typeof t.write==="function"&&typeof t.end==="function";e.isWritable=isWritable;const h=Symbol("EOF");const l=Symbol("maybeEmitEnd");const c=Symbol("emittedEnd");const u=Symbol("emittingEnd");const f=Symbol("emittedError");const d=Symbol("closed");const p=Symbol("read");const g=Symbol("flush");const y=Symbol("flushChunk");const b=Symbol("encoding");const w=Symbol("decoder");const S=Symbol("flowing");const v=Symbol("paused");const T=Symbol("resume");const k=Symbol("buffer");const x=Symbol("pipes");const E=Symbol("bufferLength");const _=Symbol("bufferPush");const C=Symbol("bufferShift");const R=Symbol("objectMode");const P=Symbol("destroyed");const A=Symbol("error");const O=Symbol("emitData");const L=Symbol("emitEnd");const I=Symbol("emitEnd2");const M=Symbol("async");const U=Symbol("abort");const B=Symbol("aborted");const F=Symbol("signal");const N=Symbol("dataListeners");const j=Symbol("discarded");const defer=t=>Promise.resolve().then(t);const nodefer=t=>t();const isEndish=t=>t==="end"||t==="finish"||t==="prefinish";const isArrayBufferLike=t=>t instanceof ArrayBuffer||!!t&&typeof t==="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0;const isArrayBufferView=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t);class Pipe{src;dest;opts;ondrain;constructor(t,e,s){this.src=t;this.dest=e;this.opts=s;this.ondrain=()=>t[T]();this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe();if(this.opts.end)this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener("error",this.proxyErrors);super.unpipe()}constructor(t,e,s){super(t,e,s);this.proxyErrors=t=>e.emit("error",t);t.on("error",this.proxyErrors)}}const isObjectModeOptions=t=>!!t.objectMode;const isEncodingOptions=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer";class Minipass extends n.EventEmitter{[S]=false;[v]=false;[x]=[];[k]=[];[R];[b];[M];[w];[h]=false;[c]=false;[u]=false;[d]=false;[f]=null;[E]=0;[P]=false;[F];[B]=false;[N]=0;[j]=false;writable=true;readable=true;constructor(...t){const e=t[0]||{};super();if(e.objectMode&&typeof e.encoding==="string"){throw new TypeError("Encoding and objectMode may not be used together")}if(isObjectModeOptions(e)){this[R]=true;this[b]=null}else if(isEncodingOptions(e)){this[b]=e.encoding;this[R]=false}else{this[R]=false;this[b]=null}this[M]=!!e.async;this[w]=this[b]?new a.StringDecoder(this[b]):null;if(e&&e.debugExposeBuffer===true){Object.defineProperty(this,"buffer",{get:()=>this[k]})}if(e&&e.debugExposePipes===true){Object.defineProperty(this,"pipes",{get:()=>this[x]})}const{signal:s}=e;if(s){this[F]=s;if(s.aborted){this[U]()}else{s.addEventListener("abort",(()=>this[U]()))}}}get bufferLength(){return this[E]}get encoding(){return this[b]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[R]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[M]}set["async"](t){this[M]=this[M]||!!t}[U](){this[B]=true;this.emit("abort",this[F]?.reason);this.destroy(this[F]?.reason)}get aborted(){return this[B]}set aborted(t){}write(t,e,s){if(this[B])return false;if(this[h])throw new Error("write after end");if(this[P]){this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"}));return true}if(typeof e==="function"){s=e;e="utf8"}if(!e)e="utf8";const i=this[M]?defer:nodefer;if(!this[R]&&!Buffer.isBuffer(t)){if(isArrayBufferView(t)){t=Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(isArrayBufferLike(t)){t=Buffer.from(t)}else if(typeof t!=="string"){throw new Error("Non-contiguous data written to non-objectMode stream")}}if(this[R]){if(this[S]&&this[E]!==0)this[g](true);if(this[S])this.emit("data",t);else this[_](t);if(this[E]!==0)this.emit("readable");if(s)i(s);return this[S]}if(!t.length){if(this[E]!==0)this.emit("readable");if(s)i(s);return this[S]}if(typeof t==="string"&&!(e===this[b]&&!this[w]?.lastNeed)){t=Buffer.from(t,e)}if(Buffer.isBuffer(t)&&this[b]){t=this[w].write(t)}if(this[S]&&this[E]!==0)this[g](true);if(this[S])this.emit("data",t);else this[_](t);if(this[E]!==0)this.emit("readable");if(s)i(s);return this[S]}read(t){if(this[P])return null;this[j]=false;if(this[E]===0||t===0||t&&t>this[E]){this[l]();return null}if(this[R])t=null;if(this[k].length>1&&!this[R]){this[k]=[this[b]?this[k].join(""):Buffer.concat(this[k],this[E])]}const e=this[p](t||null,this[k][0]);this[l]();return e}[p](t,e){if(this[R])this[C]();else{const s=e;if(t===s.length||t===null)this[C]();else if(typeof s==="string"){this[k][0]=s.slice(t);e=s.slice(0,t);this[E]-=t}else{this[k][0]=s.subarray(t);e=s.subarray(0,t);this[E]-=t}}this.emit("data",e);if(!this[k].length&&!this[h])this.emit("drain");return e}end(t,e,s){if(typeof t==="function"){s=t;t=undefined}if(typeof e==="function"){s=e;e="utf8"}if(t!==undefined)this.write(t,e);if(s)this.once("end",s);this[h]=true;this.writable=false;if(this[S]||!this[v])this[l]();return this}[T](){if(this[P])return;if(!this[N]&&!this[x].length){this[j]=true}this[v]=false;this[S]=true;this.emit("resume");if(this[k].length)this[g]();else if(this[h])this[l]();else this.emit("drain")}resume(){return this[T]()}pause(){this[S]=false;this[v]=true;this[j]=false}get destroyed(){return this[P]}get flowing(){return this[S]}get paused(){return this[v]}[_](t){if(this[R])this[E]+=1;else this[E]+=t.length;this[k].push(t)}[C](){if(this[R])this[E]-=1;else this[E]-=this[k][0].length;return this[k].shift()}[g](t=false){do{}while(this[y](this[C]())&&this[k].length);if(!t&&!this[k].length&&!this[h])this.emit("drain")}[y](t){this.emit("data",t);return this[S]}pipe(t,e){if(this[P])return t;this[j]=false;const s=this[c];e=e||{};if(t===r.stdout||t===r.stderr)e.end=false;else e.end=e.end!==false;e.proxyErrors=!!e.proxyErrors;if(s){if(e.end)t.end()}else{this[x].push(!e.proxyErrors?new Pipe(this,t,e):new PipeProxyErrors(this,t,e));if(this[M])defer((()=>this[T]()));else this[T]()}return t}unpipe(t){const e=this[x].find((e=>e.dest===t));if(e){if(this[x].length===1){if(this[S]&&this[N]===0){this[S]=false}this[x]=[]}else this[x].splice(this[x].indexOf(e),1);e.unpipe()}}addListener(t,e){return this.on(t,e)}on(t,e){const s=super.on(t,e);if(t==="data"){this[j]=false;this[N]++;if(!this[x].length&&!this[S]){this[T]()}}else if(t==="readable"&&this[E]!==0){super.emit("readable")}else if(isEndish(t)&&this[c]){super.emit(t);this.removeAllListeners(t)}else if(t==="error"&&this[f]){const t=e;if(this[M])defer((()=>t.call(this,this[f])));else t.call(this,this[f])}return s}removeListener(t,e){return this.off(t,e)}off(t,e){const s=super.off(t,e);if(t==="data"){this[N]=this.listeners("data").length;if(this[N]===0&&!this[j]&&!this[x].length){this[S]=false}}return s}removeAllListeners(t){const e=super.removeAllListeners(t);if(t==="data"||t===undefined){this[N]=0;if(!this[j]&&!this[x].length){this[S]=false}}return e}get emittedEnd(){return this[c]}[l](){if(!this[u]&&!this[c]&&!this[P]&&this[k].length===0&&this[h]){this[u]=true;this.emit("end");this.emit("prefinish");this.emit("finish");if(this[d])this.emit("close");this[u]=false}}emit(t,...e){const s=e[0];if(t!=="error"&&t!=="close"&&t!==P&&this[P]){return false}else if(t==="data"){return!this[R]&&!s?false:this[M]?(defer((()=>this[O](s))),true):this[O](s)}else if(t==="end"){return this[L]()}else if(t==="close"){this[d]=true;if(!this[c]&&!this[P])return false;const t=super.emit("close");this.removeAllListeners("close");return t}else if(t==="error"){this[f]=s;super.emit(A,s);const t=!this[F]||this.listeners("error").length?super.emit("error",s):false;this[l]();return t}else if(t==="resume"){const t=super.emit("resume");this[l]();return t}else if(t==="finish"||t==="prefinish"){const e=super.emit(t);this.removeAllListeners(t);return e}const i=super.emit(t,...e);this[l]();return i}[O](t){for(const e of this[x]){if(e.dest.write(t)===false)this.pause()}const e=this[j]?false:super.emit("data",t);this[l]();return e}[L](){if(this[c])return false;this[c]=true;this.readable=false;return this[M]?(defer((()=>this[I]())),true):this[I]()}[I](){if(this[w]){const t=this[w].end();if(t){for(const e of this[x]){e.dest.write(t)}if(!this[j])super.emit("data",t)}}for(const t of this[x]){t.end()}const t=super.emit("end");this.removeAllListeners("end");return t}async collect(){const t=Object.assign([],{dataLength:0});if(!this[R])t.dataLength=0;const e=this.promise();this.on("data",(e=>{t.push(e);if(!this[R])t.dataLength+=e.length}));await e;return t}async concat(){if(this[R]){throw new Error("cannot concat in objectMode")}const t=await this.collect();return this[b]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,e)=>{this.on(P,(()=>e(new Error("stream destroyed"))));this.on("error",(t=>e(t)));this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[j]=false;let t=false;const stop=async()=>{this.pause();t=true;return{value:undefined,done:true}};const next=()=>{if(t)return stop();const e=this.read();if(e!==null)return Promise.resolve({done:false,value:e});if(this[h])return stop();let s;let i;const onerr=t=>{this.off("data",ondata);this.off("end",onend);this.off(P,ondestroy);stop();i(t)};const ondata=t=>{this.off("error",onerr);this.off("end",onend);this.off(P,ondestroy);this.pause();s({value:t,done:!!this[h]})};const onend=()=>{this.off("error",onerr);this.off("data",ondata);this.off(P,ondestroy);stop();s({done:true,value:undefined})};const ondestroy=()=>onerr(new Error("stream destroyed"));return new Promise(((t,e)=>{i=e;s=t;this.once(P,ondestroy);this.once("error",onerr);this.once("end",onend);this.once("data",ondata)}))};return{next:next,throw:stop,return:stop,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[j]=false;let t=false;const stop=()=>{this.pause();this.off(A,stop);this.off(P,stop);this.off("end",stop);t=true;return{done:true,value:undefined}};const next=()=>{if(t)return stop();const e=this.read();return e===null?stop():{done:false,value:e}};this.once("end",stop);this.once(A,stop);this.once(P,stop);return{next:next,throw:stop,return:stop,[Symbol.iterator](){return this}}}destroy(t){if(this[P]){if(t)this.emit("error",t);else this.emit(P);return this}this[P]=true;this[j]=true;this[k].length=0;this[E]=0;const e=this;if(typeof e.close==="function"&&!this[d])e.close();if(t)this.emit("error",t);else this.emit(P);return this}static get isStream(){return e.isStream}}e.Minipass=Minipass},125:function(t,e,s){var i=this&&this.__createBinding||(Object.create?function(t,e,s,i){if(i===undefined)i=s;var r=Object.getOwnPropertyDescriptor(e,s);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[s]}}}Object.defineProperty(t,i,r)}:function(t,e,s,i){if(i===undefined)i=s;t[i]=e[s]});var r=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var s in t)if(s!=="default"&&Object.prototype.hasOwnProperty.call(t,s))i(e,t,s);r(e,t);return e};Object.defineProperty(e,"__esModule",{value:true});e.PathScurry=e.Path=e.PathScurryDarwin=e.PathScurryPosix=e.PathScurryWin32=e.PathScurryBase=e.PathPosix=e.PathWin32=e.PathBase=e.ChildrenCache=e.ResolveCache=void 0;const o=s(481);const a=s(760);const h=s(136);const l=s(896);const c=n(s(24));const u=l.realpathSync.native;const f=s(455);const d=s(31);const p={lstatSync:l.lstatSync,readdir:l.readdir,readdirSync:l.readdirSync,readlinkSync:l.readlinkSync,realpathSync:u,promises:{lstat:f.lstat,readdir:f.readdir,readlink:f.readlink,realpath:f.realpath}};const fsFromOption=t=>!t||t===p||t===c?p:{...p,...t,promises:{...p.promises,...t.promises||{}}};const g=/^\\\\\?\\([a-z]:)\\?$/i;const uncToDrive=t=>t.replace(/\//g,"\\").replace(g,"$1\\");const y=/[\\\/]/;const b=0;const w=1;const S=2;const v=4;const T=6;const k=8;const x=10;const E=12;const _=15;const C=~_;const R=16;const P=32;const A=64;const O=128;const L=256;const I=512;const M=A|O|I;const U=1023;const entToType=t=>t.isFile()?k:t.isDirectory()?v:t.isSymbolicLink()?x:t.isCharacterDevice()?S:t.isBlockDevice()?T:t.isSocket()?E:t.isFIFO()?w:b;const B=new o.LRUCache({max:2**12});const normalize=t=>{const e=B.get(t);if(e)return e;const s=t.normalize("NFKD");B.set(t,s);return s};const F=new o.LRUCache({max:2**12});const normalizeNocase=t=>{const e=F.get(t);if(e)return e;const s=normalize(t.toLowerCase());F.set(t,s);return s};class ResolveCache extends o.LRUCache{constructor(){super({max:256})}}e.ResolveCache=ResolveCache;class ChildrenCache extends o.LRUCache{constructor(t=16*1024){super({maxSize:t,sizeCalculation:t=>t.length+1})}}e.ChildrenCache=ChildrenCache;const N=Symbol("PathScurry setAsCwd");class PathBase{name;root;roots;parent;nocase;isCWD=false;#kt;#xt;get dev(){return this.#xt}#Et;get mode(){return this.#Et}#_t;get nlink(){return this.#_t}#Ct;get uid(){return this.#Ct}#Rt;get gid(){return this.#Rt}#Pt;get rdev(){return this.#Pt}#At;get blksize(){return this.#At}#Ot;get ino(){return this.#Ot}#x;get size(){return this.#x}#Lt;get blocks(){return this.#Lt}#It;get atimeMs(){return this.#It}#Mt;get mtimeMs(){return this.#Mt}#Ut;get ctimeMs(){return this.#Ut}#Bt;get birthtimeMs(){return this.#Bt}#Ft;get atime(){return this.#Ft}#Nt;get mtime(){return this.#Nt}#jt;get ctime(){return this.#jt}#Dt;get birthtime(){return this.#Dt}#zt;#Wt;#Gt;#$t;#Ht;#qt;#Kt;#Vt;#Yt;#Jt;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=b,s,i,r,n,o){this.name=t;this.#zt=r?normalizeNocase(t):normalize(t);this.#Kt=e&U;this.nocase=r;this.roots=i;this.root=s||this;this.#Vt=n;this.#Gt=o.fullpath;this.#Ht=o.relative;this.#qt=o.relativePosix;this.parent=o.parent;if(this.parent){this.#kt=this.parent.#kt}else{this.#kt=fsFromOption(o.fs)}}depth(){if(this.#Wt!==undefined)return this.#Wt;if(!this.parent)return this.#Wt=0;return this.#Wt=this.parent.depth()+1}childrenCache(){return this.#Vt}resolve(t){if(!t){return this}const e=this.getRootString(t);const s=t.substring(e.length);const i=s.split(this.splitSep);const r=e?this.getRoot(e).#Zt(i):this.#Zt(i);return r}#Zt(t){let e=this;for(const s of t){e=e.child(s)}return e}children(){const t=this.#Vt.get(this);if(t){return t}const e=Object.assign([],{provisional:0});this.#Vt.set(this,e);this.#Kt&=~R;return e}child(t,e){if(t===""||t==="."){return this}if(t===".."){return this.parent||this}const s=this.children();const i=this.nocase?normalizeNocase(t):normalize(t);for(const t of s){if(t.#zt===i){return t}}const r=this.parent?this.sep:"";const n=this.#Gt?this.#Gt+r+t:undefined;const o=this.newChild(t,b,{...e,parent:this,fullpath:n});if(!this.canReaddir()){o.#Kt|=O}s.push(o);return o}relative(){if(this.isCWD)return"";if(this.#Ht!==undefined){return this.#Ht}const t=this.name;const e=this.parent;if(!e){return this.#Ht=this.name}const s=e.relative();return s+(!s||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#qt!==undefined)return this.#qt;const t=this.name;const e=this.parent;if(!e){return this.#qt=this.fullpathPosix()}const s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(this.#Gt!==undefined){return this.#Gt}const t=this.name;const e=this.parent;if(!e){return this.#Gt=this.name}const s=e.fullpath();const i=s+(!e.parent?"":this.sep)+t;return this.#Gt=i}fullpathPosix(){if(this.#$t!==undefined)return this.#$t;if(this.sep==="/")return this.#$t=this.fullpath();if(!this.parent){const t=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(t)){return this.#$t=`//?/${t}`}else{return this.#$t=t}}const t=this.parent;const e=t.fullpathPosix();const s=e+(!e||!t.parent?"":"/")+this.name;return this.#$t=s}isUnknown(){return(this.#Kt&_)===b}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#Kt&_)===k}isDirectory(){return(this.#Kt&_)===v}isCharacterDevice(){return(this.#Kt&_)===S}isBlockDevice(){return(this.#Kt&_)===T}isFIFO(){return(this.#Kt&_)===w}isSocket(){return(this.#Kt&_)===E}isSymbolicLink(){return(this.#Kt&x)===x}lstatCached(){return this.#Kt&P?this:undefined}readlinkCached(){return this.#Yt}realpathCached(){return this.#Jt}readdirCached(){const t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#Yt)return true;if(!this.parent)return false;const t=this.#Kt&_;return!(t!==b&&t!==x||this.#Kt&L||this.#Kt&O)}calledReaddir(){return!!(this.#Kt&R)}isENOENT(){return!!(this.#Kt&O)}isNamed(t){return!this.nocase?this.#zt===normalize(t):this.#zt===normalizeNocase(t)}async readlink(){const t=this.#Yt;if(t){return t}if(!this.canReadlink()){return undefined}if(!this.parent){return undefined}try{const t=await this.#kt.promises.readlink(this.fullpath());const e=(await this.parent.realpath())?.resolve(t);if(e){return this.#Yt=e}}catch(t){this.#Xt(t.code);return undefined}}readlinkSync(){const t=this.#Yt;if(t){return t}if(!this.canReadlink()){return undefined}if(!this.parent){return undefined}try{const t=this.#kt.readlinkSync(this.fullpath());const e=this.parent.realpathSync()?.resolve(t);if(e){return this.#Yt=e}}catch(t){this.#Xt(t.code);return undefined}}#Qt(t){this.#Kt|=R;for(let e=t.provisional;e<t.length;e++){const s=t[e];if(s)s.#te()}}#te(){if(this.#Kt&O)return;this.#Kt=(this.#Kt|O)&C;this.#ee()}#ee(){const t=this.children();t.provisional=0;for(const e of t){e.#te()}}#se(){this.#Kt|=I;this.#ie()}#ie(){if(this.#Kt&A)return;let t=this.#Kt;if((t&_)===v)t&=C;this.#Kt=t|A;this.#ee()}#re(t=""){if(t==="ENOTDIR"||t==="EPERM"){this.#ie()}else if(t==="ENOENT"){this.#te()}else{this.children().provisional=0}}#ne(t=""){if(t==="ENOTDIR"){const t=this.parent;t.#ie()}else if(t==="ENOENT"){this.#te()}}#Xt(t=""){let e=this.#Kt;e|=L;if(t==="ENOENT")e|=O;if(t==="EINVAL"||t==="UNKNOWN"){e&=C}this.#Kt=e;if(t==="ENOTDIR"&&this.parent){this.parent.#ie()}}#oe(t,e){return this.#ae(t,e)||this.#he(t,e)}#he(t,e){const s=entToType(t);const i=this.newChild(t.name,s,{parent:this});const r=i.#Kt&_;if(r!==v&&r!==x&&r!==b){i.#Kt|=A}e.unshift(i);e.provisional++;return i}#ae(t,e){for(let s=e.provisional;s<e.length;s++){const i=e[s];const r=this.nocase?normalizeNocase(t.name):normalize(t.name);if(r!==i.#zt){continue}return this.#le(t,i,s,e)}}#le(t,e,s,i){const r=e.name;e.#Kt=e.#Kt&C|entToType(t);if(r!==t.name)e.name=t.name;if(s!==i.provisional){if(s===i.length-1)i.pop();else i.splice(s,1);i.unshift(e)}i.provisional++;return e}async lstat(){if((this.#Kt&O)===0){try{this.#ce(await this.#kt.promises.lstat(this.fullpath()));return this}catch(t){this.#ne(t.code)}}}lstatSync(){if((this.#Kt&O)===0){try{this.#ce(this.#kt.lstatSync(this.fullpath()));return this}catch(t){this.#ne(t.code)}}}#ce(t){const{atime:e,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:n,blocks:o,ctime:a,ctimeMs:h,dev:l,gid:c,ino:u,mode:f,mtime:d,mtimeMs:p,nlink:g,rdev:y,size:w,uid:S}=t;this.#Ft=e;this.#It=s;this.#Dt=i;this.#Bt=r;this.#At=n;this.#Lt=o;this.#jt=a;this.#Ut=h;this.#xt=l;this.#Rt=c;this.#Ot=u;this.#Et=f;this.#Nt=d;this.#Mt=p;this.#_t=g;this.#Pt=y;this.#x=w;this.#Ct=S;const T=entToType(t);this.#Kt=this.#Kt&C|T|P;if(T!==b&&T!==v&&T!==x){this.#Kt|=A}}#ue=[];#fe=false;#de(t){this.#fe=false;const e=this.#ue.slice();this.#ue.length=0;e.forEach((e=>e(null,t)))}readdirCB(t,e=false){if(!this.canReaddir()){if(e)t(null,[]);else queueMicrotask((()=>t(null,[])));return}const s=this.children();if(this.calledReaddir()){const i=s.slice(0,s.provisional);if(e)t(null,i);else queueMicrotask((()=>t(null,i)));return}this.#ue.push(t);if(this.#fe){return}this.#fe=true;const i=this.fullpath();this.#kt.readdir(i,{withFileTypes:true},((t,e)=>{if(t){this.#re(t.code);s.provisional=0}else{for(const t of e){this.#oe(t,s)}this.#Qt(s)}this.#de(s.slice(0,s.provisional));return}))}#pe;async readdir(){if(!this.canReaddir()){return[]}const t=this.children();if(this.calledReaddir()){return t.slice(0,t.provisional)}const e=this.fullpath();if(this.#pe){await this.#pe}else{let resolve=()=>{};this.#pe=new Promise((t=>resolve=t));try{for(const s of await this.#kt.promises.readdir(e,{withFileTypes:true})){this.#oe(s,t)}this.#Qt(t)}catch(e){this.#re(e.code);t.provisional=0}this.#pe=undefined;resolve()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir()){return[]}const t=this.children();if(this.calledReaddir()){return t.slice(0,t.provisional)}const e=this.fullpath();try{for(const s of this.#kt.readdirSync(e,{withFileTypes:true})){this.#oe(s,t)}this.#Qt(t)}catch(e){this.#re(e.code);t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#Kt&M)return false;const t=_&this.#Kt;if(!(t===b||t===v||t===x)){return false}return true}shouldWalk(t,e){return(this.#Kt&v)===v&&!(this.#Kt&M)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#Jt)return this.#Jt;if((I|L|O)&this.#Kt)return undefined;try{const t=await this.#kt.promises.realpath(this.fullpath());return this.#Jt=this.resolve(t)}catch(t){this.#se()}}realpathSync(){if(this.#Jt)return this.#Jt;if((I|L|O)&this.#Kt)return undefined;try{const t=this.#kt.realpathSync(this.fullpath());return this.#Jt=this.resolve(t)}catch(t){this.#se()}}[N](t){if(t===this)return;t.isCWD=false;this.isCWD=true;const e=new Set([]);let s=[];let i=this;while(i&&i.parent){e.add(i);i.#Ht=s.join(this.sep);i.#qt=s.join("/");i=i.parent;s.push("..")}i=t;while(i&&i.parent&&!e.has(i)){i.#Ht=undefined;i.#qt=undefined;i=i.parent}}}e.PathBase=PathBase;class PathWin32 extends PathBase{sep="\\";splitSep=y;constructor(t,e=b,s,i,r,n,o){super(t,e,s,i,r,n,o)}newChild(t,e=b,s={}){return new PathWin32(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return a.win32.parse(t).root}getRoot(t){t=uncToDrive(t.toUpperCase());if(t===this.root.name){return this.root}for(const[e,s]of Object.entries(this.roots)){if(this.sameRoot(t,e)){return this.roots[t]=s}}return this.roots[t]=new PathScurryWin32(t,this).root}sameRoot(t,e=this.root.name){t=t.toUpperCase().replace(/\//g,"\\").replace(g,"$1\\");return t===e}}e.PathWin32=PathWin32;class PathPosix extends PathBase{splitSep="/";sep="/";constructor(t,e=b,s,i,r,n,o){super(t,e,s,i,r,n,o)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,e=b,s={}){return new PathPosix(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}}e.PathPosix=PathPosix;class PathScurryBase{root;rootPath;roots;cwd;#me;#ge;#Vt;nocase;#kt;constructor(t=process.cwd(),e,s,{nocase:i,childrenCacheSize:r=16*1024,fs:n=p}={}){this.#kt=fsFromOption(n);if(t instanceof URL||t.startsWith("file://")){t=(0,h.fileURLToPath)(t)}const o=e.resolve(t);this.roots=Object.create(null);this.rootPath=this.parseRootPath(o);this.#me=new ResolveCache;this.#ge=new ResolveCache;this.#Vt=new ChildrenCache(r);const a=o.substring(this.rootPath.length).split(s);if(a.length===1&&!a[0]){a.pop()}if(i===undefined){throw new TypeError("must provide nocase setting to PathScurryBase ctor")}this.nocase=i;this.root=this.newRoot(this.#kt);this.roots[this.rootPath]=this.root;let l=this.root;let c=a.length-1;const u=e.sep;let f=this.rootPath;let d=false;for(const t of a){const e=c--;l=l.child(t,{relative:new Array(e).fill("..").join(u),relativePosix:new Array(e).fill("..").join("/"),fullpath:f+=(d?"":u)+t});d=true}this.cwd=l}depth(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return t.depth()}childrenCache(){return this.#Vt}resolve(...t){let e="";for(let s=t.length-1;s>=0;s--){const i=t[s];if(!i||i===".")continue;e=e?`${i}/${e}`:i;if(this.isAbsolute(i)){break}}const s=this.#me.get(e);if(s!==undefined){return s}const i=this.cwd.resolve(e).fullpath();this.#me.set(e,i);return i}resolvePosix(...t){let e="";for(let s=t.length-1;s>=0;s--){const i=t[s];if(!i||i===".")continue;e=e?`${i}/${e}`:i;if(this.isAbsolute(i)){break}}const s=this.#ge.get(e);if(s!==undefined){return s}const i=this.cwd.resolve(e).fullpathPosix();this.#ge.set(e,i);return i}relative(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return t.relative()}relativePosix(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return t.relativePosix()}basename(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return t.name}dirname(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:true}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s}=e;if(!t.canReaddir()){return[]}else{const e=await t.readdir();return s?e:e.map((t=>t.name))}}readdirSync(t=this.cwd,e={withFileTypes:true}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s=true}=e;if(!t.canReaddir()){return[]}else if(s){return t.readdirSync()}else{return t.readdirSync().map((t=>t.name))}}async lstat(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return t.lstat()}lstatSync(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:false}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t.withFileTypes;t=this.cwd}const s=await t.readlink();return e?s:s?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:false}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t.withFileTypes;t=this.cwd}const s=t.readlinkSync();return e?s:s?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:false}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t.withFileTypes;t=this.cwd}const s=await t.realpath();return e?s:s?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:false}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t.withFileTypes;t=this.cwd}const s=t.realpathSync();return e?s:s?.fullpath()}async walk(t=this.cwd,e={}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s=true,follow:i=false,filter:r,walkFilter:n}=e;const o=[];if(!r||r(t)){o.push(s?t:t.fullpath())}const a=new Set;const walk=(t,e)=>{a.add(t);t.readdirCB(((t,h)=>{if(t){return e(t)}let l=h.length;if(!l)return e();const next=()=>{if(--l===0){e()}};for(const t of h){if(!r||r(t)){o.push(s?t:t.fullpath())}if(i&&t.isSymbolicLink()){t.realpath().then((t=>t?.isUnknown()?t.lstat():t)).then((t=>t?.shouldWalk(a,n)?walk(t,next):next()))}else{if(t.shouldWalk(a,n)){walk(t,next)}else{next()}}}}),true)};const h=t;return new Promise(((t,e)=>{walk(h,(s=>{if(s)return e(s);t(o)}))}))}walkSync(t=this.cwd,e={}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s=true,follow:i=false,filter:r,walkFilter:n}=e;const o=[];if(!r||r(t)){o.push(s?t:t.fullpath())}const a=new Set([t]);for(const t of a){const e=t.readdirSync();for(const t of e){if(!r||r(t)){o.push(s?t:t.fullpath())}let e=t;if(t.isSymbolicLink()){if(!(i&&(e=t.realpathSync())))continue;if(e.isUnknown())e.lstatSync()}if(e.shouldWalk(a,n)){a.add(e)}}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}return this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s=true,follow:i=false,filter:r,walkFilter:n}=e;if(!r||r(t)){yield s?t:t.fullpath()}const o=new Set([t]);for(const t of o){const e=t.readdirSync();for(const t of e){if(!r||r(t)){yield s?t:t.fullpath()}let e=t;if(t.isSymbolicLink()){if(!(i&&(e=t.realpathSync())))continue;if(e.isUnknown())e.lstatSync()}if(e.shouldWalk(o,n)){o.add(e)}}}}stream(t=this.cwd,e={}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s=true,follow:i=false,filter:r,walkFilter:n}=e;const o=new d.Minipass({objectMode:true});if(!r||r(t)){o.write(s?t:t.fullpath())}const a=new Set;const h=[t];let l=0;const process=()=>{let t=false;while(!t){const e=h.shift();if(!e){if(l===0)o.end();return}l++;a.add(e);const onReaddir=(e,u,f=false)=>{if(e)return o.emit("error",e);if(i&&!f){const t=[];for(const e of u){if(e.isSymbolicLink()){t.push(e.realpath().then((t=>t?.isUnknown()?t.lstat():t)))}}if(t.length){Promise.all(t).then((()=>onReaddir(null,u,true)));return}}for(const e of u){if(e&&(!r||r(e))){if(!o.write(s?e:e.fullpath())){t=true}}}l--;for(const t of u){const e=t.realpathCached()||t;if(e.shouldWalk(a,n)){h.push(e)}}if(t&&!o.flowing){o.once("drain",process)}else if(!c){process()}};let c=true;e.readdirCB(onReaddir,true);c=false}};process();return o}streamSync(t=this.cwd,e={}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s=true,follow:i=false,filter:r,walkFilter:n}=e;const o=new d.Minipass({objectMode:true});const a=new Set;if(!r||r(t)){o.write(s?t:t.fullpath())}const h=[t];let l=0;const process=()=>{let t=false;while(!t){const e=h.shift();if(!e){if(l===0)o.end();return}l++;a.add(e);const c=e.readdirSync();for(const e of c){if(!r||r(e)){if(!o.write(s?e:e.fullpath())){t=true}}}l--;for(const t of c){let e=t;if(t.isSymbolicLink()){if(!(i&&(e=t.realpathSync())))continue;if(e.isUnknown())e.lstatSync()}if(e.shouldWalk(a,n)){h.push(e)}}}if(t&&!o.flowing)o.once("drain",process)};process();return o}chdir(t=this.cwd){const e=this.cwd;this.cwd=typeof t==="string"?this.cwd.resolve(t):t;this.cwd[N](e)}}e.PathScurryBase=PathScurryBase;class PathScurryWin32 extends PathScurryBase{sep="\\";constructor(t=process.cwd(),e={}){const{nocase:s=true}=e;super(t,a.win32,"\\",{...e,nocase:s});this.nocase=s;for(let t=this.cwd;t;t=t.parent){t.nocase=this.nocase}}parseRootPath(t){return a.win32.parse(t).root.toUpperCase()}newRoot(t){return new PathWin32(this.rootPath,v,undefined,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}}e.PathScurryWin32=PathScurryWin32;class PathScurryPosix extends PathScurryBase{sep="/";constructor(t=process.cwd(),e={}){const{nocase:s=false}=e;super(t,a.posix,"/",{...e,nocase:s});this.nocase=s}parseRootPath(t){return"/"}newRoot(t){return new PathPosix(this.rootPath,v,undefined,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}}e.PathScurryPosix=PathScurryPosix;class PathScurryDarwin extends PathScurryPosix{constructor(t=process.cwd(),e={}){const{nocase:s=true}=e;super(t,{...e,nocase:s})}}e.PathScurryDarwin=PathScurryDarwin;e.Path=process.platform==="win32"?PathWin32:PathPosix;e.PathScurry=process.platform==="win32"?PathScurryWin32:process.platform==="darwin"?PathScurryDarwin:PathScurryPosix}};var e={};function __nccwpck_require__(s){var i=e[s];if(i!==undefined){return i.exports}var r=e[s]={exports:{}};var n=true;try{t[s].call(r.exports,r,r.exports,__nccwpck_require__);n=false}finally{if(n)delete e[s]}return r.exports}(()=>{var t=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__;var e;__nccwpck_require__.t=function(s,i){if(i&1)s=this(s);if(i&8)return s;if(typeof s==="object"&&s){if(i&4&&s.__esModule)return s;if(i&16&&typeof s.then==="function")return s}var r=Object.create(null);__nccwpck_require__.r(r);var n={};e=e||[null,t({}),t([]),t(t)];for(var o=i&2&&s;typeof o=="object"&&!~e.indexOf(o);o=t(o)){Object.getOwnPropertyNames(o).forEach((t=>n[t]=()=>s[t]))}n["default"]=()=>s;__nccwpck_require__.d(r,n);return r}})();(()=>{__nccwpck_require__.d=(t,e)=>{for(var s in e){if(__nccwpck_require__.o(e,s)&&!__nccwpck_require__.o(t,s)){Object.defineProperty(t,s,{enumerable:true,get:e[s]})}}}})();(()=>{__nccwpck_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var s=__nccwpck_require__(328);module.exports=s})();
|
|
2
|
+
(()=>{"use strict";var t={406:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.detectCIContext=detectCIContext;function detectCIContext(){const t=process.env;if(t.GITHUB_ACTIONS==="true"){return{branch:t.GITHUB_HEAD_REF||t.GITHUB_REF_NAME||t.GITHUB_REF?.replace("refs/heads/",""),commitSha:t.GITHUB_SHA,repositoryUrl:t.GITHUB_SERVER_URL&&t.GITHUB_REPOSITORY?`${t.GITHUB_SERVER_URL}/${t.GITHUB_REPOSITORY}`:undefined,buildNumber:t.GITHUB_RUN_NUMBER,buildUrl:t.GITHUB_SERVER_URL&&t.GITHUB_REPOSITORY&&t.GITHUB_RUN_ID?`${t.GITHUB_SERVER_URL}/${t.GITHUB_REPOSITORY}/actions/runs/${t.GITHUB_RUN_ID}`:undefined}}if(t.GITLAB_CI==="true"){return{branch:t.CI_COMMIT_BRANCH||t.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME,commitSha:t.CI_COMMIT_SHA,repositoryUrl:t.CI_PROJECT_URL,buildNumber:t.CI_PIPELINE_IID,buildUrl:t.CI_PIPELINE_URL}}if(t.TF_BUILD==="True"){return{branch:t.BUILD_SOURCEBRANCH?.replace("refs/heads/",""),commitSha:t.BUILD_SOURCEVERSION,repositoryUrl:t.BUILD_REPOSITORY_URI,buildNumber:t.BUILD_BUILDNUMBER,buildUrl:t.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI&&t.SYSTEM_TEAMPROJECT&&t.BUILD_BUILDID?`${t.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI}${t.SYSTEM_TEAMPROJECT}/_build/results?buildId=${t.BUILD_BUILDID}`:undefined}}if(t.CIRCLECI==="true"){return{branch:t.CIRCLE_BRANCH,commitSha:t.CIRCLE_SHA1,repositoryUrl:t.CIRCLE_REPOSITORY_URL,buildNumber:t.CIRCLE_BUILD_NUM,buildUrl:t.CIRCLE_BUILD_URL}}if(t.JENKINS_URL){return{branch:t.GIT_BRANCH?.replace("origin/",""),commitSha:t.GIT_COMMIT,repositoryUrl:t.GIT_URL,buildNumber:t.BUILD_NUMBER,buildUrl:t.BUILD_URL}}if(t.BITBUCKET_BUILD_NUMBER){return{branch:t.BITBUCKET_BRANCH,commitSha:t.BITBUCKET_COMMIT,repositoryUrl:t.BITBUCKET_GIT_HTTP_ORIGIN,buildNumber:t.BITBUCKET_BUILD_NUMBER,buildUrl:t.BITBUCKET_REPO_FULL_NAME&&t.BITBUCKET_BUILD_NUMBER?`https://bitbucket.org/${t.BITBUCKET_REPO_FULL_NAME}/pipelines/results/${t.BITBUCKET_BUILD_NUMBER}`:undefined}}return{}}},827:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true})},322:function(t,e,s){var i=this&&this.__createBinding||(Object.create?function(t,e,s,i){if(i===undefined)i=s;var r=Object.getOwnPropertyDescriptor(e,s);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[s]}}}Object.defineProperty(t,i,r)}:function(t,e,s,i){if(i===undefined)i=s;t[i]=e[s]});var r=this&&this.__exportStar||function(t,e){for(var s in t)if(s!=="default"&&!Object.prototype.hasOwnProperty.call(e,s))i(e,t,s)};Object.defineProperty(e,"__esModule",{value:true});e.ensureReportId=e.mapAttachmentsToTestResults=e.uploadArtifacts=e.uploadTestRun=e.detectCIContext=void 0;r(s(827),e);var n=s(406);Object.defineProperty(e,"detectCIContext",{enumerable:true,get:function(){return n.detectCIContext}});var o=s(969);Object.defineProperty(e,"uploadTestRun",{enumerable:true,get:function(){return o.uploadTestRun}});Object.defineProperty(e,"uploadArtifacts",{enumerable:true,get:function(){return o.uploadArtifacts}});Object.defineProperty(e,"mapAttachmentsToTestResults",{enumerable:true,get:function(){return o.mapAttachmentsToTestResults}});Object.defineProperty(e,"ensureReportId",{enumerable:true,get:function(){return o.ensureReportId}})},969:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.ensureReportId=ensureReportId;e.uploadTestRun=uploadTestRun;e.mapAttachmentsToTestResults=mapAttachmentsToTestResults;e.uploadArtifacts=uploadArtifacts;const i=s(406);const r="https://test-manager-backend.fly.dev";function ensureReportId(t){if(typeof t.reportId==="string"&&t.reportId.trim().length>0){return t.reportId}const e=crypto.randomUUID();t.reportId=e;return e}function resolveApiUrl(t){const e=normalizeApiUrl(t);if(e){return e}const s=getEnvApiUrl();if(s){return s}return r}function getEnvApiUrl(){if(typeof process==="undefined"||!process?.env){return undefined}return normalizeApiUrl(process.env.TESTREAM_API_URL)}function normalizeApiUrl(t){if(!t){return undefined}const e=t.trim();if(!e){return undefined}return e.replace(/\/+$/,"")}function isReportAlreadyExistsConflict(t){return t.errorCode==="report_already_exists"}function formatUploadError(t){const e=t.detail||t.title||t.rawBody||"Unknown error";const s=t.errorCode?`, code=${t.errorCode}`:"";return`Upload failed (HTTP ${t.statusCode}${s}): ${e}`}async function parseHttpError(t){const e=await t.text();const s=t.headers.get("content-type")||"";if(s.toLowerCase().includes("json")&&e.trim().length>0){try{const s=JSON.parse(e);return{statusCode:t.status,title:s.title,detail:s.detail||s.details||s.error,errorCode:s.errorCode,rawBody:e}}catch{}}return{statusCode:t.status,rawBody:e}}function resolveUploadContext(t){const e=(0,i.detectCIContext)();return{commitSha:t.commitSha??e.commitSha,branch:t.branch??e.branch,repositoryUrl:t.repositoryUrl??e.repositoryUrl,buildName:t.buildName,buildNumber:t.buildNumber??e.buildNumber,buildUrl:t.buildUrl??e.buildUrl,testEnvironment:t.testEnvironment,appName:t.appName,appVersion:t.appVersion,testType:t.testType}}async function uploadTestRun(t){const{report:e,apiKey:s}=t;const i=resolveApiUrl(t.apiUrl);const r=ensureReportId(e);const n=resolveUploadContext(t);const o={report:e,reportId:r,...n};console.log("Uploading test results...");let a;try{a=await fetch(`${i}/api/v1/ingest`,{method:"POST",headers:{"X-API-KEY":s,"Content-Type":"application/json"},body:JSON.stringify(o)})}catch(t){const e=t instanceof Error?t.message:String(t);const s=`Connection failed: ${e}`;console.error(s);return{success:false,reportId:r,error:s}}if(!a.ok){const t=await parseHttpError(a);if(a.status===409&&isReportAlreadyExistsConflict(t)){console.warn("Report already exists (workflow may have been re-run)");return{success:true,reportId:r,summary:{passed:e.results.summary.passed,failed:e.results.summary.failed,skipped:e.results.summary.skipped,total:e.results.summary.tests},alreadyExists:true,statusCode:t.statusCode,errorCode:t.errorCode}}const s=formatUploadError(t);console.error(s);return{success:false,reportId:r,error:s,statusCode:t.statusCode,errorCode:t.errorCode,errorDetail:t.detail||t.rawBody}}const h=await a.json();console.log(`✓ Test results uploaded successfully`);console.log(` Report ID: ${h.reportId}`);console.log(` Test Run ID: ${h.testRunId}`);console.log(` Tests: ${h.summary.passed}/${h.summary.total} passed`);return{success:true,reportId:h.reportId,testRunId:h.testRunId,summary:{passed:h.summary.passed,failed:h.summary.failed,skipped:h.summary.skipped,total:h.summary.total},testResults:h.testResults}}function mapAttachmentsToTestResults(t,e){const s=new Map;for(const t of e){const e=s.get(t.name)??[];e.push(t.id);s.set(t.name,e)}const i=[];for(const e of t){const t=s.get(e.name);const r=t?.shift();if(!e.attachments||e.attachments.length===0){continue}if(!r){console.warn(`Skipping artifact upload: could not match test result for "${e.name}"`);continue}i.push({testResultId:r,attachments:e.attachments})}return i}async function uploadArtifacts(t){const{reportId:e,apiKey:s,testResults:i}=t;const r=resolveApiUrl(t.apiUrl);let n=0;for(const t of i){for(const i of t.attachments){try{const o=await uploadSingleArtifact({testResultId:t.testResultId,attachment:i,reportId:e,apiKey:s,apiUrl:r});if(o)n++}catch(t){const e=t instanceof Error?t.message:String(t);console.error(`Failed to upload artifact ${i.name}: ${e}`)}}}if(n>0){console.log(`✓ Uploaded ${n} artifact(s)`)}return n}async function uploadSingleArtifact(t){const{testResultId:e,attachment:i,reportId:r,apiKey:n,apiUrl:o}=t;const a=await Promise.resolve().then(s.t.bind(s,943,23));const h=await Promise.resolve().then(s.t.bind(s,928,23));const l=h.resolve(i.path);try{await a.access(l)}catch{console.warn(`Artifact not found: ${h.basename(l)}`);return false}let c;let u;const f=h.basename(l);const d=i.contentType||"application/octet-stream";try{c=await a.readFile(l);u=c.byteLength}catch(t){const e=t instanceof Error?t.message:String(t);throw new Error(`Failed to read file: ${e}`)}try{return await uploadWithPresignedUrl({testResultId:e,reportId:r,apiKey:n,apiUrl:o,attachmentName:i.name,fileName:f,contentType:d,sizeBytes:u,fileBuffer:c})}catch(t){if(!(t instanceof LegacyUploadRequiredError)){throw t}return await uploadWithLegacyEndpoint({testResultId:e,attachmentName:i.name,reportId:r,apiKey:n,apiUrl:o,fileName:f,contentType:d,fileBuffer:c})}}class LegacyUploadRequiredError extends Error{constructor(){super("Legacy upload endpoint required")}}async function uploadWithPresignedUrl(t){const{testResultId:e,reportId:s,apiKey:i,apiUrl:r,attachmentName:n,fileName:o,contentType:a,sizeBytes:h,fileBuffer:l}=t;const c={testResultId:e,ctrfAttachmentName:n,fileName:o,contentType:a,sizeBytes:h};const u=await fetch(`${r}/api/v1/artifacts/${s}/upload-url`,{method:"POST",headers:{"X-API-KEY":i,"Content-Type":"application/json"},body:JSON.stringify(c)});if(shouldFallbackToLegacyUpload(u.status)){throw new LegacyUploadRequiredError}if(!u.ok){const t=await u.text();throw new Error(`Failed to create direct upload URL (HTTP ${u.status}): ${t}`)}const f=await u.json();const d={...f.requiredHeaders??{}};if(!hasHeaderIgnoreCase(d,"Content-Type")){d["Content-Type"]=a}const p=await fetch(f.uploadUrl,{method:"PUT",headers:d,body:l});if(!p.ok){const t=await p.text();throw new Error(`Direct artifact upload failed (HTTP ${p.status}): ${t}`)}const g={testResultId:e,ctrfAttachmentName:n,fileName:o,contentType:a,sizeBytes:h,storageKey:f.storageKey};const y=await fetch(`${r}/api/v1/artifacts/${s}/complete`,{method:"POST",headers:{"X-API-KEY":i,"Content-Type":"application/json"},body:JSON.stringify(g)});if(!y.ok){const t=await y.text();throw new Error(`Failed to finalize artifact upload (HTTP ${y.status}): ${t}`)}return true}async function uploadWithLegacyEndpoint(t){const{testResultId:e,attachmentName:s,reportId:i,apiKey:r,apiUrl:n,fileName:o,contentType:a,fileBuffer:h}=t;const l=new Blob([new Uint8Array(h)],{type:a});const c=new FormData;c.append("testResultId",e);c.append("ctrfAttachmentName",s);c.append("file",l,o);const u=await fetch(`${n}/api/v1/artifacts/${i}`,{method:"POST",headers:{"X-API-KEY":r},body:c});if(!u.ok){const t=await u.text();throw new Error(`Legacy artifact upload failed (HTTP ${u.status}): ${t}`)}return true}function shouldFallbackToLegacyUpload(t){return t===404||t===405||t===501}function hasHeaderIgnoreCase(t,e){const s=e.toLowerCase();return Object.keys(t).some((t=>t.toLowerCase()===s))}},328:function(t,e,s){var i=this&&this.__createBinding||(Object.create?function(t,e,s,i){if(i===undefined)i=s;var r=Object.getOwnPropertyDescriptor(e,s);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[s]}}}Object.defineProperty(t,i,r)}:function(t,e,s,i){if(i===undefined)i=s;t[i]=e[s]});var r=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var n=this&&this.__importStar||function(){var ownKeys=function(t){ownKeys=Object.getOwnPropertyNames||function(t){var e=[];for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s))e[e.length]=s;return e};return ownKeys(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var s=ownKeys(t),n=0;n<s.length;n++)if(s[n]!=="default")i(e,t,s[n]);r(e,t);return e}}();Object.defineProperty(e,"__esModule",{value:true});const o=s(447);const a=n(s(928));const h=n(s(943));const l=s(317);const c=s(10);function printUsage(){console.log(`\n@testream/cypress-reporter - Run Cypress tests and upload results to Testream\n\nUsage:\n npx @testream/cypress-reporter --api-key <key> [options]\n\nRequired arguments:\n --api-key, -k API key for authentication\n\nOptional arguments:\n --project <path> Path to Cypress project (defaults to current directory)\n --results-path <path> Skip running tests, use existing CTRF JSON file(s) instead\n \nGit context (auto-detected in CI):\n --branch Git branch name\n --commit-sha Git commit SHA\n --repository-url Git repository URL\n\nBuild metadata (auto-detected in CI):\n --build-name Build name/identifier\n --build-number Build number\n --build-url Build URL (CI pipeline URL)\n\nEnvironment metadata:\n --test-environment Test environment (e.g., staging, production, ci)\n --app-name Application name under test\n --app-version Application version under test\n --test-type Test type (e.g., unit, integration, e2e)\n\nUpload options:\n --no-upload Skip uploading results to backend\n --fail-on-error Fail the process if upload fails\n\nOther:\n --help, -h Show this help message\n -- <args> Additional arguments to pass to 'cypress run'\n\nExamples:\n # Run tests and upload (simplest usage)\n npx @testream/cypress-reporter -k your-api-key\n\n # Run tests for a specific project\n npx @testream/cypress-reporter -k your-api-key --project ./e2e\n\n # With environment metadata\n npx @testream/cypress-reporter -k your-api-key \\\n --test-environment staging --app-name MyApp --app-version 1.0.0\n\n # Pass additional arguments to cypress run\n npx @testream/cypress-reporter -k your-api-key -- --spec "cypress/e2e/**/*.cy.js"\n\n # Use existing CTRF results (skip running tests)\n npx @testream/cypress-reporter -k your-api-key --results-path ctrf/ctrf-report.json\n\nHow it works:\n 1. Runs 'cypress run' with cypress-ctrf-json-reporter\n 2. CTRF report is generated automatically by the reporter plugin\n 3. Uploads to Testream (project key inferred from API key)\n\nNo manual steps required - just run and upload!\n`)}function parseArgs(t){const e={uploadEnabled:true,failOnUploadError:false};const s=[];let i=false;for(let r=0;r<t.length;r++){const n=t[r];const o=t[r+1];if(n==="--"){i=true;continue}if(i){s.push(n);continue}switch(n){case"--help":case"-h":printUsage();process.exit(0);break;case"--api-key":case"-k":e.apiKey=o;r++;break;case"--project":e.projectPath=o;r++;break;case"--results-path":e.resultsPath=o;r++;break;case"--branch":e.branch=o;r++;break;case"--commit-sha":e.commitSha=o;r++;break;case"--repository-url":e.repositoryUrl=o;r++;break;case"--build-name":e.buildName=o;r++;break;case"--build-number":e.buildNumber=o;r++;break;case"--build-url":e.buildUrl=o;r++;break;case"--test-environment":e.testEnvironment=o;r++;break;case"--app-name":e.appName=o;r++;break;case"--app-version":e.appVersion=o;r++;break;case"--test-type":e.testType=o;r++;break;case"--no-upload":e.uploadEnabled=false;break;case"--fail-on-error":e.failOnUploadError=true;break}}if(s.length>0){e.cypressArgs=s}if(!e.apiKey&&e.uploadEnabled){console.error("Error: Missing required argument: --api-key");console.error("Run with --help for usage information.");return null}return e}async function findResultFiles(t){if(!t.includes("*")&&!t.includes("?")){return[a.resolve(t)]}const e=await(0,o.glob)(t,{absolute:true,nodir:true});return e}async function runCypress(t,e=[]){const s=console;const i=t?a.resolve(t):process.cwd();const r=a.join(i,"ctrf","ctrf-report.json");const n=["run"];n.push(...e);s.info("Running Cypress tests...");s.info(` Command: npx cypress ${n.join(" ")}`);s.info(` Working directory: ${i}`);s.info("");return new Promise(((t,e)=>{const s=(0,l.spawn)("npx",["cypress",...n],{cwd:i,stdio:["inherit","inherit","inherit"],shell:process.platform==="win32"});s.on("error",(t=>{e(new Error(`Failed to run Cypress: ${t.message}`))}));s.on("close",(async()=>{try{await h.access(r);t(r)}catch{e(new Error("No CTRF file generated. Make sure Cypress ran successfully."))}}))}))}async function main(){const t=process.argv.slice(2);if(t.length===0){printUsage();process.exit(1)}const e=parseArgs(t);if(!e){process.exit(1)}const s=console;try{let t;if(e.resultsPath){s.info("Using existing CTRF file(s)...");t=e.resultsPath}else{t=await runCypress(e.projectPath,e.cypressArgs);s.info("")}s.info(`Finding CTRF files: ${t}`);const i=await findResultFiles(t);if(i.length===0){throw new Error(`No CTRF files found matching: ${t}`)}s.info(` Found ${i.length} file(s):`);for(const t of i){s.info(` - ${a.basename(t)}`)}s.info("");s.info("Loading CTRF report...");const r=await h.readFile(i[0],"utf-8");const n=JSON.parse(r);n.results.tool.name="cypress";n.generatedBy="@testream/cypress-reporter";s.info(` Tool: ${n.results.tool.name}`);if(n.results.tool.version){s.info(` Version: ${n.results.tool.version}`)}s.info("");if(!e.uploadEnabled){s.info("Upload disabled, skipping API upload");s.info("");s.info("=".repeat(60));s.info("Test run completed (upload skipped)");s.info(` Tests: ${n.results.summary.tests}`);s.info(` Passed: ${n.results.summary.passed}`);s.info(` Failed: ${n.results.summary.failed}`);s.info(` Skipped: ${n.results.summary.skipped}`);s.info("=".repeat(60));return}const o=await(0,c.uploadToApi)({report:n,apiKey:e.apiKey,branch:e.branch,commitSha:e.commitSha,repositoryUrl:e.repositoryUrl,buildName:e.buildName,buildNumber:e.buildNumber,buildUrl:e.buildUrl,testEnvironment:e.testEnvironment,appName:e.appName,appVersion:e.appVersion,testType:e.testType});if(!o.success){if(e.failOnUploadError){process.exit(1)}else{s.warn("Upload failed but continuing (use --fail-on-error to fail on upload errors)")}}}catch(t){const e=t instanceof Error?t.message:String(t);s.error(`Error: ${e}`);process.exit(1)}}main()},10:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.detectGitContext=void 0;e.uploadToApi=uploadToApi;const i=s(322);async function uploadToApi(t){const e=await(0,i.uploadTestRun)({report:t.report,apiKey:t.apiKey,apiUrl:t.apiUrl,commitSha:t.commitSha,branch:t.branch,repositoryUrl:t.repositoryUrl,buildName:t.buildName,buildNumber:t.buildNumber,buildUrl:t.buildUrl,testEnvironment:t.testEnvironment,appName:t.appName,appVersion:t.appVersion,testType:t.testType});if(!e.success||e.alreadyExists){return e}let s=0;if(e.testResults){const r=(0,i.mapAttachmentsToTestResults)(t.report.results.tests,e.testResults);if(r.length>0){s=await(0,i.uploadArtifacts)({reportId:e.reportId,apiKey:t.apiKey,apiUrl:t.apiUrl,testResults:r})}}return{...e,artifactCount:s}}e.detectGitContext=i.detectCIContext},317:t=>{t.exports=require("child_process")},896:t=>{t.exports=require("fs")},943:t=>{t.exports=require("fs/promises")},474:t=>{t.exports=require("node:events")},24:t=>{t.exports=require("node:fs")},455:t=>{t.exports=require("node:fs/promises")},760:t=>{t.exports=require("node:path")},75:t=>{t.exports=require("node:stream")},193:t=>{t.exports=require("node:string_decoder")},136:t=>{t.exports=require("node:url")},928:t=>{t.exports=require("path")},80:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.range=e.balanced=void 0;const balanced=(t,s,i)=>{const r=t instanceof RegExp?maybeMatch(t,i):t;const n=s instanceof RegExp?maybeMatch(s,i):s;const o=r!==null&&n!=null&&(0,e.range)(r,n,i);return o&&{start:o[0],end:o[1],pre:i.slice(0,o[0]),body:i.slice(o[0]+r.length,o[1]),post:i.slice(o[1]+n.length)}};e.balanced=balanced;const maybeMatch=(t,e)=>{const s=e.match(t);return s?s[0]:null};const range=(t,e,s)=>{let i,r,n,o=undefined,a;let h=s.indexOf(t);let l=s.indexOf(e,h+1);let c=h;if(h>=0&&l>0){if(t===e){return[h,l]}i=[];n=s.length;while(c>=0&&!a){if(c===h){i.push(c);h=s.indexOf(t,c+1)}else if(i.length===1){const t=i.pop();if(t!==undefined)a=[t,l]}else{r=i.pop();if(r!==undefined&&r<n){n=r;o=l}l=s.indexOf(e,c+1)}c=h<l&&h>=0?h:l}if(i.length&&o!==undefined){a=[n,o]}}return a};e.range=range},339:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.expand=expand;const i=s(80);const r="\0SLASH"+Math.random()+"\0";const n="\0OPEN"+Math.random()+"\0";const o="\0CLOSE"+Math.random()+"\0";const a="\0COMMA"+Math.random()+"\0";const h="\0PERIOD"+Math.random()+"\0";const l=new RegExp(r,"g");const c=new RegExp(n,"g");const u=new RegExp(o,"g");const f=new RegExp(a,"g");const d=new RegExp(h,"g");const p=/\\\\/g;const g=/\\{/g;const y=/\\}/g;const b=/\\,/g;const w=/\\./g;function numeric(t){return!isNaN(t)?parseInt(t,10):t.charCodeAt(0)}function escapeBraces(t){return t.replace(p,r).replace(g,n).replace(y,o).replace(b,a).replace(w,h)}function unescapeBraces(t){return t.replace(l,"\\").replace(c,"{").replace(u,"}").replace(f,",").replace(d,".")}function parseCommaParts(t){if(!t){return[""]}const e=[];const s=(0,i.balanced)("{","}",t);if(!s){return t.split(",")}const{pre:r,body:n,post:o}=s;const a=r.split(",");a[a.length-1]+="{"+n+"}";const h=parseCommaParts(o);if(o.length){a[a.length-1]+=h.shift();a.push.apply(a,h)}e.push.apply(e,a);return e}function expand(t){if(!t){return[]}if(t.slice(0,2)==="{}"){t="\\{\\}"+t.slice(2)}return expand_(escapeBraces(t),true).map(unescapeBraces)}function embrace(t){return"{"+t+"}"}function isPadded(t){return/^-?0\d/.test(t)}function lte(t,e){return t<=e}function gte(t,e){return t>=e}function expand_(t,e){const s=[];const r=(0,i.balanced)("{","}",t);if(!r)return[t];const n=r.pre;const a=r.post.length?expand_(r.post,false):[""];if(/\$$/.test(r.pre)){for(let t=0;t<a.length;t++){const e=n+"{"+r.body+"}"+a[t];s.push(e)}}else{const i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body);const h=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body);const l=i||h;const c=r.body.indexOf(",")>=0;if(!l&&!c){if(r.post.match(/,(?!,).*\}/)){t=r.pre+"{"+r.body+o+r.post;return expand_(t)}return[t]}let u;if(l){u=r.body.split(/\.\./)}else{u=parseCommaParts(r.body);if(u.length===1&&u[0]!==undefined){u=expand_(u[0],false).map(embrace);if(u.length===1){return a.map((t=>r.pre+u[0]+t))}}}let f;if(l&&u[0]!==undefined&&u[1]!==undefined){const t=numeric(u[0]);const e=numeric(u[1]);const s=Math.max(u[0].length,u[1].length);let i=u.length===3&&u[2]!==undefined?Math.abs(numeric(u[2])):1;let r=lte;const n=e<t;if(n){i*=-1;r=gte}const o=u.some(isPadded);f=[];for(let n=t;r(n,e);n+=i){let t;if(h){t=String.fromCharCode(n);if(t==="\\"){t=""}}else{t=String(n);if(o){const e=s-t.length;if(e>0){const s=new Array(e+1).join("0");if(n<0){t="-"+s+t.slice(1)}else{t=s+t}}}}f.push(t)}}else{f=[];for(let t=0;t<u.length;t++){f.push.apply(f,expand_(u[t],false))}}for(let t=0;t<f.length;t++){for(let i=0;i<a.length;i++){const r=n+f[t]+a[i];if(!e||l||r){s.push(r)}}}}return s}},809:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.Glob=void 0;const i=s(647);const r=s(136);const n=s(125);const o=s(841);const a=s(89);const h=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class Glob{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,e){if(!e)throw new TypeError("glob options required");this.withFileTypes=!!e.withFileTypes;this.signal=e.signal;this.follow=!!e.follow;this.dot=!!e.dot;this.dotRelative=!!e.dotRelative;this.nodir=!!e.nodir;this.mark=!!e.mark;if(!e.cwd){this.cwd=""}else if(e.cwd instanceof URL||e.cwd.startsWith("file://")){e.cwd=(0,r.fileURLToPath)(e.cwd)}this.cwd=e.cwd||"";this.root=e.root;this.magicalBraces=!!e.magicalBraces;this.nobrace=!!e.nobrace;this.noext=!!e.noext;this.realpath=!!e.realpath;this.absolute=e.absolute;this.includeChildMatches=e.includeChildMatches!==false;this.noglobstar=!!e.noglobstar;this.matchBase=!!e.matchBase;this.maxDepth=typeof e.maxDepth==="number"?e.maxDepth:Infinity;this.stat=!!e.stat;this.ignore=e.ignore;if(this.withFileTypes&&this.absolute!==undefined){throw new Error("cannot set absolute and withFileTypes:true")}if(typeof t==="string"){t=[t]}this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===false;if(this.windowsPathsNoEscape){t=t.map((t=>t.replace(/\\/g,"/")))}if(this.matchBase){if(e.noglobstar){throw new TypeError("base matching requires globstar")}t=t.map((t=>t.includes("/")?t:`./**/${t}`))}this.pattern=t;this.platform=e.platform||h;this.opts={...e,platform:this.platform};if(e.scurry){this.scurry=e.scurry;if(e.nocase!==undefined&&e.nocase!==e.scurry.nocase){throw new Error("nocase option contradicts provided scurry option")}}else{const t=e.platform==="win32"?n.PathScurryWin32:e.platform==="darwin"?n.PathScurryDarwin:e.platform?n.PathScurryPosix:n.PathScurry;this.scurry=new t(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;const s=this.platform==="darwin"||this.platform==="win32";const a={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:true,noext:this.noext,nonegate:true,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug};const l=this.pattern.map((t=>new i.Minimatch(t,a)));const[c,u]=l.reduce(((t,e)=>{t[0].push(...e.set);t[1].push(...e.globParts);return t}),[[],[]]);this.patterns=c.map(((t,e)=>{const s=u[e];if(!s)throw new Error("invalid pattern object");return new o.Pattern(t,s,0,this.platform)}))}async walk(){return[...await new a.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==Infinity?this.maxDepth+this.scurry.cwd.depth():Infinity,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new a.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==Infinity?this.maxDepth+this.scurry.cwd.depth():Infinity,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new a.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==Infinity?this.maxDepth+this.scurry.cwd.depth():Infinity,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new a.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==Infinity?this.maxDepth+this.scurry.cwd.depth():Infinity,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}e.Glob=Glob},233:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.hasMagic=void 0;const i=s(647);const hasMagic=(t,e={})=>{if(!Array.isArray(t)){t=[t]}for(const s of t){if(new i.Minimatch(s,e).hasMagic())return true}return false};e.hasMagic=hasMagic},449:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.Ignore=void 0;const i=s(647);const r=s(841);const n=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class Ignore{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:e,nocase:s,noext:i,noglobstar:r,platform:o=n}){this.relative=[];this.absolute=[];this.relativeChildren=[];this.absoluteChildren=[];this.platform=o;this.mmopts={dot:true,nobrace:e,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:o,nocomment:true,nonegate:true};for(const e of t)this.add(e)}add(t){const e=new i.Minimatch(t,this.mmopts);for(let t=0;t<e.set.length;t++){const s=e.set[t];const n=e.globParts[t];if(!s||!n){throw new Error("invalid pattern object")}while(s[0]==="."&&n[0]==="."){s.shift();n.shift()}const o=new r.Pattern(s,n,0,this.platform);const a=new i.Minimatch(o.globString(),this.mmopts);const h=n[n.length-1]==="**";const l=o.isAbsolute();if(l)this.absolute.push(a);else this.relative.push(a);if(h){if(l)this.absoluteChildren.push(a);else this.relativeChildren.push(a)}}}ignored(t){const e=t.fullpath();const s=`${e}/`;const i=t.relative()||".";const r=`${i}/`;for(const t of this.relative){if(t.match(i)||t.match(r))return true}for(const t of this.absolute){if(t.match(e)||t.match(s))return true}return false}childrenIgnored(t){const e=t.fullpath()+"/";const s=(t.relative()||".")+"/";for(const t of this.relativeChildren){if(t.match(s))return true}for(const t of this.absoluteChildren){if(t.match(e))return true}return false}}e.Ignore=Ignore},447:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.glob=e.sync=e.iterate=e.iterateSync=e.stream=e.streamSync=e.Ignore=e.hasMagic=e.Glob=e.unescape=e.escape=void 0;e.globStreamSync=globStreamSync;e.globStream=globStream;e.globSync=globSync;e.globIterateSync=globIterateSync;e.globIterate=globIterate;const i=s(647);const r=s(809);const n=s(233);var o=s(647);Object.defineProperty(e,"escape",{enumerable:true,get:function(){return o.escape}});Object.defineProperty(e,"unescape",{enumerable:true,get:function(){return o.unescape}});var a=s(809);Object.defineProperty(e,"Glob",{enumerable:true,get:function(){return a.Glob}});var h=s(233);Object.defineProperty(e,"hasMagic",{enumerable:true,get:function(){return h.hasMagic}});var l=s(449);Object.defineProperty(e,"Ignore",{enumerable:true,get:function(){return l.Ignore}});function globStreamSync(t,e={}){return new r.Glob(t,e).streamSync()}function globStream(t,e={}){return new r.Glob(t,e).stream()}function globSync(t,e={}){return new r.Glob(t,e).walkSync()}async function glob_(t,e={}){return new r.Glob(t,e).walk()}function globIterateSync(t,e={}){return new r.Glob(t,e).iterateSync()}function globIterate(t,e={}){return new r.Glob(t,e).iterate()}e.streamSync=globStreamSync;e.stream=Object.assign(globStream,{sync:globStreamSync});e.iterateSync=globIterateSync;e.iterate=Object.assign(globIterate,{sync:globIterateSync});e.sync=Object.assign(globSync,{stream:globStreamSync,iterate:globIterateSync});e.glob=Object.assign(glob_,{glob:glob_,globSync:globSync,sync:e.sync,globStream:globStream,stream:e.stream,globStreamSync:globStreamSync,streamSync:e.streamSync,globIterate:globIterate,iterate:e.iterate,globIterateSync:globIterateSync,iterateSync:e.iterateSync,Glob:r.Glob,hasMagic:n.hasMagic,escape:i.escape,unescape:i.unescape});e.glob.glob=e.glob},841:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.Pattern=void 0;const i=s(647);const isPatternList=t=>t.length>=1;const isGlobList=t=>t.length>=1;class Pattern{#t;#e;#s;length;#i;#r;#n;#o;#a;#h;#l=true;constructor(t,e,s,i){if(!isPatternList(t)){throw new TypeError("empty pattern list")}if(!isGlobList(e)){throw new TypeError("empty glob list")}if(e.length!==t.length){throw new TypeError("mismatched pattern list and glob list lengths")}this.length=t.length;if(s<0||s>=this.length){throw new TypeError("index out of range")}this.#t=t;this.#e=e;this.#s=s;this.#i=i;if(this.#s===0){if(this.isUNC()){const[t,e,s,i,...r]=this.#t;const[n,o,a,h,...l]=this.#e;if(r[0]===""){r.shift();l.shift()}const c=[t,e,s,i,""].join("/");const u=[n,o,a,h,""].join("/");this.#t=[c,...r];this.#e=[u,...l];this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){const[t,...e]=this.#t;const[s,...i]=this.#e;if(e[0]===""){e.shift();i.shift()}const r=t+"/";const n=s+"/";this.#t=[r,...e];this.#e=[n,...i];this.length=this.#t.length}}}pattern(){return this.#t[this.#s]}isString(){return typeof this.#t[this.#s]==="string"}isGlobstar(){return this.#t[this.#s]===i.GLOBSTAR}isRegExp(){return this.#t[this.#s]instanceof RegExp}globString(){return this.#n=this.#n||(this.#s===0?this.isAbsolute()?this.#e[0]+this.#e.slice(1).join("/"):this.#e.join("/"):this.#e.slice(this.#s).join("/"))}hasMore(){return this.length>this.#s+1}rest(){if(this.#r!==undefined)return this.#r;if(!this.hasMore())return this.#r=null;this.#r=new Pattern(this.#t,this.#e,this.#s+1,this.#i);this.#r.#h=this.#h;this.#r.#a=this.#a;this.#r.#o=this.#o;return this.#r}isUNC(){const t=this.#t;return this.#a!==undefined?this.#a:this.#a=this.#i==="win32"&&this.#s===0&&t[0]===""&&t[1]===""&&typeof t[2]==="string"&&!!t[2]&&typeof t[3]==="string"&&!!t[3]}isDrive(){const t=this.#t;return this.#o!==undefined?this.#o:this.#o=this.#i==="win32"&&this.#s===0&&this.length>1&&typeof t[0]==="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){const t=this.#t;return this.#h!==undefined?this.#h:this.#h=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){const t=this.#t[0];return typeof t==="string"&&this.isAbsolute()&&this.#s===0?t:""}checkFollowGlobstar(){return!(this.#s===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){if(this.#s===0||!this.isGlobstar()||!this.#l)return false;this.#l=false;return true}}e.Pattern=Pattern},999:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.Processor=e.SubWalks=e.MatchRecord=e.HasWalkedCache=void 0;const i=s(647);class HasWalkedCache{store;constructor(t=new Map){this.store=t}copy(){return new HasWalkedCache(new Map(this.store))}hasWalked(t,e){return this.store.get(t.fullpath())?.has(e.globString())}storeWalked(t,e){const s=t.fullpath();const i=this.store.get(s);if(i)i.add(e.globString());else this.store.set(s,new Set([e.globString()]))}}e.HasWalkedCache=HasWalkedCache;class MatchRecord{store=new Map;add(t,e,s){const i=(e?2:0)|(s?1:0);const r=this.store.get(t);this.store.set(t,r===undefined?i:i&r)}entries(){return[...this.store.entries()].map((([t,e])=>[t,!!(e&2),!!(e&1)]))}}e.MatchRecord=MatchRecord;class SubWalks{store=new Map;add(t,e){if(!t.canReaddir()){return}const s=this.store.get(t);if(s){if(!s.find((t=>t.globString()===e.globString()))){s.push(e)}}else this.store.set(t,[e])}get(t){const e=this.store.get(t);if(!e){throw new Error("attempting to walk unknown path")}return e}entries(){return this.keys().map((t=>[t,this.store.get(t)]))}keys(){return[...this.store.keys()].filter((t=>t.canReaddir()))}}e.SubWalks=SubWalks;class Processor{hasWalkedCache;matches=new MatchRecord;subwalks=new SubWalks;patterns;follow;dot;opts;constructor(t,e){this.opts=t;this.follow=!!t.follow;this.dot=!!t.dot;this.hasWalkedCache=e?e.copy():new HasWalkedCache}processPatterns(t,e){this.patterns=e;const s=e.map((e=>[t,e]));for(let[t,e]of s){this.hasWalkedCache.storeWalked(t,e);const s=e.root();const r=e.isAbsolute()&&this.opts.absolute!==false;if(s){t=t.resolve(s==="/"&&this.opts.root!==undefined?this.opts.root:s);const i=e.rest();if(!i){this.matches.add(t,true,false);continue}else{e=i}}if(t.isENOENT())continue;let n;let o;let a=false;while(typeof(n=e.pattern())==="string"&&(o=e.rest())){const s=t.resolve(n);t=s;e=o;a=true}n=e.pattern();o=e.rest();if(a){if(this.hasWalkedCache.hasWalked(t,e))continue;this.hasWalkedCache.storeWalked(t,e)}if(typeof n==="string"){const e=n===".."||n===""||n===".";this.matches.add(t.resolve(n),r,e);continue}else if(n===i.GLOBSTAR){if(!t.isSymbolicLink()||this.follow||e.checkFollowGlobstar()){this.subwalks.add(t,e)}const s=o?.pattern();const i=o?.rest();if(!o||(s===""||s===".")&&!i){this.matches.add(t,r,s===""||s===".")}else{if(s===".."){const e=t.parent||t;if(!i)this.matches.add(e,r,true);else if(!this.hasWalkedCache.hasWalked(e,i)){this.subwalks.add(e,i)}}}}else if(n instanceof RegExp){this.subwalks.add(t,e)}}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new Processor(this.opts,this.hasWalkedCache)}filterEntries(t,e){const s=this.subwalks.get(t);const r=this.child();for(const t of e){for(const e of s){const s=e.isAbsolute();const n=e.pattern();const o=e.rest();if(n===i.GLOBSTAR){r.testGlobstar(t,e,o,s)}else if(n instanceof RegExp){r.testRegExp(t,n,o,s)}else{r.testString(t,n,o,s)}}}return r}testGlobstar(t,e,s,i){if(this.dot||!t.name.startsWith(".")){if(!e.hasMore()){this.matches.add(t,i,false)}if(t.canReaddir()){if(this.follow||!t.isSymbolicLink()){this.subwalks.add(t,e)}else if(t.isSymbolicLink()){if(s&&e.checkFollowGlobstar()){this.subwalks.add(t,s)}else if(e.markFollowGlobstar()){this.subwalks.add(t,e)}}}}if(s){const e=s.pattern();if(typeof e==="string"&&e!==".."&&e!==""&&e!=="."){this.testString(t,e,s.rest(),i)}else if(e===".."){const e=t.parent||t;this.subwalks.add(e,s)}else if(e instanceof RegExp){this.testRegExp(t,e,s.rest(),i)}}}testRegExp(t,e,s,i){if(!e.test(t.name))return;if(!s){this.matches.add(t,i,false)}else{this.subwalks.add(t,s)}}testString(t,e,s,i){if(!t.isNamed(e))return;if(!s){this.matches.add(t,i,false)}else{this.subwalks.add(t,s)}}}e.Processor=Processor},89:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.GlobStream=e.GlobWalker=e.GlobUtil=void 0;const i=s(31);const r=s(449);const n=s(999);const makeIgnore=(t,e)=>typeof t==="string"?new r.Ignore([t],e):Array.isArray(t)?new r.Ignore(t,e):t;class GlobUtil{path;patterns;opts;seen=new Set;paused=false;aborted=false;#c=[];#u;#f;signal;maxDepth;includeChildMatches;constructor(t,e,s){this.patterns=t;this.path=e;this.opts=s;this.#f=!s.posix&&s.platform==="win32"?"\\":"/";this.includeChildMatches=s.includeChildMatches!==false;if(s.ignore||!this.includeChildMatches){this.#u=makeIgnore(s.ignore??[],s);if(!this.includeChildMatches&&typeof this.#u.add!=="function"){const t="cannot ignore child matches, ignore lacks add() method.";throw new Error(t)}}this.maxDepth=s.maxDepth||Infinity;if(s.signal){this.signal=s.signal;this.signal.addEventListener("abort",(()=>{this.#c.length=0}))}}#d(t){return this.seen.has(t)||!!this.#u?.ignored?.(t)}#p(t){return!!this.#u?.childrenIgnored?.(t)}pause(){this.paused=true}resume(){if(this.signal?.aborted)return;this.paused=false;let t=undefined;while(!this.paused&&(t=this.#c.shift())){t()}}onResume(t){if(this.signal?.aborted)return;if(!this.paused){t()}else{this.#c.push(t)}}async matchCheck(t,e){if(e&&this.opts.nodir)return undefined;let s;if(this.opts.realpath){s=t.realpathCached()||await t.realpath();if(!s)return undefined;t=s}const i=t.isUnknown()||this.opts.stat;const r=i?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){const t=await r.realpath();if(t&&(t.isUnknown()||this.opts.stat)){await t.lstat()}}return this.matchCheckTest(r,e)}matchCheckTest(t,e){return t&&(this.maxDepth===Infinity||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#d(t)?t:undefined}matchCheckSync(t,e){if(e&&this.opts.nodir)return undefined;let s;if(this.opts.realpath){s=t.realpathCached()||t.realpathSync();if(!s)return undefined;t=s}const i=t.isUnknown()||this.opts.stat;const r=i?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){const t=r.realpathSync();if(t&&(t?.isUnknown()||this.opts.stat)){t.lstatSync()}}return this.matchCheckTest(r,e)}matchFinish(t,e){if(this.#d(t))return;if(!this.includeChildMatches&&this.#u?.add){const e=`${t.relativePosix()}/**`;this.#u.add(e)}const s=this.opts.absolute===undefined?e:this.opts.absolute;this.seen.add(t);const i=this.opts.mark&&t.isDirectory()?this.#f:"";if(this.opts.withFileTypes){this.matchEmit(t)}else if(s){const e=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(e+i)}else{const e=this.opts.posix?t.relativePosix():t.relative();const s=this.opts.dotRelative&&!e.startsWith(".."+this.#f)?"."+this.#f:"";this.matchEmit(!e?"."+i:s+e+i)}}async match(t,e,s){const i=await this.matchCheck(t,s);if(i)this.matchFinish(i,e)}matchSync(t,e,s){const i=this.matchCheckSync(t,s);if(i)this.matchFinish(i,e)}walkCB(t,e,s){if(this.signal?.aborted)s();this.walkCB2(t,e,new n.Processor(this.opts),s)}walkCB2(t,e,s,i){if(this.#p(t))return i();if(this.signal?.aborted)i();if(this.paused){this.onResume((()=>this.walkCB2(t,e,s,i)));return}s.processPatterns(t,e);let r=1;const next=()=>{if(--r===0)i()};for(const[t,e,i]of s.matches.entries()){if(this.#d(t))continue;r++;this.match(t,e,i).then((()=>next()))}for(const t of s.subwalkTargets()){if(this.maxDepth!==Infinity&&t.depth()>=this.maxDepth){continue}r++;const e=t.readdirCached();if(t.calledReaddir())this.walkCB3(t,e,s,next);else{t.readdirCB(((e,i)=>this.walkCB3(t,i,s,next)),true)}}next()}walkCB3(t,e,s,i){s=s.filterEntries(t,e);let r=1;const next=()=>{if(--r===0)i()};for(const[t,e,i]of s.matches.entries()){if(this.#d(t))continue;r++;this.match(t,e,i).then((()=>next()))}for(const[t,e]of s.subwalks.entries()){r++;this.walkCB2(t,e,s.child(),next)}next()}walkCBSync(t,e,s){if(this.signal?.aborted)s();this.walkCB2Sync(t,e,new n.Processor(this.opts),s)}walkCB2Sync(t,e,s,i){if(this.#p(t))return i();if(this.signal?.aborted)i();if(this.paused){this.onResume((()=>this.walkCB2Sync(t,e,s,i)));return}s.processPatterns(t,e);let r=1;const next=()=>{if(--r===0)i()};for(const[t,e,i]of s.matches.entries()){if(this.#d(t))continue;this.matchSync(t,e,i)}for(const t of s.subwalkTargets()){if(this.maxDepth!==Infinity&&t.depth()>=this.maxDepth){continue}r++;const e=t.readdirSync();this.walkCB3Sync(t,e,s,next)}next()}walkCB3Sync(t,e,s,i){s=s.filterEntries(t,e);let r=1;const next=()=>{if(--r===0)i()};for(const[t,e,i]of s.matches.entries()){if(this.#d(t))continue;this.matchSync(t,e,i)}for(const[t,e]of s.subwalks.entries()){r++;this.walkCB2Sync(t,e,s.child(),next)}next()}}e.GlobUtil=GlobUtil;class GlobWalker extends GlobUtil{matches=new Set;constructor(t,e,s){super(t,e,s)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown()){await this.path.lstat()}await new Promise(((t,e)=>{this.walkCB(this.path,this.patterns,(()=>{if(this.signal?.aborted){e(this.signal.reason)}else{t(this.matches)}}))}));return this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown()){this.path.lstatSync()}this.walkCBSync(this.path,this.patterns,(()=>{if(this.signal?.aborted)throw this.signal.reason}));return this.matches}}e.GlobWalker=GlobWalker;class GlobStream extends GlobUtil{results;constructor(t,e,s){super(t,e,s);this.results=new i.Minipass({signal:this.signal,objectMode:true});this.results.on("drain",(()=>this.resume()));this.results.on("resume",(()=>this.resume()))}matchEmit(t){this.results.write(t);if(!this.results.flowing)this.pause()}stream(){const t=this.path;if(t.isUnknown()){t.lstat().then((()=>{this.walkCB(t,this.patterns,(()=>this.results.end()))}))}else{this.walkCB(t,this.patterns,(()=>this.results.end()))}return this.results}streamSync(){if(this.path.isUnknown()){this.path.lstatSync()}this.walkCBSync(this.path,this.patterns,(()=>this.results.end()));return this.results}}e.GlobStream=GlobStream},481:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.LRUCache=void 0;const s=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date;const i=new Set;const r=typeof process==="object"&&!!process?process:{};const emitWarning=(t,e,s,i)=>{typeof r.emitWarning==="function"?r.emitWarning(t,e,s,i):console.error(`[${s}] ${e}: ${t}`)};let n=globalThis.AbortController;let o=globalThis.AbortSignal;if(typeof n==="undefined"){o=class AbortSignal{onabort;_onabort=[];reason;aborted=false;addEventListener(t,e){this._onabort.push(e)}};n=class AbortController{constructor(){warnACPolyfill()}signal=new o;abort(t){if(this.signal.aborted)return;this.signal.reason=t;this.signal.aborted=true;for(const e of this.signal._onabort){e(t)}this.signal.onabort?.(t)}};let t=r.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1";const warnACPolyfill=()=>{if(!t)return;t=false;emitWarning("AbortController is not defined. If using lru-cache in "+"node 14, load an AbortController polyfill from the "+"`node-abort-controller` package. A minimal polyfill is "+"provided for use by LRUCache.fetch(), but it should not be "+"relied upon in other contexts (eg, passing it to other APIs that "+"use AbortController/AbortSignal might have undesirable effects). "+"You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",warnACPolyfill)}}const shouldWarn=t=>!i.has(t);const a=Symbol("type");const isPosInt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t);const getUintArray=t=>!isPosInt(t)?null:t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ZeroArray:null;class ZeroArray extends Array{constructor(t){super(t);this.fill(0)}}class Stack{heap;length;static#m=false;static create(t){const e=getUintArray(t);if(!e)return[];Stack.#m=true;const s=new Stack(t,e);Stack.#m=false;return s}constructor(t,e){if(!Stack.#m){throw new TypeError("instantiate Stack using Stack.create(n)")}this.heap=new e(t);this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class LRUCache{#g;#y;#b;#w;#S;#v;#T;#k;get perf(){return this.#k}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#x;#E;#_;#C;#R;#P;#A;#O;#L;#I;#M;#U;#B;#F;#N;#j;#D;#z;#W;static unsafeExposeInternals(t){return{starts:t.#B,ttls:t.#F,autopurgeTimers:t.#N,sizes:t.#U,keyMap:t.#_,keyList:t.#C,valList:t.#R,next:t.#P,prev:t.#A,get head(){return t.#O},get tail(){return t.#L},free:t.#I,isBackgroundFetch:e=>t.#G(e),backgroundFetch:(e,s,i,r)=>t.#$(e,s,i,r),moveToTail:e=>t.#H(e),indexes:e=>t.#q(e),rindexes:e=>t.#K(e),isStale:e=>t.#V(e)}}get max(){return this.#g}get maxSize(){return this.#y}get calculatedSize(){return this.#E}get size(){return this.#x}get fetchMethod(){return this.#v}get memoMethod(){return this.#T}get dispose(){return this.#b}get onInsert(){return this.#w}get disposeAfter(){return this.#S}constructor(t){const{max:e=0,ttl:r,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:h,allowStale:l,dispose:c,onInsert:u,disposeAfter:f,noDisposeOnSet:d,noUpdateTTL:p,maxSize:g=0,maxEntrySize:y=0,sizeCalculation:b,fetchMethod:w,memoMethod:S,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:T,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:x,ignoreFetchAbort:E,perf:_}=t;if(_!==undefined){if(typeof _?.now!=="function"){throw new TypeError("perf option must have a now() method if specified")}}this.#k=_??s;if(e!==0&&!isPosInt(e)){throw new TypeError("max option must be a nonnegative integer")}const C=e?getUintArray(e):Array;if(!C){throw new Error("invalid max value: "+e)}this.#g=e;this.#y=g;this.maxEntrySize=y||this.#y;this.sizeCalculation=b;if(this.sizeCalculation){if(!this.#y&&!this.maxEntrySize){throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize")}if(typeof this.sizeCalculation!=="function"){throw new TypeError("sizeCalculation set to non-function")}}if(S!==undefined&&typeof S!=="function"){throw new TypeError("memoMethod must be a function if defined")}this.#T=S;if(w!==undefined&&typeof w!=="function"){throw new TypeError("fetchMethod must be a function if specified")}this.#v=w;this.#D=!!w;this.#_=new Map;this.#C=new Array(e).fill(undefined);this.#R=new Array(e).fill(undefined);this.#P=new C(e);this.#A=new C(e);this.#O=0;this.#L=0;this.#I=Stack.create(e);this.#x=0;this.#E=0;if(typeof c==="function"){this.#b=c}if(typeof u==="function"){this.#w=u}if(typeof f==="function"){this.#S=f;this.#M=[]}else{this.#S=undefined;this.#M=undefined}this.#j=!!this.#b;this.#W=!!this.#w;this.#z=!!this.#S;this.noDisposeOnSet=!!d;this.noUpdateTTL=!!p;this.noDeleteOnFetchRejection=!!v;this.allowStaleOnFetchRejection=!!k;this.allowStaleOnFetchAbort=!!x;this.ignoreFetchAbort=!!E;if(this.maxEntrySize!==0){if(this.#y!==0){if(!isPosInt(this.#y)){throw new TypeError("maxSize must be a positive integer if specified")}}if(!isPosInt(this.maxEntrySize)){throw new TypeError("maxEntrySize must be a positive integer if specified")}this.#Y()}this.allowStale=!!l;this.noDeleteOnStaleGet=!!T;this.updateAgeOnGet=!!a;this.updateAgeOnHas=!!h;this.ttlResolution=isPosInt(n)||n===0?n:1;this.ttlAutopurge=!!o;this.ttl=r||0;if(this.ttl){if(!isPosInt(this.ttl)){throw new TypeError("ttl must be a positive integer if specified")}this.#J()}if(this.#g===0&&this.ttl===0&&this.#y===0){throw new TypeError("At least one of max, maxSize, or ttl is required")}if(!this.ttlAutopurge&&!this.#g&&!this.#y){const t="LRU_CACHE_UNBOUNDED";if(shouldWarn(t)){i.add(t);const e="TTL caching without ttlAutopurge, max, or maxSize can "+"result in unbounded memory consumption.";emitWarning(e,"UnboundedCacheWarning",t,LRUCache)}}}getRemainingTTL(t){return this.#_.has(t)?Infinity:0}#J(){const t=new ZeroArray(this.#g);const e=new ZeroArray(this.#g);this.#F=t;this.#B=e;const s=this.ttlAutopurge?new Array(this.#g):undefined;this.#N=s;this.#Z=(i,r,n=this.#k.now())=>{e[i]=r!==0?n:0;t[i]=r;if(s?.[i]){clearTimeout(s[i]);s[i]=undefined}if(r!==0&&s){const t=setTimeout((()=>{if(this.#V(i)){this.#X(this.#C[i],"expire")}}),r+1);if(t.unref){t.unref()}s[i]=t}};this.#Q=s=>{e[s]=t[s]!==0?this.#k.now():0};this.#tt=(s,r)=>{if(t[r]){const n=t[r];const o=e[r];if(!n||!o)return;s.ttl=n;s.start=o;s.now=i||getNow();const a=s.now-o;s.remainingTTL=n-a}};let i=0;const getNow=()=>{const t=this.#k.now();if(this.ttlResolution>0){i=t;const e=setTimeout((()=>i=0),this.ttlResolution);if(e.unref){e.unref()}}return t};this.getRemainingTTL=s=>{const r=this.#_.get(s);if(r===undefined){return 0}const n=t[r];const o=e[r];if(!n||!o){return Infinity}const a=(i||getNow())-o;return n-a};this.#V=s=>{const r=e[s];const n=t[s];return!!n&&!!r&&(i||getNow())-r>n}}#Q=()=>{};#tt=()=>{};#Z=()=>{};#V=()=>false;#Y(){const t=new ZeroArray(this.#g);this.#E=0;this.#U=t;this.#et=e=>{this.#E-=t[e];t[e]=0};this.#st=(t,e,s,i)=>{if(this.#G(e)){return 0}if(!isPosInt(s)){if(i){if(typeof i!=="function"){throw new TypeError("sizeCalculation must be a function")}s=i(e,t);if(!isPosInt(s)){throw new TypeError("sizeCalculation return invalid (expect positive integer)")}}else{throw new TypeError("invalid size value (must be positive integer). "+"When maxSize or maxEntrySize is used, sizeCalculation "+"or size must be set.")}}return s};this.#it=(e,s,i)=>{t[e]=s;if(this.#y){const s=this.#y-t[e];while(this.#E>s){this.#rt(true)}}this.#E+=t[e];if(i){i.entrySize=s;i.totalCalculatedSize=this.#E}}}#et=t=>{};#it=(t,e,s)=>{};#st=(t,e,s,i)=>{if(s||i){throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}return 0};*#q({allowStale:t=this.allowStale}={}){if(this.#x){for(let e=this.#L;true;){if(!this.#nt(e)){break}if(t||!this.#V(e)){yield e}if(e===this.#O){break}else{e=this.#A[e]}}}}*#K({allowStale:t=this.allowStale}={}){if(this.#x){for(let e=this.#O;true;){if(!this.#nt(e)){break}if(t||!this.#V(e)){yield e}if(e===this.#L){break}else{e=this.#P[e]}}}}#nt(t){return t!==undefined&&this.#_.get(this.#C[t])===t}*entries(){for(const t of this.#q()){if(this.#R[t]!==undefined&&this.#C[t]!==undefined&&!this.#G(this.#R[t])){yield[this.#C[t],this.#R[t]]}}}*rentries(){for(const t of this.#K()){if(this.#R[t]!==undefined&&this.#C[t]!==undefined&&!this.#G(this.#R[t])){yield[this.#C[t],this.#R[t]]}}}*keys(){for(const t of this.#q()){const e=this.#C[t];if(e!==undefined&&!this.#G(this.#R[t])){yield e}}}*rkeys(){for(const t of this.#K()){const e=this.#C[t];if(e!==undefined&&!this.#G(this.#R[t])){yield e}}}*values(){for(const t of this.#q()){const e=this.#R[t];if(e!==undefined&&!this.#G(this.#R[t])){yield this.#R[t]}}}*rvalues(){for(const t of this.#K()){const e=this.#R[t];if(e!==undefined&&!this.#G(this.#R[t])){yield this.#R[t]}}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(const s of this.#q()){const i=this.#R[s];const r=this.#G(i)?i.__staleWhileFetching:i;if(r===undefined)continue;if(t(r,this.#C[s],this)){return this.get(this.#C[s],e)}}}forEach(t,e=this){for(const s of this.#q()){const i=this.#R[s];const r=this.#G(i)?i.__staleWhileFetching:i;if(r===undefined)continue;t.call(e,r,this.#C[s],this)}}rforEach(t,e=this){for(const s of this.#K()){const i=this.#R[s];const r=this.#G(i)?i.__staleWhileFetching:i;if(r===undefined)continue;t.call(e,r,this.#C[s],this)}}purgeStale(){let t=false;for(const e of this.#K({allowStale:true})){if(this.#V(e)){this.#X(this.#C[e],"expire");t=true}}return t}info(t){const e=this.#_.get(t);if(e===undefined)return undefined;const s=this.#R[e];const i=this.#G(s)?s.__staleWhileFetching:s;if(i===undefined)return undefined;const r={value:i};if(this.#F&&this.#B){const t=this.#F[e];const s=this.#B[e];if(t&&s){const e=t-(this.#k.now()-s);r.ttl=e;r.start=Date.now()}}if(this.#U){r.size=this.#U[e]}return r}dump(){const t=[];for(const e of this.#q({allowStale:true})){const s=this.#C[e];const i=this.#R[e];const r=this.#G(i)?i.__staleWhileFetching:i;if(r===undefined||s===undefined)continue;const n={value:r};if(this.#F&&this.#B){n.ttl=this.#F[e];const t=this.#k.now()-this.#B[e];n.start=Math.floor(Date.now()-t)}if(this.#U){n.size=this.#U[e]}t.unshift([s,n])}return t}load(t){this.clear();for(const[e,s]of t){if(s.start){const t=Date.now()-s.start;s.start=this.#k.now()-t}this.set(e,s.value,s)}}set(t,e,s={}){if(e===undefined){this.delete(t);return this}const{ttl:i=this.ttl,start:r,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:a}=s;let{noUpdateTTL:h=this.noUpdateTTL}=s;const l=this.#st(t,e,s.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize){if(a){a.set="miss";a.maxEntrySizeExceeded=true}this.#X(t,"set");return this}let c=this.#x===0?undefined:this.#_.get(t);if(c===undefined){c=this.#x===0?this.#L:this.#I.length!==0?this.#I.pop():this.#x===this.#g?this.#rt(false):this.#x;this.#C[c]=t;this.#R[c]=e;this.#_.set(t,c);this.#P[this.#L]=c;this.#A[c]=this.#L;this.#L=c;this.#x++;this.#it(c,l,a);if(a)a.set="add";h=false;if(this.#W){this.#w?.(e,t,"add")}}else{this.#H(c);const s=this.#R[c];if(e!==s){if(this.#D&&this.#G(s)){s.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:e}=s;if(e!==undefined&&!n){if(this.#j){this.#b?.(e,t,"set")}if(this.#z){this.#M?.push([e,t,"set"])}}}else if(!n){if(this.#j){this.#b?.(s,t,"set")}if(this.#z){this.#M?.push([s,t,"set"])}}this.#et(c);this.#it(c,l,a);this.#R[c]=e;if(a){a.set="replace";const t=s&&this.#G(s)?s.__staleWhileFetching:s;if(t!==undefined)a.oldValue=t}}else if(a){a.set="update"}if(this.#W){this.onInsert?.(e,t,e===s?"update":"replace")}}if(i!==0&&!this.#F){this.#J()}if(this.#F){if(!h){this.#Z(c,i,r)}if(a)this.#tt(a,c)}if(!n&&this.#z&&this.#M){const t=this.#M;let e;while(e=t?.shift()){this.#S?.(...e)}}return this}pop(){try{while(this.#x){const t=this.#R[this.#O];this.#rt(true);if(this.#G(t)){if(t.__staleWhileFetching){return t.__staleWhileFetching}}else if(t!==undefined){return t}}}finally{if(this.#z&&this.#M){const t=this.#M;let e;while(e=t?.shift()){this.#S?.(...e)}}}}#rt(t){const e=this.#O;const s=this.#C[e];const i=this.#R[e];if(this.#D&&this.#G(i)){i.__abortController.abort(new Error("evicted"))}else if(this.#j||this.#z){if(this.#j){this.#b?.(i,s,"evict")}if(this.#z){this.#M?.push([i,s,"evict"])}}this.#et(e);if(this.#N?.[e]){clearTimeout(this.#N[e]);this.#N[e]=undefined}if(t){this.#C[e]=undefined;this.#R[e]=undefined;this.#I.push(e)}if(this.#x===1){this.#O=this.#L=0;this.#I.length=0}else{this.#O=this.#P[e]}this.#_.delete(s);this.#x--;return e}has(t,e={}){const{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=e;const r=this.#_.get(t);if(r!==undefined){const t=this.#R[r];if(this.#G(t)&&t.__staleWhileFetching===undefined){return false}if(!this.#V(r)){if(s){this.#Q(r)}if(i){i.has="hit";this.#tt(i,r)}return true}else if(i){i.has="stale";this.#tt(i,r)}}else if(i){i.has="miss"}return false}peek(t,e={}){const{allowStale:s=this.allowStale}=e;const i=this.#_.get(t);if(i===undefined||!s&&this.#V(i)){return}const r=this.#R[i];return this.#G(r)?r.__staleWhileFetching:r}#$(t,e,s,i){const r=e===undefined?undefined:this.#R[e];if(this.#G(r)){return r}const o=new n;const{signal:a}=s;a?.addEventListener("abort",(()=>o.abort(a.reason)),{signal:o.signal});const h={signal:o.signal,options:s,context:i};const cb=(i,r=false)=>{const{aborted:n}=o.signal;const a=s.ignoreFetchAbort&&i!==undefined;if(s.status){if(n&&!r){s.status.fetchAborted=true;s.status.fetchError=o.signal.reason;if(a)s.status.fetchAbortIgnored=true}else{s.status.fetchResolved=true}}if(n&&!a&&!r){return fetchFail(o.signal.reason)}const c=l;const u=this.#R[e];if(u===l||a&&r&&u===undefined){if(i===undefined){if(c.__staleWhileFetching!==undefined){this.#R[e]=c.__staleWhileFetching}else{this.#X(t,"fetch")}}else{if(s.status)s.status.fetchUpdated=true;this.set(t,i,h.options)}}return i};const eb=t=>{if(s.status){s.status.fetchRejected=true;s.status.fetchError=t}return fetchFail(t)};const fetchFail=i=>{const{aborted:r}=o.signal;const n=r&&s.allowStaleOnFetchAbort;const a=n||s.allowStaleOnFetchRejection;const h=a||s.noDeleteOnFetchRejection;const c=l;if(this.#R[e]===l){const s=!h||c.__staleWhileFetching===undefined;if(s){this.#X(t,"fetch")}else if(!n){this.#R[e]=c.__staleWhileFetching}}if(a){if(s.status&&c.__staleWhileFetching!==undefined){s.status.returnedStale=true}return c.__staleWhileFetching}else if(c.__returned===c){throw i}};const pcall=(e,i)=>{const n=this.#v?.(t,r,h);if(n&&n instanceof Promise){n.then((t=>e(t===undefined?undefined:t)),i)}o.signal.addEventListener("abort",(()=>{if(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort){e(undefined);if(s.allowStaleOnFetchAbort){e=t=>cb(t,true)}}}))};if(s.status)s.status.fetchDispatched=true;const l=new Promise(pcall).then(cb,eb);const c=Object.assign(l,{__abortController:o,__staleWhileFetching:r,__returned:undefined});if(e===undefined){this.set(t,c,{...h.options,status:undefined});e=this.#_.get(t)}else{this.#R[e]=c}return c}#G(t){if(!this.#D)return false;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof n}async fetch(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:p,forceRefresh:g=false,status:y,signal:b}=e;if(!this.#D){if(y)y.fetch="get";return this.get(t,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:y})}const w={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:n,noDisposeOnSet:o,size:a,sizeCalculation:h,noUpdateTTL:l,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:d,ignoreFetchAbort:f,status:y,signal:b};let S=this.#_.get(t);if(S===undefined){if(y)y.fetch="miss";const e=this.#$(t,S,w,p);return e.__returned=e}else{const e=this.#R[S];if(this.#G(e)){const t=s&&e.__staleWhileFetching!==undefined;if(y){y.fetch="inflight";if(t)y.returnedStale=true}return t?e.__staleWhileFetching:e.__returned=e}const r=this.#V(S);if(!g&&!r){if(y)y.fetch="hit";this.#H(S);if(i){this.#Q(S)}if(y)this.#tt(y,S);return e}const n=this.#$(t,S,w,p);const o=n.__staleWhileFetching!==undefined;const a=o&&s;if(y){y.fetch=r?"stale":"refresh";if(a&&r)y.returnedStale=true}return a?n.__staleWhileFetching:n.__returned=n}}async forceFetch(t,e={}){const s=await this.fetch(t,e);if(s===undefined)throw new Error("fetch() returned undefined");return s}memo(t,e={}){const s=this.#T;if(!s){throw new Error("no memoMethod provided to constructor")}const{context:i,forceRefresh:r,...n}=e;const o=this.get(t,n);if(!r&&o!==undefined)return o;const a=s(t,o,{options:n,context:i});this.set(t,a,n);return a}get(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:n}=e;const o=this.#_.get(t);if(o!==undefined){const e=this.#R[o];const a=this.#G(e);if(n)this.#tt(n,o);if(this.#V(o)){if(n)n.get="stale";if(!a){if(!r){this.#X(t,"expire")}if(n&&s)n.returnedStale=true;return s?e:undefined}else{if(n&&s&&e.__staleWhileFetching!==undefined){n.returnedStale=true}return s?e.__staleWhileFetching:undefined}}else{if(n)n.get="hit";if(a){return e.__staleWhileFetching}this.#H(o);if(i){this.#Q(o)}return e}}else if(n){n.get="miss"}}#ot(t,e){this.#A[e]=t;this.#P[t]=e}#H(t){if(t!==this.#L){if(t===this.#O){this.#O=this.#P[t]}else{this.#ot(this.#A[t],this.#P[t])}this.#ot(this.#L,t);this.#L=t}}delete(t){return this.#X(t,"delete")}#X(t,e){let s=false;if(this.#x!==0){const i=this.#_.get(t);if(i!==undefined){if(this.#N?.[i]){clearTimeout(this.#N?.[i]);this.#N[i]=undefined}s=true;if(this.#x===1){this.#at(e)}else{this.#et(i);const s=this.#R[i];if(this.#G(s)){s.__abortController.abort(new Error("deleted"))}else if(this.#j||this.#z){if(this.#j){this.#b?.(s,t,e)}if(this.#z){this.#M?.push([s,t,e])}}this.#_.delete(t);this.#C[i]=undefined;this.#R[i]=undefined;if(i===this.#L){this.#L=this.#A[i]}else if(i===this.#O){this.#O=this.#P[i]}else{const t=this.#A[i];this.#P[t]=this.#P[i];const e=this.#P[i];this.#A[e]=this.#A[i]}this.#x--;this.#I.push(i)}}}if(this.#z&&this.#M?.length){const t=this.#M;let e;while(e=t?.shift()){this.#S?.(...e)}}return s}clear(){return this.#at("delete")}#at(t){for(const e of this.#K({allowStale:true})){const s=this.#R[e];if(this.#G(s)){s.__abortController.abort(new Error("deleted"))}else{const i=this.#C[e];if(this.#j){this.#b?.(s,i,t)}if(this.#z){this.#M?.push([s,i,t])}}}this.#_.clear();this.#R.fill(undefined);this.#C.fill(undefined);if(this.#F&&this.#B){this.#F.fill(0);this.#B.fill(0);for(const t of this.#N??[]){if(t!==undefined)clearTimeout(t)}this.#N?.fill(undefined)}if(this.#U){this.#U.fill(0)}this.#O=0;this.#L=0;this.#I.length=0;this.#E=0;this.#x=0;if(this.#z&&this.#M){const t=this.#M;let e;while(e=t?.shift()){this.#S?.(...e)}}}}e.LRUCache=LRUCache},557:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.assertValidPattern=void 0;const s=1024*64;const assertValidPattern=t=>{if(typeof t!=="string"){throw new TypeError("invalid pattern")}if(t.length>s){throw new TypeError("pattern is too long")}};e.assertValidPattern=assertValidPattern},743:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.AST=void 0;const i=s(694);const r=s(967);const n=new Set(["!","?","+","*","@"]);const isExtglobType=t=>n.has(t);const o="(?!(?:^|/)\\.\\.?(?:$|/))";const a="(?!\\.)";const h=new Set(["[","."]);const l=new Set(["..","."]);const c=new Set("().*{}+?[]^$\\!");const regExpEscape=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");const u="[^/]";const f=u+"*?";const d=u+"+?";class AST{type;#ht;#lt;#ct=false;#ut=[];#ft;#dt;#pt;#mt=false;#gt;#yt;#bt=false;constructor(t,e,s={}){this.type=t;if(t)this.#lt=true;this.#ft=e;this.#ht=this.#ft?this.#ft.#ht:this;this.#gt=this.#ht===this?s:this.#ht.#gt;this.#pt=this.#ht===this?[]:this.#ht.#pt;if(t==="!"&&!this.#ht.#mt)this.#pt.push(this);this.#dt=this.#ft?this.#ft.#ut.length:0}get hasMagic(){if(this.#lt!==undefined)return this.#lt;for(const t of this.#ut){if(typeof t==="string")continue;if(t.type||t.hasMagic)return this.#lt=true}return this.#lt}toString(){if(this.#yt!==undefined)return this.#yt;if(!this.type){return this.#yt=this.#ut.map((t=>String(t))).join("")}else{return this.#yt=this.type+"("+this.#ut.map((t=>String(t))).join("|")+")"}}#wt(){if(this!==this.#ht)throw new Error("should only call on root");if(this.#mt)return this;this.toString();this.#mt=true;let t;while(t=this.#pt.pop()){if(t.type!=="!")continue;let e=t;let s=e.#ft;while(s){for(let i=e.#dt+1;!s.type&&i<s.#ut.length;i++){for(const e of t.#ut){if(typeof e==="string"){throw new Error("string part in extglob AST??")}e.copyIn(s.#ut[i])}}e=s;s=e.#ft}}return this}push(...t){for(const e of t){if(e==="")continue;if(typeof e!=="string"&&!(e instanceof AST&&e.#ft===this)){throw new Error("invalid part: "+e)}this.#ut.push(e)}}toJSON(){const t=this.type===null?this.#ut.slice().map((t=>typeof t==="string"?t:t.toJSON())):[this.type,...this.#ut.map((t=>t.toJSON()))];if(this.isStart()&&!this.type)t.unshift([]);if(this.isEnd()&&(this===this.#ht||this.#ht.#mt&&this.#ft?.type==="!")){t.push({})}return t}isStart(){if(this.#ht===this)return true;if(!this.#ft?.isStart())return false;if(this.#dt===0)return true;const t=this.#ft;for(let e=0;e<this.#dt;e++){const s=t.#ut[e];if(!(s instanceof AST&&s.type==="!")){return false}}return true}isEnd(){if(this.#ht===this)return true;if(this.#ft?.type==="!")return true;if(!this.#ft?.isEnd())return false;if(!this.type)return this.#ft?.isEnd();const t=this.#ft?this.#ft.#ut.length:0;return this.#dt===t-1}copyIn(t){if(typeof t==="string")this.push(t);else this.push(t.clone(this))}clone(t){const e=new AST(this.type,t);for(const t of this.#ut){e.copyIn(t)}return e}static#St(t,e,s,i){let r=false;let n=false;let o=-1;let a=false;if(e.type===null){let h=s;let l="";while(h<t.length){const s=t.charAt(h++);if(r||s==="\\"){r=!r;l+=s;continue}if(n){if(h===o+1){if(s==="^"||s==="!"){a=true}}else if(s==="]"&&!(h===o+2&&a)){n=false}l+=s;continue}else if(s==="["){n=true;o=h;a=false;l+=s;continue}if(!i.noext&&isExtglobType(s)&&t.charAt(h)==="("){e.push(l);l="";const r=new AST(s,e);h=AST.#St(t,r,h,i);e.push(r);continue}l+=s}e.push(l);return h}let h=s+1;let l=new AST(null,e);const c=[];let u="";while(h<t.length){const s=t.charAt(h++);if(r||s==="\\"){r=!r;u+=s;continue}if(n){if(h===o+1){if(s==="^"||s==="!"){a=true}}else if(s==="]"&&!(h===o+2&&a)){n=false}u+=s;continue}else if(s==="["){n=true;o=h;a=false;u+=s;continue}if(isExtglobType(s)&&t.charAt(h)==="("){l.push(u);u="";const e=new AST(s,l);l.push(e);h=AST.#St(t,e,h,i);continue}if(s==="|"){l.push(u);u="";c.push(l);l=new AST(null,e);continue}if(s===")"){if(u===""&&e.#ut.length===0){e.#bt=true}l.push(u);u="";e.push(...c,l);return h}u+=s}e.type=null;e.#lt=undefined;e.#ut=[t.substring(s-1)];return h}static fromGlob(t,e={}){const s=new AST(null,undefined,e);AST.#St(t,s,0,e);return s}toMMPattern(){if(this!==this.#ht)return this.#ht.toMMPattern();const t=this.toString();const[e,s,i,r]=this.toRegExpSource();const n=i||this.#lt||this.#gt.nocase&&!this.#gt.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase();if(!n){return s}const o=(this.#gt.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,o),{_src:e,_glob:t})}get options(){return this.#gt}toRegExpSource(t){const e=t??!!this.#gt.dot;if(this.#ht===this)this.#wt();if(!this.type){const s=this.isStart()&&this.isEnd()&&!this.#ut.some((t=>typeof t!=="string"));const i=this.#ut.map((e=>{const[i,r,n,o]=typeof e==="string"?AST.#vt(e,this.#lt,s):e.toRegExpSource(t);this.#lt=this.#lt||n;this.#ct=this.#ct||o;return i})).join("");let n="";if(this.isStart()){if(typeof this.#ut[0]==="string"){const s=this.#ut.length===1&&l.has(this.#ut[0]);if(!s){const s=h;const r=e&&s.has(i.charAt(0))||i.startsWith("\\.")&&s.has(i.charAt(2))||i.startsWith("\\.\\.")&&s.has(i.charAt(4));const l=!e&&!t&&s.has(i.charAt(0));n=r?o:l?a:""}}}let c="";if(this.isEnd()&&this.#ht.#mt&&this.#ft?.type==="!"){c="(?:$|\\/)"}const u=n+i+c;return[u,(0,r.unescape)(i),this.#lt=!!this.#lt,this.#ct]}const s=this.type==="*"||this.type==="+";const i=this.type==="!"?"(?:(?!(?:":"(?:";let n=this.#Tt(e);if(this.isStart()&&this.isEnd()&&!n&&this.type!=="!"){const t=this.toString();this.#ut=[t];this.type=null;this.#lt=undefined;return[t,(0,r.unescape)(this.toString()),false,false]}let c=!s||t||e||!a?"":this.#Tt(true);if(c===n){c=""}if(c){n=`(?:${n})(?:${c})*?`}let u="";if(this.type==="!"&&this.#bt){u=(this.isStart()&&!e?a:"")+d}else{const s=this.type==="!"?"))"+(this.isStart()&&!e&&!t?a:"")+f+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&c?")":this.type==="*"&&c?`)?`:`)${this.type}`;u=i+n+s}return[u,(0,r.unescape)(n),this.#lt=!!this.#lt,this.#ct]}#Tt(t){return this.#ut.map((e=>{if(typeof e==="string"){throw new Error("string type in extglob ast??")}const[s,i,r,n]=e.toRegExpSource(t);this.#ct=this.#ct||n;return s})).filter((t=>!(this.isStart()&&this.isEnd())||!!t)).join("|")}static#vt(t,e,s=false){let n=false;let o="";let a=false;for(let r=0;r<t.length;r++){const h=t.charAt(r);if(n){n=false;o+=(c.has(h)?"\\":"")+h;continue}if(h==="\\"){if(r===t.length-1){o+="\\\\"}else{n=true}continue}if(h==="["){const[s,n,h,l]=(0,i.parseClass)(t,r);if(h){o+=s;a=a||n;r+=h-1;e=e||l;continue}}if(h==="*"){o+=s&&t==="*"?d:f;e=true;continue}if(h==="?"){o+=u;e=true;continue}o+=regExpEscape(h)}return[o,(0,r.unescape)(t),!!e,a]}}e.AST=AST},694:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.parseClass=void 0;const s={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",true],"[:alpha:]":["\\p{L}\\p{Nl}",true],"[:ascii:]":["\\x"+"00-\\x"+"7f",false],"[:blank:]":["\\p{Zs}\\t",true],"[:cntrl:]":["\\p{Cc}",true],"[:digit:]":["\\p{Nd}",true],"[:graph:]":["\\p{Z}\\p{C}",true,true],"[:lower:]":["\\p{Ll}",true],"[:print:]":["\\p{C}",true],"[:punct:]":["\\p{P}",true],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",true],"[:upper:]":["\\p{Lu}",true],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",true],"[:xdigit:]":["A-Fa-f0-9",false]};const braceEscape=t=>t.replace(/[[\]\\-]/g,"\\$&");const regexpEscape=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");const rangesToString=t=>t.join("");const parseClass=(t,e)=>{const i=e;if(t.charAt(i)!=="["){throw new Error("not in a brace expression")}const r=[];const n=[];let o=i+1;let a=false;let h=false;let l=false;let c=false;let u=i;let f="";t:while(o<t.length){const e=t.charAt(o);if((e==="!"||e==="^")&&o===i+1){c=true;o++;continue}if(e==="]"&&a&&!l){u=o+1;break}a=true;if(e==="\\"){if(!l){l=true;o++;continue}}if(e==="["&&!l){for(const[e,[a,l,c]]of Object.entries(s)){if(t.startsWith(e,o)){if(f){return["$.",false,t.length-i,true]}o+=e.length;if(c)n.push(a);else r.push(a);h=h||l;continue t}}}l=false;if(f){if(e>f){r.push(braceEscape(f)+"-"+braceEscape(e))}else if(e===f){r.push(braceEscape(e))}f="";o++;continue}if(t.startsWith("-]",o+1)){r.push(braceEscape(e+"-"));o+=2;continue}if(t.startsWith("-",o+1)){f=e;o+=2;continue}r.push(braceEscape(e));o++}if(u<o){return["",false,0,false]}if(!r.length&&!n.length){return["$.",false,t.length-i,true]}if(n.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!c){const t=r[0].length===2?r[0].slice(-1):r[0];return[regexpEscape(t),false,u-i,false]}const d="["+(c?"^":"")+rangesToString(r)+"]";const p="["+(c?"":"^")+rangesToString(n)+"]";const g=r.length&&n.length?"("+d+"|"+p+")":r.length?d:p;return[g,h,u-i,true]};e.parseClass=parseClass},516:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.escape=void 0;const escape=(t,{windowsPathsNoEscape:e=false,magicalBraces:s=false}={})=>{if(s){return e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&")}return e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")};e.escape=escape},647:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:true});e.unescape=e.escape=e.AST=e.Minimatch=e.match=e.makeRe=e.braceExpand=e.defaults=e.filter=e.GLOBSTAR=e.sep=e.minimatch=void 0;const i=s(339);const r=s(557);const n=s(743);const o=s(516);const a=s(967);const minimatch=(t,e,s={})=>{(0,r.assertValidPattern)(e);if(!s.nocomment&&e.charAt(0)==="#"){return false}return new Minimatch(e,s).match(t)};e.minimatch=minimatch;const h=/^\*+([^+@!?\*\[\(]*)$/;const starDotExtTest=t=>e=>!e.startsWith(".")&&e.endsWith(t);const starDotExtTestDot=t=>e=>e.endsWith(t);const starDotExtTestNocase=t=>{t=t.toLowerCase();return e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)};const starDotExtTestNocaseDot=t=>{t=t.toLowerCase();return e=>e.toLowerCase().endsWith(t)};const l=/^\*+\.\*+$/;const starDotStarTest=t=>!t.startsWith(".")&&t.includes(".");const starDotStarTestDot=t=>t!=="."&&t!==".."&&t.includes(".");const c=/^\.\*+$/;const dotStarTest=t=>t!=="."&&t!==".."&&t.startsWith(".");const u=/^\*+$/;const starTest=t=>t.length!==0&&!t.startsWith(".");const starTestDot=t=>t.length!==0&&t!=="."&&t!=="..";const f=/^\?+([^+@!?\*\[\(]*)?$/;const qmarksTestNocase=([t,e=""])=>{const s=qmarksTestNoExt([t]);if(!e)return s;e=e.toLowerCase();return t=>s(t)&&t.toLowerCase().endsWith(e)};const qmarksTestNocaseDot=([t,e=""])=>{const s=qmarksTestNoExtDot([t]);if(!e)return s;e=e.toLowerCase();return t=>s(t)&&t.toLowerCase().endsWith(e)};const qmarksTestDot=([t,e=""])=>{const s=qmarksTestNoExtDot([t]);return!e?s:t=>s(t)&&t.endsWith(e)};const qmarksTest=([t,e=""])=>{const s=qmarksTestNoExt([t]);return!e?s:t=>s(t)&&t.endsWith(e)};const qmarksTestNoExt=([t])=>{const e=t.length;return t=>t.length===e&&!t.startsWith(".")};const qmarksTestNoExtDot=([t])=>{const e=t.length;return t=>t.length===e&&t!=="."&&t!==".."};const d=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";const p={win32:{sep:"\\"},posix:{sep:"/"}};e.sep=d==="win32"?p.win32.sep:p.posix.sep;e.minimatch.sep=e.sep;e.GLOBSTAR=Symbol("globstar **");e.minimatch.GLOBSTAR=e.GLOBSTAR;const g="[^/]";const y=g+"*?";const b="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";const w="(?:(?!(?:\\/|^)\\.).)*?";const filter=(t,s={})=>i=>(0,e.minimatch)(i,t,s);e.filter=filter;e.minimatch.filter=e.filter;const ext=(t,e={})=>Object.assign({},t,e);const defaults=t=>{if(!t||typeof t!=="object"||!Object.keys(t).length){return e.minimatch}const s=e.minimatch;const m=(e,i,r={})=>s(e,i,ext(t,r));return Object.assign(m,{Minimatch:class Minimatch extends s.Minimatch{constructor(e,s={}){super(e,ext(t,s))}static defaults(e){return s.defaults(ext(t,e)).Minimatch}},AST:class AST extends s.AST{constructor(e,s,i={}){super(e,s,ext(t,i))}static fromGlob(e,i={}){return s.AST.fromGlob(e,ext(t,i))}},unescape:(e,i={})=>s.unescape(e,ext(t,i)),escape:(e,i={})=>s.escape(e,ext(t,i)),filter:(e,i={})=>s.filter(e,ext(t,i)),defaults:e=>s.defaults(ext(t,e)),makeRe:(e,i={})=>s.makeRe(e,ext(t,i)),braceExpand:(e,i={})=>s.braceExpand(e,ext(t,i)),match:(e,i,r={})=>s.match(e,i,ext(t,r)),sep:s.sep,GLOBSTAR:e.GLOBSTAR})};e.defaults=defaults;e.minimatch.defaults=e.defaults;const braceExpand=(t,e={})=>{(0,r.assertValidPattern)(t);if(e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)){return[t]}return(0,i.expand)(t)};e.braceExpand=braceExpand;e.minimatch.braceExpand=e.braceExpand;const makeRe=(t,e={})=>new Minimatch(t,e).makeRe();e.makeRe=makeRe;e.minimatch.makeRe=e.makeRe;const match=(t,e,s={})=>{const i=new Minimatch(e,s);t=t.filter((t=>i.match(t)));if(i.options.nonull&&!t.length){t.push(e)}return t};e.match=match;e.minimatch.match=e.match;const S=/[?*]|[+@!]\(.*?\)|\[|\]/;const regExpEscape=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class Minimatch{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){(0,r.assertValidPattern)(t);e=e||{};this.options=e;this.pattern=t;this.platform=e.platform||d;this.isWindows=this.platform==="win32";this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===false;if(this.windowsPathsNoEscape){this.pattern=this.pattern.replace(/\\/g,"/")}this.preserveMultipleSlashes=!!e.preserveMultipleSlashes;this.regexp=null;this.negate=false;this.nonegate=!!e.nonegate;this.comment=false;this.empty=false;this.partial=!!e.partial;this.nocase=!!this.options.nocase;this.windowsNoMagicRoot=e.windowsNoMagicRoot!==undefined?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase);this.globSet=[];this.globParts=[];this.set=[];this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1){return true}for(const t of this.set){for(const e of t){if(typeof e!=="string")return true}}return false}debug(...t){}make(){const t=this.pattern;const e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=true;return}if(!t){this.empty=true;return}this.parseNegate();this.globSet=[...new Set(this.braceExpand())];if(e.debug){this.debug=(...t)=>console.error(...t)}this.debug(this.pattern,this.globSet);const s=this.globSet.map((t=>this.slashSplit(t)));this.globParts=this.preprocess(s);this.debug(this.pattern,this.globParts);let i=this.globParts.map(((t,e,s)=>{if(this.isWindows&&this.windowsNoMagicRoot){const e=t[0]===""&&t[1]===""&&(t[2]==="?"||!S.test(t[2]))&&!S.test(t[3]);const s=/^[a-z]:/i.test(t[0]);if(e){return[...t.slice(0,4),...t.slice(4).map((t=>this.parse(t)))]}else if(s){return[t[0],...t.slice(1).map((t=>this.parse(t)))]}}return t.map((t=>this.parse(t)))}));this.debug(this.pattern,i);this.set=i.filter((t=>t.indexOf(false)===-1));if(this.isWindows){for(let t=0;t<this.set.length;t++){const e=this.set[t];if(e[0]===""&&e[1]===""&&this.globParts[t][2]==="?"&&typeof e[3]==="string"&&/^[a-z]:$/i.test(e[3])){e[2]="?"}}}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar){for(let e=0;e<t.length;e++){for(let s=0;s<t[e].length;s++){if(t[e][s]==="**"){t[e][s]="*"}}}}const{optimizationLevel:e=1}=this.options;if(e>=2){t=this.firstPhasePreProcess(t);t=this.secondPhasePreProcess(t)}else if(e>=1){t=this.levelOneOptimize(t)}else{t=this.adjascentGlobstarOptimize(t)}return t}adjascentGlobstarOptimize(t){return t.map((t=>{let e=-1;while(-1!==(e=t.indexOf("**",e+1))){let s=e;while(t[s+1]==="**"){s++}if(s!==e){t.splice(e,s-e)}}return t}))}levelOneOptimize(t){return t.map((t=>{t=t.reduce(((t,e)=>{const s=t[t.length-1];if(e==="**"&&s==="**"){return t}if(e===".."){if(s&&s!==".."&&s!=="."&&s!=="**"){t.pop();return t}}t.push(e);return t}),[]);return t.length===0?[""]:t}))}levelTwoFileOptimize(t){if(!Array.isArray(t)){t=this.slashSplit(t)}let e=false;do{e=false;if(!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){const i=t[s];if(s===1&&i===""&&t[0]==="")continue;if(i==="."||i===""){e=true;t.splice(s,1);s--}}if(t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")){e=true;t.pop()}}let s=0;while(-1!==(s=t.indexOf("..",s+1))){const i=t[s-1];if(i&&i!=="."&&i!==".."&&i!=="**"){e=true;t.splice(s-1,2);s-=2}}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=false;do{e=false;for(let s of t){let i=-1;while(-1!==(i=s.indexOf("**",i+1))){let r=i;while(s[r+1]==="**"){r++}if(r>i){s.splice(i+1,r-i)}let n=s[i+1];const o=s[i+2];const a=s[i+3];if(n!=="..")continue;if(!o||o==="."||o===".."||!a||a==="."||a===".."){continue}e=true;s.splice(i,1);const h=s.slice(0);h[i]="**";t.push(h);i--}if(!this.preserveMultipleSlashes){for(let t=1;t<s.length-1;t++){const i=s[t];if(t===1&&i===""&&s[0]==="")continue;if(i==="."||i===""){e=true;s.splice(t,1);t--}}if(s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")){e=true;s.pop()}}let r=0;while(-1!==(r=s.indexOf("..",r+1))){const t=s[r-1];if(t&&t!=="."&&t!==".."&&t!=="**"){e=true;const t=r===1&&s[r+1]==="**";const i=t?["."]:[];s.splice(r-1,2,...i);if(s.length===0)s.push("");r-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++){for(let s=e+1;s<t.length;s++){const i=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(i){t[e]=[];t[s]=i;break}}}return t.filter((t=>t.length))}partsMatch(t,e,s=false){let i=0;let r=0;let n=[];let o="";while(i<t.length&&r<e.length){if(t[i]===e[r]){n.push(o==="b"?e[r]:t[i]);i++;r++}else if(s&&t[i]==="**"&&e[r]===t[i+1]){n.push(t[i]);i++}else if(s&&e[r]==="**"&&t[i]===e[r+1]){n.push(e[r]);r++}else if(t[i]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(o==="b")return false;o="a";n.push(t[i]);i++;r++}else if(e[r]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(o==="a")return false;o="b";n.push(e[r]);i++;r++}else{return false}}return t.length===e.length&&n}parseNegate(){if(this.nonegate)return;const t=this.pattern;let e=false;let s=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++){e=!e;s++}if(s)this.pattern=t.slice(s);this.negate=e}matchOne(t,s,i=false){const r=this.options;if(this.isWindows){const e=typeof t[0]==="string"&&/^[a-z]:$/i.test(t[0]);const i=!e&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]);const r=typeof s[0]==="string"&&/^[a-z]:$/i.test(s[0]);const n=!r&&s[0]===""&&s[1]===""&&s[2]==="?"&&typeof s[3]==="string"&&/^[a-z]:$/i.test(s[3]);const o=i?3:e?0:undefined;const a=n?3:r?0:undefined;if(typeof o==="number"&&typeof a==="number"){const[e,i]=[t[o],s[a]];if(e.toLowerCase()===i.toLowerCase()){s[a]=e;if(a>o){s=s.slice(a)}else if(o>a){t=t.slice(o)}}}}const{optimizationLevel:n=1}=this.options;if(n>=2){t=this.levelTwoFileOptimize(t)}this.debug("matchOne",this,{file:t,pattern:s});this.debug("matchOne",t.length,s.length);for(var o=0,a=0,h=t.length,l=s.length;o<h&&a<l;o++,a++){this.debug("matchOne loop");var c=s[a];var u=t[o];this.debug(s,c,u);if(c===false){return false}if(c===e.GLOBSTAR){this.debug("GLOBSTAR",[s,c,u]);var f=o;var d=a+1;if(d===l){this.debug("** at the end");for(;o<h;o++){if(t[o]==="."||t[o]===".."||!r.dot&&t[o].charAt(0)===".")return false}return true}while(f<h){var p=t[f];this.debug("\nglobstar while",t,f,s,d,p);if(this.matchOne(t.slice(f),s.slice(d),i)){this.debug("globstar found match!",f,h,p);return true}else{if(p==="."||p===".."||!r.dot&&p.charAt(0)==="."){this.debug("dot detected!",t,f,s,d);break}this.debug("globstar swallow a segment, and continue");f++}}if(i){this.debug("\n>>> no match, partial?",t,f,s,d);if(f===h){return true}}return false}let n;if(typeof c==="string"){n=u===c;this.debug("string match",c,u,n)}else{n=c.test(u);this.debug("pattern match",c,u,n)}if(!n)return false}if(o===h&&a===l){return true}else if(o===h){return i}else if(a===l){return o===h-1&&t[o]===""}else{throw new Error("wtf?")}}braceExpand(){return(0,e.braceExpand)(this.pattern,this.options)}parse(t){(0,r.assertValidPattern)(t);const s=this.options;if(t==="**")return e.GLOBSTAR;if(t==="")return"";let i;let o=null;if(i=t.match(u)){o=s.dot?starTestDot:starTest}else if(i=t.match(h)){o=(s.nocase?s.dot?starDotExtTestNocaseDot:starDotExtTestNocase:s.dot?starDotExtTestDot:starDotExtTest)(i[1])}else if(i=t.match(f)){o=(s.nocase?s.dot?qmarksTestNocaseDot:qmarksTestNocase:s.dot?qmarksTestDot:qmarksTest)(i)}else if(i=t.match(l)){o=s.dot?starDotStarTestDot:starDotStarTest}else if(i=t.match(c)){o=dotStarTest}const a=n.AST.fromGlob(t,this.options).toMMPattern();if(o&&typeof a==="object"){Reflect.defineProperty(a,"test",{value:o})}return a}makeRe(){if(this.regexp||this.regexp===false)return this.regexp;const t=this.set;if(!t.length){this.regexp=false;return this.regexp}const s=this.options;const i=s.noglobstar?y:s.dot?b:w;const r=new Set(s.nocase?["i"]:[]);let n=t.map((t=>{const s=t.map((t=>{if(t instanceof RegExp){for(const e of t.flags.split(""))r.add(e)}return typeof t==="string"?regExpEscape(t):t===e.GLOBSTAR?e.GLOBSTAR:t._src}));s.forEach(((t,r)=>{const n=s[r+1];const o=s[r-1];if(t!==e.GLOBSTAR||o===e.GLOBSTAR){return}if(o===undefined){if(n!==undefined&&n!==e.GLOBSTAR){s[r+1]="(?:\\/|"+i+"\\/)?"+n}else{s[r]=i}}else if(n===undefined){s[r-1]=o+"(?:\\/|\\/"+i+")?"}else if(n!==e.GLOBSTAR){s[r-1]=o+"(?:\\/|\\/"+i+"\\/)"+n;s[r+1]=e.GLOBSTAR}}));const n=s.filter((t=>t!==e.GLOBSTAR));if(this.partial&&n.length>=1){const t=[];for(let e=1;e<=n.length;e++){t.push(n.slice(0,e).join("/"))}return"(?:"+t.join("|")+")"}return n.join("/")})).join("|");const[o,a]=t.length>1?["(?:",")"]:["",""];n="^"+o+n+a+"$";if(this.partial){n="^(?:\\/|"+o+n.slice(1,-1)+a+")$"}if(this.negate)n="^(?!"+n+").+$";try{this.regexp=new RegExp(n,[...r].join(""))}catch(t){this.regexp=false}return this.regexp}slashSplit(t){if(this.preserveMultipleSlashes){return t.split("/")}else if(this.isWindows&&/^\/\/[^\/]+/.test(t)){return["",...t.split(/\/+/)]}else{return t.split(/\/+/)}}match(t,e=this.partial){this.debug("match",t,this.pattern);if(this.comment){return false}if(this.empty){return t===""}if(t==="/"&&e){return true}const s=this.options;if(this.isWindows){t=t.split("\\").join("/")}const i=this.slashSplit(t);this.debug(this.pattern,"split",i);const r=this.set;this.debug(this.pattern,"set",r);let n=i[i.length-1];if(!n){for(let t=i.length-2;!n&&t>=0;t--){n=i[t]}}for(let t=0;t<r.length;t++){const o=r[t];let a=i;if(s.matchBase&&o.length===1){a=[n]}const h=this.matchOne(a,o,e);if(h){if(s.flipNegate){return true}return!this.negate}}if(s.flipNegate){return false}return this.negate}static defaults(t){return e.minimatch.defaults(t).Minimatch}}e.Minimatch=Minimatch;var v=s(743);Object.defineProperty(e,"AST",{enumerable:true,get:function(){return v.AST}});var T=s(516);Object.defineProperty(e,"escape",{enumerable:true,get:function(){return T.escape}});var k=s(967);Object.defineProperty(e,"unescape",{enumerable:true,get:function(){return k.unescape}});e.minimatch.AST=n.AST;e.minimatch.Minimatch=Minimatch;e.minimatch.escape=o.escape;e.minimatch.unescape=a.unescape},967:(t,e)=>{Object.defineProperty(e,"__esModule",{value:true});e.unescape=void 0;const unescape=(t,{windowsPathsNoEscape:e=false,magicalBraces:s=true}={})=>{if(s){return e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")}return e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")};e.unescape=unescape},31:function(t,e,s){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:true});e.Minipass=e.isWritable=e.isReadable=e.isStream=void 0;const r=typeof process==="object"&&process?process:{stdout:null,stderr:null};const n=s(474);const o=i(s(75));const a=s(193);const isStream=t=>!!t&&typeof t==="object"&&(t instanceof Minipass||t instanceof o.default||(0,e.isReadable)(t)||(0,e.isWritable)(t));e.isStream=isStream;const isReadable=t=>!!t&&typeof t==="object"&&t instanceof n.EventEmitter&&typeof t.pipe==="function"&&t.pipe!==o.default.Writable.prototype.pipe;e.isReadable=isReadable;const isWritable=t=>!!t&&typeof t==="object"&&t instanceof n.EventEmitter&&typeof t.write==="function"&&typeof t.end==="function";e.isWritable=isWritable;const h=Symbol("EOF");const l=Symbol("maybeEmitEnd");const c=Symbol("emittedEnd");const u=Symbol("emittingEnd");const f=Symbol("emittedError");const d=Symbol("closed");const p=Symbol("read");const g=Symbol("flush");const y=Symbol("flushChunk");const b=Symbol("encoding");const w=Symbol("decoder");const S=Symbol("flowing");const v=Symbol("paused");const T=Symbol("resume");const k=Symbol("buffer");const x=Symbol("pipes");const E=Symbol("bufferLength");const _=Symbol("bufferPush");const C=Symbol("bufferShift");const R=Symbol("objectMode");const P=Symbol("destroyed");const A=Symbol("error");const O=Symbol("emitData");const L=Symbol("emitEnd");const I=Symbol("emitEnd2");const M=Symbol("async");const U=Symbol("abort");const B=Symbol("aborted");const F=Symbol("signal");const N=Symbol("dataListeners");const j=Symbol("discarded");const defer=t=>Promise.resolve().then(t);const nodefer=t=>t();const isEndish=t=>t==="end"||t==="finish"||t==="prefinish";const isArrayBufferLike=t=>t instanceof ArrayBuffer||!!t&&typeof t==="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0;const isArrayBufferView=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t);class Pipe{src;dest;opts;ondrain;constructor(t,e,s){this.src=t;this.dest=e;this.opts=s;this.ondrain=()=>t[T]();this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe();if(this.opts.end)this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener("error",this.proxyErrors);super.unpipe()}constructor(t,e,s){super(t,e,s);this.proxyErrors=t=>e.emit("error",t);t.on("error",this.proxyErrors)}}const isObjectModeOptions=t=>!!t.objectMode;const isEncodingOptions=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer";class Minipass extends n.EventEmitter{[S]=false;[v]=false;[x]=[];[k]=[];[R];[b];[M];[w];[h]=false;[c]=false;[u]=false;[d]=false;[f]=null;[E]=0;[P]=false;[F];[B]=false;[N]=0;[j]=false;writable=true;readable=true;constructor(...t){const e=t[0]||{};super();if(e.objectMode&&typeof e.encoding==="string"){throw new TypeError("Encoding and objectMode may not be used together")}if(isObjectModeOptions(e)){this[R]=true;this[b]=null}else if(isEncodingOptions(e)){this[b]=e.encoding;this[R]=false}else{this[R]=false;this[b]=null}this[M]=!!e.async;this[w]=this[b]?new a.StringDecoder(this[b]):null;if(e&&e.debugExposeBuffer===true){Object.defineProperty(this,"buffer",{get:()=>this[k]})}if(e&&e.debugExposePipes===true){Object.defineProperty(this,"pipes",{get:()=>this[x]})}const{signal:s}=e;if(s){this[F]=s;if(s.aborted){this[U]()}else{s.addEventListener("abort",(()=>this[U]()))}}}get bufferLength(){return this[E]}get encoding(){return this[b]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[R]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[M]}set["async"](t){this[M]=this[M]||!!t}[U](){this[B]=true;this.emit("abort",this[F]?.reason);this.destroy(this[F]?.reason)}get aborted(){return this[B]}set aborted(t){}write(t,e,s){if(this[B])return false;if(this[h])throw new Error("write after end");if(this[P]){this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"}));return true}if(typeof e==="function"){s=e;e="utf8"}if(!e)e="utf8";const i=this[M]?defer:nodefer;if(!this[R]&&!Buffer.isBuffer(t)){if(isArrayBufferView(t)){t=Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(isArrayBufferLike(t)){t=Buffer.from(t)}else if(typeof t!=="string"){throw new Error("Non-contiguous data written to non-objectMode stream")}}if(this[R]){if(this[S]&&this[E]!==0)this[g](true);if(this[S])this.emit("data",t);else this[_](t);if(this[E]!==0)this.emit("readable");if(s)i(s);return this[S]}if(!t.length){if(this[E]!==0)this.emit("readable");if(s)i(s);return this[S]}if(typeof t==="string"&&!(e===this[b]&&!this[w]?.lastNeed)){t=Buffer.from(t,e)}if(Buffer.isBuffer(t)&&this[b]){t=this[w].write(t)}if(this[S]&&this[E]!==0)this[g](true);if(this[S])this.emit("data",t);else this[_](t);if(this[E]!==0)this.emit("readable");if(s)i(s);return this[S]}read(t){if(this[P])return null;this[j]=false;if(this[E]===0||t===0||t&&t>this[E]){this[l]();return null}if(this[R])t=null;if(this[k].length>1&&!this[R]){this[k]=[this[b]?this[k].join(""):Buffer.concat(this[k],this[E])]}const e=this[p](t||null,this[k][0]);this[l]();return e}[p](t,e){if(this[R])this[C]();else{const s=e;if(t===s.length||t===null)this[C]();else if(typeof s==="string"){this[k][0]=s.slice(t);e=s.slice(0,t);this[E]-=t}else{this[k][0]=s.subarray(t);e=s.subarray(0,t);this[E]-=t}}this.emit("data",e);if(!this[k].length&&!this[h])this.emit("drain");return e}end(t,e,s){if(typeof t==="function"){s=t;t=undefined}if(typeof e==="function"){s=e;e="utf8"}if(t!==undefined)this.write(t,e);if(s)this.once("end",s);this[h]=true;this.writable=false;if(this[S]||!this[v])this[l]();return this}[T](){if(this[P])return;if(!this[N]&&!this[x].length){this[j]=true}this[v]=false;this[S]=true;this.emit("resume");if(this[k].length)this[g]();else if(this[h])this[l]();else this.emit("drain")}resume(){return this[T]()}pause(){this[S]=false;this[v]=true;this[j]=false}get destroyed(){return this[P]}get flowing(){return this[S]}get paused(){return this[v]}[_](t){if(this[R])this[E]+=1;else this[E]+=t.length;this[k].push(t)}[C](){if(this[R])this[E]-=1;else this[E]-=this[k][0].length;return this[k].shift()}[g](t=false){do{}while(this[y](this[C]())&&this[k].length);if(!t&&!this[k].length&&!this[h])this.emit("drain")}[y](t){this.emit("data",t);return this[S]}pipe(t,e){if(this[P])return t;this[j]=false;const s=this[c];e=e||{};if(t===r.stdout||t===r.stderr)e.end=false;else e.end=e.end!==false;e.proxyErrors=!!e.proxyErrors;if(s){if(e.end)t.end()}else{this[x].push(!e.proxyErrors?new Pipe(this,t,e):new PipeProxyErrors(this,t,e));if(this[M])defer((()=>this[T]()));else this[T]()}return t}unpipe(t){const e=this[x].find((e=>e.dest===t));if(e){if(this[x].length===1){if(this[S]&&this[N]===0){this[S]=false}this[x]=[]}else this[x].splice(this[x].indexOf(e),1);e.unpipe()}}addListener(t,e){return this.on(t,e)}on(t,e){const s=super.on(t,e);if(t==="data"){this[j]=false;this[N]++;if(!this[x].length&&!this[S]){this[T]()}}else if(t==="readable"&&this[E]!==0){super.emit("readable")}else if(isEndish(t)&&this[c]){super.emit(t);this.removeAllListeners(t)}else if(t==="error"&&this[f]){const t=e;if(this[M])defer((()=>t.call(this,this[f])));else t.call(this,this[f])}return s}removeListener(t,e){return this.off(t,e)}off(t,e){const s=super.off(t,e);if(t==="data"){this[N]=this.listeners("data").length;if(this[N]===0&&!this[j]&&!this[x].length){this[S]=false}}return s}removeAllListeners(t){const e=super.removeAllListeners(t);if(t==="data"||t===undefined){this[N]=0;if(!this[j]&&!this[x].length){this[S]=false}}return e}get emittedEnd(){return this[c]}[l](){if(!this[u]&&!this[c]&&!this[P]&&this[k].length===0&&this[h]){this[u]=true;this.emit("end");this.emit("prefinish");this.emit("finish");if(this[d])this.emit("close");this[u]=false}}emit(t,...e){const s=e[0];if(t!=="error"&&t!=="close"&&t!==P&&this[P]){return false}else if(t==="data"){return!this[R]&&!s?false:this[M]?(defer((()=>this[O](s))),true):this[O](s)}else if(t==="end"){return this[L]()}else if(t==="close"){this[d]=true;if(!this[c]&&!this[P])return false;const t=super.emit("close");this.removeAllListeners("close");return t}else if(t==="error"){this[f]=s;super.emit(A,s);const t=!this[F]||this.listeners("error").length?super.emit("error",s):false;this[l]();return t}else if(t==="resume"){const t=super.emit("resume");this[l]();return t}else if(t==="finish"||t==="prefinish"){const e=super.emit(t);this.removeAllListeners(t);return e}const i=super.emit(t,...e);this[l]();return i}[O](t){for(const e of this[x]){if(e.dest.write(t)===false)this.pause()}const e=this[j]?false:super.emit("data",t);this[l]();return e}[L](){if(this[c])return false;this[c]=true;this.readable=false;return this[M]?(defer((()=>this[I]())),true):this[I]()}[I](){if(this[w]){const t=this[w].end();if(t){for(const e of this[x]){e.dest.write(t)}if(!this[j])super.emit("data",t)}}for(const t of this[x]){t.end()}const t=super.emit("end");this.removeAllListeners("end");return t}async collect(){const t=Object.assign([],{dataLength:0});if(!this[R])t.dataLength=0;const e=this.promise();this.on("data",(e=>{t.push(e);if(!this[R])t.dataLength+=e.length}));await e;return t}async concat(){if(this[R]){throw new Error("cannot concat in objectMode")}const t=await this.collect();return this[b]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,e)=>{this.on(P,(()=>e(new Error("stream destroyed"))));this.on("error",(t=>e(t)));this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[j]=false;let t=false;const stop=async()=>{this.pause();t=true;return{value:undefined,done:true}};const next=()=>{if(t)return stop();const e=this.read();if(e!==null)return Promise.resolve({done:false,value:e});if(this[h])return stop();let s;let i;const onerr=t=>{this.off("data",ondata);this.off("end",onend);this.off(P,ondestroy);stop();i(t)};const ondata=t=>{this.off("error",onerr);this.off("end",onend);this.off(P,ondestroy);this.pause();s({value:t,done:!!this[h]})};const onend=()=>{this.off("error",onerr);this.off("data",ondata);this.off(P,ondestroy);stop();s({done:true,value:undefined})};const ondestroy=()=>onerr(new Error("stream destroyed"));return new Promise(((t,e)=>{i=e;s=t;this.once(P,ondestroy);this.once("error",onerr);this.once("end",onend);this.once("data",ondata)}))};return{next:next,throw:stop,return:stop,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[j]=false;let t=false;const stop=()=>{this.pause();this.off(A,stop);this.off(P,stop);this.off("end",stop);t=true;return{done:true,value:undefined}};const next=()=>{if(t)return stop();const e=this.read();return e===null?stop():{done:false,value:e}};this.once("end",stop);this.once(A,stop);this.once(P,stop);return{next:next,throw:stop,return:stop,[Symbol.iterator](){return this}}}destroy(t){if(this[P]){if(t)this.emit("error",t);else this.emit(P);return this}this[P]=true;this[j]=true;this[k].length=0;this[E]=0;const e=this;if(typeof e.close==="function"&&!this[d])e.close();if(t)this.emit("error",t);else this.emit(P);return this}static get isStream(){return e.isStream}}e.Minipass=Minipass},125:function(t,e,s){var i=this&&this.__createBinding||(Object.create?function(t,e,s,i){if(i===undefined)i=s;var r=Object.getOwnPropertyDescriptor(e,s);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[s]}}}Object.defineProperty(t,i,r)}:function(t,e,s,i){if(i===undefined)i=s;t[i]=e[s]});var r=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var s in t)if(s!=="default"&&Object.prototype.hasOwnProperty.call(t,s))i(e,t,s);r(e,t);return e};Object.defineProperty(e,"__esModule",{value:true});e.PathScurry=e.Path=e.PathScurryDarwin=e.PathScurryPosix=e.PathScurryWin32=e.PathScurryBase=e.PathPosix=e.PathWin32=e.PathBase=e.ChildrenCache=e.ResolveCache=void 0;const o=s(481);const a=s(760);const h=s(136);const l=s(896);const c=n(s(24));const u=l.realpathSync.native;const f=s(455);const d=s(31);const p={lstatSync:l.lstatSync,readdir:l.readdir,readdirSync:l.readdirSync,readlinkSync:l.readlinkSync,realpathSync:u,promises:{lstat:f.lstat,readdir:f.readdir,readlink:f.readlink,realpath:f.realpath}};const fsFromOption=t=>!t||t===p||t===c?p:{...p,...t,promises:{...p.promises,...t.promises||{}}};const g=/^\\\\\?\\([a-z]:)\\?$/i;const uncToDrive=t=>t.replace(/\//g,"\\").replace(g,"$1\\");const y=/[\\\/]/;const b=0;const w=1;const S=2;const v=4;const T=6;const k=8;const x=10;const E=12;const _=15;const C=~_;const R=16;const P=32;const A=64;const O=128;const L=256;const I=512;const M=A|O|I;const U=1023;const entToType=t=>t.isFile()?k:t.isDirectory()?v:t.isSymbolicLink()?x:t.isCharacterDevice()?S:t.isBlockDevice()?T:t.isSocket()?E:t.isFIFO()?w:b;const B=new o.LRUCache({max:2**12});const normalize=t=>{const e=B.get(t);if(e)return e;const s=t.normalize("NFKD");B.set(t,s);return s};const F=new o.LRUCache({max:2**12});const normalizeNocase=t=>{const e=F.get(t);if(e)return e;const s=normalize(t.toLowerCase());F.set(t,s);return s};class ResolveCache extends o.LRUCache{constructor(){super({max:256})}}e.ResolveCache=ResolveCache;class ChildrenCache extends o.LRUCache{constructor(t=16*1024){super({maxSize:t,sizeCalculation:t=>t.length+1})}}e.ChildrenCache=ChildrenCache;const N=Symbol("PathScurry setAsCwd");class PathBase{name;root;roots;parent;nocase;isCWD=false;#kt;#xt;get dev(){return this.#xt}#Et;get mode(){return this.#Et}#_t;get nlink(){return this.#_t}#Ct;get uid(){return this.#Ct}#Rt;get gid(){return this.#Rt}#Pt;get rdev(){return this.#Pt}#At;get blksize(){return this.#At}#Ot;get ino(){return this.#Ot}#x;get size(){return this.#x}#Lt;get blocks(){return this.#Lt}#It;get atimeMs(){return this.#It}#Mt;get mtimeMs(){return this.#Mt}#Ut;get ctimeMs(){return this.#Ut}#Bt;get birthtimeMs(){return this.#Bt}#Ft;get atime(){return this.#Ft}#Nt;get mtime(){return this.#Nt}#jt;get ctime(){return this.#jt}#Dt;get birthtime(){return this.#Dt}#zt;#Wt;#Gt;#$t;#Ht;#qt;#Kt;#Vt;#Yt;#Jt;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=b,s,i,r,n,o){this.name=t;this.#zt=r?normalizeNocase(t):normalize(t);this.#Kt=e&U;this.nocase=r;this.roots=i;this.root=s||this;this.#Vt=n;this.#Gt=o.fullpath;this.#Ht=o.relative;this.#qt=o.relativePosix;this.parent=o.parent;if(this.parent){this.#kt=this.parent.#kt}else{this.#kt=fsFromOption(o.fs)}}depth(){if(this.#Wt!==undefined)return this.#Wt;if(!this.parent)return this.#Wt=0;return this.#Wt=this.parent.depth()+1}childrenCache(){return this.#Vt}resolve(t){if(!t){return this}const e=this.getRootString(t);const s=t.substring(e.length);const i=s.split(this.splitSep);const r=e?this.getRoot(e).#Zt(i):this.#Zt(i);return r}#Zt(t){let e=this;for(const s of t){e=e.child(s)}return e}children(){const t=this.#Vt.get(this);if(t){return t}const e=Object.assign([],{provisional:0});this.#Vt.set(this,e);this.#Kt&=~R;return e}child(t,e){if(t===""||t==="."){return this}if(t===".."){return this.parent||this}const s=this.children();const i=this.nocase?normalizeNocase(t):normalize(t);for(const t of s){if(t.#zt===i){return t}}const r=this.parent?this.sep:"";const n=this.#Gt?this.#Gt+r+t:undefined;const o=this.newChild(t,b,{...e,parent:this,fullpath:n});if(!this.canReaddir()){o.#Kt|=O}s.push(o);return o}relative(){if(this.isCWD)return"";if(this.#Ht!==undefined){return this.#Ht}const t=this.name;const e=this.parent;if(!e){return this.#Ht=this.name}const s=e.relative();return s+(!s||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#qt!==undefined)return this.#qt;const t=this.name;const e=this.parent;if(!e){return this.#qt=this.fullpathPosix()}const s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(this.#Gt!==undefined){return this.#Gt}const t=this.name;const e=this.parent;if(!e){return this.#Gt=this.name}const s=e.fullpath();const i=s+(!e.parent?"":this.sep)+t;return this.#Gt=i}fullpathPosix(){if(this.#$t!==undefined)return this.#$t;if(this.sep==="/")return this.#$t=this.fullpath();if(!this.parent){const t=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(t)){return this.#$t=`//?/${t}`}else{return this.#$t=t}}const t=this.parent;const e=t.fullpathPosix();const s=e+(!e||!t.parent?"":"/")+this.name;return this.#$t=s}isUnknown(){return(this.#Kt&_)===b}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#Kt&_)===k}isDirectory(){return(this.#Kt&_)===v}isCharacterDevice(){return(this.#Kt&_)===S}isBlockDevice(){return(this.#Kt&_)===T}isFIFO(){return(this.#Kt&_)===w}isSocket(){return(this.#Kt&_)===E}isSymbolicLink(){return(this.#Kt&x)===x}lstatCached(){return this.#Kt&P?this:undefined}readlinkCached(){return this.#Yt}realpathCached(){return this.#Jt}readdirCached(){const t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#Yt)return true;if(!this.parent)return false;const t=this.#Kt&_;return!(t!==b&&t!==x||this.#Kt&L||this.#Kt&O)}calledReaddir(){return!!(this.#Kt&R)}isENOENT(){return!!(this.#Kt&O)}isNamed(t){return!this.nocase?this.#zt===normalize(t):this.#zt===normalizeNocase(t)}async readlink(){const t=this.#Yt;if(t){return t}if(!this.canReadlink()){return undefined}if(!this.parent){return undefined}try{const t=await this.#kt.promises.readlink(this.fullpath());const e=(await this.parent.realpath())?.resolve(t);if(e){return this.#Yt=e}}catch(t){this.#Xt(t.code);return undefined}}readlinkSync(){const t=this.#Yt;if(t){return t}if(!this.canReadlink()){return undefined}if(!this.parent){return undefined}try{const t=this.#kt.readlinkSync(this.fullpath());const e=this.parent.realpathSync()?.resolve(t);if(e){return this.#Yt=e}}catch(t){this.#Xt(t.code);return undefined}}#Qt(t){this.#Kt|=R;for(let e=t.provisional;e<t.length;e++){const s=t[e];if(s)s.#te()}}#te(){if(this.#Kt&O)return;this.#Kt=(this.#Kt|O)&C;this.#ee()}#ee(){const t=this.children();t.provisional=0;for(const e of t){e.#te()}}#se(){this.#Kt|=I;this.#ie()}#ie(){if(this.#Kt&A)return;let t=this.#Kt;if((t&_)===v)t&=C;this.#Kt=t|A;this.#ee()}#re(t=""){if(t==="ENOTDIR"||t==="EPERM"){this.#ie()}else if(t==="ENOENT"){this.#te()}else{this.children().provisional=0}}#ne(t=""){if(t==="ENOTDIR"){const t=this.parent;t.#ie()}else if(t==="ENOENT"){this.#te()}}#Xt(t=""){let e=this.#Kt;e|=L;if(t==="ENOENT")e|=O;if(t==="EINVAL"||t==="UNKNOWN"){e&=C}this.#Kt=e;if(t==="ENOTDIR"&&this.parent){this.parent.#ie()}}#oe(t,e){return this.#ae(t,e)||this.#he(t,e)}#he(t,e){const s=entToType(t);const i=this.newChild(t.name,s,{parent:this});const r=i.#Kt&_;if(r!==v&&r!==x&&r!==b){i.#Kt|=A}e.unshift(i);e.provisional++;return i}#ae(t,e){for(let s=e.provisional;s<e.length;s++){const i=e[s];const r=this.nocase?normalizeNocase(t.name):normalize(t.name);if(r!==i.#zt){continue}return this.#le(t,i,s,e)}}#le(t,e,s,i){const r=e.name;e.#Kt=e.#Kt&C|entToType(t);if(r!==t.name)e.name=t.name;if(s!==i.provisional){if(s===i.length-1)i.pop();else i.splice(s,1);i.unshift(e)}i.provisional++;return e}async lstat(){if((this.#Kt&O)===0){try{this.#ce(await this.#kt.promises.lstat(this.fullpath()));return this}catch(t){this.#ne(t.code)}}}lstatSync(){if((this.#Kt&O)===0){try{this.#ce(this.#kt.lstatSync(this.fullpath()));return this}catch(t){this.#ne(t.code)}}}#ce(t){const{atime:e,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:n,blocks:o,ctime:a,ctimeMs:h,dev:l,gid:c,ino:u,mode:f,mtime:d,mtimeMs:p,nlink:g,rdev:y,size:w,uid:S}=t;this.#Ft=e;this.#It=s;this.#Dt=i;this.#Bt=r;this.#At=n;this.#Lt=o;this.#jt=a;this.#Ut=h;this.#xt=l;this.#Rt=c;this.#Ot=u;this.#Et=f;this.#Nt=d;this.#Mt=p;this.#_t=g;this.#Pt=y;this.#x=w;this.#Ct=S;const T=entToType(t);this.#Kt=this.#Kt&C|T|P;if(T!==b&&T!==v&&T!==x){this.#Kt|=A}}#ue=[];#fe=false;#de(t){this.#fe=false;const e=this.#ue.slice();this.#ue.length=0;e.forEach((e=>e(null,t)))}readdirCB(t,e=false){if(!this.canReaddir()){if(e)t(null,[]);else queueMicrotask((()=>t(null,[])));return}const s=this.children();if(this.calledReaddir()){const i=s.slice(0,s.provisional);if(e)t(null,i);else queueMicrotask((()=>t(null,i)));return}this.#ue.push(t);if(this.#fe){return}this.#fe=true;const i=this.fullpath();this.#kt.readdir(i,{withFileTypes:true},((t,e)=>{if(t){this.#re(t.code);s.provisional=0}else{for(const t of e){this.#oe(t,s)}this.#Qt(s)}this.#de(s.slice(0,s.provisional));return}))}#pe;async readdir(){if(!this.canReaddir()){return[]}const t=this.children();if(this.calledReaddir()){return t.slice(0,t.provisional)}const e=this.fullpath();if(this.#pe){await this.#pe}else{let resolve=()=>{};this.#pe=new Promise((t=>resolve=t));try{for(const s of await this.#kt.promises.readdir(e,{withFileTypes:true})){this.#oe(s,t)}this.#Qt(t)}catch(e){this.#re(e.code);t.provisional=0}this.#pe=undefined;resolve()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir()){return[]}const t=this.children();if(this.calledReaddir()){return t.slice(0,t.provisional)}const e=this.fullpath();try{for(const s of this.#kt.readdirSync(e,{withFileTypes:true})){this.#oe(s,t)}this.#Qt(t)}catch(e){this.#re(e.code);t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#Kt&M)return false;const t=_&this.#Kt;if(!(t===b||t===v||t===x)){return false}return true}shouldWalk(t,e){return(this.#Kt&v)===v&&!(this.#Kt&M)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#Jt)return this.#Jt;if((I|L|O)&this.#Kt)return undefined;try{const t=await this.#kt.promises.realpath(this.fullpath());return this.#Jt=this.resolve(t)}catch(t){this.#se()}}realpathSync(){if(this.#Jt)return this.#Jt;if((I|L|O)&this.#Kt)return undefined;try{const t=this.#kt.realpathSync(this.fullpath());return this.#Jt=this.resolve(t)}catch(t){this.#se()}}[N](t){if(t===this)return;t.isCWD=false;this.isCWD=true;const e=new Set([]);let s=[];let i=this;while(i&&i.parent){e.add(i);i.#Ht=s.join(this.sep);i.#qt=s.join("/");i=i.parent;s.push("..")}i=t;while(i&&i.parent&&!e.has(i)){i.#Ht=undefined;i.#qt=undefined;i=i.parent}}}e.PathBase=PathBase;class PathWin32 extends PathBase{sep="\\";splitSep=y;constructor(t,e=b,s,i,r,n,o){super(t,e,s,i,r,n,o)}newChild(t,e=b,s={}){return new PathWin32(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return a.win32.parse(t).root}getRoot(t){t=uncToDrive(t.toUpperCase());if(t===this.root.name){return this.root}for(const[e,s]of Object.entries(this.roots)){if(this.sameRoot(t,e)){return this.roots[t]=s}}return this.roots[t]=new PathScurryWin32(t,this).root}sameRoot(t,e=this.root.name){t=t.toUpperCase().replace(/\//g,"\\").replace(g,"$1\\");return t===e}}e.PathWin32=PathWin32;class PathPosix extends PathBase{splitSep="/";sep="/";constructor(t,e=b,s,i,r,n,o){super(t,e,s,i,r,n,o)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,e=b,s={}){return new PathPosix(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}}e.PathPosix=PathPosix;class PathScurryBase{root;rootPath;roots;cwd;#me;#ge;#Vt;nocase;#kt;constructor(t=process.cwd(),e,s,{nocase:i,childrenCacheSize:r=16*1024,fs:n=p}={}){this.#kt=fsFromOption(n);if(t instanceof URL||t.startsWith("file://")){t=(0,h.fileURLToPath)(t)}const o=e.resolve(t);this.roots=Object.create(null);this.rootPath=this.parseRootPath(o);this.#me=new ResolveCache;this.#ge=new ResolveCache;this.#Vt=new ChildrenCache(r);const a=o.substring(this.rootPath.length).split(s);if(a.length===1&&!a[0]){a.pop()}if(i===undefined){throw new TypeError("must provide nocase setting to PathScurryBase ctor")}this.nocase=i;this.root=this.newRoot(this.#kt);this.roots[this.rootPath]=this.root;let l=this.root;let c=a.length-1;const u=e.sep;let f=this.rootPath;let d=false;for(const t of a){const e=c--;l=l.child(t,{relative:new Array(e).fill("..").join(u),relativePosix:new Array(e).fill("..").join("/"),fullpath:f+=(d?"":u)+t});d=true}this.cwd=l}depth(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return t.depth()}childrenCache(){return this.#Vt}resolve(...t){let e="";for(let s=t.length-1;s>=0;s--){const i=t[s];if(!i||i===".")continue;e=e?`${i}/${e}`:i;if(this.isAbsolute(i)){break}}const s=this.#me.get(e);if(s!==undefined){return s}const i=this.cwd.resolve(e).fullpath();this.#me.set(e,i);return i}resolvePosix(...t){let e="";for(let s=t.length-1;s>=0;s--){const i=t[s];if(!i||i===".")continue;e=e?`${i}/${e}`:i;if(this.isAbsolute(i)){break}}const s=this.#ge.get(e);if(s!==undefined){return s}const i=this.cwd.resolve(e).fullpathPosix();this.#ge.set(e,i);return i}relative(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return t.relative()}relativePosix(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return t.relativePosix()}basename(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return t.name}dirname(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:true}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s}=e;if(!t.canReaddir()){return[]}else{const e=await t.readdir();return s?e:e.map((t=>t.name))}}readdirSync(t=this.cwd,e={withFileTypes:true}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s=true}=e;if(!t.canReaddir()){return[]}else if(s){return t.readdirSync()}else{return t.readdirSync().map((t=>t.name))}}async lstat(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return t.lstat()}lstatSync(t=this.cwd){if(typeof t==="string"){t=this.cwd.resolve(t)}return t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:false}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t.withFileTypes;t=this.cwd}const s=await t.readlink();return e?s:s?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:false}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t.withFileTypes;t=this.cwd}const s=t.readlinkSync();return e?s:s?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:false}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t.withFileTypes;t=this.cwd}const s=await t.realpath();return e?s:s?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:false}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t.withFileTypes;t=this.cwd}const s=t.realpathSync();return e?s:s?.fullpath()}async walk(t=this.cwd,e={}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s=true,follow:i=false,filter:r,walkFilter:n}=e;const o=[];if(!r||r(t)){o.push(s?t:t.fullpath())}const a=new Set;const walk=(t,e)=>{a.add(t);t.readdirCB(((t,h)=>{if(t){return e(t)}let l=h.length;if(!l)return e();const next=()=>{if(--l===0){e()}};for(const t of h){if(!r||r(t)){o.push(s?t:t.fullpath())}if(i&&t.isSymbolicLink()){t.realpath().then((t=>t?.isUnknown()?t.lstat():t)).then((t=>t?.shouldWalk(a,n)?walk(t,next):next()))}else{if(t.shouldWalk(a,n)){walk(t,next)}else{next()}}}}),true)};const h=t;return new Promise(((t,e)=>{walk(h,(s=>{if(s)return e(s);t(o)}))}))}walkSync(t=this.cwd,e={}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s=true,follow:i=false,filter:r,walkFilter:n}=e;const o=[];if(!r||r(t)){o.push(s?t:t.fullpath())}const a=new Set([t]);for(const t of a){const e=t.readdirSync();for(const t of e){if(!r||r(t)){o.push(s?t:t.fullpath())}let e=t;if(t.isSymbolicLink()){if(!(i&&(e=t.realpathSync())))continue;if(e.isUnknown())e.lstatSync()}if(e.shouldWalk(a,n)){a.add(e)}}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}return this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s=true,follow:i=false,filter:r,walkFilter:n}=e;if(!r||r(t)){yield s?t:t.fullpath()}const o=new Set([t]);for(const t of o){const e=t.readdirSync();for(const t of e){if(!r||r(t)){yield s?t:t.fullpath()}let e=t;if(t.isSymbolicLink()){if(!(i&&(e=t.realpathSync())))continue;if(e.isUnknown())e.lstatSync()}if(e.shouldWalk(o,n)){o.add(e)}}}}stream(t=this.cwd,e={}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s=true,follow:i=false,filter:r,walkFilter:n}=e;const o=new d.Minipass({objectMode:true});if(!r||r(t)){o.write(s?t:t.fullpath())}const a=new Set;const h=[t];let l=0;const process=()=>{let t=false;while(!t){const e=h.shift();if(!e){if(l===0)o.end();return}l++;a.add(e);const onReaddir=(e,u,f=false)=>{if(e)return o.emit("error",e);if(i&&!f){const t=[];for(const e of u){if(e.isSymbolicLink()){t.push(e.realpath().then((t=>t?.isUnknown()?t.lstat():t)))}}if(t.length){Promise.all(t).then((()=>onReaddir(null,u,true)));return}}for(const e of u){if(e&&(!r||r(e))){if(!o.write(s?e:e.fullpath())){t=true}}}l--;for(const t of u){const e=t.realpathCached()||t;if(e.shouldWalk(a,n)){h.push(e)}}if(t&&!o.flowing){o.once("drain",process)}else if(!c){process()}};let c=true;e.readdirCB(onReaddir,true);c=false}};process();return o}streamSync(t=this.cwd,e={}){if(typeof t==="string"){t=this.cwd.resolve(t)}else if(!(t instanceof PathBase)){e=t;t=this.cwd}const{withFileTypes:s=true,follow:i=false,filter:r,walkFilter:n}=e;const o=new d.Minipass({objectMode:true});const a=new Set;if(!r||r(t)){o.write(s?t:t.fullpath())}const h=[t];let l=0;const process=()=>{let t=false;while(!t){const e=h.shift();if(!e){if(l===0)o.end();return}l++;a.add(e);const c=e.readdirSync();for(const e of c){if(!r||r(e)){if(!o.write(s?e:e.fullpath())){t=true}}}l--;for(const t of c){let e=t;if(t.isSymbolicLink()){if(!(i&&(e=t.realpathSync())))continue;if(e.isUnknown())e.lstatSync()}if(e.shouldWalk(a,n)){h.push(e)}}}if(t&&!o.flowing)o.once("drain",process)};process();return o}chdir(t=this.cwd){const e=this.cwd;this.cwd=typeof t==="string"?this.cwd.resolve(t):t;this.cwd[N](e)}}e.PathScurryBase=PathScurryBase;class PathScurryWin32 extends PathScurryBase{sep="\\";constructor(t=process.cwd(),e={}){const{nocase:s=true}=e;super(t,a.win32,"\\",{...e,nocase:s});this.nocase=s;for(let t=this.cwd;t;t=t.parent){t.nocase=this.nocase}}parseRootPath(t){return a.win32.parse(t).root.toUpperCase()}newRoot(t){return new PathWin32(this.rootPath,v,undefined,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}}e.PathScurryWin32=PathScurryWin32;class PathScurryPosix extends PathScurryBase{sep="/";constructor(t=process.cwd(),e={}){const{nocase:s=false}=e;super(t,a.posix,"/",{...e,nocase:s});this.nocase=s}parseRootPath(t){return"/"}newRoot(t){return new PathPosix(this.rootPath,v,undefined,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}}e.PathScurryPosix=PathScurryPosix;class PathScurryDarwin extends PathScurryPosix{constructor(t=process.cwd(),e={}){const{nocase:s=true}=e;super(t,{...e,nocase:s})}}e.PathScurryDarwin=PathScurryDarwin;e.Path=process.platform==="win32"?PathWin32:PathPosix;e.PathScurry=process.platform==="win32"?PathScurryWin32:process.platform==="darwin"?PathScurryDarwin:PathScurryPosix}};var e={};function __nccwpck_require__(s){var i=e[s];if(i!==undefined){return i.exports}var r=e[s]={exports:{}};var n=true;try{t[s].call(r.exports,r,r.exports,__nccwpck_require__);n=false}finally{if(n)delete e[s]}return r.exports}(()=>{var t=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__;var e;__nccwpck_require__.t=function(s,i){if(i&1)s=this(s);if(i&8)return s;if(typeof s==="object"&&s){if(i&4&&s.__esModule)return s;if(i&16&&typeof s.then==="function")return s}var r=Object.create(null);__nccwpck_require__.r(r);var n={};e=e||[null,t({}),t([]),t(t)];for(var o=i&2&&s;typeof o=="object"&&!~e.indexOf(o);o=t(o)){Object.getOwnPropertyNames(o).forEach((t=>n[t]=()=>s[t]))}n["default"]=()=>s;__nccwpck_require__.d(r,n);return r}})();(()=>{__nccwpck_require__.d=(t,e)=>{for(var s in e){if(__nccwpck_require__.o(e,s)&&!__nccwpck_require__.o(t,s)){Object.defineProperty(t,s,{enumerable:true,get:e[s]})}}}})();(()=>{__nccwpck_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var s=__nccwpck_require__(328);module.exports=s})();
|
package/dist/cli/reporter.d.ts
CHANGED
|
@@ -15,11 +15,6 @@ export interface TestreamReporterOptions {
|
|
|
15
15
|
* @required
|
|
16
16
|
*/
|
|
17
17
|
apiKey: string;
|
|
18
|
-
/**
|
|
19
|
-
* Project key to associate test results with
|
|
20
|
-
* @required
|
|
21
|
-
*/
|
|
22
|
-
projectKey: string;
|
|
23
18
|
/**
|
|
24
19
|
* Git commit SHA (auto-detected from environment if not provided)
|
|
25
20
|
*/
|
|
@@ -88,7 +83,6 @@ export interface TestreamReporterOptions {
|
|
|
88
83
|
* new TestreamReporter({
|
|
89
84
|
* on,
|
|
90
85
|
* apiKey: 'your-api-key',
|
|
91
|
-
* projectKey: 'YOUR_PROJECT',
|
|
92
86
|
* uploadEnabled: true,
|
|
93
87
|
* });
|
|
94
88
|
* },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"","sourceRoot":"","sources":["file:///home/runner/work/jira-test-manager/jira-test-manager/packages/cypress-reporter/src/reporter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,KAAK,mBAAmB,GAAG,GAAG,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,iFAAiF;IACjF,EAAE,EAAE,mBAAmB,CAAC;IAExB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf
|
|
1
|
+
{"version":3,"file":"","sourceRoot":"","sources":["file:///home/runner/work/jira-test-manager/jira-test-manager/packages/cypress-reporter/src/reporter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,KAAK,mBAAmB,GAAG,GAAG,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,iFAAiF;IACjF,EAAE,EAAE,mBAAmB,CAAC;IAExB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAG5B,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,sBAAsB;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qBAAqB;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,IAAI,CAAqB;YAEnB,iBAAiB;gBAenB,OAAO,EAAE,uBAAuB;IAiE5C;;OAEG;YACW,aAAa;CA4D5B"}
|
package/dist/cli/types.d.ts
CHANGED
|
@@ -46,11 +46,6 @@ export interface CypressReporterConfig {
|
|
|
46
46
|
* @required
|
|
47
47
|
*/
|
|
48
48
|
apiKey: string;
|
|
49
|
-
/**
|
|
50
|
-
* Project key to associate test results with
|
|
51
|
-
* @required
|
|
52
|
-
*/
|
|
53
|
-
projectKey: string;
|
|
54
49
|
/**
|
|
55
50
|
* Path to Cypress project directory
|
|
56
51
|
* If not provided, uses current directory
|
package/dist/cli/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"","sourceRoot":"","sources":["file:///home/runner/work/jira-test-manager/jira-test-manager/packages/cypress-reporter/src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC;QACd,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;QACvC,KAAK,CAAC,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;YAChB,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QACF,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC,CAAC;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"","sourceRoot":"","sources":["file:///home/runner/work/jira-test-manager/jira-test-manager/packages/cypress-reporter/src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC;QACd,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;QACvC,KAAK,CAAC,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;YAChB,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QACF,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC,CAAC;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAEvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={301:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.GenerateCtrfReport=void 0;const n=r(896);const o=r(928);class GenerateCtrfReport{constructor(e){var t,r,o,i,s,a,u,l,d,p,c,f,m,h,y,_,b,v,R,T;this.reporterName="cypress-ctrf-json-reporter";this.defaultOutputFile="ctrf-report.json";this.defaultOutputDir="ctrf";this.runStart=0;this.runStop=0;this.filename=this.defaultOutputFile;this.browser="";this.reporterConfigOptions={on:e.on,outputFile:(t=e===null||e===void 0?void 0:e.outputFile)!==null&&t!==void 0?t:this.defaultOutputFile,outputDir:(r=e===null||e===void 0?void 0:e.outputDir)!==null&&r!==void 0?r:this.defaultOutputDir,minimal:(o=e===null||e===void 0?void 0:e.minimal)!==null&&o!==void 0?o:false,screenshot:(i=e===null||e===void 0?void 0:e.screenshot)!==null&&i!==void 0?i:false,testType:(s=e===null||e===void 0?void 0:e.testType)!==null&&s!==void 0?s:"e2e",appName:(a=e===null||e===void 0?void 0:e.appName)!==null&&a!==void 0?a:undefined,appVersion:(u=e===null||e===void 0?void 0:e.appVersion)!==null&&u!==void 0?u:undefined,osPlatform:(l=e===null||e===void 0?void 0:e.osPlatform)!==null&&l!==void 0?l:undefined,osRelease:(d=e===null||e===void 0?void 0:e.osRelease)!==null&&d!==void 0?d:undefined,osVersion:(p=e===null||e===void 0?void 0:e.osVersion)!==null&&p!==void 0?p:undefined,buildName:(c=e===null||e===void 0?void 0:e.buildName)!==null&&c!==void 0?c:undefined,buildNumber:(f=e===null||e===void 0?void 0:e.buildNumber)!==null&&f!==void 0?f:undefined,buildUrl:(m=e===null||e===void 0?void 0:e.buildUrl)!==null&&m!==void 0?m:undefined,repositoryName:(h=e===null||e===void 0?void 0:e.repositoryName)!==null&&h!==void 0?h:undefined,repositoryUrl:(y=e===null||e===void 0?void 0:e.repositoryUrl)!==null&&y!==void 0?y:undefined,branchName:(_=e===null||e===void 0?void 0:e.branchName)!==null&&_!==void 0?_:undefined,testEnvironment:(b=e===null||e===void 0?void 0:e.testEnvironment)!==null&&b!==void 0?b:undefined};this.ctrfReport={results:{tool:{name:"cypress"},summary:{tests:0,passed:0,failed:0,pending:0,skipped:0,other:0,start:0,stop:0},tests:[]}};this.validateOptions();if(this.reporterConfigOptions.outputFile!==undefined)this.setFilename(this.reporterConfigOptions.outputFile);this.ctrfEnvironment={};if(((v=this.reporterConfigOptions)===null||v===void 0?void 0:v.outputFile)!==undefined)this.setFilename(this.reporterConfigOptions.outputFile);if(!n.existsSync((R=this.reporterConfigOptions.outputDir)!==null&&R!==void 0?R:this.defaultOutputDir)){n.mkdirSync((T=this.reporterConfigOptions.outputDir)!==null&&T!==void 0?T:this.defaultOutputDir,{recursive:true})}this.setEventHandlers()}setFilename(e){if(e.endsWith(".json")){this.filename=e}else{this.filename=`${e}.json`}}validateOptions(){if(this.reporterConfigOptions.on===false){throw new Error("Missing required option: on")}}setEventHandlers(){this.reporterConfigOptions.on("before:run",(e=>{var t;this.runStart=Date.now();this.browser=`${e.browser.name} ${e.browser.version}`;this.setEnvironmentDetails((t=this.reporterConfigOptions)!==null&&t!==void 0?t:{});if(this.hasEnvironmentDetails(this.ctrfEnvironment)){this.ctrfReport.results.environment=this.ctrfEnvironment}}));this.reporterConfigOptions.on("after:spec",((e,t)=>{this.updateCtrfResultsFromAfterSpecResults(t)}));this.reporterConfigOptions.on("after:run",(e=>{this.runStop=Date.now();this.updateCtrfTotalsFromAfterRun(e);this.writeReportToFile(this.ctrfReport)}))}updateCtrfResultsFromAfterSpecResults(e){e.tests.forEach((t=>{var r,n,o,i,s,a;const u=(r=t.attempts)===null||r===void 0?void 0:r[t.attempts.length-1];const l=typeof t.duration==="number"?t.duration:(n=u===null||u===void 0?void 0:u.wallClockDuration)!==null&&n!==void 0?n:0;const d=(i=(o=t.attempts)===null||o===void 0?void 0:o.length)!==null&&i!==void 0?i:0;const p=t.state==="passed"&&d>1;const c={name:t.title.join(" "),status:t.state,duration:l};if(this.reporterConfigOptions.minimal===false){if(t.state==="failed"){const e=this.extractFailureDetails(t,u);c.message=e.message;c.trace=e.trace}c.rawStatus=t.state;c.type=(s=this.reporterConfigOptions.testType)!==null&&s!==void 0?s:"e2e";c.filePath=(a=e.spec)===null||a===void 0?void 0:a.relative;c.retries=d-1;c.flaky=p;c.browser=this.browser;const r=this.getScreenshot(t,e,false);if(r!==undefined&&typeof r==="string"){c.screenshot=r}}const f=this.getAttachments(t,e);if(f.length>0){if(c.attachments!==undefined){c.attachments=[...c.attachments,...f]}else{c.attachments=f}}this.ctrfReport.results.tests.push(c)}))}updateCtrfTotalsFromAfterRun(e){this.ctrfReport.results.summary={tests:e.totalTests,failed:e.totalFailed,passed:e.totalPassed,skipped:e.totalSkipped,pending:e.totalPending,other:0,start:this.runStart,stop:this.runStop}}setEnvironmentDetails(e){if(e.appName!==undefined){this.ctrfEnvironment.appName=e.appName}if(e.appVersion!==undefined){this.ctrfEnvironment.appVersion=e.appVersion}if(e.osPlatform!==undefined){this.ctrfEnvironment.osPlatform=e.osPlatform}if(e.osRelease!==undefined){this.ctrfEnvironment.osRelease=e.osRelease}if(e.osVersion!==undefined){this.ctrfEnvironment.osVersion=e.osVersion}if(e.buildName!==undefined){this.ctrfEnvironment.buildName=e.buildName}if(e.buildNumber!==undefined){this.ctrfEnvironment.buildNumber=e.buildNumber}if(e.buildUrl!==undefined){this.ctrfEnvironment.buildUrl=e.buildUrl}if(e.repositoryName!==undefined){this.ctrfEnvironment.repositoryName=e.repositoryName}if(e.repositoryUrl!==undefined){this.ctrfEnvironment.repositoryUrl=e.repositoryUrl}if(e.branchName!==undefined){this.ctrfEnvironment.branchName=e.branchName}if(e.testEnvironment!==undefined){this.ctrfEnvironment.testEnvironment=e.testEnvironment}}hasEnvironmentDetails(e){return Object.keys(e).length>0}extractFailureDetails(e,t){const r={};if((t===null||t===void 0?void 0:t.error)!==undefined&&(t===null||t===void 0?void 0:t.error)!==null&&"message"in t.error&&"stack"in t.error){r.message=t.error.message;r.trace=t.error.stack}else if(typeof e.displayError==="string"&&e.displayError.trim().length>0){r.message=e.displayError;r.trace=e.displayError}return r}getScreenshot(e,t,r=false){if(this.reporterConfigOptions.screenshot===false&&!r){return undefined}if(t.screenshots===undefined||t.screenshots.length===0){return undefined}const o=t.screenshots.filter((t=>t.path!==undefined&&t.path!==""&&t.path.includes(e.title.join(" -- "))));if(o.length===0){return undefined}if(r){return o.map((e=>({name:"screenshot",contentType:"image/png",path:e.path})))}let i=o.find((e=>e.path.includes("(failed)")));if(i===undefined&&o.length>0){i=o[o.length-1]}if(i!==undefined){try{const e=n.readFileSync(i.path,{encoding:"base64"});return e}catch(e){console.warn(`Error reading screenshot file ${i.path}:`,e);return undefined}}return undefined}getAttachments(e,t){const r=[];if(t.screenshots!==undefined&&t.screenshots.length>0){try{const n=this.getScreenshot(e,t,true);if(n!==undefined&&Array.isArray(n)){r.push(...n)}}catch(e){console.error("Error processing screenshot attachments:",e)}}if(t.video!==undefined&&t.video!==null&&t.video.trim()!==""){try{if(n.existsSync(t.video)){r.push({name:"video",contentType:"video/mp4",path:t.video})}else{console.warn(`Video file not found: ${t.video}`)}}catch(e){console.warn("Error processing video attachment:",e)}}return r}writeReportToFile(e){var t,r;const i=o.join((t=this.reporterConfigOptions.outputDir)!==null&&t!==void 0?t:this.defaultOutputDir,(r=this.reporterConfigOptions.outputFile)!==null&&r!==void 0?r:this.defaultOutputFile);const s=JSON.stringify(e,null,2);try{n.writeFileSync(i,s+"\n");console.log(`${this.reporterName}: successfully written ctrf json to %s/%s`,this.reporterConfigOptions.outputDir,this.reporterConfigOptions.outputFile)}catch(e){console.error(`Error writing ctrf json report:, ${String(e)}`)}}}t.GenerateCtrfReport=GenerateCtrfReport},641:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.GenerateCtrfReport=void 0;var n=r(301);Object.defineProperty(t,"GenerateCtrfReport",{enumerable:true,get:function(){return n.GenerateCtrfReport}})},406:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.detectCIContext=detectCIContext;function detectCIContext(){const e=process.env;if(e.GITHUB_ACTIONS==="true"){return{branch:e.GITHUB_HEAD_REF||e.GITHUB_REF_NAME||e.GITHUB_REF?.replace("refs/heads/",""),commitSha:e.GITHUB_SHA,repositoryUrl:e.GITHUB_SERVER_URL&&e.GITHUB_REPOSITORY?`${e.GITHUB_SERVER_URL}/${e.GITHUB_REPOSITORY}`:undefined,buildNumber:e.GITHUB_RUN_NUMBER,buildUrl:e.GITHUB_SERVER_URL&&e.GITHUB_REPOSITORY&&e.GITHUB_RUN_ID?`${e.GITHUB_SERVER_URL}/${e.GITHUB_REPOSITORY}/actions/runs/${e.GITHUB_RUN_ID}`:undefined}}if(e.GITLAB_CI==="true"){return{branch:e.CI_COMMIT_BRANCH||e.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME,commitSha:e.CI_COMMIT_SHA,repositoryUrl:e.CI_PROJECT_URL,buildNumber:e.CI_PIPELINE_IID,buildUrl:e.CI_PIPELINE_URL}}if(e.TF_BUILD==="True"){return{branch:e.BUILD_SOURCEBRANCH?.replace("refs/heads/",""),commitSha:e.BUILD_SOURCEVERSION,repositoryUrl:e.BUILD_REPOSITORY_URI,buildNumber:e.BUILD_BUILDNUMBER,buildUrl:e.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI&&e.SYSTEM_TEAMPROJECT&&e.BUILD_BUILDID?`${e.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI}${e.SYSTEM_TEAMPROJECT}/_build/results?buildId=${e.BUILD_BUILDID}`:undefined}}if(e.CIRCLECI==="true"){return{branch:e.CIRCLE_BRANCH,commitSha:e.CIRCLE_SHA1,repositoryUrl:e.CIRCLE_REPOSITORY_URL,buildNumber:e.CIRCLE_BUILD_NUM,buildUrl:e.CIRCLE_BUILD_URL}}if(e.JENKINS_URL){return{branch:e.GIT_BRANCH?.replace("origin/",""),commitSha:e.GIT_COMMIT,repositoryUrl:e.GIT_URL,buildNumber:e.BUILD_NUMBER,buildUrl:e.BUILD_URL}}if(e.BITBUCKET_BUILD_NUMBER){return{branch:e.BITBUCKET_BRANCH,commitSha:e.BITBUCKET_COMMIT,repositoryUrl:e.BITBUCKET_GIT_HTTP_ORIGIN,buildNumber:e.BITBUCKET_BUILD_NUMBER,buildUrl:e.BITBUCKET_REPO_FULL_NAME&&e.BITBUCKET_BUILD_NUMBER?`https://bitbucket.org/${e.BITBUCKET_REPO_FULL_NAME}/pipelines/results/${e.BITBUCKET_BUILD_NUMBER}`:undefined}}return{}}},827:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true})},322:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;var o=Object.getOwnPropertyDescriptor(t,r);if(!o||("get"in o?!t.__esModule:o.writable||o.configurable)){o={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,n,o)}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var o=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))n(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});t.ensureReportId=t.mapAttachmentsToTestResults=t.uploadArtifacts=t.uploadTestRun=t.detectCIContext=void 0;o(r(827),t);var i=r(406);Object.defineProperty(t,"detectCIContext",{enumerable:true,get:function(){return i.detectCIContext}});var s=r(969);Object.defineProperty(t,"uploadTestRun",{enumerable:true,get:function(){return s.uploadTestRun}});Object.defineProperty(t,"uploadArtifacts",{enumerable:true,get:function(){return s.uploadArtifacts}});Object.defineProperty(t,"mapAttachmentsToTestResults",{enumerable:true,get:function(){return s.mapAttachmentsToTestResults}});Object.defineProperty(t,"ensureReportId",{enumerable:true,get:function(){return s.ensureReportId}})},969:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.ensureReportId=ensureReportId;t.uploadTestRun=uploadTestRun;t.mapAttachmentsToTestResults=mapAttachmentsToTestResults;t.uploadArtifacts=uploadArtifacts;const n=r(406);const o="https://test-manager-backend.fly.dev";function ensureReportId(e){if(typeof e.reportId==="string"&&e.reportId.trim().length>0){return e.reportId}const t=crypto.randomUUID();e.reportId=t;return t}function resolveApiUrl(e){const t=normalizeApiUrl(e);if(t){return t}const r=getEnvApiUrl();if(r){return r}return o}function getEnvApiUrl(){if(typeof process==="undefined"||!process?.env){return undefined}return normalizeApiUrl(process.env.TESTREAM_API_URL)}function normalizeApiUrl(e){if(!e){return undefined}const t=e.trim();if(!t){return undefined}return t.replace(/\/+$/,"")}function isReportAlreadyExistsConflict(e){return e.errorCode==="report_already_exists"}function formatUploadError(e){const t=e.detail||e.title||e.rawBody||"Unknown error";const r=e.errorCode?`, code=${e.errorCode}`:"";return`Upload failed (HTTP ${e.statusCode}${r}): ${t}`}async function parseHttpError(e){const t=await e.text();const r=e.headers.get("content-type")||"";if(r.toLowerCase().includes("json")&&t.trim().length>0){try{const r=JSON.parse(t);return{statusCode:e.status,title:r.title,detail:r.detail||r.details||r.error,errorCode:r.errorCode,rawBody:t}}catch{}}return{statusCode:e.status,rawBody:t}}function resolveUploadContext(e){const t=(0,n.detectCIContext)();return{commitSha:e.commitSha??t.commitSha,branch:e.branch??t.branch,repositoryUrl:e.repositoryUrl??t.repositoryUrl,buildName:e.buildName,buildNumber:e.buildNumber??t.buildNumber,buildUrl:e.buildUrl??t.buildUrl,testEnvironment:e.testEnvironment,appName:e.appName,appVersion:e.appVersion,testType:e.testType}}async function uploadTestRun(e){const{report:t,apiKey:r}=e;const n=resolveApiUrl(e.apiUrl);const o=ensureReportId(t);const i=resolveUploadContext(e);const s={report:t,reportId:o,...i};console.log("Uploading test results...");let a;try{a=await fetch(`${n}/api/v1/ingest`,{method:"POST",headers:{"X-API-KEY":r,"Content-Type":"application/json"},body:JSON.stringify(s)})}catch(e){const t=e instanceof Error?e.message:String(e);const r=`Connection failed: ${t}`;console.error(r);return{success:false,reportId:o,error:r}}if(!a.ok){const e=await parseHttpError(a);if(a.status===409&&isReportAlreadyExistsConflict(e)){console.warn("Report already exists (workflow may have been re-run)");return{success:true,reportId:o,summary:{passed:t.results.summary.passed,failed:t.results.summary.failed,skipped:t.results.summary.skipped,total:t.results.summary.tests},alreadyExists:true,statusCode:e.statusCode,errorCode:e.errorCode}}const r=formatUploadError(e);console.error(r);return{success:false,reportId:o,error:r,statusCode:e.statusCode,errorCode:e.errorCode,errorDetail:e.detail||e.rawBody}}const u=await a.json();console.log(`✓ Test results uploaded successfully`);console.log(` Report ID: ${u.reportId}`);console.log(` Test Run ID: ${u.testRunId}`);console.log(` Tests: ${u.summary.passed}/${u.summary.total} passed`);return{success:true,reportId:u.reportId,testRunId:u.testRunId,summary:{passed:u.summary.passed,failed:u.summary.failed,skipped:u.summary.skipped,total:u.summary.total},testResults:u.testResults}}function mapAttachmentsToTestResults(e,t){const r=new Map;for(const e of t){const t=r.get(e.name)??[];t.push(e.id);r.set(e.name,t)}const n=[];for(const t of e){const e=r.get(t.name);const o=e?.shift();if(!t.attachments||t.attachments.length===0){continue}if(!o){console.warn(`Skipping artifact upload: could not match test result for "${t.name}"`);continue}n.push({testResultId:o,attachments:t.attachments})}return n}async function uploadArtifacts(e){const{reportId:t,apiKey:r,testResults:n}=e;const o=resolveApiUrl(e.apiUrl);let i=0;for(const e of n){for(const n of e.attachments){try{const s=await uploadSingleArtifact({testResultId:e.testResultId,attachment:n,reportId:t,apiKey:r,apiUrl:o});if(s)i++}catch(e){const t=e instanceof Error?e.message:String(e);console.error(`Failed to upload artifact ${n.name}: ${t}`)}}}if(i>0){console.log(`✓ Uploaded ${i} artifact(s)`)}return i}async function uploadSingleArtifact(e){const{testResultId:t,attachment:n,reportId:o,apiKey:i,apiUrl:s}=e;const a=await Promise.resolve().then(r.t.bind(r,943,23));const u=await Promise.resolve().then(r.t.bind(r,928,23));const l=u.resolve(n.path);try{await a.access(l)}catch{console.warn(`Artifact not found: ${u.basename(l)}`);return false}let d;let p;const c=u.basename(l);const f=n.contentType||"application/octet-stream";try{d=await a.readFile(l);p=d.byteLength}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to read file: ${t}`)}try{return await uploadWithPresignedUrl({testResultId:t,reportId:o,apiKey:i,apiUrl:s,attachmentName:n.name,fileName:c,contentType:f,sizeBytes:p,fileBuffer:d})}catch(e){if(!(e instanceof LegacyUploadRequiredError)){throw e}return await uploadWithLegacyEndpoint({testResultId:t,attachmentName:n.name,reportId:o,apiKey:i,apiUrl:s,fileName:c,contentType:f,fileBuffer:d})}}class LegacyUploadRequiredError extends Error{constructor(){super("Legacy upload endpoint required")}}async function uploadWithPresignedUrl(e){const{testResultId:t,reportId:r,apiKey:n,apiUrl:o,attachmentName:i,fileName:s,contentType:a,sizeBytes:u,fileBuffer:l}=e;const d={testResultId:t,ctrfAttachmentName:i,fileName:s,contentType:a,sizeBytes:u};const p=await fetch(`${o}/api/v1/artifacts/${r}/upload-url`,{method:"POST",headers:{"X-API-KEY":n,"Content-Type":"application/json"},body:JSON.stringify(d)});if(shouldFallbackToLegacyUpload(p.status)){throw new LegacyUploadRequiredError}if(!p.ok){const e=await p.text();throw new Error(`Failed to create direct upload URL (HTTP ${p.status}): ${e}`)}const c=await p.json();const f={...c.requiredHeaders??{}};if(!hasHeaderIgnoreCase(f,"Content-Type")){f["Content-Type"]=a}const m=await fetch(c.uploadUrl,{method:"PUT",headers:f,body:l});if(!m.ok){const e=await m.text();throw new Error(`Direct artifact upload failed (HTTP ${m.status}): ${e}`)}const h={testResultId:t,ctrfAttachmentName:i,fileName:s,contentType:a,sizeBytes:u,storageKey:c.storageKey};const y=await fetch(`${o}/api/v1/artifacts/${r}/complete`,{method:"POST",headers:{"X-API-KEY":n,"Content-Type":"application/json"},body:JSON.stringify(h)});if(!y.ok){const e=await y.text();throw new Error(`Failed to finalize artifact upload (HTTP ${y.status}): ${e}`)}return true}async function uploadWithLegacyEndpoint(e){const{testResultId:t,attachmentName:r,reportId:n,apiKey:o,apiUrl:i,fileName:s,contentType:a,fileBuffer:u}=e;const l=new Blob([new Uint8Array(u)],{type:a});const d=new FormData;d.append("testResultId",t);d.append("ctrfAttachmentName",r);d.append("file",l,s);const p=await fetch(`${i}/api/v1/artifacts/${n}`,{method:"POST",headers:{"X-API-KEY":o},body:d});if(!p.ok){const e=await p.text();throw new Error(`Legacy artifact upload failed (HTTP ${p.status}): ${e}`)}return true}function shouldFallbackToLegacyUpload(e){return e===404||e===405||e===501}function hasHeaderIgnoreCase(e,t){const r=t.toLowerCase();return Object.keys(e).some((e=>e.toLowerCase()===r))}},481:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;var o=Object.getOwnPropertyDescriptor(t,r);if(!o||("get"in o?!t.__esModule:o.writable||o.configurable)){o={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,n,o)}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__importStar||function(){var ownKeys=function(e){ownKeys=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r))t[t.length]=r;return t};return ownKeys(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=ownKeys(e),i=0;i<r.length;i++)if(r[i]!=="default")n(t,e,r[i]);o(t,e);return t}}();Object.defineProperty(t,"__esModule",{value:true});t.detectCypressVersion=detectCypressVersion;const s=i(r(943));const a=i(r(928));async function detectCypressVersion(e){try{const t=a.join(e||process.cwd(),"package.json");const r=JSON.parse(await s.readFile(t,"utf-8"));const n=r.dependencies?.cypress||r.devDependencies?.cypress;if(n){return n.replace(/^[\^~]/,"")}}catch{}return undefined}},665:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;var o=Object.getOwnPropertyDescriptor(t,r);if(!o||("get"in o?!t.__esModule:o.writable||o.configurable)){o={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,n,o)}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__importStar||function(){var ownKeys=function(e){ownKeys=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r))t[t.length]=r;return t};return ownKeys(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=ownKeys(e),i=0;i<r.length;i++)if(r[i]!=="default")n(t,e,r[i]);o(t,e);return t}}();Object.defineProperty(t,"__esModule",{value:true});t.TestreamReporter=void 0;const s=i(r(943));const a=i(r(928));const u=r(641);const l=r(10);class TestreamReporter{async waitForReportFile(e,t=6e4,r=250){const n=Date.now();while(Date.now()-n<t){try{await s.access(e);return}catch{await new Promise((e=>setTimeout(e,r)))}}throw new Error(`CTRF report not found at ${e} after ${t}ms`)}constructor(e){this.options=e;if(!e.apiKey||e.apiKey.trim()===""){throw new Error("[TestreamReporter] API key is required. Please provide apiKey in TestreamReporterOptions or set TESTREAM_API_KEY environment variable.")}if(!e.projectKey||e.projectKey.trim()===""){throw new Error("[TestreamReporter] Project key is required. Please provide projectKey in TestreamReporterOptions or set TESTREAM_PROJECT_KEY environment variable.")}const t={};const wrappedOn=(r,n)=>{if(!t[r]){t[r]=[];e.on(r,(async(...e)=>{const n=t[r].map((t=>t(...e)));await Promise.all(n)}))}t[r].push(n)};const r={on:wrappedOn};if(e.outputDir!==undefined)r.outputDir=e.outputDir;if(e.outputFile!==undefined)r.outputFile=e.outputFile;if(e.minimal!==undefined)r.minimal=e.minimal;r.screenshot=e.screenshot??true;if(e.annotations!==undefined)r.annotations=e.annotations;if(e.testType!==undefined)r.testType=e.testType;if(e.appName!==undefined)r.appName=e.appName;if(e.appVersion!==undefined)r.appVersion=e.appVersion;if(e.osPlatform!==undefined)r.osPlatform=e.osPlatform;if(e.osRelease!==undefined)r.osRelease=e.osRelease;if(e.osVersion!==undefined)r.osVersion=e.osVersion;if(e.buildName!==undefined)r.buildName=e.buildName;if(e.buildNumber!==undefined)r.buildNumber=e.buildNumber;if(e.buildUrl!==undefined)r.buildUrl=e.buildUrl;if(e.repositoryName!==undefined)r.repositoryName=e.repositoryName;if(e.repositoryUrl!==undefined)r.repositoryUrl=e.repositoryUrl;if(e.branchName!==undefined)r.branchName=e.branchName;if(e.testEnvironment!==undefined)r.testEnvironment=e.testEnvironment;this.ctrf=new u.GenerateCtrfReport(r);wrappedOn("after:run",(()=>this.uploadResults()))}async uploadResults(){const{uploadEnabled:e=true,failOnUploadError:t=false}=this.options;if(!e){console.log("[TestreamReporter] Upload disabled, skipping upload.");return}try{const e=this.options.outputDir||"ctrf";const r=this.options.outputFile||"ctrf-report.json";const n=a.resolve(e,r);await this.waitForReportFile(n);const o=await s.readFile(n,"utf-8");const i=JSON.parse(o);i.results.tool.name="cypress";const u=await(0,l.uploadToApi)({report:i,apiKey:this.options.apiKey,commitSha:this.options.commitSha,branch:this.options.branchName,repositoryUrl:this.options.repositoryUrl,buildNumber:this.options.buildNumber,buildUrl:this.options.buildUrl,testEnvironment:this.options.testEnvironment,appName:this.options.appName,appVersion:this.options.appVersion,testType:this.options.testType||"e2e"});if(!u.success){const e=`Failed to upload test results: ${u.error}`;if(t){throw new Error(e)}else{console.error(`[TestreamReporter] ${e}`)}}}catch(e){const r=e instanceof Error?e.message:String(e);const n=`[TestreamReporter] Error uploading results: ${r}`;if(t){console.error(n);throw e}else{console.error(n)}}}}t.TestreamReporter=TestreamReporter},10:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.detectGitContext=void 0;t.uploadToApi=uploadToApi;const n=r(322);async function uploadToApi(e){const t=await(0,n.uploadTestRun)({report:e.report,apiKey:e.apiKey,apiUrl:e.apiUrl,commitSha:e.commitSha,branch:e.branch,repositoryUrl:e.repositoryUrl,buildName:e.buildName,buildNumber:e.buildNumber,buildUrl:e.buildUrl,testEnvironment:e.testEnvironment,appName:e.appName,appVersion:e.appVersion,testType:e.testType});if(!t.success||t.alreadyExists){return t}let r=0;if(t.testResults){const o=(0,n.mapAttachmentsToTestResults)(e.report.results.tests,t.testResults);if(o.length>0){r=await(0,n.uploadArtifacts)({reportId:t.reportId,apiKey:e.apiKey,apiUrl:e.apiUrl,testResults:o})}}return{...t,artifactCount:r}}t.detectGitContext=n.detectCIContext},896:e=>{e.exports=require("fs")},943:e=>{e.exports=require("fs/promises")},928:e=>{e.exports=require("path")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var o=t[r]={exports:{}};var i=true;try{e[r].call(o.exports,o,o.exports,__nccwpck_require__);i=false}finally{if(i)delete t[r]}return o.exports}(()=>{var e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;var t;__nccwpck_require__.t=function(r,n){if(n&1)r=this(r);if(n&8)return r;if(typeof r==="object"&&r){if(n&4&&r.__esModule)return r;if(n&16&&typeof r.then==="function")return r}var o=Object.create(null);__nccwpck_require__.r(o);var i={};t=t||[null,e({}),e([]),e(e)];for(var s=n&2&&r;typeof s=="object"&&!~t.indexOf(s);s=e(s)){Object.getOwnPropertyNames(s).forEach((e=>i[e]=()=>r[e]))}i["default"]=()=>r;__nccwpck_require__.d(o,i);return o}})();(()=>{__nccwpck_require__.d=(e,t)=>{for(var r in t){if(__nccwpck_require__.o(t,r)&&!__nccwpck_require__.o(e,r)){Object.defineProperty(e,r,{enumerable:true,get:t[r]})}}}})();(()=>{__nccwpck_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})();(()=>{__nccwpck_require__.r=e=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r={};(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:true});e.detectGitContext=e.uploadToApi=e.detectCypressVersion=e.TestreamReporter=void 0;var t=__nccwpck_require__(665);Object.defineProperty(e,"TestreamReporter",{enumerable:true,get:function(){return t.TestreamReporter}});var n=__nccwpck_require__(481);Object.defineProperty(e,"detectCypressVersion",{enumerable:true,get:function(){return n.detectCypressVersion}});var o=__nccwpck_require__(10);Object.defineProperty(e,"uploadToApi",{enumerable:true,get:function(){return o.uploadToApi}});var i=__nccwpck_require__(322);Object.defineProperty(e,"detectGitContext",{enumerable:true,get:function(){return i.detectCIContext}})})();module.exports=r})();
|
|
1
|
+
(()=>{"use strict";var e={301:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.GenerateCtrfReport=void 0;const n=r(896);const o=r(928);class GenerateCtrfReport{constructor(e){var t,r,o,i,s,a,u,l,d,p,c,f,m,h,y,_,b,v,R,T;this.reporterName="cypress-ctrf-json-reporter";this.defaultOutputFile="ctrf-report.json";this.defaultOutputDir="ctrf";this.runStart=0;this.runStop=0;this.filename=this.defaultOutputFile;this.browser="";this.reporterConfigOptions={on:e.on,outputFile:(t=e===null||e===void 0?void 0:e.outputFile)!==null&&t!==void 0?t:this.defaultOutputFile,outputDir:(r=e===null||e===void 0?void 0:e.outputDir)!==null&&r!==void 0?r:this.defaultOutputDir,minimal:(o=e===null||e===void 0?void 0:e.minimal)!==null&&o!==void 0?o:false,screenshot:(i=e===null||e===void 0?void 0:e.screenshot)!==null&&i!==void 0?i:false,testType:(s=e===null||e===void 0?void 0:e.testType)!==null&&s!==void 0?s:"e2e",appName:(a=e===null||e===void 0?void 0:e.appName)!==null&&a!==void 0?a:undefined,appVersion:(u=e===null||e===void 0?void 0:e.appVersion)!==null&&u!==void 0?u:undefined,osPlatform:(l=e===null||e===void 0?void 0:e.osPlatform)!==null&&l!==void 0?l:undefined,osRelease:(d=e===null||e===void 0?void 0:e.osRelease)!==null&&d!==void 0?d:undefined,osVersion:(p=e===null||e===void 0?void 0:e.osVersion)!==null&&p!==void 0?p:undefined,buildName:(c=e===null||e===void 0?void 0:e.buildName)!==null&&c!==void 0?c:undefined,buildNumber:(f=e===null||e===void 0?void 0:e.buildNumber)!==null&&f!==void 0?f:undefined,buildUrl:(m=e===null||e===void 0?void 0:e.buildUrl)!==null&&m!==void 0?m:undefined,repositoryName:(h=e===null||e===void 0?void 0:e.repositoryName)!==null&&h!==void 0?h:undefined,repositoryUrl:(y=e===null||e===void 0?void 0:e.repositoryUrl)!==null&&y!==void 0?y:undefined,branchName:(_=e===null||e===void 0?void 0:e.branchName)!==null&&_!==void 0?_:undefined,testEnvironment:(b=e===null||e===void 0?void 0:e.testEnvironment)!==null&&b!==void 0?b:undefined};this.ctrfReport={results:{tool:{name:"cypress"},summary:{tests:0,passed:0,failed:0,pending:0,skipped:0,other:0,start:0,stop:0},tests:[]}};this.validateOptions();if(this.reporterConfigOptions.outputFile!==undefined)this.setFilename(this.reporterConfigOptions.outputFile);this.ctrfEnvironment={};if(((v=this.reporterConfigOptions)===null||v===void 0?void 0:v.outputFile)!==undefined)this.setFilename(this.reporterConfigOptions.outputFile);if(!n.existsSync((R=this.reporterConfigOptions.outputDir)!==null&&R!==void 0?R:this.defaultOutputDir)){n.mkdirSync((T=this.reporterConfigOptions.outputDir)!==null&&T!==void 0?T:this.defaultOutputDir,{recursive:true})}this.setEventHandlers()}setFilename(e){if(e.endsWith(".json")){this.filename=e}else{this.filename=`${e}.json`}}validateOptions(){if(this.reporterConfigOptions.on===false){throw new Error("Missing required option: on")}}setEventHandlers(){this.reporterConfigOptions.on("before:run",(e=>{var t;this.runStart=Date.now();this.browser=`${e.browser.name} ${e.browser.version}`;this.setEnvironmentDetails((t=this.reporterConfigOptions)!==null&&t!==void 0?t:{});if(this.hasEnvironmentDetails(this.ctrfEnvironment)){this.ctrfReport.results.environment=this.ctrfEnvironment}}));this.reporterConfigOptions.on("after:spec",((e,t)=>{this.updateCtrfResultsFromAfterSpecResults(t)}));this.reporterConfigOptions.on("after:run",(e=>{this.runStop=Date.now();this.updateCtrfTotalsFromAfterRun(e);this.writeReportToFile(this.ctrfReport)}))}updateCtrfResultsFromAfterSpecResults(e){e.tests.forEach((t=>{var r,n,o,i,s,a;const u=(r=t.attempts)===null||r===void 0?void 0:r[t.attempts.length-1];const l=typeof t.duration==="number"?t.duration:(n=u===null||u===void 0?void 0:u.wallClockDuration)!==null&&n!==void 0?n:0;const d=(i=(o=t.attempts)===null||o===void 0?void 0:o.length)!==null&&i!==void 0?i:0;const p=t.state==="passed"&&d>1;const c={name:t.title.join(" "),status:t.state,duration:l};if(this.reporterConfigOptions.minimal===false){if(t.state==="failed"){const e=this.extractFailureDetails(t,u);c.message=e.message;c.trace=e.trace}c.rawStatus=t.state;c.type=(s=this.reporterConfigOptions.testType)!==null&&s!==void 0?s:"e2e";c.filePath=(a=e.spec)===null||a===void 0?void 0:a.relative;c.retries=d-1;c.flaky=p;c.browser=this.browser;const r=this.getScreenshot(t,e,false);if(r!==undefined&&typeof r==="string"){c.screenshot=r}}const f=this.getAttachments(t,e);if(f.length>0){if(c.attachments!==undefined){c.attachments=[...c.attachments,...f]}else{c.attachments=f}}this.ctrfReport.results.tests.push(c)}))}updateCtrfTotalsFromAfterRun(e){this.ctrfReport.results.summary={tests:e.totalTests,failed:e.totalFailed,passed:e.totalPassed,skipped:e.totalSkipped,pending:e.totalPending,other:0,start:this.runStart,stop:this.runStop}}setEnvironmentDetails(e){if(e.appName!==undefined){this.ctrfEnvironment.appName=e.appName}if(e.appVersion!==undefined){this.ctrfEnvironment.appVersion=e.appVersion}if(e.osPlatform!==undefined){this.ctrfEnvironment.osPlatform=e.osPlatform}if(e.osRelease!==undefined){this.ctrfEnvironment.osRelease=e.osRelease}if(e.osVersion!==undefined){this.ctrfEnvironment.osVersion=e.osVersion}if(e.buildName!==undefined){this.ctrfEnvironment.buildName=e.buildName}if(e.buildNumber!==undefined){this.ctrfEnvironment.buildNumber=e.buildNumber}if(e.buildUrl!==undefined){this.ctrfEnvironment.buildUrl=e.buildUrl}if(e.repositoryName!==undefined){this.ctrfEnvironment.repositoryName=e.repositoryName}if(e.repositoryUrl!==undefined){this.ctrfEnvironment.repositoryUrl=e.repositoryUrl}if(e.branchName!==undefined){this.ctrfEnvironment.branchName=e.branchName}if(e.testEnvironment!==undefined){this.ctrfEnvironment.testEnvironment=e.testEnvironment}}hasEnvironmentDetails(e){return Object.keys(e).length>0}extractFailureDetails(e,t){const r={};if((t===null||t===void 0?void 0:t.error)!==undefined&&(t===null||t===void 0?void 0:t.error)!==null&&"message"in t.error&&"stack"in t.error){r.message=t.error.message;r.trace=t.error.stack}else if(typeof e.displayError==="string"&&e.displayError.trim().length>0){r.message=e.displayError;r.trace=e.displayError}return r}getScreenshot(e,t,r=false){if(this.reporterConfigOptions.screenshot===false&&!r){return undefined}if(t.screenshots===undefined||t.screenshots.length===0){return undefined}const o=t.screenshots.filter((t=>t.path!==undefined&&t.path!==""&&t.path.includes(e.title.join(" -- "))));if(o.length===0){return undefined}if(r){return o.map((e=>({name:"screenshot",contentType:"image/png",path:e.path})))}let i=o.find((e=>e.path.includes("(failed)")));if(i===undefined&&o.length>0){i=o[o.length-1]}if(i!==undefined){try{const e=n.readFileSync(i.path,{encoding:"base64"});return e}catch(e){console.warn(`Error reading screenshot file ${i.path}:`,e);return undefined}}return undefined}getAttachments(e,t){const r=[];if(t.screenshots!==undefined&&t.screenshots.length>0){try{const n=this.getScreenshot(e,t,true);if(n!==undefined&&Array.isArray(n)){r.push(...n)}}catch(e){console.error("Error processing screenshot attachments:",e)}}if(t.video!==undefined&&t.video!==null&&t.video.trim()!==""){try{if(n.existsSync(t.video)){r.push({name:"video",contentType:"video/mp4",path:t.video})}else{console.warn(`Video file not found: ${t.video}`)}}catch(e){console.warn("Error processing video attachment:",e)}}return r}writeReportToFile(e){var t,r;const i=o.join((t=this.reporterConfigOptions.outputDir)!==null&&t!==void 0?t:this.defaultOutputDir,(r=this.reporterConfigOptions.outputFile)!==null&&r!==void 0?r:this.defaultOutputFile);const s=JSON.stringify(e,null,2);try{n.writeFileSync(i,s+"\n");console.log(`${this.reporterName}: successfully written ctrf json to %s/%s`,this.reporterConfigOptions.outputDir,this.reporterConfigOptions.outputFile)}catch(e){console.error(`Error writing ctrf json report:, ${String(e)}`)}}}t.GenerateCtrfReport=GenerateCtrfReport},641:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.GenerateCtrfReport=void 0;var n=r(301);Object.defineProperty(t,"GenerateCtrfReport",{enumerable:true,get:function(){return n.GenerateCtrfReport}})},406:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.detectCIContext=detectCIContext;function detectCIContext(){const e=process.env;if(e.GITHUB_ACTIONS==="true"){return{branch:e.GITHUB_HEAD_REF||e.GITHUB_REF_NAME||e.GITHUB_REF?.replace("refs/heads/",""),commitSha:e.GITHUB_SHA,repositoryUrl:e.GITHUB_SERVER_URL&&e.GITHUB_REPOSITORY?`${e.GITHUB_SERVER_URL}/${e.GITHUB_REPOSITORY}`:undefined,buildNumber:e.GITHUB_RUN_NUMBER,buildUrl:e.GITHUB_SERVER_URL&&e.GITHUB_REPOSITORY&&e.GITHUB_RUN_ID?`${e.GITHUB_SERVER_URL}/${e.GITHUB_REPOSITORY}/actions/runs/${e.GITHUB_RUN_ID}`:undefined}}if(e.GITLAB_CI==="true"){return{branch:e.CI_COMMIT_BRANCH||e.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME,commitSha:e.CI_COMMIT_SHA,repositoryUrl:e.CI_PROJECT_URL,buildNumber:e.CI_PIPELINE_IID,buildUrl:e.CI_PIPELINE_URL}}if(e.TF_BUILD==="True"){return{branch:e.BUILD_SOURCEBRANCH?.replace("refs/heads/",""),commitSha:e.BUILD_SOURCEVERSION,repositoryUrl:e.BUILD_REPOSITORY_URI,buildNumber:e.BUILD_BUILDNUMBER,buildUrl:e.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI&&e.SYSTEM_TEAMPROJECT&&e.BUILD_BUILDID?`${e.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI}${e.SYSTEM_TEAMPROJECT}/_build/results?buildId=${e.BUILD_BUILDID}`:undefined}}if(e.CIRCLECI==="true"){return{branch:e.CIRCLE_BRANCH,commitSha:e.CIRCLE_SHA1,repositoryUrl:e.CIRCLE_REPOSITORY_URL,buildNumber:e.CIRCLE_BUILD_NUM,buildUrl:e.CIRCLE_BUILD_URL}}if(e.JENKINS_URL){return{branch:e.GIT_BRANCH?.replace("origin/",""),commitSha:e.GIT_COMMIT,repositoryUrl:e.GIT_URL,buildNumber:e.BUILD_NUMBER,buildUrl:e.BUILD_URL}}if(e.BITBUCKET_BUILD_NUMBER){return{branch:e.BITBUCKET_BRANCH,commitSha:e.BITBUCKET_COMMIT,repositoryUrl:e.BITBUCKET_GIT_HTTP_ORIGIN,buildNumber:e.BITBUCKET_BUILD_NUMBER,buildUrl:e.BITBUCKET_REPO_FULL_NAME&&e.BITBUCKET_BUILD_NUMBER?`https://bitbucket.org/${e.BITBUCKET_REPO_FULL_NAME}/pipelines/results/${e.BITBUCKET_BUILD_NUMBER}`:undefined}}return{}}},827:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true})},322:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;var o=Object.getOwnPropertyDescriptor(t,r);if(!o||("get"in o?!t.__esModule:o.writable||o.configurable)){o={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,n,o)}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var o=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))n(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});t.ensureReportId=t.mapAttachmentsToTestResults=t.uploadArtifacts=t.uploadTestRun=t.detectCIContext=void 0;o(r(827),t);var i=r(406);Object.defineProperty(t,"detectCIContext",{enumerable:true,get:function(){return i.detectCIContext}});var s=r(969);Object.defineProperty(t,"uploadTestRun",{enumerable:true,get:function(){return s.uploadTestRun}});Object.defineProperty(t,"uploadArtifacts",{enumerable:true,get:function(){return s.uploadArtifacts}});Object.defineProperty(t,"mapAttachmentsToTestResults",{enumerable:true,get:function(){return s.mapAttachmentsToTestResults}});Object.defineProperty(t,"ensureReportId",{enumerable:true,get:function(){return s.ensureReportId}})},969:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.ensureReportId=ensureReportId;t.uploadTestRun=uploadTestRun;t.mapAttachmentsToTestResults=mapAttachmentsToTestResults;t.uploadArtifacts=uploadArtifacts;const n=r(406);const o="https://test-manager-backend.fly.dev";function ensureReportId(e){if(typeof e.reportId==="string"&&e.reportId.trim().length>0){return e.reportId}const t=crypto.randomUUID();e.reportId=t;return t}function resolveApiUrl(e){const t=normalizeApiUrl(e);if(t){return t}const r=getEnvApiUrl();if(r){return r}return o}function getEnvApiUrl(){if(typeof process==="undefined"||!process?.env){return undefined}return normalizeApiUrl(process.env.TESTREAM_API_URL)}function normalizeApiUrl(e){if(!e){return undefined}const t=e.trim();if(!t){return undefined}return t.replace(/\/+$/,"")}function isReportAlreadyExistsConflict(e){return e.errorCode==="report_already_exists"}function formatUploadError(e){const t=e.detail||e.title||e.rawBody||"Unknown error";const r=e.errorCode?`, code=${e.errorCode}`:"";return`Upload failed (HTTP ${e.statusCode}${r}): ${t}`}async function parseHttpError(e){const t=await e.text();const r=e.headers.get("content-type")||"";if(r.toLowerCase().includes("json")&&t.trim().length>0){try{const r=JSON.parse(t);return{statusCode:e.status,title:r.title,detail:r.detail||r.details||r.error,errorCode:r.errorCode,rawBody:t}}catch{}}return{statusCode:e.status,rawBody:t}}function resolveUploadContext(e){const t=(0,n.detectCIContext)();return{commitSha:e.commitSha??t.commitSha,branch:e.branch??t.branch,repositoryUrl:e.repositoryUrl??t.repositoryUrl,buildName:e.buildName,buildNumber:e.buildNumber??t.buildNumber,buildUrl:e.buildUrl??t.buildUrl,testEnvironment:e.testEnvironment,appName:e.appName,appVersion:e.appVersion,testType:e.testType}}async function uploadTestRun(e){const{report:t,apiKey:r}=e;const n=resolveApiUrl(e.apiUrl);const o=ensureReportId(t);const i=resolveUploadContext(e);const s={report:t,reportId:o,...i};console.log("Uploading test results...");let a;try{a=await fetch(`${n}/api/v1/ingest`,{method:"POST",headers:{"X-API-KEY":r,"Content-Type":"application/json"},body:JSON.stringify(s)})}catch(e){const t=e instanceof Error?e.message:String(e);const r=`Connection failed: ${t}`;console.error(r);return{success:false,reportId:o,error:r}}if(!a.ok){const e=await parseHttpError(a);if(a.status===409&&isReportAlreadyExistsConflict(e)){console.warn("Report already exists (workflow may have been re-run)");return{success:true,reportId:o,summary:{passed:t.results.summary.passed,failed:t.results.summary.failed,skipped:t.results.summary.skipped,total:t.results.summary.tests},alreadyExists:true,statusCode:e.statusCode,errorCode:e.errorCode}}const r=formatUploadError(e);console.error(r);return{success:false,reportId:o,error:r,statusCode:e.statusCode,errorCode:e.errorCode,errorDetail:e.detail||e.rawBody}}const u=await a.json();console.log(`✓ Test results uploaded successfully`);console.log(` Report ID: ${u.reportId}`);console.log(` Test Run ID: ${u.testRunId}`);console.log(` Tests: ${u.summary.passed}/${u.summary.total} passed`);return{success:true,reportId:u.reportId,testRunId:u.testRunId,summary:{passed:u.summary.passed,failed:u.summary.failed,skipped:u.summary.skipped,total:u.summary.total},testResults:u.testResults}}function mapAttachmentsToTestResults(e,t){const r=new Map;for(const e of t){const t=r.get(e.name)??[];t.push(e.id);r.set(e.name,t)}const n=[];for(const t of e){const e=r.get(t.name);const o=e?.shift();if(!t.attachments||t.attachments.length===0){continue}if(!o){console.warn(`Skipping artifact upload: could not match test result for "${t.name}"`);continue}n.push({testResultId:o,attachments:t.attachments})}return n}async function uploadArtifacts(e){const{reportId:t,apiKey:r,testResults:n}=e;const o=resolveApiUrl(e.apiUrl);let i=0;for(const e of n){for(const n of e.attachments){try{const s=await uploadSingleArtifact({testResultId:e.testResultId,attachment:n,reportId:t,apiKey:r,apiUrl:o});if(s)i++}catch(e){const t=e instanceof Error?e.message:String(e);console.error(`Failed to upload artifact ${n.name}: ${t}`)}}}if(i>0){console.log(`✓ Uploaded ${i} artifact(s)`)}return i}async function uploadSingleArtifact(e){const{testResultId:t,attachment:n,reportId:o,apiKey:i,apiUrl:s}=e;const a=await Promise.resolve().then(r.t.bind(r,943,23));const u=await Promise.resolve().then(r.t.bind(r,928,23));const l=u.resolve(n.path);try{await a.access(l)}catch{console.warn(`Artifact not found: ${u.basename(l)}`);return false}let d;let p;const c=u.basename(l);const f=n.contentType||"application/octet-stream";try{d=await a.readFile(l);p=d.byteLength}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to read file: ${t}`)}try{return await uploadWithPresignedUrl({testResultId:t,reportId:o,apiKey:i,apiUrl:s,attachmentName:n.name,fileName:c,contentType:f,sizeBytes:p,fileBuffer:d})}catch(e){if(!(e instanceof LegacyUploadRequiredError)){throw e}return await uploadWithLegacyEndpoint({testResultId:t,attachmentName:n.name,reportId:o,apiKey:i,apiUrl:s,fileName:c,contentType:f,fileBuffer:d})}}class LegacyUploadRequiredError extends Error{constructor(){super("Legacy upload endpoint required")}}async function uploadWithPresignedUrl(e){const{testResultId:t,reportId:r,apiKey:n,apiUrl:o,attachmentName:i,fileName:s,contentType:a,sizeBytes:u,fileBuffer:l}=e;const d={testResultId:t,ctrfAttachmentName:i,fileName:s,contentType:a,sizeBytes:u};const p=await fetch(`${o}/api/v1/artifacts/${r}/upload-url`,{method:"POST",headers:{"X-API-KEY":n,"Content-Type":"application/json"},body:JSON.stringify(d)});if(shouldFallbackToLegacyUpload(p.status)){throw new LegacyUploadRequiredError}if(!p.ok){const e=await p.text();throw new Error(`Failed to create direct upload URL (HTTP ${p.status}): ${e}`)}const c=await p.json();const f={...c.requiredHeaders??{}};if(!hasHeaderIgnoreCase(f,"Content-Type")){f["Content-Type"]=a}const m=await fetch(c.uploadUrl,{method:"PUT",headers:f,body:l});if(!m.ok){const e=await m.text();throw new Error(`Direct artifact upload failed (HTTP ${m.status}): ${e}`)}const h={testResultId:t,ctrfAttachmentName:i,fileName:s,contentType:a,sizeBytes:u,storageKey:c.storageKey};const y=await fetch(`${o}/api/v1/artifacts/${r}/complete`,{method:"POST",headers:{"X-API-KEY":n,"Content-Type":"application/json"},body:JSON.stringify(h)});if(!y.ok){const e=await y.text();throw new Error(`Failed to finalize artifact upload (HTTP ${y.status}): ${e}`)}return true}async function uploadWithLegacyEndpoint(e){const{testResultId:t,attachmentName:r,reportId:n,apiKey:o,apiUrl:i,fileName:s,contentType:a,fileBuffer:u}=e;const l=new Blob([new Uint8Array(u)],{type:a});const d=new FormData;d.append("testResultId",t);d.append("ctrfAttachmentName",r);d.append("file",l,s);const p=await fetch(`${i}/api/v1/artifacts/${n}`,{method:"POST",headers:{"X-API-KEY":o},body:d});if(!p.ok){const e=await p.text();throw new Error(`Legacy artifact upload failed (HTTP ${p.status}): ${e}`)}return true}function shouldFallbackToLegacyUpload(e){return e===404||e===405||e===501}function hasHeaderIgnoreCase(e,t){const r=t.toLowerCase();return Object.keys(e).some((e=>e.toLowerCase()===r))}},481:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;var o=Object.getOwnPropertyDescriptor(t,r);if(!o||("get"in o?!t.__esModule:o.writable||o.configurable)){o={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,n,o)}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__importStar||function(){var ownKeys=function(e){ownKeys=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r))t[t.length]=r;return t};return ownKeys(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=ownKeys(e),i=0;i<r.length;i++)if(r[i]!=="default")n(t,e,r[i]);o(t,e);return t}}();Object.defineProperty(t,"__esModule",{value:true});t.detectCypressVersion=detectCypressVersion;const s=i(r(943));const a=i(r(928));async function detectCypressVersion(e){try{const t=a.join(e||process.cwd(),"package.json");const r=JSON.parse(await s.readFile(t,"utf-8"));const n=r.dependencies?.cypress||r.devDependencies?.cypress;if(n){return n.replace(/^[\^~]/,"")}}catch{}return undefined}},665:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;var o=Object.getOwnPropertyDescriptor(t,r);if(!o||("get"in o?!t.__esModule:o.writable||o.configurable)){o={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,n,o)}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__importStar||function(){var ownKeys=function(e){ownKeys=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r))t[t.length]=r;return t};return ownKeys(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=ownKeys(e),i=0;i<r.length;i++)if(r[i]!=="default")n(t,e,r[i]);o(t,e);return t}}();Object.defineProperty(t,"__esModule",{value:true});t.TestreamReporter=void 0;const s=i(r(943));const a=i(r(928));const u=r(641);const l=r(10);class TestreamReporter{async waitForReportFile(e,t=6e4,r=250){const n=Date.now();while(Date.now()-n<t){try{await s.access(e);return}catch{await new Promise((e=>setTimeout(e,r)))}}throw new Error(`CTRF report not found at ${e} after ${t}ms`)}constructor(e){this.options=e;if(!e.apiKey||e.apiKey.trim()===""){throw new Error("[TestreamReporter] API key is required. Please provide apiKey in TestreamReporterOptions or set TESTREAM_API_KEY environment variable.")}const t={};const wrappedOn=(r,n)=>{if(!t[r]){t[r]=[];e.on(r,(async(...e)=>{const n=t[r].map((t=>t(...e)));await Promise.all(n)}))}t[r].push(n)};const r={on:wrappedOn};if(e.outputDir!==undefined)r.outputDir=e.outputDir;if(e.outputFile!==undefined)r.outputFile=e.outputFile;if(e.minimal!==undefined)r.minimal=e.minimal;r.screenshot=e.screenshot??true;if(e.annotations!==undefined)r.annotations=e.annotations;if(e.testType!==undefined)r.testType=e.testType;if(e.appName!==undefined)r.appName=e.appName;if(e.appVersion!==undefined)r.appVersion=e.appVersion;if(e.osPlatform!==undefined)r.osPlatform=e.osPlatform;if(e.osRelease!==undefined)r.osRelease=e.osRelease;if(e.osVersion!==undefined)r.osVersion=e.osVersion;if(e.buildName!==undefined)r.buildName=e.buildName;if(e.buildNumber!==undefined)r.buildNumber=e.buildNumber;if(e.buildUrl!==undefined)r.buildUrl=e.buildUrl;if(e.repositoryName!==undefined)r.repositoryName=e.repositoryName;if(e.repositoryUrl!==undefined)r.repositoryUrl=e.repositoryUrl;if(e.branchName!==undefined)r.branchName=e.branchName;if(e.testEnvironment!==undefined)r.testEnvironment=e.testEnvironment;this.ctrf=new u.GenerateCtrfReport(r);wrappedOn("after:run",(()=>this.uploadResults()))}async uploadResults(){const{uploadEnabled:e=true,failOnUploadError:t=false}=this.options;if(!e){console.log("[TestreamReporter] Upload disabled, skipping upload.");return}try{const e=this.options.outputDir||"ctrf";const r=this.options.outputFile||"ctrf-report.json";const n=a.resolve(e,r);await this.waitForReportFile(n);const o=await s.readFile(n,"utf-8");const i=JSON.parse(o);i.results.tool.name="cypress";i.generatedBy="@testream/cypress-reporter";const u=await(0,l.uploadToApi)({report:i,apiKey:this.options.apiKey,commitSha:this.options.commitSha,branch:this.options.branchName,repositoryUrl:this.options.repositoryUrl,buildNumber:this.options.buildNumber,buildUrl:this.options.buildUrl,testEnvironment:this.options.testEnvironment,appName:this.options.appName,appVersion:this.options.appVersion,testType:this.options.testType||"e2e"});if(!u.success){const e=`Failed to upload test results: ${u.error}`;if(t){throw new Error(e)}else{console.error(`[TestreamReporter] ${e}`)}}}catch(e){const r=e instanceof Error?e.message:String(e);const n=`[TestreamReporter] Error uploading results: ${r}`;if(t){console.error(n);throw e}else{console.error(n)}}}}t.TestreamReporter=TestreamReporter},10:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.detectGitContext=void 0;t.uploadToApi=uploadToApi;const n=r(322);async function uploadToApi(e){const t=await(0,n.uploadTestRun)({report:e.report,apiKey:e.apiKey,apiUrl:e.apiUrl,commitSha:e.commitSha,branch:e.branch,repositoryUrl:e.repositoryUrl,buildName:e.buildName,buildNumber:e.buildNumber,buildUrl:e.buildUrl,testEnvironment:e.testEnvironment,appName:e.appName,appVersion:e.appVersion,testType:e.testType});if(!t.success||t.alreadyExists){return t}let r=0;if(t.testResults){const o=(0,n.mapAttachmentsToTestResults)(e.report.results.tests,t.testResults);if(o.length>0){r=await(0,n.uploadArtifacts)({reportId:t.reportId,apiKey:e.apiKey,apiUrl:e.apiUrl,testResults:o})}}return{...t,artifactCount:r}}t.detectGitContext=n.detectCIContext},896:e=>{e.exports=require("fs")},943:e=>{e.exports=require("fs/promises")},928:e=>{e.exports=require("path")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var o=t[r]={exports:{}};var i=true;try{e[r].call(o.exports,o,o.exports,__nccwpck_require__);i=false}finally{if(i)delete t[r]}return o.exports}(()=>{var e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;var t;__nccwpck_require__.t=function(r,n){if(n&1)r=this(r);if(n&8)return r;if(typeof r==="object"&&r){if(n&4&&r.__esModule)return r;if(n&16&&typeof r.then==="function")return r}var o=Object.create(null);__nccwpck_require__.r(o);var i={};t=t||[null,e({}),e([]),e(e)];for(var s=n&2&&r;typeof s=="object"&&!~t.indexOf(s);s=e(s)){Object.getOwnPropertyNames(s).forEach((e=>i[e]=()=>r[e]))}i["default"]=()=>r;__nccwpck_require__.d(o,i);return o}})();(()=>{__nccwpck_require__.d=(e,t)=>{for(var r in t){if(__nccwpck_require__.o(t,r)&&!__nccwpck_require__.o(e,r)){Object.defineProperty(e,r,{enumerable:true,get:t[r]})}}}})();(()=>{__nccwpck_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})();(()=>{__nccwpck_require__.r=e=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r={};(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:true});e.detectGitContext=e.uploadToApi=e.detectCypressVersion=e.TestreamReporter=void 0;var t=__nccwpck_require__(665);Object.defineProperty(e,"TestreamReporter",{enumerable:true,get:function(){return t.TestreamReporter}});var n=__nccwpck_require__(481);Object.defineProperty(e,"detectCypressVersion",{enumerable:true,get:function(){return n.detectCypressVersion}});var o=__nccwpck_require__(10);Object.defineProperty(e,"uploadToApi",{enumerable:true,get:function(){return o.uploadToApi}});var i=__nccwpck_require__(322);Object.defineProperty(e,"detectGitContext",{enumerable:true,get:function(){return i.detectCIContext}})})();module.exports=r})();
|
package/dist/reporter.d.ts
CHANGED
|
@@ -15,11 +15,6 @@ export interface TestreamReporterOptions {
|
|
|
15
15
|
* @required
|
|
16
16
|
*/
|
|
17
17
|
apiKey: string;
|
|
18
|
-
/**
|
|
19
|
-
* Project key to associate test results with
|
|
20
|
-
* @required
|
|
21
|
-
*/
|
|
22
|
-
projectKey: string;
|
|
23
18
|
/**
|
|
24
19
|
* Git commit SHA (auto-detected from environment if not provided)
|
|
25
20
|
*/
|
|
@@ -88,7 +83,6 @@ export interface TestreamReporterOptions {
|
|
|
88
83
|
* new TestreamReporter({
|
|
89
84
|
* on,
|
|
90
85
|
* apiKey: 'your-api-key',
|
|
91
|
-
* projectKey: 'YOUR_PROJECT',
|
|
92
86
|
* uploadEnabled: true,
|
|
93
87
|
* });
|
|
94
88
|
* },
|
package/dist/reporter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,KAAK,mBAAmB,GAAG,GAAG,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,iFAAiF;IACjF,EAAE,EAAE,mBAAmB,CAAC;IAExB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,KAAK,mBAAmB,GAAG,GAAG,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,iFAAiF;IACjF,EAAE,EAAE,mBAAmB,CAAC;IAExB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAG5B,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,sBAAsB;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qBAAqB;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,IAAI,CAAqB;YAEnB,iBAAiB;gBAenB,OAAO,EAAE,uBAAuB;IAiE5C;;OAEG;YACW,aAAa;CA4D5B"}
|
package/dist/types.d.ts
CHANGED
|
@@ -46,11 +46,6 @@ export interface CypressReporterConfig {
|
|
|
46
46
|
* @required
|
|
47
47
|
*/
|
|
48
48
|
apiKey: string;
|
|
49
|
-
/**
|
|
50
|
-
* Project key to associate test results with
|
|
51
|
-
* @required
|
|
52
|
-
*/
|
|
53
|
-
projectKey: string;
|
|
54
49
|
/**
|
|
55
50
|
* Path to Cypress project directory
|
|
56
51
|
* If not provided, uses current directory
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC;QACd,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;QACvC,KAAK,CAAC,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;YAChB,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QACF,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC,CAAC;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC;QACd,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;QACvC,KAAK,CAAC,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;YAChB,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QACF,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC,CAAC;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAEvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|