@curl-runner/cli 1.23.1 → 1.23.2

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.js CHANGED
@@ -151,7 +151,7 @@ __CURL_BATCH_${Z}_START__%{json}__CURL_BATCH_${Z}_END__
151
151
  `)}stringify(Z){if(Z===void 0)return"undefined";if(Z===null)return"null";if(typeof Z==="string")return`"${Z}"`;if(typeof Z==="object"){let X=JSON.stringify(Z);if(X.length>80)return`${X.slice(0,77)}...`;return X}return String(Z)}formatSummary(Z){let X=[];if(Z.passed>0)X.push(this.color(`${Z.passed} passed`,"green"));if(Z.failed>0)X.push(this.color(`${Z.failed} failed`,"red"));if(Z.updated>0)X.push(this.color(`${Z.updated} updated`,"yellow"));if(Z.created>0)X.push(this.color(`${Z.created} created`,"cyan"));if(X.length===0)return"";return`Snapshots: ${X.join(", ")}`}}function d1(Z,X){if(Z.length===0)return 0;if(Z.length===1)return Z[0];let J=X/100*(Z.length-1),W=Math.floor(J),$=Math.ceil(J),G=J-W;if(W===$)return Z[W];return Z[W]*(1-G)+Z[$]*G}function W2(Z){if(Z.length===0)return 0;return Z.reduce((X,J)=>X+J,0)/Z.length}function $2(Z,X){if(Z.length<=1)return 0;let W=Z.map(($)=>($-X)**2).reduce(($,G)=>$+G,0)/Z.length;return Math.sqrt(W)}function t9(Z,X,J){let W=Z.slice(X),$=[...W].sort((z,H)=>z-H),G=W2($),Q=Z.length;return{iterations:W.length,warmup:X,min:$.length>0?$[0]:0,max:$.length>0?$[$.length-1]:0,mean:Math.round(G*100)/100,median:Math.round(d1($,50)*100)/100,p50:Math.round(d1($,50)*100)/100,p95:Math.round(d1($,95)*100)/100,p99:Math.round(d1($,99)*100)/100,stdDev:Math.round($2($,G)*100)/100,failures:J,failureRate:Q>0?Math.round(J/Q*1e4)/100:0,timings:W}}function e9(Z,X=10,J=40){if(Z.length===0)return["No data"];let W=Math.min(...Z),Q=(Math.max(...Z)-W||1)/X,Y=Array(X).fill(0);for(let K of Z){let B=Math.min(Math.floor((K-W)/Q),X-1);Y[B]++}let z=Math.max(...Y),H=[];for(let K=0;K<X;K++){let B=W+K*Q,M=W+(K+1)*Q,R=z>0?Math.round(Y[K]/z*J):0,_="\u2588".repeat(R),O=`${B.toFixed(0).padStart(6)}ms - ${M.toFixed(0).padStart(6)}ms`;H.push(`${O} \u2502${_} ${Y[K]}`)}return H}function Z4(Z,X){let J=["iteration","latency_ms"],W=Z.timings.map(($,G)=>`${G+1},${$}`);return[J.join(","),...W].join(`
152
152
  `)}function X4(Z,X){return JSON.stringify({request:X,summary:{iterations:Z.iterations,warmup:Z.warmup,failures:Z.failures,failureRate:Z.failureRate,min:Z.min,max:Z.max,mean:Z.mean,median:Z.median,p50:Z.p50,p95:Z.p95,p99:Z.p99,stdDev:Z.stdDev},timings:Z.timings},null,2)}class a{config;redactor=x1();constructor(Z={}){this.config={verbose:!1,showHeaders:!1,showBody:!0,showMetrics:!1,format:"pretty",prettyLevel:"minimal",...Z}}redact(Z){return this.redactor.redact(Z)}color(Z,X){return i(Z,X)}shouldShowOutput(){if(this.config.format==="raw")return!1;if(this.config.format==="pretty")return!0;return this.config.verbose!==!1}shouldShowHeaders(){if(this.config.format!=="pretty")return this.config.showHeaders||!1;switch(this.config.prettyLevel||"standard"){case"minimal":return!1;case"standard":return this.config.showHeaders||!1;case"detailed":return!0;default:return this.config.showHeaders||!1}}shouldShowBody(){if(this.config.format!=="pretty")return this.config.showBody!==!1;switch(this.config.prettyLevel||"standard"){case"minimal":return!1;case"standard":return this.config.showBody!==!1;case"detailed":return!0;default:return this.config.showBody!==!1}}shouldShowMetrics(){if(this.config.format!=="pretty")return this.config.showMetrics||!1;switch(this.config.prettyLevel||"standard"){case"minimal":return!1;case"standard":return this.config.showMetrics||!1;case"detailed":return!0;default:return this.config.showMetrics||!1}}shouldShowRequestDetails(){if(this.config.format!=="pretty")return this.config.verbose||!1;switch(this.config.prettyLevel||"standard"){case"minimal":return!1;case"standard":return this.config.verbose||!1;case"detailed":return!0;default:return this.config.verbose||!1}}shouldShowSeparators(){if(this.config.format!=="pretty")return!0;switch(this.config.prettyLevel||"standard"){case"minimal":return!1;case"standard":return!0;case"detailed":return!0;default:return!0}}colorStatusCode(Z){return this.color(Z,"yellow")}logValidationErrors(Z){let X=Z.split("; ");if(X.length===1){let J=X[0].trim(),W=J.match(/^Expected status (.+?), got (.+)$/);if(W){let[,$,G]=W,Q=this.colorStatusCode($.replace(" or ","|")),Y=this.color(G,"red");console.log(` ${this.color("\u2717","red")} ${this.color("Error:","red")} Expected ${this.color("status","yellow")} ${Q}, got ${Y}`)}else console.log(` ${this.color("\u2717","red")} ${this.color("Error:","red")} ${J}`)}else{console.log(` ${this.color("\u2717","red")} ${this.color("Validation Errors:","red")}`);for(let J of X){let W=J.trim();if(W)if(W.startsWith("Expected ")){let $=W.match(/^Expected status (.+?), got (.+)$/);if($){let[,G,Q]=$,Y=this.colorStatusCode(G.replace(" or ","|")),z=this.color(Q,"red");console.log(` ${this.color("\u2022","red")} ${this.color("status","yellow")}: expected ${Y}, got ${z}`)}else{let G=W.match(/^Expected (.+?) to be (.+?), got (.+)$/);if(G){let[,Q,Y,z]=G;console.log(` ${this.color("\u2022","red")} ${this.color(Q,"yellow")}: expected ${this.color(Y,"green")}, got ${this.color(z,"red")}`)}else console.log(` ${this.color("\u2022","red")} ${W}`)}}else console.log(` ${this.color("\u2022","red")} ${W}`)}}}logExecutionStart(Z,X){if(!this.shouldShowOutput())return;if(this.shouldShowSeparators())console.log(),console.log(this.color(`Executing ${Z} request(s) in ${X} mode`,"dim")),console.log();else console.log()}logRequestStart(Z,X){return}logCommand(Z){if(this.config.dryRun||this.shouldShowRequestDetails())console.log(this.color(" Command:","dim")),console.log(this.color(` ${this.redact(Z)}`,"dim"))}logRetry(Z,X){console.log(this.color(` \u21BB Retry ${Z}/${X}...`,"yellow"))}logRequestComplete(Z){if(this.config.format==="raw"){if(Z.success&&this.config.showBody&&Z.body){let Y=y1(Z.body,this.config.format);console.log(Y)}return}if(this.config.format==="json"){let Y={request:{name:Z.request.name,url:this.redact(Z.request.url),method:Z.request.method||"GET"},success:Z.success,...Z.dryRun?{dryRun:!0}:{status:Z.status},...this.shouldShowHeaders()&&Z.headers?{headers:Z.headers}:{},...this.shouldShowBody()&&Z.body?{body:Z.body}:{},...Z.error?{error:Z.error}:{},...this.shouldShowMetrics()&&Z.metrics?{metrics:Z.metrics}:{}};console.log(JSON.stringify(Y,null,2));return}if(!this.shouldShowOutput())return;let X=this.config.prettyLevel||"minimal",J=Z.success?"green":"red",W=Z.success?"\u2713":"x",$=Z.request.name||"Request";if(X==="minimal"){let Y=Z.request.sourceFile?h0(Z.request.sourceFile):"inline";console.log(`${this.color(W,J)} ${this.color($,"bright")} [${Y}]`);let z=[],H=new H1;z.push({label:Z.request.method||"GET",value:this.redact(Z.request.url),color:"blue"});let K=Z.dryRun?"DRY-RUN":Z.status?`${Z.status}`:"ERROR";if(z.push({label:`${W} Status`,value:K,color:Z.dryRun?"cyan":J}),Z.metrics){let B=`${u(Z.metrics.duration)} | ${v1(Z.metrics.size)}`;z.push({label:"Duration",value:B,color:"cyan"})}if(H.render(z),Z.error)console.log(),this.logValidationErrors(Z.error);if(Z.snapshotResult)console.log(),this.logSnapshotResult(Z.request.name||"Request",Z.snapshotResult);console.log();return}console.log(`${this.color(W,J)} ${this.color($,"bright")}`);let G=[],Q=new H1;if(G.push({label:"URL",value:this.redact(Z.request.url),color:"blue"}),G.push({label:"Method",value:Z.request.method||"GET",color:"yellow"}),G.push({label:"Status",value:Z.dryRun?"DRY-RUN":String(Z.status||"ERROR"),color:Z.dryRun?"cyan":J}),Z.metrics)G.push({label:"Duration",value:u(Z.metrics.duration),color:"cyan"});if(this.shouldShowHeaders()&&Z.headers&&Object.keys(Z.headers).length>0){let Y=Object.entries(Z.headers).map(([z,H])=>({label:this.color(z,"dim"),value:String(H)}));G.push({label:"Headers",children:Y})}if(this.shouldShowBody()&&Z.body){let z=y1(Z.body,this.config.format).split(`
153
153
  `),H=this.shouldShowRequestDetails()?1/0:10,K=z.slice(0,H);if(z.length>H)K.push(this.color(`... (${z.length-H} more lines)`,"dim"));G.push({label:"Response Body",value:K.join(`
154
- `)})}if(this.shouldShowMetrics()&&Z.metrics&&X==="detailed"){let Y=Z.metrics,z=[];if(z.push({label:"Request Duration",value:u(Y.duration),color:"cyan"}),Y.size!==void 0)z.push({label:"Response Size",value:v1(Y.size),color:"cyan"});if(Y.dnsLookup)z.push({label:"DNS Lookup",value:u(Y.dnsLookup),color:"cyan"});if(Y.tcpConnection)z.push({label:"TCP Connection",value:u(Y.tcpConnection),color:"cyan"});if(Y.tlsHandshake)z.push({label:"TLS Handshake",value:u(Y.tlsHandshake),color:"cyan"});if(Y.firstByte)z.push({label:"Time to First Byte",value:u(Y.firstByte),color:"cyan"});G.push({label:"Metrics",children:z})}if(Q.render(G),Z.error)console.log(),this.logValidationErrors(Z.error);if(Z.snapshotResult)console.log(),this.logSnapshotResult(Z.request.name||"Request",Z.snapshotResult);console.log()}logSnapshotResult(Z,X){if(!X)return;let J=new u0;console.log(J.formatResult(Z,X))}logSummary(Z,X=!1){if(this.config.format==="raw")return;if(this.config.format==="json"){let z={summary:{total:Z.total,successful:Z.successful,failed:Z.failed,skipped:Z.skipped,duration:Z.duration},results:Z.results.map((H)=>({request:{name:H.request.name,url:this.redact(H.request.url),method:H.request.method||"GET"},success:H.success,...H.dryRun?{dryRun:!0}:{status:H.status},...this.shouldShowHeaders()&&H.headers?{headers:H.headers}:{},...this.shouldShowBody()&&H.body?{body:H.body}:{},...H.error?{error:H.error}:{},...this.shouldShowMetrics()&&H.metrics?{metrics:H.metrics}:{}}))};console.log(JSON.stringify(z,null,2));return}if(!this.shouldShowOutput())return;let J=this.config.prettyLevel||"minimal";if(X)console.log();if(J==="minimal"){let z=Z.failed===0?"green":"red",H=Z.skipped>0?`, ${Z.skipped} skipped`:"",K=Z.failed===0?`${Z.total} request${Z.total===1?"":"s"} completed successfully${H}`:`${Z.successful}/${Z.total} request${Z.total===1?"":"s"} completed, ${Z.failed} failed${H}`;console.log(`${X?"\u25C6 Global Summary":"Summary"}: ${this.color(K,z)}`);return}let W=(Z.successful/Z.total*100).toFixed(1),$=Z.failed===0?"green":"red",G=Z.skipped>0?`, ${Z.skipped} skipped`:"",Q=Z.failed===0?`${Z.total} request${Z.total===1?"":"s"} completed successfully${G}`:`${Z.successful}/${Z.total} request${Z.total===1?"":"s"} completed, ${Z.failed} failed${G}`,Y=X?"\u25C6 Global Summary":"Summary";if(console.log(),console.log(`${Y}: ${this.color(Q,$)} (${this.color(u(Z.duration),"cyan")})`),Z.failed>0&&this.shouldShowRequestDetails())Z.results.filter((z)=>!z.success).forEach((z)=>{let H=z.request.name||this.redact(z.request.url);console.log(` ${this.color("\u2022","red")} ${H}: ${z.error||""}`)})}logError(Z){console.error(this.color(`\u2717 ${Z}`,"red"))}logWarning(Z){console.warn(this.color(`\u26A0 ${Z}`,"yellow"))}logInfo(Z){console.log(this.color(`\u2139 ${Z}`,"blue"))}logSuccess(Z){console.log(this.color(`\u2713 ${Z}`,"green"))}logSkipped(Z,X,J){if(!this.shouldShowOutput())return;let W=Z.name||`Request ${X}`;if(this.config.format==="json"){let $={request:{name:Z.name,url:this.redact(Z.url),method:Z.method||"GET"},skipped:!0,reason:J||"condition not met"};console.log(JSON.stringify($,null,2));return}if(console.log(`${this.color("\u2298","yellow")} ${this.color(W,"bright")} ${this.color("[SKIP]","yellow")}`),J){let $=[{label:"Reason",value:J,color:"yellow"}];new H1().render($)}console.log()}logFileHeader(Z,X){if(!this.shouldShowOutput()||this.config.format!=="pretty")return;let J=Z.replace(/.*\//,"").replace(".yaml","");console.log(),console.log(this.color(`\u25B6 ${J}.yaml`,"bright")+this.color(` (${X} request${X===1?"":"s"})`,"dim"))}logWatch(Z){console.log(),console.log(`${this.color("Watching for changes...","cyan")} ${this.color("(press Ctrl+C to stop)","dim")}`);let X=Z.length<=3?Z.join(", "):`${Z.length} files`;console.log(this.color(` Files: ${X}`,"dim")),console.log()}logWatchReady(){console.log(),console.log(this.color("Watching for changes...","cyan"))}logFileChanged(Z){let X=new Date().toLocaleTimeString("en-US",{hour12:!1});console.log(this.color("-".repeat(50),"dim")),console.log(`${this.color(`[${X}]`,"dim")} File changed: ${this.color(Z,"yellow")}`),console.log()}logProfileStart(Z,X,J,W){if(!this.shouldShowOutput())return;console.log(),console.log(`${this.color("\u26A1 PROFILING","magenta")} ${this.color(Z,"bright")}`),console.log(this.color(` ${X} iterations, ${J} warmup, concurrency: ${W}`,"dim"))}logProfileResult(Z,X){let{stats:J,request:W}=Z,$=W.name||W.url;if(this.config.format==="json"){console.log(JSON.stringify({request:{name:$,url:W.url,method:W.method||"GET"},stats:{iterations:J.iterations,warmup:J.warmup,failures:J.failures,failureRate:J.failureRate,min:J.min,max:J.max,mean:J.mean,median:J.median,p50:J.p50,p95:J.p95,p99:J.p99,stdDev:J.stdDev}}));return}if(this.config.format==="raw"){console.log(`${J.p50} ${J.p95} ${J.p99} ${J.mean}`);return}console.log();let G=J.failures===0?this.color("\u2713","green"):this.color("\u26A0","yellow");if(console.log(`${G} ${this.color($,"bright")}`),console.log(this.color(" \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","dim")),console.log(` \u2502 ${this.color("p50","cyan")} ${e(J.p50).padStart(10)} \u2502 ${this.color("min","dim")} ${e(J.min).padStart(10)} \u2502`),console.log(` \u2502 ${this.color("p95","yellow")} ${e(J.p95).padStart(10)} \u2502 ${this.color("max","dim")} ${e(J.max).padStart(10)} \u2502`),console.log(` \u2502 ${this.color("p99","red")} ${e(J.p99).padStart(10)} \u2502 ${this.color("mean","dim")} ${e(J.mean).padStart(10)} \u2502`),console.log(this.color(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518","dim")),console.log(this.color(` \u03C3 ${J.stdDev.toFixed(2)}ms | ${J.iterations} samples | ${J.failures} failures (${J.failureRate}%)`,"dim")),X&&J.timings.length>0){console.log(),console.log(this.color(" Distribution:","dim"));let Q=e9(J.timings,8,30);for(let Y of Q)console.log(` ${this.color(Y,"dim")}`)}}logProfileSummary(Z){if(!this.shouldShowOutput())return;let X=Z.reduce((W,$)=>W+$.stats.iterations,0),J=Z.reduce((W,$)=>W+$.stats.failures,0);if(console.log(),console.log(this.color("\u2500".repeat(50),"dim")),console.log(`${this.color("\u26A1 Profile Summary:","magenta")} ${Z.length} request${Z.length===1?"":"s"}, ${X} total iterations`),J>0)console.log(this.color(` ${J} total failures`,"yellow"))}}class l0{logger;profileConfig;constructor(Z,X){this.profileConfig=X,this.logger=new a(Z.output)}async executeSingleIteration(Z){let X=performance.now(),J=Z1.buildCommand(Z),W=await Z1.executeCurl(J);if(W.success)return{request:Z,success:!0,status:W.status,headers:W.headers,body:$1(W.body,W.headers?.["content-type"]),metrics:{...W.metrics,duration:performance.now()-X}};return{request:Z,success:!1,error:W.error,metrics:{duration:performance.now()-X}}}async executeWithConcurrency(Z,X,J){let W=[];for(let $=0;$<X;$+=J){let G=Math.min(J,X-$),Q=await Promise.all(Array.from({length:G},()=>this.executeSingleIteration(Z)));W.push(...Q)}return W}async profileRequest(Z,X=0){let J=this.profileConfig.iterations,W=this.profileConfig.warmup??1,$=this.profileConfig.concurrency??1,G=Z.name||`Request ${X+1}`;this.logger.logProfileStart(G,J,W,$);let Q=$===1?await this.executeSequentially(Z,J):await this.executeWithConcurrency(Z,J,$),Y=[],z=0;for(let B of Q)if(B.success&&B.metrics?.duration!==void 0)Y.push(B.metrics.duration);else z++,Y.push(0);let H=Y.map((B,M)=>Q[M].success?B:-1).filter((B)=>B>=0),K=t9(H,Math.min(W,H.length),z);return{request:Z,stats:K,iterations:Q}}async executeSequentially(Z,X){let J=[];for(let W=0;W<X;W++){let $=await this.executeSingleIteration(Z);J.push($)}return J}async profileRequests(Z){let X=[];for(let J=0;J<Z.length;J++){let W=await this.profileRequest(Z[J],J);X.push(W),this.logger.logProfileResult(W,this.profileConfig.histogram??!1)}return X}}function a0(Z,X){if(!X)return{success:!0};let J=[];if(X.status!==void 0){let $=J4(Z.status,X.status);J.push(...$)}if(X.headers){let $=W4(Z.headers,X.headers);J.push(...$)}if(X.body!==void 0){let $=f1(Z.body,X.body,"");J.push(...$)}if(X.responseTime!==void 0&&Z.metrics){let $=Z.metrics.duration;if(!p1($,X.responseTime))J.push(`Expected response time to match ${X.responseTime}ms, got ${$.toFixed(2)}ms`)}let W=J.length>0;if(X.failure===!0){if(W)return{success:!1,error:J.join("; ")};let $=Z.status||0;if($>=400)return{success:!0};return{success:!1,error:`Expected request to fail (4xx/5xx) but got status ${$}`}}if(W)return{success:!1,error:J.join("; ")};return{success:!0}}function J4(Z,X){let J=Array.isArray(X)?X:[X];if(!J.includes(Z||0))return[`Expected status ${J.join(" or ")}, got ${Z}`];return[]}function W4(Z,X){let J=[];for(let[W,$]of Object.entries(X)){let G=Z?.[W]||Z?.[W.toLowerCase()];if(G!==$)J.push(`Expected header ${W}="${$}", got "${G}"`)}return J}function f1(Z,X,J){let W=[];if(typeof X!=="object"||X===null){let $=L1(Z,X,J||"body");if(!$.isValid)W.push($.error);return W}if(Array.isArray(X)){if(Array.isArray(Z)){for(let G=0;G<X.length;G++){let Q=X[G],Y=`${J||"body"}[${G}]`;if(typeof Q==="object"&&Q!==null){if(!Z.some((H)=>{return f1(H,Q,Y).length===0}))W.push(`Expected ${J||"body"} to contain item matching ${JSON.stringify(Q)}, but no match found`)}else if(!Z.some((H)=>{return L1(H,Q,Y).isValid}))W.push(`Expected ${J||"body"} to contain item matching ${JSON.stringify(Q)}, but no match found`)}return W}let $=L1(Z,X,J||"body");if(!$.isValid)W.push($.error);return W}for(let[$,G]of Object.entries(X)){let Q=J?`${J}.${$}`:$,Y;if(Array.isArray(Z)&&$4($))Y=G4(Z,$);else Y=Z?.[$];if(typeof G==="object"&&G!==null){let z=f1(Y,G,Q);W.push(...z)}else{let z=L1(Y,G,Q);if(!z.isValid)W.push(z.error)}}return W}function L1(Z,X,J){if(X==="*")return{isValid:!0};if(Array.isArray(X)){if(!X.some(($)=>{if($==="*")return!0;if(typeof $==="string"&&n0($))return o0(Z,$);if(typeof $==="string"&&i0($))return p1(Z,$);return Z===$}))return{isValid:!1,error:`Expected ${J} to match one of ${JSON.stringify(X)}, got ${JSON.stringify(Z)}`};return{isValid:!0}}if(typeof X==="string"&&n0(X)){if(!o0(Z,X))return{isValid:!1,error:`Expected ${J} to match pattern ${X}, got ${JSON.stringify(Z)}`};return{isValid:!0}}if(typeof X==="string"&&i0(X)){if(!p1(Z,X))return{isValid:!1,error:`Expected ${J} to match range ${X}, got ${JSON.stringify(Z)}`};return{isValid:!0}}if(X==="null"||X===null){if(Z!==null)return{isValid:!1,error:`Expected ${J} to be null, got ${JSON.stringify(Z)}`};return{isValid:!0}}if(Z!==X)return{isValid:!1,error:`Expected ${J} to be ${JSON.stringify(X)}, got ${JSON.stringify(Z)}`};return{isValid:!0}}function n0(Z){return Z.startsWith("^")||Z.endsWith("$")||Z.includes("\\d")||Z.includes("\\w")||Z.includes("\\s")||Z.includes("[")||Z.includes("*")||Z.includes("+")||Z.includes("?")}function o0(Z,X){let J=String(Z);try{return new RegExp(X).test(J)}catch{return!1}}function i0(Z){return/^(>=?|<=?|>|<)\s*[\d.-]+(\s*,\s*(>=?|<=?|>|<)\s*[\d.-]+)*$/.test(Z)}function p1(Z,X){let J=Number(Z);if(Number.isNaN(J))return!1;let W=X.match(/^([\d.-]+)\s*-\s*([\d.-]+)$/);if(W){let G=Number(W[1]),Q=Number(W[2]);return J>=G&&J<=Q}return X.split(",").map((G)=>G.trim()).every((G)=>{let Q=G.match(/^(>=?|<=?|>|<)\s*([\d.-]+)$/);if(!Q)return!1;let Y=Q[1],z=Number(Q[2]);switch(Y){case">":return J>z;case">=":return J>=z;case"<":return J<z;case"<=":return J<=z;default:return!1}})}function $4(Z){return/^\[.*\]$/.test(Z)||Z==="*"||Z.startsWith("slice(")}function G4(Z,X){if(X==="*")return Z;if(X.startsWith("[")&&X.endsWith("]")){let J=X.slice(1,-1);if(J==="*")return Z;let W=Number(J);if(!Number.isNaN(W))return W>=0?Z[W]:Z[Z.length+W]}if(X.startsWith("slice(")){let J=X.match(/slice\((\d+)(?:,(\d+))?\)/);if(J){let W=Number(J[1]),$=J[2]?Number(J[2]):void 0;return Z.slice(W,$)}}return}async function c1(Z,X,J={}){if(Z.success&&X.expect){let G=a0(Z,X.expect);if(!G.success)Z.success=!1,Z.error=G.error}let{snapshotManager:W,snapshotConfig:$}=J;if(W&&$&&X.sourceFile&&Z.success){let G=await W.compareAndUpdate(X.sourceFile,X.name||"Request",Z,$);if(Z.snapshotResult=G,!G.match&&!G.updated){if(Z.success=!1,!Z.error)Z.error="Snapshot mismatch"}}return Z}function Q4(Z,X,J){return X*J**(Z-1)}async function r0(Z,X={}){let{config:J,shouldRetry:W,onRetry:$}=X,G=(J?.count??0)+1,Q=J?.delay??0,Y=J?.backoff??1,z=0,H;while(z<G){if(z>0&&$)$(z,J?.count??0);if(z>0&&Q>0){let K=Q4(z,Q,Y);await Bun.sleep(K)}z++;try{let K=await Z();if(W?.(K)){H="Operation returned retriable result";continue}return{value:K,success:!0,attempts:z}}catch(K){H=K instanceof Error?K.message:String(K)}}return{success:!1,attempts:z,error:H}}import*as r from"path";class s0{excludePaths;matchRules;constructor(Z){this.excludePaths=new Set(Z.exclude||[]),this.matchRules=new Map(Object.entries(Z.match||{}))}compare(Z,X){let J=[];if(Z.status!==void 0||X.status!==void 0){if(Z.status!==X.status&&!this.isExcluded("status"))J.push({path:"status",expected:Z.status,received:X.status,type:"changed"})}if(Z.headers||X.headers){let W=this.compareObjects(Z.headers||{},X.headers||{},"headers");J.push(...W)}if(Z.body!==void 0||X.body!==void 0){let W=this.deepCompare(Z.body,X.body,"body");J.push(...W)}return{match:J.length===0,differences:J}}deepCompare(Z,X,J){if(this.isExcluded(J))return[];if(this.matchesRule(J,X))return[];if(Z===null&&X===null)return[];if(Z===void 0&&X===void 0)return[];let W=this.getType(Z),$=this.getType(X);if(W!==$)return[{path:J,expected:Z,received:X,type:"type_mismatch"}];if(W!=="object"&&W!=="array"){if(Z!==X)return[{path:J,expected:Z,received:X,type:"changed"}];return[]}if(W==="array")return this.compareArrays(Z,X,J);return this.compareObjects(Z,X,J)}compareArrays(Z,X,J){let W=[],$=Math.max(Z.length,X.length);for(let G=0;G<$;G++){let Q=`${J}[${G}]`;if(G>=Z.length){if(!this.isExcluded(Q))W.push({path:Q,expected:void 0,received:X[G],type:"added"})}else if(G>=X.length){if(!this.isExcluded(Q))W.push({path:Q,expected:Z[G],received:void 0,type:"removed"})}else{let Y=this.deepCompare(Z[G],X[G],Q);W.push(...Y)}}return W}compareObjects(Z,X,J){let W=[],$=new Set([...Object.keys(Z),...Object.keys(X)]);for(let G of $){let Q=J?`${J}.${G}`:G,Y=G in Z,z=G in X;if(!Y&&z){if(!this.isExcluded(Q))W.push({path:Q,expected:void 0,received:X[G],type:"added"})}else if(Y&&!z){if(!this.isExcluded(Q))W.push({path:Q,expected:Z[G],received:void 0,type:"removed"})}else{let H=this.deepCompare(Z[G],X[G],Q);W.push(...H)}}return W}isExcluded(Z){if(this.excludePaths.has(Z))return!0;for(let X of this.excludePaths){if(X.startsWith("*.")){let J=X.slice(2);if(Z.endsWith(`.${J}`))return!0;if(Z.split(".").pop()===J)return!0}if(X.includes("[*]")){if(new RegExp(`^${X.replace(/\[\*\]/g,"\\[\\d+\\]").replace(/\./g,"\\.")}$`).test(Z))return!0}}return!1}matchesRule(Z,X){let J=this.matchRules.get(Z);if(!J)return!1;if(J==="*")return!0;if(J.startsWith("regex:")){let W=J.slice(6);try{return new RegExp(W).test(String(X))}catch{return!1}}return!1}getType(Z){if(Z===null)return"null";if(Z===void 0)return"undefined";if(Array.isArray(Z))return"array";return typeof Z}}var G2=1,Q2="__snapshots__";class u1{snapshotDir;globalConfig;writeLocks=new Map;constructor(Z={}){this.globalConfig=Z,this.snapshotDir=Z.dir||Q2}getSnapshotPath(Z){let X=r.dirname(Z),J=r.basename(Z,r.extname(Z));return r.join(X,this.snapshotDir,`${J}.snap.json`)}async load(Z){let X=this.getSnapshotPath(Z);try{let J=Bun.file(X);if(!await J.exists())return null;let W=await J.text();return JSON.parse(W)}catch{return null}}async save(Z,X){let J=this.getSnapshotPath(Z),W=this.writeLocks.get(J),$=(async()=>{if(W)await W;let G=r.dirname(J);await(await import("fs/promises")).mkdir(G,{recursive:!0});let Y=JSON.stringify(X,null,2);await Bun.write(J,Y)})();this.writeLocks.set(J,$),await $,this.writeLocks.delete(J)}async get(Z,X){return(await this.load(Z))?.snapshots[X]||null}createSnapshot(Z,X){let J=X.include||["body"],W={hash:"",updatedAt:new Date().toISOString()};if(J.includes("status")&&Z.status!==void 0)W.status=Z.status;if(J.includes("headers")&&Z.headers)W.headers=this.normalizeHeaders(Z.headers);if(J.includes("body")&&Z.body!==void 0)W.body=Z.body;return W.hash=this.hash(W),W}normalizeHeaders(Z){let X={},J=Object.keys(Z).sort();for(let W of J)X[W.toLowerCase()]=Z[W];return X}hash(Z){let X=JSON.stringify(Z),J=new Bun.CryptoHasher("md5");return J.update(X),J.digest("hex").slice(0,8)}async compareAndUpdate(Z,X,J,W){let $=W.name||X,G=await this.get(Z,$),Q=this.createSnapshot(J,W);if(!G){if(this.globalConfig.ci)return{match:!1,isNew:!0,updated:!1,differences:[{path:"",expected:"snapshot",received:"none",type:"removed"}]};return await this.updateSnapshot(Z,$,Q),{match:!0,isNew:!0,updated:!0,differences:[]}}let z=new s0(W).compare(G,Q);if(z.match)return{match:!0,isNew:!1,updated:!1,differences:[]};let H=this.globalConfig.updateMode||"none";if(H==="all"||H==="failing")return await this.updateSnapshot(Z,$,Q),{match:!0,isNew:!1,updated:!0,differences:z.differences};return{match:!1,isNew:!1,updated:!1,differences:z.differences}}async updateSnapshot(Z,X,J){let W=await this.load(Z);if(!W)W={version:G2,snapshots:{}};W.snapshots[X]=J,await this.save(Z,W)}static mergeConfig(Z,X){if(!X&&!Z?.enabled)return null;if(X===!0)return{enabled:!0,include:Z?.include||["body"],exclude:Z?.exclude||[],match:Z?.match||{}};if(typeof X==="object"&&X.enabled!==!1)return{enabled:!0,name:X.name,include:X.include||Z?.include||["body"],exclude:[...Z?.exclude||[],...X.exclude||[]],match:{...Z?.match||{},...X.match||{}}};if(Z?.enabled&&X===void 0)return{enabled:!0,include:Z.include||["body"],exclude:Z.exclude||[],match:Z.match||{}};return null}}function t0(Z,X){let J=X.split("."),W=Z;for(let $ of J){if(W===null||W===void 0)return;if(typeof W!=="object")return;let G=$.match(/^(\w+)\[(\d+)\]$/);if(G){let[,Q,Y]=G,z=Number.parseInt(Y,10);if(W=W[Q],Array.isArray(W))W=W[z];else return}else if(/^\d+$/.test($)&&Array.isArray(W))W=W[Number.parseInt($,10)];else W=W[$]}return W}function l1(Z){if(Z===void 0||Z===null)return"";if(typeof Z==="string")return Z;if(typeof Z==="number"||typeof Z==="boolean")return String(Z);return JSON.stringify(Z)}function Y4(Z,X){let J={},W={status:Z.status,headers:Z.headers||{},body:Z.body,metrics:Z.metrics};for(let[$,G]of Object.entries(X)){let Q=t0(W,G);J[$]=l1(Q)}return J}function z4(){return{}}function Y2(Z){let X=Z.trim(),J=X.match(/^(.+?)\s+(exists|not-exists)$/i);if(J)return{left:J[1].trim(),operator:J[2].toLowerCase()};let W=/^(.+?)\s*(==|!=|>=|<=|>|<|contains|matches)\s*(.+)$/i,$=X.match(W);if(!$)return null;let[,G,Q,Y]=$,z=z2(Y.trim());return{left:G.trim(),operator:Q.toLowerCase(),right:z}}function z2(Z){if(Z==="true")return!0;if(Z==="false")return!1;let X=Number(Z);if(!Number.isNaN(X)&&Z!=="")return X;if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);return Z}function H2(Z,X){let J=Z.startsWith("store.")?Z.slice(6):Z;if(J in X){let G=X[J];if(G.startsWith("{")||G.startsWith("["))try{return JSON.parse(G)}catch{return G}let Q=Number(G);if(!Number.isNaN(Q)&&G!=="")return Q;if(G==="true")return!0;if(G==="false")return!1;return G}let W=J.split("."),$=W[0];if($ in X){let G=X[$];try{let Q=JSON.parse(G);return t0(Q,W.slice(1).join("."))}catch{return}}return}function H4(Z,X,J){if(J)return Z===X;return Z.toLowerCase()===X.toLowerCase()}function n1(Z,X){let J=H2(Z.left,X),W=Z.caseSensitive??!1,$=(Q)=>{if(Q===void 0)return"undefined";if(Q===null)return"null";if(typeof Q==="string")return`"${Q}"`;return String(Q)},G=`${Z.left} ${Z.operator}${Z.right!==void 0?` ${$(Z.right)}`:""}`;switch(Z.operator){case"exists":return{passed:J!==void 0&&J!==null&&J!=="",description:G};case"not-exists":return{passed:J===void 0||J===null||J==="",description:G};case"==":{let Q;if(typeof J==="string"&&typeof Z.right==="string")Q=H4(J,Z.right,W);else Q=J==Z.right;return{passed:Q,description:G}}case"!=":{let Q;if(typeof J==="string"&&typeof Z.right==="string")Q=!H4(J,Z.right,W);else Q=J!=Z.right;return{passed:Q,description:G}}case">":return{passed:Number(J)>Number(Z.right),description:G};case"<":return{passed:Number(J)<Number(Z.right),description:G};case">=":return{passed:Number(J)>=Number(Z.right),description:G};case"<=":return{passed:Number(J)<=Number(Z.right),description:G};case"contains":{let Q=l1(J),Y=String(Z.right??"");return{passed:W?Q.includes(Y):Q.toLowerCase().includes(Y.toLowerCase()),description:G}}case"matches":{let Q=l1(J),Y=String(Z.right??"");try{return{passed:new RegExp(Y,W?"":"i").test(Q),description:G}}catch{return{passed:!1,description:`${G} (invalid regex)`}}}default:return{passed:!1,description:`unknown operator: ${Z.operator}`}}}function K4(Z,X){if(typeof Z==="string"){let J=Y2(Z);if(!J)return{shouldRun:!1,reason:`invalid condition syntax: "${Z}"`};let W=n1(J,X);return{shouldRun:W.passed,reason:W.passed?void 0:`condition not met: ${W.description}`}}if(Z.all&&Z.all.length>0){for(let J of Z.all){let W=n1(J,X);if(!W.passed)return{shouldRun:!1,reason:`condition not met: ${W.description}`}}return{shouldRun:!0}}if(Z.any&&Z.any.length>0){let J=[];for(let W of Z.any){let $=n1(W,X);if($.passed)return{shouldRun:!0};J.push($.description)}return{shouldRun:!1,reason:`no conditions met: ${J.join(", ")}`}}if(Z.left&&Z.operator){let J={left:Z.left,operator:Z.operator,right:Z.right,caseSensitive:Z.caseSensitive},W=n1(J,X);return{shouldRun:W.passed,reason:W.passed?void 0:`condition not met: ${W.description}`}}return{shouldRun:!0}}class e0{poolConfig;constructor(Z={}){this.poolConfig={enabled:!0,maxStreamsPerHost:10,keepaliveTime:60,connectTimeout:30,...Z}}getHostKey(Z){try{let X=new URL(Z);return`${X.protocol}//${X.host}`}catch{return Z}}groupRequestsByHost(Z){let X=new Map;return Z.forEach((J,W)=>{let $=this.getHostKey(J.url),G=X.get($)||[];G.push({index:W,config:J}),X.set($,G)}),Array.from(X.entries()).map(([J,W])=>({host:J,requests:W}))}buildRequestArgs(Z,X){let{args:J,url:W}=F1(Z,{writeOutMarker:g0(X),includeSilentFlags:!1,includeHttp2Flag:!1,includeOutputFlag:!1});return J.push(W),J}buildBatchedCommand(Z){let X=[];return X.push("-Z"),X.push("--parallel-max",this.poolConfig.maxStreamsPerHost.toString()),X.push("--http2"),X.push("--keepalive-time",this.poolConfig.keepaliveTime.toString()),X.push("--connect-timeout",this.poolConfig.connectTimeout.toString()),X.push("-s","-S"),Z.requests.forEach((J,W)=>{if(W>0)X.push("--next");let $=this.buildRequestArgs(J.config,J.index);X.push(...$)}),X}parseBatchedOutput(Z,X,J,W){let $=new Map;for(let G of J.requests){let{found:Q,metricsJson:Y,startIdx:z}=f0(Z,G.index);if(!Q){$.set(G.index,{request:G.config,success:!1,error:X||`Request failed (exit code: ${W})`,metrics:{duration:0}});continue}let H={};try{H=JSON.parse(Y)}catch{}let K=z,B=0;for(let O of J.requests){if(O.index===G.index)continue;let I=`__CURL_BATCH_${O.index}_END__`,N=Z.indexOf(I);if(N!==-1&&N<K&&N+I.length>B)B=N+I.length}let M=Z.substring(B,K).trim(),R=N1(H),_=I1(H);$.set(G.index,{request:G.config,success:c0(R),status:R,body:$1(M),metrics:_})}return $}async executeBatch(Z){let X=this.buildBatchedCommand(Z);try{let J=Bun.spawn(["curl",...X],{stdout:"pipe",stderr:"pipe"}),W=await new Response(J.stdout).text(),$=await new Response(J.stderr).text();return await J.exited,this.parseBatchedOutput(W,$,Z,J.exitCode||0)}catch(J){let W=new Map;for(let $ of Z.requests)W.set($.index,{request:$.config,success:!1,error:J instanceof Error?J.message:String(J),metrics:{duration:0}});return W}}async executeAll(Z){let X=this.groupRequestsByHost(Z),J=new Map,W=X.map((G)=>this.executeBatch(G)),$=await Promise.all(W);for(let G of $)for(let[Q,Y]of G)J.set(Q,Y);return Z.map((G,Q)=>{return J.get(Q)||{request:Z[Q],success:!1,error:"Request not executed",metrics:{duration:0}}})}formatBatchedCommandForDisplay(Z){let X=this.buildBatchedCommand(Z);return T1(X)}}class Z9{logger;globalConfig;snapshotManager;pooledExecutor=null;constructor(Z={}){if(this.globalConfig=Z,this.logger=new a(Z.output),this.snapshotManager=new u1(Z.snapshot),Z.connectionPool?.enabled)this.pooledExecutor=new e0(Z.connectionPool)}mergeOutputConfig(Z){return{...this.globalConfig.output,...Z.sourceOutputConfig}}getSnapshotConfig(Z){return u1.mergeConfig(this.globalConfig.snapshot,Z.snapshot)}isFileAttachment(Z){return typeof Z==="object"&&Z!==null&&"file"in Z}async validateFileAttachments(Z){if(!Z.formData)return;let X=[];for(let[J,W]of Object.entries(Z.formData))if(this.isFileAttachment(W)){let $=W.file;if(!await Bun.file($).exists())X.push(`${J}: ${$}`)}if(X.length>0)return`File(s) not found: ${X.join(", ")}`;return}async executeRequest(Z,X=0){let J=performance.now(),W=this.mergeOutputConfig(Z),$=new a(W);$.logRequestStart(Z,X);let G=await this.validateFileAttachments(Z);if(G){let K={request:Z,success:!1,error:G,metrics:{duration:performance.now()-J}};return $.logRequestComplete(K),K}let Q=Z1.buildCommand(Z);if($.logCommand(Z1.formatCommandForDisplay(Q)),this.globalConfig.dryRun){let K={request:Z,success:!0,dryRun:!0,metrics:{duration:0}};return $.logRequestComplete(K),K}let Y=await r0(()=>Z1.executeCurl(Q),{config:Z.retry,shouldRetry:(K)=>!K.success,onRetry:(K,B)=>$.logRetry(K,B)});if(!Y.success||!Y.value?.success){let K={request:Z,success:!1,error:Y.error||Y.value?.error,metrics:{duration:performance.now()-J}};return $.logRequestComplete(K),K}let z=Y.value,H=this.processCurlResult(Z,z,J);return await c1(H,Z,{snapshotManager:this.snapshotManager,snapshotConfig:this.getSnapshotConfig(Z)}),$.logRequestComplete(H),H}processCurlResult(Z,X,J){let W=$1(X.body,X.headers?.["content-type"]);return{request:Z,success:!0,status:X.status,headers:X.headers,body:W,metrics:{...X.metrics,duration:performance.now()-J}}}async executeSequential(Z){let X=performance.now(),J=[],W=z4();for(let $=0;$<Z.length;$++){let G=this.interpolateStoreVariables(Z[$],W);if(G.when){let Y=K4(G.when,W);if(!Y.shouldRun){let z={request:G,success:!0,skipped:!0,skipReason:Y.reason};J.push(z),this.logger.logSkipped(G,$+1,Y.reason);continue}}let Q=await this.executeRequest(G,$+1);if(J.push(Q),Q.success&&G.store){let Y=Y4(Q,G.store);Object.assign(W,Y),this.logStoredValues(Y)}if(!Q.success&&!this.globalConfig.continueOnError){this.logger.logError("Stopping execution due to error");break}}return this.createSummary(J,performance.now()-X)}interpolateStoreVariables(Z,X){if(Object.keys(X).length===0)return Z;return v.interpolateVariables(Z,{},X)}logStoredValues(Z){if(Object.keys(Z).length===0)return;let X=Object.entries(Z);for(let[J,W]of X){let $=W.length>50?`${W.substring(0,50)}...`:W;this.logger.logInfo(`Stored: ${J} = "${$}"`)}}async executeParallel(Z){let X=performance.now();if(this.pooledExecutor&&!this.globalConfig.dryRun)return this.executePooled(Z,X);let J=this.globalConfig.maxConcurrency;if(!J||J>=Z.length){let $=Z.map((Q,Y)=>this.executeRequest(Q,Y+1)),G=await Promise.all($);return this.createSummary(G,performance.now()-X)}let W=[];for(let $=0;$<Z.length;$+=J){let Q=Z.slice($,$+J).map((H,K)=>this.executeRequest(H,$+K+1)),Y=await Promise.all(Q);if(W.push(...Y),Y.some((H)=>!H.success)&&!this.globalConfig.continueOnError){this.logger.logError("Stopping execution due to error");break}}return this.createSummary(W,performance.now()-X)}async executePooled(Z,X){this.logger.logInfo(`Using connection pooling (HTTP/2 multiplexing) for ${Z.length} requests`);let J=this.pooledExecutor.groupRequestsByHost(Z);for(let G of J)this.logger.logInfo(` ${G.host}: ${G.requests.length} request(s) batched`);let W=await this.pooledExecutor.executeAll(Z),$=[];for(let G=0;G<W.length;G++){let Q=W[G],Y=Z[G],z=this.mergeOutputConfig(Y),H=new a(z);if(H.logRequestStart(Y,G+1),await c1(Q,Y,{snapshotManager:this.snapshotManager,snapshotConfig:this.getSnapshotConfig(Y)}),H.logRequestComplete(Q),$.push(Q),!Q.success&&!this.globalConfig.continueOnError){this.logger.logError("Stopping execution due to error");break}}return this.createSummary($,performance.now()-X)}async execute(Z){this.logger.logExecutionStart(Z.length,this.globalConfig.execution||"sequential");let X=this.globalConfig.execution==="parallel"?await this.executeParallel(Z):await this.executeSequential(Z);if(this.logger.logSummary(X),this.globalConfig.output?.saveToFile)await this.saveSummaryToFile(X);return X}createSummary(Z,X){let J=Z.filter((G)=>G.skipped).length,W=Z.filter((G)=>G.success&&!G.skipped).length,$=Z.filter((G)=>!G.success).length;return{total:Z.length,successful:W,failed:$,skipped:J,duration:X,results:Z}}async saveSummaryToFile(Z){let X=this.globalConfig.output?.saveToFile;if(!X)return;let J=JSON.stringify(Z,null,2);await Bun.write(X,J),this.logger.logInfo(`Results saved to ${X}`)}}var U4=`${process.env.HOME}/.curl-runner-version-cache.json`,K2=86400000,U2="https://registry.npmjs.org/@curl-runner/cli/latest";class X9{async checkForUpdates(Z=!1){try{if(process.env.CI)return;let X=n();if(X==="0.0.0")return;if(!Z){let W=await this.getCachedVersion();if(W&&Date.now()-W.lastCheck<K2){this.compareVersions(X,W.latestVersion);return}}let J=await this.fetchLatestVersion();if(J)await this.setCachedVersion(J),this.compareVersions(X,J)}catch{}}async fetchLatestVersion(){try{let Z=await fetch(U2,{signal:AbortSignal.timeout(3000)});if(!Z.ok)return null;return(await Z.json()).version}catch{return null}}compareVersions(Z,X){if(this.isNewerVersion(Z,X))console.log(),console.log(D("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E","yellow")),console.log(D("\u2502","yellow")+" "+D("\u2502","yellow")),console.log(D("\u2502","yellow")+" "+D("Update available!","bright")+` ${D(Z,"red")} \u2192 ${D(X,"green")} `+D("\u2502","yellow")),console.log(D("\u2502","yellow")+" "+D("\u2502","yellow")),console.log(D("\u2502","yellow")+" Run "+D("curl-runner upgrade","cyan")+" to update "+D("\u2502","yellow")),console.log(D("\u2502","yellow")+" "+D("\u2502","yellow")),console.log(D("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F","yellow")),console.log()}isNewerVersion(Z,X){try{let J=Z.replace(/^v/,""),W=X.replace(/^v/,""),$=J.split(".").map(Number),G=W.split(".").map(Number);for(let Q=0;Q<Math.max($.length,G.length);Q++){let Y=$[Q]||0,z=G[Q]||0;if(z>Y)return!0;if(z<Y)return!1}return!1}catch{return!1}}async getCachedVersion(){try{let Z=Bun.file(U4);if(await Z.exists())return JSON.parse(await Z.text())}catch{}return null}async setCachedVersion(Z){try{let X={lastCheck:Date.now(),latestVersion:Z};await Bun.write(U4,JSON.stringify(X))}catch{}}}import{watch as B2}from"fs";class J9{watchers=[];debounceTimer=null;isRunning=!1;pendingRun=!1;options;constructor(Z){this.options=Z}async start(){let{files:Z,logger:X}=this.options;await this.runRequests();for(let J of Z)try{let W=B2(J,($)=>{if($==="change")this.handleFileChange(J)});W.on("error",($)=>{X.logWarning(`Watch error on ${J}: ${$.message}`)}),this.watchers.push(W)}catch(W){X.logWarning(`Failed to watch ${J}: ${W instanceof Error?W.message:String(W)}`)}X.logWatch(Z),this.setupSignalHandlers(),await this.keepAlive()}handleFileChange(Z){let{config:X,logger:J}=this.options,W=X.debounce??300;if(this.debounceTimer)clearTimeout(this.debounceTimer);this.debounceTimer=setTimeout(async()=>{if(this.isRunning){this.pendingRun=!0;return}if(X.clear!==!1)console.clear();J.logFileChanged(Z),await this.runRequests()},W)}async runRequests(){let{onRun:Z,logger:X}=this.options;this.isRunning=!0;try{await Z()}catch(J){X.logError(J instanceof Error?J.message:String(J))}if(this.isRunning=!1,this.pendingRun){this.pendingRun=!1;let{config:J}=this.options;if(J.clear!==!1)console.clear();X.logFileChanged("(queued change)"),await this.runRequests()}else X.logWatchReady()}setupSignalHandlers(){let Z=()=>{this.stop(),process.exit(0)};process.on("SIGINT",Z),process.on("SIGTERM",Z)}async keepAlive(){while(!0)await Bun.sleep(1000)}stop(){for(let Z of this.watchers)Z.close();if(this.watchers=[],this.debounceTimer)clearTimeout(this.debounceTimer),this.debounceTimer=null}}var X1=V1($9(),1);import{stdout as T4,stdin as T2}from"process";var m=V1(Q9(),1);import I2 from"readline";var N2=(Z)=>Z===161||Z===164||Z===167||Z===168||Z===170||Z===173||Z===174||Z>=176&&Z<=180||Z>=182&&Z<=186||Z>=188&&Z<=191||Z===198||Z===208||Z===215||Z===216||Z>=222&&Z<=225||Z===230||Z>=232&&Z<=234||Z===236||Z===237||Z===240||Z===242||Z===243||Z>=247&&Z<=250||Z===252||Z===254||Z===257||Z===273||Z===275||Z===283||Z===294||Z===295||Z===299||Z>=305&&Z<=307||Z===312||Z>=319&&Z<=322||Z===324||Z>=328&&Z<=331||Z===333||Z===338||Z===339||Z===358||Z===359||Z===363||Z===462||Z===464||Z===466||Z===468||Z===470||Z===472||Z===474||Z===476||Z===593||Z===609||Z===708||Z===711||Z>=713&&Z<=715||Z===717||Z===720||Z>=728&&Z<=731||Z===733||Z===735||Z>=768&&Z<=879||Z>=913&&Z<=929||Z>=931&&Z<=937||Z>=945&&Z<=961||Z>=963&&Z<=969||Z===1025||Z>=1040&&Z<=1103||Z===1105||Z===8208||Z>=8211&&Z<=8214||Z===8216||Z===8217||Z===8220||Z===8221||Z>=8224&&Z<=8226||Z>=8228&&Z<=8231||Z===8240||Z===8242||Z===8243||Z===8245||Z===8251||Z===8254||Z===8308||Z===8319||Z>=8321&&Z<=8324||Z===8364||Z===8451||Z===8453||Z===8457||Z===8467||Z===8470||Z===8481||Z===8482||Z===8486||Z===8491||Z===8531||Z===8532||Z>=8539&&Z<=8542||Z>=8544&&Z<=8555||Z>=8560&&Z<=8569||Z===8585||Z>=8592&&Z<=8601||Z===8632||Z===8633||Z===8658||Z===8660||Z===8679||Z===8704||Z===8706||Z===8707||Z===8711||Z===8712||Z===8715||Z===8719||Z===8721||Z===8725||Z===8730||Z>=8733&&Z<=8736||Z===8739||Z===8741||Z>=8743&&Z<=8748||Z===8750||Z>=8756&&Z<=8759||Z===8764||Z===8765||Z===8776||Z===8780||Z===8786||Z===8800||Z===8801||Z>=8804&&Z<=8807||Z===8810||Z===8811||Z===8814||Z===8815||Z===8834||Z===8835||Z===8838||Z===8839||Z===8853||Z===8857||Z===8869||Z===8895||Z===8978||Z>=9312&&Z<=9449||Z>=9451&&Z<=9547||Z>=9552&&Z<=9587||Z>=9600&&Z<=9615||Z>=9618&&Z<=9621||Z===9632||Z===9633||Z>=9635&&Z<=9641||Z===9650||Z===9651||Z===9654||Z===9655||Z===9660||Z===9661||Z===9664||Z===9665||Z>=9670&&Z<=9672||Z===9675||Z>=9678&&Z<=9681||Z>=9698&&Z<=9701||Z===9711||Z===9733||Z===9734||Z===9737||Z===9742||Z===9743||Z===9756||Z===9758||Z===9792||Z===9794||Z===9824||Z===9825||Z>=9827&&Z<=9829||Z>=9831&&Z<=9834||Z===9836||Z===9837||Z===9839||Z===9886||Z===9887||Z===9919||Z>=9926&&Z<=9933||Z>=9935&&Z<=9939||Z>=9941&&Z<=9953||Z===9955||Z===9960||Z===9961||Z>=9963&&Z<=9969||Z===9972||Z>=9974&&Z<=9977||Z===9979||Z===9980||Z===9982||Z===9983||Z===10045||Z>=10102&&Z<=10111||Z>=11094&&Z<=11097||Z>=12872&&Z<=12879||Z>=57344&&Z<=63743||Z>=65024&&Z<=65039||Z===65533||Z>=127232&&Z<=127242||Z>=127248&&Z<=127277||Z>=127280&&Z<=127337||Z>=127344&&Z<=127373||Z===127375||Z===127376||Z>=127387&&Z<=127404||Z>=917760&&Z<=917999||Z>=983040&&Z<=1048573||Z>=1048576&&Z<=1114109,L2=(Z)=>Z===12288||Z>=65281&&Z<=65376||Z>=65504&&Z<=65510,R2=(Z)=>Z>=4352&&Z<=4447||Z===8986||Z===8987||Z===9001||Z===9002||Z>=9193&&Z<=9196||Z===9200||Z===9203||Z===9725||Z===9726||Z===9748||Z===9749||Z>=9800&&Z<=9811||Z===9855||Z===9875||Z===9889||Z===9898||Z===9899||Z===9917||Z===9918||Z===9924||Z===9925||Z===9934||Z===9940||Z===9962||Z===9970||Z===9971||Z===9973||Z===9978||Z===9981||Z===9989||Z===9994||Z===9995||Z===10024||Z===10060||Z===10062||Z>=10067&&Z<=10069||Z===10071||Z>=10133&&Z<=10135||Z===10160||Z===10175||Z===11035||Z===11036||Z===11088||Z===11093||Z>=11904&&Z<=11929||Z>=11931&&Z<=12019||Z>=12032&&Z<=12245||Z>=12272&&Z<=12287||Z>=12289&&Z<=12350||Z>=12353&&Z<=12438||Z>=12441&&Z<=12543||Z>=12549&&Z<=12591||Z>=12593&&Z<=12686||Z>=12688&&Z<=12771||Z>=12783&&Z<=12830||Z>=12832&&Z<=12871||Z>=12880&&Z<=19903||Z>=19968&&Z<=42124||Z>=42128&&Z<=42182||Z>=43360&&Z<=43388||Z>=44032&&Z<=55203||Z>=63744&&Z<=64255||Z>=65040&&Z<=65049||Z>=65072&&Z<=65106||Z>=65108&&Z<=65126||Z>=65128&&Z<=65131||Z>=94176&&Z<=94180||Z===94192||Z===94193||Z>=94208&&Z<=100343||Z>=100352&&Z<=101589||Z>=101632&&Z<=101640||Z>=110576&&Z<=110579||Z>=110581&&Z<=110587||Z===110589||Z===110590||Z>=110592&&Z<=110882||Z===110898||Z>=110928&&Z<=110930||Z===110933||Z>=110948&&Z<=110951||Z>=110960&&Z<=111355||Z===126980||Z===127183||Z===127374||Z>=127377&&Z<=127386||Z>=127488&&Z<=127490||Z>=127504&&Z<=127547||Z>=127552&&Z<=127560||Z===127568||Z===127569||Z>=127584&&Z<=127589||Z>=127744&&Z<=127776||Z>=127789&&Z<=127797||Z>=127799&&Z<=127868||Z>=127870&&Z<=127891||Z>=127904&&Z<=127946||Z>=127951&&Z<=127955||Z>=127968&&Z<=127984||Z===127988||Z>=127992&&Z<=128062||Z===128064||Z>=128066&&Z<=128252||Z>=128255&&Z<=128317||Z>=128331&&Z<=128334||Z>=128336&&Z<=128359||Z===128378||Z===128405||Z===128406||Z===128420||Z>=128507&&Z<=128591||Z>=128640&&Z<=128709||Z===128716||Z>=128720&&Z<=128722||Z>=128725&&Z<=128727||Z>=128732&&Z<=128735||Z===128747||Z===128748||Z>=128756&&Z<=128764||Z>=128992&&Z<=129003||Z===129008||Z>=129292&&Z<=129338||Z>=129340&&Z<=129349||Z>=129351&&Z<=129535||Z>=129648&&Z<=129660||Z>=129664&&Z<=129672||Z>=129680&&Z<=129725||Z>=129727&&Z<=129733||Z>=129742&&Z<=129755||Z>=129760&&Z<=129768||Z>=129776&&Z<=129784||Z>=131072&&Z<=196605||Z>=196608&&Z<=262141,Y9=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,a1=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,r1=/\t{1,1000}/y,z9=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,s1=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,j2=/\p{M}+/gu,S2={limit:1/0,ellipsis:""},I4=(Z,X={},J={})=>{let W=X.limit??1/0,$=X.ellipsis??"",G=X?.ellipsisWidth??($?I4($,S2,J).width:0),Q=J.ansiWidth??0,Y=J.controlWidth??0,z=J.tabWidth??8,H=J.ambiguousWidth??1,K=J.emojiWidth??2,B=J.fullWidthWidth??2,M=J.regularWidth??1,R=J.wideWidth??2,_=0,O=0,I=Z.length,N=0,j=!1,A=I,k=Math.max(0,W-G),w=0,C=0,F=0,T=0;Z:for(;;){if(C>w||O>=I&&O>_){let f=Z.slice(w,C)||Z.slice(_,O);N=0;for(let c of f.replaceAll(j2,"")){let g=c.codePointAt(0)||0;if(L2(g)?T=B:R2(g)?T=R:H!==M&&N2(g)?T=H:T=M,F+T>k&&(A=Math.min(A,Math.max(w,_)+N)),F+T>W){j=!0;break Z}N+=c.length,F+=T}w=C=0}if(O>=I)break;if(s1.lastIndex=O,s1.test(Z)){if(N=s1.lastIndex-O,T=N*M,F+T>k&&(A=Math.min(A,O+Math.floor((k-F)/M))),F+T>W){j=!0;break}F+=T,w=_,C=O,O=_=s1.lastIndex;continue}if(Y9.lastIndex=O,Y9.test(Z)){if(F+Q>k&&(A=Math.min(A,O)),F+Q>W){j=!0;break}F+=Q,w=_,C=O,O=_=Y9.lastIndex;continue}if(a1.lastIndex=O,a1.test(Z)){if(N=a1.lastIndex-O,T=N*Y,F+T>k&&(A=Math.min(A,O+Math.floor((k-F)/Y))),F+T>W){j=!0;break}F+=T,w=_,C=O,O=_=a1.lastIndex;continue}if(r1.lastIndex=O,r1.test(Z)){if(N=r1.lastIndex-O,T=N*z,F+T>k&&(A=Math.min(A,O+Math.floor((k-F)/z))),F+T>W){j=!0;break}F+=T,w=_,C=O,O=_=r1.lastIndex;continue}if(z9.lastIndex=O,z9.test(Z)){if(F+K>k&&(A=Math.min(A,O)),F+K>W){j=!0;break}F+=K,w=_,C=O,O=_=z9.lastIndex;continue}O+=1}return{width:j?k:F,index:j?A:I,truncated:j,ellipsed:j&&W>=G}},E2={limit:1/0,ellipsis:"",ellipsisWidth:0},R1=(Z,X={})=>I4(Z,E2,X).width,e1="\x1B",N4="\x9B",A2=39,B9="\x07",L4="[",V2="]",R4="m",O9=`${V2}8;;`,M4=new RegExp(`(?:\\${L4}(?<code>\\d+)m|\\${O9}(?<uri>.*)${B9})`,"y"),k2=(Z)=>{if(Z>=30&&Z<=37||Z>=90&&Z<=97)return 39;if(Z>=40&&Z<=47||Z>=100&&Z<=107)return 49;if(Z===1||Z===2)return 22;if(Z===3)return 23;if(Z===4)return 24;if(Z===7)return 27;if(Z===8)return 28;if(Z===9)return 29;if(Z===0)return 0},D4=(Z)=>`${e1}${L4}${Z}${R4}`,F4=(Z)=>`${e1}${O9}${Z}${B9}`,P2=(Z)=>Z.map((X)=>R1(X)),H9=(Z,X,J)=>{let W=X[Symbol.iterator](),$=!1,G=!1,Q=Z.at(-1),Y=Q===void 0?0:R1(Q),z=W.next(),H=W.next(),K=0;for(;!z.done;){let B=z.value,M=R1(B);Y+M<=J?Z[Z.length-1]+=B:(Z.push(B),Y=0),(B===e1||B===N4)&&($=!0,G=X.startsWith(O9,K+1)),$?G?B===B9&&($=!1,G=!1):B===R4&&($=!1):(Y+=M,Y===J&&!H.done&&(Z.push(""),Y=0)),z=H,H=W.next(),K+=B.length}Q=Z.at(-1),!Y&&Q!==void 0&&Q.length>0&&Z.length>1&&(Z[Z.length-2]+=Z.pop())},C2=(Z)=>{let X=Z.split(" "),J=X.length;for(;J>0&&!(R1(X[J-1])>0);)J--;return J===X.length?Z:X.slice(0,J).join(" ")+X.slice(J).join("")},w2=(Z,X,J={})=>{if(J.trim!==!1&&Z.trim()==="")return"";let W="",$,G,Q=Z.split(" "),Y=P2(Q),z=[""];for(let[_,O]of Q.entries()){J.trim!==!1&&(z[z.length-1]=(z.at(-1)??"").trimStart());let I=R1(z.at(-1)??"");if(_!==0&&(I>=X&&(J.wordWrap===!1||J.trim===!1)&&(z.push(""),I=0),(I>0||J.trim===!1)&&(z[z.length-1]+=" ",I++)),J.hard&&Y[_]>X){let N=X-I,j=1+Math.floor((Y[_]-N-1)/X);Math.floor((Y[_]-1)/X)<j&&z.push(""),H9(z,O,X);continue}if(I+Y[_]>X&&I>0&&Y[_]>0){if(J.wordWrap===!1&&I<X){H9(z,O,X);continue}z.push("")}if(I+Y[_]>X&&J.wordWrap===!1){H9(z,O,X);continue}z[z.length-1]+=O}J.trim!==!1&&(z=z.map((_)=>C2(_)));let H=z.join(`
154
+ `)})}if(this.shouldShowMetrics()&&Z.metrics&&X==="detailed"){let Y=Z.metrics,z=[];if(z.push({label:"Request Duration",value:u(Y.duration),color:"cyan"}),Y.size!==void 0)z.push({label:"Response Size",value:v1(Y.size),color:"cyan"});if(Y.dnsLookup)z.push({label:"DNS Lookup",value:u(Y.dnsLookup),color:"cyan"});if(Y.tcpConnection)z.push({label:"TCP Connection",value:u(Y.tcpConnection),color:"cyan"});if(Y.tlsHandshake)z.push({label:"TLS Handshake",value:u(Y.tlsHandshake),color:"cyan"});if(Y.firstByte)z.push({label:"Time to First Byte",value:u(Y.firstByte),color:"cyan"});G.push({label:"Metrics",children:z})}if(Q.render(G),Z.error)console.log(),this.logValidationErrors(Z.error);if(Z.snapshotResult)console.log(),this.logSnapshotResult(Z.request.name||"Request",Z.snapshotResult);console.log()}logSnapshotResult(Z,X){if(!X)return;let J=new u0;console.log(J.formatResult(Z,X))}logSummary(Z,X=!1){if(this.config.format==="raw")return;if(this.config.format==="json"){let z={summary:{total:Z.total,successful:Z.successful,failed:Z.failed,skipped:Z.skipped,duration:Z.duration},results:Z.results.map((H)=>({request:{name:H.request.name,url:this.redact(H.request.url),method:H.request.method||"GET"},success:H.success,...H.dryRun?{dryRun:!0}:{status:H.status},...this.shouldShowHeaders()&&H.headers?{headers:H.headers}:{},...this.shouldShowBody()&&H.body?{body:H.body}:{},...H.error?{error:H.error}:{},...this.shouldShowMetrics()&&H.metrics?{metrics:H.metrics}:{}}))};console.log(JSON.stringify(z,null,2));return}if(!this.shouldShowOutput())return;let J=this.config.prettyLevel||"minimal";if(X)console.log();if(J==="minimal"){let z=Z.failed===0?"green":"red",H=Z.skipped>0?`, ${Z.skipped} skipped`:"",K=Z.failed===0?`${Z.total} request${Z.total===1?"":"s"} completed successfully${H}`:`${Z.successful}/${Z.total} request${Z.total===1?"":"s"} completed, ${Z.failed} failed${H}`;console.log(`${X?"\u25C6 Global Summary":"Summary"}: ${this.color(K,z)}`);return}let W=(Z.successful/Z.total*100).toFixed(1),$=Z.failed===0?"green":"red",G=Z.skipped>0?`, ${Z.skipped} skipped`:"",Q=Z.failed===0?`${Z.total} request${Z.total===1?"":"s"} completed successfully${G}`:`${Z.successful}/${Z.total} request${Z.total===1?"":"s"} completed, ${Z.failed} failed${G}`,Y=X?"\u25C6 Global Summary":"Summary";if(console.log(),console.log(`${Y}: ${this.color(Q,$)} (${this.color(u(Z.duration),"cyan")})`),Z.failed>0&&this.shouldShowRequestDetails())Z.results.filter((z)=>!z.success).forEach((z)=>{let H=z.request.name||this.redact(z.request.url);console.log(` ${this.color("\u2022","red")} ${H}: ${z.error||""}`)})}logError(Z){console.error(this.color(`\u2717 ${Z}`,"red"))}logWarning(Z){console.warn(this.color(`\u26A0 ${Z}`,"yellow"))}logInfo(Z){console.log(this.color(`\u2139 ${Z}`,"blue"))}logSuccess(Z){console.log(this.color(`\u2713 ${Z}`,"green"))}logSkipped(Z,X,J){if(!this.shouldShowOutput())return;let W=Z.name||`Request ${X}`;if(this.config.format==="json"){let $={request:{name:Z.name,url:this.redact(Z.url),method:Z.method||"GET"},skipped:!0,reason:J||"condition not met"};console.log(JSON.stringify($,null,2));return}if(console.log(`${this.color("\u2298","yellow")} ${this.color(W,"bright")} ${this.color("[SKIP]","yellow")}`),J){let $=[{label:"Reason",value:J,color:"yellow"}];new H1().render($)}console.log()}logFileHeader(Z,X){if(!this.shouldShowOutput()||this.config.format!=="pretty")return;let J=Z.replace(/.*\//,"").replace(".yaml","");console.log(),console.log(this.color(`\u25B6 ${J}.yaml`,"bright")+this.color(` (${X} request${X===1?"":"s"})`,"dim"))}logWatch(Z){console.log(),console.log(`${this.color("Watching for changes...","cyan")} ${this.color("(press Ctrl+C to stop)","dim")}`);let X=Z.length<=3?Z.join(", "):`${Z.length} files`;console.log(this.color(` Files: ${X}`,"dim")),console.log()}logWatchReady(){console.log(),console.log(this.color("Watching for changes...","cyan"))}logFileChanged(Z){let X=new Date().toLocaleTimeString("en-US",{hour12:!1});console.log(this.color("-".repeat(50),"dim")),console.log(`${this.color(`[${X}]`,"dim")} File changed: ${this.color(Z,"yellow")}`),console.log()}logProfileStart(Z,X,J,W){if(!this.shouldShowOutput())return;console.log(),console.log(`${this.color("\u26A1 PROFILING","magenta")} ${this.color(Z,"bright")}`),console.log(this.color(` ${X} iterations, ${J} warmup, concurrency: ${W}`,"dim"))}logProfileResult(Z,X){let{stats:J,request:W}=Z,$=W.name||W.url;if(this.config.format==="json"){console.log(JSON.stringify({request:{name:$,url:W.url,method:W.method||"GET"},stats:{iterations:J.iterations,warmup:J.warmup,failures:J.failures,failureRate:J.failureRate,min:J.min,max:J.max,mean:J.mean,median:J.median,p50:J.p50,p95:J.p95,p99:J.p99,stdDev:J.stdDev}}));return}if(this.config.format==="raw"){console.log(`${J.p50} ${J.p95} ${J.p99} ${J.mean}`);return}console.log();let G=J.failures===0?this.color("\u2713","green"):this.color("\u26A0","yellow");if(console.log(`${G} ${this.color($,"bright")}`),console.log(this.color(" \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","dim")),console.log(` \u2502 ${this.color("p50","cyan")} ${e(J.p50).padStart(10)} \u2502 ${this.color("min","dim")} ${e(J.min).padStart(10)} \u2502`),console.log(` \u2502 ${this.color("p95","yellow")} ${e(J.p95).padStart(10)} \u2502 ${this.color("max","dim")} ${e(J.max).padStart(10)} \u2502`),console.log(` \u2502 ${this.color("p99","red")} ${e(J.p99).padStart(10)} \u2502 ${this.color("mean","dim")} ${e(J.mean).padStart(10)} \u2502`),console.log(this.color(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518","dim")),console.log(this.color(` \u03C3 ${J.stdDev.toFixed(2)}ms | ${J.iterations} samples | ${J.failures} failures (${J.failureRate}%)`,"dim")),X&&J.timings.length>0){console.log(),console.log(this.color(" Distribution:","dim"));let Q=e9(J.timings,8,30);for(let Y of Q)console.log(` ${this.color(Y,"dim")}`)}}logProfileSummary(Z){if(!this.shouldShowOutput())return;let X=Z.reduce((W,$)=>W+$.stats.iterations,0),J=Z.reduce((W,$)=>W+$.stats.failures,0);if(console.log(),console.log(this.color("\u2500".repeat(50),"dim")),console.log(`${this.color("\u26A1 Profile Summary:","magenta")} ${Z.length} request${Z.length===1?"":"s"}, ${X} total iterations`),J>0)console.log(this.color(` ${J} total failures`,"yellow"))}}class l0{logger;profileConfig;constructor(Z,X){this.profileConfig=X,this.logger=new a(Z.output)}async executeSingleIteration(Z){let X=performance.now(),J=Z1.buildCommand(Z),W=await Z1.executeCurl(J);if(W.success)return{request:Z,success:!0,status:W.status,headers:W.headers,body:$1(W.body,W.headers?.["content-type"]),metrics:{...W.metrics,duration:performance.now()-X}};return{request:Z,success:!1,error:W.error,metrics:{duration:performance.now()-X}}}async executeWithConcurrency(Z,X,J){let W=[];for(let $=0;$<X;$+=J){let G=Math.min(J,X-$),Q=await Promise.all(Array.from({length:G},()=>this.executeSingleIteration(Z)));W.push(...Q)}return W}async profileRequest(Z,X=0){let J=this.profileConfig.iterations,W=this.profileConfig.warmup??1,$=this.profileConfig.concurrency??1,G=Z.name||`Request ${X+1}`;this.logger.logProfileStart(G,J,W,$);let Q=$===1?await this.executeSequentially(Z,J):await this.executeWithConcurrency(Z,J,$),Y=[],z=0;for(let B of Q)if(B.success&&B.metrics?.duration!==void 0)Y.push(B.metrics.duration);else z++,Y.push(0);let H=Y.map((B,M)=>Q[M].success?B:-1).filter((B)=>B>=0),K=t9(H,Math.min(W,H.length),z);return{request:Z,stats:K,iterations:Q}}async executeSequentially(Z,X){let J=[];for(let W=0;W<X;W++){let $=await this.executeSingleIteration(Z);J.push($)}return J}async profileRequests(Z){let X=[];for(let J=0;J<Z.length;J++){let W=await this.profileRequest(Z[J],J);X.push(W),this.logger.logProfileResult(W,this.profileConfig.histogram??!1)}return X}}function a0(Z,X){if(!X)return{success:!0};let J=[];if(X.status!==void 0){let $=J4(Z.status,X.status);J.push(...$)}if(X.headers){let $=W4(Z.headers,X.headers);J.push(...$)}if(X.body!==void 0){let $=f1(Z.body,X.body,"");J.push(...$)}if(X.responseTime!==void 0&&Z.metrics){let $=Z.metrics.duration;if(!p1($,X.responseTime))J.push(`Expected response time to match ${X.responseTime}ms, got ${$.toFixed(2)}ms`)}let W=J.length>0;if(X.failure===!0){if(W)return{success:!1,error:J.join("; ")};let $=Z.status||0;if($>=400)return{success:!0};return{success:!1,error:`Expected request to fail (4xx/5xx) but got status ${$}`}}if(W)return{success:!1,error:J.join("; ")};return{success:!0}}function J4(Z,X){let J=Array.isArray(X)?X:[X];if(!J.includes(Z||0))return[`Expected status ${J.join(" or ")}, got ${Z}`];return[]}function W4(Z,X){let J=[];for(let[W,$]of Object.entries(X)){let G=Z?.[W]||Z?.[W.toLowerCase()];if(G!==$)J.push(`Expected header ${W}="${$}", got "${G}"`)}return J}function f1(Z,X,J){let W=[];if(typeof X!=="object"||X===null){let $=L1(Z,X,J||"body");if(!$.isValid)W.push($.error);return W}if(Array.isArray(X)){if(Array.isArray(Z)){for(let G=0;G<X.length;G++){let Q=X[G],Y=`${J||"body"}[${G}]`;if(typeof Q==="object"&&Q!==null){if(!Z.some((H)=>{return f1(H,Q,Y).length===0}))W.push(`Expected ${J||"body"} to contain item matching ${JSON.stringify(Q)}, but no match found`)}else if(!Z.some((H)=>{return L1(H,Q,Y).isValid}))W.push(`Expected ${J||"body"} to contain item matching ${JSON.stringify(Q)}, but no match found`)}return W}let $=L1(Z,X,J||"body");if(!$.isValid)W.push($.error);return W}for(let[$,G]of Object.entries(X)){let Q=J?`${J}.${$}`:$,Y;if(Array.isArray(Z)&&$4($))Y=G4(Z,$);else Y=Z?.[$];if(typeof G==="object"&&G!==null){let z=f1(Y,G,Q);W.push(...z)}else{let z=L1(Y,G,Q);if(!z.isValid)W.push(z.error)}}return W}function L1(Z,X,J){if(X==="*")return{isValid:!0};if(Array.isArray(X)){if(!X.some(($)=>{if($==="*")return!0;if(typeof $==="string"&&n0($))return o0(Z,$);if(typeof $==="string"&&i0($))return p1(Z,$);return Z===$}))return{isValid:!1,error:`Expected ${J} to match one of ${JSON.stringify(X)}, got ${JSON.stringify(Z)}`};return{isValid:!0}}if(typeof X==="string"&&n0(X)){if(!o0(Z,X))return{isValid:!1,error:`Expected ${J} to match pattern ${X}, got ${JSON.stringify(Z)}`};return{isValid:!0}}if(typeof X==="string"&&i0(X)){if(!p1(Z,X))return{isValid:!1,error:`Expected ${J} to match range ${X}, got ${JSON.stringify(Z)}`};return{isValid:!0}}if(X==="null"||X===null){if(Z!==null)return{isValid:!1,error:`Expected ${J} to be null, got ${JSON.stringify(Z)}`};return{isValid:!0}}if(Z!==X)return{isValid:!1,error:`Expected ${J} to be ${JSON.stringify(X)}, got ${JSON.stringify(Z)}`};return{isValid:!0}}function n0(Z){return Z.startsWith("^")||Z.endsWith("$")||Z.includes("\\d")||Z.includes("\\w")||Z.includes("\\s")}function o0(Z,X){let J=String(Z);try{return new RegExp(X).test(J)}catch{return!1}}function i0(Z){return/^(>=?|<=?|>|<)\s*[\d.-]+(\s*,\s*(>=?|<=?|>|<)\s*[\d.-]+)*$/.test(Z)}function p1(Z,X){let J=Number(Z);if(Number.isNaN(J))return!1;let W=X.match(/^([\d.-]+)\s*-\s*([\d.-]+)$/);if(W){let G=Number(W[1]),Q=Number(W[2]);return J>=G&&J<=Q}return X.split(",").map((G)=>G.trim()).every((G)=>{let Q=G.match(/^(>=?|<=?|>|<)\s*([\d.-]+)$/);if(!Q)return!1;let Y=Q[1],z=Number(Q[2]);switch(Y){case">":return J>z;case">=":return J>=z;case"<":return J<z;case"<=":return J<=z;default:return!1}})}function $4(Z){return/^\[.*\]$/.test(Z)||Z==="*"||Z.startsWith("slice(")}function G4(Z,X){if(X==="*")return Z;if(X.startsWith("[")&&X.endsWith("]")){let J=X.slice(1,-1);if(J==="*")return Z;let W=Number(J);if(!Number.isNaN(W))return W>=0?Z[W]:Z[Z.length+W]}if(X.startsWith("slice(")){let J=X.match(/slice\((\d+)(?:,(\d+))?\)/);if(J){let W=Number(J[1]),$=J[2]?Number(J[2]):void 0;return Z.slice(W,$)}}return}async function c1(Z,X,J={}){if(Z.success&&X.expect){let G=a0(Z,X.expect);if(!G.success)Z.success=!1,Z.error=G.error}let{snapshotManager:W,snapshotConfig:$}=J;if(W&&$&&X.sourceFile&&Z.success){let G=await W.compareAndUpdate(X.sourceFile,X.name||"Request",Z,$);if(Z.snapshotResult=G,!G.match&&!G.updated){if(Z.success=!1,!Z.error)Z.error="Snapshot mismatch"}}return Z}function Q4(Z,X,J){return X*J**(Z-1)}async function r0(Z,X={}){let{config:J,shouldRetry:W,onRetry:$}=X,G=(J?.count??0)+1,Q=J?.delay??0,Y=J?.backoff??1,z=0,H;while(z<G){if(z>0&&$)$(z,J?.count??0);if(z>0&&Q>0){let K=Q4(z,Q,Y);await Bun.sleep(K)}z++;try{let K=await Z();if(W?.(K)){H="Operation returned retriable result";continue}return{value:K,success:!0,attempts:z}}catch(K){H=K instanceof Error?K.message:String(K)}}return{success:!1,attempts:z,error:H}}import*as r from"path";class s0{excludePaths;matchRules;constructor(Z){this.excludePaths=new Set(Z.exclude||[]),this.matchRules=new Map(Object.entries(Z.match||{}))}compare(Z,X){let J=[];if(Z.status!==void 0||X.status!==void 0){if(Z.status!==X.status&&!this.isExcluded("status"))J.push({path:"status",expected:Z.status,received:X.status,type:"changed"})}if(Z.headers||X.headers){let W=this.compareObjects(Z.headers||{},X.headers||{},"headers");J.push(...W)}if(Z.body!==void 0||X.body!==void 0){let W=this.deepCompare(Z.body,X.body,"body");J.push(...W)}return{match:J.length===0,differences:J}}deepCompare(Z,X,J){if(this.isExcluded(J))return[];if(this.matchesRule(J,X))return[];if(Z===null&&X===null)return[];if(Z===void 0&&X===void 0)return[];let W=this.getType(Z),$=this.getType(X);if(W!==$)return[{path:J,expected:Z,received:X,type:"type_mismatch"}];if(W!=="object"&&W!=="array"){if(Z!==X)return[{path:J,expected:Z,received:X,type:"changed"}];return[]}if(W==="array")return this.compareArrays(Z,X,J);return this.compareObjects(Z,X,J)}compareArrays(Z,X,J){let W=[],$=Math.max(Z.length,X.length);for(let G=0;G<$;G++){let Q=`${J}[${G}]`;if(G>=Z.length){if(!this.isExcluded(Q))W.push({path:Q,expected:void 0,received:X[G],type:"added"})}else if(G>=X.length){if(!this.isExcluded(Q))W.push({path:Q,expected:Z[G],received:void 0,type:"removed"})}else{let Y=this.deepCompare(Z[G],X[G],Q);W.push(...Y)}}return W}compareObjects(Z,X,J){let W=[],$=new Set([...Object.keys(Z),...Object.keys(X)]);for(let G of $){let Q=J?`${J}.${G}`:G,Y=G in Z,z=G in X;if(!Y&&z){if(!this.isExcluded(Q))W.push({path:Q,expected:void 0,received:X[G],type:"added"})}else if(Y&&!z){if(!this.isExcluded(Q))W.push({path:Q,expected:Z[G],received:void 0,type:"removed"})}else{let H=this.deepCompare(Z[G],X[G],Q);W.push(...H)}}return W}isExcluded(Z){if(this.excludePaths.has(Z))return!0;for(let X of this.excludePaths){if(X.startsWith("*.")){let J=X.slice(2);if(Z.endsWith(`.${J}`))return!0;if(Z.split(".").pop()===J)return!0}if(X.includes("[*]")){if(new RegExp(`^${X.replace(/\[\*\]/g,"\\[\\d+\\]").replace(/\./g,"\\.")}$`).test(Z))return!0}}return!1}matchesRule(Z,X){let J=this.matchRules.get(Z);if(!J)return!1;if(J==="*")return!0;if(J.startsWith("regex:")){let W=J.slice(6);try{return new RegExp(W).test(String(X))}catch{return!1}}return!1}getType(Z){if(Z===null)return"null";if(Z===void 0)return"undefined";if(Array.isArray(Z))return"array";return typeof Z}}var G2=1,Q2="__snapshots__";class u1{snapshotDir;globalConfig;writeLocks=new Map;constructor(Z={}){this.globalConfig=Z,this.snapshotDir=Z.dir||Q2}getSnapshotPath(Z){let X=r.dirname(Z),J=r.basename(Z,r.extname(Z));return r.join(X,this.snapshotDir,`${J}.snap.json`)}async load(Z){let X=this.getSnapshotPath(Z);try{let J=Bun.file(X);if(!await J.exists())return null;let W=await J.text();return JSON.parse(W)}catch{return null}}async save(Z,X){let J=this.getSnapshotPath(Z),W=this.writeLocks.get(J),$=(async()=>{if(W)await W;let G=r.dirname(J);await(await import("fs/promises")).mkdir(G,{recursive:!0});let Y=JSON.stringify(X,null,2);await Bun.write(J,Y)})();this.writeLocks.set(J,$),await $,this.writeLocks.delete(J)}async get(Z,X){return(await this.load(Z))?.snapshots[X]||null}createSnapshot(Z,X){let J=X.include||["body"],W={hash:"",updatedAt:new Date().toISOString()};if(J.includes("status")&&Z.status!==void 0)W.status=Z.status;if(J.includes("headers")&&Z.headers)W.headers=this.normalizeHeaders(Z.headers);if(J.includes("body")&&Z.body!==void 0)W.body=Z.body;return W.hash=this.hash(W),W}normalizeHeaders(Z){let X={},J=Object.keys(Z).sort();for(let W of J)X[W.toLowerCase()]=Z[W];return X}hash(Z){let X=JSON.stringify(Z),J=new Bun.CryptoHasher("md5");return J.update(X),J.digest("hex").slice(0,8)}async compareAndUpdate(Z,X,J,W){let $=W.name||X,G=await this.get(Z,$),Q=this.createSnapshot(J,W);if(!G){if(this.globalConfig.ci)return{match:!1,isNew:!0,updated:!1,differences:[{path:"",expected:"snapshot",received:"none",type:"removed"}]};return await this.updateSnapshot(Z,$,Q),{match:!0,isNew:!0,updated:!0,differences:[]}}let z=new s0(W).compare(G,Q);if(z.match)return{match:!0,isNew:!1,updated:!1,differences:[]};let H=this.globalConfig.updateMode||"none";if(H==="all"||H==="failing")return await this.updateSnapshot(Z,$,Q),{match:!0,isNew:!1,updated:!0,differences:z.differences};return{match:!1,isNew:!1,updated:!1,differences:z.differences}}async updateSnapshot(Z,X,J){let W=await this.load(Z);if(!W)W={version:G2,snapshots:{}};W.snapshots[X]=J,await this.save(Z,W)}static mergeConfig(Z,X){if(!X&&!Z?.enabled)return null;if(X===!0)return{enabled:!0,include:Z?.include||["body"],exclude:Z?.exclude||[],match:Z?.match||{}};if(typeof X==="object"&&X.enabled!==!1)return{enabled:!0,name:X.name,include:X.include||Z?.include||["body"],exclude:[...Z?.exclude||[],...X.exclude||[]],match:{...Z?.match||{},...X.match||{}}};if(Z?.enabled&&X===void 0)return{enabled:!0,include:Z.include||["body"],exclude:Z.exclude||[],match:Z.match||{}};return null}}function t0(Z,X){let J=X.split("."),W=Z;for(let $ of J){if(W===null||W===void 0)return;if(typeof W!=="object")return;let G=$.match(/^(\w+)\[(\d+)\]$/);if(G){let[,Q,Y]=G,z=Number.parseInt(Y,10);if(W=W[Q],Array.isArray(W))W=W[z];else return}else if(/^\d+$/.test($)&&Array.isArray(W))W=W[Number.parseInt($,10)];else W=W[$]}return W}function l1(Z){if(Z===void 0||Z===null)return"";if(typeof Z==="string")return Z;if(typeof Z==="number"||typeof Z==="boolean")return String(Z);return JSON.stringify(Z)}function Y4(Z,X){let J={},W={status:Z.status,headers:Z.headers||{},body:Z.body,metrics:Z.metrics};for(let[$,G]of Object.entries(X)){let Q=t0(W,G);J[$]=l1(Q)}return J}function z4(){return{}}function Y2(Z){let X=Z.trim(),J=X.match(/^(.+?)\s+(exists|not-exists)$/i);if(J)return{left:J[1].trim(),operator:J[2].toLowerCase()};let W=/^(.+?)\s*(==|!=|>=|<=|>|<|contains|matches)\s*(.+)$/i,$=X.match(W);if(!$)return null;let[,G,Q,Y]=$,z=z2(Y.trim());return{left:G.trim(),operator:Q.toLowerCase(),right:z}}function z2(Z){if(Z==="true")return!0;if(Z==="false")return!1;let X=Number(Z);if(!Number.isNaN(X)&&Z!=="")return X;if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);return Z}function H2(Z,X){let J=Z.startsWith("store.")?Z.slice(6):Z;if(J in X){let G=X[J];if(G.startsWith("{")||G.startsWith("["))try{return JSON.parse(G)}catch{return G}let Q=Number(G);if(!Number.isNaN(Q)&&G!=="")return Q;if(G==="true")return!0;if(G==="false")return!1;return G}let W=J.split("."),$=W[0];if($ in X){let G=X[$];try{let Q=JSON.parse(G);return t0(Q,W.slice(1).join("."))}catch{return}}return}function H4(Z,X,J){if(J)return Z===X;return Z.toLowerCase()===X.toLowerCase()}function n1(Z,X){let J=H2(Z.left,X),W=Z.caseSensitive??!1,$=(Q)=>{if(Q===void 0)return"undefined";if(Q===null)return"null";if(typeof Q==="string")return`"${Q}"`;return String(Q)},G=`${Z.left} ${Z.operator}${Z.right!==void 0?` ${$(Z.right)}`:""}`;switch(Z.operator){case"exists":return{passed:J!==void 0&&J!==null&&J!=="",description:G};case"not-exists":return{passed:J===void 0||J===null||J==="",description:G};case"==":{let Q;if(typeof J==="string"&&typeof Z.right==="string")Q=H4(J,Z.right,W);else Q=J==Z.right;return{passed:Q,description:G}}case"!=":{let Q;if(typeof J==="string"&&typeof Z.right==="string")Q=!H4(J,Z.right,W);else Q=J!=Z.right;return{passed:Q,description:G}}case">":return{passed:Number(J)>Number(Z.right),description:G};case"<":return{passed:Number(J)<Number(Z.right),description:G};case">=":return{passed:Number(J)>=Number(Z.right),description:G};case"<=":return{passed:Number(J)<=Number(Z.right),description:G};case"contains":{let Q=l1(J),Y=String(Z.right??"");return{passed:W?Q.includes(Y):Q.toLowerCase().includes(Y.toLowerCase()),description:G}}case"matches":{let Q=l1(J),Y=String(Z.right??"");try{return{passed:new RegExp(Y,W?"":"i").test(Q),description:G}}catch{return{passed:!1,description:`${G} (invalid regex)`}}}default:return{passed:!1,description:`unknown operator: ${Z.operator}`}}}function K4(Z,X){if(typeof Z==="string"){let J=Y2(Z);if(!J)return{shouldRun:!1,reason:`invalid condition syntax: "${Z}"`};let W=n1(J,X);return{shouldRun:W.passed,reason:W.passed?void 0:`condition not met: ${W.description}`}}if(Z.all&&Z.all.length>0){for(let J of Z.all){let W=n1(J,X);if(!W.passed)return{shouldRun:!1,reason:`condition not met: ${W.description}`}}return{shouldRun:!0}}if(Z.any&&Z.any.length>0){let J=[];for(let W of Z.any){let $=n1(W,X);if($.passed)return{shouldRun:!0};J.push($.description)}return{shouldRun:!1,reason:`no conditions met: ${J.join(", ")}`}}if(Z.left&&Z.operator){let J={left:Z.left,operator:Z.operator,right:Z.right,caseSensitive:Z.caseSensitive},W=n1(J,X);return{shouldRun:W.passed,reason:W.passed?void 0:`condition not met: ${W.description}`}}return{shouldRun:!0}}class e0{poolConfig;constructor(Z={}){this.poolConfig={enabled:!0,maxStreamsPerHost:10,keepaliveTime:60,connectTimeout:30,...Z}}getHostKey(Z){try{let X=new URL(Z);return`${X.protocol}//${X.host}`}catch{return Z}}groupRequestsByHost(Z){let X=new Map;return Z.forEach((J,W)=>{let $=this.getHostKey(J.url),G=X.get($)||[];G.push({index:W,config:J}),X.set($,G)}),Array.from(X.entries()).map(([J,W])=>({host:J,requests:W}))}buildRequestArgs(Z,X){let{args:J,url:W}=F1(Z,{writeOutMarker:g0(X),includeSilentFlags:!1,includeHttp2Flag:!1,includeOutputFlag:!1});return J.push(W),J}buildBatchedCommand(Z){let X=[];return X.push("-Z"),X.push("--parallel-max",this.poolConfig.maxStreamsPerHost.toString()),X.push("--http2"),X.push("--keepalive-time",this.poolConfig.keepaliveTime.toString()),X.push("--connect-timeout",this.poolConfig.connectTimeout.toString()),X.push("-s","-S"),Z.requests.forEach((J,W)=>{if(W>0)X.push("--next");let $=this.buildRequestArgs(J.config,J.index);X.push(...$)}),X}parseBatchedOutput(Z,X,J,W){let $=new Map;for(let G of J.requests){let{found:Q,metricsJson:Y,startIdx:z}=f0(Z,G.index);if(!Q){$.set(G.index,{request:G.config,success:!1,error:X||`Request failed (exit code: ${W})`,metrics:{duration:0}});continue}let H={};try{H=JSON.parse(Y)}catch{}let K=z,B=0;for(let O of J.requests){if(O.index===G.index)continue;let I=`__CURL_BATCH_${O.index}_END__`,N=Z.indexOf(I);if(N!==-1&&N<K&&N+I.length>B)B=N+I.length}let M=Z.substring(B,K).trim(),R=N1(H),_=I1(H);$.set(G.index,{request:G.config,success:c0(R),status:R,body:$1(M),metrics:_})}return $}async executeBatch(Z){let X=this.buildBatchedCommand(Z);try{let J=Bun.spawn(["curl",...X],{stdout:"pipe",stderr:"pipe"}),W=await new Response(J.stdout).text(),$=await new Response(J.stderr).text();return await J.exited,this.parseBatchedOutput(W,$,Z,J.exitCode||0)}catch(J){let W=new Map;for(let $ of Z.requests)W.set($.index,{request:$.config,success:!1,error:J instanceof Error?J.message:String(J),metrics:{duration:0}});return W}}async executeAll(Z){let X=this.groupRequestsByHost(Z),J=new Map,W=X.map((G)=>this.executeBatch(G)),$=await Promise.all(W);for(let G of $)for(let[Q,Y]of G)J.set(Q,Y);return Z.map((G,Q)=>{return J.get(Q)||{request:Z[Q],success:!1,error:"Request not executed",metrics:{duration:0}}})}formatBatchedCommandForDisplay(Z){let X=this.buildBatchedCommand(Z);return T1(X)}}class Z9{logger;globalConfig;snapshotManager;pooledExecutor=null;constructor(Z={}){if(this.globalConfig=Z,this.logger=new a(Z.output),this.snapshotManager=new u1(Z.snapshot),Z.connectionPool?.enabled)this.pooledExecutor=new e0(Z.connectionPool)}mergeOutputConfig(Z){return{...this.globalConfig.output,...Z.sourceOutputConfig}}getSnapshotConfig(Z){return u1.mergeConfig(this.globalConfig.snapshot,Z.snapshot)}isFileAttachment(Z){return typeof Z==="object"&&Z!==null&&"file"in Z}async validateFileAttachments(Z){if(!Z.formData)return;let X=[];for(let[J,W]of Object.entries(Z.formData))if(this.isFileAttachment(W)){let $=W.file;if(!await Bun.file($).exists())X.push(`${J}: ${$}`)}if(X.length>0)return`File(s) not found: ${X.join(", ")}`;return}async executeRequest(Z,X=0){let J=performance.now(),W=this.mergeOutputConfig(Z),$=new a(W);$.logRequestStart(Z,X);let G=await this.validateFileAttachments(Z);if(G){let K={request:Z,success:!1,error:G,metrics:{duration:performance.now()-J}};return $.logRequestComplete(K),K}let Q=Z1.buildCommand(Z);if($.logCommand(Z1.formatCommandForDisplay(Q)),this.globalConfig.dryRun){let K={request:Z,success:!0,dryRun:!0,metrics:{duration:0}};return $.logRequestComplete(K),K}let Y=await r0(()=>Z1.executeCurl(Q),{config:Z.retry,shouldRetry:(K)=>!K.success,onRetry:(K,B)=>$.logRetry(K,B)});if(!Y.success||!Y.value?.success){let K={request:Z,success:!1,error:Y.error||Y.value?.error,metrics:{duration:performance.now()-J}};return $.logRequestComplete(K),K}let z=Y.value,H=this.processCurlResult(Z,z,J);return await c1(H,Z,{snapshotManager:this.snapshotManager,snapshotConfig:this.getSnapshotConfig(Z)}),$.logRequestComplete(H),H}processCurlResult(Z,X,J){let W=$1(X.body,X.headers?.["content-type"]);return{request:Z,success:!0,status:X.status,headers:X.headers,body:W,metrics:{...X.metrics,duration:performance.now()-J}}}async executeSequential(Z){let X=performance.now(),J=[],W=z4();for(let $=0;$<Z.length;$++){let G=this.interpolateStoreVariables(Z[$],W);if(G.when){let Y=K4(G.when,W);if(!Y.shouldRun){let z={request:G,success:!0,skipped:!0,skipReason:Y.reason};J.push(z),this.logger.logSkipped(G,$+1,Y.reason);continue}}let Q=await this.executeRequest(G,$+1);if(J.push(Q),Q.success&&G.store){let Y=Y4(Q,G.store);Object.assign(W,Y),this.logStoredValues(Y)}if(!Q.success&&!this.globalConfig.continueOnError){this.logger.logError("Stopping execution due to error");break}}return this.createSummary(J,performance.now()-X)}interpolateStoreVariables(Z,X){if(Object.keys(X).length===0)return Z;return v.interpolateVariables(Z,{},X)}logStoredValues(Z){if(Object.keys(Z).length===0)return;let X=Object.entries(Z);for(let[J,W]of X){let $=W.length>50?`${W.substring(0,50)}...`:W;this.logger.logInfo(`Stored: ${J} = "${$}"`)}}async executeParallel(Z){let X=performance.now();if(this.pooledExecutor&&!this.globalConfig.dryRun)return this.executePooled(Z,X);let J=this.globalConfig.maxConcurrency;if(!J||J>=Z.length){let $=Z.map((Q,Y)=>this.executeRequest(Q,Y+1)),G=await Promise.all($);return this.createSummary(G,performance.now()-X)}let W=[];for(let $=0;$<Z.length;$+=J){let Q=Z.slice($,$+J).map((H,K)=>this.executeRequest(H,$+K+1)),Y=await Promise.all(Q);if(W.push(...Y),Y.some((H)=>!H.success)&&!this.globalConfig.continueOnError){this.logger.logError("Stopping execution due to error");break}}return this.createSummary(W,performance.now()-X)}async executePooled(Z,X){this.logger.logInfo(`Using connection pooling (HTTP/2 multiplexing) for ${Z.length} requests`);let J=this.pooledExecutor.groupRequestsByHost(Z);for(let G of J)this.logger.logInfo(` ${G.host}: ${G.requests.length} request(s) batched`);let W=await this.pooledExecutor.executeAll(Z),$=[];for(let G=0;G<W.length;G++){let Q=W[G],Y=Z[G],z=this.mergeOutputConfig(Y),H=new a(z);if(H.logRequestStart(Y,G+1),await c1(Q,Y,{snapshotManager:this.snapshotManager,snapshotConfig:this.getSnapshotConfig(Y)}),H.logRequestComplete(Q),$.push(Q),!Q.success&&!this.globalConfig.continueOnError){this.logger.logError("Stopping execution due to error");break}}return this.createSummary($,performance.now()-X)}async execute(Z){this.logger.logExecutionStart(Z.length,this.globalConfig.execution||"sequential");let X=this.globalConfig.execution==="parallel"?await this.executeParallel(Z):await this.executeSequential(Z);if(this.logger.logSummary(X),this.globalConfig.output?.saveToFile)await this.saveSummaryToFile(X);return X}createSummary(Z,X){let J=Z.filter((G)=>G.skipped).length,W=Z.filter((G)=>G.success&&!G.skipped).length,$=Z.filter((G)=>!G.success).length;return{total:Z.length,successful:W,failed:$,skipped:J,duration:X,results:Z}}async saveSummaryToFile(Z){let X=this.globalConfig.output?.saveToFile;if(!X)return;let J=JSON.stringify(Z,null,2);await Bun.write(X,J),this.logger.logInfo(`Results saved to ${X}`)}}var U4=`${process.env.HOME}/.curl-runner-version-cache.json`,K2=86400000,U2="https://registry.npmjs.org/@curl-runner/cli/latest";class X9{async checkForUpdates(Z=!1){try{if(process.env.CI)return;let X=n();if(X==="0.0.0")return;if(!Z){let W=await this.getCachedVersion();if(W&&Date.now()-W.lastCheck<K2){this.compareVersions(X,W.latestVersion);return}}let J=await this.fetchLatestVersion();if(J)await this.setCachedVersion(J),this.compareVersions(X,J)}catch{}}async fetchLatestVersion(){try{let Z=await fetch(U2,{signal:AbortSignal.timeout(3000)});if(!Z.ok)return null;return(await Z.json()).version}catch{return null}}compareVersions(Z,X){if(this.isNewerVersion(Z,X))console.log(),console.log(D("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E","yellow")),console.log(D("\u2502","yellow")+" "+D("\u2502","yellow")),console.log(D("\u2502","yellow")+" "+D("Update available!","bright")+` ${D(Z,"red")} \u2192 ${D(X,"green")} `+D("\u2502","yellow")),console.log(D("\u2502","yellow")+" "+D("\u2502","yellow")),console.log(D("\u2502","yellow")+" Run "+D("curl-runner upgrade","cyan")+" to update "+D("\u2502","yellow")),console.log(D("\u2502","yellow")+" "+D("\u2502","yellow")),console.log(D("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F","yellow")),console.log()}isNewerVersion(Z,X){try{let J=Z.replace(/^v/,""),W=X.replace(/^v/,""),$=J.split(".").map(Number),G=W.split(".").map(Number);for(let Q=0;Q<Math.max($.length,G.length);Q++){let Y=$[Q]||0,z=G[Q]||0;if(z>Y)return!0;if(z<Y)return!1}return!1}catch{return!1}}async getCachedVersion(){try{let Z=Bun.file(U4);if(await Z.exists())return JSON.parse(await Z.text())}catch{}return null}async setCachedVersion(Z){try{let X={lastCheck:Date.now(),latestVersion:Z};await Bun.write(U4,JSON.stringify(X))}catch{}}}import{watch as B2}from"fs";class J9{watchers=[];debounceTimer=null;isRunning=!1;pendingRun=!1;options;constructor(Z){this.options=Z}async start(){let{files:Z,logger:X}=this.options;await this.runRequests();for(let J of Z)try{let W=B2(J,($)=>{if($==="change")this.handleFileChange(J)});W.on("error",($)=>{X.logWarning(`Watch error on ${J}: ${$.message}`)}),this.watchers.push(W)}catch(W){X.logWarning(`Failed to watch ${J}: ${W instanceof Error?W.message:String(W)}`)}X.logWatch(Z),this.setupSignalHandlers(),await this.keepAlive()}handleFileChange(Z){let{config:X,logger:J}=this.options,W=X.debounce??300;if(this.debounceTimer)clearTimeout(this.debounceTimer);this.debounceTimer=setTimeout(async()=>{if(this.isRunning){this.pendingRun=!0;return}if(X.clear!==!1)console.clear();J.logFileChanged(Z),await this.runRequests()},W)}async runRequests(){let{onRun:Z,logger:X}=this.options;this.isRunning=!0;try{await Z()}catch(J){X.logError(J instanceof Error?J.message:String(J))}if(this.isRunning=!1,this.pendingRun){this.pendingRun=!1;let{config:J}=this.options;if(J.clear!==!1)console.clear();X.logFileChanged("(queued change)"),await this.runRequests()}else X.logWatchReady()}setupSignalHandlers(){let Z=()=>{this.stop(),process.exit(0)};process.on("SIGINT",Z),process.on("SIGTERM",Z)}async keepAlive(){while(!0)await Bun.sleep(1000)}stop(){for(let Z of this.watchers)Z.close();if(this.watchers=[],this.debounceTimer)clearTimeout(this.debounceTimer),this.debounceTimer=null}}var X1=V1($9(),1);import{stdout as T4,stdin as T2}from"process";var m=V1(Q9(),1);import I2 from"readline";var N2=(Z)=>Z===161||Z===164||Z===167||Z===168||Z===170||Z===173||Z===174||Z>=176&&Z<=180||Z>=182&&Z<=186||Z>=188&&Z<=191||Z===198||Z===208||Z===215||Z===216||Z>=222&&Z<=225||Z===230||Z>=232&&Z<=234||Z===236||Z===237||Z===240||Z===242||Z===243||Z>=247&&Z<=250||Z===252||Z===254||Z===257||Z===273||Z===275||Z===283||Z===294||Z===295||Z===299||Z>=305&&Z<=307||Z===312||Z>=319&&Z<=322||Z===324||Z>=328&&Z<=331||Z===333||Z===338||Z===339||Z===358||Z===359||Z===363||Z===462||Z===464||Z===466||Z===468||Z===470||Z===472||Z===474||Z===476||Z===593||Z===609||Z===708||Z===711||Z>=713&&Z<=715||Z===717||Z===720||Z>=728&&Z<=731||Z===733||Z===735||Z>=768&&Z<=879||Z>=913&&Z<=929||Z>=931&&Z<=937||Z>=945&&Z<=961||Z>=963&&Z<=969||Z===1025||Z>=1040&&Z<=1103||Z===1105||Z===8208||Z>=8211&&Z<=8214||Z===8216||Z===8217||Z===8220||Z===8221||Z>=8224&&Z<=8226||Z>=8228&&Z<=8231||Z===8240||Z===8242||Z===8243||Z===8245||Z===8251||Z===8254||Z===8308||Z===8319||Z>=8321&&Z<=8324||Z===8364||Z===8451||Z===8453||Z===8457||Z===8467||Z===8470||Z===8481||Z===8482||Z===8486||Z===8491||Z===8531||Z===8532||Z>=8539&&Z<=8542||Z>=8544&&Z<=8555||Z>=8560&&Z<=8569||Z===8585||Z>=8592&&Z<=8601||Z===8632||Z===8633||Z===8658||Z===8660||Z===8679||Z===8704||Z===8706||Z===8707||Z===8711||Z===8712||Z===8715||Z===8719||Z===8721||Z===8725||Z===8730||Z>=8733&&Z<=8736||Z===8739||Z===8741||Z>=8743&&Z<=8748||Z===8750||Z>=8756&&Z<=8759||Z===8764||Z===8765||Z===8776||Z===8780||Z===8786||Z===8800||Z===8801||Z>=8804&&Z<=8807||Z===8810||Z===8811||Z===8814||Z===8815||Z===8834||Z===8835||Z===8838||Z===8839||Z===8853||Z===8857||Z===8869||Z===8895||Z===8978||Z>=9312&&Z<=9449||Z>=9451&&Z<=9547||Z>=9552&&Z<=9587||Z>=9600&&Z<=9615||Z>=9618&&Z<=9621||Z===9632||Z===9633||Z>=9635&&Z<=9641||Z===9650||Z===9651||Z===9654||Z===9655||Z===9660||Z===9661||Z===9664||Z===9665||Z>=9670&&Z<=9672||Z===9675||Z>=9678&&Z<=9681||Z>=9698&&Z<=9701||Z===9711||Z===9733||Z===9734||Z===9737||Z===9742||Z===9743||Z===9756||Z===9758||Z===9792||Z===9794||Z===9824||Z===9825||Z>=9827&&Z<=9829||Z>=9831&&Z<=9834||Z===9836||Z===9837||Z===9839||Z===9886||Z===9887||Z===9919||Z>=9926&&Z<=9933||Z>=9935&&Z<=9939||Z>=9941&&Z<=9953||Z===9955||Z===9960||Z===9961||Z>=9963&&Z<=9969||Z===9972||Z>=9974&&Z<=9977||Z===9979||Z===9980||Z===9982||Z===9983||Z===10045||Z>=10102&&Z<=10111||Z>=11094&&Z<=11097||Z>=12872&&Z<=12879||Z>=57344&&Z<=63743||Z>=65024&&Z<=65039||Z===65533||Z>=127232&&Z<=127242||Z>=127248&&Z<=127277||Z>=127280&&Z<=127337||Z>=127344&&Z<=127373||Z===127375||Z===127376||Z>=127387&&Z<=127404||Z>=917760&&Z<=917999||Z>=983040&&Z<=1048573||Z>=1048576&&Z<=1114109,L2=(Z)=>Z===12288||Z>=65281&&Z<=65376||Z>=65504&&Z<=65510,R2=(Z)=>Z>=4352&&Z<=4447||Z===8986||Z===8987||Z===9001||Z===9002||Z>=9193&&Z<=9196||Z===9200||Z===9203||Z===9725||Z===9726||Z===9748||Z===9749||Z>=9800&&Z<=9811||Z===9855||Z===9875||Z===9889||Z===9898||Z===9899||Z===9917||Z===9918||Z===9924||Z===9925||Z===9934||Z===9940||Z===9962||Z===9970||Z===9971||Z===9973||Z===9978||Z===9981||Z===9989||Z===9994||Z===9995||Z===10024||Z===10060||Z===10062||Z>=10067&&Z<=10069||Z===10071||Z>=10133&&Z<=10135||Z===10160||Z===10175||Z===11035||Z===11036||Z===11088||Z===11093||Z>=11904&&Z<=11929||Z>=11931&&Z<=12019||Z>=12032&&Z<=12245||Z>=12272&&Z<=12287||Z>=12289&&Z<=12350||Z>=12353&&Z<=12438||Z>=12441&&Z<=12543||Z>=12549&&Z<=12591||Z>=12593&&Z<=12686||Z>=12688&&Z<=12771||Z>=12783&&Z<=12830||Z>=12832&&Z<=12871||Z>=12880&&Z<=19903||Z>=19968&&Z<=42124||Z>=42128&&Z<=42182||Z>=43360&&Z<=43388||Z>=44032&&Z<=55203||Z>=63744&&Z<=64255||Z>=65040&&Z<=65049||Z>=65072&&Z<=65106||Z>=65108&&Z<=65126||Z>=65128&&Z<=65131||Z>=94176&&Z<=94180||Z===94192||Z===94193||Z>=94208&&Z<=100343||Z>=100352&&Z<=101589||Z>=101632&&Z<=101640||Z>=110576&&Z<=110579||Z>=110581&&Z<=110587||Z===110589||Z===110590||Z>=110592&&Z<=110882||Z===110898||Z>=110928&&Z<=110930||Z===110933||Z>=110948&&Z<=110951||Z>=110960&&Z<=111355||Z===126980||Z===127183||Z===127374||Z>=127377&&Z<=127386||Z>=127488&&Z<=127490||Z>=127504&&Z<=127547||Z>=127552&&Z<=127560||Z===127568||Z===127569||Z>=127584&&Z<=127589||Z>=127744&&Z<=127776||Z>=127789&&Z<=127797||Z>=127799&&Z<=127868||Z>=127870&&Z<=127891||Z>=127904&&Z<=127946||Z>=127951&&Z<=127955||Z>=127968&&Z<=127984||Z===127988||Z>=127992&&Z<=128062||Z===128064||Z>=128066&&Z<=128252||Z>=128255&&Z<=128317||Z>=128331&&Z<=128334||Z>=128336&&Z<=128359||Z===128378||Z===128405||Z===128406||Z===128420||Z>=128507&&Z<=128591||Z>=128640&&Z<=128709||Z===128716||Z>=128720&&Z<=128722||Z>=128725&&Z<=128727||Z>=128732&&Z<=128735||Z===128747||Z===128748||Z>=128756&&Z<=128764||Z>=128992&&Z<=129003||Z===129008||Z>=129292&&Z<=129338||Z>=129340&&Z<=129349||Z>=129351&&Z<=129535||Z>=129648&&Z<=129660||Z>=129664&&Z<=129672||Z>=129680&&Z<=129725||Z>=129727&&Z<=129733||Z>=129742&&Z<=129755||Z>=129760&&Z<=129768||Z>=129776&&Z<=129784||Z>=131072&&Z<=196605||Z>=196608&&Z<=262141,Y9=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,a1=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,r1=/\t{1,1000}/y,z9=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,s1=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,j2=/\p{M}+/gu,S2={limit:1/0,ellipsis:""},I4=(Z,X={},J={})=>{let W=X.limit??1/0,$=X.ellipsis??"",G=X?.ellipsisWidth??($?I4($,S2,J).width:0),Q=J.ansiWidth??0,Y=J.controlWidth??0,z=J.tabWidth??8,H=J.ambiguousWidth??1,K=J.emojiWidth??2,B=J.fullWidthWidth??2,M=J.regularWidth??1,R=J.wideWidth??2,_=0,O=0,I=Z.length,N=0,j=!1,A=I,k=Math.max(0,W-G),w=0,C=0,F=0,T=0;Z:for(;;){if(C>w||O>=I&&O>_){let f=Z.slice(w,C)||Z.slice(_,O);N=0;for(let c of f.replaceAll(j2,"")){let g=c.codePointAt(0)||0;if(L2(g)?T=B:R2(g)?T=R:H!==M&&N2(g)?T=H:T=M,F+T>k&&(A=Math.min(A,Math.max(w,_)+N)),F+T>W){j=!0;break Z}N+=c.length,F+=T}w=C=0}if(O>=I)break;if(s1.lastIndex=O,s1.test(Z)){if(N=s1.lastIndex-O,T=N*M,F+T>k&&(A=Math.min(A,O+Math.floor((k-F)/M))),F+T>W){j=!0;break}F+=T,w=_,C=O,O=_=s1.lastIndex;continue}if(Y9.lastIndex=O,Y9.test(Z)){if(F+Q>k&&(A=Math.min(A,O)),F+Q>W){j=!0;break}F+=Q,w=_,C=O,O=_=Y9.lastIndex;continue}if(a1.lastIndex=O,a1.test(Z)){if(N=a1.lastIndex-O,T=N*Y,F+T>k&&(A=Math.min(A,O+Math.floor((k-F)/Y))),F+T>W){j=!0;break}F+=T,w=_,C=O,O=_=a1.lastIndex;continue}if(r1.lastIndex=O,r1.test(Z)){if(N=r1.lastIndex-O,T=N*z,F+T>k&&(A=Math.min(A,O+Math.floor((k-F)/z))),F+T>W){j=!0;break}F+=T,w=_,C=O,O=_=r1.lastIndex;continue}if(z9.lastIndex=O,z9.test(Z)){if(F+K>k&&(A=Math.min(A,O)),F+K>W){j=!0;break}F+=K,w=_,C=O,O=_=z9.lastIndex;continue}O+=1}return{width:j?k:F,index:j?A:I,truncated:j,ellipsed:j&&W>=G}},E2={limit:1/0,ellipsis:"",ellipsisWidth:0},R1=(Z,X={})=>I4(Z,E2,X).width,e1="\x1B",N4="\x9B",A2=39,B9="\x07",L4="[",V2="]",R4="m",O9=`${V2}8;;`,M4=new RegExp(`(?:\\${L4}(?<code>\\d+)m|\\${O9}(?<uri>.*)${B9})`,"y"),k2=(Z)=>{if(Z>=30&&Z<=37||Z>=90&&Z<=97)return 39;if(Z>=40&&Z<=47||Z>=100&&Z<=107)return 49;if(Z===1||Z===2)return 22;if(Z===3)return 23;if(Z===4)return 24;if(Z===7)return 27;if(Z===8)return 28;if(Z===9)return 29;if(Z===0)return 0},D4=(Z)=>`${e1}${L4}${Z}${R4}`,F4=(Z)=>`${e1}${O9}${Z}${B9}`,P2=(Z)=>Z.map((X)=>R1(X)),H9=(Z,X,J)=>{let W=X[Symbol.iterator](),$=!1,G=!1,Q=Z.at(-1),Y=Q===void 0?0:R1(Q),z=W.next(),H=W.next(),K=0;for(;!z.done;){let B=z.value,M=R1(B);Y+M<=J?Z[Z.length-1]+=B:(Z.push(B),Y=0),(B===e1||B===N4)&&($=!0,G=X.startsWith(O9,K+1)),$?G?B===B9&&($=!1,G=!1):B===R4&&($=!1):(Y+=M,Y===J&&!H.done&&(Z.push(""),Y=0)),z=H,H=W.next(),K+=B.length}Q=Z.at(-1),!Y&&Q!==void 0&&Q.length>0&&Z.length>1&&(Z[Z.length-2]+=Z.pop())},C2=(Z)=>{let X=Z.split(" "),J=X.length;for(;J>0&&!(R1(X[J-1])>0);)J--;return J===X.length?Z:X.slice(0,J).join(" ")+X.slice(J).join("")},w2=(Z,X,J={})=>{if(J.trim!==!1&&Z.trim()==="")return"";let W="",$,G,Q=Z.split(" "),Y=P2(Q),z=[""];for(let[_,O]of Q.entries()){J.trim!==!1&&(z[z.length-1]=(z.at(-1)??"").trimStart());let I=R1(z.at(-1)??"");if(_!==0&&(I>=X&&(J.wordWrap===!1||J.trim===!1)&&(z.push(""),I=0),(I>0||J.trim===!1)&&(z[z.length-1]+=" ",I++)),J.hard&&Y[_]>X){let N=X-I,j=1+Math.floor((Y[_]-N-1)/X);Math.floor((Y[_]-1)/X)<j&&z.push(""),H9(z,O,X);continue}if(I+Y[_]>X&&I>0&&Y[_]>0){if(J.wordWrap===!1&&I<X){H9(z,O,X);continue}z.push("")}if(I+Y[_]>X&&J.wordWrap===!1){H9(z,O,X);continue}z[z.length-1]+=O}J.trim!==!1&&(z=z.map((_)=>C2(_)));let H=z.join(`
155
155
  `),K=H[Symbol.iterator](),B=K.next(),M=K.next(),R=0;for(;!B.done;){let _=B.value,O=M.value;if(W+=_,_===e1||_===N4){M4.lastIndex=R+1;let N=M4.exec(H)?.groups;if(N?.code!==void 0){let j=Number.parseFloat(N.code);$=j===A2?void 0:j}else N?.uri!==void 0&&(G=N.uri.length===0?void 0:N.uri)}let I=$?k2($):void 0;O===`
156
156
  `?(G&&(W+=F4("")),$&&I&&(W+=D4(I))):_===`
157
157
  `&&($&&I&&(W+=D4($)),G&&(W+=F4(G))),R+=_.length,B=M,M=K.next()}return W};function K9(Z,X,J){return String(Z).normalize().replaceAll(`\r
@@ -524,5 +524,5 @@ ${this.logger.color("YAML STRUCTURE:","yellow")}
524
524
  method: GET
525
525
  `)}}var O7=new $3;O7.run(process.argv.slice(2));
526
526
 
527
- //# debugId=370B90C78426925364756E2164756E21
527
+ //# debugId=26152E1659D9305064756E2164756E21
528
528
  //# sourceMappingURL=cli.js.map