@vibgrate/cli 2026.701.4 → 2026.702.1

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.
@@ -1,27 +1,27 @@
1
- import {a}from'./chunk-MKDRULJ6.js';import {p,o,j,n,a as a$1,i,k,d,e,q,r,s}from'./chunk-XTHPCEME.js';import {b}from'./chunk-EK7ODJWE.js';import*as B from'path';import {basename,dirname}from'path';import*as xe from'fs/promises';import {readFile,mkdtemp,rm as rm$1,mkdir,writeFile}from'fs/promises';import U from'typescript';import*as fs from'crypto';import E from'chalk';import*as Mn from'os';import {parse}from'yaml';import {spawn,execFile}from'child_process';import*as sn from'fs';import {mkdirSync,writeFileSync}from'fs';import {createRequire}from'module';import*as ia from'zlib';import {promisify}from'util';function ba(t){switch(t){case "node":return "nodejs";case "python":return "python";case "dotnet":return "dotnet";case "java":return "java";case "php":return "php";case "ruby":return "ruby";case "go":return "go";default:return null}}function it(t,e){if(!e)return null;switch(t){case "python":case "php":case "ruby":case "go":{let n=e.match(/(\d+)\.(\d+)/);return n?`${n[1]}.${n[2]}`:null}case "dotnet":{let n=e.match(/(\d+)\.(\d+)/)??e.match(/(\d+)/);return n?n[2]!==void 0?`${n[1]}.${n[2]}`:`${n[1]}.0`:null}case "node":{let n=e.match(/(\d+)/);return n?n[1]:null}case "java":{let n=e.match(/1\.(\d+)/);if(n)return n[1];let r=e.match(/(\d+)/);return r?r[1]:null}default:return null}}function wa(t,e,n=Date.now()){let r=e.find(o=>String(o.cycle)===t);if(!r)return null;if(typeof r.eol=="boolean")return r.eol;let s=Date.parse(r.eol);return Number.isNaN(s)?null:s<=n}function $s(t){let e=String(t).match(/^(\d+)(?:\.(\d+))?/);return e?{major:parseInt(e[1],10),minor:e[2]?parseInt(e[2],10):0}:null}function Hn(t){return t.major*1e3+t.minor}function Ls(t,e){if(typeof t.releaseDate!="string")return true;let n=Date.parse(t.releaseDate);return Number.isNaN(n)?true:n<=e}function Sa(t,e){if(t.lts===true)return true;if(typeof t.lts=="string"){let n=Date.parse(t.lts);return !Number.isNaN(n)&&n<=e}return false}function zn(t,e){return t.products[e]?.cycles??[]}function pn(t,e,n=Date.now()){let r=null;for(let s of zn(t,e)){if(!Ls(s,n))continue;let o=$s(s.cycle);o&&(!r||Hn(o)>Hn(r))&&(r=o);}return r}function Mr(t,e,n=Date.now()){let r=null;for(let s of zn(t,e)){if(!Ls(s,n)||!Sa(s,n))continue;let o=$s(s.cycle);o&&(!r||Hn(o)>Hn(r))&&(r=o);}return r}function gt(t,e,n){let r=zn(t,e).find(s=>String(s.cycle)===n);return r&&typeof r.eol=="string"?r.eol:void 0}function yt(t,e,n,r=Date.now()){let s=ba(e);if(!s)return null;let o=it(e,n);return o?wa(o,zn(t,s),r):null}var Ne={generatedAt:"2026-06-01",source:"endoflife.date",products:{nodejs:{product:"nodejs",cycles:[{cycle:"24",releaseDate:"2025-05-06",lts:"2025-10-28",eol:"2028-04-30"},{cycle:"23",releaseDate:"2024-10-16",lts:false,eol:"2025-06-01"},{cycle:"22",releaseDate:"2024-04-24",lts:"2024-10-29",eol:"2027-04-30"},{cycle:"20",releaseDate:"2023-04-18",lts:"2023-10-24",eol:"2026-04-30"},{cycle:"18",releaseDate:"2022-04-19",lts:"2022-10-25",eol:"2025-04-30"}]},python:{product:"python",cycles:[{cycle:"3.14",releaseDate:"2025-10-07",eol:"2030-10-01"},{cycle:"3.13",releaseDate:"2024-10-07",eol:"2029-10-01"},{cycle:"3.12",releaseDate:"2023-10-02",eol:"2028-10-01"},{cycle:"3.11",releaseDate:"2022-10-24",eol:"2027-10-01"},{cycle:"3.10",releaseDate:"2021-10-04",eol:"2026-10-01"},{cycle:"3.9",releaseDate:"2020-10-05",eol:"2025-10-01"},{cycle:"3.8",releaseDate:"2019-10-14",eol:"2024-10-07"}]},dotnet:{product:"dotnet",cycles:[{cycle:"10.0",releaseDate:"2025-11-11",lts:true,eol:"2028-11-10"},{cycle:"9.0",releaseDate:"2024-11-12",lts:false,eol:"2026-05-12"},{cycle:"8.0",releaseDate:"2023-11-14",lts:true,eol:"2026-11-10"},{cycle:"7.0",releaseDate:"2022-11-08",lts:false,eol:"2024-05-14"},{cycle:"6.0",releaseDate:"2021-11-08",lts:true,eol:"2024-11-12"}]},java:{product:"java",cycles:[{cycle:"25",releaseDate:"2025-09-16",lts:true,eol:"2033-09-01"},{cycle:"21",releaseDate:"2023-09-19",lts:true,eol:"2031-09-01"},{cycle:"17",releaseDate:"2021-09-14",lts:true,eol:"2029-09-01"},{cycle:"11",releaseDate:"2018-09-25",lts:true,eol:"2026-09-01"},{cycle:"8",releaseDate:"2014-03-18",lts:true,eol:"2030-12-01"}]},php:{product:"php",cycles:[{cycle:"8.4",releaseDate:"2024-11-21",eol:"2028-12-31"},{cycle:"8.3",releaseDate:"2023-11-23",eol:"2027-12-31"},{cycle:"8.2",releaseDate:"2022-12-08",eol:"2026-12-31"},{cycle:"8.1",releaseDate:"2021-11-25",eol:"2025-12-31"},{cycle:"8.0",releaseDate:"2020-11-26",eol:"2023-11-26"}]},ruby:{product:"ruby",cycles:[{cycle:"3.5",releaseDate:"2025-12-25",eol:"2029-03-31"},{cycle:"3.4",releaseDate:"2024-12-25",eol:"2028-03-31"},{cycle:"3.3",releaseDate:"2023-12-25",eol:"2027-03-31"},{cycle:"3.2",releaseDate:"2022-12-25",eol:"2026-03-31"},{cycle:"3.1",releaseDate:"2021-12-25",eol:"2025-03-31"}]},go:{product:"go",cycles:[{cycle:"1.25",releaseDate:"2025-08-13",eol:false},{cycle:"1.24",releaseDate:"2025-02-11",eol:false},{cycle:"1.23",releaseDate:"2024-08-13",eol:true},{cycle:"1.22",releaseDate:"2024-02-06",eol:true}]}}};var de=b(a(),1),ft=b(a(),1),Ct=b(a(),1);var Ns=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",ka=Ns+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",xa="["+Ns+"]["+ka+"]*",Ea=new RegExp("^"+xa+"$");function Wn(t,e){let n=[],r=e.exec(t);for(;r;){let s=[];s.startIndex=e.lastIndex-r[0].length;let o=r.length;for(let i=0;i<o;i++)s.push(r[i]);n.push(s),r=e.exec(t);}return n}var $r=function(t){let e=Ea.exec(t);return !(e===null||typeof e>"u")};function Rs(t){return typeof t<"u"}var fn=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],Jn=["__proto__","constructor","prototype"];var ja={allowBooleanAttributes:false,unpairedTags:[]};function Bs(t,e){e=Object.assign({},ja,e);let n=[],r=false,s=false;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=_s(t,o),o.err)return o}else if(t[o]==="<"){let i=o;if(o++,t[o]==="!"){o=Fs(t,o);continue}else {let a=false;t[o]==="/"&&(a=true,o++);let c="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
2
- `&&t[o]!=="\r";o++)c+=t[o];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),o--),!Na(c)){let p;return c.trim().length===0?p="Invalid space after '<'.":p="Tag '"+c+"' is an invalid name.",G("InvalidTag",p,te(t,o))}let l=Aa(t,o);if(l===false)return G("InvalidAttr","Attributes for '"+c+"' have open quote.",te(t,o));let u=l.value;if(o=l.index,u[u.length-1]==="/"){let p=o-u.length;u=u.substring(0,u.length-1);let f=Os(u,e);if(f===true)r=true;else return G(f.err.code,f.err.msg,te(t,p+f.err.line))}else if(a)if(l.tagClosed){if(u.trim().length>0)return G("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",te(t,i));if(n.length===0)return G("InvalidTag","Closing tag '"+c+"' has not been opened.",te(t,i));{let p=n.pop();if(c!==p.tagName){let f=te(t,p.tagStartPos);return G("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+c+"'.",te(t,i))}n.length==0&&(s=true);}}else return G("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",te(t,o));else {let p=Os(u,e);if(p!==true)return G(p.err.code,p.err.msg,te(t,o-u.length+p.err.line));if(s===true)return G("InvalidXml","Multiple possible root nodes found.",te(t,o));e.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:i}),r=true;}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=Fs(t,o);continue}else if(t[o+1]==="?"){if(o=_s(t,++o),o.err)return o}else break;else if(t[o]==="&"){let p=$a(t,o);if(p==-1)return G("InvalidChar","char '&' is not expected.",te(t,o));o=p;}else if(s===true&&!Is(t[o]))return G("InvalidXml","Extra text at the end",te(t,o));t[o]==="<"&&o--;}}else {if(Is(t[o]))continue;return G("InvalidChar","char '"+t[o]+"' is not expected.",te(t,o))}if(r){if(n.length==1)return G("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",te(t,n[0].tagStartPos));if(n.length>0)return G("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return G("InvalidXml","Start tag expected.",1);return true}function Is(t){return t===" "||t===" "||t===`
3
- `||t==="\r"}function _s(t,e){let n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let r=t.substr(n,e-n);if(e>5&&r==="xml")return G("InvalidXml","XML declaration allowed only at the start of the document.",te(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Fs(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var Ta='"',Ca="'";function Aa(t,e){let n="",r="",s=false;for(;e<t.length;e++){if(t[e]===Ta||t[e]===Ca)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){s=true;break}n+=t[e];}return r!==""?false:{value:n,index:e,tagClosed:s}}var Pa=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Os(t,e){let n=Wn(t,Pa),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return G("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",dn(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return G("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",dn(n[s]));if(n[s][3]===void 0&&!e.allowBooleanAttributes)return G("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",dn(n[s]));let o=n[s][2];if(!La(o))return G("InvalidAttr","Attribute '"+o+"' is an invalid name.",dn(n[s]));if(!Object.prototype.hasOwnProperty.call(r,o))r[o]=1;else return G("InvalidAttr","Attribute '"+o+"' is repeated.",dn(n[s]))}return true}function Ma(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return -1}function $a(t,e){if(e++,t[e]===";")return -1;if(t[e]==="#")return e++,Ma(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return -1}return e}function G(t,e,n){return {err:{code:t,msg:e,line:n.line||n,col:n.col}}}function La(t){return $r(t)}function Na(t){return $r(t)}function te(t,e){let n=t.substring(0,e).split(/\r?\n/);return {line:n.length,col:n[n.length-1].length+1}}function dn(t){return t.startIndex+t[1].length}var Kn={cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",euro:"\u20AC",dollar:"$",fnof:"\u0192",inr:"\u20B9",af:"\u060B",birr:"\u1265\u122D",peso:"\u20B1",rub:"\u20BD",won:"\u20A9",yuan:"\xA5",cedil:"\xB8"},mn={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},Lr={nbsp:"\xA0",copy:"\xA9",reg:"\xAE",trade:"\u2122",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",laquo:"\xAB",raquo:"\xBB",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",bull:"\u2022",para:"\xB6",sect:"\xA7",deg:"\xB0",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE"};var Gt=Object.freeze({ALLOW:"allow",BLOCK:"block",THROW:"throw"}),Ia=new Set("!?\\\\/[]$%{}^&*()<>|+");function Qs(t){if(t[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t}"`);for(let e of t)if(Ia.has(e))throw new Error(`[EntityReplacer] Invalid character '${e}' in entity name: "${t}"`);return t}function hn(...t){let e=Object.create(null);for(let n of t)if(n)for(let r of Object.keys(n)){let s=n[r];if(typeof s=="string")e[r]=s;else if(s&&typeof s=="object"&&s.val!==void 0){let o=s.val;typeof o=="string"&&(e[r]=o);}}return e}var vt="external",Yn="base",Nr="all";function _a(t){return !t||t===vt?new Set([vt]):t===Nr?new Set([Nr]):t===Yn?new Set([Yn]):Array.isArray(t)?new Set(t):new Set([vt])}var oe=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Fa=new Set([9,10,13]);function Oa(t){if(!t)return {xmlVersion:1,onLevel:oe.allow,nullLevel:oe.remove};let e=t.xmlVersion===1.1?1.1:1,n=oe[t.onNCR]??oe.allow,r=oe[t.nullNCR]??oe.remove,s=Math.max(r,oe.remove);return {xmlVersion:e,onLevel:n,nullLevel:s}}var qt=class{constructor(e={}){this._limit=e.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof e.postCheck=="function"?e.postCheck:r=>r,this._limitTiers=_a(this._limit.applyLimitsTo??vt),this._numericAllowed=e.numericAllowed??true,this._baseMap=hn(mn,e.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]),this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);let n=Oa(e.ncr);this._ncrXmlVersion=n.xmlVersion,this._ncrOnLevel=n.onLevel,this._ncrNullLevel=n.nullLevel,this._onExternalEntity=typeof e.onExternalEntity=="function"?e.onExternalEntity:null,this._onInputEntity=typeof e.onInputEntity=="function"?e.onInputEntity:null;}_applyRegistrationHook(e,n,r,s){if(!e)return true;let o=e(n,r);if(o===Gt.BLOCK)return false;if(o===Gt.THROW)throw new Error(`[EntityDecoder] Registration of ${s} entity "&${n};" was rejected by hook`);return true}setExternalEntities(e){if(e)for(let s of Object.keys(e))Qs(s);if(!this._onExternalEntity){this._externalMap=hn(e);return}let n=hn(e),r=Object.create(null);for(let[s,o]of Object.entries(n))this._applyRegistrationHook(this._onExternalEntity,s,o,"external")&&(r[s]=o);this._externalMap=r;}addExternalEntity(e,n){Qs(e),typeof n=="string"&&n.indexOf("&")===-1&&this._applyRegistrationHook(this._onExternalEntity,e,n,"external")&&(this._externalMap[e]=n);}addInputEntities(e){if(this._totalExpansions=0,this._expandedLength=0,!this._onInputEntity){this._inputMap=hn(e);return}let n=hn(e),r=Object.create(null);for(let[s,o]of Object.entries(n))this._applyRegistrationHook(this._onInputEntity,s,o,"input")&&(r[s]=o);this._inputMap=r;}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1;}decode(e){if(typeof e!="string"||e.length===0||e.indexOf("&")===-1)return e;let n=e,r=[],s=e.length,o=0,i=0,a=this._maxTotalExpansions>0,c=this._maxExpandedLength>0,l=a||c;for(;i<s;){if(e.charCodeAt(i)!==38){i++;continue}let p=i+1;for(;p<s&&e.charCodeAt(p)!==59&&p-i<=32;)p++;if(p>=s||e.charCodeAt(p)!==59){i++;continue}let f=e.slice(i+1,p);if(f.length===0){i++;continue}let d,h;if(this._removeSet.has(f))d="",h===void 0&&(h=vt);else if(this._leaveSet.has(f)){i++;continue}else if(f.charCodeAt(0)===35){let g=this._resolveNCR(f);if(g===void 0){i++;continue}d=g,h=Yn;}else {let g=this._resolveName(f);d=g?.value,h=g?.tier;}if(d===void 0){i++;continue}if(i>o&&r.push(e.slice(o,i)),r.push(d),o=p+1,i=o,l&&this._tierCounts(h)){if(a&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(c){let g=d.length-(f.length+2);if(g>0&&(this._expandedLength+=g,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}o<s&&r.push(e.slice(o));let u=r.length===0?e:r.join("");return this._postCheck(u,n)}_tierCounts(e){return this._limitTiers.has(Nr)?true:this._limitTiers.has(e)}_resolveName(e){if(e in this._inputMap)return {value:this._inputMap[e],tier:vt};if(e in this._externalMap)return {value:this._externalMap[e],tier:vt};if(e in this._baseMap)return {value:this._baseMap[e],tier:Yn}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!Fa.has(e)?oe.remove:-1}_applyNCRAction(e,n,r){switch(e){case oe.allow:return String.fromCodePoint(r);case oe.remove:return "";case oe.leave:return;case oe.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${n}; (U+${r.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(r)}}_resolveNCR(e){let n=e.charCodeAt(1),r;if(n===120||n===88?r=parseInt(e.slice(2),16):r=parseInt(e.slice(1),10),Number.isNaN(r)||r<0||r>1114111)return;let s=this._classifyNCR(r);if(!this._numericAllowed&&s<oe.remove)return;let o=s===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,s);return this._applyNCRAction(o,e,r)}};var Zs=t=>fn.includes(t)?"__"+t:t,Ba={preserveOrder:false,attributeNamePrefix:"@_",attributesGroupName:false,textNodeName:"#text",ignoreAttributes:true,removeNSPrefix:false,allowBooleanAttributes:false,parseTagValue:true,parseAttributeValue:false,trimValues:true,cdataPropName:false,numberParseOptions:{hex:true,leadingZeros:true,eNotation:true,unicode:false},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:false,isArray:()=>false,commentPropName:false,unpairedTags:[],processEntities:true,htmlEntities:false,entityDecoder:null,ignoreDeclaration:false,ignorePiTags:false,transformTagName:false,transformAttributeName:false,updateTag:function(t,e,n){return t},captureMetaData:false,maxNestedTags:100,strictReservedNames:true,jPath:true,onDangerousProperty:Zs};function Va(t,e){if(typeof t!="string")return;let n=t.toLowerCase();if(fn.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(Jn.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function eo(t,e){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof t=="object"&&t!==null?{enabled:t.enabled!==false,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??1e3),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null,appliesTo:t.appliesTo??"all"}:eo(true)}var to=function(t){let e=Object.assign({},Ba,t),n=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(let{value:r,name:s}of n)r&&Va(r,s);return e.onDangerousProperty===null&&(e.onDangerousProperty=Zs),e.processEntities=eo(e.processEntities,e.htmlEntities),e.unpairedTagsSet=new Set(e.unpairedTags),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(r=>typeof r=="string"&&r.startsWith("*.")?".."+r.substring(2):r)),e};var Xn;typeof Symbol!="function"?Xn="@@xmlMetadata":Xn=Symbol("XML Node Metadata");var ie=class{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null);}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n});}addChild(e,n){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),n!==void 0&&(this.child[this.child.length-1][Xn]={startIndex:n});}static getMetaDataSymbol(){return Xn}};var no=":A-Za-z_\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",Da=no+"\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040",ro=":A-Za-z_\xC0-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}",Ua=ro+"\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040",so=(t,e,n="")=>{let r=t.replace(":",""),s=e.replace(":",""),o=`[${r}][${s}]*`;return {name:new RegExp(`^[${t}][${e}]*$`,n),ncName:new RegExp(`^${o}$`,n),qName:new RegExp(`^${o}(?::${o})?$`,n),nmToken:new RegExp(`^[${e}]+$`,n),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,n)}},Ga=so(no,Da),qa=so(ro,Ua,"u"),Ha=(t="1.0")=>t==="1.1"?qa:Ga;var Rr=(t,{xmlVersion:e="1.0"}={})=>Ha(e).qName.test(t);var yn=class{constructor(e,n){this.suppressValidationErr=!e,this.options=e,this.xmlVersion=n||1;}setXmlVersion(e=1){this.xmlVersion=e;}readDocType(e,n){let r=Object.create(null),s=0;if(e[n+3]==="O"&&e[n+4]==="C"&&e[n+5]==="T"&&e[n+6]==="Y"&&e[n+7]==="P"&&e[n+8]==="E"){n=n+9;let o=1,i=false,a=false,c="";for(;n<e.length;n++)if(e[n]==="<"&&!a){if(i&&bt(e,"!ENTITY",n)){n+=7;let l,u;if([l,u,n]=this.readEntityExp(e,n+1,this.suppressValidationErr),u.indexOf("&")===-1){if(this.options.enabled!==false&&this.options.maxEntityCount!=null&&s>=this.options.maxEntityCount)throw new Error(`Entity count (${s+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);r[l]=u,s++;}}else if(i&&bt(e,"!ELEMENT",n)){n+=8;let{index:l}=this.readElementExp(e,n+1);n=l;}else if(i&&bt(e,"!ATTLIST",n))n+=8;else if(i&&bt(e,"!NOTATION",n)){n+=9;let{index:l}=this.readNotationExp(e,n+1,this.suppressValidationErr);n=l;}else if(bt(e,"!--",n))a=true;else throw new Error("Invalid DOCTYPE");o++,c="";}else if(e[n]===">"){if(a?e[n-1]==="-"&&e[n-2]==="-"&&(a=false,o--):o--,o===0)break}else e[n]==="["?i=true:c+=e[n];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return {entities:r,i:n}}readEntityExp(e,n){n=ae(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n])&&e[n]!=='"'&&e[n]!=="'";)n++;let s=e.substring(r,n);if(gn(s,{xmlVersion:this.xmlVersion}),n=ae(e,n),!this.suppressValidationErr){if(e.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[n]==="%")throw new Error("Parameter entities are not supported")}let o="";if([n,o]=this.readIdentifierVal(e,n,"entity"),this.options.enabled!==false&&this.options.maxEntitySize!=null&&o.length>this.options.maxEntitySize)throw new Error(`Entity "${s}" size (${o.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return n--,[s,o,n]}readNotationExp(e,n){n=ae(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let s=e.substring(r,n);!this.suppressValidationErr&&gn(s,{xmlVersion:this.xmlVersion}),n=ae(e,n);let o=e.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);n+=o.length,n=ae(e,n);let i=null,a=null;if(o==="PUBLIC")[n,i]=this.readIdentifierVal(e,n,"publicIdentifier"),n=ae(e,n),(e[n]==='"'||e[n]==="'")&&([n,a]=this.readIdentifierVal(e,n,"systemIdentifier"));else if(o==="SYSTEM"&&([n,a]=this.readIdentifierVal(e,n,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return {notationName:s,publicIdentifier:i,systemIdentifier:a,index:--n}}readIdentifierVal(e,n,r){let s="",o=e[n];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);n++;let i=n;for(;n<e.length&&e[n]!==o;)n++;if(s=e.substring(i,n),e[n]!==o)throw new Error(`Unterminated ${r} value`);return n++,[n,s]}readElementExp(e,n){n=ae(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let s=e.substring(r,n);if(!this.suppressValidationErr&&!Rr(s,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${s}"`);n=ae(e,n);let o="";if(e[n]==="E"&&bt(e,"MPTY",n))n+=4;else if(e[n]==="A"&&bt(e,"NY",n))n+=2;else if(e[n]==="("){n++;let i=n;for(;n<e.length&&e[n]!==")";)n++;if(o=e.substring(i,n),e[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[n]}"`);return {elementName:s,contentModel:o.trim(),index:n}}readAttlistExp(e,n){n=ae(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let s=e.substring(r,n);for(gn(s,{xmlVersion:this.xmlVersion}),n=ae(e,n),r=n;n<e.length&&!/\s/.test(e[n]);)n++;let o=e.substring(r,n);if(!gn(o,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${o}"`);n=ae(e,n);let i="";if(e.substring(n,n+8).toUpperCase()==="NOTATION"){if(i="NOTATION",n+=8,n=ae(e,n),e[n]!=="(")throw new Error(`Expected '(', found "${e[n]}"`);n++;let c=[];for(;n<e.length&&e[n]!==")";){let l=n;for(;n<e.length&&e[n]!=="|"&&e[n]!==")";)n++;let u=e.substring(l,n);if(u=u.trim(),!gn(u,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${u}"`);c.push(u),e[n]==="|"&&(n++,n=ae(e,n));}if(e[n]!==")")throw new Error("Unterminated list of notations");n++,i+=" ("+c.join("|")+")";}else {let c=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;i+=e.substring(c,n);let l=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!l.includes(i.toUpperCase()))throw new Error(`Invalid attribute type: "${i}"`)}n=ae(e,n);let a="";return e.substring(n,n+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",n+=8):e.substring(n,n+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",n+=7):[n,a]=this.readIdentifierVal(e,n,"ATTLIST"),{elementName:s,attributeName:o,attributeType:i,defaultValue:a,index:n}}},ae=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function bt(t,e,n){for(let r=0;r<e.length;r++)if(e[r]!==t[n+r+1])return false;return true}function gn(t,e){if(Rr(t,{xmlVersion:e}))return t;throw new Error(`Invalid entity name ${t}`)}var za=[48,1632,1776,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,65296,120782,120792,120802,120812,120822,66720,68912,69734,69872,69942,70096,70384,70736,70864,71248,71360,71472,71904,72016,72688,72784,73040,73120,73552,92768,92864,93008,123200,123632,124144,125264,130032],Qn=255,Zn=new Map,oo=65535,io=1632,Ht=io,Wa=oo-io+1,er=new Uint8Array(Wa).fill(Qn);for(let t of za)for(let e=0;e<10;e++){let n=t+e;n<=oo?er[n-Ht]=e:Zn.set(n,e);}var ao=48,co=57,lo=45,tr=new Set([8722,65293,65123]);function Ja(t){if(typeof t!="string")return t;let e=t.length;if(e===0)return t;let n=-1;for(let s=0;s<e;s++){let o=t.charCodeAt(s);if(!(o>=ao&&o<=co||o===lo)){if(o<Ht){if(tr.has(o)){n=s;break}continue}if(o>=55296&&o<=56319){if(s+1<e){let i=t.charCodeAt(s+1);if(i>=56320&&i<=57343){let a=65536+(o-55296<<10)+(i-56320);if(Zn.has(a)){n=s;break}}}continue}if(er[o-Ht]!==Qn||tr.has(o)){n=s;break}}}if(n===-1)return t;let r=[];n>0&&r.push(t.slice(0,n));for(let s=n;s<e;s++){let o=t.charCodeAt(s);if(o>=ao&&o<=co||o===lo){r.push(t[s]);continue}if(o<Ht){r.push(tr.has(o)?"-":t[s]);continue}if(o>=55296&&o<=56319){if(s+1<e){let a=t.charCodeAt(s+1);if(a>=56320&&a<=57343){let c=65536+(o-55296<<10)+(a-56320),l=Zn.get(c);if(l!==void 0){r.push(String.fromCharCode(l+48)),s++;continue}}}r.push(t[s]);continue}if(tr.has(o)){r.push("-");continue}let i=er[o-Ht];r.push(i!==Qn?String.fromCharCode(i+48):t[s]);}return r.join("")}var uo=Ja;var Ka=/^[-+]?0x[a-fA-F0-9]+$/,Ya=/^0b[01]+$/,Xa=/^0o[0-7]+$/,Qa=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Za={hex:true,binary:false,octal:false,leadingZeros:true,decimalPoint:".",eNotation:true,infinity:"original",unicode:false};function _r(t,e={}){if(e=Object.assign({},Za,e),!t||typeof t!="string")return t;let n=t.trim();if(n.length===0)return t;if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(n==="0"||e.unicode&&(n=uo(n),n==="0"))return 0;if(e.hex&&Ka.test(n))return Ir(n,16);if(e.binary&&Ya.test(n))return Ir(n,2);if(e.octal&&Xa.test(n))return Ir(n,8);if(isFinite(n)){if(n.includes("e")||n.includes("E"))return tc(t,n,e);{let r=Qa.exec(n);if(r){let s=r[1]||"",o=r[2],i=nc(r[3]),a=s?t[o.length+1]===".":t[o.length]===".";if(!e.leadingZeros&&(o.length>1||o.length===1&&!a))return t;{let c=Number(n),l=String(c);if(c===0)return c;if(l.search(/[eE]/)!==-1)return e.eNotation?c:t;if(n.indexOf(".")!==-1)return l==="0"||l===i||l===`${s}${i}`?c:t;let u=o?i:n;return o?u===l||s+u===l?c:t:u===l||u===s+l?c:t}}else return t}}else return rc(t,Number(n),e)}var ec=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function tc(t,e,n){if(!n.eNotation)return t;let r=e.match(ec);if(r){let s=r[1]||"",o=r[3].indexOf("e")===-1?"E":"e",i=r[2],a=s?t[i.length+1]===o:t[i.length]===o;return i.length>1&&a?t:i.length===1&&(r[3].startsWith(`.${o}`)||r[3][0]===o)?Number(e):i.length>0?n.leadingZeros&&!a?(e=(r[1]||"")+r[3],Number(e)):t:Number(e)}else return t}function nc(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substring(0,t.length-1))),t}function Ir(t,e){let n=t.trim();if((e===2||e===8)&&(t=n.substring(2)),parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function rc(t,e,n){let r=e===1/0;switch(n.infinity.toLowerCase()){case "null":return null;case "infinity":return e;case "string":return r?"Infinity":"-Infinity";default:return t}}function Fr(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(let n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return true}:()=>false}var wt=class{constructor(e,n={},r){this.pattern=e,this.separator=n.separator||".",this.segments=this._parse(e),this.data=r,this._hasDeepWildcard=this.segments.some(s=>s.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(s=>s.attrName!==void 0),this._hasPositionSelector=this.segments.some(s=>s.position!==void 0);}_parse(e){let n=[],r=0,s="";for(;r<e.length;)e[r]===this.separator?r+1<e.length&&e[r+1]===this.separator?(s.trim()&&(n.push(this._parseSegment(s.trim())),s=""),n.push({type:"deep-wildcard"}),r+=2):(s.trim()&&n.push(this._parseSegment(s.trim())),s="",r++):(s+=e[r],r++);return s.trim()&&n.push(this._parseSegment(s.trim())),n}_parseSegment(e){let n={type:"tag"},r=null,s=e,o=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(o&&(s=o[1]+o[3],o[2])){let u=o[2].slice(1,-1);u&&(r=u);}let i,a=s;if(s.includes("::")){let u=s.indexOf("::");if(i=s.substring(0,u).trim(),a=s.substring(u+2).trim(),!i)throw new Error(`Invalid namespace in pattern: ${e}`)}let c,l=null;if(a.includes(":")){let u=a.lastIndexOf(":"),p=a.substring(0,u).trim(),f=a.substring(u+1).trim();["first","last","odd","even"].includes(f)||/^nth\(\d+\)$/.test(f)?(c=p,l=f):c=a;}else c=a;if(!c)throw new Error(`Invalid segment pattern: ${e}`);if(n.tag=c,i&&(n.namespace=i),r)if(r.includes("=")){let u=r.indexOf("=");n.attrName=r.substring(0,u).trim(),n.attrValue=r.substring(u+1).trim();}else n.attrName=r.trim();if(l){let u=l.match(/^nth\((\d+)\)$/);u?(n.position="nth",n.positionValue=parseInt(u[1],10)):n.position=l;}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}};var zt=class{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._deepByTerminalTag=new Map,this._patterns=new Set,this._sealed=false;}add(e){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard()){let o=e.segments[e.segments.length-1];if(o&&o.type!=="deep-wildcard"&&o.tag!=="*"){let i=o.tag;this._deepByTerminalTag.has(i)||this._deepByTerminalTag.set(i,[]),this._deepByTerminalTag.get(i).push(e);}else this._deepWildcards.push(e);return this}let n=e.length,s=e.segments[e.segments.length-1]?.tag;if(!s||s==="*")this._wildcardByDepth.has(n)||this._wildcardByDepth.set(n,[]),this._wildcardByDepth.get(n).push(e);else {let o=`${n}:${s}`;this._byDepthAndTag.has(o)||this._byDepthAndTag.set(o,[]),this._byDepthAndTag.get(o).push(e);}return this}addAll(e){for(let n of e)this.add(n);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=true,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){let n=e.getDepth(),r=e.getCurrentTag(),s=`${n}:${r}`,o=this._byDepthAndTag.get(s);if(o){for(let c=0;c<o.length;c++)if(e.matches(o[c]))return o[c]}let i=this._wildcardByDepth.get(n);if(i){for(let c=0;c<i.length;c++)if(e.matches(i[c]))return i[c]}let a=this._deepByTerminalTag.get(r);if(a){for(let c=0;c<a.length;c++)if(e.matches(a[c]))return a[c]}for(let c=0;c<this._deepWildcards.length;c++)if(e.matches(this._deepWildcards[c]))return this._deepWildcards[c];return null}};var Or=class{constructor(e){this._matcher=e;}get separator(){return this._matcher.separator}getCurrentTag(){let e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){let e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){let n=this._matcher.path;if(n.length!==0)return n[n.length-1].values?.[e]}hasAttr(e){let n=this._matcher.path;if(n.length===0)return false;let r=n[n.length-1];return r.values!==void 0&&e in r.values}getAnyParentAttr(e){return this._matcher.getAnyParentAttr(e)}hasAnyParentAttr(e){return this._matcher.hasAnyParentAttr(e)}getPosition(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,n=true){return this._matcher.toString(e,n)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}},Wt=class{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new Or(this),this._keptAttrs=[];}push(e,n=null,r=null,s=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let o=this.path.length;this.siblingStacks[o]||(this.siblingStacks[o]=new Map);let i=this.siblingStacks[o],a=r?`${r}:${e}`:e,c=i.get(a)||0,l=0;for(let d of i.values())l+=d;i.set(a,c+1);let u={tag:e,position:l,counter:c};r!=null&&(u.namespace=r),n!=null&&(u.values=n),this.path.push(u);let p=this.path.length,f=s!==null?s.keep:null;if(f!=null&&f.length>0&&n)for(let d=0;d<f.length;d++){let h=f[d];n[h]!==void 0&&this._keptAttrs.push({depth:p,name:h,value:n[h]});}}pop(){if(this.path.length===0)return;this._pathStringCache=null;let e=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);let n=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=n;)this._keptAttrs.pop();return e}updateCurrent(e){if(this.path.length>0){let n=this.path[this.path.length-1];e!=null&&(n.values=e);}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return false;let n=this.path[this.path.length-1];return n.values!==void 0&&e in n.values}getAnyParentAttr(e){let n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].name===e)return n[r].value}hasAnyParentAttr(e){let n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].name===e)return true;return false}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,n=true){let r=e||this.separator;if(r===this.separator&&n===true){if(this._pathStringCache!==null)return this._pathStringCache;let o=this.path.map(i=>i.namespace?`${i.namespace}:${i.tag}`:i.tag).join(r);return this._pathStringCache=o,o}return this.path.map(o=>n&&o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(r)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[];}matches(e){let n=e.segments;return n.length===0?false:e.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n)}_matchSimple(e){if(this.path.length!==e.length)return false;for(let n=0;n<e.length;n++)if(!this._matchSegment(e[n],this.path[n],n===this.path.length-1))return false;return true}_matchWithDeepWildcard(e){let n=this.path.length-1,r=e.length-1;for(;r>=0&&n>=0;){let s=e[r];if(s.type==="deep-wildcard"){if(r--,r<0)return true;let o=e[r],i=false;for(let a=n;a>=0;a--)if(this._matchSegment(o,this.path[a],a===this.path.length-1)){n=a-1,r--,i=true;break}if(!i)return false}else {if(!this._matchSegment(s,this.path[n],n===this.path.length-1))return false;n--,r--;}}return r<0}_matchSegment(e,n,r){if(e.tag!=="*"&&e.tag!==n.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==n.namespace||e.attrName!==void 0&&(!r||!n.values||!(e.attrName in n.values)||e.attrValue!==void 0&&String(n.values[e.attrName])!==String(e.attrValue)))return false;if(e.position!==void 0){if(!r)return false;let s=n.counter??0;if(e.position==="first"&&s!==0)return false;if(e.position==="odd"&&s%2!==1)return false;if(e.position==="even"&&s%2!==0)return false;if(e.position==="nth"&&s!==e.positionValue)return false}return true}matchesAny(e){return e.matchesAny(this)}snapshot(){return {path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e)),keptAttrs:this._keptAttrs.map(e=>({...e}))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>new Map(n)),this._keptAttrs=(e.keptAttrs||[]).map(n=>({...n}));}readOnly(){return this._view}};var sc=[{id:"html-script-open",description:"<script opening tag",pattern:/<script[\s>/]/i},{id:"html-script-close",description:"</script closing tag",pattern:/<\/script[\s>]/i},{id:"html-javascript-protocol",description:"javascript: URI scheme (with optional whitespace/encoding)",pattern:/j[\t\n\r ]*a[\t\n\r ]*v[\t\n\r ]*a[\t\n\r ]*s[\t\n\r ]*c[\t\n\r ]*r[\t\n\r ]*i[\t\n\r ]*p[\t\n\r ]*t[\t\n\r ]*:/i},{id:"html-vbscript-protocol",description:"vbscript: URI scheme",pattern:/vbscript[\t\n\r ]*:/i},{id:"html-data-html",description:"data:text/html URI \u2014 can execute scripts in browsers",pattern:/data[\t\n\r ]*:[\t\n\r ]*text\/html/i},{id:"html-data-xhtml",description:"data:application/xhtml+xml URI",pattern:/data[\t\n\r ]*:[\t\n\r ]*application\/xhtml/i},{id:"html-data-svg",description:"data:image/svg+xml URI \u2014 can execute scripts",pattern:/data[\t\n\r ]*:[\t\n\r ]*image\/svg\+xml/i},{id:"html-inline-event-handler",description:"Inline event handler attributes: onclick=, onerror=, onload=, etc.",pattern:/\bon\w{1,30}\s*=/i},{id:"html-entity-obfuscated-script",description:"HTML-entity-encoded <script (e.g. &#x3C;script or &lt;script)",pattern:/(?:&#x0*3[Cc];?|&#0*60;?|&lt;)\s*script/i},{id:"html-entity-obfuscated-javascript",description:'HTML-entity-encoded javascript: (partial \u2014 catches common &#106; or &#x6a; for "j")',pattern:/(?:&#x0*6[Aa];?|&#0*106;?)\s*(?:&#x0*61;?|a)[\s\S]{0,80}script\s*:/i},{id:"html-style-expression",description:"CSS expression() \u2014 IE-era code execution in style attributes",pattern:/style[\s\S]{0,20}expression\s*\(/i},{id:"html-object-embed",description:"<object or <embed tags that can load active content",pattern:/<(?:object|embed)[\s>/]/i},{id:"html-base-tag",description:"<base href= \u2014 can hijack all relative URLs on a page",pattern:/<base[\s>]/i},{id:"html-meta-refresh",description:'<meta http-equiv="refresh" \u2014 can redirect users',pattern:/<meta[\s\S]{0,40}http-equiv[\s\S]{0,20}refresh/i},{id:"html-srcdoc",description:"srcdoc= attribute on iframes \u2014 embeds HTML that can run scripts",pattern:/srcdoc\s*=/i},{id:"html-iframe",description:"<iframe tag",pattern:/<iframe[\s>/]/i},{id:"html-form",description:"<form tag \u2014 can be used for phishing / credential harvesting injection",pattern:/<form[\s>/]/i}],po=sc;var oc=[{id:"xml-cdata-injection",description:"CDATA section injection: <![CDATA[ breaks out of text node context",pattern:/<!\[CDATA\[/i},{id:"xml-cdata-close",description:"CDATA close sequence: ]]> can terminate an enclosing CDATA section",pattern:/\]\]>/},{id:"xml-processing-instruction",description:"XML processing instruction: <?xml-stylesheet or <?php etc.",pattern:/<\?(?:xml[\- ]|php|asp)/i},{id:"xml-doctype-injection",description:"DOCTYPE declaration embedded in content \u2014 can define entities",pattern:/<!DOCTYPE(?:[\s[]|$)/i},{id:"xml-entity-system",description:"SYSTEM keyword \u2014 used in external entity declarations (XXE)",pattern:/\bSYSTEM\s+["']/i},{id:"xml-entity-public",description:"PUBLIC keyword \u2014 used in external entity declarations (XXE)",pattern:/\bPUBLIC\s+["']/i},{id:"xml-entity-declaration",description:"<!ENTITY declaration \u2014 defines entities, potential XXE or entity expansion",pattern:/<!ENTITY[\s%]/i},{id:"xml-billion-laughs",description:"Entity reference chaining / billion laughs: repeated &eX; style references",pattern:/(?:&\w{1,20};){3,}/},{id:"xml-namespace-confusion",description:"xmlns: attribute injection \u2014 can redefine namespaces to confuse parsers",pattern:/\bxmlns\s*(?::\w{1,40})?\s*=/i},{id:"xml-comment-injection",description:"<!-- comment injection \u2014 can hide content from some parsers",pattern:/<!--/},{id:"xml-comment-close",description:"--> closes an enclosing XML comment",pattern:/-->/},{id:"xml-pi-close",description:"?> closes an enclosing processing instruction",pattern:/\?>/}],fo=oc;var ic=[{id:"svg-script-element",description:"<script element inside SVG executes JavaScript",pattern:/<script[\s>/]/i},{id:"svg-xlink-href-javascript",description:"xlink:href with javascript: \u2014 classic SVG XSS via <a> or <use>",pattern:/xlink\s*:\s*href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-href-javascript",description:"href= with javascript: in SVG context (<a>, <animate>, etc.)",pattern:/href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-foreignobject",description:"<foreignObject embeds HTML inside SVG \u2014 can execute scripts",pattern:/<foreignObject[\s>/]/i},{id:"svg-use-external",description:"<use xlink:href or href pointing to external resource (non-fragment URL)",pattern:/<use[\s\S]{0,60}(?:xlink\s*:\s*)?href\s*=\s*(?:["'][^#]|[^"'#\s>])/i},{id:"svg-animate-href",description:'<animate attributeName="href" \u2014 can dynamically change href to javascript:',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*href["']/i},{id:"svg-animate-xlinkhref",description:'<animate attributeName="xlink:href"',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*xlink\s*:\s*href["']/i},{id:"svg-set-javascript",description:'<set to="javascript:..." \u2014 sets an attribute to a javascript: URI',pattern:/<set[\s\S]{0,80}to\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-event-handler",description:"SVG-specific event handler attributes: onload=, onerror=, onactivate=, etc.",pattern:/\bon(?:load|error|activate|begin|end|repeat|focus|blur|click|mouse\w{1,20}|key\w{1,20})\s*=/i},{id:"svg-handler-generic",description:"Generic on* handler catch-all for SVG attributes",pattern:/\bon\w{1,30}\s*=/i},{id:"svg-filter-feimage",description:"<feImage href= \u2014 filter primitive that can load external resources",pattern:/<feImage[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=/i},{id:"svg-image-external",description:"<image xlink:href with http/https or javascript protocol",pattern:/<image[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=\s*["']?\s*(?:https?|javascript)\s*:/i},{id:"svg-style-javascript",description:"style= attribute containing javascript: (e.g. background:url(javascript:...))",pattern:/style\s*=[\s\S]{0,60}javascript\s*:/i}],mo=ic;var ac=[{id:"sql-block-comment-open",description:"SQL block comment open: /* ... */ \u2014 unusual in legitimate user text",pattern:/\/\*/},{id:"sql-union-select",description:"UNION SELECT \u2014 most common SQL injection aggregation attack",pattern:/\bUNION\s{1,20}(?:ALL\s{1,20})?SELECT\b/i},{id:"sql-drop-table",description:"DROP TABLE \u2014 destructive DDL injection",pattern:/\bDROP\s{1,20}TABLE\b/i},{id:"sql-drop-database",description:"DROP DATABASE \u2014 destructive DDL injection",pattern:/\bDROP\s{1,20}DATABASE\b/i},{id:"sql-insert-into",description:"INSERT INTO \u2014 data injection",pattern:/\bINSERT\s{1,20}INTO\b/i},{id:"sql-delete-from",description:"DELETE FROM \u2014 data deletion injection",pattern:/\bDELETE\s{1,20}FROM\b/i},{id:"sql-update-set",description:"UPDATE ... SET \u2014 data modification injection",pattern:/\bUPDATE\b[\s\S]{1,60}\bSET\b/i},{id:"sql-exec-xp",description:"EXEC xp_ \u2014 MSSQL extended stored procedure execution",pattern:/\bEXEC(?:UTE)?\s{1,20}xp_/i},{id:"sql-tautology-string",description:`Classic string tautology: ' OR '1'='1 or " OR "1"="1"`,pattern:/'\s{0,10}OR\s{0,10}'[^']{0,20}'\s*=\s*'[^']{0,20}/i},{id:"sql-tautology-numeric",description:"Numeric tautology: OR 1=1",pattern:/\bOR\s{1,10}1\s*=\s*1\b/i},{id:"sql-always-true-zero",description:"Numeric tautology: OR 0=0",pattern:/\bOR\s{1,10}0\s*=\s*0\b/i},{id:"sql-sleep-benchmark",description:"Time-based blind injection: SLEEP() or BENCHMARK()",pattern:/\b(?:SLEEP|BENCHMARK)\s*\(/i},{id:"sql-waitfor-delay",description:"MSSQL time-based blind injection: WAITFOR DELAY",pattern:/\bWAITFOR\s{1,20}DELAY\b/i},{id:"sql-char-function",description:"CHAR() function \u2014 used to obfuscate injected strings",pattern:/\bCHAR\s*\(\s*\d{1,3}/i},{id:"sql-information-schema",description:"INFORMATION_SCHEMA \u2014 reconnaissance query for table/column enumeration",pattern:/\bINFORMATION_SCHEMA\b/i}],nr=ac;var cc=[{id:"sql-line-comment",description:"SQL line comment: -- followed by whitespace or end of string",pattern:/--(?:\s|$)/},{id:"sql-stacked-query",description:"Stacked queries: semicolon immediately followed by a SQL keyword",pattern:/;\s{0,10}(?:SELECT|INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|EXEC)\b/i},{id:"sql-hex-encoding",description:"Hex-encoded string injection: 0x41414141 style (MySQL)",pattern:/\b0x[0-9a-f]{4,}/i}],lc=[...nr,...cc],ho=lc;var uc=[{id:"shell-path-traversal-unix",description:"Unix path traversal: ../ \u2014 climbing the directory tree",pattern:/\.\.\//},{id:"shell-path-traversal-windows",description:"Windows path traversal: ..\\ \u2014 climbing the directory tree",pattern:/\.\.\\/},{id:"shell-path-traversal-encoded",description:"URL-encoded path traversal: %2e%2e or %2f variants",pattern:/%2e%2e|%2f\.\.|\.\.%2f/i},{id:"shell-null-byte",description:"Null byte injection: \\x00 or %00 \u2014 truncates strings in C-backed functions",pattern:/\x00|%00/},{id:"shell-semicolon",description:"Semicolon command separator: cmd1; cmd2",pattern:/;/},{id:"shell-pipe",description:"Pipe operator: cmd1 | cmd2",pattern:/\|/},{id:"shell-and-operator",description:"AND operator: cmd1 && cmd2",pattern:/&&/},{id:"shell-or-operator",description:"OR operator: cmd1 || cmd2",pattern:/\|\|/},{id:"shell-backtick",description:"Backtick command substitution: `cmd`",pattern:/`/},{id:"shell-dollar-paren",description:"Dollar-paren command substitution: $(cmd)",pattern:/\$\(/},{id:"shell-dollar-brace",description:"Dollar-brace variable expansion: ${var} \u2014 can be abused for injection",pattern:/\$\{/},{id:"shell-redirect-out",description:"Output redirection: cmd > file or cmd >> file",pattern:/>{1,2}/},{id:"shell-redirect-in",description:"Input redirection: cmd < file",pattern:/</},{id:"shell-newline-injection",description:"Newline injection: \\n or \\r \u2014 can inject new shell commands",pattern:/[\n\r]/},{id:"shell-glob-star",description:"Glob expansion: * or ? \u2014 can expand to unintended files",pattern:/[/\\][*?]/},{id:"shell-absolute-root",description:"Absolute root path injection: string starting with / or \\ (Windows UNC)",pattern:/^(?:\/|\\\\)/},{id:"shell-windows-drive",description:"Windows drive letter path injection: C:\\ or D:/",pattern:/^[a-zA-Z]:[/\\]/},{id:"shell-curl-wget",description:"curl/wget with URL or flags \u2014 can exfiltrate data or download payloads",pattern:/\b(?:curl|wget)\s+(?:https?:\/\/|ftp:\/\/|-)/i}],go=uc;var pc=[{id:"redos-nested-quantifier-plus",description:"Nested + quantifier inside a group with outer quantifier: (a+)+, (.+b)*, etc.",pattern:/\([^)]*\+[^)]*\)[+*]/},{id:"redos-nested-quantifier-star",description:"Nested * quantifier: (a*)* or (a*)+ \u2014 catastrophic backtracking",pattern:/\([^)]*\*[^)]*\)[*+]/},{id:"redos-nested-groups",description:"Doubly nested quantified groups: ((a+)+) \u2014 guaranteed catastrophic",pattern:/\(\([^)]{0,40}\)[+*]\)[+*]/},{id:"redos-alternation-overlap",description:"Overlapping alternation under quantifier: (a|a)+ \u2014 ambiguous NFA paths",pattern:/\(([^|()]{1,20})\|(?:\1)(?:\|[^|()]{1,20}){0,5}\)[+*?]{1,2}/},{id:"redos-star-plus-concat",description:"(x*x)+ pattern \u2014 triggers super-linear backtracking",pattern:/\([^)]{0,10}\*[^)]{0,10}\)[+*]/},{id:"redos-dot-star-greedy",description:"(.*){n,} or (.+){n,} \u2014 repeated greedy dot quantifiers",pattern:/\(\.[*+]\)\{?\d/},{id:"redos-large-repetition",description:"Very large fixed or range repetition count {1000,} or {1000,n} \u2014 denial of service via backtracking",pattern:/\{\d{4,}(?:,\d*)?\}/},{id:"redos-catastrophic-alternation",description:"Long alternation with many similar branches \u2014 polynomial backtracking risk",pattern:/\([^)]{0,200}(?:\|[^|)]{0,50}){9,}\)/}],yo=pc;var le=`["'\\s]*:`,fc=[{id:"nosql-where-operator",description:"$where \u2014 executes arbitrary JavaScript server-side in MongoDB",pattern:new RegExp(`\\$where${le}`,"i")},{id:"nosql-ne-operator",description:'$ne \u2014 "not equal" operator used to bypass equality checks',pattern:new RegExp(`\\$ne${le}`,"i")},{id:"nosql-gt-operator",description:'$gt \u2014 "greater than" used to bypass password/value checks',pattern:new RegExp(`\\$gte?${le}`,"i")},{id:"nosql-lt-operator",description:'$lt / $lte \u2014 "less than" bypass variants',pattern:new RegExp(`\\$lte?${le}`,"i")},{id:"nosql-regex-operator",description:"$regex \u2014 can be used to extract data character by character (blind injection)",pattern:new RegExp(`\\$regex${le}`,"i")},{id:"nosql-or-operator",description:"$or \u2014 logical OR; used to create always-true conditions",pattern:new RegExp(`\\$or${le}\\s*\\[`,"i")},{id:"nosql-and-operator",description:"$and \u2014 logical AND operator injection",pattern:new RegExp(`\\$and${le}\\s*\\[`,"i")},{id:"nosql-nor-operator",description:"$nor \u2014 logical NOR operator injection",pattern:new RegExp(`\\$nor${le}\\s*\\[`,"i")},{id:"nosql-exists-operator",description:"$exists \u2014 can enumerate fields to determine schema",pattern:new RegExp(`\\$exists${le}`,"i")},{id:"nosql-in-operator",description:"$in \u2014 matches any value in a list; can enumerate values",pattern:new RegExp(`\\$in${le}\\s*\\[`,"i")},{id:"nosql-expr-operator",description:"$expr \u2014 allows aggregation expressions in queries (MongoDB 3.6+)",pattern:new RegExp(`\\$expr${le}`,"i")},{id:"nosql-function-operator",description:"$function \u2014 executes arbitrary JavaScript in MongoDB 4.4+",pattern:new RegExp(`\\$function${le}`,"i")},{id:"nosql-accumulator-operator",description:"$accumulator \u2014 custom aggregation with arbitrary JS execution",pattern:new RegExp(`\\$accumulator${le}`,"i")},{id:"nosql-proto-pollution",description:"__proto__ \u2014 prototype pollution via object key injection",pattern:/__proto__/},{id:"nosql-constructor-prototype",description:"constructor.prototype \u2014 alternative prototype pollution vector (dot notation or JSON key)",pattern:/constructor[\s"':.,{\[]*prototype/i},{id:"nosql-proto-bracket",description:'["__proto__"] \u2014 bracket-notation prototype pollution',pattern:/\[["']__proto__["']\]/}],vo=fc;var dc=[{id:"log-crlf-injection",description:"CRLF injection: literal \\r or \\n embeds fake log lines",pattern:/[\r\n]/},{id:"log-url-encoded-crlf",description:"URL-encoded CRLF: %0d, %0a, %0D, %0A \u2014 decoded by some log parsers",pattern:/%0[dDaA]/},{id:"log-unicode-newline",description:"Unicode newline variants: U+2028 (line separator), U+2029 (paragraph separator)",pattern:/[\u2028\u2029]/},{id:"log-log4shell-jndi",description:"Log4Shell: ${jndi:...} triggers remote code execution in Apache Log4j",pattern:/\$\{jndi\s*:/i},{id:"log-log4shell-obfuscated",description:"Obfuscated Log4Shell: ${::-j}... lookup-bypass prefix used to evade WAF detection",pattern:/\$\{::-/},{id:"log-log4j-lookup",description:"Log4j lookup syntax: ${env:...}, ${sys:...}, ${ctx:...} \u2014 data exfiltration",pattern:/\$\{(?:env|sys|ctx|main|map|sd|web|docker|k8s|spring)\s*:/i},{id:"log-ssti-double-brace",description:"SSTI double-brace: {{expression}} \u2014 Jinja2, Twig, Handlebars, etc.",pattern:/\{\{[\s\S]{0,80}\}\}/},{id:"log-ssti-hash-brace",description:"SSTI hash-brace: #{expression} \u2014 Thymeleaf, Velocity, Ruby ERB",pattern:/#\{[\s\S]{0,80}\}/},{id:"log-ssti-dollar-brace",description:"SSTI/EL injection: ${expression with operators or method calls} \u2014 JSP EL, Freemarker, SpEL",pattern:/\$\{[^}]*(?:\.|\(|\*|\+|\bclass\b|\bruntime\b|\bprocess\b|\bexec\b)[^}]{0,80}\}/i},{id:"log-ssti-percent-tag",description:"SSTI ERB/ASP tag: <%= expression %> \u2014 Ruby ERB, ASP",pattern:/<%=[\s\S]{0,80}%>/},{id:"log-null-byte",description:"Null byte: \\x00 or %00 \u2014 can truncate log entries in C-backed loggers",pattern:/\x00|%00/},{id:"log-ansi-escape",description:"ANSI escape sequence: ESC[ \u2014 can manipulate terminal output when logs are tailed",pattern:/\x1b\[/}],bo=dc;var wo={HTML:po,XML:fo,SVG:mo,SQL:nr,"SQL-STRICT":ho,SHELL:go,REDOS:yo,NOSQL:vo,LOG:bo},rr=wo,Jt=Object.freeze(Object.fromEntries(Object.keys(wo).map(t=>[t,t])));function mc(t){if(typeof t!="string")throw new TypeError(`is-unsafe: first argument must be a string, got ${typeof t}`)}function hc(t){if(!(t instanceof RegExp)){if(typeof t=="string"){if(!rr[t])throw new TypeError(`is-unsafe: unknown context "${t}". Valid contexts: ${Object.keys(Jt).join(", ")}`);return}if(Array.isArray(t)){if(t.length===0)throw new TypeError("is-unsafe: context array must not be empty");for(let e of t)if(typeof e!="string"||!rr[e])throw new TypeError(`is-unsafe: unknown context "${e}" in array. Valid contexts: ${Object.keys(Jt).join(", ")}`);return}throw new TypeError(`is-unsafe: second argument must be a context string, array of context strings, or RegExp. Got: ${typeof t}`)}}function So(t,e){let n=rr[e];for(let r of n)if(r.pattern.test(t))return {context:e,id:r.id,description:r.description,pattern:r.pattern};return null}function ko(t,e){if(mc(t),hc(e),e instanceof RegExp)return e.test(t);if(typeof e=="string")return So(t,e)!==null;for(let n of e)if(So(t,n)!==null)return true;return false}function gc(t,e){if(!t)return {};let n=e.attributesGroupName?t[e.attributesGroupName]:t;if(!n)return {};let r={};for(let s in n)if(s.startsWith(e.attributeNamePrefix)){let o=s.substring(e.attributeNamePrefix.length);r[o]=n[s];}else r[s]=n[s];return r}function yc(t){if(!t||typeof t!="string")return;let e=t.indexOf(":");if(e!==-1&&e>0){let n=t.substring(0,e);if(n!=="xmlns")return n}}var vn=class{constructor(e,n){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=kc,this.parseTextData=vc,this.resolveNameSpace=bc,this.buildAttributesMap=Sc,this.isItStopNode=Tc,this.replaceEntitiesValue=Ec,this.readStopNodeData=Pc,this.saveTextToParentTag=jc,this.addChild=xc,this.ignoreAttributesFn=Fr(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0;let r={...mn};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?r=this.options.htmlEntities:this.options.htmlEntities===true&&(r={...Lr,...Kn}),this.entityDecoder=new qt({namedEntities:{...r,...n},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo},onInputEntity:(o,i)=>ko(i,[Jt.HTML,Jt.XML])?Gt.BLOCK:Gt.ALLOW})),this.matcher=new Wt,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=false,this.stopNodeExpressionsSet=new zt;let s=this.options.stopNodes;if(s&&s.length>0){for(let o=0;o<s.length;o++){let i=s[o];typeof i=="string"?this.stopNodeExpressionsSet.add(new wt(i)):i instanceof wt&&this.stopNodeExpressionsSet.add(i);}this.stopNodeExpressionsSet.seal();}}};function vc(t,e,n,r,s,o,i){let a=this.options;if(t!==void 0&&(a.trimValues&&!r&&(t=t.trim()),t.length>0)){i||(t=this.replaceEntitiesValue(t,e,n));let c=a.jPath?n.toString():n,l=a.tagValueProcessor(e,t,c,s,o);return l==null?t:typeof l!=typeof t||l!==t?l:a.trimValues||t.trim()===t?Dr(t,a.parseTagValue,a.numberParseOptions):t}}function bc(t){if(this.options.removeNSPrefix){let e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return "";e.length===2&&(t=n+e[1]);}return t}var wc=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Sc(t,e,n,r=false){let s=this.options;if(r===true||s.ignoreAttributes!==true&&typeof t=="string"){let o=Wn(t,wc),i=o.length,a={},c=new Array(i),l=false,u={};for(let d=0;d<i;d++){let h=this.resolveNameSpace(o[d][1]),g=o[d][4];if(h.length&&g!==void 0){let v=g;s.trimValues&&(v=v.trim()),v=this.replaceEntitiesValue(v,n,this.readonlyMatcher),c[d]=v,u[h]=v,l=true;}}l&&typeof e=="object"&&e.updateCurrent&&e.updateCurrent(u);let p=s.jPath?e.toString():this.readonlyMatcher,f=false;for(let d=0;d<i;d++){let h=this.resolveNameSpace(o[d][1]);if(this.ignoreAttributesFn(h,p))continue;let g=s.attributeNamePrefix+h;if(h.length)if(s.transformAttributeName&&(g=s.transformAttributeName(g)),g=xo(g,s),o[d][4]!==void 0){let v=c[d],w=s.attributeValueProcessor(h,v,p);w==null?a[g]=v:typeof w!=typeof v||w!==v?a[g]=w:a[g]=Dr(v,s.parseAttributeValue,s.numberParseOptions),f=true;}else s.allowBooleanAttributes&&(a[g]=true,f=true);}if(!f)return;if(s.attributesGroupName&&!s.preserveOrder){let d={};return d[s.attributesGroupName]=a,d}return a}}var kc=function(t){t=t.replace(/\r\n?/g,`
4
- `);let e=new ie("!xml"),n=e,r="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let s=this.options,o=new yn(s.processEntities),i=t.length;for(let a=0;a<i;a++)if(t[a]==="<"){let l=t.charCodeAt(a+1);if(l===47){let u=Kt(t,">",a,"Closing Tag is not closed."),p=t.substring(a+2,u).trim();if(s.removeNSPrefix){let d=p.indexOf(":");d!==-1&&(p=p.substr(d+1));}p=Br(s.transformTagName,p,"",s).tagName,n&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher));let f=this.matcher.getCurrentTag();if(p&&s.unpairedTagsSet.has(p))throw new Error(`Unpaired tag can not be used as closing tag: </${p}>`);f&&s.unpairedTagsSet.has(f)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=false,n=this.tagsNodeStack.pop(),r="",a=u;}else if(l===63){let u=Vr(t,a,false,"?>");if(!u)throw new Error("Pi Tag is not closed.");r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let p=this.buildAttributesMap(u.tagExp,this.matcher,u.tagName,true);if(p){let f=p[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(f)||1),o.setXmlVersion(Number(f)||1);}if(!(s.ignoreDeclaration&&u.tagName==="?xml"||s.ignorePiTags)){let f=new ie(u.tagName);f.add(s.textNodeName,""),u.tagName!==u.tagExp&&u.attrExpPresent&&s.ignoreAttributes!==true&&(f[":@"]=p),this.addChild(n,f,this.readonlyMatcher,a);}a=u.closeIndex+1;}else if(l===33&&t.charCodeAt(a+2)===45&&t.charCodeAt(a+3)===45){let u=Kt(t,"-->",a+4,"Comment is not closed.");if(s.commentPropName){let p=t.substring(a+4,u-2);r=this.saveTextToParentTag(r,n,this.readonlyMatcher),n.add(s.commentPropName,[{[s.textNodeName]:p}]);}a=u;}else if(l===33&&t.charCodeAt(a+2)===68){let u=o.readDocType(t,a);this.entityDecoder.addInputEntities(u.entities),a=u.i;}else if(l===33&&t.charCodeAt(a+2)===91){let u=Kt(t,"]]>",a,"CDATA is not closed.")-2,p=t.substring(a+9,u);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let f=this.parseTextData(p,n.tagname,this.readonlyMatcher,true,false,true,true);f==null&&(f=""),s.cdataPropName?n.add(s.cdataPropName,[{[s.textNodeName]:p}]):n.add(s.textNodeName,f),a=u+2;}else {let u=Vr(t,a,s.removeNSPrefix);if(!u){let y=t.substring(Math.max(0,a-50),Math.min(i,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${y}"`)}let p=u.tagName,f=u.rawTagName,d=u.tagExp,h=u.attrExpPresent,g=u.closeIndex;if({tagName:p,tagExp:d}=Br(s.transformTagName,p,d,s),s.strictReservedNames&&(p===s.commentPropName||p===s.cdataPropName||p===s.textNodeName||p===s.attributesGroupName))throw new Error(`Invalid tag name: ${p}`);n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher,false));let v=n;v&&s.unpairedTagsSet.has(v.tagname)&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let w=false;d.length>0&&d.lastIndexOf("/")===d.length-1&&(w=true,p[p.length-1]==="/"?(p=p.substr(0,p.length-1),d=p):d=d.substr(0,d.length-1),h=p!==d);let j=null,C;C=yc(f),p!==e.tagname&&this.matcher.push(p,{},C),p!==d&&h&&(j=this.buildAttributesMap(d,this.matcher,p),j&&(gc(j,s))),p!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let x=a;if(this.isCurrentNodeStopNode){let y="";if(w)a=u.closeIndex;else if(s.unpairedTagsSet.has(p))a=u.closeIndex;else {let k=this.readStopNodeData(t,f,g+1);if(!k)throw new Error(`Unexpected end of ${f}`);a=k.i,y=k.tagContent;}let b=new ie(p);j&&(b[":@"]=j),b.add(s.textNodeName,y),this.matcher.pop(),this.isCurrentNodeStopNode=false,this.addChild(n,b,this.readonlyMatcher,x);}else {if(w){({tagName:p,tagExp:d}=Br(s.transformTagName,p,d,s));let y=new ie(p);j&&(y[":@"]=j),this.addChild(n,y,this.readonlyMatcher,x),this.matcher.pop(),this.isCurrentNodeStopNode=false;}else if(s.unpairedTagsSet.has(p)){let y=new ie(p);j&&(y[":@"]=j),this.addChild(n,y,this.readonlyMatcher,x),this.matcher.pop(),this.isCurrentNodeStopNode=false,a=u.closeIndex;continue}else {let y=new ie(p);if(this.tagsNodeStack.length>s.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),j&&(y[":@"]=j),this.addChild(n,y,this.readonlyMatcher,x),n=y;}r="",a=g;}}}else r+=t[a];return e.child};function xc(t,e,n,r){this.options.captureMetaData||(r=void 0);let s=this.options.jPath?n.toString():n,o=this.options.updateTag(e.tagname,s,e[":@"]);o===false||(typeof o=="string"&&(e.tagname=o),t.addChild(e,r));}function Ec(t,e,n){let r=this.options.processEntities;if(!r||!r.enabled)return t;if(r.allowedTags){let s=this.options.jPath?n.toString():n;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(e):r.allowedTags(e,s)))return t}if(r.tagFilter){let s=this.options.jPath?n.toString():n;if(!r.tagFilter(e,s))return t}return this.entityDecoder.decode(t)}function jc(t,e,n,r){return t&&(r===void 0&&(r=e.child.length===0),t=this.parseTextData(t,e.tagname,n,false,e[":@"]?Object.keys(e[":@"]).length!==0:false,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function Tc(){return this.stopNodeExpressionsSet.size===0?false:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function Cc(t,e,n=">"){let r=0,s=t.length,o=n.charCodeAt(0),i=n.length>1?n.charCodeAt(1):-1,a="",c=e;for(let l=e;l<s;l++){let u=t.charCodeAt(l);if(r)u===r&&(r=0);else if(u===34||u===39)r=u;else if(u===o)if(i!==-1){if(t.charCodeAt(l+1)===i)return a+=t.substring(c,l),{data:a,index:l}}else return a+=t.substring(c,l),{data:a,index:l};else u===9&&!r&&(a+=t.substring(c,l)+" ",c=l+1);}}function Kt(t,e,n,r){let s=t.indexOf(e,n);if(s===-1)throw new Error(r);return s+e.length-1}function Ac(t,e,n,r){let s=t.indexOf(e,n);if(s===-1)throw new Error(r);return s}function Vr(t,e,n,r=">"){let s=Cc(t,e+1,r);if(!s)return;let o=s.data,i=s.index,a=o.search(/\s/),c=o,l=true;a!==-1&&(c=o.substring(0,a),o=o.substring(a+1).trimStart());let u=c;if(n){let p=c.indexOf(":");p!==-1&&(c=c.substr(p+1),l=c!==s.data.substr(p+1));}return {tagName:c,tagExp:o,closeIndex:i,attrExpPresent:l,rawTagName:u}}function Pc(t,e,n){let r=n,s=1,o=t.length;for(;n<o;n++)if(t[n]==="<"){let i=t.charCodeAt(n+1);if(i===47){let a=Ac(t,">",n,`${e} is not closed`);if(t.substring(n+2,a).trim()===e&&(s--,s===0))return {tagContent:t.substring(r,n),i:a};n=a;}else if(i===63)n=Kt(t,"?>",n+1,"StopNode is not closed.");else if(i===33&&t.charCodeAt(n+2)===45&&t.charCodeAt(n+3)===45)n=Kt(t,"-->",n+3,"StopNode is not closed.");else if(i===33&&t.charCodeAt(n+2)===91)n=Kt(t,"]]>",n,"StopNode is not closed.")-2;else {let a=Vr(t,n,false);a&&((a&&a.tagName)===e&&a.tagExp[a.tagExp.length-1]!=="/"&&s++,n=a.closeIndex);}}}function Dr(t,e,n){if(e&&typeof t=="string"){let r=t.trim();return r==="true"?true:r==="false"?false:_r(t,n)}else return Rs(t)?t:""}function Br(t,e,n,r){if(t){let s=t(e);n===e&&(n=s),e=s;}return e=xo(e,r),{tagName:e,tagExp:n}}function xo(t,e){if(Jn.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return fn.includes(t)?e.onDangerousProperty(t):t}var Ur=ie.getMetaDataSymbol();function Mc(t,e){if(!t||typeof t!="object")return {};if(!e)return t;let n={};for(let r in t)if(r.startsWith(e)){let s=r.substring(e.length);n[s]=t[r];}else n[r]=t[r];return n}function Gr(t,e,n,r){return Eo(t,e,n,r)}function Eo(t,e,n,r){let s,o={};for(let i=0;i<t.length;i++){let a=t[i],c=$c(a);if(c!==void 0&&c!==e.textNodeName){let l=Mc(a[":@"]||{},e.attributeNamePrefix);n.push(c,l);}if(c===e.textNodeName)s===void 0?s=a[c]:s+=""+a[c];else {if(c===void 0)continue;if(a[c]){let l=Eo(a[c],e,n,r),u=Nc(l,e);if(Object.keys(l).length===0&&e.alwaysCreateTextNode&&(l[e.textNodeName]=""),a[":@"]?Lc(l,a[":@"],r,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),a[Ur]!==void 0&&typeof l=="object"&&l!==null&&(l[Ur]=a[Ur]),o[c]!==void 0&&Object.prototype.hasOwnProperty.call(o,c))Array.isArray(o[c])||(o[c]=[o[c]]),o[c].push(l);else {let p=e.jPath?r.toString():r;e.isArray(c,p,u)?o[c]=[l]:o[c]=l;}c!==void 0&&c!==e.textNodeName&&n.pop();}}}return typeof s=="string"?s.length>0&&(o[e.textNodeName]=s):s!==void 0&&(o[e.textNodeName]=s),o}function $c(t){let e=Object.keys(t);for(let n=0;n<e.length;n++){let r=e[n];if(r!==":@")return r}}function Lc(t,e,n,r){if(e){let s=Object.keys(e),o=s.length;for(let i=0;i<o;i++){let a=s[i],c=a.startsWith(r.attributeNamePrefix)?a.substring(r.attributeNamePrefix.length):a,l=r.jPath?n.toString()+"."+c:n;r.isArray(a,l,true,true)?t[a]=[e[a]]:t[a]=e[a];}}}function Nc(t,e){let{textNodeName:n}=e,r=Object.keys(t).length;return !!(r===0||r===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}var je=class{constructor(e){this.externalEntities={},this.options=to(e);}parse(e,n){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===true&&(n={});let o=Bs(e,n);if(o!==true)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let r=new vn(this.options,this.externalEntities),s=r.parseXml(e);return this.options.preserveOrder||s===void 0?s:Gr(s,this.options,r.matcher,r.readonlyMatcher)}addEntity(e,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=n;}static getMetaDataSymbol(){return ie.getMetaDataSymbol()}};var At=b(a(),1);var Rc=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,bn=class t extends Date{#t=false;#n=false;#e=null;constructor(e){let n=true,r=true,s="Z";if(typeof e=="string"){let o=e.match(Rc);o?(o[1]||(n=false,e=`0000-01-01T${e}`),r=!!o[2],r&&e[10]===" "&&(e=e.replace(" ","T")),o[2]&&+o[2]>23?e="":(s=o[3]||null,e=e.toUpperCase(),!s&&r&&(e+="Z"))):e="";}super(e),isNaN(this.getTime())||(this.#t=n,this.#n=r,this.#e=s);}isDateTime(){return this.#t&&this.#n}isLocal(){return !this.#t||!this.#n||!this.#e}isDate(){return this.#t&&!this.#n}isTime(){return this.#n&&!this.#t}isValid(){return this.#t||this.#n}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,n="Z"){let r=new t(e);return r.#e=n,r}static wrapAsLocalDateTime(e){let n=new t(e);return n.#e=null,n}static wrapAsLocalDate(e){let n=new t(e);return n.#n=false,n.#e=null,n}static wrapAsLocalTime(e){let n=new t(e);return n.#t=false,n.#e=null,n}};function Ic(t,e){let n=t.slice(0,e).split(/\r\n|\n|\r/g);return [n.length,n.pop().length+1]}function _c(t,e,n){let r=t.split(/\r\n|\n|\r/g),s="",o=(Math.log10(e+1)|0)+1;for(let i=e-1;i<=e+1;i++){let a=r[i-1];a&&(s+=i.toString().padEnd(o," "),s+=": ",s+=a,s+=`
1
+ import {a}from'./chunk-MKDRULJ6.js';import {p,o,j,n,a as a$1,i,k as k$1,d,e,q,r,s}from'./chunk-XTHPCEME.js';import {b}from'./chunk-EK7ODJWE.js';import*as B from'path';import {basename,dirname}from'path';import*as Ee from'fs/promises';import {readFile,mkdtemp,rm as rm$1,mkdir,writeFile}from'fs/promises';import U from'typescript';import*as ds from'crypto';import k from'chalk';import*as $n from'os';import {parse}from'yaml';import {spawn,execFile}from'child_process';import*as on from'fs';import {mkdirSync,writeFileSync}from'fs';import {createRequire}from'module';import*as fa from'zlib';import {promisify}from'util';function ja(t){switch(t){case "node":return "nodejs";case "python":return "python";case "dotnet":return "dotnet";case "java":return "java";case "php":return "php";case "ruby":return "ruby";case "go":return "go";default:return null}}function it(t,e){if(!e)return null;switch(t){case "python":case "php":case "ruby":case "go":{let n=e.match(/(\d+)\.(\d+)/);return n?`${n[1]}.${n[2]}`:null}case "dotnet":{let n=e.match(/(\d+)\.(\d+)/)??e.match(/(\d+)/);return n?n[2]!==void 0?`${n[1]}.${n[2]}`:`${n[1]}.0`:null}case "node":{let n=e.match(/(\d+)/);return n?n[1]:null}case "java":{let n=e.match(/1\.(\d+)/);if(n)return n[1];let r=e.match(/(\d+)/);return r?r[1]:null}default:return null}}function Ta(t,e,n=Date.now()){let r=e.find(o=>String(o.cycle)===t);if(!r)return null;if(typeof r.eol=="boolean")return r.eol;let s=Date.parse(r.eol);return Number.isNaN(s)?null:s<=n}function Ns(t){let e=String(t).match(/^(\d+)(?:\.(\d+))?/);return e?{major:parseInt(e[1],10),minor:e[2]?parseInt(e[2],10):0}:null}function zn(t){return t.major*1e3+t.minor}function Rs(t,e){if(typeof t.releaseDate!="string")return true;let n=Date.parse(t.releaseDate);return Number.isNaN(n)?true:n<=e}function Ca(t,e){if(t.lts===true)return true;if(typeof t.lts=="string"){let n=Date.parse(t.lts);return !Number.isNaN(n)&&n<=e}return false}function Wn(t,e){return t.products[e]?.cycles??[]}function dn(t,e,n=Date.now()){let r=null;for(let s of Wn(t,e)){if(!Rs(s,n))continue;let o=Ns(s.cycle);o&&(!r||zn(o)>zn(r))&&(r=o);}return r}function $r(t,e,n=Date.now()){let r=null;for(let s of Wn(t,e)){if(!Rs(s,n)||!Ca(s,n))continue;let o=Ns(s.cycle);o&&(!r||zn(o)>zn(r))&&(r=o);}return r}function gt(t,e,n){let r=Wn(t,e).find(s=>String(s.cycle)===n);return r&&typeof r.eol=="string"?r.eol:void 0}function yt(t,e,n,r=Date.now()){let s=ja(e);if(!s)return null;let o=it(e,n);return o?Ta(o,Wn(t,s),r):null}var Ne={generatedAt:"2026-06-01",source:"endoflife.date",products:{nodejs:{product:"nodejs",cycles:[{cycle:"24",releaseDate:"2025-05-06",lts:"2025-10-28",eol:"2028-04-30"},{cycle:"23",releaseDate:"2024-10-16",lts:false,eol:"2025-06-01"},{cycle:"22",releaseDate:"2024-04-24",lts:"2024-10-29",eol:"2027-04-30"},{cycle:"20",releaseDate:"2023-04-18",lts:"2023-10-24",eol:"2026-04-30"},{cycle:"18",releaseDate:"2022-04-19",lts:"2022-10-25",eol:"2025-04-30"}]},python:{product:"python",cycles:[{cycle:"3.14",releaseDate:"2025-10-07",eol:"2030-10-01"},{cycle:"3.13",releaseDate:"2024-10-07",eol:"2029-10-01"},{cycle:"3.12",releaseDate:"2023-10-02",eol:"2028-10-01"},{cycle:"3.11",releaseDate:"2022-10-24",eol:"2027-10-01"},{cycle:"3.10",releaseDate:"2021-10-04",eol:"2026-10-01"},{cycle:"3.9",releaseDate:"2020-10-05",eol:"2025-10-01"},{cycle:"3.8",releaseDate:"2019-10-14",eol:"2024-10-07"}]},dotnet:{product:"dotnet",cycles:[{cycle:"10.0",releaseDate:"2025-11-11",lts:true,eol:"2028-11-10"},{cycle:"9.0",releaseDate:"2024-11-12",lts:false,eol:"2026-05-12"},{cycle:"8.0",releaseDate:"2023-11-14",lts:true,eol:"2026-11-10"},{cycle:"7.0",releaseDate:"2022-11-08",lts:false,eol:"2024-05-14"},{cycle:"6.0",releaseDate:"2021-11-08",lts:true,eol:"2024-11-12"}]},java:{product:"java",cycles:[{cycle:"25",releaseDate:"2025-09-16",lts:true,eol:"2033-09-01"},{cycle:"21",releaseDate:"2023-09-19",lts:true,eol:"2031-09-01"},{cycle:"17",releaseDate:"2021-09-14",lts:true,eol:"2029-09-01"},{cycle:"11",releaseDate:"2018-09-25",lts:true,eol:"2026-09-01"},{cycle:"8",releaseDate:"2014-03-18",lts:true,eol:"2030-12-01"}]},php:{product:"php",cycles:[{cycle:"8.4",releaseDate:"2024-11-21",eol:"2028-12-31"},{cycle:"8.3",releaseDate:"2023-11-23",eol:"2027-12-31"},{cycle:"8.2",releaseDate:"2022-12-08",eol:"2026-12-31"},{cycle:"8.1",releaseDate:"2021-11-25",eol:"2025-12-31"},{cycle:"8.0",releaseDate:"2020-11-26",eol:"2023-11-26"}]},ruby:{product:"ruby",cycles:[{cycle:"3.5",releaseDate:"2025-12-25",eol:"2029-03-31"},{cycle:"3.4",releaseDate:"2024-12-25",eol:"2028-03-31"},{cycle:"3.3",releaseDate:"2023-12-25",eol:"2027-03-31"},{cycle:"3.2",releaseDate:"2022-12-25",eol:"2026-03-31"},{cycle:"3.1",releaseDate:"2021-12-25",eol:"2025-03-31"}]},go:{product:"go",cycles:[{cycle:"1.25",releaseDate:"2025-08-13",eol:false},{cycle:"1.24",releaseDate:"2025-02-11",eol:false},{cycle:"1.23",releaseDate:"2024-08-13",eol:true},{cycle:"1.22",releaseDate:"2024-02-06",eol:true}]}}};var me=b(a(),1),ft=b(a(),1),Ct=b(a(),1);var Is=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",Aa=Is+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Pa="["+Is+"]["+Aa+"]*",Ma=new RegExp("^"+Pa+"$");function Jn(t,e){let n=[],r=e.exec(t);for(;r;){let s=[];s.startIndex=e.lastIndex-r[0].length;let o=r.length;for(let i=0;i<o;i++)s.push(r[i]);n.push(s),r=e.exec(t);}return n}var Lr=function(t){let e=Ma.exec(t);return !(e===null||typeof e>"u")};function _s(t){return typeof t<"u"}var mn=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],Kn=["__proto__","constructor","prototype"];var $a={allowBooleanAttributes:false,unpairedTags:[]};function Ds(t,e){e=Object.assign({},$a,e);let n=[],r=false,s=false;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=Os(t,o),o.err)return o}else if(t[o]==="<"){let i=o;if(o++,t[o]==="!"){o=Bs(t,o);continue}else {let a=false;t[o]==="/"&&(a=true,o++);let c="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
2
+ `&&t[o]!=="\r";o++)c+=t[o];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),o--),!Ba(c)){let p;return c.trim().length===0?p="Invalid space after '<'.":p="Tag '"+c+"' is an invalid name.",G("InvalidTag",p,te(t,o))}let l=Ra(t,o);if(l===false)return G("InvalidAttr","Attributes for '"+c+"' have open quote.",te(t,o));let u=l.value;if(o=l.index,u[u.length-1]==="/"){let p=o-u.length;u=u.substring(0,u.length-1);let f=Vs(u,e);if(f===true)r=true;else return G(f.err.code,f.err.msg,te(t,p+f.err.line))}else if(a)if(l.tagClosed){if(u.trim().length>0)return G("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",te(t,i));if(n.length===0)return G("InvalidTag","Closing tag '"+c+"' has not been opened.",te(t,i));{let p=n.pop();if(c!==p.tagName){let f=te(t,p.tagStartPos);return G("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+c+"'.",te(t,i))}n.length==0&&(s=true);}}else return G("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",te(t,o));else {let p=Vs(u,e);if(p!==true)return G(p.err.code,p.err.msg,te(t,o-u.length+p.err.line));if(s===true)return G("InvalidXml","Multiple possible root nodes found.",te(t,o));e.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:i}),r=true;}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=Bs(t,o);continue}else if(t[o+1]==="?"){if(o=Os(t,++o),o.err)return o}else break;else if(t[o]==="&"){let p=Fa(t,o);if(p==-1)return G("InvalidChar","char '&' is not expected.",te(t,o));o=p;}else if(s===true&&!Fs(t[o]))return G("InvalidXml","Extra text at the end",te(t,o));t[o]==="<"&&o--;}}else {if(Fs(t[o]))continue;return G("InvalidChar","char '"+t[o]+"' is not expected.",te(t,o))}if(r){if(n.length==1)return G("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",te(t,n[0].tagStartPos));if(n.length>0)return G("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return G("InvalidXml","Start tag expected.",1);return true}function Fs(t){return t===" "||t===" "||t===`
3
+ `||t==="\r"}function Os(t,e){let n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let r=t.substr(n,e-n);if(e>5&&r==="xml")return G("InvalidXml","XML declaration allowed only at the start of the document.",te(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Bs(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var La='"',Na="'";function Ra(t,e){let n="",r="",s=false;for(;e<t.length;e++){if(t[e]===La||t[e]===Na)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){s=true;break}n+=t[e];}return r!==""?false:{value:n,index:e,tagClosed:s}}var Ia=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Vs(t,e){let n=Jn(t,Ia),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return G("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",hn(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return G("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",hn(n[s]));if(n[s][3]===void 0&&!e.allowBooleanAttributes)return G("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",hn(n[s]));let o=n[s][2];if(!Oa(o))return G("InvalidAttr","Attribute '"+o+"' is an invalid name.",hn(n[s]));if(!Object.prototype.hasOwnProperty.call(r,o))r[o]=1;else return G("InvalidAttr","Attribute '"+o+"' is repeated.",hn(n[s]))}return true}function _a(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return -1}function Fa(t,e){if(e++,t[e]===";")return -1;if(t[e]==="#")return e++,_a(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return -1}return e}function G(t,e,n){return {err:{code:t,msg:e,line:n.line||n,col:n.col}}}function Oa(t){return Lr(t)}function Ba(t){return Lr(t)}function te(t,e){let n=t.substring(0,e).split(/\r?\n/);return {line:n.length,col:n[n.length-1].length+1}}function hn(t){return t.startIndex+t[1].length}var Yn={cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",euro:"\u20AC",dollar:"$",fnof:"\u0192",inr:"\u20B9",af:"\u060B",birr:"\u1265\u122D",peso:"\u20B1",rub:"\u20BD",won:"\u20A9",yuan:"\xA5",cedil:"\xB8"},gn={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},Nr={nbsp:"\xA0",copy:"\xA9",reg:"\xAE",trade:"\u2122",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",laquo:"\xAB",raquo:"\xBB",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",bull:"\u2022",para:"\xB6",sect:"\xA7",deg:"\xB0",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE"};var Gt=Object.freeze({ALLOW:"allow",BLOCK:"block",THROW:"throw"}),Da=new Set("!?\\\\/[]$%{}^&*()<>|+");function eo(t){if(t[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t}"`);for(let e of t)if(Da.has(e))throw new Error(`[EntityReplacer] Invalid character '${e}' in entity name: "${t}"`);return t}function yn(...t){let e=Object.create(null);for(let n of t)if(n)for(let r of Object.keys(n)){let s=n[r];if(typeof s=="string")e[r]=s;else if(s&&typeof s=="object"&&s.val!==void 0){let o=s.val;typeof o=="string"&&(e[r]=o);}}return e}var vt="external",Xn="base",Rr="all";function Ua(t){return !t||t===vt?new Set([vt]):t===Rr?new Set([Rr]):t===Xn?new Set([Xn]):Array.isArray(t)?new Set(t):new Set([vt])}var oe=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Ga=new Set([9,10,13]);function qa(t){if(!t)return {xmlVersion:1,onLevel:oe.allow,nullLevel:oe.remove};let e=t.xmlVersion===1.1?1.1:1,n=oe[t.onNCR]??oe.allow,r=oe[t.nullNCR]??oe.remove,s=Math.max(r,oe.remove);return {xmlVersion:e,onLevel:n,nullLevel:s}}var qt=class{constructor(e={}){this._limit=e.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof e.postCheck=="function"?e.postCheck:r=>r,this._limitTiers=Ua(this._limit.applyLimitsTo??vt),this._numericAllowed=e.numericAllowed??true,this._baseMap=yn(gn,e.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]),this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);let n=qa(e.ncr);this._ncrXmlVersion=n.xmlVersion,this._ncrOnLevel=n.onLevel,this._ncrNullLevel=n.nullLevel,this._onExternalEntity=typeof e.onExternalEntity=="function"?e.onExternalEntity:null,this._onInputEntity=typeof e.onInputEntity=="function"?e.onInputEntity:null;}_applyRegistrationHook(e,n,r,s){if(!e)return true;let o=e(n,r);if(o===Gt.BLOCK)return false;if(o===Gt.THROW)throw new Error(`[EntityDecoder] Registration of ${s} entity "&${n};" was rejected by hook`);return true}setExternalEntities(e){if(e)for(let s of Object.keys(e))eo(s);if(!this._onExternalEntity){this._externalMap=yn(e);return}let n=yn(e),r=Object.create(null);for(let[s,o]of Object.entries(n))this._applyRegistrationHook(this._onExternalEntity,s,o,"external")&&(r[s]=o);this._externalMap=r;}addExternalEntity(e,n){eo(e),typeof n=="string"&&n.indexOf("&")===-1&&this._applyRegistrationHook(this._onExternalEntity,e,n,"external")&&(this._externalMap[e]=n);}addInputEntities(e){if(this._totalExpansions=0,this._expandedLength=0,!this._onInputEntity){this._inputMap=yn(e);return}let n=yn(e),r=Object.create(null);for(let[s,o]of Object.entries(n))this._applyRegistrationHook(this._onInputEntity,s,o,"input")&&(r[s]=o);this._inputMap=r;}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1;}decode(e){if(typeof e!="string"||e.length===0||e.indexOf("&")===-1)return e;let n=e,r=[],s=e.length,o=0,i=0,a=this._maxTotalExpansions>0,c=this._maxExpandedLength>0,l=a||c;for(;i<s;){if(e.charCodeAt(i)!==38){i++;continue}let p=i+1;for(;p<s&&e.charCodeAt(p)!==59&&p-i<=32;)p++;if(p>=s||e.charCodeAt(p)!==59){i++;continue}let f=e.slice(i+1,p);if(f.length===0){i++;continue}let d,h;if(this._removeSet.has(f))d="",h===void 0&&(h=vt);else if(this._leaveSet.has(f)){i++;continue}else if(f.charCodeAt(0)===35){let g=this._resolveNCR(f);if(g===void 0){i++;continue}d=g,h=Xn;}else {let g=this._resolveName(f);d=g?.value,h=g?.tier;}if(d===void 0){i++;continue}if(i>o&&r.push(e.slice(o,i)),r.push(d),o=p+1,i=o,l&&this._tierCounts(h)){if(a&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(c){let g=d.length-(f.length+2);if(g>0&&(this._expandedLength+=g,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}o<s&&r.push(e.slice(o));let u=r.length===0?e:r.join("");return this._postCheck(u,n)}_tierCounts(e){return this._limitTiers.has(Rr)?true:this._limitTiers.has(e)}_resolveName(e){if(e in this._inputMap)return {value:this._inputMap[e],tier:vt};if(e in this._externalMap)return {value:this._externalMap[e],tier:vt};if(e in this._baseMap)return {value:this._baseMap[e],tier:Xn}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!Ga.has(e)?oe.remove:-1}_applyNCRAction(e,n,r){switch(e){case oe.allow:return String.fromCodePoint(r);case oe.remove:return "";case oe.leave:return;case oe.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${n}; (U+${r.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(r)}}_resolveNCR(e){let n=e.charCodeAt(1),r;if(n===120||n===88?r=parseInt(e.slice(2),16):r=parseInt(e.slice(1),10),Number.isNaN(r)||r<0||r>1114111)return;let s=this._classifyNCR(r);if(!this._numericAllowed&&s<oe.remove)return;let o=s===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,s);return this._applyNCRAction(o,e,r)}};var to=t=>mn.includes(t)?"__"+t:t,Ha={preserveOrder:false,attributeNamePrefix:"@_",attributesGroupName:false,textNodeName:"#text",ignoreAttributes:true,removeNSPrefix:false,allowBooleanAttributes:false,parseTagValue:true,parseAttributeValue:false,trimValues:true,cdataPropName:false,numberParseOptions:{hex:true,leadingZeros:true,eNotation:true,unicode:false},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:false,isArray:()=>false,commentPropName:false,unpairedTags:[],processEntities:true,htmlEntities:false,entityDecoder:null,ignoreDeclaration:false,ignorePiTags:false,transformTagName:false,transformAttributeName:false,updateTag:function(t,e,n){return t},captureMetaData:false,maxNestedTags:100,strictReservedNames:true,jPath:true,onDangerousProperty:to};function za(t,e){if(typeof t!="string")return;let n=t.toLowerCase();if(mn.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(Kn.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function no(t,e){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof t=="object"&&t!==null?{enabled:t.enabled!==false,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??1e3),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null,appliesTo:t.appliesTo??"all"}:no(true)}var ro=function(t){let e=Object.assign({},Ha,t),n=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(let{value:r,name:s}of n)r&&za(r,s);return e.onDangerousProperty===null&&(e.onDangerousProperty=to),e.processEntities=no(e.processEntities,e.htmlEntities),e.unpairedTagsSet=new Set(e.unpairedTags),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(r=>typeof r=="string"&&r.startsWith("*.")?".."+r.substring(2):r)),e};var Qn;typeof Symbol!="function"?Qn="@@xmlMetadata":Qn=Symbol("XML Node Metadata");var ie=class{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null);}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n});}addChild(e,n){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),n!==void 0&&(this.child[this.child.length-1][Qn]={startIndex:n});}static getMetaDataSymbol(){return Qn}};var so=":A-Za-z_\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",Wa=so+"\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040",oo=":A-Za-z_\xC0-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}",Ja=oo+"\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040",io=(t,e,n="")=>{let r=t.replace(":",""),s=e.replace(":",""),o=`[${r}][${s}]*`;return {name:new RegExp(`^[${t}][${e}]*$`,n),ncName:new RegExp(`^${o}$`,n),qName:new RegExp(`^${o}(?::${o})?$`,n),nmToken:new RegExp(`^[${e}]+$`,n),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,n)}},Ka=io(so,Wa),Ya=io(oo,Ja,"u"),Xa=(t="1.0")=>t==="1.1"?Ya:Ka;var Ir=(t,{xmlVersion:e="1.0"}={})=>Xa(e).qName.test(t);var bn=class{constructor(e,n){this.suppressValidationErr=!e,this.options=e,this.xmlVersion=n||1;}setXmlVersion(e=1){this.xmlVersion=e;}readDocType(e,n){let r=Object.create(null),s=0;if(e[n+3]==="O"&&e[n+4]==="C"&&e[n+5]==="T"&&e[n+6]==="Y"&&e[n+7]==="P"&&e[n+8]==="E"){n=n+9;let o=1,i=false,a=false,c="";for(;n<e.length;n++)if(e[n]==="<"&&!a){if(i&&bt(e,"!ENTITY",n)){n+=7;let l,u;if([l,u,n]=this.readEntityExp(e,n+1,this.suppressValidationErr),u.indexOf("&")===-1){if(this.options.enabled!==false&&this.options.maxEntityCount!=null&&s>=this.options.maxEntityCount)throw new Error(`Entity count (${s+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);r[l]=u,s++;}}else if(i&&bt(e,"!ELEMENT",n)){n+=8;let{index:l}=this.readElementExp(e,n+1);n=l;}else if(i&&bt(e,"!ATTLIST",n))n+=8;else if(i&&bt(e,"!NOTATION",n)){n+=9;let{index:l}=this.readNotationExp(e,n+1,this.suppressValidationErr);n=l;}else if(bt(e,"!--",n))a=true;else throw new Error("Invalid DOCTYPE");o++,c="";}else if(e[n]===">"){if(a?e[n-1]==="-"&&e[n-2]==="-"&&(a=false,o--):o--,o===0)break}else e[n]==="["?i=true:c+=e[n];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return {entities:r,i:n}}readEntityExp(e,n){n=ae(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n])&&e[n]!=='"'&&e[n]!=="'";)n++;let s=e.substring(r,n);if(vn(s,{xmlVersion:this.xmlVersion}),n=ae(e,n),!this.suppressValidationErr){if(e.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[n]==="%")throw new Error("Parameter entities are not supported")}let o="";if([n,o]=this.readIdentifierVal(e,n,"entity"),this.options.enabled!==false&&this.options.maxEntitySize!=null&&o.length>this.options.maxEntitySize)throw new Error(`Entity "${s}" size (${o.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return n--,[s,o,n]}readNotationExp(e,n){n=ae(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let s=e.substring(r,n);!this.suppressValidationErr&&vn(s,{xmlVersion:this.xmlVersion}),n=ae(e,n);let o=e.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);n+=o.length,n=ae(e,n);let i=null,a=null;if(o==="PUBLIC")[n,i]=this.readIdentifierVal(e,n,"publicIdentifier"),n=ae(e,n),(e[n]==='"'||e[n]==="'")&&([n,a]=this.readIdentifierVal(e,n,"systemIdentifier"));else if(o==="SYSTEM"&&([n,a]=this.readIdentifierVal(e,n,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return {notationName:s,publicIdentifier:i,systemIdentifier:a,index:--n}}readIdentifierVal(e,n,r){let s="",o=e[n];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);n++;let i=n;for(;n<e.length&&e[n]!==o;)n++;if(s=e.substring(i,n),e[n]!==o)throw new Error(`Unterminated ${r} value`);return n++,[n,s]}readElementExp(e,n){n=ae(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let s=e.substring(r,n);if(!this.suppressValidationErr&&!Ir(s,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${s}"`);n=ae(e,n);let o="";if(e[n]==="E"&&bt(e,"MPTY",n))n+=4;else if(e[n]==="A"&&bt(e,"NY",n))n+=2;else if(e[n]==="("){n++;let i=n;for(;n<e.length&&e[n]!==")";)n++;if(o=e.substring(i,n),e[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[n]}"`);return {elementName:s,contentModel:o.trim(),index:n}}readAttlistExp(e,n){n=ae(e,n);let r=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;let s=e.substring(r,n);for(vn(s,{xmlVersion:this.xmlVersion}),n=ae(e,n),r=n;n<e.length&&!/\s/.test(e[n]);)n++;let o=e.substring(r,n);if(!vn(o,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${o}"`);n=ae(e,n);let i="";if(e.substring(n,n+8).toUpperCase()==="NOTATION"){if(i="NOTATION",n+=8,n=ae(e,n),e[n]!=="(")throw new Error(`Expected '(', found "${e[n]}"`);n++;let c=[];for(;n<e.length&&e[n]!==")";){let l=n;for(;n<e.length&&e[n]!=="|"&&e[n]!==")";)n++;let u=e.substring(l,n);if(u=u.trim(),!vn(u,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${u}"`);c.push(u),e[n]==="|"&&(n++,n=ae(e,n));}if(e[n]!==")")throw new Error("Unterminated list of notations");n++,i+=" ("+c.join("|")+")";}else {let c=n;for(;n<e.length&&!/\s/.test(e[n]);)n++;i+=e.substring(c,n);let l=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!l.includes(i.toUpperCase()))throw new Error(`Invalid attribute type: "${i}"`)}n=ae(e,n);let a="";return e.substring(n,n+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",n+=8):e.substring(n,n+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",n+=7):[n,a]=this.readIdentifierVal(e,n,"ATTLIST"),{elementName:s,attributeName:o,attributeType:i,defaultValue:a,index:n}}},ae=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function bt(t,e,n){for(let r=0;r<e.length;r++)if(e[r]!==t[n+r+1])return false;return true}function vn(t,e){if(Ir(t,{xmlVersion:e}))return t;throw new Error(`Invalid entity name ${t}`)}var Qa=[48,1632,1776,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,65296,120782,120792,120802,120812,120822,66720,68912,69734,69872,69942,70096,70384,70736,70864,71248,71360,71472,71904,72016,72688,72784,73040,73120,73552,92768,92864,93008,123200,123632,124144,125264,130032],Zn=255,er=new Map,ao=65535,co=1632,Ht=co,Za=ao-co+1,tr=new Uint8Array(Za).fill(Zn);for(let t of Qa)for(let e=0;e<10;e++){let n=t+e;n<=ao?tr[n-Ht]=e:er.set(n,e);}var lo=48,uo=57,po=45,nr=new Set([8722,65293,65123]);function ec(t){if(typeof t!="string")return t;let e=t.length;if(e===0)return t;let n=-1;for(let s=0;s<e;s++){let o=t.charCodeAt(s);if(!(o>=lo&&o<=uo||o===po)){if(o<Ht){if(nr.has(o)){n=s;break}continue}if(o>=55296&&o<=56319){if(s+1<e){let i=t.charCodeAt(s+1);if(i>=56320&&i<=57343){let a=65536+(o-55296<<10)+(i-56320);if(er.has(a)){n=s;break}}}continue}if(tr[o-Ht]!==Zn||nr.has(o)){n=s;break}}}if(n===-1)return t;let r=[];n>0&&r.push(t.slice(0,n));for(let s=n;s<e;s++){let o=t.charCodeAt(s);if(o>=lo&&o<=uo||o===po){r.push(t[s]);continue}if(o<Ht){r.push(nr.has(o)?"-":t[s]);continue}if(o>=55296&&o<=56319){if(s+1<e){let a=t.charCodeAt(s+1);if(a>=56320&&a<=57343){let c=65536+(o-55296<<10)+(a-56320),l=er.get(c);if(l!==void 0){r.push(String.fromCharCode(l+48)),s++;continue}}}r.push(t[s]);continue}if(nr.has(o)){r.push("-");continue}let i=tr[o-Ht];r.push(i!==Zn?String.fromCharCode(i+48):t[s]);}return r.join("")}var fo=ec;var tc=/^[-+]?0x[a-fA-F0-9]+$/,nc=/^0b[01]+$/,rc=/^0o[0-7]+$/,sc=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,oc={hex:true,binary:false,octal:false,leadingZeros:true,decimalPoint:".",eNotation:true,infinity:"original",unicode:false};function Fr(t,e={}){if(e=Object.assign({},oc,e),!t||typeof t!="string")return t;let n=t.trim();if(n.length===0)return t;if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(n==="0"||e.unicode&&(n=fo(n),n==="0"))return 0;if(e.hex&&tc.test(n))return _r(n,16);if(e.binary&&nc.test(n))return _r(n,2);if(e.octal&&rc.test(n))return _r(n,8);if(isFinite(n)){if(n.includes("e")||n.includes("E"))return ac(t,n,e);{let r=sc.exec(n);if(r){let s=r[1]||"",o=r[2],i=cc(r[3]),a=s?t[o.length+1]===".":t[o.length]===".";if(!e.leadingZeros&&(o.length>1||o.length===1&&!a))return t;{let c=Number(n),l=String(c);if(c===0)return c;if(l.search(/[eE]/)!==-1)return e.eNotation?c:t;if(n.indexOf(".")!==-1)return l==="0"||l===i||l===`${s}${i}`?c:t;let u=o?i:n;return o?u===l||s+u===l?c:t:u===l||u===s+l?c:t}}else return t}}else return lc(t,Number(n),e)}var ic=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function ac(t,e,n){if(!n.eNotation)return t;let r=e.match(ic);if(r){let s=r[1]||"",o=r[3].indexOf("e")===-1?"E":"e",i=r[2],a=s?t[i.length+1]===o:t[i.length]===o;return i.length>1&&a?t:i.length===1&&(r[3].startsWith(`.${o}`)||r[3][0]===o)?Number(e):i.length>0?n.leadingZeros&&!a?(e=(r[1]||"")+r[3],Number(e)):t:Number(e)}else return t}function cc(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substring(0,t.length-1))),t}function _r(t,e){let n=t.trim();if((e===2||e===8)&&(t=n.substring(2)),parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function lc(t,e,n){let r=e===1/0;switch(n.infinity.toLowerCase()){case "null":return null;case "infinity":return e;case "string":return r?"Infinity":"-Infinity";default:return t}}function Or(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(let n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return true}:()=>false}var wt=class{constructor(e,n={},r){this.pattern=e,this.separator=n.separator||".",this.segments=this._parse(e),this.data=r,this._hasDeepWildcard=this.segments.some(s=>s.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(s=>s.attrName!==void 0),this._hasPositionSelector=this.segments.some(s=>s.position!==void 0);}_parse(e){let n=[],r=0,s="";for(;r<e.length;)e[r]===this.separator?r+1<e.length&&e[r+1]===this.separator?(s.trim()&&(n.push(this._parseSegment(s.trim())),s=""),n.push({type:"deep-wildcard"}),r+=2):(s.trim()&&n.push(this._parseSegment(s.trim())),s="",r++):(s+=e[r],r++);return s.trim()&&n.push(this._parseSegment(s.trim())),n}_parseSegment(e){let n={type:"tag"},r=null,s=e,o=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(o&&(s=o[1]+o[3],o[2])){let u=o[2].slice(1,-1);u&&(r=u);}let i,a=s;if(s.includes("::")){let u=s.indexOf("::");if(i=s.substring(0,u).trim(),a=s.substring(u+2).trim(),!i)throw new Error(`Invalid namespace in pattern: ${e}`)}let c,l=null;if(a.includes(":")){let u=a.lastIndexOf(":"),p=a.substring(0,u).trim(),f=a.substring(u+1).trim();["first","last","odd","even"].includes(f)||/^nth\(\d+\)$/.test(f)?(c=p,l=f):c=a;}else c=a;if(!c)throw new Error(`Invalid segment pattern: ${e}`);if(n.tag=c,i&&(n.namespace=i),r)if(r.includes("=")){let u=r.indexOf("=");n.attrName=r.substring(0,u).trim(),n.attrValue=r.substring(u+1).trim();}else n.attrName=r.trim();if(l){let u=l.match(/^nth\((\d+)\)$/);u?(n.position="nth",n.positionValue=parseInt(u[1],10)):n.position=l;}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}};var zt=class{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._deepByTerminalTag=new Map,this._patterns=new Set,this._sealed=false;}add(e){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard()){let o=e.segments[e.segments.length-1];if(o&&o.type!=="deep-wildcard"&&o.tag!=="*"){let i=o.tag;this._deepByTerminalTag.has(i)||this._deepByTerminalTag.set(i,[]),this._deepByTerminalTag.get(i).push(e);}else this._deepWildcards.push(e);return this}let n=e.length,s=e.segments[e.segments.length-1]?.tag;if(!s||s==="*")this._wildcardByDepth.has(n)||this._wildcardByDepth.set(n,[]),this._wildcardByDepth.get(n).push(e);else {let o=`${n}:${s}`;this._byDepthAndTag.has(o)||this._byDepthAndTag.set(o,[]),this._byDepthAndTag.get(o).push(e);}return this}addAll(e){for(let n of e)this.add(n);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=true,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){let n=e.getDepth(),r=e.getCurrentTag(),s=`${n}:${r}`,o=this._byDepthAndTag.get(s);if(o){for(let c=0;c<o.length;c++)if(e.matches(o[c]))return o[c]}let i=this._wildcardByDepth.get(n);if(i){for(let c=0;c<i.length;c++)if(e.matches(i[c]))return i[c]}let a=this._deepByTerminalTag.get(r);if(a){for(let c=0;c<a.length;c++)if(e.matches(a[c]))return a[c]}for(let c=0;c<this._deepWildcards.length;c++)if(e.matches(this._deepWildcards[c]))return this._deepWildcards[c];return null}};var Br=class{constructor(e){this._matcher=e;}get separator(){return this._matcher.separator}getCurrentTag(){let e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){let e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){let n=this._matcher.path;if(n.length!==0)return n[n.length-1].values?.[e]}hasAttr(e){let n=this._matcher.path;if(n.length===0)return false;let r=n[n.length-1];return r.values!==void 0&&e in r.values}getAnyParentAttr(e){return this._matcher.getAnyParentAttr(e)}hasAnyParentAttr(e){return this._matcher.hasAnyParentAttr(e)}getPosition(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,n=true){return this._matcher.toString(e,n)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}},Wt=class{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new Br(this),this._keptAttrs=[];}push(e,n=null,r=null,s=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let o=this.path.length;this.siblingStacks[o]||(this.siblingStacks[o]=new Map);let i=this.siblingStacks[o],a=r?`${r}:${e}`:e,c=i.get(a)||0,l=0;for(let d of i.values())l+=d;i.set(a,c+1);let u={tag:e,position:l,counter:c};r!=null&&(u.namespace=r),n!=null&&(u.values=n),this.path.push(u);let p=this.path.length,f=s!==null?s.keep:null;if(f!=null&&f.length>0&&n)for(let d=0;d<f.length;d++){let h=f[d];n[h]!==void 0&&this._keptAttrs.push({depth:p,name:h,value:n[h]});}}pop(){if(this.path.length===0)return;this._pathStringCache=null;let e=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);let n=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=n;)this._keptAttrs.pop();return e}updateCurrent(e){if(this.path.length>0){let n=this.path[this.path.length-1];e!=null&&(n.values=e);}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return false;let n=this.path[this.path.length-1];return n.values!==void 0&&e in n.values}getAnyParentAttr(e){let n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].name===e)return n[r].value}hasAnyParentAttr(e){let n=this._keptAttrs;for(let r=n.length-1;r>=0;r--)if(n[r].name===e)return true;return false}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,n=true){let r=e||this.separator;if(r===this.separator&&n===true){if(this._pathStringCache!==null)return this._pathStringCache;let o=this.path.map(i=>i.namespace?`${i.namespace}:${i.tag}`:i.tag).join(r);return this._pathStringCache=o,o}return this.path.map(o=>n&&o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(r)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[];}matches(e){let n=e.segments;return n.length===0?false:e.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n)}_matchSimple(e){if(this.path.length!==e.length)return false;for(let n=0;n<e.length;n++)if(!this._matchSegment(e[n],this.path[n],n===this.path.length-1))return false;return true}_matchWithDeepWildcard(e){let n=this.path.length-1,r=e.length-1;for(;r>=0&&n>=0;){let s=e[r];if(s.type==="deep-wildcard"){if(r--,r<0)return true;let o=e[r],i=false;for(let a=n;a>=0;a--)if(this._matchSegment(o,this.path[a],a===this.path.length-1)){n=a-1,r--,i=true;break}if(!i)return false}else {if(!this._matchSegment(s,this.path[n],n===this.path.length-1))return false;n--,r--;}}return r<0}_matchSegment(e,n,r){if(e.tag!=="*"&&e.tag!==n.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==n.namespace||e.attrName!==void 0&&(!r||!n.values||!(e.attrName in n.values)||e.attrValue!==void 0&&String(n.values[e.attrName])!==String(e.attrValue)))return false;if(e.position!==void 0){if(!r)return false;let s=n.counter??0;if(e.position==="first"&&s!==0)return false;if(e.position==="odd"&&s%2!==1)return false;if(e.position==="even"&&s%2!==0)return false;if(e.position==="nth"&&s!==e.positionValue)return false}return true}matchesAny(e){return e.matchesAny(this)}snapshot(){return {path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e)),keptAttrs:this._keptAttrs.map(e=>({...e}))}}restore(e){this._pathStringCache=null,this.path=e.path.map(n=>({...n})),this.siblingStacks=e.siblingStacks.map(n=>new Map(n)),this._keptAttrs=(e.keptAttrs||[]).map(n=>({...n}));}readOnly(){return this._view}};var uc=[{id:"html-script-open",description:"<script opening tag",pattern:/<script[\s>/]/i},{id:"html-script-close",description:"</script closing tag",pattern:/<\/script[\s>]/i},{id:"html-javascript-protocol",description:"javascript: URI scheme (with optional whitespace/encoding)",pattern:/j[\t\n\r ]*a[\t\n\r ]*v[\t\n\r ]*a[\t\n\r ]*s[\t\n\r ]*c[\t\n\r ]*r[\t\n\r ]*i[\t\n\r ]*p[\t\n\r ]*t[\t\n\r ]*:/i},{id:"html-vbscript-protocol",description:"vbscript: URI scheme",pattern:/vbscript[\t\n\r ]*:/i},{id:"html-data-html",description:"data:text/html URI \u2014 can execute scripts in browsers",pattern:/data[\t\n\r ]*:[\t\n\r ]*text\/html/i},{id:"html-data-xhtml",description:"data:application/xhtml+xml URI",pattern:/data[\t\n\r ]*:[\t\n\r ]*application\/xhtml/i},{id:"html-data-svg",description:"data:image/svg+xml URI \u2014 can execute scripts",pattern:/data[\t\n\r ]*:[\t\n\r ]*image\/svg\+xml/i},{id:"html-inline-event-handler",description:"Inline event handler attributes: onclick=, onerror=, onload=, etc.",pattern:/\bon\w{1,30}\s*=/i},{id:"html-entity-obfuscated-script",description:"HTML-entity-encoded <script (e.g. &#x3C;script or &lt;script)",pattern:/(?:&#x0*3[Cc];?|&#0*60;?|&lt;)\s*script/i},{id:"html-entity-obfuscated-javascript",description:'HTML-entity-encoded javascript: (partial \u2014 catches common &#106; or &#x6a; for "j")',pattern:/(?:&#x0*6[Aa];?|&#0*106;?)\s*(?:&#x0*61;?|a)[\s\S]{0,80}script\s*:/i},{id:"html-style-expression",description:"CSS expression() \u2014 IE-era code execution in style attributes",pattern:/style[\s\S]{0,20}expression\s*\(/i},{id:"html-object-embed",description:"<object or <embed tags that can load active content",pattern:/<(?:object|embed)[\s>/]/i},{id:"html-base-tag",description:"<base href= \u2014 can hijack all relative URLs on a page",pattern:/<base[\s>]/i},{id:"html-meta-refresh",description:'<meta http-equiv="refresh" \u2014 can redirect users',pattern:/<meta[\s\S]{0,40}http-equiv[\s\S]{0,20}refresh/i},{id:"html-srcdoc",description:"srcdoc= attribute on iframes \u2014 embeds HTML that can run scripts",pattern:/srcdoc\s*=/i},{id:"html-iframe",description:"<iframe tag",pattern:/<iframe[\s>/]/i},{id:"html-form",description:"<form tag \u2014 can be used for phishing / credential harvesting injection",pattern:/<form[\s>/]/i}],mo=uc;var pc=[{id:"xml-cdata-injection",description:"CDATA section injection: <![CDATA[ breaks out of text node context",pattern:/<!\[CDATA\[/i},{id:"xml-cdata-close",description:"CDATA close sequence: ]]> can terminate an enclosing CDATA section",pattern:/\]\]>/},{id:"xml-processing-instruction",description:"XML processing instruction: <?xml-stylesheet or <?php etc.",pattern:/<\?(?:xml[\- ]|php|asp)/i},{id:"xml-doctype-injection",description:"DOCTYPE declaration embedded in content \u2014 can define entities",pattern:/<!DOCTYPE(?:[\s[]|$)/i},{id:"xml-entity-system",description:"SYSTEM keyword \u2014 used in external entity declarations (XXE)",pattern:/\bSYSTEM\s+["']/i},{id:"xml-entity-public",description:"PUBLIC keyword \u2014 used in external entity declarations (XXE)",pattern:/\bPUBLIC\s+["']/i},{id:"xml-entity-declaration",description:"<!ENTITY declaration \u2014 defines entities, potential XXE or entity expansion",pattern:/<!ENTITY[\s%]/i},{id:"xml-billion-laughs",description:"Entity reference chaining / billion laughs: repeated &eX; style references",pattern:/(?:&\w{1,20};){3,}/},{id:"xml-namespace-confusion",description:"xmlns: attribute injection \u2014 can redefine namespaces to confuse parsers",pattern:/\bxmlns\s*(?::\w{1,40})?\s*=/i},{id:"xml-comment-injection",description:"<!-- comment injection \u2014 can hide content from some parsers",pattern:/<!--/},{id:"xml-comment-close",description:"--> closes an enclosing XML comment",pattern:/-->/},{id:"xml-pi-close",description:"?> closes an enclosing processing instruction",pattern:/\?>/}],ho=pc;var fc=[{id:"svg-script-element",description:"<script element inside SVG executes JavaScript",pattern:/<script[\s>/]/i},{id:"svg-xlink-href-javascript",description:"xlink:href with javascript: \u2014 classic SVG XSS via <a> or <use>",pattern:/xlink\s*:\s*href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-href-javascript",description:"href= with javascript: in SVG context (<a>, <animate>, etc.)",pattern:/href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-foreignobject",description:"<foreignObject embeds HTML inside SVG \u2014 can execute scripts",pattern:/<foreignObject[\s>/]/i},{id:"svg-use-external",description:"<use xlink:href or href pointing to external resource (non-fragment URL)",pattern:/<use[\s\S]{0,60}(?:xlink\s*:\s*)?href\s*=\s*(?:["'][^#]|[^"'#\s>])/i},{id:"svg-animate-href",description:'<animate attributeName="href" \u2014 can dynamically change href to javascript:',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*href["']/i},{id:"svg-animate-xlinkhref",description:'<animate attributeName="xlink:href"',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*xlink\s*:\s*href["']/i},{id:"svg-set-javascript",description:'<set to="javascript:..." \u2014 sets an attribute to a javascript: URI',pattern:/<set[\s\S]{0,80}to\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-event-handler",description:"SVG-specific event handler attributes: onload=, onerror=, onactivate=, etc.",pattern:/\bon(?:load|error|activate|begin|end|repeat|focus|blur|click|mouse\w{1,20}|key\w{1,20})\s*=/i},{id:"svg-handler-generic",description:"Generic on* handler catch-all for SVG attributes",pattern:/\bon\w{1,30}\s*=/i},{id:"svg-filter-feimage",description:"<feImage href= \u2014 filter primitive that can load external resources",pattern:/<feImage[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=/i},{id:"svg-image-external",description:"<image xlink:href with http/https or javascript protocol",pattern:/<image[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=\s*["']?\s*(?:https?|javascript)\s*:/i},{id:"svg-style-javascript",description:"style= attribute containing javascript: (e.g. background:url(javascript:...))",pattern:/style\s*=[\s\S]{0,60}javascript\s*:/i}],go=fc;var dc=[{id:"sql-block-comment-open",description:"SQL block comment open: /* ... */ \u2014 unusual in legitimate user text",pattern:/\/\*/},{id:"sql-union-select",description:"UNION SELECT \u2014 most common SQL injection aggregation attack",pattern:/\bUNION\s{1,20}(?:ALL\s{1,20})?SELECT\b/i},{id:"sql-drop-table",description:"DROP TABLE \u2014 destructive DDL injection",pattern:/\bDROP\s{1,20}TABLE\b/i},{id:"sql-drop-database",description:"DROP DATABASE \u2014 destructive DDL injection",pattern:/\bDROP\s{1,20}DATABASE\b/i},{id:"sql-insert-into",description:"INSERT INTO \u2014 data injection",pattern:/\bINSERT\s{1,20}INTO\b/i},{id:"sql-delete-from",description:"DELETE FROM \u2014 data deletion injection",pattern:/\bDELETE\s{1,20}FROM\b/i},{id:"sql-update-set",description:"UPDATE ... SET \u2014 data modification injection",pattern:/\bUPDATE\b[\s\S]{1,60}\bSET\b/i},{id:"sql-exec-xp",description:"EXEC xp_ \u2014 MSSQL extended stored procedure execution",pattern:/\bEXEC(?:UTE)?\s{1,20}xp_/i},{id:"sql-tautology-string",description:`Classic string tautology: ' OR '1'='1 or " OR "1"="1"`,pattern:/'\s{0,10}OR\s{0,10}'[^']{0,20}'\s*=\s*'[^']{0,20}/i},{id:"sql-tautology-numeric",description:"Numeric tautology: OR 1=1",pattern:/\bOR\s{1,10}1\s*=\s*1\b/i},{id:"sql-always-true-zero",description:"Numeric tautology: OR 0=0",pattern:/\bOR\s{1,10}0\s*=\s*0\b/i},{id:"sql-sleep-benchmark",description:"Time-based blind injection: SLEEP() or BENCHMARK()",pattern:/\b(?:SLEEP|BENCHMARK)\s*\(/i},{id:"sql-waitfor-delay",description:"MSSQL time-based blind injection: WAITFOR DELAY",pattern:/\bWAITFOR\s{1,20}DELAY\b/i},{id:"sql-char-function",description:"CHAR() function \u2014 used to obfuscate injected strings",pattern:/\bCHAR\s*\(\s*\d{1,3}/i},{id:"sql-information-schema",description:"INFORMATION_SCHEMA \u2014 reconnaissance query for table/column enumeration",pattern:/\bINFORMATION_SCHEMA\b/i}],rr=dc;var mc=[{id:"sql-line-comment",description:"SQL line comment: -- followed by whitespace or end of string",pattern:/--(?:\s|$)/},{id:"sql-stacked-query",description:"Stacked queries: semicolon immediately followed by a SQL keyword",pattern:/;\s{0,10}(?:SELECT|INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|EXEC)\b/i},{id:"sql-hex-encoding",description:"Hex-encoded string injection: 0x41414141 style (MySQL)",pattern:/\b0x[0-9a-f]{4,}/i}],hc=[...rr,...mc],yo=hc;var gc=[{id:"shell-path-traversal-unix",description:"Unix path traversal: ../ \u2014 climbing the directory tree",pattern:/\.\.\//},{id:"shell-path-traversal-windows",description:"Windows path traversal: ..\\ \u2014 climbing the directory tree",pattern:/\.\.\\/},{id:"shell-path-traversal-encoded",description:"URL-encoded path traversal: %2e%2e or %2f variants",pattern:/%2e%2e|%2f\.\.|\.\.%2f/i},{id:"shell-null-byte",description:"Null byte injection: \\x00 or %00 \u2014 truncates strings in C-backed functions",pattern:/\x00|%00/},{id:"shell-semicolon",description:"Semicolon command separator: cmd1; cmd2",pattern:/;/},{id:"shell-pipe",description:"Pipe operator: cmd1 | cmd2",pattern:/\|/},{id:"shell-and-operator",description:"AND operator: cmd1 && cmd2",pattern:/&&/},{id:"shell-or-operator",description:"OR operator: cmd1 || cmd2",pattern:/\|\|/},{id:"shell-backtick",description:"Backtick command substitution: `cmd`",pattern:/`/},{id:"shell-dollar-paren",description:"Dollar-paren command substitution: $(cmd)",pattern:/\$\(/},{id:"shell-dollar-brace",description:"Dollar-brace variable expansion: ${var} \u2014 can be abused for injection",pattern:/\$\{/},{id:"shell-redirect-out",description:"Output redirection: cmd > file or cmd >> file",pattern:/>{1,2}/},{id:"shell-redirect-in",description:"Input redirection: cmd < file",pattern:/</},{id:"shell-newline-injection",description:"Newline injection: \\n or \\r \u2014 can inject new shell commands",pattern:/[\n\r]/},{id:"shell-glob-star",description:"Glob expansion: * or ? \u2014 can expand to unintended files",pattern:/[/\\][*?]/},{id:"shell-absolute-root",description:"Absolute root path injection: string starting with / or \\ (Windows UNC)",pattern:/^(?:\/|\\\\)/},{id:"shell-windows-drive",description:"Windows drive letter path injection: C:\\ or D:/",pattern:/^[a-zA-Z]:[/\\]/},{id:"shell-curl-wget",description:"curl/wget with URL or flags \u2014 can exfiltrate data or download payloads",pattern:/\b(?:curl|wget)\s+(?:https?:\/\/|ftp:\/\/|-)/i}],vo=gc;var yc=[{id:"redos-nested-quantifier-plus",description:"Nested + quantifier inside a group with outer quantifier: (a+)+, (.+b)*, etc.",pattern:/\([^)]*\+[^)]*\)[+*]/},{id:"redos-nested-quantifier-star",description:"Nested * quantifier: (a*)* or (a*)+ \u2014 catastrophic backtracking",pattern:/\([^)]*\*[^)]*\)[*+]/},{id:"redos-nested-groups",description:"Doubly nested quantified groups: ((a+)+) \u2014 guaranteed catastrophic",pattern:/\(\([^)]{0,40}\)[+*]\)[+*]/},{id:"redos-alternation-overlap",description:"Overlapping alternation under quantifier: (a|a)+ \u2014 ambiguous NFA paths",pattern:/\(([^|()]{1,20})\|(?:\1)(?:\|[^|()]{1,20}){0,5}\)[+*?]{1,2}/},{id:"redos-star-plus-concat",description:"(x*x)+ pattern \u2014 triggers super-linear backtracking",pattern:/\([^)]{0,10}\*[^)]{0,10}\)[+*]/},{id:"redos-dot-star-greedy",description:"(.*){n,} or (.+){n,} \u2014 repeated greedy dot quantifiers",pattern:/\(\.[*+]\)\{?\d/},{id:"redos-large-repetition",description:"Very large fixed or range repetition count {1000,} or {1000,n} \u2014 denial of service via backtracking",pattern:/\{\d{4,}(?:,\d*)?\}/},{id:"redos-catastrophic-alternation",description:"Long alternation with many similar branches \u2014 polynomial backtracking risk",pattern:/\([^)]{0,200}(?:\|[^|)]{0,50}){9,}\)/}],bo=yc;var ue=`["'\\s]*:`,vc=[{id:"nosql-where-operator",description:"$where \u2014 executes arbitrary JavaScript server-side in MongoDB",pattern:new RegExp(`\\$where${ue}`,"i")},{id:"nosql-ne-operator",description:'$ne \u2014 "not equal" operator used to bypass equality checks',pattern:new RegExp(`\\$ne${ue}`,"i")},{id:"nosql-gt-operator",description:'$gt \u2014 "greater than" used to bypass password/value checks',pattern:new RegExp(`\\$gte?${ue}`,"i")},{id:"nosql-lt-operator",description:'$lt / $lte \u2014 "less than" bypass variants',pattern:new RegExp(`\\$lte?${ue}`,"i")},{id:"nosql-regex-operator",description:"$regex \u2014 can be used to extract data character by character (blind injection)",pattern:new RegExp(`\\$regex${ue}`,"i")},{id:"nosql-or-operator",description:"$or \u2014 logical OR; used to create always-true conditions",pattern:new RegExp(`\\$or${ue}\\s*\\[`,"i")},{id:"nosql-and-operator",description:"$and \u2014 logical AND operator injection",pattern:new RegExp(`\\$and${ue}\\s*\\[`,"i")},{id:"nosql-nor-operator",description:"$nor \u2014 logical NOR operator injection",pattern:new RegExp(`\\$nor${ue}\\s*\\[`,"i")},{id:"nosql-exists-operator",description:"$exists \u2014 can enumerate fields to determine schema",pattern:new RegExp(`\\$exists${ue}`,"i")},{id:"nosql-in-operator",description:"$in \u2014 matches any value in a list; can enumerate values",pattern:new RegExp(`\\$in${ue}\\s*\\[`,"i")},{id:"nosql-expr-operator",description:"$expr \u2014 allows aggregation expressions in queries (MongoDB 3.6+)",pattern:new RegExp(`\\$expr${ue}`,"i")},{id:"nosql-function-operator",description:"$function \u2014 executes arbitrary JavaScript in MongoDB 4.4+",pattern:new RegExp(`\\$function${ue}`,"i")},{id:"nosql-accumulator-operator",description:"$accumulator \u2014 custom aggregation with arbitrary JS execution",pattern:new RegExp(`\\$accumulator${ue}`,"i")},{id:"nosql-proto-pollution",description:"__proto__ \u2014 prototype pollution via object key injection",pattern:/__proto__/},{id:"nosql-constructor-prototype",description:"constructor.prototype \u2014 alternative prototype pollution vector (dot notation or JSON key)",pattern:/constructor[\s"':.,{\[]*prototype/i},{id:"nosql-proto-bracket",description:'["__proto__"] \u2014 bracket-notation prototype pollution',pattern:/\[["']__proto__["']\]/}],wo=vc;var bc=[{id:"log-crlf-injection",description:"CRLF injection: literal \\r or \\n embeds fake log lines",pattern:/[\r\n]/},{id:"log-url-encoded-crlf",description:"URL-encoded CRLF: %0d, %0a, %0D, %0A \u2014 decoded by some log parsers",pattern:/%0[dDaA]/},{id:"log-unicode-newline",description:"Unicode newline variants: U+2028 (line separator), U+2029 (paragraph separator)",pattern:/[\u2028\u2029]/},{id:"log-log4shell-jndi",description:"Log4Shell: ${jndi:...} triggers remote code execution in Apache Log4j",pattern:/\$\{jndi\s*:/i},{id:"log-log4shell-obfuscated",description:"Obfuscated Log4Shell: ${::-j}... lookup-bypass prefix used to evade WAF detection",pattern:/\$\{::-/},{id:"log-log4j-lookup",description:"Log4j lookup syntax: ${env:...}, ${sys:...}, ${ctx:...} \u2014 data exfiltration",pattern:/\$\{(?:env|sys|ctx|main|map|sd|web|docker|k8s|spring)\s*:/i},{id:"log-ssti-double-brace",description:"SSTI double-brace: {{expression}} \u2014 Jinja2, Twig, Handlebars, etc.",pattern:/\{\{[\s\S]{0,80}\}\}/},{id:"log-ssti-hash-brace",description:"SSTI hash-brace: #{expression} \u2014 Thymeleaf, Velocity, Ruby ERB",pattern:/#\{[\s\S]{0,80}\}/},{id:"log-ssti-dollar-brace",description:"SSTI/EL injection: ${expression with operators or method calls} \u2014 JSP EL, Freemarker, SpEL",pattern:/\$\{[^}]*(?:\.|\(|\*|\+|\bclass\b|\bruntime\b|\bprocess\b|\bexec\b)[^}]{0,80}\}/i},{id:"log-ssti-percent-tag",description:"SSTI ERB/ASP tag: <%= expression %> \u2014 Ruby ERB, ASP",pattern:/<%=[\s\S]{0,80}%>/},{id:"log-null-byte",description:"Null byte: \\x00 or %00 \u2014 can truncate log entries in C-backed loggers",pattern:/\x00|%00/},{id:"log-ansi-escape",description:"ANSI escape sequence: ESC[ \u2014 can manipulate terminal output when logs are tailed",pattern:/\x1b\[/}],So=bc;var ko={HTML:mo,XML:ho,SVG:go,SQL:rr,"SQL-STRICT":yo,SHELL:vo,REDOS:bo,NOSQL:wo,LOG:So},sr=ko,Jt=Object.freeze(Object.fromEntries(Object.keys(ko).map(t=>[t,t])));function wc(t){if(typeof t!="string")throw new TypeError(`is-unsafe: first argument must be a string, got ${typeof t}`)}function Sc(t){if(!(t instanceof RegExp)){if(typeof t=="string"){if(!sr[t])throw new TypeError(`is-unsafe: unknown context "${t}". Valid contexts: ${Object.keys(Jt).join(", ")}`);return}if(Array.isArray(t)){if(t.length===0)throw new TypeError("is-unsafe: context array must not be empty");for(let e of t)if(typeof e!="string"||!sr[e])throw new TypeError(`is-unsafe: unknown context "${e}" in array. Valid contexts: ${Object.keys(Jt).join(", ")}`);return}throw new TypeError(`is-unsafe: second argument must be a context string, array of context strings, or RegExp. Got: ${typeof t}`)}}function xo(t,e){let n=sr[e];for(let r of n)if(r.pattern.test(t))return {context:e,id:r.id,description:r.description,pattern:r.pattern};return null}function Eo(t,e){if(wc(t),Sc(e),e instanceof RegExp)return e.test(t);if(typeof e=="string")return xo(t,e)!==null;for(let n of e)if(xo(t,n)!==null)return true;return false}function kc(t,e){if(!t)return {};let n=e.attributesGroupName?t[e.attributesGroupName]:t;if(!n)return {};let r={};for(let s in n)if(s.startsWith(e.attributeNamePrefix)){let o=s.substring(e.attributeNamePrefix.length);r[o]=n[s];}else r[s]=n[s];return r}function xc(t){if(!t||typeof t!="string")return;let e=t.indexOf(":");if(e!==-1&&e>0){let n=t.substring(0,e);if(n!=="xmlns")return n}}var wn=class{constructor(e,n){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=Ac,this.parseTextData=Ec,this.resolveNameSpace=jc,this.buildAttributesMap=Cc,this.isItStopNode=Lc,this.replaceEntitiesValue=Mc,this.readStopNodeData=Ic,this.saveTextToParentTag=$c,this.addChild=Pc,this.ignoreAttributesFn=Or(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0;let r={...gn};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?r=this.options.htmlEntities:this.options.htmlEntities===true&&(r={...Nr,...Yn}),this.entityDecoder=new qt({namedEntities:{...r,...n},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo},onInputEntity:(o,i)=>Eo(i,[Jt.HTML,Jt.XML])?Gt.BLOCK:Gt.ALLOW})),this.matcher=new Wt,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=false,this.stopNodeExpressionsSet=new zt;let s=this.options.stopNodes;if(s&&s.length>0){for(let o=0;o<s.length;o++){let i=s[o];typeof i=="string"?this.stopNodeExpressionsSet.add(new wt(i)):i instanceof wt&&this.stopNodeExpressionsSet.add(i);}this.stopNodeExpressionsSet.seal();}}};function Ec(t,e,n,r,s,o,i){let a=this.options;if(t!==void 0&&(a.trimValues&&!r&&(t=t.trim()),t.length>0)){i||(t=this.replaceEntitiesValue(t,e,n));let c=a.jPath?n.toString():n,l=a.tagValueProcessor(e,t,c,s,o);return l==null?t:typeof l!=typeof t||l!==t?l:a.trimValues||t.trim()===t?Ur(t,a.parseTagValue,a.numberParseOptions):t}}function jc(t){if(this.options.removeNSPrefix){let e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return "";e.length===2&&(t=n+e[1]);}return t}var Tc=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Cc(t,e,n,r=false){let s=this.options;if(r===true||s.ignoreAttributes!==true&&typeof t=="string"){let o=Jn(t,Tc),i=o.length,a={},c=new Array(i),l=false,u={};for(let d=0;d<i;d++){let h=this.resolveNameSpace(o[d][1]),g=o[d][4];if(h.length&&g!==void 0){let v=g;s.trimValues&&(v=v.trim()),v=this.replaceEntitiesValue(v,n,this.readonlyMatcher),c[d]=v,u[h]=v,l=true;}}l&&typeof e=="object"&&e.updateCurrent&&e.updateCurrent(u);let p=s.jPath?e.toString():this.readonlyMatcher,f=false;for(let d=0;d<i;d++){let h=this.resolveNameSpace(o[d][1]);if(this.ignoreAttributesFn(h,p))continue;let g=s.attributeNamePrefix+h;if(h.length)if(s.transformAttributeName&&(g=s.transformAttributeName(g)),g=jo(g,s),o[d][4]!==void 0){let v=c[d],S=s.attributeValueProcessor(h,v,p);S==null?a[g]=v:typeof S!=typeof v||S!==v?a[g]=S:a[g]=Ur(v,s.parseAttributeValue,s.numberParseOptions),f=true;}else s.allowBooleanAttributes&&(a[g]=true,f=true);}if(!f)return;if(s.attributesGroupName&&!s.preserveOrder){let d={};return d[s.attributesGroupName]=a,d}return a}}var Ac=function(t){t=t.replace(/\r\n?/g,`
4
+ `);let e=new ie("!xml"),n=e,r="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let s=this.options,o=new bn(s.processEntities),i=t.length;for(let a=0;a<i;a++)if(t[a]==="<"){let l=t.charCodeAt(a+1);if(l===47){let u=Kt(t,">",a,"Closing Tag is not closed."),p=t.substring(a+2,u).trim();if(s.removeNSPrefix){let d=p.indexOf(":");d!==-1&&(p=p.substr(d+1));}p=Vr(s.transformTagName,p,"",s).tagName,n&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher));let f=this.matcher.getCurrentTag();if(p&&s.unpairedTagsSet.has(p))throw new Error(`Unpaired tag can not be used as closing tag: </${p}>`);f&&s.unpairedTagsSet.has(f)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=false,n=this.tagsNodeStack.pop(),r="",a=u;}else if(l===63){let u=Dr(t,a,false,"?>");if(!u)throw new Error("Pi Tag is not closed.");r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let p=this.buildAttributesMap(u.tagExp,this.matcher,u.tagName,true);if(p){let f=p[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(f)||1),o.setXmlVersion(Number(f)||1);}if(!(s.ignoreDeclaration&&u.tagName==="?xml"||s.ignorePiTags)){let f=new ie(u.tagName);f.add(s.textNodeName,""),u.tagName!==u.tagExp&&u.attrExpPresent&&s.ignoreAttributes!==true&&(f[":@"]=p),this.addChild(n,f,this.readonlyMatcher,a);}a=u.closeIndex+1;}else if(l===33&&t.charCodeAt(a+2)===45&&t.charCodeAt(a+3)===45){let u=Kt(t,"-->",a+4,"Comment is not closed.");if(s.commentPropName){let p=t.substring(a+4,u-2);r=this.saveTextToParentTag(r,n,this.readonlyMatcher),n.add(s.commentPropName,[{[s.textNodeName]:p}]);}a=u;}else if(l===33&&t.charCodeAt(a+2)===68){let u=o.readDocType(t,a);this.entityDecoder.addInputEntities(u.entities),a=u.i;}else if(l===33&&t.charCodeAt(a+2)===91){let u=Kt(t,"]]>",a,"CDATA is not closed.")-2,p=t.substring(a+9,u);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let f=this.parseTextData(p,n.tagname,this.readonlyMatcher,true,false,true,true);f==null&&(f=""),s.cdataPropName?n.add(s.cdataPropName,[{[s.textNodeName]:p}]):n.add(s.textNodeName,f),a=u+2;}else {let u=Dr(t,a,s.removeNSPrefix);if(!u){let y=t.substring(Math.max(0,a-50),Math.min(i,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${y}"`)}let p=u.tagName,f=u.rawTagName,d=u.tagExp,h=u.attrExpPresent,g=u.closeIndex;if({tagName:p,tagExp:d}=Vr(s.transformTagName,p,d,s),s.strictReservedNames&&(p===s.commentPropName||p===s.cdataPropName||p===s.textNodeName||p===s.attributesGroupName))throw new Error(`Invalid tag name: ${p}`);n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher,false));let v=n;v&&s.unpairedTagsSet.has(v.tagname)&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let S=false;d.length>0&&d.lastIndexOf("/")===d.length-1&&(S=true,p[p.length-1]==="/"?(p=p.substr(0,p.length-1),d=p):d=d.substr(0,d.length-1),h=p!==d);let j=null,C;C=xc(f),p!==e.tagname&&this.matcher.push(p,{},C),p!==d&&h&&(j=this.buildAttributesMap(d,this.matcher,p),j&&(kc(j,s))),p!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let E=a;if(this.isCurrentNodeStopNode){let y="";if(S)a=u.closeIndex;else if(s.unpairedTagsSet.has(p))a=u.closeIndex;else {let x=this.readStopNodeData(t,f,g+1);if(!x)throw new Error(`Unexpected end of ${f}`);a=x.i,y=x.tagContent;}let b=new ie(p);j&&(b[":@"]=j),b.add(s.textNodeName,y),this.matcher.pop(),this.isCurrentNodeStopNode=false,this.addChild(n,b,this.readonlyMatcher,E);}else {if(S){({tagName:p,tagExp:d}=Vr(s.transformTagName,p,d,s));let y=new ie(p);j&&(y[":@"]=j),this.addChild(n,y,this.readonlyMatcher,E),this.matcher.pop(),this.isCurrentNodeStopNode=false;}else if(s.unpairedTagsSet.has(p)){let y=new ie(p);j&&(y[":@"]=j),this.addChild(n,y,this.readonlyMatcher,E),this.matcher.pop(),this.isCurrentNodeStopNode=false,a=u.closeIndex;continue}else {let y=new ie(p);if(this.tagsNodeStack.length>s.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),j&&(y[":@"]=j),this.addChild(n,y,this.readonlyMatcher,E),n=y;}r="",a=g;}}}else r+=t[a];return e.child};function Pc(t,e,n,r){this.options.captureMetaData||(r=void 0);let s=this.options.jPath?n.toString():n,o=this.options.updateTag(e.tagname,s,e[":@"]);o===false||(typeof o=="string"&&(e.tagname=o),t.addChild(e,r));}function Mc(t,e,n){let r=this.options.processEntities;if(!r||!r.enabled)return t;if(r.allowedTags){let s=this.options.jPath?n.toString():n;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(e):r.allowedTags(e,s)))return t}if(r.tagFilter){let s=this.options.jPath?n.toString():n;if(!r.tagFilter(e,s))return t}return this.entityDecoder.decode(t)}function $c(t,e,n,r){return t&&(r===void 0&&(r=e.child.length===0),t=this.parseTextData(t,e.tagname,n,false,e[":@"]?Object.keys(e[":@"]).length!==0:false,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function Lc(){return this.stopNodeExpressionsSet.size===0?false:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function Nc(t,e,n=">"){let r=0,s=t.length,o=n.charCodeAt(0),i=n.length>1?n.charCodeAt(1):-1,a="",c=e;for(let l=e;l<s;l++){let u=t.charCodeAt(l);if(r)u===r&&(r=0);else if(u===34||u===39)r=u;else if(u===o)if(i!==-1){if(t.charCodeAt(l+1)===i)return a+=t.substring(c,l),{data:a,index:l}}else return a+=t.substring(c,l),{data:a,index:l};else u===9&&!r&&(a+=t.substring(c,l)+" ",c=l+1);}}function Kt(t,e,n,r){let s=t.indexOf(e,n);if(s===-1)throw new Error(r);return s+e.length-1}function Rc(t,e,n,r){let s=t.indexOf(e,n);if(s===-1)throw new Error(r);return s}function Dr(t,e,n,r=">"){let s=Nc(t,e+1,r);if(!s)return;let o=s.data,i=s.index,a=o.search(/\s/),c=o,l=true;a!==-1&&(c=o.substring(0,a),o=o.substring(a+1).trimStart());let u=c;if(n){let p=c.indexOf(":");p!==-1&&(c=c.substr(p+1),l=c!==s.data.substr(p+1));}return {tagName:c,tagExp:o,closeIndex:i,attrExpPresent:l,rawTagName:u}}function Ic(t,e,n){let r=n,s=1,o=t.length;for(;n<o;n++)if(t[n]==="<"){let i=t.charCodeAt(n+1);if(i===47){let a=Rc(t,">",n,`${e} is not closed`);if(t.substring(n+2,a).trim()===e&&(s--,s===0))return {tagContent:t.substring(r,n),i:a};n=a;}else if(i===63)n=Kt(t,"?>",n+1,"StopNode is not closed.");else if(i===33&&t.charCodeAt(n+2)===45&&t.charCodeAt(n+3)===45)n=Kt(t,"-->",n+3,"StopNode is not closed.");else if(i===33&&t.charCodeAt(n+2)===91)n=Kt(t,"]]>",n,"StopNode is not closed.")-2;else {let a=Dr(t,n,false);a&&((a&&a.tagName)===e&&a.tagExp[a.tagExp.length-1]!=="/"&&s++,n=a.closeIndex);}}}function Ur(t,e,n){if(e&&typeof t=="string"){let r=t.trim();return r==="true"?true:r==="false"?false:Fr(t,n)}else return _s(t)?t:""}function Vr(t,e,n,r){if(t){let s=t(e);n===e&&(n=s),e=s;}return e=jo(e,r),{tagName:e,tagExp:n}}function jo(t,e){if(Kn.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return mn.includes(t)?e.onDangerousProperty(t):t}var Gr=ie.getMetaDataSymbol();function _c(t,e){if(!t||typeof t!="object")return {};if(!e)return t;let n={};for(let r in t)if(r.startsWith(e)){let s=r.substring(e.length);n[s]=t[r];}else n[r]=t[r];return n}function qr(t,e,n,r){return To(t,e,n,r)}function To(t,e,n,r){let s,o={};for(let i=0;i<t.length;i++){let a=t[i],c=Fc(a);if(c!==void 0&&c!==e.textNodeName){let l=_c(a[":@"]||{},e.attributeNamePrefix);n.push(c,l);}if(c===e.textNodeName)s===void 0?s=a[c]:s+=""+a[c];else {if(c===void 0)continue;if(a[c]){let l=To(a[c],e,n,r),u=Bc(l,e);if(Object.keys(l).length===0&&e.alwaysCreateTextNode&&(l[e.textNodeName]=""),a[":@"]?Oc(l,a[":@"],r,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),a[Gr]!==void 0&&typeof l=="object"&&l!==null&&(l[Gr]=a[Gr]),o[c]!==void 0&&Object.prototype.hasOwnProperty.call(o,c))Array.isArray(o[c])||(o[c]=[o[c]]),o[c].push(l);else {let p=e.jPath?r.toString():r;e.isArray(c,p,u)?o[c]=[l]:o[c]=l;}c!==void 0&&c!==e.textNodeName&&n.pop();}}}return typeof s=="string"?s.length>0&&(o[e.textNodeName]=s):s!==void 0&&(o[e.textNodeName]=s),o}function Fc(t){let e=Object.keys(t);for(let n=0;n<e.length;n++){let r=e[n];if(r!==":@")return r}}function Oc(t,e,n,r){if(e){let s=Object.keys(e),o=s.length;for(let i=0;i<o;i++){let a=s[i],c=a.startsWith(r.attributeNamePrefix)?a.substring(r.attributeNamePrefix.length):a,l=r.jPath?n.toString()+"."+c:n;r.isArray(a,l,true,true)?t[a]=[e[a]]:t[a]=e[a];}}}function Bc(t,e){let{textNodeName:n}=e,r=Object.keys(t).length;return !!(r===0||r===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}var Te=class{constructor(e){this.externalEntities={},this.options=ro(e);}parse(e,n){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===true&&(n={});let o=Ds(e,n);if(o!==true)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let r=new wn(this.options,this.externalEntities),s=r.parseXml(e);return this.options.preserveOrder||s===void 0?s:qr(s,this.options,r.matcher,r.readonlyMatcher)}addEntity(e,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=n;}static getMetaDataSymbol(){return ie.getMetaDataSymbol()}};var At=b(a(),1);var Vc=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,Sn=class t extends Date{#t=false;#n=false;#e=null;constructor(e){let n=true,r=true,s="Z";if(typeof e=="string"){let o=e.match(Vc);o?(o[1]||(n=false,e=`0000-01-01T${e}`),r=!!o[2],r&&e[10]===" "&&(e=e.replace(" ","T")),o[2]&&+o[2]>23?e="":(s=o[3]||null,e=e.toUpperCase(),!s&&r&&(e+="Z"))):e="";}super(e),isNaN(this.getTime())||(this.#t=n,this.#n=r,this.#e=s);}isDateTime(){return this.#t&&this.#n}isLocal(){return !this.#t||!this.#n||!this.#e}isDate(){return this.#t&&!this.#n}isTime(){return this.#n&&!this.#t}isValid(){return this.#t||this.#n}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,n="Z"){let r=new t(e);return r.#e=n,r}static wrapAsLocalDateTime(e){let n=new t(e);return n.#e=null,n}static wrapAsLocalDate(e){let n=new t(e);return n.#n=false,n.#e=null,n}static wrapAsLocalTime(e){let n=new t(e);return n.#t=false,n.#e=null,n}};function Dc(t,e){let n=t.slice(0,e).split(/\r\n|\n|\r/g);return [n.length,n.pop().length+1]}function Uc(t,e,n){let r=t.split(/\r\n|\n|\r/g),s="",o=(Math.log10(e+1)|0)+1;for(let i=e-1;i<=e+1;i++){let a=r[i-1];a&&(s+=i.toString().padEnd(o," "),s+=": ",s+=a,s+=`
5
5
  `,i===e&&(s+=" ".repeat(o+n+2),s+=`^
6
- `));}return s}var R=class extends Error{line;column;codeblock;constructor(e,n){let[r,s]=Ic(n.toml,n.ptr),o=_c(n.toml,r,s);super(`Invalid TOML document: ${e}
6
+ `));}return s}var R=class extends Error{line;column;codeblock;constructor(e,n){let[r,s]=Dc(n.toml,n.ptr),o=Uc(n.toml,r,s);super(`Invalid TOML document: ${e}
7
7
 
8
- ${o}`,n),this.line=r,this.column=s,this.codeblock=o;}};var Fc=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,Oc=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Bc=/^[+-]?0[0-9_]/;function sr(t,e){let n=t[e++],r=n,s=n==="'",o=n===t[e]&&n===t[e+1];o&&(t[e+=2]===`
8
+ ${o}`,n),this.line=r,this.column=s,this.codeblock=o;}};var Gc=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,qc=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Hc=/^[+-]?0[0-9_]/;function or(t,e){let n=t[e++],r=n,s=n==="'",o=n===t[e]&&n===t[e+1];o&&(t[e+=2]===`
9
9
  `?e++:t[e]==="\r"&&t[e+1]===`
10
10
  `&&(e+=2));let i="",a=e,c=0;for(let l=e;l<t.length;l++)if(n=t[l],o&&(n===`
11
11
  `||n==="\r"&&t[l+1]===`
12
12
  `))c=c&&3;else {if(n<" "&&n!==" "||n==="\x7F")throw new R("control characters are not allowed in strings",{toml:t,ptr:l});if((!c||c===3)&&n===r&&(!o||t[l+1]===r&&t[l+2]===r))return o&&(t[l+3]===r&&l++,t[l+3]===r&&l++),[c?i:i+t.slice(a,l),l+(o?3:1)];if(!c)!s&&n==="\\"&&(i+=t.slice(a,a=l),c=1);else if(c===1)if(n==="x"||n==="u"||n==="U"){let u=0,p=n==="x"?2:n==="u"?4:8;for(let f=0;f<p;f++,l++){let d=t.charCodeAt(l+1),h=d>=48&&d<=57?d-48:d>=65&&d<=70?d-65+10:d>=97&&d<=102?d-97+10:-1;if(h<0)throw new R("invalid non-hex character in unicode escape",{toml:t,ptr:l+1});u=u<<4|h;}if(u<0||u>1114111||u>=55296&&u<=57343)throw new R("invalid unicode escape",{toml:t,ptr:l});i+=String.fromCodePoint(u),a=l+1,c=0;}else if(n===" "||n===" ")c=2;else {if(n==="b")i+="\b";else if(n==="t")i+=" ";else if(n==="n")i+=`
13
- `;else if(n==="f")i+="\f";else if(n==="r")i+="\r";else if(n==="e")i+="\x1B";else if(n==='"')i+='"';else if(n==="\\")i+="\\";else throw new R("unrecognized escape sequence",{toml:t,ptr:l});a=l+1,c=0;}else if(n!==" "&&n!==" "){if(c===2)throw new R("invalid escape: only line-ending whitespace may be escaped",{toml:t,ptr:a});c=!s&&n==="\\"?1:0,a=l;}}throw new R("unfinished string",{toml:t,ptr:e})}function jo(t,e,n,r){if(t==="true")return true;if(t==="false")return false;if(t==="-inf")return -1/0;if(t==="inf"||t==="+inf")return 1/0;if(t==="nan"||t==="+nan"||t==="-nan")return NaN;if(t==="-0")return r?0n:0;let s=Fc.test(t);if(s||Oc.test(t)){if(Bc.test(t))throw new R("leading zeroes are not allowed",{toml:e,ptr:n});t=t.replace(/_/g,"");let i=+t;if(isNaN(i))throw new R("invalid number",{toml:e,ptr:n});if(s){if((s=!Number.isSafeInteger(i))&&!r)throw new R("integer value cannot be represented losslessly",{toml:e,ptr:n});(s||r===true)&&(i=BigInt(t));}return i}let o=new bn(t);if(!o.isValid())throw new R("invalid value",{toml:e,ptr:n});return o}function or(t,e=0,n=t.length){let r=t.indexOf(`
13
+ `;else if(n==="f")i+="\f";else if(n==="r")i+="\r";else if(n==="e")i+="\x1B";else if(n==='"')i+='"';else if(n==="\\")i+="\\";else throw new R("unrecognized escape sequence",{toml:t,ptr:l});a=l+1,c=0;}else if(n!==" "&&n!==" "){if(c===2)throw new R("invalid escape: only line-ending whitespace may be escaped",{toml:t,ptr:a});c=!s&&n==="\\"?1:0,a=l;}}throw new R("unfinished string",{toml:t,ptr:e})}function Co(t,e,n,r){if(t==="true")return true;if(t==="false")return false;if(t==="-inf")return -1/0;if(t==="inf"||t==="+inf")return 1/0;if(t==="nan"||t==="+nan"||t==="-nan")return NaN;if(t==="-0")return r?0n:0;let s=Gc.test(t);if(s||qc.test(t)){if(Hc.test(t))throw new R("leading zeroes are not allowed",{toml:e,ptr:n});t=t.replace(/_/g,"");let i=+t;if(isNaN(i))throw new R("invalid number",{toml:e,ptr:n});if(s){if((s=!Number.isSafeInteger(i))&&!r)throw new R("integer value cannot be represented losslessly",{toml:e,ptr:n});(s||r===true)&&(i=BigInt(t));}return i}let o=new Sn(t);if(!o.isValid())throw new R("invalid value",{toml:e,ptr:n});return o}function ir(t,e=0,n=t.length){let r=t.indexOf(`
14
14
  `,e);return t[r-1]==="\r"&&r--,r<=n?r:-1}function Yt(t,e){for(let n=e;n<t.length;n++){let r=t[n];if(r===`
15
15
  `)return n;if(r==="\r"&&t[n+1]===`
16
- `)return n+1;if(r<" "&&r!==" "||r==="\x7F")throw new R("control characters are not allowed in comments",{toml:t,ptr:e})}return t.length}function Te(t,e,n,r){let s;for(;;){for(;(s=t[e])===" "||s===" "||!n&&(s===`
16
+ `)return n+1;if(r<" "&&r!==" "||r==="\x7F")throw new R("control characters are not allowed in comments",{toml:t,ptr:e})}return t.length}function Ce(t,e,n,r){let s;for(;;){for(;(s=t[e])===" "||s===" "||!n&&(s===`
17
17
  `||s==="\r"&&t[e+1]===`
18
- `);)e++;if(r||s!=="#")break;e=Yt(t,e);}return e}function To(t,e,n,r,s=false){if(!r)return e=or(t,e),e<0?t.length:e;for(let o=e;o<t.length;o++){let i=t[o];if(i==="#")o=or(t,o);else {if(i===n)return o+1;if(i===r||s&&(i===`
18
+ `);)e++;if(r||s!=="#")break;e=Yt(t,e);}return e}function Ao(t,e,n,r,s=false){if(!r)return e=ir(t,e),e<0?t.length:e;for(let o=e;o<t.length;o++){let i=t[o];if(i==="#")o=ir(t,o);else {if(i===n)return o+1;if(i===r||s&&(i===`
19
19
  `||i==="\r"&&t[o+1]===`
20
- `))return o}}throw new R("cannot find end of structure",{toml:t,ptr:e})}function Vc(t,e,n){let r=t.slice(e,n),s=r.indexOf("#");return s>-1&&(Yt(t,s),r=r.slice(0,s)),[r.trimEnd(),s]}function wn(t,e,n,r,s){if(r===0)throw new R("document contains excessively nested structures. aborting.",{toml:t,ptr:e});let o=t[e];if(o==="["||o==="{"){let[c,l]=o==="["?Ao(t,e,r,s):Co(t,e,r,s);if(n){if(l=Te(t,l),t[l]===",")l++;else if(t[l]!==n)throw new R("expected comma or end of structure",{toml:t,ptr:l})}return [c,l]}if(o==='"'||o==="'"){let[c,l]=sr(t,e);if(n){if(l=Te(t,l),t[l]&&t[l]!==","&&t[l]!==n&&t[l]!==`
21
- `&&t[l]!=="\r")throw new R("unexpected character encountered",{toml:t,ptr:l});t[l]===","&&l++;}return [c,l]}let i=To(t,e,",",n),a=Vc(t,e,i-(t[i-1]===","?1:0));if(!a[0])throw new R("incomplete key-value declaration: no value specified",{toml:t,ptr:e});return n&&a[1]>-1&&(i=Te(t,e+a[1]),t[i]===","&&i++),[jo(a[0],t,e,s),i]}var Dc=/^[a-zA-Z0-9-_]+[ \t]*$/;function ir(t,e,n="="){let r=e-1,s=[],o=t.indexOf(n,e);if(o<0)throw new R("incomplete key-value: cannot find end of key",{toml:t,ptr:e});do{let i=t[e=++r];if(i!==" "&&i!==" ")if(i==='"'||i==="'"){if(i===t[e+1]&&i===t[e+2])throw new R("multiline strings are not allowed in keys",{toml:t,ptr:e});let[a,c]=sr(t,e);r=t.indexOf(".",c);let l=t.slice(c,r<0||r>o?o:r),u=or(l);if(u>-1)throw new R("newlines are not allowed in keys",{toml:t,ptr:e+r+u});if(l.trimStart())throw new R("found extra tokens after the string part",{toml:t,ptr:c});if(o<c&&(o=t.indexOf(n,c),o<0))throw new R("incomplete key-value: cannot find end of key",{toml:t,ptr:e});s.push(a);}else {r=t.indexOf(".",e);let a=t.slice(e,r<0||r>o?o:r);if(!Dc.test(a))throw new R("only letter, numbers, dashes and underscores are allowed in keys",{toml:t,ptr:e});s.push(a.trimEnd());}}while(r+1&&r<o);return [s,Te(t,o+1,true,true)]}function Co(t,e,n,r){let s={},o=new Set,i;for(e++;(i=t[e++])!=="}"&&i;){if(i===",")throw new R("expected value, found comma",{toml:t,ptr:e-1});if(i==="#")e=Yt(t,e);else if(i!==" "&&i!==" "&&i!==`
22
- `&&i!=="\r"){let a,c=s,l=false,[u,p]=ir(t,e-1);for(let h=0;h<u.length;h++){if(h&&(c=l?c[a]:c[a]={}),a=u[h],(l=Object.hasOwn(c,a))&&(typeof c[a]!="object"||o.has(c[a])))throw new R("trying to redefine an already defined value",{toml:t,ptr:e});!l&&a==="__proto__"&&Object.defineProperty(c,a,{enumerable:true,configurable:true,writable:true});}if(l)throw new R("trying to redefine an already defined value",{toml:t,ptr:e});let[f,d]=wn(t,p,"}",n-1,r);o.add(f),c[a]=f,e=d;}}if(!i)throw new R("unfinished table encountered",{toml:t,ptr:e});return [s,e]}function Ao(t,e,n,r){let s=[],o;for(e++;(o=t[e++])!=="]"&&o;){if(o===",")throw new R("expected value, found comma",{toml:t,ptr:e-1});if(o==="#")e=Yt(t,e);else if(o!==" "&&o!==" "&&o!==`
23
- `&&o!=="\r"){let i=wn(t,e-1,"]",n-1,r);s.push(i[0]),e=i[1];}}if(!o)throw new R("unfinished array encountered",{toml:t,ptr:e});return [s,e]}function Po(t,e,n,r){let s=e,o=n,i,a=false,c;for(let l=0;l<t.length;l++){if(l){if(s=a?s[i]:s[i]={},o=(c=o[i]).c,r===0&&(c.t===1||c.t===2))return null;if(c.t===2){let u=s.length-1;s=s[u],o=o[u].c;}}if(i=t[l],(a=Object.hasOwn(s,i))&&o[i]?.t===0&&o[i]?.d)return null;a||(i==="__proto__"&&(Object.defineProperty(s,i,{enumerable:true,configurable:true,writable:true}),Object.defineProperty(o,i,{enumerable:true,configurable:true,writable:true})),o[i]={t:l<t.length-1&&r===2?3:r,d:false,i:0,c:{}});}if(c=o[i],c.t!==r&&!(r===1&&c.t===3)||(r===2&&(c.d||(c.d=true,s[i]=[]),s[i].push(s={}),c.c[c.i++]=c={t:1,d:false,i:0,c:{}}),c.d))return null;if(c.d=true,r===1)s=a?s[i]:s[i]={};else if(r===0&&a)return null;return [i,s,c.c]}function qr(t,{maxDepth:e=1e3,integersAsBigInt:n}={}){let r={},s={},o=r,i=s;for(let a=Te(t,0);a<t.length;){if(t[a]==="["){let c=t[++a]==="[",l=ir(t,a+=+c,"]");if(c){if(t[l[1]-1]!=="]")throw new R("expected end of table declaration",{toml:t,ptr:l[1]-1});l[1]++;}let u=Po(l[0],r,s,c?2:1);if(!u)throw new R("trying to redefine an already defined table or value",{toml:t,ptr:a});i=u[2],o=u[1],a=l[1];}else {let c=ir(t,a),l=Po(c[0],o,i,0);if(!l)throw new R("trying to redefine an already defined table or value",{toml:t,ptr:a});let u=wn(t,c[1],void 0,e,n);l[1][l[0]]=u[0],a=u[1];}if(a=Te(t,a,true),t[a]&&t[a]!==`
24
- `&&t[a]!=="\r")throw new R("each key-value declaration must be followed by an end-of-line",{toml:t,ptr:a});a=Te(t,a);}return r}var Pt=b(a(),1);var Mt=b(a(),1),Ie=b(a(),1),_e=b(a(),1),Ae=b(a(),1),ut=b(a(),1),Fe=b(a(),1),Oe=b(a(),1),vr=b(a(),1),Se=b(a(),1),br=b(a(),1),$t=b(a(),1),ke=b(a(),1),rn=b(a(),1),re=b(a(),1),me=b(a(),1),Be=b(a(),1),K=b(a(),1),$e=b(a(),1),pt=b(a(),1);var Ve=b(a(),1),$n=b(a(),1),Ln=b(a(),1),Nn=b(a(),1),ce=b(a(),1),ye=b(a(),1),ve=b(a(),1),be=b(a(),1),we=b(a(),1),Ee=b(a(),1),sa=b(a(),1);var Uc=["vibgrate.config.ts","vibgrate.config.js","vibgrate.config.json"],Gc="VIBGRATE_TRUST_CONFIG";function qc(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function En(t,e){if(U.isParenthesizedExpression(t))return En(t.expression,e);if(U.isStringLiteralLike(t))return t.text;if(U.isNumericLiteral(t))return Number(t.text);if(t.kind===U.SyntaxKind.TrueKeyword)return true;if(t.kind===U.SyntaxKind.FalseKeyword)return false;if(t.kind===U.SyntaxKind.NullKeyword)return null;if(U.isArrayLiteralExpression(t))return t.elements.map(n=>{if(U.isSpreadElement(n))throw new Error("Spread not supported in static config arrays");return En(n,e)});if(U.isObjectLiteralExpression(t)){let n={};for(let r of t.properties){if(!U.isPropertyAssignment(r)||r.initializer===void 0)throw new Error("Only plain object properties are supported in static config");if(U.isComputedPropertyName(r.name))throw new Error("Computed property names are not supported in static config");let s=U.isIdentifier(r.name)||U.isStringLiteral(r.name)||U.isNumericLiteral(r.name)?r.name.text:null;if(s===null)throw new Error("Unsupported object key in static config");n[s]=En(r.initializer,e);}return n}if(U.isIdentifier(t)){let n=e.get(t.text);if(!n)throw new Error(`Unknown identifier in static config: ${t.text}`);return En(n,e)}throw new Error("Non-static expression in config")}function Hc(t,e){let n=e.endsWith(".ts")?U.ScriptKind.TS:U.ScriptKind.JS,r=U.createSourceFile(e,t,U.ScriptTarget.ESNext,true,n),s=new Map;for(let o of r.statements)if(U.isVariableStatement(o)&&o.declarationList.flags&U.NodeFlags.Const)for(let i of o.declarationList.declarations)U.isIdentifier(i.name)&&i.initializer&&s.set(i.name.text,i.initializer);for(let o of r.statements){if(!U.isExportAssignment(o))continue;let i=En(o.expression,s);return qc(i)?{...fr,...i}:null}return null}var zc=5242880,Wc=180,fr={exclude:[],maxFileSizeToScan:zc,projectScanTimeout:Wc,thresholds:{failOnError:{eolDays:180,frameworkMajorLag:3,dependencyTwoPlusPercent:50},warn:{frameworkMajorLag:2,dependencyTwoPlusPercent:30}}};async function Jc(t){let e=fr;for(let r of Uc){let s=B.join(t,r);if(await p(s)){if(r.endsWith(".json")){let a=await o(s);e={...fr,...JSON.parse(a)};break}let o$1=await o(s),i=null;try{i=Hc(o$1,s);}catch{i=null;}if(i){e=i;break}if(process.env[Gc]==="1")try{let a=await import(s);e={...fr,...a.default??a};break}catch{}}}let n=B.join(t,".vibgrate","auto-excludes.json");if(await p(n))try{let r=await o(n),s=JSON.parse(r);if(Array.isArray(s)&&s.length>0){let o=e.exclude??[];e={...e,exclude:[...new Set([...o,...s])]};}}catch{}return e}async function yy(t){let e=B.join(t,"vibgrate.config.ts");return await xe.writeFile(e,`import type { VibgrateConfig } from '@vibgrate/cli';
20
+ `))return o}}throw new R("cannot find end of structure",{toml:t,ptr:e})}function zc(t,e,n){let r=t.slice(e,n),s=r.indexOf("#");return s>-1&&(Yt(t,s),r=r.slice(0,s)),[r.trimEnd(),s]}function kn(t,e,n,r,s){if(r===0)throw new R("document contains excessively nested structures. aborting.",{toml:t,ptr:e});let o=t[e];if(o==="["||o==="{"){let[c,l]=o==="["?Mo(t,e,r,s):Po(t,e,r,s);if(n){if(l=Ce(t,l),t[l]===",")l++;else if(t[l]!==n)throw new R("expected comma or end of structure",{toml:t,ptr:l})}return [c,l]}if(o==='"'||o==="'"){let[c,l]=or(t,e);if(n){if(l=Ce(t,l),t[l]&&t[l]!==","&&t[l]!==n&&t[l]!==`
21
+ `&&t[l]!=="\r")throw new R("unexpected character encountered",{toml:t,ptr:l});t[l]===","&&l++;}return [c,l]}let i=Ao(t,e,",",n),a=zc(t,e,i-(t[i-1]===","?1:0));if(!a[0])throw new R("incomplete key-value declaration: no value specified",{toml:t,ptr:e});return n&&a[1]>-1&&(i=Ce(t,e+a[1]),t[i]===","&&i++),[Co(a[0],t,e,s),i]}var Wc=/^[a-zA-Z0-9-_]+[ \t]*$/;function ar(t,e,n="="){let r=e-1,s=[],o=t.indexOf(n,e);if(o<0)throw new R("incomplete key-value: cannot find end of key",{toml:t,ptr:e});do{let i=t[e=++r];if(i!==" "&&i!==" ")if(i==='"'||i==="'"){if(i===t[e+1]&&i===t[e+2])throw new R("multiline strings are not allowed in keys",{toml:t,ptr:e});let[a,c]=or(t,e);r=t.indexOf(".",c);let l=t.slice(c,r<0||r>o?o:r),u=ir(l);if(u>-1)throw new R("newlines are not allowed in keys",{toml:t,ptr:e+r+u});if(l.trimStart())throw new R("found extra tokens after the string part",{toml:t,ptr:c});if(o<c&&(o=t.indexOf(n,c),o<0))throw new R("incomplete key-value: cannot find end of key",{toml:t,ptr:e});s.push(a);}else {r=t.indexOf(".",e);let a=t.slice(e,r<0||r>o?o:r);if(!Wc.test(a))throw new R("only letter, numbers, dashes and underscores are allowed in keys",{toml:t,ptr:e});s.push(a.trimEnd());}}while(r+1&&r<o);return [s,Ce(t,o+1,true,true)]}function Po(t,e,n,r){let s={},o=new Set,i;for(e++;(i=t[e++])!=="}"&&i;){if(i===",")throw new R("expected value, found comma",{toml:t,ptr:e-1});if(i==="#")e=Yt(t,e);else if(i!==" "&&i!==" "&&i!==`
22
+ `&&i!=="\r"){let a,c=s,l=false,[u,p]=ar(t,e-1);for(let h=0;h<u.length;h++){if(h&&(c=l?c[a]:c[a]={}),a=u[h],(l=Object.hasOwn(c,a))&&(typeof c[a]!="object"||o.has(c[a])))throw new R("trying to redefine an already defined value",{toml:t,ptr:e});!l&&a==="__proto__"&&Object.defineProperty(c,a,{enumerable:true,configurable:true,writable:true});}if(l)throw new R("trying to redefine an already defined value",{toml:t,ptr:e});let[f,d]=kn(t,p,"}",n-1,r);o.add(f),c[a]=f,e=d;}}if(!i)throw new R("unfinished table encountered",{toml:t,ptr:e});return [s,e]}function Mo(t,e,n,r){let s=[],o;for(e++;(o=t[e++])!=="]"&&o;){if(o===",")throw new R("expected value, found comma",{toml:t,ptr:e-1});if(o==="#")e=Yt(t,e);else if(o!==" "&&o!==" "&&o!==`
23
+ `&&o!=="\r"){let i=kn(t,e-1,"]",n-1,r);s.push(i[0]),e=i[1];}}if(!o)throw new R("unfinished array encountered",{toml:t,ptr:e});return [s,e]}function $o(t,e,n,r){let s=e,o=n,i,a=false,c;for(let l=0;l<t.length;l++){if(l){if(s=a?s[i]:s[i]={},o=(c=o[i]).c,r===0&&(c.t===1||c.t===2))return null;if(c.t===2){let u=s.length-1;s=s[u],o=o[u].c;}}if(i=t[l],(a=Object.hasOwn(s,i))&&o[i]?.t===0&&o[i]?.d)return null;a||(i==="__proto__"&&(Object.defineProperty(s,i,{enumerable:true,configurable:true,writable:true}),Object.defineProperty(o,i,{enumerable:true,configurable:true,writable:true})),o[i]={t:l<t.length-1&&r===2?3:r,d:false,i:0,c:{}});}if(c=o[i],c.t!==r&&!(r===1&&c.t===3)||(r===2&&(c.d||(c.d=true,s[i]=[]),s[i].push(s={}),c.c[c.i++]=c={t:1,d:false,i:0,c:{}}),c.d))return null;if(c.d=true,r===1)s=a?s[i]:s[i]={};else if(r===0&&a)return null;return [i,s,c.c]}function Hr(t,{maxDepth:e=1e3,integersAsBigInt:n}={}){let r={},s={},o=r,i=s;for(let a=Ce(t,0);a<t.length;){if(t[a]==="["){let c=t[++a]==="[",l=ar(t,a+=+c,"]");if(c){if(t[l[1]-1]!=="]")throw new R("expected end of table declaration",{toml:t,ptr:l[1]-1});l[1]++;}let u=$o(l[0],r,s,c?2:1);if(!u)throw new R("trying to redefine an already defined table or value",{toml:t,ptr:a});i=u[2],o=u[1],a=l[1];}else {let c=ar(t,a),l=$o(c[0],o,i,0);if(!l)throw new R("trying to redefine an already defined table or value",{toml:t,ptr:a});let u=kn(t,c[1],void 0,e,n);l[1][l[0]]=u[0],a=u[1];}if(a=Ce(t,a,true),t[a]&&t[a]!==`
24
+ `&&t[a]!=="\r")throw new R("each key-value declaration must be followed by an end-of-line",{toml:t,ptr:a});a=Ce(t,a);}return r}var Pt=b(a(),1);var Mt=b(a(),1),Ie=b(a(),1),_e=b(a(),1),Pe=b(a(),1),ut=b(a(),1),Fe=b(a(),1),Oe=b(a(),1),wr=b(a(),1),ke=b(a(),1),Sr=b(a(),1),$t=b(a(),1),xe=b(a(),1),sn=b(a(),1),re=b(a(),1),he=b(a(),1),Be=b(a(),1),K=b(a(),1),Le=b(a(),1),pt=b(a(),1);var Ve=b(a(),1),Ln=b(a(),1),Nn=b(a(),1),Rn=b(a(),1),ce=b(a(),1),ve=b(a(),1),be=b(a(),1),we=b(a(),1),Se=b(a(),1),je=b(a(),1),ua=b(a(),1);var Jc=["vibgrate.config.ts","vibgrate.config.js","vibgrate.config.json"],Kc="VIBGRATE_TRUST_CONFIG";function Yc(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function jn(t,e){if(U.isParenthesizedExpression(t))return jn(t.expression,e);if(U.isStringLiteralLike(t))return t.text;if(U.isNumericLiteral(t))return Number(t.text);if(t.kind===U.SyntaxKind.TrueKeyword)return true;if(t.kind===U.SyntaxKind.FalseKeyword)return false;if(t.kind===U.SyntaxKind.NullKeyword)return null;if(U.isArrayLiteralExpression(t))return t.elements.map(n=>{if(U.isSpreadElement(n))throw new Error("Spread not supported in static config arrays");return jn(n,e)});if(U.isObjectLiteralExpression(t)){let n={};for(let r of t.properties){if(!U.isPropertyAssignment(r)||r.initializer===void 0)throw new Error("Only plain object properties are supported in static config");if(U.isComputedPropertyName(r.name))throw new Error("Computed property names are not supported in static config");let s=U.isIdentifier(r.name)||U.isStringLiteral(r.name)||U.isNumericLiteral(r.name)?r.name.text:null;if(s===null)throw new Error("Unsupported object key in static config");n[s]=jn(r.initializer,e);}return n}if(U.isIdentifier(t)){let n=e.get(t.text);if(!n)throw new Error(`Unknown identifier in static config: ${t.text}`);return jn(n,e)}throw new Error("Non-static expression in config")}function Xc(t,e){let n=e.endsWith(".ts")?U.ScriptKind.TS:U.ScriptKind.JS,r=U.createSourceFile(e,t,U.ScriptTarget.ESNext,true,n),s=new Map;for(let o of r.statements)if(U.isVariableStatement(o)&&o.declarationList.flags&U.NodeFlags.Const)for(let i of o.declarationList.declarations)U.isIdentifier(i.name)&&i.initializer&&s.set(i.name.text,i.initializer);for(let o of r.statements){if(!U.isExportAssignment(o))continue;let i=jn(o.expression,s);return Yc(i)?{...dr,...i}:null}return null}var Qc=5242880,Zc=180,dr={exclude:[],maxFileSizeToScan:Qc,projectScanTimeout:Zc,thresholds:{failOnError:{eolDays:180,frameworkMajorLag:3,dependencyTwoPlusPercent:50},warn:{frameworkMajorLag:2,dependencyTwoPlusPercent:30}}};async function el(t){let e=dr;for(let r of Jc){let s=B.join(t,r);if(await p(s)){if(r.endsWith(".json")){let a=await o(s);e={...dr,...JSON.parse(a)};break}let o$1=await o(s),i=null;try{i=Xc(o$1,s);}catch{i=null;}if(i){e=i;break}if(process.env[Kc]==="1")try{let a=await import(s);e={...dr,...a.default??a};break}catch{}}}let n=B.join(t,".vibgrate","auto-excludes.json");if(await p(n))try{let r=await o(n),s=JSON.parse(r);if(Array.isArray(s)&&s.length>0){let o=e.exclude??[];e={...e,exclude:[...new Set([...o,...s])]};}}catch{}return e}async function Ay(t){let e=B.join(t,"vibgrate.config.ts");return await Ee.writeFile(e,`import type { VibgrateConfig } from '@vibgrate/cli';
25
25
 
26
26
  const config: VibgrateConfig = {
27
27
  // exclude: ['legacy/**'],
@@ -41,23 +41,23 @@ const config: VibgrateConfig = {
41
41
  };
42
42
 
43
43
  export default config;
44
- `,"utf8"),e}async function Kc(t,e){if(e.length===0)return false;let n=B.join(t,"vibgrate.config.json");if(await p(n))try{let a=await o(n),c=JSON.parse(a),l=Array.isArray(c.exclude)?c.exclude:[],u=[...new Set([...l,...e])];return c.exclude=u,await xe.writeFile(n,JSON.stringify(c,null,2)+`
45
- `,"utf8"),!0}catch{}let r=B.join(t,".vibgrate"),s=B.join(r,"auto-excludes.json"),o$1=[];if(await p(s))try{let a=await o(s),c=JSON.parse(a);Array.isArray(c)&&(o$1=c);}catch{}let i=[...new Set([...o$1,...e])];try{return await xe.mkdir(r,{recursive:!0}),await xe.writeFile(s,JSON.stringify(i,null,2)+`
46
- `,"utf8"),!0}catch{return false}}var Yc=864e5,Xc=365.25;function Qc(t,e,n){if(!t||!e||!n)return null;let r=n[t],s=n[e];if(!r||!s)return null;let o=Date.parse(r),i=Date.parse(s);if(Number.isNaN(o)||Number.isNaN(i))return null;let a=(i-o)/Yc;return a>0?a:0}function Zc(t){return t===null?null:t/Xc}function el(t){let e=0,n=0,r=0;for(let s of t)s==null||Number.isNaN(s)||(e+=s,s>n&&(n=s),r++);return r===0?null:{total:e,max:n,measured:r}}function tl(t){if(!t||t.measured===0)return null;let e=t.total/t.measured,n=Math.min(e*20,100),r=Math.min(t.max*10,100),s=100-(n*.7+r*.3);return Math.max(0,Math.min(100,Math.round(s)))}var Mo="driftscore-2.0",$o={failOnError:{eolDays:180,frameworkMajorLag:3,dependencyTwoPlusPercent:50},warn:{frameworkMajorLag:2,dependencyTwoPlusPercent:30}};function ai(t,e,n){return Math.min(n,Math.max(e,t))}function nl(t){if(t.length===0)return null;let e=t.map(r=>r.runtimeMajorsBehind).filter(r=>r!==void 0);if(e.length===0)return null;let n=Math.max(...e);return n===0?100:n===1?80:n===2?50:n===3?20:0}function rl(t){let e=t.flatMap(a=>a.frameworks);if(e.length===0)return null;let n=e.map(a=>a.majorsBehind).filter(a=>a!==null);if(n.length===0)return null;let r=Math.max(...n),s=n.reduce((a,c)=>a+c,0)/n.length,o=Math.min(r*20,100),i=Math.min(s*15,100);return ai(100-(o*.6+i*.4),0,100)}function sl(t){let e=0,n=0,r=0;for(let c of t)e+=c.dependencyAgeBuckets.current,n+=c.dependencyAgeBuckets.oneBehind,r+=c.dependencyAgeBuckets.twoPlusBehind;let s=e+n+r;if(s===0)return null;let o=e/s,i=n/s,a=r/s;return ai(Math.round(o*100-i*10-a*40),0,100)}var Lo=1e3*60*60*24*30;function ol(t){if(!t.some(s=>s.runtimeMajorsBehind!==void 0||s.runtimeEol!==void 0&&s.runtimeEol!==null))return null;let n=100,r=Date.now();for(let s of t){if(s.runtimeEol===true){n=Math.min(n,0);continue}if(s.runtimeEol===false){if(s.runtimeEolDate){let o=Date.parse(s.runtimeEolDate)-r;Number.isNaN(o)||(o<=6*Lo?n=Math.min(n,40):o<=12*Lo&&(n=Math.min(n,75)));}continue}s.type==="node"&&s.runtimeMajorsBehind!==void 0&&(s.runtimeMajorsBehind>=3?n=Math.min(n,0):s.runtimeMajorsBehind>=2?n=Math.min(n,30):s.runtimeMajorsBehind>=1&&(n=Math.min(n,70))),s.type==="dotnet"&&s.runtimeMajorsBehind!==void 0&&(s.runtimeMajorsBehind>=3?n=Math.min(n,0):s.runtimeMajorsBehind>=2?n=Math.min(n,20):s.runtimeMajorsBehind>=1&&(n=Math.min(n,60))),s.type==="python"&&s.runtimeMajorsBehind!==void 0&&(s.runtimeMajorsBehind>=6?n=Math.min(n,0):s.runtimeMajorsBehind>=4?n=Math.min(n,20):s.runtimeMajorsBehind>=2&&(n=Math.min(n,60))),s.type==="java"&&s.runtimeMajorsBehind!==void 0&&(s.runtimeMajorsBehind>=10?n=Math.min(n,0):s.runtimeMajorsBehind>=4?n=Math.min(n,30):s.runtimeMajorsBehind>=1&&(n=Math.min(n,70)));}return n}function il(t){let e=t.map(o=>o.libyears).filter(o=>!!o);if(e.length===0)return null;let n=e.reduce((o,i)=>o+i.total,0),r=e.reduce((o,i)=>o+i.measured,0),s=e.reduce((o,i)=>Math.max(o,i.max),0);return r===0?null:tl({total:n,max:s,measured:r})}function al(t){let e=0,n=0;for(let s of t)e+=s.dependencyAgeBuckets.current+s.dependencyAgeBuckets.oneBehind+s.dependencyAgeBuckets.twoPlusBehind,n+=s.dependencyAgeBuckets.unknown;let r=e+n;return r===0?null:Math.round(e/r*100)/100}function Hr(t){let e=nl(t),n=rl(t),r=sl(t),s=ol(t),o=il(t),i=[{score:e,weight:.25},{score:n,weight:.25},{score:r,weight:.3},{score:s,weight:.2},{score:o,weight:.15}],a=al(t)??void 0,c=v=>100-v,l=()=>{let v={runtimeScore:c(Math.round(e??100)),frameworkScore:c(Math.round(n??100)),dependencyScore:c(Math.round(r??100)),eolScore:c(Math.round(s??100))};return o!==null&&(v.freshnessScore=c(Math.round(o))),v},u=i.filter(v=>v.score!==null);if(u.length===0)return {score:0,riskLevel:"low",components:l(),methodologyVersion:Mo,...a!==void 0?{confidence:a}:{}};let p=u.reduce((v,w)=>v+w.weight,0),f=0;for(let v of u)f+=v.score*(v.weight/p);let d=c(Math.round(f)),h;d<=30?h="low":d<=60?h="moderate":h="high";let g=[];return e!==null&&g.push("runtime"),n!==null&&g.push("framework"),r!==null&&g.push("dependency"),s!==null&&g.push("eol"),o!==null&&g.push("freshness"),{score:d,riskLevel:h,components:l(),measured:g,methodologyVersion:Mo,...a!==void 0?{confidence:a}:{}}}function cl(t,e){let n={failOnError:{...$o.failOnError,...e?.thresholds?.failOnError},warn:{...$o.warn,...e?.thresholds?.warn}},r=[];for(let s of t){let o=s.type==="node"?"Node.js":s.type==="dotnet"?".NET":s.type==="python"?"Python":s.type==="java"?"Java":s.type;if(s.runtimeEol===true){let a=s.runtimeEolDate?` on ${s.runtimeEolDate}`:"";r.push({ruleId:"vibgrate/runtime-eol",level:"error",message:`${o} runtime "${s.runtime}" reached end-of-life${a} (latest: ${s.runtimeLatest}).`,location:s.path});}else s.runtimeMajorsBehind!==void 0&&s.runtimeMajorsBehind>=3?r.push({ruleId:"vibgrate/runtime-eol",level:"error",message:`${o} runtime "${s.runtime}" is ${s.runtimeMajorsBehind} major versions behind (latest: ${s.runtimeLatest}). Likely at or past EOL.`,location:s.path}):s.runtimeMajorsBehind!==void 0&&s.runtimeMajorsBehind>=2&&r.push({ruleId:"vibgrate/runtime-lag",level:"warning",message:`${o} runtime "${s.runtime}" is ${s.runtimeMajorsBehind} major versions behind (latest: ${s.runtimeLatest}).`,location:s.path});for(let a of s.frameworks)a.majorsBehind!==null&&n.failOnError.frameworkMajorLag!==void 0&&a.majorsBehind>=n.failOnError.frameworkMajorLag?r.push({ruleId:"vibgrate/framework-major-lag",level:"error",message:`${a.name} is ${a.majorsBehind} major versions behind (current: ${a.currentVersion}, latest: ${a.latestVersion}).`,location:s.path}):a.majorsBehind!==null&&n.warn.frameworkMajorLag!==void 0&&a.majorsBehind>=n.warn.frameworkMajorLag&&r.push({ruleId:"vibgrate/framework-major-lag",level:"warning",message:`${a.name} is ${a.majorsBehind} major versions behind (current: ${a.currentVersion}, latest: ${a.latestVersion}).`,location:s.path});let i=s.dependencyAgeBuckets.current+s.dependencyAgeBuckets.oneBehind+s.dependencyAgeBuckets.twoPlusBehind;if(i>0){let a=s.dependencyAgeBuckets.twoPlusBehind/i*100;n.failOnError.dependencyTwoPlusPercent!==void 0&&a>=n.failOnError.dependencyTwoPlusPercent?r.push({ruleId:"vibgrate/dependency-rot",level:"error",message:`${Math.round(a)}% of dependencies are 2+ major versions behind in ${s.name}.`,location:s.path}):n.warn.dependencyTwoPlusPercent!==void 0&&a>=n.warn.dependencyTwoPlusPercent&&r.push({ruleId:"vibgrate/dependency-rot",level:"warning",message:`${Math.round(a)}% of dependencies are 2+ major versions behind in ${s.name}.`,location:s.path});}for(let a of s.dependencies)a.majorsBehind!==null&&a.majorsBehind>=3&&r.push({ruleId:"vibgrate/dependency-major-lag",level:"error",message:`${a.package} is ${a.majorsBehind} major versions behind (spec: ${a.currentSpec}, latest: ${a.latestStable}).`,location:s.path});}return r}function ll(t,e,n){let r=n?`${t}:${e}:${n}`:`${t}:${e}`;return fs.createHash("sha256").update(r).digest("hex").slice(0,16)}function ul(t,e,n){let r=n?`${t}:${e}:${n}`:`${t}:${e}`;return fs.createHash("sha256").update(r).digest("hex").slice(0,16)}var pl=20,fl=50,No={red:"#E5484D",amber:"#F5A524",green:"#30A46C",unknown:"#6B7280"},vy="#24292F";function by(t){if(t==null||!Number.isFinite(t))return "unknown";let e=Math.round(t);return e<=pl?"green":e<=fl?"amber":"red"}function wy(t){if(t==null||!Number.isFinite(t))return "unknown";let e=Math.round(Math.min(100,Math.max(0,t)));return e===100?"100":String(e).padStart(2,"0")}function Sy(t){return No[t]??No.unknown}var dl=["","\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589"],ml="\u2588";function zr(t,e,n){return Math.round(t+(e-t)*n)}function es(t,e,n){return {r:zr(t.r,e.r,n),g:zr(t.g,e.g,n),b:zr(t.b,e.b,n)}}function hl({r:t,g:e,b:n}){let r=s=>Math.max(0,Math.min(255,s)).toString(16).padStart(2,"0");return `#${r(t)}${r(e)}${r(n)}`}function ci(t,e,n,r,s="\u2591"){let i=(Number.isFinite(t)?Math.max(0,Math.min(t,1)):0)*e,a=Math.min(Math.floor(i),e),c=a<e?Math.floor((i-a)*8):0,l=f=>E.hex(hl(es(n,r,e>1?f/(e-1):0))),u="";for(let f=0;f<a;f++)u+=l(f)(ml);let p=a;return c>0&&(u+=l(a)(dl[c]),p++),u+=E.dim(s.repeat(Math.max(e-p,0))),u}var gl={r:63,g:176,b:164},yl={r:79,g:227,b:193};function vl(t,e){return ci(t,e,gl,yl)}var bl={r:63,g:176,b:106},Io={r:224,g:168,b:48},wl={r:224,g:83,b:83};function Sl(t){let e=Number.isFinite(t)?Math.max(0,Math.min(t,100)):0;return e<=50?es(bl,Io,e/50):es(Io,wl,(e-50)/50)}function kl(t,e=20){let n=Number.isFinite(t)?Math.max(0,Math.min(t,100)):0,r=Sl(n);return `${ci(n/100,e,r,r)} ${Math.round(n)}`}var xl=42;function jn(t,e=E.cyan,n=xl){let r=(a,c)=>e(a+"\u2500".repeat(n)+c),o=Math.max(n-2-t.length,0),i=e("\u2502")+" ".repeat(2)+E.bold.white(t)+" ".repeat(o)+e("\u2502");return [r("\u256D","\u256E"),i,r("\u2570","\u256F")]}function Sn(t){return String(Number(t.toFixed(2)))}function El(t){let e=[];e.push(""),e.push(...jn("Vibgrate Drift Report")),e.push("");for(let a of t.projects){if(e.push(E.bold(` \u2500\u2500 ${a.name} `)+E.dim(`(${a.type}) ${a.path}`)),a.runtime){let u=a.runtimeMajorsBehind!==void 0&&a.runtimeMajorsBehind>0?E.yellow(` (${a.runtimeMajorsBehind} major${a.runtimeMajorsBehind>1?"s":""} behind)`):E.green(" (current)");e.push(` Runtime: ${a.runtime}${u}`);}if(a.targetFramework&&e.push(` Target: ${a.targetFramework}`),a.frameworks.length>0){e.push(" Frameworks:");for(let u of a.frameworks){let p=u.majorsBehind!==null?u.majorsBehind===0?E.green("current"):E.yellow(`${u.majorsBehind} behind`):E.dim("unknown");e.push(` ${u.name}: ${u.currentVersion??"?"} \u2192 ${u.latestVersion??"?"} (${p})`);}}let c=a.dependencyAgeBuckets;c.current+c.oneBehind+c.twoPlusBehind+c.unknown>0&&(e.push(" Dependencies:"),e.push(` ${E.green(`${c.current} current`)} ${E.yellow(`${c.oneBehind} 1-behind`)} ${E.red(`${c.twoPlusBehind} 2+ behind`)} ${E.dim(`${c.unknown} unknown`)}`)),e.push("");}if(t.delta!==void 0){let a=t.delta<0?E.green(`${t.delta}`):t.delta>0?E.red(`+${t.delta}`):E.dim("0");e.push(E.bold(" Drift Delta: ")+a+" (vs baseline)"),e.push("");}if(t.extended&&e.push(...Tl(t.extended)),t.findings.length>0){let a=t.findings.filter(p=>p.level==="error"),c=t.findings.filter(p=>p.level==="warning"),l=t.findings.filter(p=>p.level==="note"),u=[a.length>0?E.red(`${a.length} error${a.length!==1?"s":""}`):"",c.length>0?E.yellow(`${c.length} warning${c.length!==1?"s":""}`):"",l.length>0?E.blue(`${l.length} note${l.length!==1?"s":""}`):""].filter(Boolean).join(E.dim(", "));e.push(E.bold.underline(" Findings")+E.dim(` (${u})`));for(let p of t.findings){let f=p.level==="error"?E.red("\u2716"):p.level==="warning"?E.yellow("\u26A0"):E.blue("\u2139");e.push(` ${f} ${p.message}`),e.push(E.dim(` ${p.ruleId} in ${p.location}`));}e.push("");}let n=Al(t);if(n.length>0){e.push(...jn("Top Priority Actions")),e.push("");for(let a=0;a<n.length;a++){let c=n[a],l=E.bold.cyan(` ${a+1}.`);e.push(`${l} ${E.bold(c.title)}`),e.push(E.dim(` ${c.explanation}`)),c.impact&&e.push(` Impact: ${E.green(c.impact)}`),e.push("");}}if(t.extended?.architecture&&e.push(...Cl(t.extended.architecture)),t.solutions&&t.solutions.length>0){e.push(...jn("Solution Drift Summary")),e.push("");for(let a of t.solutions){let c=a.drift?.score,l=typeof c=="number"?c<=30?E.green:c<=60?E.yellow:E.red:E.dim;e.push(` \u2022 ${a.name} (${a.projectPaths.length} projects) \u2014 ${typeof c=="number"?l(`${c}/100`):E.dim("n/a")}`);}e.push("");}let r=t.drift.score<=30?E.green:t.drift.score<=60?E.yellow:E.red;e.push(...jn("Drift Score Summary")),e.push(""),e.push(E.bold(" Drift Score: ")+r.bold(`${t.drift.score}/100`)),e.push(E.bold(" Risk Level: ")+jl(t.drift.riskLevel)),e.push(E.bold(" Projects: ")+`${t.projects.length}`);let s=t.billing;if(s){let a=[];s.standardCount>0&&a.push(`${E.cyan(Sn(s.standardCount))} standard`),s.smallCount>0&&a.push(`${E.cyan(Sn(s.smallCount/s.smallBillingRatio))} small`),s.microCount>0&&a.push(`${E.cyan(Sn(s.microCount/s.microBillingRatio))} micro`),s.nanoCount>0&&a.push(`${E.cyan(Sn(s.nanoCount/s.nanoBillingRatio))} nano`),e.push(E.bold(" Classified: ")+`${E.cyan(s.nanoCount)} nano \xB7 ${E.cyan(s.microCount)} micro \xB7 ${E.cyan(s.smallCount)} small \xB7 ${E.cyan(s.standardCount)} standard`);let c=Sn(s.billableProjectsRaw);e.push(E.bold(" Billable: ")+E.bold.white(c)+E.dim(` \xB7 ${s.totalScanned} detected \u2192 ${c} billable project${s.billableProjectsRaw===1?"":"s"} (micro-project pricing)`)),a.length>0&&e.push(E.dim(" ")+a.join(E.dim(" \xB7 "))),s.billableProjectsRaw!==Math.floor(s.billableProjectsRaw)&&e.push(E.dim(" These fractions add up across repositories, then round down to whole billable projects."));}if(t.vcs){let a=[t.vcs.type];t.vcs.branch&&a.push(t.vcs.branch),t.vcs.shortSha&&a.push(E.dim(t.vcs.shortSha)),e.push(E.bold(" VCS: ")+a.join(" "));}e.push("");let o=new Set(t.drift.measured??["runtime","framework","dependency","eol"]);e.push(" "+E.bold.underline("Score Breakdown")),e.push(` Runtime: ${o.has("runtime")?Tn(t.drift.components.runtimeScore):E.dim("n/a")}`),e.push(` Frameworks: ${o.has("framework")?Tn(t.drift.components.frameworkScore):E.dim("n/a")}`),e.push(` Dependencies: ${o.has("dependency")?Tn(t.drift.components.dependencyScore):E.dim("n/a")}`),e.push(` EOL Risk: ${o.has("eol")?Tn(t.drift.components.eolScore):E.dim("n/a")}`),e.push("");let i=[`Scanned at ${t.timestamp}`];if(t.durationMs!==void 0){let a=(t.durationMs/1e3).toFixed(1);i.push(`${a}s`);}return t.filesScanned!==void 0&&i.push(`${t.filesScanned} file${t.filesScanned!==1?"s":""} scanned`),t.treeSummary&&(i.push(`${t.treeSummary.totalFiles.toLocaleString()} workspace files`),i.push(`${t.treeSummary.totalDirs.toLocaleString()} dirs`)),e.push(E.dim(` ${i.join(" \xB7 ")}`)),e.push(""),e.join(`
47
- `)}function jl(t){switch(t){case "low":return E.bgGreen.black(" LOW ");case "moderate":return E.bgYellow.black(" MODERATE ");case "high":return E.bgRed.white(" HIGH ");default:return t}}function Tn(t){return kl(t,20)}var Fo={frontend:"Frontend",metaFrameworks:"Meta-frameworks",bundlers:"Bundlers",css:"CSS / UI",backend:"Backend",orm:"ORM / Database",testing:"Testing",lintFormat:"Lint & Format",apiMessaging:"API & Messaging",observability:"Observability",payment:"Payment",auth:"Auth",email:"Email",cloud:"Cloud",databases:"Databases",messaging:"Messaging",crm:"CRM & Comms",storage:"Storage",search:"Search & AI"};function Tl(t){let e=[];if(t.toolingInventory){let n=t.toolingInventory,r=Object.entries(n).filter(([,s])=>s.length>0);if(r.length>0){e.push(E.bold.underline(" Tech Stack"));for(let[s,o]of r){let i=Fo[s]??s,a=o.map(c=>E.white(c.name)).join(E.dim(", "));e.push(` ${E.cyan(i)}: ${a}`);}e.push("");}}if(t.serviceDependencies){let n=t.serviceDependencies,r=Object.entries(n).filter(([,s])=>s.length>0);if(r.length>0){e.push(E.bold.underline(" Services & Integrations"));for(let[s,o]of r){let i=Fo[s]??s,a=o.map(c=>{let l=c.version?E.dim(` ${c.version}`):"";return E.white(c.name)+l}).join(E.dim(", "));e.push(` ${E.cyan(i)}: ${a}`);}e.push("");}}if(t.breakingChangeExposure){let n=t.breakingChangeExposure;if(n.deprecatedPackages.length>0||n.legacyPolyfills.length>0){e.push(E.bold.underline(" Breaking Change Exposure"));let r=n.exposureScore>=40?E.red:n.exposureScore>=20?E.yellow:E.green;e.push(` Exposure Score: ${r.bold(`${n.exposureScore}/100`)}`),n.deprecatedPackages.length>0&&e.push(` ${E.red("Deprecated")}: ${n.deprecatedPackages.map(o=>E.dim(o)).join(", ")}`),n.legacyPolyfills.length>0&&e.push(` ${E.yellow("Polyfills")}: ${n.legacyPolyfills.map(o=>E.dim(o)).join(", ")}`),n.peerConflictsDetected&&e.push(` ${E.red("\u26A0")} Peer dependency conflicts detected`),e.push(` Recommendation: ${E.bold(n.overallRecommendation)}`);let s=n.projectIntelligence.filter(o=>o.packages.length>0).slice(0,3);if(s.length>0){e.push(" Major Upgrade Intelligence:");for(let o of s){e.push(` - ${o.project} (${o.recommendation})`);for(let i of o.packages.slice(0,2))e.push(` \xB7 ${i.package} ${i.currentVersion??"?"} \u2192 ${i.targetVersion??"?"} | touched ~${i.usage.touchedPercent}% | ${i.automatable}`);}}e.push("");}}if(t.tsModernity&&t.tsModernity.typescriptVersion){let n=t.tsModernity;e.push(E.bold.underline(" TypeScript"));let r=[];r.push(`v${n.typescriptVersion}`),n.strict===true?r.push(E.green("strict \u2714")):n.strict===false&&r.push(E.yellow("strict \u2716")),n.moduleType&&r.push(n.moduleType.toUpperCase()),n.target&&r.push(`target: ${n.target}`),e.push(` ${r.join(E.dim(" \xB7 "))}`),e.push("");}if(t.buildDeploy){let n=t.buildDeploy;(n.ci.length>0||n.docker.dockerfileCount>0||n.packageManagers.length>0)&&(e.push(E.bold.underline(" Build & Deploy")),n.ci.length>0&&e.push(` CI: ${n.ci.join(", ")}`),n.docker.dockerfileCount>0&&e.push(` Docker: ${n.docker.dockerfileCount} Dockerfile${n.docker.dockerfileCount!==1?"s":""} (${n.docker.baseImages.join(", ")})`),n.packageManagers.length>0&&e.push(` Package Managers: ${n.packageManagers.join(", ")}`),n.monorepoTools.length>0&&e.push(` Monorepo: ${n.monorepoTools.join(", ")}`),n.iac.length>0&&e.push(` IaC: ${n.iac.join(", ")}`),e.push(""));}if(t.uiPurpose){let n=t.uiPurpose;e.push(E.bold.underline(" Product Purpose Signals")),e.push(` Frameworks: ${n.detectedFrameworks.length>0?n.detectedFrameworks.join(", "):E.dim("unknown")}`),e.push(` Evidence: ${n.topEvidence.length}${n.capped?E.dim(` of ${n.evidenceCount} (capped)`):""}`);let r=n.topEvidence.slice(0,8);if(r.length>0){e.push(" Top Signals:");for(let s of r)e.push(` - [${s.kind}] ${s.value} ${E.dim(`(${s.file})`)}`);}if(n.unknownSignals.length>0){e.push(" Unknowns:");for(let s of n.unknownSignals.slice(0,4))e.push(` - ${E.yellow(s)}`);}e.push("");}if(t.securityPosture){let n=t.securityPosture;e.push(E.bold.underline(" Security Posture"));let r=[];r.push(n.lockfilePresent?E.green("Lockfile \u2714"):E.red("Lockfile \u2716")),r.push(n.gitignoreCoversEnv?E.green(".env \u2714"):E.red(".env \u2716")),r.push(n.gitignoreCoversNodeModules?E.green("node_modules \u2714"):E.yellow("node_modules \u2716")),n.multipleLockfileTypes&&r.push(E.yellow("Multiple lockfiles \u26A0")),n.envFilesTracked&&r.push(E.red("Env files tracked \u2716")),e.push(` ${r.join(E.dim(" \xB7 "))}`),e.push("");}if(t.platformMatrix){let n=t.platformMatrix;(n.nativeModules.length>0||n.dockerBaseImages.length>0)&&(e.push(E.bold.underline(" Platform")),n.nativeModules.length>0&&e.push(` Native modules: ${n.nativeModules.map(r=>E.dim(r)).join(", ")}`),n.osAssumptions.length>0&&e.push(` OS assumptions: ${n.osAssumptions.join(", ")}`),e.push(""));}if(t.codeQuality){let n=t.codeQuality;if(e.push(E.bold.underline(" Code Quality")),e.push(` Files: ${E.white(`${n.filesAnalyzed}`)} \xB7 Functions: ${E.white(`${n.functionsAnalyzed}`)} \xB7 Avg complexity: ${E.white(`${n.avgCyclomaticComplexity}`)} \xB7 Avg length: ${E.white(`${n.avgFunctionLength}`)} lines`),e.push(` Max nesting: ${n.maxNestingDepth} \xB7 Circular deps: ${n.circularDependencies} \xB7 Dead code: ${n.deadCodePercent}%`),n.godFiles.length>0){let r=n.godFiles.slice(0,3).map(s=>`${s.path} (${s.lines} lines)`).join(", ");e.push(` ${E.yellow("God files")}: ${r}`);}e.push("");}if(t.dependencyGraph){let n=t.dependencyGraph;n.lockfileType&&(e.push(E.bold.underline(" Dependency Graph")),e.push(` ${n.lockfileType}: ${E.white(`${n.totalUnique}`)} unique, ${E.white(`${n.totalInstalled}`)} installed`),n.duplicatedPackages.length>0&&e.push(` ${E.yellow(`${n.duplicatedPackages.length} duplicated`)} packages`),n.phantomDependencies.length>0&&e.push(` ${E.red(`${n.phantomDependencies.length} phantom`)} dependencies`),e.push(""));}return e}function Cl(t){let e=[];if(e.push(...jn("Architecture Layers")),e.push(""),e.push(E.bold(" Archetype: ")+`${t.archetype}`+E.dim(` (${Math.round(t.archetypeConfidence*100)}% confidence)`)),e.push(` Files classified: ${t.totalClassified}`+(t.unclassified>0?E.dim(` (${t.unclassified} unclassified)`):"")),e.push(""),t.layers.length>0){for(let n of t.layers){let r=n.riskLevel==="none"?E.dim("none"):n.riskLevel==="low"?E.green("low"):n.riskLevel==="moderate"?E.yellow("moderate"):E.red("high");e.push(` ${E.bold(n.layer)} ${n.fileCount} file${n.fileCount!==1?"s":""} drift ${Tn(n.driftScore)} risk ${r}`);}e.push("");}return e}function Al(t){let e=[],n=t.projects.filter(i=>i.runtimeMajorsBehind!==void 0&&i.runtimeMajorsBehind>=3);if(n.length>0){let i=n.map(l=>l.name).join(", "),a="End-of-life runtimes no longer receive security patches and block ecosystem upgrades.",c=[];for(let l of n)c.push(`
44
+ `,"utf8"),e}async function tl(t,e){if(e.length===0)return false;let n=B.join(t,"vibgrate.config.json");if(await p(n))try{let a=await o(n),c=JSON.parse(a),l=Array.isArray(c.exclude)?c.exclude:[],u=[...new Set([...l,...e])];return c.exclude=u,await Ee.writeFile(n,JSON.stringify(c,null,2)+`
45
+ `,"utf8"),!0}catch{}let r=B.join(t,".vibgrate"),s=B.join(r,"auto-excludes.json"),o$1=[];if(await p(s))try{let a=await o(s),c=JSON.parse(a);Array.isArray(c)&&(o$1=c);}catch{}let i=[...new Set([...o$1,...e])];try{return await Ee.mkdir(r,{recursive:!0}),await Ee.writeFile(s,JSON.stringify(i,null,2)+`
46
+ `,"utf8"),!0}catch{return false}}var nl=864e5,rl=365.25;function sl(t,e,n){if(!t||!e||!n)return null;let r=n[t],s=n[e];if(!r||!s)return null;let o=Date.parse(r),i=Date.parse(s);if(Number.isNaN(o)||Number.isNaN(i))return null;let a=(i-o)/nl;return a>0?a:0}function ol(t){return t===null?null:t/rl}function il(t){let e=0,n=0,r=0;for(let s of t)s==null||Number.isNaN(s)||(e+=s,s>n&&(n=s),r++);return r===0?null:{total:e,max:n,measured:r}}function al(t){if(!t||t.measured===0)return null;let e=t.total/t.measured,n=Math.min(e*20,100),r=Math.min(t.max*10,100),s=100-(n*.7+r*.3);return Math.max(0,Math.min(100,Math.round(s)))}var Lo="driftscore-2.0",No={failOnError:{eolDays:180,frameworkMajorLag:3,dependencyTwoPlusPercent:50},warn:{frameworkMajorLag:2,dependencyTwoPlusPercent:30}};function fi(t,e,n){return Math.min(n,Math.max(e,t))}function cl(t){if(t.length===0)return null;let e=t.map(r=>r.runtimeMajorsBehind).filter(r=>r!==void 0);if(e.length===0)return null;let n=Math.max(...e);return n===0?100:n===1?80:n===2?50:n===3?20:0}function ll(t){let e=t.flatMap(a=>a.frameworks);if(e.length===0)return null;let n=e.map(a=>a.majorsBehind).filter(a=>a!==null);if(n.length===0)return null;let r=Math.max(...n),s=n.reduce((a,c)=>a+c,0)/n.length,o=Math.min(r*20,100),i=Math.min(s*15,100);return fi(100-(o*.6+i*.4),0,100)}function ul(t){let e=0,n=0,r=0;for(let c of t)e+=c.dependencyAgeBuckets.current,n+=c.dependencyAgeBuckets.oneBehind,r+=c.dependencyAgeBuckets.twoPlusBehind;let s=e+n+r;if(s===0)return null;let o=e/s,i=n/s,a=r/s;return fi(Math.round(o*100-i*10-a*40),0,100)}var Ro=1e3*60*60*24*30;function pl(t){if(!t.some(s=>s.runtimeMajorsBehind!==void 0||s.runtimeEol!==void 0&&s.runtimeEol!==null))return null;let n=100,r=Date.now();for(let s of t){if(s.runtimeEol===true){n=Math.min(n,0);continue}if(s.runtimeEol===false){if(s.runtimeEolDate){let o=Date.parse(s.runtimeEolDate)-r;Number.isNaN(o)||(o<=6*Ro?n=Math.min(n,40):o<=12*Ro&&(n=Math.min(n,75)));}continue}s.type==="node"&&s.runtimeMajorsBehind!==void 0&&(s.runtimeMajorsBehind>=3?n=Math.min(n,0):s.runtimeMajorsBehind>=2?n=Math.min(n,30):s.runtimeMajorsBehind>=1&&(n=Math.min(n,70))),s.type==="dotnet"&&s.runtimeMajorsBehind!==void 0&&(s.runtimeMajorsBehind>=3?n=Math.min(n,0):s.runtimeMajorsBehind>=2?n=Math.min(n,20):s.runtimeMajorsBehind>=1&&(n=Math.min(n,60))),s.type==="python"&&s.runtimeMajorsBehind!==void 0&&(s.runtimeMajorsBehind>=6?n=Math.min(n,0):s.runtimeMajorsBehind>=4?n=Math.min(n,20):s.runtimeMajorsBehind>=2&&(n=Math.min(n,60))),s.type==="java"&&s.runtimeMajorsBehind!==void 0&&(s.runtimeMajorsBehind>=10?n=Math.min(n,0):s.runtimeMajorsBehind>=4?n=Math.min(n,30):s.runtimeMajorsBehind>=1&&(n=Math.min(n,70)));}return n}function fl(t){let e=t.map(o=>o.libyears).filter(o=>!!o);if(e.length===0)return null;let n=e.reduce((o,i)=>o+i.total,0),r=e.reduce((o,i)=>o+i.measured,0),s=e.reduce((o,i)=>Math.max(o,i.max),0);return r===0?null:al({total:n,max:s,measured:r})}function dl(t){let e=0,n=0;for(let s of t)e+=s.dependencyAgeBuckets.current+s.dependencyAgeBuckets.oneBehind+s.dependencyAgeBuckets.twoPlusBehind,n+=s.dependencyAgeBuckets.unknown;let r=e+n;return r===0?null:Math.round(e/r*100)/100}function zr(t){let e=cl(t),n=ll(t),r=ul(t),s=pl(t),o=fl(t),i=[{score:e,weight:.25},{score:n,weight:.25},{score:r,weight:.3},{score:s,weight:.2},{score:o,weight:.15}],a=dl(t)??void 0,c=v=>100-v,l=()=>{let v={runtimeScore:c(Math.round(e??100)),frameworkScore:c(Math.round(n??100)),dependencyScore:c(Math.round(r??100)),eolScore:c(Math.round(s??100))};return o!==null&&(v.freshnessScore=c(Math.round(o))),v},u=i.filter(v=>v.score!==null);if(u.length===0)return {score:0,riskLevel:"low",components:l(),methodologyVersion:Lo,...a!==void 0?{confidence:a}:{}};let p=u.reduce((v,S)=>v+S.weight,0),f=0;for(let v of u)f+=v.score*(v.weight/p);let d=c(Math.round(f)),h;d<=30?h="low":d<=60?h="moderate":h="high";let g=[];return e!==null&&g.push("runtime"),n!==null&&g.push("framework"),r!==null&&g.push("dependency"),s!==null&&g.push("eol"),o!==null&&g.push("freshness"),{score:d,riskLevel:h,components:l(),measured:g,methodologyVersion:Lo,...a!==void 0?{confidence:a}:{}}}function ml(t,e){let n={failOnError:{...No.failOnError,...e?.thresholds?.failOnError},warn:{...No.warn,...e?.thresholds?.warn}},r=[];for(let s of t){let o=s.type==="node"?"Node.js":s.type==="dotnet"?".NET":s.type==="python"?"Python":s.type==="java"?"Java":s.type;if(s.runtimeEol===true){let a=s.runtimeEolDate?` on ${s.runtimeEolDate}`:"";r.push({ruleId:"vibgrate/runtime-eol",level:"error",message:`${o} runtime "${s.runtime}" reached end-of-life${a} (latest: ${s.runtimeLatest}).`,location:s.path});}else s.runtimeMajorsBehind!==void 0&&s.runtimeMajorsBehind>=3?r.push({ruleId:"vibgrate/runtime-eol",level:"error",message:`${o} runtime "${s.runtime}" is ${s.runtimeMajorsBehind} major versions behind (latest: ${s.runtimeLatest}). Likely at or past EOL.`,location:s.path}):s.runtimeMajorsBehind!==void 0&&s.runtimeMajorsBehind>=2&&r.push({ruleId:"vibgrate/runtime-lag",level:"warning",message:`${o} runtime "${s.runtime}" is ${s.runtimeMajorsBehind} major versions behind (latest: ${s.runtimeLatest}).`,location:s.path});for(let a of s.frameworks)a.majorsBehind!==null&&n.failOnError.frameworkMajorLag!==void 0&&a.majorsBehind>=n.failOnError.frameworkMajorLag?r.push({ruleId:"vibgrate/framework-major-lag",level:"error",message:`${a.name} is ${a.majorsBehind} major versions behind (current: ${a.currentVersion}, latest: ${a.latestVersion}).`,location:s.path}):a.majorsBehind!==null&&n.warn.frameworkMajorLag!==void 0&&a.majorsBehind>=n.warn.frameworkMajorLag&&r.push({ruleId:"vibgrate/framework-major-lag",level:"warning",message:`${a.name} is ${a.majorsBehind} major versions behind (current: ${a.currentVersion}, latest: ${a.latestVersion}).`,location:s.path});let i=s.dependencyAgeBuckets.current+s.dependencyAgeBuckets.oneBehind+s.dependencyAgeBuckets.twoPlusBehind;if(i>0){let a=s.dependencyAgeBuckets.twoPlusBehind/i*100;n.failOnError.dependencyTwoPlusPercent!==void 0&&a>=n.failOnError.dependencyTwoPlusPercent?r.push({ruleId:"vibgrate/dependency-rot",level:"error",message:`${Math.round(a)}% of dependencies are 2+ major versions behind in ${s.name}.`,location:s.path}):n.warn.dependencyTwoPlusPercent!==void 0&&a>=n.warn.dependencyTwoPlusPercent&&r.push({ruleId:"vibgrate/dependency-rot",level:"warning",message:`${Math.round(a)}% of dependencies are 2+ major versions behind in ${s.name}.`,location:s.path});}for(let a of s.dependencies)a.majorsBehind!==null&&a.majorsBehind>=3&&r.push({ruleId:"vibgrate/dependency-major-lag",level:"error",message:`${a.package} is ${a.majorsBehind} major versions behind (spec: ${a.currentSpec}, latest: ${a.latestStable}).`,location:s.path});}return r}function hl(t,e,n){let r=n?`${t}:${e}:${n}`:`${t}:${e}`;return ds.createHash("sha256").update(r).digest("hex").slice(0,16)}function gl(t,e,n){let r=n?`${t}:${e}:${n}`:`${t}:${e}`;return ds.createHash("sha256").update(r).digest("hex").slice(0,16)}var yl=20,vl=50,Io={red:"#E5484D",amber:"#F5A524",green:"#30A46C",unknown:"#6B7280"},Py="#24292F";function My(t){if(t==null||!Number.isFinite(t))return "unknown";let e=Math.round(t);return e<=yl?"green":e<=vl?"amber":"red"}function $y(t){if(t==null||!Number.isFinite(t))return "unknown";let e=Math.round(Math.min(100,Math.max(0,t)));return e===100?"100":String(e).padStart(2,"0")}function Ly(t){return Io[t]??Io.unknown}var bl=["","\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589"],wl="\u2588";function Wr(t,e,n){return Math.round(t+(e-t)*n)}function ts(t,e,n){return {r:Wr(t.r,e.r,n),g:Wr(t.g,e.g,n),b:Wr(t.b,e.b,n)}}function Sl({r:t,g:e,b:n}){let r=s=>Math.max(0,Math.min(255,s)).toString(16).padStart(2,"0");return `#${r(t)}${r(e)}${r(n)}`}function di(t,e,n,r,s="\u2591"){let i=(Number.isFinite(t)?Math.max(0,Math.min(t,1)):0)*e,a=Math.min(Math.floor(i),e),c=a<e?Math.floor((i-a)*8):0,l=f=>k.hex(Sl(ts(n,r,e>1?f/(e-1):0))),u="";for(let f=0;f<a;f++)u+=l(f)(wl);let p=a;return c>0&&(u+=l(a)(bl[c]),p++),u+=k.dim(s.repeat(Math.max(e-p,0))),u}var kl={r:63,g:176,b:164},xl={r:79,g:227,b:193};function El(t,e){return di(t,e,kl,xl)}var jl={r:63,g:176,b:106},Fo={r:224,g:168,b:48},Tl={r:224,g:83,b:83};function Cl(t){let e=Number.isFinite(t)?Math.max(0,Math.min(t,100)):0;return e<=50?ts(jl,Fo,e/50):ts(Fo,Tl,(e-50)/50)}function Al(t,e=20){let n=Number.isFinite(t)?Math.max(0,Math.min(t,100)):0,r=Cl(n);return `${di(n/100,e,r,r)} ${Math.round(n)}`}var mi=42;function Tn(t,e=k.cyan,n=mi){let r=(a,c)=>e(a+"\u2500".repeat(n)+c),o=Math.max(n-2-t.length,0),i=e("\u2502")+" ".repeat(2)+k.bold.white(t)+" ".repeat(o)+e("\u2502");return [r("\u256D","\u256E"),i,r("\u2570","\u256F")]}var Pl=/\[[0-9;]*m/g;function Ml(t){return t.replace(Pl,"").length}function $l(t,e,n=k.cyan,r=mi){let s=[],o=` ${t} `,i=Math.max(r-1-o.length,0);s.push(n("\u256D\u2500")+k.bold.white(o)+n("\u2500".repeat(i)+"\u256E"));let a=1;for(let c of e){let l=Math.max(r-a-Ml(c),0);s.push(n("\u2502")+" ".repeat(a)+c+" ".repeat(l)+n("\u2502"));}return s.push(n("\u2570"+"\u2500".repeat(r)+"\u256F")),s}function Zt(t){return String(Number(t.toFixed(2)))}function Ll(t,e={}){let n=[];n.push(""),n.push(...Tn("Vibgrate Drift Report")),n.push("");for(let c of t.projects){if(n.push(k.bold(` \u2500\u2500 ${c.name} `)+k.dim(`(${c.type}) ${c.path}`)),c.runtime){let p=c.runtimeMajorsBehind!==void 0&&c.runtimeMajorsBehind>0?k.yellow(` (${c.runtimeMajorsBehind} major${c.runtimeMajorsBehind>1?"s":""} behind)`):k.green(" (current)");n.push(` Runtime: ${c.runtime}${p}`);}if(c.targetFramework&&n.push(` Target: ${c.targetFramework}`),c.frameworks.length>0){n.push(" Frameworks:");for(let p of c.frameworks){let f=p.majorsBehind!==null?p.majorsBehind===0?k.green("current"):k.yellow(`${p.majorsBehind} behind`):k.dim("unknown");n.push(` ${p.name}: ${p.currentVersion??"?"} \u2192 ${p.latestVersion??"?"} (${f})`);}}let l=c.dependencyAgeBuckets;l.current+l.oneBehind+l.twoPlusBehind+l.unknown>0&&(n.push(" Dependencies:"),n.push(` ${k.green(`${l.current} current`)} ${k.yellow(`${l.oneBehind} 1-behind`)} ${k.red(`${l.twoPlusBehind} 2+ behind`)} ${k.dim(`${l.unknown} unknown`)}`)),n.push("");}if(t.delta!==void 0){let c=t.delta<0?k.green(`${t.delta}`):t.delta>0?k.red(`+${t.delta}`):k.dim("0");n.push(k.bold(" Drift Delta: ")+c+" (vs baseline)"),n.push("");}if(t.extended&&n.push(...Il(t.extended)),t.findings.length>0){let c=t.findings.filter(f=>f.level==="error"),l=t.findings.filter(f=>f.level==="warning"),u=t.findings.filter(f=>f.level==="note"),p=[c.length>0?k.red(`${c.length} error${c.length!==1?"s":""}`):"",l.length>0?k.yellow(`${l.length} warning${l.length!==1?"s":""}`):"",u.length>0?k.blue(`${u.length} note${u.length!==1?"s":""}`):""].filter(Boolean).join(k.dim(", "));n.push(k.bold.underline(" Findings")+k.dim(` (${p})`));for(let f of t.findings){let d=f.level==="error"?k.red("\u2716"):f.level==="warning"?k.yellow("\u26A0"):k.blue("\u2139");n.push(` ${d} ${f.message}`),n.push(k.dim(` ${f.ruleId} in ${f.location}`));}n.push("");}let r=Fl(t);if(r.length>0){n.push(...Tn("Top Priority Actions")),n.push("");for(let c=0;c<r.length;c++){let l=r[c],u=k.bold.cyan(` ${c+1}.`);n.push(`${u} ${k.bold(l.title)}`),n.push(k.dim(` ${l.explanation}`)),l.impact&&n.push(` Impact: ${k.green(l.impact)}`),n.push("");}}if(t.extended?.architecture&&n.push(..._l(t.extended.architecture)),t.solutions&&t.solutions.length>0){n.push(...Tn("Solution Drift Summary")),n.push("");for(let c of t.solutions){let l=c.drift?.score,u=typeof l=="number"?l<=30?k.green:l<=60?k.yellow:k.red:k.dim;n.push(` \u2022 ${c.name} (${c.projectPaths.length} projects) \u2014 ${typeof l=="number"?u(`${l}/100`):k.dim("n/a")}`);}n.push("");}let s=t.drift.score<=30?k.green:t.drift.score<=60?k.yellow:k.red;n.push(...Tn("Drift Score Summary")),n.push(""),n.push(k.bold(" Drift Score: ")+s.bold(`${t.drift.score}/100`)),n.push(k.bold(" Risk Level: ")+Rl(t.drift.riskLevel)),n.push(k.bold(" Projects: ")+`${t.projects.length}`);let o=t.billing;if(o){let c=[];o.standardCount>0&&c.push(`${k.cyan(Zt(o.standardCount))} standard`),o.smallCount>0&&c.push(`${k.cyan(Zt(o.smallCount/o.smallBillingRatio))} small`),o.microCount>0&&c.push(`${k.cyan(Zt(o.microCount/o.microBillingRatio))} micro`),o.nanoCount>0&&c.push(`${k.cyan(Zt(o.nanoCount/o.nanoBillingRatio))} nano`),n.push(k.bold(" Classified: ")+`${k.cyan(o.nanoCount)} nano \xB7 ${k.cyan(o.microCount)} micro \xB7 ${k.cyan(o.smallCount)} small \xB7 ${k.cyan(o.standardCount)} standard`);let l=Zt(o.billableProjectsRaw);n.push(k.bold(" Billable: ")+k.bold.white(l)+k.dim(` \xB7 ${o.totalScanned} detected \u2192 ${l} billable project${o.billableProjectsRaw===1?"":"s"} (micro-project pricing)`)),c.length>0&&n.push(k.dim(" ")+c.join(k.dim(" \xB7 "))),o.billableProjectsRaw!==Math.floor(o.billableProjectsRaw)&&n.push(k.dim(" These fractions add up across repositories, then round down to whole billable projects."));}if(t.vcs){let c=[t.vcs.type];t.vcs.branch&&c.push(t.vcs.branch),t.vcs.shortSha&&c.push(k.dim(t.vcs.shortSha)),n.push(k.bold(" VCS: ")+c.join(" "));}n.push("");let i=new Set(t.drift.measured??["runtime","framework","dependency","eol"]);n.push(" "+k.bold.underline("Score Breakdown")),n.push(` Runtime: ${i.has("runtime")?Cn(t.drift.components.runtimeScore):k.dim("n/a")}`),n.push(` Frameworks: ${i.has("framework")?Cn(t.drift.components.frameworkScore):k.dim("n/a")}`),n.push(` Dependencies: ${i.has("dependency")?Cn(t.drift.components.dependencyScore):k.dim("n/a")}`),n.push(` EOL Risk: ${i.has("eol")?Cn(t.drift.components.eolScore):k.dim("n/a")}`),n.push("");let a=[`Scanned at ${t.timestamp}`];if(t.durationMs!==void 0){let c=(t.durationMs/1e3).toFixed(1);a.push(`${c}s`);}return t.filesScanned!==void 0&&a.push(`${t.filesScanned} file${t.filesScanned!==1?"s":""} scanned`),t.treeSummary&&(a.push(`${t.treeSummary.totalFiles.toLocaleString()} workspace files`),a.push(`${t.treeSummary.totalDirs.toLocaleString()} dirs`)),n.push(k.dim(` ${a.join(" \xB7 ")}`)),n.push(""),e.free&&t.billing&&(n.push(...Nl(t.billing)),n.push("")),n.join(`
47
+ `)}var Oo=[0,25,100,300,500],Bo={team:[6,5,4,3.5],business:[15,12,10,8]};function Vo(t,e){let n=0;for(let r=0;r<4;r++){let s=Oo[r],o=r===3?1/0:Oo[r+1];t>s&&(n+=(Math.min(t,o)-s)*e[r]);}return Math.round(n*100)/100}function Do(t){return t===Math.floor(t)?`$${t}`:`$${t.toFixed(2)}`}function Nl(t){let e=t.billableProjectsRaw,n=Vo(e,Bo.team),r=Vo(e,Bo.business),s=Zt(e),o=["You're on Vibgrate Free \u2014 this scan ran locally and","isn't tracked over time.","",k.bold("Tracked monthly on Vibgrate Cloud, this repo would cost:"),` ${k.bold("Team")} ${k.bold.white(Do(n))} / mo`,` ${k.bold("Business")} ${k.bold.white(Do(r))} / mo`,k.dim(` (${s} billable project${e===1?"":"s"}, banded per-project pricing)`),"",k.bold("Vibgrate Cloud adds:"),` ${k.cyan("\u2022")} DriftScore tracked over time \u2014 trends, not snapshots`,` ${k.cyan("\u2022")} Scheduled scans that run automatically \u2014 no CI wiring`,` ${k.cyan("\u2022")} Alerts when drift crosses the budget you set`,"",k.dim("Free forever: 1 repository, 5 pushed scans / month."),`${k.bold("Start tracking:")} ${k.cyan("vg login")} \u2192 ${k.cyan("vg push")}`];return $l("KEEP TRACKING YOUR DRIFTSCORE",o,k.hex("#3FB0A4"),60)}function Rl(t){switch(t){case "low":return k.bgGreen.black(" LOW ");case "moderate":return k.bgYellow.black(" MODERATE ");case "high":return k.bgRed.white(" HIGH ");default:return t}}function Cn(t){return Al(t,20)}var Uo={frontend:"Frontend",metaFrameworks:"Meta-frameworks",bundlers:"Bundlers",css:"CSS / UI",backend:"Backend",orm:"ORM / Database",testing:"Testing",lintFormat:"Lint & Format",apiMessaging:"API & Messaging",observability:"Observability",payment:"Payment",auth:"Auth",email:"Email",cloud:"Cloud",databases:"Databases",messaging:"Messaging",crm:"CRM & Comms",storage:"Storage",search:"Search & AI"};function Il(t){let e=[];if(t.toolingInventory){let n=t.toolingInventory,r=Object.entries(n).filter(([,s])=>s.length>0);if(r.length>0){e.push(k.bold.underline(" Tech Stack"));for(let[s,o]of r){let i=Uo[s]??s,a=o.map(c=>k.white(c.name)).join(k.dim(", "));e.push(` ${k.cyan(i)}: ${a}`);}e.push("");}}if(t.serviceDependencies){let n=t.serviceDependencies,r=Object.entries(n).filter(([,s])=>s.length>0);if(r.length>0){e.push(k.bold.underline(" Services & Integrations"));for(let[s,o]of r){let i=Uo[s]??s,a=o.map(c=>{let l=c.version?k.dim(` ${c.version}`):"";return k.white(c.name)+l}).join(k.dim(", "));e.push(` ${k.cyan(i)}: ${a}`);}e.push("");}}if(t.breakingChangeExposure){let n=t.breakingChangeExposure;if(n.deprecatedPackages.length>0||n.legacyPolyfills.length>0){e.push(k.bold.underline(" Breaking Change Exposure"));let r=n.exposureScore>=40?k.red:n.exposureScore>=20?k.yellow:k.green;e.push(` Exposure Score: ${r.bold(`${n.exposureScore}/100`)}`),n.deprecatedPackages.length>0&&e.push(` ${k.red("Deprecated")}: ${n.deprecatedPackages.map(o=>k.dim(o)).join(", ")}`),n.legacyPolyfills.length>0&&e.push(` ${k.yellow("Polyfills")}: ${n.legacyPolyfills.map(o=>k.dim(o)).join(", ")}`),n.peerConflictsDetected&&e.push(` ${k.red("\u26A0")} Peer dependency conflicts detected`),e.push(` Recommendation: ${k.bold(n.overallRecommendation)}`);let s=n.projectIntelligence.filter(o=>o.packages.length>0).slice(0,3);if(s.length>0){e.push(" Major Upgrade Intelligence:");for(let o of s){e.push(` - ${o.project} (${o.recommendation})`);for(let i of o.packages.slice(0,2))e.push(` \xB7 ${i.package} ${i.currentVersion??"?"} \u2192 ${i.targetVersion??"?"} | touched ~${i.usage.touchedPercent}% | ${i.automatable}`);}}e.push("");}}if(t.tsModernity&&t.tsModernity.typescriptVersion){let n=t.tsModernity;e.push(k.bold.underline(" TypeScript"));let r=[];r.push(`v${n.typescriptVersion}`),n.strict===true?r.push(k.green("strict \u2714")):n.strict===false&&r.push(k.yellow("strict \u2716")),n.moduleType&&r.push(n.moduleType.toUpperCase()),n.target&&r.push(`target: ${n.target}`),e.push(` ${r.join(k.dim(" \xB7 "))}`),e.push("");}if(t.buildDeploy){let n=t.buildDeploy;(n.ci.length>0||n.docker.dockerfileCount>0||n.packageManagers.length>0)&&(e.push(k.bold.underline(" Build & Deploy")),n.ci.length>0&&e.push(` CI: ${n.ci.join(", ")}`),n.docker.dockerfileCount>0&&e.push(` Docker: ${n.docker.dockerfileCount} Dockerfile${n.docker.dockerfileCount!==1?"s":""} (${n.docker.baseImages.join(", ")})`),n.packageManagers.length>0&&e.push(` Package Managers: ${n.packageManagers.join(", ")}`),n.monorepoTools.length>0&&e.push(` Monorepo: ${n.monorepoTools.join(", ")}`),n.iac.length>0&&e.push(` IaC: ${n.iac.join(", ")}`),e.push(""));}if(t.uiPurpose){let n=t.uiPurpose;e.push(k.bold.underline(" Product Purpose Signals")),e.push(` Frameworks: ${n.detectedFrameworks.length>0?n.detectedFrameworks.join(", "):k.dim("unknown")}`),e.push(` Evidence: ${n.topEvidence.length}${n.capped?k.dim(` of ${n.evidenceCount} (capped)`):""}`);let r=n.topEvidence.slice(0,8);if(r.length>0){e.push(" Top Signals:");for(let s of r)e.push(` - [${s.kind}] ${s.value} ${k.dim(`(${s.file})`)}`);}if(n.unknownSignals.length>0){e.push(" Unknowns:");for(let s of n.unknownSignals.slice(0,4))e.push(` - ${k.yellow(s)}`);}e.push("");}if(t.securityPosture){let n=t.securityPosture;e.push(k.bold.underline(" Security Posture"));let r=[];r.push(n.lockfilePresent?k.green("Lockfile \u2714"):k.red("Lockfile \u2716")),r.push(n.gitignoreCoversEnv?k.green(".env \u2714"):k.red(".env \u2716")),r.push(n.gitignoreCoversNodeModules?k.green("node_modules \u2714"):k.yellow("node_modules \u2716")),n.multipleLockfileTypes&&r.push(k.yellow("Multiple lockfiles \u26A0")),n.envFilesTracked&&r.push(k.red("Env files tracked \u2716")),e.push(` ${r.join(k.dim(" \xB7 "))}`),e.push("");}if(t.platformMatrix){let n=t.platformMatrix;(n.nativeModules.length>0||n.dockerBaseImages.length>0)&&(e.push(k.bold.underline(" Platform")),n.nativeModules.length>0&&e.push(` Native modules: ${n.nativeModules.map(r=>k.dim(r)).join(", ")}`),n.osAssumptions.length>0&&e.push(` OS assumptions: ${n.osAssumptions.join(", ")}`),e.push(""));}if(t.codeQuality){let n=t.codeQuality;if(e.push(k.bold.underline(" Code Quality")),e.push(` Files: ${k.white(`${n.filesAnalyzed}`)} \xB7 Functions: ${k.white(`${n.functionsAnalyzed}`)} \xB7 Avg complexity: ${k.white(`${n.avgCyclomaticComplexity}`)} \xB7 Avg length: ${k.white(`${n.avgFunctionLength}`)} lines`),e.push(` Max nesting: ${n.maxNestingDepth} \xB7 Circular deps: ${n.circularDependencies} \xB7 Dead code: ${n.deadCodePercent}%`),n.godFiles.length>0){let r=n.godFiles.slice(0,3).map(s=>`${s.path} (${s.lines} lines)`).join(", ");e.push(` ${k.yellow("God files")}: ${r}`);}e.push("");}if(t.dependencyGraph){let n=t.dependencyGraph;n.lockfileType&&(e.push(k.bold.underline(" Dependency Graph")),e.push(` ${n.lockfileType}: ${k.white(`${n.totalUnique}`)} unique, ${k.white(`${n.totalInstalled}`)} installed`),n.duplicatedPackages.length>0&&e.push(` ${k.yellow(`${n.duplicatedPackages.length} duplicated`)} packages`),n.phantomDependencies.length>0&&e.push(` ${k.red(`${n.phantomDependencies.length} phantom`)} dependencies`),e.push(""));}return e}function _l(t){let e=[];if(e.push(...Tn("Architecture Layers")),e.push(""),e.push(k.bold(" Archetype: ")+`${t.archetype}`+k.dim(` (${Math.round(t.archetypeConfidence*100)}% confidence)`)),e.push(` Files classified: ${t.totalClassified}`+(t.unclassified>0?k.dim(` (${t.unclassified} unclassified)`):"")),e.push(""),t.layers.length>0){for(let n of t.layers){let r=n.riskLevel==="none"?k.dim("none"):n.riskLevel==="low"?k.green("low"):n.riskLevel==="moderate"?k.yellow("moderate"):k.red("high");e.push(` ${k.bold(n.layer)} ${n.fileCount} file${n.fileCount!==1?"s":""} drift ${Cn(n.driftScore)} risk ${r}`);}e.push("");}return e}function Fl(t){let e=[],n=t.projects.filter(i=>i.runtimeMajorsBehind!==void 0&&i.runtimeMajorsBehind>=3);if(n.length>0){let i=n.map(l=>l.name).join(", "),a="End-of-life runtimes no longer receive security patches and block ecosystem upgrades.",c=[];for(let l of n)c.push(`
48
48
  ./${l.path}`),c.push(`
49
49
  ${l.runtime} \u2192 ${l.runtimeLatest} (${l.runtimeMajorsBehind} major${l.runtimeMajorsBehind>1?"s":""} behind)`);a+=c.join(""),e.push({title:`Upgrade EOL runtime${n.length>1?"s":""} in ${i}`,explanation:a,impact:`\u2212${Math.min(n.length*10,30)} drift points (runtime & EOL)`,severity:100});}let r=[];for(let i of t.projects)for(let a of i.frameworks)a.majorsBehind!==null&&a.majorsBehind>=3&&r.push({name:a.name,fw:`${a.currentVersion} \u2192 ${a.latestVersion}`,behind:a.majorsBehind,project:i.name,projectPath:i.path});if(r.length>0){let i=r.sort((f,d)=>d.behind-f.behind)[0],a=r.length>1?` (+${r.length-1} more)`:"",c=`${i.behind} major versions behind. Major framework drift increases breaking change risk and blocks access to security fixes and performance improvements.`,l=[],u=0;for(let f of r){if(u>=8)break;l.push(`
50
50
  ./${f.projectPath}`),l.push(`
51
51
  ${f.name}: ${f.fw} (${f.behind} major${f.behind>1?"s":""} behind)`),u++;}let p=r.length-u;c+=l.join(""),p>0&&(c+=`
52
52
  ... and ${p} more`),e.push({title:`Upgrade ${i.name} ${i.fw} in ${i.project}${a}`,explanation:c,impact:"\u22125\u201315 drift points",severity:90});}for(let i of t.projects){let a=i.dependencyAgeBuckets,c=a.current+a.oneBehind+a.twoPlusBehind;if(c===0)continue;let l=Math.round(a.twoPlusBehind/c*100);if(l>=40){let u=`${a.twoPlusBehind} of ${c} dependencies are 2+ majors behind. Run \`npm outdated\` and prioritise packages with known CVEs or breaking API changes.`,p=i.dependencies.filter(f=>f.majorsBehind!==null&&f.majorsBehind>=2).sort((f,d)=>(d.majorsBehind??0)-(f.majorsBehind??0));if(p.length>0){let f=[],d=0;f.push(`
53
- ./${i.path}`);for(let g of p){if(d>=8)break;let v=g.resolvedVersion??g.currentSpec,w=g.latestStable??"?";f.push(`
54
- ${g.package}: ${v} \u2192 ${w} (${g.majorsBehind} major${g.majorsBehind>1?"s":""} behind)`),d++;}let h=p.length-d;u+=f.join(""),h>0&&(u+=`
53
+ ./${i.path}`);for(let g of p){if(d>=8)break;let v=g.resolvedVersion??g.currentSpec,S=g.latestStable??"?";f.push(`
54
+ ${g.package}: ${v} \u2192 ${S} (${g.majorsBehind} major${g.majorsBehind>1?"s":""} behind)`),d++;}let h=p.length-d;u+=f.join(""),h>0&&(u+=`
55
55
  ... and ${h} more`);}e.push({title:`Reduce dependency rot in ${i.name} (${l}% severely outdated)`,explanation:u,impact:"\u22125\u201310 drift points",severity:80+l/10});}}let s=[];for(let i of t.projects)for(let a of i.frameworks)a.majorsBehind===2&&s.push({name:a.name,project:i.name,projectPath:i.path,fw:`${a.currentVersion} \u2192 ${a.latestVersion}`});let o=[...new Map(s.map(i=>[i.name,i])).values()];if(o.length>0){let i=o.slice(0,3).map(f=>`${f.name} (${f.fw})`).join(", "),a=o.length>3?` +${o.length-3} more`:"",c="These frameworks are 2 major versions behind. Create upgrade tickets and check migration guides \u2014 the gap will widen with each new release.",l=[],u=0;for(let f of s){if(u>=8)break;l.push(`
56
56
  ./${f.projectPath}`),l.push(`
57
57
  ${f.name}: ${f.fw}`),u++;}let p=s.length-u;c+=l.join(""),p>0&&(c+=`
58
- ... and ${p} more`),e.push({title:`Plan major framework upgrades: ${i}${a}`,explanation:c,impact:"\u22125\u201310 drift points",severity:60});}if(t.extended?.breakingChangeExposure){let i=t.extended.breakingChangeExposure,a=i.deprecatedPackages.length+i.legacyPolyfills.length;if(a>0){let c=[...i.deprecatedPackages,...i.legacyPolyfills].slice(0,5).join(", "),l=a>5?` +${a-5} more`:"",u=`${a} package${a!==1?"s":""} are deprecated or legacy polyfills. These receive no updates and may have known vulnerabilities.`,p=new Set([...i.deprecatedPackages,...i.legacyPolyfills]),f=[],d=0;for(let g of t.projects){let v=g.dependencies.filter(w=>p.has(w.package));if(v.length!==0){if(d>=10)break;f.push(`
59
- ./${g.path}`);for(let w of v){if(d>=10)break;let j=w.resolvedVersion??w.currentSpec,P=i.deprecatedPackages.includes(w.package)?"deprecated":"polyfill";f.push(`
60
- ${w.package}: ${j} (${P})`),d++;}}}let h=a-d;u+=f.join(""),h>0&&(u+=`
58
+ ... and ${p} more`),e.push({title:`Plan major framework upgrades: ${i}${a}`,explanation:c,impact:"\u22125\u201310 drift points",severity:60});}if(t.extended?.breakingChangeExposure){let i=t.extended.breakingChangeExposure,a=i.deprecatedPackages.length+i.legacyPolyfills.length;if(a>0){let c=[...i.deprecatedPackages,...i.legacyPolyfills].slice(0,5).join(", "),l=a>5?` +${a-5} more`:"",u=`${a} package${a!==1?"s":""} are deprecated or legacy polyfills. These receive no updates and may have known vulnerabilities.`,p=new Set([...i.deprecatedPackages,...i.legacyPolyfills]),f=[],d=0;for(let g of t.projects){let v=g.dependencies.filter(S=>p.has(S.package));if(v.length!==0){if(d>=10)break;f.push(`
59
+ ./${g.path}`);for(let S of v){if(d>=10)break;let j=S.resolvedVersion??S.currentSpec,P=i.deprecatedPackages.includes(S.package)?"deprecated":"polyfill";f.push(`
60
+ ${S.package}: ${j} (${P})`),d++;}}}let h=a-d;u+=f.join(""),h>0&&(u+=`
61
61
  ... and ${h} more`),e.push({title:`Replace deprecated/legacy packages: ${c}${l}`,explanation:u,severity:55});}}if(t.extended?.dependencyGraph){let i=t.extended.dependencyGraph,a=i.phantomDependencies.length;if(a>=10){let c="Packages used in code but not declared in package.json. These rely on transitive installs and can break unpredictably when other packages update.",l=i.phantomDependencyDetails;if(l&&l.length>0){let u=new Map;for(let h of l)u.has(h.sourcePath)||u.set(h.sourcePath,[]),u.get(h.sourcePath).push({package:h.package,spec:h.spec});let p=[],f=0;for(let[h,g]of u){if(f>=10)break;p.push(`
62
62
  ./${h}`);for(let v of g){if(f>=10)break;p.push(`
63
63
  ${v.package}: ${v.spec}`),f++;}}let d=a-f;c+=p.join(""),d>0&&(c+=`
@@ -67,42 +67,42 @@ export default config;
67
67
  ./`,c+=`
68
68
  Missing: ${i.lockfileTypes.length>0?i.lockfileTypes.join(", ")+" (multiple types detected)":"package-lock.json, pnpm-lock.yaml, or yarn.lock"}`),e.push({title:`Fix security posture: ${a.join(", ")}`,explanation:c,severity:95});}}if(t.extended?.dependencyGraph){let a=t.extended.dependencyGraph.duplicatedPackages.filter(c=>c.versions.length>=3);if(a.length>=3){let c=`${a.length} packages have 3+ versions installed. Run \`npm dedupe\` to reduce bundle size and install time.`,l=[],u=0;for(let f of a){if(u>=8)break;l.push(`
69
69
  ${f.name}: ${f.versions.join(", ")} (${f.consumers} consumer${f.consumers!==1?"s":""})`),u++;}let p=a.length-u;c+=l.join(""),p>0&&(c+=`
70
- ... and ${p} more`),e.push({title:"Deduplicate heavily-versioned packages",explanation:c,severity:35});}}return e.sort((i,a)=>a.severity-i.severity),e.slice(0,5)}function Pl(t){let e=Ml(t.findings),n=t.findings.map(r=>$l(r));return {$schema:"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json",version:"2.1.0",runs:[{tool:{driver:{name:"vibgrate",version:t.vibgrateVersion,informationUri:"https://vibgrate.com",rules:e}},results:n,invocations:[{executionSuccessful:true,startTimeUtc:t.timestamp}]}]}}function Ml(t){return [...new Set(t.map(n=>n.ruleId))].map(n=>({"vibgrate/runtime-eol":{id:"vibgrate/runtime-eol",shortDescription:{text:"Runtime at or past end-of-life"},helpUri:"https://vibgrate.com/rules/runtime-eol"},"vibgrate/runtime-lag":{id:"vibgrate/runtime-lag",shortDescription:{text:"Runtime major version lag"},helpUri:"https://vibgrate.com/rules/runtime-lag"},"vibgrate/framework-major-lag":{id:"vibgrate/framework-major-lag",shortDescription:{text:"Framework major version behind latest"},helpUri:"https://vibgrate.com/rules/framework-major-lag"},"vibgrate/dependency-rot":{id:"vibgrate/dependency-rot",shortDescription:{text:"High percentage of outdated dependencies"},helpUri:"https://vibgrate.com/rules/dependency-rot"},"vibgrate/dependency-major-lag":{id:"vibgrate/dependency-major-lag",shortDescription:{text:"Individual dependency severely behind"},helpUri:"https://vibgrate.com/rules/dependency-major-lag"},"vibgrate/vulnerability":{id:"vibgrate/vulnerability",shortDescription:{text:"Known vulnerability in an installed dependency"},helpUri:"https://vibgrate.com/rules/vulnerability"}})[n]??{id:n,shortDescription:{text:n},helpUri:"https://vibgrate.com"})}function $l(t){return {ruleId:t.ruleId,level:t.level==="error"?"error":t.level==="warning"?"warning":"note",message:{text:t.message},locations:[{physicalLocation:{artifactLocation:{uri:t.location}}}],...t.details&&Object.keys(t.details).length>0?{properties:t.details}:{}}}function kn(t){return String(Number(t.toFixed(2)))}function Ll(t){let e=[],n=t.billing;if(e.push("# Vibgrate Drift Report"),e.push(""),e.push("| Metric | Value |"),e.push("|--------|-------|"),e.push(`| **Drift Score** | ${t.drift.score}/100 |`),e.push(`| **Risk Level** | ${t.drift.riskLevel.toUpperCase()} |`),e.push(`| **Projects** | ${t.projects.length} |`),n){let s=[];n.standardCount>0&&s.push(`${kn(n.standardCount)} standard`),n.smallCount>0&&s.push(`${kn(n.smallCount/n.smallBillingRatio)} small`),n.microCount>0&&s.push(`${kn(n.microCount/n.microBillingRatio)} micro`),n.nanoCount>0&&s.push(`${kn(n.nanoCount/n.nanoBillingRatio)} nano`);let o=kn(n.billableProjectsRaw);e.push(`| **Classification** | ${n.nanoCount} nano \xB7 ${n.microCount} micro \xB7 ${n.smallCount} small \xB7 ${n.standardCount} standard |`),e.push(`| **Billable Projects** | ${o} (${n.totalScanned} detected \u2192 ${o} billable${s.length>0?`; ${s.join(" \xB7 ")}`:""}) |`);}let r=[t.timestamp];t.durationMs!==void 0&&r.push(`${(t.durationMs/1e3).toFixed(1)}s`),t.filesScanned!==void 0&&r.push(`${t.filesScanned} files`),t.treeSummary&&r.push(`${t.treeSummary.totalFiles.toLocaleString()} workspace files \xB7 ${t.treeSummary.totalDirs.toLocaleString()} dirs`),e.push(`| **Scanned** | ${r.join(" \xB7 ")} |`),t.vcs&&(e.push(`| **VCS** | ${t.vcs.type} |`),t.vcs.branch&&e.push(`| **Branch** | ${t.vcs.branch} |`),t.vcs.sha&&e.push(`| **Commit** | \`${t.vcs.shortSha}\` |`)),e.push(""),e.push("## Score Breakdown"),e.push(""),e.push("| Component | Score |"),e.push("|-----------|-------|"),e.push(`| Runtime | ${t.drift.components.runtimeScore} |`),e.push(`| Frameworks | ${t.drift.components.frameworkScore} |`),e.push(`| Dependencies | ${t.drift.components.dependencyScore} |`),e.push(`| EOL Risk | ${t.drift.components.eolScore} |`),e.push(""),e.push("## Projects"),e.push("");for(let s of t.projects){if(e.push(`### ${s.name} (${s.type})`),e.push(""),s.runtime){let a=s.runtimeMajorsBehind!==void 0&&s.runtimeMajorsBehind>0?` \u2014 ${s.runtimeMajorsBehind} major(s) behind`:" \u2014 current";e.push(`- **Runtime:** ${s.runtime}${a}`);}if(s.frameworks.length>0){e.push("- **Frameworks:**");for(let a of s.frameworks){let c=a.majorsBehind!==null?a.majorsBehind===0?"current":`${a.majorsBehind} behind`:"unknown";e.push(` - ${a.name}: ${a.currentVersion??"?"} \u2192 ${a.latestVersion??"?"} (${c})`);}}let o=s.dependencyAgeBuckets;o.current+o.oneBehind+o.twoPlusBehind+o.unknown>0&&e.push(`- **Dependencies:** ${o.current} current, ${o.oneBehind} 1-behind, ${o.twoPlusBehind} 2+ behind, ${o.unknown} unknown`),e.push("");}if(t.extended?.uiPurpose){let s=t.extended.uiPurpose;if(e.push("## Product Purpose Signals"),e.push(""),e.push(`- **Frameworks:** ${s.detectedFrameworks.length>0?s.detectedFrameworks.join(", "):"unknown"}`),e.push(`- **Evidence Items:** ${s.topEvidence.length}${s.capped?` (capped from ${s.evidenceCount})`:""}`),s.topEvidence.length>0){e.push("- **Top Evidence:**");for(let o of s.topEvidence.slice(0,10))e.push(` - [${o.kind}] ${o.value} (${o.file})`);}if(s.unknownSignals.length>0){e.push("- **Unknowns:**");for(let o of s.unknownSignals.slice(0,5))e.push(` - ${o}`);}e.push("");}if(t.extended?.standards&&t.extended.standards.recommended.length>0){let s=t.extended.standards;e.push("## Recommended Standards"),e.push("");let o=s.projectPurposes.map(i=>`${i.project} \u2192 ${i.category}`).join(", ");if(o&&e.push(`- **Detected purpose:** ${o}`),s.frameworks.length>0){e.push("- **Compliance framework coverage:**");for(let i of s.frameworks)e.push(` - ${i.name}: ${i.recommendedMembers}/${i.totalMembers} member standards apply`);}e.push("- **Top standards to consider:**");for(let i of s.recommended.slice(0,10)){let a=i.complianceRelevant?" _(compliance)_":"";e.push(` - **${i.name}** \u2014 ${i.reason}${a}`);}e.push("");}if(t.findings.length>0){e.push("## Findings"),e.push(""),e.push("| Level | Rule | Message | Location |"),e.push("|-------|------|---------|----------|");for(let s of t.findings){let o=s.level==="error"?"\u{1F534}":s.level==="warning"?"\u{1F7E1}":"\u{1F535}";e.push(`| ${o} ${s.level} | ${s.ruleId} | ${s.message} | ${s.location} |`);}e.push("");}if(t.delta!==void 0){let s=t.delta>0?"\u{1F4C8}":t.delta<0?"\u{1F4C9}":"\u27A1\uFE0F";e.push(`## Drift Delta: ${s} ${t.delta>0?"+":""}${t.delta} vs baseline`),e.push("");}return e.join(`
71
- `)}var Rl=/^node_modules\/((?:@[^/]+\/)?[^/]+)$/;function Il(t){let e=new Map;if(!t||typeof t!="object")return e;let n=t;if(n.packages&&typeof n.packages=="object")for(let[r,s]of Object.entries(n.packages)){let o=s?.version;if(!o)continue;let i=Rl.exec(r);i&&e.set(i[1],o);}if(e.size===0&&n.dependencies&&typeof n.dependencies=="object")for(let[r,s]of Object.entries(n.dependencies)){let o=s?.version;o&&e.set(r,o);}return e}function _l(t){let e=t.indexOf("@",t.startsWith("@")?1:0);return e>0?t.slice(0,e):null}function Fl(t){let e=new Map,n=new Map,r=[];for(let s of t.split(`
72
- `))if(!(!s.trim()||s.trimStart().startsWith("#")))if(!/^\s/.test(s))r=s.replace(/:\s*$/,"").split(",").map(o=>o.trim().replace(/^"|"$/g,"")).filter(Boolean);else {let o=/^\s+version:?\s+"?([^"\s]+)"?/.exec(s);if(o&&r.length){let i=o[1];for(let a of r){let c=_l(a);c&&(e.set(a,i),n.set(c,i));}r=[];}}return {bySpec:e,byName:n}}function Ol(t){let e=t.split("(")[0].trim().replace(/^\/+/,""),n=e.lastIndexOf("@");return n>0&&/^\d/.test(e.slice(n+1))&&(e=e.slice(n+1)),/^\d/.test(e)?e:null}function Bl(t){let e=new Map;if(!t||typeof t!="object")return e;let n=t,r=s=>{if(!(!s||typeof s!="object"))for(let[o,i]of Object.entries(s)){let a=i&&typeof i=="object"?i.version:i;if(typeof a!="string")continue;let c=Ol(a);c&&!e.has(o)&&e.set(o,c);}};if(n.importers&&typeof n.importers=="object")for(let s of Object.values(n.importers)){let o=s;r(o?.dependencies),r(o?.devDependencies),r(o?.optionalDependencies);}return r(n.dependencies),r(n.devDependencies),r(n.optionalDependencies),e}async function Vl(t,e){let n=B.join(t,"pnpm-lock.yaml"),r=B.join(t,"yarn.lock"),s=B.join(t,"package-lock.json");if(await e.exists(n).catch(()=>false))try{let o=Bl(parse(await e.readText(n)));if(o.size)return {source:"pnpm",size:o.size,resolve:i=>o.get(i)??null}}catch{}if(await e.exists(s).catch(()=>false))try{let o=Il(await e.readJson(s));if(o.size)return {source:"package-lock",size:o.size,resolve:i=>o.get(i)??null}}catch{}if(await e.exists(r).catch(()=>false))try{let{bySpec:o,byName:i}=Fl(await e.readText(r));if(i.size)return {source:"yarn",size:i.size,resolve:(a,c)=>(c?o.get(`${a}@${c}`):void 0)??i.get(a)??null}}catch{}return null}async function Me(t,e){let n,r=new Promise(s=>{n=setTimeout(()=>s({ok:false}),e);});try{return await Promise.race([t.then(o=>({ok:!0,value:o})),r])}finally{clearTimeout(n);}}function Hl(t,e){return new Promise((n,r)=>{let s=spawn(t,e,{stdio:["ignore","pipe","pipe"]}),o="",i="";s.stdout.on("data",a=>o+=String(a)),s.stderr.on("data",a=>i+=String(a)),s.on("error",r),s.on("close",a=>{if(a!==0){r(new Error(`${t} ${e.join(" ")} failed (code=${a}): ${i.trim()}`));return}n(o);});})}async function pi(t,e){try{return JSON.parse(t)}catch{throw new Error(`Invalid JSON in package version manifest: ${e}`)}}async function zl(t){let e=await mkdtemp(B.join(Mn.tmpdir(),"vibgrate-manifest-"));try{await Hl("unzip",["-qq",t,"-d",e]);let n=[B.join(e,"package-versions.json"),B.join(e,"manifest.json"),B.join(e,"index.json")];for(let r of n)try{let s=await readFile(r,"utf8");return await pi(s,r)}catch{}throw new Error("Zip must contain package-versions.json, manifest.json, or index.json")}finally{await rm$1(e,{recursive:true,force:true});}}async function Wl(t){let e=B.resolve(t);if(e.toLowerCase().endsWith(".zip"))return zl(e);let n=await readFile(e,"utf8");return pi(n,e)}function W(t,e,n){if(!t)return;let r=t[e];if(r)return e==="nuget"?r[n.toLowerCase()]??r[n]:r[n]}function An(t){return t.filter(e=>ft.valid(e)&&ft.prerelease(e)===null)}function mr(t){let e=An(t);return e.length===0?null:e.sort(ft.rcompare)[0]??null}function Jl(t){if(!t||typeof t!="object")return;let e={};for(let[n,r]of Object.entries(t))n==="created"||n==="modified"||typeof r=="string"&&(e[n]=r);return Object.keys(e).length>0?e:void 0}function ar(t){let e=null,n=[],r=null,s;if(t&&typeof t=="object"){let a=t,c=a["dist-tags.latest"];typeof c=="string"&&(e=c);let l=a["dist-tags"];!e&&l&&typeof l=="object"&&typeof l.latest=="string"&&(e=l.latest);let u=a.versions;Array.isArray(u)?n=u.map(String):typeof u=="string"&&(n=[u]),r=fi(a.license??a.licenses),s=Jl(a.time);}let o=An(n),i=mr(o);return !e&&i&&(e=i),{latest:e,stableVersions:o,latestStableOverall:i,license:r,...s?{releaseDates:s}:{}}}function fi(t){if(!t)return null;if(typeof t=="string")return t.trim()||null;if(Array.isArray(t)){let e=t.map(fi).filter(n=>!!n);return e.length===0?null:e.length===1?e[0]:`(${e.join(" OR ")})`}if(typeof t=="object"){let e=t;if(typeof e.type=="string")return e.type.trim()||null;if(typeof e.spdx=="string")return e.spdx.trim()||null}return null}var Kl=24,Yl=7e3,Xl=3e4,Ql=process.platform==="win32"?"npm.cmd":"npm";function Zl(t,e=process.platform){let n=e==="win32"?Yl:Xl,r=[],s=[],o=0;for(let i of t){let a=i.length+1;(s.length>=Kl||s.length>0&&o+a>n)&&(r.push(s),s=[],o=0),s.push(i),o+=a;}return s.length>0&&r.push(s),r}async function Cn(t,e){return new Promise((n,r)=>{let s=spawn(Ql,["view",...t,"--json"],{cwd:e,stdio:["ignore","pipe","pipe"]}),o="",i="";s.stdout.on("data",a=>o+=String(a)),s.stderr.on("data",a=>i+=String(a)),s.on("error",r),s.on("close",a=>{if(a!==0){r(new Error(`npm view ${t.join(" ")} failed (code=${a}): ${i.trim()}`));return}let c=o.trim();if(!c){n(null);return}try{n(JSON.parse(c));}catch{n(c.replace(/^"|"$/g,""));}});})}var eu=class{constructor(t,e,n,r=false){this.cwd=t,this.sem=e,this.manifest=n,this.offline=r;}meta=new Map;async prefetch(t){let n=[...new Set(t.filter(Boolean))].filter(s=>!this.meta.has(s));if(n.length===0)return;let r=this.sem.run(()=>this.fetchBatch(n));for(let s of n){let o=r.then(i=>i.get(s)??{latest:null,stableVersions:[],latestStableOverall:null,license:null});this.meta.set(s,o);}await r;}get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(()=>this.fetchOne(t));return this.meta.set(t,n),n}async fetchBatch(t){let e=new Map,n=[];for(let r of t){let s=W(this.manifest,"npm",r);if(s){let o=An(s.versions??[]),i=mr(o);e.set(r,{latest:s.latest??i,stableVersions:o,latestStableOverall:i,license:s.license??null,...s.releaseDates?{releaseDates:s.releaseDates}:{}});}else this.offline?e.set(r,{latest:null,stableVersions:[],latestStableOverall:null,license:null}):n.push(r);}if(n.length===0)return e;for(let r of Zl(n)){let s=await this.fetchRemoteChunk(r);for(let[o,i]of s)e.set(o,i);}return e}async fetchRemoteChunk(t){let e=new Map;if(t.length===1)return e.set(t[0],await this.fetchOneRemote(t[0])),e;try{let n=await Cn([...t,"dist-tags.latest","versions","license","licenses","time"],this.cwd);if(Array.isArray(n))for(let r=0;r<n.length&&r<t.length;r++)e.set(t[r],ar(n[r]));else if(n&&typeof n=="object"){let r=n,s=0;for(let o of t)o in r&&(e.set(o,ar(r[o])),s++);s===0&&t.length===1&&e.set(t[0],ar(r));}}catch{}for(let n of t)e.has(n)||e.set(n,await this.fetchOneRemote(n));return e}async fetchOne(t){let e=W(this.manifest,"npm",t);if(e){let n=An(e.versions??[]),r=mr(n);return {latest:e.latest??r,stableVersions:n,latestStableOverall:r,license:e.license??null,...e.releaseDates?{releaseDates:e.releaseDates}:{}}}return this.offline?{latest:null,stableVersions:[],latestStableOverall:null,license:null}:this.fetchOneRemote(t)}async fetchOneRemote(t){try{let e=await Cn([t,"dist-tags.latest","versions","license","licenses","time"],this.cwd);return ar(e)}catch{let e=null,n=[];try{let o=await Cn([t,"dist-tags"],this.cwd);o&&typeof o=="object"&&typeof o.latest=="string"&&(e=o.latest);}catch{}try{let o=await Cn([t,"versions"],this.cwd);Array.isArray(o)?n=o.map(String):typeof o=="string"&&(n=[o]);}catch{}let r=An(n),s=mr(r);return !e&&s&&(e=s),{latest:e,stableVersions:r,latestStableOverall:s,license:null}}}};async function tu(t){try{let e=new AbortController,n=setTimeout(()=>e.abort(),5e3),r=await fetch("https://registry.npmjs.org/npm/latest",{method:"HEAD",signal:e.signal});return clearTimeout(n),r.ok}catch{try{let e=await Cn(["npm","dist-tags.latest"],t);return typeof e=="string"&&e.length>0}catch{return false}}}function di(t){let e=t.trim();return !e||e.startsWith("workspace:")||e.startsWith("file:")||e.startsWith("link:")||e.startsWith("git+")||e.includes("://")||e.startsWith("github:")?false:e==="*"||e.toLowerCase()==="latest"?true:ft.validRange(e)!==null}function mi(t){switch(t){case "public-domain":case "permissive":return "low";case "weak-copyleft":return "medium";case "copyleft":case "network-copyleft":case "proprietary":return "high";default:return "medium"}}var hi={attribution:false,copyleft:false,networkCopyleft:false,discloseSource:false,patentGrant:false,commercialRestriction:false};function nu(t){return {spdxId:t.id,name:t.name,family:t.family,category:t.category,osiApproved:t.osi??false,fsfLibre:t.fsf??false,deprecated:t.deprecated??false,referenceUrl:t.url??`https://spdx.org/licenses/${t.id}.html`,riskLevel:mi(t.category),obligations:{...hi,...t.obligations??{}}}}var X={attribution:true},ru={attribution:true,patentGrant:true},ue={attribution:true,copyleft:true,discloseSource:true},at={attribution:true,copyleft:true,discloseSource:true},cr={attribution:true,copyleft:true,networkCopyleft:true,discloseSource:true},su=[{id:"CC0-1.0",name:"Creative Commons Zero v1.0 Universal",family:"CC",category:"public-domain",fsf:true},{id:"Unlicense",name:"The Unlicense",family:"Public Domain",category:"public-domain",osi:true,fsf:true},{id:"0BSD",name:"BSD Zero Clause License",family:"BSD",category:"permissive",osi:true},{id:"WTFPL",name:"Do What The F*ck You Want To Public License",family:"WTFPL",category:"permissive",fsf:true},{id:"MIT",name:"MIT License",family:"MIT",category:"permissive",osi:true,fsf:true,obligations:X},{id:"MIT-0",name:"MIT No Attribution",family:"MIT",category:"permissive",osi:true},{id:"ISC",name:"ISC License",family:"ISC",category:"permissive",osi:true,fsf:true,obligations:X},{id:"BSD-2-Clause",name:'BSD 2-Clause "Simplified" License',family:"BSD",category:"permissive",osi:true,fsf:true,obligations:X},{id:"BSD-3-Clause",name:'BSD 3-Clause "New" or "Revised" License',family:"BSD",category:"permissive",osi:true,fsf:true,obligations:X},{id:"BSD-3-Clause-Clear",name:"BSD 3-Clause Clear License",family:"BSD",category:"permissive",osi:true,obligations:X},{id:"Apache-2.0",name:"Apache License 2.0",family:"Apache",category:"permissive",osi:true,fsf:true,obligations:ru},{id:"Apache-1.1",name:"Apache Software License 1.1",family:"Apache",category:"permissive",osi:true,obligations:X},{id:"Zlib",name:"zlib License",family:"Zlib",category:"permissive",osi:true,fsf:true},{id:"BSL-1.0",name:"Boost Software License 1.0",family:"Boost",category:"permissive",osi:true,fsf:true,obligations:X},{id:"PostgreSQL",name:"PostgreSQL License",family:"BSD",category:"permissive",osi:true,obligations:X},{id:"Python-2.0",name:"Python License 2.0",family:"Python",category:"permissive",osi:true,obligations:X},{id:"PSF-2.0",name:"Python Software Foundation License 2.0",family:"Python",category:"permissive",obligations:X},{id:"Artistic-2.0",name:"Artistic License 2.0",family:"Artistic",category:"permissive",osi:true,fsf:true,obligations:X},{id:"NCSA",name:"University of Illinois/NCSA Open Source License",family:"NCSA",category:"permissive",osi:true,fsf:true,obligations:X},{id:"Unicode-DFS-2016",name:"Unicode License Agreement - Data Files and Software (2016)",family:"Unicode",category:"permissive",osi:true,obligations:X},{id:"BlueOak-1.0.0",name:"Blue Oak Model License 1.0.0",family:"BlueOak",category:"permissive",obligations:X},{id:"LGPL-2.0-only",name:"GNU Library General Public License v2 only",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:ue},{id:"LGPL-2.1-only",name:"GNU Lesser General Public License v2.1 only",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:ue},{id:"LGPL-2.1-or-later",name:"GNU Lesser General Public License v2.1 or later",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:ue},{id:"LGPL-3.0-only",name:"GNU Lesser General Public License v3.0 only",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...ue,patentGrant:true}},{id:"LGPL-3.0-or-later",name:"GNU Lesser General Public License v3.0 or later",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...ue,patentGrant:true}},{id:"MPL-2.0",name:"Mozilla Public License 2.0",family:"MPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...ue,patentGrant:true}},{id:"MPL-1.1",name:"Mozilla Public License 1.1",family:"MPL",category:"weak-copyleft",osi:true,fsf:true,obligations:ue},{id:"EPL-1.0",name:"Eclipse Public License 1.0",family:"EPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...ue,patentGrant:true}},{id:"EPL-2.0",name:"Eclipse Public License 2.0",family:"EPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...ue,patentGrant:true}},{id:"CDDL-1.0",name:"Common Development and Distribution License 1.0",family:"CDDL",category:"weak-copyleft",osi:true,fsf:true,obligations:ue},{id:"CDDL-1.1",name:"Common Development and Distribution License 1.1",family:"CDDL",category:"weak-copyleft",obligations:ue},{id:"CPL-1.0",name:"Common Public License 1.0",family:"CPL",category:"weak-copyleft",osi:true,fsf:true,obligations:ue},{id:"MS-PL",name:"Microsoft Public License",family:"Microsoft",category:"weak-copyleft",osi:true,fsf:true,obligations:X},{id:"MS-RL",name:"Microsoft Reciprocal License",family:"Microsoft",category:"weak-copyleft",osi:true,fsf:true,obligations:ue},{id:"GPL-2.0-only",name:"GNU General Public License v2.0 only",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:at},{id:"GPL-2.0-or-later",name:"GNU General Public License v2.0 or later",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:at},{id:"GPL-3.0-only",name:"GNU General Public License v3.0 only",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:{...at,patentGrant:true}},{id:"GPL-3.0-or-later",name:"GNU General Public License v3.0 or later",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:{...at,patentGrant:true}},{id:"EUPL-1.1",name:"European Union Public License 1.1",family:"EUPL",category:"copyleft",osi:true,fsf:true,obligations:at},{id:"EUPL-1.2",name:"European Union Public License 1.2",family:"EUPL",category:"copyleft",osi:true,fsf:true,obligations:at},{id:"OSL-3.0",name:"Open Software License 3.0",family:"OSL",category:"copyleft",osi:true,fsf:true,obligations:{...at,patentGrant:true}},{id:"CECILL-2.1",name:"CeCILL Free Software License Agreement v2.1",family:"CeCILL",category:"copyleft",osi:true,fsf:true,obligations:at},{id:"CC-BY-SA-4.0",name:"Creative Commons Attribution Share Alike 4.0 International",family:"CC",category:"copyleft",obligations:{attribution:true,copyleft:true}},{id:"AGPL-3.0-only",name:"GNU Affero General Public License v3.0 only",family:"AGPL",category:"network-copyleft",osi:true,fsf:true,obligations:{...cr,patentGrant:true}},{id:"AGPL-3.0-or-later",name:"GNU Affero General Public License v3.0 or later",family:"AGPL",category:"network-copyleft",osi:true,fsf:true,obligations:{...cr,patentGrant:true}},{id:"SSPL-1.0",name:"Server Side Public License 1.0",family:"SSPL",category:"network-copyleft",obligations:cr},{id:"BUSL-1.1",name:"Business Source License 1.1",family:"BUSL",category:"proprietary",obligations:{commercialRestriction:true,discloseSource:true}},{id:"Elastic-2.0",name:"Elastic License 2.0",family:"Elastic",category:"proprietary",obligations:{commercialRestriction:true}},{id:"RPL-1.5",name:"Reciprocal Public License 1.5",family:"RPL",category:"network-copyleft",osi:true,obligations:cr},{id:"Commons-Clause",name:"Commons Clause License Condition v1.0",family:"Commons-Clause",category:"proprietary",obligations:{commercialRestriction:true}},{id:"LicenseRef-Proprietary",name:"Proprietary / Commercial",family:"Proprietary",category:"proprietary",obligations:{commercialRestriction:true}},{id:"CC-BY-NC-4.0",name:"Creative Commons Attribution Non Commercial 4.0 International",family:"CC",category:"proprietary",obligations:{attribution:true,commercialRestriction:true}},{id:"CC-BY-4.0",name:"Creative Commons Attribution 4.0 International",family:"CC",category:"permissive",obligations:X}],ou=su.map(nu),gi=new Map;for(let t of ou)gi.set(t.spdxId.toLowerCase(),t);function z(t){return gi.get(t.trim().toLowerCase())}function hr(t="Unknown"){return {spdxId:"NOASSERTION",name:t,family:"Unknown",category:"unknown",osiApproved:false,fsfLibre:false,deprecated:false,referenceUrl:"",riskLevel:"medium",obligations:{...hi}}}function yi(t){return t.trim().toLowerCase().replace(/^\(+|\)+$/g,"").replace(/[._]/g,"-").replace(/\s+/g," ").replace(/\s*-\s*/g,"-").replace(/\bversion\b/g,"v").replace(/\blicen[sc]e\b/g,"").replace(/\s+/g," ").trim()}var iu={mit:"MIT","mit license":"MIT","the mit license":"MIT",expat:"MIT",isc:"ISC",apache:"Apache-2.0","apache 2":"Apache-2.0",apache2:"Apache-2.0","apache 2.0":"Apache-2.0","apache-2":"Apache-2.0","apache license 2.0":"Apache-2.0","apache license version 2.0":"Apache-2.0","asl 2.0":"Apache-2.0",al2:"Apache-2.0",bsd:"BSD-3-Clause","bsd license":"BSD-3-Clause","bsd-2":"BSD-2-Clause","bsd 2-clause":"BSD-2-Clause","simplified bsd":"BSD-2-Clause",freebsd:"BSD-2-Clause","bsd-3":"BSD-3-Clause","bsd 3-clause":"BSD-3-Clause","new bsd":"BSD-3-Clause","modified bsd":"BSD-3-Clause","revised bsd":"BSD-3-Clause",gpl:"GPL-3.0-or-later",gplv2:"GPL-2.0-only",gpl2:"GPL-2.0-only","gpl-2":"GPL-2.0-only","gpl 2.0":"GPL-2.0-only","gpl-2.0":"GPL-2.0-only","gpl-2.0+":"GPL-2.0-or-later","gnu gpl v2":"GPL-2.0-only",gplv3:"GPL-3.0-only",gpl3:"GPL-3.0-only","gpl-3":"GPL-3.0-only","gpl 3.0":"GPL-3.0-only","gpl-3.0":"GPL-3.0-only","gpl-3.0+":"GPL-3.0-or-later","gnu gpl v3":"GPL-3.0-only","gnu general public v3":"GPL-3.0-only",lgpl:"LGPL-3.0-or-later","lgplv2.1":"LGPL-2.1-only","lgpl-2.1":"LGPL-2.1-only","lgpl 2.1":"LGPL-2.1-only",lgplv3:"LGPL-3.0-only","lgpl-3":"LGPL-3.0-only","lgpl-3.0":"LGPL-3.0-only","lgpl 3.0":"LGPL-3.0-only",agpl:"AGPL-3.0-or-later",agplv3:"AGPL-3.0-only","agpl-3":"AGPL-3.0-only","agpl-3.0":"AGPL-3.0-only","agpl 3.0":"AGPL-3.0-only","gnu agpl v3":"AGPL-3.0-only",mpl:"MPL-2.0","mpl 2.0":"MPL-2.0","mpl-2":"MPL-2.0","mozilla public 2.0":"MPL-2.0",epl:"EPL-2.0","eclipse public 2.0":"EPL-2.0","epl-2":"EPL-2.0",sspl:"SSPL-1.0","server side public":"SSPL-1.0",busl:"BUSL-1.1","business source":"BUSL-1.1",elastic:"Elastic-2.0","elastic-2":"Elastic-2.0","commons clause":"Commons-Clause",proprietary:"LicenseRef-Proprietary",commercial:"LicenseRef-Proprietary","see license in license":"LicenseRef-Proprietary",unlicensed:"LicenseRef-Proprietary","all rights reserved":"LicenseRef-Proprietary",cc0:"CC0-1.0","cc0 1.0":"CC0-1.0","public domain":"CC0-1.0","the unlicense":"Unlicense",wtfpl:"WTFPL",boost:"BSL-1.0",bsl:"BSL-1.0","zlib/libpng":"Zlib",python:"Python-2.0",psf:"PSF-2.0",artistic:"Artistic-2.0"},vi=new Map;for(let[t,e]of Object.entries(iu))vi.set(yi(t),e);function bi(t){return vi.get(yi(t))}var au=/\(|\)|\bWITH\b|\bAND\b|\bOR\b|[^\s()]+/gi;function cu(t){let e=(t??"").trim(),n=[],r=[],s=false,o=false,i=false,a=false,c=e.match(au)??[];for(let u of c){let p=u.toUpperCase();if(u==="("||u===")")continue;if(p==="OR"){s=true,a=false;continue}if(p==="AND"){o=true,a=false;continue}if(p==="WITH"){a=true;continue}if(a){r.includes(u)||r.push(u),a=false;continue}let f=u;f.endsWith("+")&&(i=true,f=f.slice(0,-1)),f&&!n.includes(f)&&n.push(f);}let l=s?"OR":o?"AND":"SINGLE";return {licenseIds:n,exceptions:r,operator:l,orLater:i,normalized:lu(n,r,l,i,e)}}function lu(t,e,n,r,s){if(t.length===0)return s.trim();if(t.length===1){let i=t[0];return r&&!i.endsWith("+")&&(i+="+"),e.length>0&&(i+=` WITH ${e.join(" WITH ")}`),i}let o=n==="AND"?" AND ":" OR ";return t.join(o)}function uu(t){return /\b(?:AND|OR|WITH)\b|\+\s*$|\(/i.test(t)}var Oo={"public-domain":0,permissive:1,"weak-copyleft":2,copyleft:3,"network-copyleft":4,proprietary:5,unknown:2};function Ce(t,e,n,r,s){return {spdxId:t.spdxId,name:t.name,expression:r??t.spdxId,family:t.family,category:t.category,riskLevel:t.riskLevel,osiApproved:t.osiApproved,fsfLibre:t.fsfLibre,obligations:t.obligations,matchStatus:e,confidence:n,components:s??[t.spdxId]}}function wi(t){let e=t.toLowerCase();if(/\bagpl/.test(e))return z("AGPL-3.0-or-later");if(/\bsspl/.test(e))return z("SSPL-1.0");if(/\bbusl|business source/.test(e))return z("BUSL-1.1");if(/\blgpl/.test(e))return z("LGPL-3.0-or-later");if(/\bgpl/.test(e))return z("GPL-3.0-or-later");if(/\bmpl|mozilla/.test(e))return z("MPL-2.0");if(/\bepl|eclipse/.test(e))return z("EPL-2.0");if(/\bapache/.test(e))return z("Apache-2.0");if(/\bbsd/.test(e))return z("BSD-3-Clause");if(/\bmit\b/.test(e))return z("MIT");if(/\bisc\b/.test(e))return z("ISC");if(/commons clause/.test(e))return z("Commons-Clause");if(/proprietary|commercial|all rights reserved/.test(e))return z("LicenseRef-Proprietary");if(/public domain|cc0/.test(e))return z("CC0-1.0")}function pu(t){let e=(t??"").trim();if(!e||/^(unknown|noassertion|none|n\/a)$/i.test(e))return Ce(hr(),"unknown",0);let n=z(e);if(n)return Ce(n,"exact",1);if(uu(e))return fu(e);let r=bi(e);if(r){let o=z(r);if(o)return Ce(o,"alias",.95)}let s=wi(e);return s?{...Ce(s,"fuzzy",.6),name:e.slice(0,120)}:Ce(hr(e.slice(0,120)),"unknown",0)}function fu(t){let e=cu(t);if(e.licenseIds.length===0)return Ce(hr(t.slice(0,120)),"unknown",0);let n=e.licenseIds.map(c=>{let l=z(c);if(l)return Ce(l,"exact",1);let u=bi(c);if(u){let f=z(u);if(f)return Ce(f,"alias",.95)}let p=wi(c);return p?Ce(p,"fuzzy",.6):Ce(hr(c),"unknown",0)}),r=e.operator!=="OR",s=n[0];for(let c of n){let l=Oo[c.category]>Oo[s.category];(r?l:!l)&&(s=c);}let o=du(r?n:[s]),i=n.map(c=>c.spdxId),a=s.category;return {spdxId:s.spdxId,name:e.normalized,expression:e.normalized,family:s.family,category:a,riskLevel:mi(a),osiApproved:n.every(c=>c.osiApproved),fsfLibre:n.every(c=>c.fsfLibre),obligations:o,matchStatus:"expression",confidence:Math.min(...n.map(c=>c.confidence))||.5,components:i}}function du(t){let e={attribution:false,copyleft:false,networkCopyleft:false,discloseSource:false,patentGrant:false,commercialRestriction:false};for(let n of t)e.attribution||=n.obligations.attribution,e.copyleft||=n.obligations.copyleft,e.networkCopyleft||=n.obligations.networkCopyleft,e.discloseSource||=n.obligations.discloseSource,e.patentGrant||=n.obligations.patentGrant,e.commercialRestriction||=n.obligations.commercialRestriction;return e}function mu(t,e){let n=(t??"").trim();if(!n)return {raw:null,spdxId:null,source:"none",confidence:0};let r=pu(n);return {raw:n.slice(0,200),spdxId:r.matchStatus==="unknown"?null:r.spdxId,source:e,confidence:r.confidence}}var Bo={react:"React","react-dom":"React DOM",vue:"Vue","@angular/core":"Angular",svelte:"Svelte","solid-js":"Solid",preact:"Preact",lit:"Lit",qwik:"Qwik","htmx.org":"htmx",alpinejs:"Alpine.js",stimulus:"Stimulus",next:"Next.js",nuxt:"Nuxt","@remix-run/react":"Remix","@remix-run/node":"Remix (Node)",gatsby:"Gatsby",astro:"Astro","@sveltejs/kit":"SvelteKit","@analogjs/platform":"Analog","@tanstack/start":"TanStack Start",express:"Express",fastify:"Fastify","@nestjs/core":"NestJS",hono:"Hono",koa:"Koa","@hapi/hapi":"Hapi",restify:"Restify","@elysiajs/eden":"Elysia",elysia:"Elysia","@adonisjs/core":"AdonisJS",moleculer:"Moleculer","@feathersjs/feathers":"Feathers",sails:"Sails",typescript:"TypeScript",redux:"Redux","@reduxjs/toolkit":"Redux Toolkit",zustand:"Zustand",mobx:"MobX",jotai:"Jotai",recoil:"Recoil",pinia:"Pinia",vuex:"Vuex","@tanstack/react-query":"TanStack Query",swr:"SWR",xstate:"XState","@ngrx/store":"NgRx",prisma:"Prisma","drizzle-orm":"Drizzle",typeorm:"TypeORM",sequelize:"Sequelize","@mikro-orm/core":"MikroORM",mongoose:"Mongoose",knex:"Knex",kysely:"Kysely",objection:"Objection.js",vite:"Vite",webpack:"webpack",rollup:"Rollup",esbuild:"esbuild",parcel:"Parcel",turbo:"Turbo",tsup:"tsup","@swc/core":"SWC",bun:"Bun",vitest:"Vitest",jest:"Jest","@playwright/test":"Playwright",cypress:"Cypress",mocha:"Mocha",ava:"AVA",storybook:"Storybook","@storybook/react":"Storybook"};async function hu(t,e,n$1,r,s=Ne){let o$1=n$1?await n$1.findPackageJsonFiles(t):await j(t),i=[],a=new Map,c;try{let w=n$1?P=>n$1.pathExists(P):p,j=B.join(t,"package.json");if(await w(j))try{let P=n$1?await n$1.readJsonFile(j):await n(j);if(P.packageManager){let C=P.packageManager.split("@")[0]?.toLowerCase();C&&["pnpm","yarn","npm","bun"].includes(C)&&(c=C);}}catch{}c||await w(B.join(t,"pnpm-workspace.yaml"))&&(c="pnpm"),c||(await w(B.join(t,"pnpm-lock.yaml"))?c="pnpm":await w(B.join(t,"yarn.lock"))?c="yarn":await w(B.join(t,"package-lock.json"))?c="npm":await w(B.join(t,"bun.lockb"))&&(c="bun"));}catch{}let u=await Vl(t,{exists:w=>n$1?n$1.pathExists(w):p(w),readText:w=>n$1?n$1.readTextFile(w):o(w),readJson:w=>n$1?n$1.readJsonFile(w):n(w)}).catch(()=>null),p$1=r??n$1?.projectScanTimeout??18e4,f=typeof Mn.availableParallelism=="function"?Mn.availableParallelism():Mn.cpus().length||4,d=Math.max(2,Math.min(16,f*2)),h=new a$1(d),g=new Set;if(await Promise.all(o$1.map(async w=>{try{let j=n$1?await n$1.readJsonFile(w):await n(w),P=[j.dependencies,j.devDependencies,j.peerDependencies,j.optionalDependencies];for(let C of P)if(C)for(let[x,y]of Object.entries(C))di(y)&&g.add(x);}catch{}})),g.size>0)try{await e.prefetch([...g]);}catch{}let v=await Promise.all(o$1.map(async w=>h.run(async()=>{try{let j=gu(w,t,e,n$1,s,u),P=await Me(j,p$1);if(P.ok)return P.value;let C=B.relative(t,B.dirname(w));return n$1&&n$1.addStuckPath(C||"."),console.error(`Timeout scanning ${w} (>${p$1/1e3}s) \u2014 skipped`),n$1?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects"),null}catch(j){let P=j instanceof Error?j.message:String(j);return console.error(`Error scanning ${w}: ${P}`),null}})));for(let w of v)w&&(i.push(w),a.set(w.name,w.path));for(let w of i){let j=[];for(let P of w.dependencies){let C=a.get(P.package);C&&C!==w.path&&j.push({path:C,name:P.package,refType:"workspace"});}j.length>0&&(w.projectReferences=j),c&&(w.packageManager=c);}return i}async function gu(t,e,n$1,r,s,o=null){let i=r?await r.readJsonFile(t):await n(t),a=B.dirname(t),c=B.relative(e,a)||".",l=i.engines?.node??void 0,u,p,f,d;if(l){let y=Mr(s,"nodejs"),b=de.minVersion(l);if(y&&b){let T=de.major(b);u=`${y.major}.0.0`,p=Math.max(0,y.major-T);}f=yt(s,"node",l);let k=it("node",l);k&&(d=gt(s,"nodejs",k));}let h=[{name:"dependencies",deps:i.dependencies},{name:"devDependencies",deps:i.devDependencies},{name:"peerDependencies",deps:i.peerDependencies},{name:"optionalDependencies",deps:i.optionalDependencies}],g=[],v=[],w={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=[];for(let y of h)if(y.deps)for(let[b,k]of Object.entries(y.deps))di(k)&&j.push({pkg:b,section:y.name,spec:k});await n$1.prefetch(j.map(y=>y.pkg));let P=j.map(async y=>{let b=await n$1.get(y.pkg);return {...y,meta:b}}),C=await Promise.all(P);for(let{pkg:y,section:b,spec:k,meta:T}of C){let m=o?.resolve(y,k)??null,A=T.stableVersions.length>0?de.maxSatisfying(T.stableVersions,k)??null:null,$=m&&de.valid(m)?m:A,L=T.latestStableOverall,I=null,V="unknown";if($&&L){let cn=de.major($);I=de.major(L)-cn,I===0?V=de.eq($,L)?"current":"minor-behind":V="major-behind",I===0?w.current++:I===1?w.oneBehind++:w.twoPlusBehind++;}else w.unknown++;let pe=Qc($,L,T.releaseDates),H=Zc(pe);g.push({package:y,section:b,currentSpec:k,resolvedVersion:$,latestStable:L,majorsBehind:I,drift:V,license:mu(T.license,"registry"),ageDays:pe,libyears:H}),y in Bo&&v.push({name:Bo[y],currentVersion:$,latestVersion:L,majorsBehind:I});}for(let y of h)if(y.deps)for(let[b,k]of Object.entries(y.deps))k.trim().startsWith("workspace:")&&(g.push({package:b,section:y.name,currentSpec:k,resolvedVersion:null,latestStable:null,majorsBehind:null,drift:"unknown",license:{raw:null,spdxId:null,source:"none",confidence:0}}),w.unknown++);g.sort((y,b)=>{let k={"major-behind":0,"minor-behind":1,current:2,unknown:3},T=(k[y.drift]??9)-(k[b.drift]??9);return T!==0?T:y.package.localeCompare(b.package)});let x;try{x=r?await r.countFilesUnder(e,a):void 0;}catch{}return {type:"node",path:c,name:i.name??B.basename(a),runtime:l,runtimeLatest:u,runtimeMajorsBehind:p,runtimeEol:f,runtimeEolDate:d,frameworks:v,dependencies:g,dependencyAgeBuckets:w,libyears:el(g.map(y=>y.libyears))??void 0,fileCount:x}}var Si=new je({ignoreAttributes:false,attributeNamePrefix:"@_"}),Vo={"Microsoft.AspNetCore.App":"ASP.NET Core","Microsoft.AspNetCore.Mvc":"ASP.NET Core MVC","Microsoft.AspNetCore.Components":"Blazor","Microsoft.AspNetCore.Components.WebAssembly":"Blazor WASM","Microsoft.AspNetCore.SignalR":"SignalR","Microsoft.AspNetCore.OData":"OData","Microsoft.AspNetCore.Identity":"ASP.NET Identity","Microsoft.AspNetCore.Authentication.JwtBearer":"JWT Bearer Auth","Microsoft.AspNetCore.Diagnostics.HealthChecks":"Health Checks","Swashbuckle.AspNetCore":"Swashbuckle","NSwag.AspNetCore":"NSwag","Microsoft.EntityFrameworkCore":"EF Core","Microsoft.EntityFrameworkCore.SqlServer":"EF Core SQL Server","Microsoft.EntityFrameworkCore.Sqlite":"EF Core SQLite","Microsoft.EntityFrameworkCore.Design":"EF Core Design","Microsoft.EntityFrameworkCore.Tools":"EF Core Tools","Npgsql.EntityFrameworkCore.PostgreSQL":"EF Core PostgreSQL","Pomelo.EntityFrameworkCore.MySql":"EF Core MySQL (Pomelo)","MongoDB.EntityFrameworkCore":"EF Core MongoDB",Dapper:"Dapper","Dapper.Contrib":"Dapper Contrib",NHibernate:"NHibernate",Npgsql:"Npgsql",MySqlConnector:"MySqlConnector","MongoDB.Driver":"MongoDB Driver","StackExchange.Redis":"StackExchange.Redis","Microsoft.Data.SqlClient":"SqlClient","Oracle.ManagedDataAccess.Core":"Oracle (Managed)",Cassandra:"Cassandra Driver","Neo4j.Driver":"Neo4j Driver",Marten:"Marten",LiteDB:"LiteDB","RavenDB.Client":"RavenDB","Microsoft.Extensions.Hosting":".NET Hosting","Microsoft.Extensions.Hosting.Abstractions":".NET Hosting Abstractions","Microsoft.Extensions.DependencyInjection":".NET DI","Microsoft.Extensions.DependencyInjection.Abstractions":".NET DI Abstractions","Microsoft.Extensions.Configuration":".NET Configuration","Microsoft.Extensions.Configuration.Abstractions":".NET Configuration Abstractions","Microsoft.Extensions.Configuration.Binder":".NET Configuration Binder","Microsoft.Extensions.Configuration.EnvironmentVariables":".NET Configuration EnvVars","Microsoft.Extensions.Configuration.Json":".NET Configuration JSON","Microsoft.Extensions.Configuration.UserSecrets":".NET Configuration UserSecrets","Microsoft.Extensions.Logging":".NET Logging","Microsoft.Extensions.Logging.Abstractions":".NET Logging Abstractions","Microsoft.Extensions.Logging.Console":".NET Logging Console","Microsoft.Extensions.Logging.Debug":".NET Logging Debug","Microsoft.Extensions.Logging.EventSource":".NET Logging EventSource","Microsoft.Extensions.Options":".NET Options","Microsoft.Extensions.Options.ConfigurationExtensions":".NET Options Configuration","Microsoft.Extensions.Options.DataAnnotations":".NET Options DataAnnotations","Microsoft.Extensions.Caching.Memory":".NET Memory Cache","Microsoft.Extensions.Caching.Abstractions":".NET Caching Abstractions","Microsoft.Extensions.Caching.StackExchangeRedis":".NET Redis Cache","Microsoft.Extensions.Http":".NET HttpClientFactory","Microsoft.Extensions.Http.Resilience":".NET HttpClient Resilience","Microsoft.Extensions.Resilience":".NET Resilience","Microsoft.Extensions.Diagnostics":".NET Diagnostics","Microsoft.Extensions.Diagnostics.HealthChecks":".NET Health Checks (Extensions)","Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions":".NET Health Checks Abstractions","Microsoft.Extensions.FileProviders.Abstractions":".NET File Providers","Microsoft.Extensions.FileProviders.Physical":".NET File Providers Physical","Microsoft.Extensions.Localization":".NET Localization","Microsoft.Extensions.Localization.Abstractions":".NET Localization Abstractions","Microsoft.Extensions.Primitives":".NET Primitives","System.Text.Json":".NET System.Text.Json","System.Text.Encodings.Web":".NET System.Text.Encodings.Web","System.Net.Http.Json":".NET System.Net.Http.Json","System.ComponentModel.Annotations":".NET ComponentModel Annotations",MediatR:"MediatR",Wolverine:"Wolverine",Brighter:"Brighter",AutoMapper:"AutoMapper",Mapster:"Mapster","Riok.Mapperly":"Mapperly",FluentValidation:"FluentValidation","FluentValidation.AspNetCore":"FluentValidation ASP.NET","Newtonsoft.Json":"Newtonsoft.Json",MessagePack:"MessagePack","protobuf-net":"protobuf-net",CsvHelper:"CsvHelper",Serilog:"Serilog","Serilog.AspNetCore":"Serilog ASP.NET","Serilog.Sinks.Console":"Serilog Console","Serilog.Sinks.Seq":"Serilog Seq","Serilog.Sinks.File":"Serilog File","Serilog.Sinks.Elasticsearch":"Serilog Elasticsearch",NLog:"NLog","NLog.Web.AspNetCore":"NLog ASP.NET",log4net:"log4net",OpenTelemetry:"OpenTelemetry","OpenTelemetry.Extensions.Hosting":"OpenTelemetry Hosting","OpenTelemetry.Instrumentation.AspNetCore":"OpenTelemetry ASP.NET","OpenTelemetry.Exporter.Prometheus":"OpenTelemetry Prometheus","OpenTelemetry.Exporter.Jaeger":"OpenTelemetry Jaeger","OpenTelemetry.Exporter.OpenTelemetryProtocol":"OpenTelemetry OTLP","App.Metrics":"App.Metrics","prometheus-net":"Prometheus.NET","Elastic.Apm":"Elastic APM",xunit:"xUnit","xunit.runner.visualstudio":"xUnit Runner",NUnit:"NUnit",NUnit3TestAdapter:"NUnit Adapter","MSTest.TestFramework":"MSTest","MSTest.TestAdapter":"MSTest Adapter",Moq:"Moq",NSubstitute:"NSubstitute",FakeItEasy:"FakeItEasy",FluentAssertions:"FluentAssertions",Shouldly:"Shouldly",Bogus:"Bogus",AutoFixture:"AutoFixture","WireMock.Net":"WireMock.Net",Testcontainers:"Testcontainers",Respawn:"Respawn",BenchmarkDotNet:"BenchmarkDotNet","coverlet.collector":"Coverlet",SpecFlow:"SpecFlow",TUnit:"TUnit","Verify.Xunit":"Verify",Snapshooter:"Snapshooter",MassTransit:"MassTransit","MassTransit.RabbitMQ":"MassTransit RabbitMQ","MassTransit.Azure.ServiceBus.Core":"MassTransit Azure SB",NServiceBus:"NServiceBus","RabbitMQ.Client":"RabbitMQ Client","Confluent.Kafka":"Confluent Kafka","Azure.Messaging.ServiceBus":"Azure Service Bus","Azure.Messaging.EventHubs":"Azure Event Hubs","Amazon.SQS":"AWS SQS","Amazon.SNS":"AWS SNS",Rebus:"Rebus",EasyNetQ:"EasyNetQ",SlimMessageBus:"SlimMessageBus",CAP:"DotNetCore.CAP","AWSSDK.Core":"AWS SDK Core","AWSSDK.S3":"AWS SDK S3","AWSSDK.SQS":"AWS SDK SQS","AWSSDK.DynamoDBv2":"AWS SDK DynamoDB","AWSSDK.Lambda":"AWS SDK Lambda","AWSSDK.SecretsManager":"AWS SDK Secrets Manager","AWSSDK.CloudWatch":"AWS SDK CloudWatch","Azure.Storage.Blobs":"Azure Blob Storage","Azure.Identity":"Azure Identity","Azure.Security.KeyVault.Secrets":"Azure Key Vault","Azure.Cosmos":"Azure Cosmos DB","Microsoft.Azure.Functions.Worker":"Azure Functions","Google.Cloud.Storage.V1":"GCP Storage","Google.Cloud.PubSub.V1":"GCP Pub/Sub","Google.Cloud.Firestore":"GCP Firestore","Microsoft.Identity.Web":"Microsoft Identity Web","Microsoft.Identity.Client":"MSAL",IdentityServer4:"IdentityServer4","Duende.IdentityServer":"Duende IdentityServer","Microsoft.AspNetCore.Authentication.OpenIdConnect":"OpenID Connect",IdentityModel:"IdentityModel",Refit:"Refit",RestSharp:"RestSharp","Flurl.Http":"Flurl",Polly:"Polly","Polly.Extensions.Http":"Polly HTTP","Microsoft.Extensions.Http.Polly":"HttpClient Polly","Grpc.AspNetCore":"gRPC ASP.NET","Grpc.Net.Client":"gRPC Client","GraphQL.Server.All":"GraphQL Server","HotChocolate.AspNetCore":"Hot Chocolate (GraphQL)",Hangfire:"Hangfire","Hangfire.Core":"Hangfire Core","Hangfire.AspNetCore":"Hangfire ASP.NET",Quartz:"Quartz.NET","Quartz.Extensions.Hosting":"Quartz.NET Hosting",Coravel:"Coravel",EPPlus:"EPPlus",ClosedXML:"ClosedXML",iTextSharp:"iTextSharp",QuestPDF:"QuestPDF",ImageSharp:"ImageSharp","SixLabors.ImageSharp":"ImageSharp","LaunchDarkly.ServerSdk":"LaunchDarkly","Microsoft.FeatureManagement":"Feature Management","Microsoft.FeatureManagement.AspNetCore":"Feature Management ASP.NET","Dapr.Client":"Dapr","Steeltoe.Discovery.ClientCore":"Steeltoe",Ocelot:"Ocelot (API Gateway)","Yarp.ReverseProxy":"YARP","Microsoft.AspNetCore.SignalR.Client":"SignalR Client"};function ts(t){return t.replace(/\\/g,"/")}function yu(t){let e=t.match(/^net(\d+)\.\d+$/);if(e?.[1])return parseInt(e[1],10);let n=t.match(/^netcoreapp(\d+)\.\d+$/);return n?.[1]?parseInt(n[1],10):(t.startsWith("netstandard")||t.match(/^net(\d)(\d+)?$/),null)}function Do(t){return t.endsWith(".csproj")||t.endsWith(".vbproj")}function ns(t){return B.basename(t).replace(/\.(cs|vb)proj$/i,"")}function vu(t,e){let r=Si.parse(t)?.Project;if(!r)return {targetFrameworks:[],packageReferences:[],projectReferences:[],projectName:ns(e)};let s=Array.isArray(r.PropertyGroup)?r.PropertyGroup:r.PropertyGroup?[r.PropertyGroup]:[],o=[];for(let l of s)if(l.TargetFramework&&o.push(String(l.TargetFramework)),l.TargetFrameworks){let u=String(l.TargetFrameworks).split(";").map(p=>p.trim()).filter(Boolean);o.push(...u);}let i=Array.isArray(r.ItemGroup)?r.ItemGroup:r.ItemGroup?[r.ItemGroup]:[],a=[],c=[];for(let l of i){let u=Array.isArray(l.PackageReference)?l.PackageReference:l.PackageReference?[l.PackageReference]:[];for(let f of u){let d=f["@_Include"]??f["@_include"]??"",h=f["@_Version"]??f["@_version"]??f.Version??"";d&&h&&a.push({name:String(d),version:String(h)});}let p=Array.isArray(l.ProjectReference)?l.ProjectReference:l.ProjectReference?[l.ProjectReference]:[];for(let f of p){let d=f["@_Include"]??f["@_include"]??"";d&&c.push(String(d).replace(/\\/g,"/"));}}return {targetFrameworks:[...new Set(o)],packageReferences:a,projectReferences:c,projectName:ns(e)}}function bu(t){let n=Si.parse(t)?.packages;if(!n)return [];let r=Array.isArray(n.package)?n.package:n.package?[n.package]:[],s=[];for(let o of r){let i=o["@_id"]??o["@_Id"]??"",a=o["@_version"]??o["@_Version"]??"";i&&a&&s.push({name:String(i),version:String(a)});}return s}async function wu(t,e,n,r,s=Ne){let o$1=n?await n.findFiles(t,Do):await i(t,Do),i$1=n?await n.findSolutionFiles(t):await k(t),a=new Set;for(let p of i$1)try{let f=n?await n.readTextFile(p):await o(p),d=B.dirname(p),h=/Project\("[^"]*"\)\s*=\s*"[^"]*",\s*"([^"]+\.(?:cs|vb)proj)"/g,g;for(;(g=h.exec(f))!==null;)if(g[1]){let v=B.resolve(d,g[1].replace(/\\/g,"/"));a.add(v);}}catch{}let c=new Set([...o$1,...a]),l=[],u=r??n?.projectScanTimeout??18e4;for(let p of c)try{let f=Su(p,t,e,n,s),d=await Me(f,u);if(d.ok)l.push(d.value);else {let h=ts(B.relative(t,B.dirname(p)));n&&n.addStuckPath(h||"."),console.error(`Timeout scanning ${p} (>${u/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(f){let d=f instanceof Error?f.message:String(f);console.error(`Error scanning ${p}: ${d}`);}return l}async function Su(t,e,n,r,s){let o$1=r?await r.readTextFile(t):await o(t),i=vu(o$1,t),a=B.dirname(t);{let x=B.join(a,"packages.config");try{let y=r?await r.readTextFile(x):await o(x),b=new Set(i.packageReferences.map(k=>k.name.toLowerCase()));for(let k of bu(y))b.has(k.name.toLowerCase())||(i.packageReferences.push(k),b.add(k.name.toLowerCase()));}catch{}}let c=i.targetFrameworks[0],l=pn(s,"dotnet")?.major,u,p,f,d=c;if(c){let x=yu(c);x!==null&&l!==void 0&&(u=Math.max(0,l-x)),p=yt(s,"dotnet",c);let y=it("dotnet",c);y&&(f=gt(s,"dotnet",y));}let h=[],g={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};if(n){let x=i.packageReferences.map(async b=>{let k=await n.get(b.name);return {ref:b,meta:k}}),y=await Promise.all(x);for(let{ref:b,meta:k}of y){let T=Ct.valid(b.version)?b.version:null,m=k.latestStableOverall,A=null,$="unknown";if(T&&m){let L=Ct.major(T);A=Ct.major(m)-L,A===0?$=Ct.eq(T,m)?"current":"minor-behind":A>0?$="major-behind":$="current",A<=0?g.current++:A===1?g.oneBehind++:g.twoPlusBehind++;}else g.unknown++;h.push({package:b.name,section:"dependencies",currentSpec:b.version,resolvedVersion:T,latestStable:m,majorsBehind:A,drift:$});}}else for(let x of i.packageReferences)h.push({package:x.name,section:"dependencies",currentSpec:x.version,resolvedVersion:x.version,latestStable:null,majorsBehind:null,drift:"unknown"}),g.unknown++;let v=[],w=new Map(h.map(x=>[x.package,x]));for(let x of i.packageReferences)if(x.name in Vo){let y=w.get(x.name);v.push({name:Vo[x.name],currentVersion:y?.resolvedVersion??x.version,latestVersion:y?.latestStable??null,majorsBehind:y?.majorsBehind??null});}let j=i.projectReferences.map(x=>{let y=B.resolve(a,x),b=ts(B.relative(e,B.dirname(y))),k=ns(y);return {path:b||".",name:k,refType:"project"}}),P;try{P=r?await r.countFilesUnder(e,a):void 0;}catch{}h.sort((x,y)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},k=(b[x.drift]??9)-(b[y.drift]??9);return k!==0?k:x.package.localeCompare(y.package)});let C=g;return {type:"dotnet",path:ts(B.relative(e,a))||".",name:i.projectName,targetFramework:d,runtime:c,runtimeLatest:l!==void 0?`net${l}.0`:void 0,runtimeMajorsBehind:u,runtimeEol:p,runtimeEolDate:f,frameworks:v,dependencies:h,dependencyAgeBuckets:C,projectReferences:j.length>0?j:void 0,fileCount:P}}function ki(t){if(!t)return null;try{let e=qr(t);return e&&typeof e=="object"?e:null}catch{return null}}function gr(t){return t.trim().toLowerCase().replace(/[-_.]+/g,"-")}function ku(t){let e=t.trim().replace(/^[=~^><!]+\s*/,"").split(/[,;\s]/)[0];return /^\d/.test(e)?e:null}function xu(t){let e=new Map,r=ki(t)?.package;if(!Array.isArray(r))return e;for(let s of r){if(!s||typeof s!="object")continue;let{name:o,version:i}=s;if(typeof o!="string"||typeof i!="string")continue;let a=gr(o);e.has(a)||e.set(a,i);}return e}function Eu(t){let e=new Map;if(!t||typeof t!="object")return e;let n=t;for(let r of ["default","develop"]){let s=n[r];if(!(!s||typeof s!="object"))for(let[o,i]of Object.entries(s)){let a=i&&typeof i=="object"?i.version:void 0;if(typeof a!="string")continue;let c=ku(a),l=gr(o);c&&!e.has(l)&&e.set(l,c);}}return e}var ju=[["poetry","poetry.lock"],["uv","uv.lock"],["pdm","pdm.lock"]];async function Tu(t,e){for(let[r,s]of ju){let o=B.join(t,s);if(await e.exists(o).catch(()=>false))try{let i=xu(await e.readText(o));if(i.size)return {source:r,size:i.size,resolve:a=>i.get(gr(a))??null}}catch{}}let n=B.join(t,"Pipfile.lock");if(await e.exists(n).catch(()=>false))try{let r=Eu(await e.readJson(n));if(r.size)return {source:"pipfile",size:r.size,resolve:s=>r.get(gr(s))??null}}catch{}return null}var Uo={django:"Django",flask:"Flask",fastapi:"FastAPI",starlette:"Starlette",tornado:"Tornado",bottle:"Bottle",sanic:"Sanic",falcon:"Falcon",aiohttp:"aiohttp",quart:"Quart",litestar:"Litestar",robyn:"Robyn",sqlalchemy:"SQLAlchemy","django-rest-framework":"DRF",djangorestframework:"DRF",peewee:"Peewee","tortoise-orm":"Tortoise ORM",sqlmodel:"SQLModel",pony:"Pony ORM",alembic:"Alembic",psycopg2:"psycopg2","psycopg2-binary":"psycopg2",psycopg:"psycopg3",asyncpg:"asyncpg",pymongo:"PyMongo",motor:"Motor",redis:"redis-py",celery:"Celery",boto3:"AWS SDK (boto3)",botocore:"AWS SDK (botocore)",numpy:"NumPy",pandas:"pandas",scipy:"SciPy","scikit-learn":"scikit-learn",tensorflow:"TensorFlow",torch:"PyTorch",keras:"Keras",matplotlib:"Matplotlib",seaborn:"Seaborn",plotly:"Plotly",polars:"Polars",dask:"Dask",xgboost:"XGBoost",lightgbm:"LightGBM",transformers:"Transformers (HF)",langchain:"LangChain",openai:"OpenAI SDK",pytest:"pytest",unittest2:"unittest2",nose2:"nose2",tox:"tox",hypothesis:"Hypothesis","factory-boy":"factory_boy",faker:"Faker",coverage:"Coverage.py",responses:"responses",httpx:"HTTPX",uvicorn:"Uvicorn",gunicorn:"Gunicorn",hypercorn:"Hypercorn",dramatiq:"Dramatiq",rq:"RQ",huey:"Huey",pyjwt:"PyJWT",authlib:"Authlib","python-jose":"python-jose",passlib:"Passlib",cryptography:"cryptography",pydantic:"Pydantic",marshmallow:"Marshmallow",attrs:"attrs",cerberus:"Cerberus",msgpack:"msgpack",protobuf:"protobuf",requests:"Requests",urllib3:"urllib3",ansible:"Ansible",fabric:"Fabric",invoke:"Invoke",paramiko:"Paramiko",black:"Black",ruff:"Ruff",flake8:"Flake8",mypy:"mypy",pylint:"Pylint",isort:"isort",bandit:"Bandit",structlog:"structlog",loguru:"Loguru","sentry-sdk":"Sentry SDK","opentelemetry-api":"OpenTelemetry","prometheus-client":"prometheus-client"};function ds(t){let e=t.trim();if(!e||e.startsWith("#")||e.startsWith("-"))return null;let r=e.split(";")[0].trim().match(/^([A-Za-z0-9][-A-Za-z0-9_.]*[A-Za-z0-9]?)(?:\[.*?\])?\s*(.*)?$/);if(!r)return null;let s=r[1],o=(r[2]??"").trim(),i=s.toLowerCase().replace(/[_.]+/g,"-");return {name:s,spec:o,normalisedName:i}}function Cu(t){return t.match(/^==\s*([^\s,;]+)/)?.[1]??null}function Au(t){let e=t.replace(/^[vV]/,"").trim();if(/(?:a\d|b\d|rc\d|alpha|beta|dev|post)/i.test(e))return null;let n=e.split(".");for(;n.length<3;)n.push("0");return e=n.slice(0,3).join("."),At.valid(e)}function Pu(t){let e=[];for(let n of t.split(`
73
- `)){let r=ds(n);r&&e.push(r);}return e}function Mu(t){let e={dependencies:[]},n=t.match(/^\s*name\s*=\s*"([^"]+)"/m);n&&(e.projectName=n[1]);let r=t.match(/^\s*requires-python\s*=\s*"([^"]+)"/m);r&&(e.pythonVersion=r[1]);let s=t.match(/^\s*dependencies\s*=\s*\[([\s\S]*?)\]/m);if(s){let i=s[1],a=/"([^"]+)"/g,c;for(;(c=a.exec(i))!==null;){let l=ds(c[1]);l&&e.dependencies.push(l);}}let o=t.match(/\[tool\.poetry\.dependencies\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(o){let i=o[1].split(`
74
- `);for(let a of i){let c=a.match(/^\s*([A-Za-z0-9][-A-Za-z0-9_.]*)\s*=\s*(?:"([^"]+)"|{.*?version\s*=\s*"([^"]+)".*?})/);if(c){let l=c[1];if(l.toLowerCase()==="python"){e.pythonVersion=c[2]??c[3]??void 0;continue}let u=c[2]??c[3]??"",p=l.toLowerCase().replace(/[_.]+/g,"-");e.dependencies.push({name:l,spec:u?`==${u}`:"",normalisedName:p});}}}return e}function $u(t){let e=[],n=t.match(/\[packages\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(n){let s=n[1].split(`
70
+ ... and ${p} more`),e.push({title:"Deduplicate heavily-versioned packages",explanation:c,severity:35});}}return e.sort((i,a)=>a.severity-i.severity),e.slice(0,5)}function Ol(t){let e=Bl(t.findings),n=t.findings.map(r=>Vl(r));return {$schema:"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json",version:"2.1.0",runs:[{tool:{driver:{name:"vibgrate",version:t.vibgrateVersion,informationUri:"https://vibgrate.com",rules:e}},results:n,invocations:[{executionSuccessful:true,startTimeUtc:t.timestamp}]}]}}function Bl(t){return [...new Set(t.map(n=>n.ruleId))].map(n=>({"vibgrate/runtime-eol":{id:"vibgrate/runtime-eol",shortDescription:{text:"Runtime at or past end-of-life"},helpUri:"https://vibgrate.com/rules/runtime-eol"},"vibgrate/runtime-lag":{id:"vibgrate/runtime-lag",shortDescription:{text:"Runtime major version lag"},helpUri:"https://vibgrate.com/rules/runtime-lag"},"vibgrate/framework-major-lag":{id:"vibgrate/framework-major-lag",shortDescription:{text:"Framework major version behind latest"},helpUri:"https://vibgrate.com/rules/framework-major-lag"},"vibgrate/dependency-rot":{id:"vibgrate/dependency-rot",shortDescription:{text:"High percentage of outdated dependencies"},helpUri:"https://vibgrate.com/rules/dependency-rot"},"vibgrate/dependency-major-lag":{id:"vibgrate/dependency-major-lag",shortDescription:{text:"Individual dependency severely behind"},helpUri:"https://vibgrate.com/rules/dependency-major-lag"},"vibgrate/vulnerability":{id:"vibgrate/vulnerability",shortDescription:{text:"Known vulnerability in an installed dependency"},helpUri:"https://vibgrate.com/rules/vulnerability"}})[n]??{id:n,shortDescription:{text:n},helpUri:"https://vibgrate.com"})}function Vl(t){return {ruleId:t.ruleId,level:t.level==="error"?"error":t.level==="warning"?"warning":"note",message:{text:t.message},locations:[{physicalLocation:{artifactLocation:{uri:t.location}}}],...t.details&&Object.keys(t.details).length>0?{properties:t.details}:{}}}function xn(t){return String(Number(t.toFixed(2)))}function Dl(t){let e=[],n=t.billing;if(e.push("# Vibgrate Drift Report"),e.push(""),e.push("| Metric | Value |"),e.push("|--------|-------|"),e.push(`| **Drift Score** | ${t.drift.score}/100 |`),e.push(`| **Risk Level** | ${t.drift.riskLevel.toUpperCase()} |`),e.push(`| **Projects** | ${t.projects.length} |`),n){let s=[];n.standardCount>0&&s.push(`${xn(n.standardCount)} standard`),n.smallCount>0&&s.push(`${xn(n.smallCount/n.smallBillingRatio)} small`),n.microCount>0&&s.push(`${xn(n.microCount/n.microBillingRatio)} micro`),n.nanoCount>0&&s.push(`${xn(n.nanoCount/n.nanoBillingRatio)} nano`);let o=xn(n.billableProjectsRaw);e.push(`| **Classification** | ${n.nanoCount} nano \xB7 ${n.microCount} micro \xB7 ${n.smallCount} small \xB7 ${n.standardCount} standard |`),e.push(`| **Billable Projects** | ${o} (${n.totalScanned} detected \u2192 ${o} billable${s.length>0?`; ${s.join(" \xB7 ")}`:""}) |`);}let r=[t.timestamp];t.durationMs!==void 0&&r.push(`${(t.durationMs/1e3).toFixed(1)}s`),t.filesScanned!==void 0&&r.push(`${t.filesScanned} files`),t.treeSummary&&r.push(`${t.treeSummary.totalFiles.toLocaleString()} workspace files \xB7 ${t.treeSummary.totalDirs.toLocaleString()} dirs`),e.push(`| **Scanned** | ${r.join(" \xB7 ")} |`),t.vcs&&(e.push(`| **VCS** | ${t.vcs.type} |`),t.vcs.branch&&e.push(`| **Branch** | ${t.vcs.branch} |`),t.vcs.sha&&e.push(`| **Commit** | \`${t.vcs.shortSha}\` |`)),e.push(""),e.push("## Score Breakdown"),e.push(""),e.push("| Component | Score |"),e.push("|-----------|-------|"),e.push(`| Runtime | ${t.drift.components.runtimeScore} |`),e.push(`| Frameworks | ${t.drift.components.frameworkScore} |`),e.push(`| Dependencies | ${t.drift.components.dependencyScore} |`),e.push(`| EOL Risk | ${t.drift.components.eolScore} |`),e.push(""),e.push("## Projects"),e.push("");for(let s of t.projects){if(e.push(`### ${s.name} (${s.type})`),e.push(""),s.runtime){let a=s.runtimeMajorsBehind!==void 0&&s.runtimeMajorsBehind>0?` \u2014 ${s.runtimeMajorsBehind} major(s) behind`:" \u2014 current";e.push(`- **Runtime:** ${s.runtime}${a}`);}if(s.frameworks.length>0){e.push("- **Frameworks:**");for(let a of s.frameworks){let c=a.majorsBehind!==null?a.majorsBehind===0?"current":`${a.majorsBehind} behind`:"unknown";e.push(` - ${a.name}: ${a.currentVersion??"?"} \u2192 ${a.latestVersion??"?"} (${c})`);}}let o=s.dependencyAgeBuckets;o.current+o.oneBehind+o.twoPlusBehind+o.unknown>0&&e.push(`- **Dependencies:** ${o.current} current, ${o.oneBehind} 1-behind, ${o.twoPlusBehind} 2+ behind, ${o.unknown} unknown`),e.push("");}if(t.extended?.uiPurpose){let s=t.extended.uiPurpose;if(e.push("## Product Purpose Signals"),e.push(""),e.push(`- **Frameworks:** ${s.detectedFrameworks.length>0?s.detectedFrameworks.join(", "):"unknown"}`),e.push(`- **Evidence Items:** ${s.topEvidence.length}${s.capped?` (capped from ${s.evidenceCount})`:""}`),s.topEvidence.length>0){e.push("- **Top Evidence:**");for(let o of s.topEvidence.slice(0,10))e.push(` - [${o.kind}] ${o.value} (${o.file})`);}if(s.unknownSignals.length>0){e.push("- **Unknowns:**");for(let o of s.unknownSignals.slice(0,5))e.push(` - ${o}`);}e.push("");}if(t.extended?.standards&&t.extended.standards.recommended.length>0){let s=t.extended.standards;e.push("## Recommended Standards"),e.push("");let o=s.projectPurposes.map(i=>`${i.project} \u2192 ${i.category}`).join(", ");if(o&&e.push(`- **Detected purpose:** ${o}`),s.frameworks.length>0){e.push("- **Compliance framework coverage:**");for(let i of s.frameworks)e.push(` - ${i.name}: ${i.recommendedMembers}/${i.totalMembers} member standards apply`);}e.push("- **Top standards to consider:**");for(let i of s.recommended.slice(0,10)){let a=i.complianceRelevant?" _(compliance)_":"";e.push(` - **${i.name}** \u2014 ${i.reason}${a}`);}e.push("");}if(t.findings.length>0){e.push("## Findings"),e.push(""),e.push("| Level | Rule | Message | Location |"),e.push("|-------|------|---------|----------|");for(let s of t.findings){let o=s.level==="error"?"\u{1F534}":s.level==="warning"?"\u{1F7E1}":"\u{1F535}";e.push(`| ${o} ${s.level} | ${s.ruleId} | ${s.message} | ${s.location} |`);}e.push("");}if(t.delta!==void 0){let s=t.delta>0?"\u{1F4C8}":t.delta<0?"\u{1F4C9}":"\u27A1\uFE0F";e.push(`## Drift Delta: ${s} ${t.delta>0?"+":""}${t.delta} vs baseline`),e.push("");}return e.join(`
71
+ `)}var Gl=/^node_modules\/((?:@[^/]+\/)?[^/]+)$/;function ql(t){let e=new Map;if(!t||typeof t!="object")return e;let n=t;if(n.packages&&typeof n.packages=="object")for(let[r,s]of Object.entries(n.packages)){let o=s?.version;if(!o)continue;let i=Gl.exec(r);i&&e.set(i[1],o);}if(e.size===0&&n.dependencies&&typeof n.dependencies=="object")for(let[r,s]of Object.entries(n.dependencies)){let o=s?.version;o&&e.set(r,o);}return e}function Hl(t){let e=t.indexOf("@",t.startsWith("@")?1:0);return e>0?t.slice(0,e):null}function zl(t){let e=new Map,n=new Map,r=[];for(let s of t.split(`
72
+ `))if(!(!s.trim()||s.trimStart().startsWith("#")))if(!/^\s/.test(s))r=s.replace(/:\s*$/,"").split(",").map(o=>o.trim().replace(/^"|"$/g,"")).filter(Boolean);else {let o=/^\s+version:?\s+"?([^"\s]+)"?/.exec(s);if(o&&r.length){let i=o[1];for(let a of r){let c=Hl(a);c&&(e.set(a,i),n.set(c,i));}r=[];}}return {bySpec:e,byName:n}}function Wl(t){let e=t.split("(")[0].trim().replace(/^\/+/,""),n=e.lastIndexOf("@");return n>0&&/^\d/.test(e.slice(n+1))&&(e=e.slice(n+1)),/^\d/.test(e)?e:null}function Jl(t){let e=new Map;if(!t||typeof t!="object")return e;let n=t,r=s=>{if(!(!s||typeof s!="object"))for(let[o,i]of Object.entries(s)){let a=i&&typeof i=="object"?i.version:i;if(typeof a!="string")continue;let c=Wl(a);c&&!e.has(o)&&e.set(o,c);}};if(n.importers&&typeof n.importers=="object")for(let s of Object.values(n.importers)){let o=s;r(o?.dependencies),r(o?.devDependencies),r(o?.optionalDependencies);}return r(n.dependencies),r(n.devDependencies),r(n.optionalDependencies),e}async function Kl(t,e){let n=B.join(t,"pnpm-lock.yaml"),r=B.join(t,"yarn.lock"),s=B.join(t,"package-lock.json");if(await e.exists(n).catch(()=>false))try{let o=Jl(parse(await e.readText(n)));if(o.size)return {source:"pnpm",size:o.size,resolve:i=>o.get(i)??null}}catch{}if(await e.exists(s).catch(()=>false))try{let o=ql(await e.readJson(s));if(o.size)return {source:"package-lock",size:o.size,resolve:i=>o.get(i)??null}}catch{}if(await e.exists(r).catch(()=>false))try{let{bySpec:o,byName:i}=zl(await e.readText(r));if(i.size)return {source:"yarn",size:i.size,resolve:(a,c)=>(c?o.get(`${a}@${c}`):void 0)??i.get(a)??null}}catch{}return null}async function $e(t,e){let n,r=new Promise(s=>{n=setTimeout(()=>s({ok:false}),e);});try{return await Promise.race([t.then(o=>({ok:!0,value:o})),r])}finally{clearTimeout(n);}}function eu(t,e){return new Promise((n,r)=>{let s=spawn(t,e,{stdio:["ignore","pipe","pipe"]}),o="",i="";s.stdout.on("data",a=>o+=String(a)),s.stderr.on("data",a=>i+=String(a)),s.on("error",r),s.on("close",a=>{if(a!==0){r(new Error(`${t} ${e.join(" ")} failed (code=${a}): ${i.trim()}`));return}n(o);});})}async function yi(t,e){try{return JSON.parse(t)}catch{throw new Error(`Invalid JSON in package version manifest: ${e}`)}}async function tu(t){let e=await mkdtemp(B.join($n.tmpdir(),"vibgrate-manifest-"));try{await eu("unzip",["-qq",t,"-d",e]);let n=[B.join(e,"package-versions.json"),B.join(e,"manifest.json"),B.join(e,"index.json")];for(let r of n)try{let s=await readFile(r,"utf8");return await yi(s,r)}catch{}throw new Error("Zip must contain package-versions.json, manifest.json, or index.json")}finally{await rm$1(e,{recursive:true,force:true});}}async function nu(t){let e=B.resolve(t);if(e.toLowerCase().endsWith(".zip"))return tu(e);let n=await readFile(e,"utf8");return yi(n,e)}function W(t,e,n){if(!t)return;let r=t[e];if(r)return e==="nuget"?r[n.toLowerCase()]??r[n]:r[n]}function Pn(t){return t.filter(e=>ft.valid(e)&&ft.prerelease(e)===null)}function hr(t){let e=Pn(t);return e.length===0?null:e.sort(ft.rcompare)[0]??null}function ru(t){if(!t||typeof t!="object")return;let e={};for(let[n,r]of Object.entries(t))n==="created"||n==="modified"||typeof r=="string"&&(e[n]=r);return Object.keys(e).length>0?e:void 0}function cr(t){let e=null,n=[],r=null,s;if(t&&typeof t=="object"){let a=t,c=a["dist-tags.latest"];typeof c=="string"&&(e=c);let l=a["dist-tags"];!e&&l&&typeof l=="object"&&typeof l.latest=="string"&&(e=l.latest);let u=a.versions;Array.isArray(u)?n=u.map(String):typeof u=="string"&&(n=[u]),r=vi(a.license??a.licenses),s=ru(a.time);}let o=Pn(n),i=hr(o);return !e&&i&&(e=i),{latest:e,stableVersions:o,latestStableOverall:i,license:r,...s?{releaseDates:s}:{}}}function vi(t){if(!t)return null;if(typeof t=="string")return t.trim()||null;if(Array.isArray(t)){let e=t.map(vi).filter(n=>!!n);return e.length===0?null:e.length===1?e[0]:`(${e.join(" OR ")})`}if(typeof t=="object"){let e=t;if(typeof e.type=="string")return e.type.trim()||null;if(typeof e.spdx=="string")return e.spdx.trim()||null}return null}var su=24,ou=7e3,iu=3e4,au=process.platform==="win32"?"npm.cmd":"npm";function cu(t,e=process.platform){let n=e==="win32"?ou:iu,r=[],s=[],o=0;for(let i of t){let a=i.length+1;(s.length>=su||s.length>0&&o+a>n)&&(r.push(s),s=[],o=0),s.push(i),o+=a;}return s.length>0&&r.push(s),r}async function An(t,e){return new Promise((n,r)=>{let s=spawn(au,["view",...t,"--json"],{cwd:e,stdio:["ignore","pipe","pipe"]}),o="",i="";s.stdout.on("data",a=>o+=String(a)),s.stderr.on("data",a=>i+=String(a)),s.on("error",r),s.on("close",a=>{if(a!==0){r(new Error(`npm view ${t.join(" ")} failed (code=${a}): ${i.trim()}`));return}let c=o.trim();if(!c){n(null);return}try{n(JSON.parse(c));}catch{n(c.replace(/^"|"$/g,""));}});})}var lu=class{constructor(t,e,n,r=false){this.cwd=t,this.sem=e,this.manifest=n,this.offline=r;}meta=new Map;async prefetch(t){let n=[...new Set(t.filter(Boolean))].filter(s=>!this.meta.has(s));if(n.length===0)return;let r=this.sem.run(()=>this.fetchBatch(n));for(let s of n){let o=r.then(i=>i.get(s)??{latest:null,stableVersions:[],latestStableOverall:null,license:null});this.meta.set(s,o);}await r;}get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(()=>this.fetchOne(t));return this.meta.set(t,n),n}async fetchBatch(t){let e=new Map,n=[];for(let r of t){let s=W(this.manifest,"npm",r);if(s){let o=Pn(s.versions??[]),i=hr(o);e.set(r,{latest:s.latest??i,stableVersions:o,latestStableOverall:i,license:s.license??null,...s.releaseDates?{releaseDates:s.releaseDates}:{}});}else this.offline?e.set(r,{latest:null,stableVersions:[],latestStableOverall:null,license:null}):n.push(r);}if(n.length===0)return e;for(let r of cu(n)){let s=await this.fetchRemoteChunk(r);for(let[o,i]of s)e.set(o,i);}return e}async fetchRemoteChunk(t){let e=new Map;if(t.length===1)return e.set(t[0],await this.fetchOneRemote(t[0])),e;try{let n=await An([...t,"dist-tags.latest","versions","license","licenses","time"],this.cwd);if(Array.isArray(n))for(let r=0;r<n.length&&r<t.length;r++)e.set(t[r],cr(n[r]));else if(n&&typeof n=="object"){let r=n,s=0;for(let o of t)o in r&&(e.set(o,cr(r[o])),s++);s===0&&t.length===1&&e.set(t[0],cr(r));}}catch{}for(let n of t)e.has(n)||e.set(n,await this.fetchOneRemote(n));return e}async fetchOne(t){let e=W(this.manifest,"npm",t);if(e){let n=Pn(e.versions??[]),r=hr(n);return {latest:e.latest??r,stableVersions:n,latestStableOverall:r,license:e.license??null,...e.releaseDates?{releaseDates:e.releaseDates}:{}}}return this.offline?{latest:null,stableVersions:[],latestStableOverall:null,license:null}:this.fetchOneRemote(t)}async fetchOneRemote(t){try{let e=await An([t,"dist-tags.latest","versions","license","licenses","time"],this.cwd);return cr(e)}catch{let e=null,n=[];try{let o=await An([t,"dist-tags"],this.cwd);o&&typeof o=="object"&&typeof o.latest=="string"&&(e=o.latest);}catch{}try{let o=await An([t,"versions"],this.cwd);Array.isArray(o)?n=o.map(String):typeof o=="string"&&(n=[o]);}catch{}let r=Pn(n),s=hr(r);return !e&&s&&(e=s),{latest:e,stableVersions:r,latestStableOverall:s,license:null}}}};async function uu(t){try{let e=new AbortController,n=setTimeout(()=>e.abort(),5e3),r=await fetch("https://registry.npmjs.org/npm/latest",{method:"HEAD",signal:e.signal});return clearTimeout(n),r.ok}catch{try{let e=await An(["npm","dist-tags.latest"],t);return typeof e=="string"&&e.length>0}catch{return false}}}function bi(t){let e=t.trim();return !e||e.startsWith("workspace:")||e.startsWith("file:")||e.startsWith("link:")||e.startsWith("git+")||e.includes("://")||e.startsWith("github:")?false:e==="*"||e.toLowerCase()==="latest"?true:ft.validRange(e)!==null}function wi(t){switch(t){case "public-domain":case "permissive":return "low";case "weak-copyleft":return "medium";case "copyleft":case "network-copyleft":case "proprietary":return "high";default:return "medium"}}var Si={attribution:false,copyleft:false,networkCopyleft:false,discloseSource:false,patentGrant:false,commercialRestriction:false};function pu(t){return {spdxId:t.id,name:t.name,family:t.family,category:t.category,osiApproved:t.osi??false,fsfLibre:t.fsf??false,deprecated:t.deprecated??false,referenceUrl:t.url??`https://spdx.org/licenses/${t.id}.html`,riskLevel:wi(t.category),obligations:{...Si,...t.obligations??{}}}}var X={attribution:true},fu={attribution:true,patentGrant:true},pe={attribution:true,copyleft:true,discloseSource:true},at={attribution:true,copyleft:true,discloseSource:true},lr={attribution:true,copyleft:true,networkCopyleft:true,discloseSource:true},du=[{id:"CC0-1.0",name:"Creative Commons Zero v1.0 Universal",family:"CC",category:"public-domain",fsf:true},{id:"Unlicense",name:"The Unlicense",family:"Public Domain",category:"public-domain",osi:true,fsf:true},{id:"0BSD",name:"BSD Zero Clause License",family:"BSD",category:"permissive",osi:true},{id:"WTFPL",name:"Do What The F*ck You Want To Public License",family:"WTFPL",category:"permissive",fsf:true},{id:"MIT",name:"MIT License",family:"MIT",category:"permissive",osi:true,fsf:true,obligations:X},{id:"MIT-0",name:"MIT No Attribution",family:"MIT",category:"permissive",osi:true},{id:"ISC",name:"ISC License",family:"ISC",category:"permissive",osi:true,fsf:true,obligations:X},{id:"BSD-2-Clause",name:'BSD 2-Clause "Simplified" License',family:"BSD",category:"permissive",osi:true,fsf:true,obligations:X},{id:"BSD-3-Clause",name:'BSD 3-Clause "New" or "Revised" License',family:"BSD",category:"permissive",osi:true,fsf:true,obligations:X},{id:"BSD-3-Clause-Clear",name:"BSD 3-Clause Clear License",family:"BSD",category:"permissive",osi:true,obligations:X},{id:"Apache-2.0",name:"Apache License 2.0",family:"Apache",category:"permissive",osi:true,fsf:true,obligations:fu},{id:"Apache-1.1",name:"Apache Software License 1.1",family:"Apache",category:"permissive",osi:true,obligations:X},{id:"Zlib",name:"zlib License",family:"Zlib",category:"permissive",osi:true,fsf:true},{id:"BSL-1.0",name:"Boost Software License 1.0",family:"Boost",category:"permissive",osi:true,fsf:true,obligations:X},{id:"PostgreSQL",name:"PostgreSQL License",family:"BSD",category:"permissive",osi:true,obligations:X},{id:"Python-2.0",name:"Python License 2.0",family:"Python",category:"permissive",osi:true,obligations:X},{id:"PSF-2.0",name:"Python Software Foundation License 2.0",family:"Python",category:"permissive",obligations:X},{id:"Artistic-2.0",name:"Artistic License 2.0",family:"Artistic",category:"permissive",osi:true,fsf:true,obligations:X},{id:"NCSA",name:"University of Illinois/NCSA Open Source License",family:"NCSA",category:"permissive",osi:true,fsf:true,obligations:X},{id:"Unicode-DFS-2016",name:"Unicode License Agreement - Data Files and Software (2016)",family:"Unicode",category:"permissive",osi:true,obligations:X},{id:"BlueOak-1.0.0",name:"Blue Oak Model License 1.0.0",family:"BlueOak",category:"permissive",obligations:X},{id:"LGPL-2.0-only",name:"GNU Library General Public License v2 only",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:pe},{id:"LGPL-2.1-only",name:"GNU Lesser General Public License v2.1 only",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:pe},{id:"LGPL-2.1-or-later",name:"GNU Lesser General Public License v2.1 or later",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:pe},{id:"LGPL-3.0-only",name:"GNU Lesser General Public License v3.0 only",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...pe,patentGrant:true}},{id:"LGPL-3.0-or-later",name:"GNU Lesser General Public License v3.0 or later",family:"LGPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...pe,patentGrant:true}},{id:"MPL-2.0",name:"Mozilla Public License 2.0",family:"MPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...pe,patentGrant:true}},{id:"MPL-1.1",name:"Mozilla Public License 1.1",family:"MPL",category:"weak-copyleft",osi:true,fsf:true,obligations:pe},{id:"EPL-1.0",name:"Eclipse Public License 1.0",family:"EPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...pe,patentGrant:true}},{id:"EPL-2.0",name:"Eclipse Public License 2.0",family:"EPL",category:"weak-copyleft",osi:true,fsf:true,obligations:{...pe,patentGrant:true}},{id:"CDDL-1.0",name:"Common Development and Distribution License 1.0",family:"CDDL",category:"weak-copyleft",osi:true,fsf:true,obligations:pe},{id:"CDDL-1.1",name:"Common Development and Distribution License 1.1",family:"CDDL",category:"weak-copyleft",obligations:pe},{id:"CPL-1.0",name:"Common Public License 1.0",family:"CPL",category:"weak-copyleft",osi:true,fsf:true,obligations:pe},{id:"MS-PL",name:"Microsoft Public License",family:"Microsoft",category:"weak-copyleft",osi:true,fsf:true,obligations:X},{id:"MS-RL",name:"Microsoft Reciprocal License",family:"Microsoft",category:"weak-copyleft",osi:true,fsf:true,obligations:pe},{id:"GPL-2.0-only",name:"GNU General Public License v2.0 only",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:at},{id:"GPL-2.0-or-later",name:"GNU General Public License v2.0 or later",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:at},{id:"GPL-3.0-only",name:"GNU General Public License v3.0 only",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:{...at,patentGrant:true}},{id:"GPL-3.0-or-later",name:"GNU General Public License v3.0 or later",family:"GPL",category:"copyleft",osi:true,fsf:true,obligations:{...at,patentGrant:true}},{id:"EUPL-1.1",name:"European Union Public License 1.1",family:"EUPL",category:"copyleft",osi:true,fsf:true,obligations:at},{id:"EUPL-1.2",name:"European Union Public License 1.2",family:"EUPL",category:"copyleft",osi:true,fsf:true,obligations:at},{id:"OSL-3.0",name:"Open Software License 3.0",family:"OSL",category:"copyleft",osi:true,fsf:true,obligations:{...at,patentGrant:true}},{id:"CECILL-2.1",name:"CeCILL Free Software License Agreement v2.1",family:"CeCILL",category:"copyleft",osi:true,fsf:true,obligations:at},{id:"CC-BY-SA-4.0",name:"Creative Commons Attribution Share Alike 4.0 International",family:"CC",category:"copyleft",obligations:{attribution:true,copyleft:true}},{id:"AGPL-3.0-only",name:"GNU Affero General Public License v3.0 only",family:"AGPL",category:"network-copyleft",osi:true,fsf:true,obligations:{...lr,patentGrant:true}},{id:"AGPL-3.0-or-later",name:"GNU Affero General Public License v3.0 or later",family:"AGPL",category:"network-copyleft",osi:true,fsf:true,obligations:{...lr,patentGrant:true}},{id:"SSPL-1.0",name:"Server Side Public License 1.0",family:"SSPL",category:"network-copyleft",obligations:lr},{id:"BUSL-1.1",name:"Business Source License 1.1",family:"BUSL",category:"proprietary",obligations:{commercialRestriction:true,discloseSource:true}},{id:"Elastic-2.0",name:"Elastic License 2.0",family:"Elastic",category:"proprietary",obligations:{commercialRestriction:true}},{id:"RPL-1.5",name:"Reciprocal Public License 1.5",family:"RPL",category:"network-copyleft",osi:true,obligations:lr},{id:"Commons-Clause",name:"Commons Clause License Condition v1.0",family:"Commons-Clause",category:"proprietary",obligations:{commercialRestriction:true}},{id:"LicenseRef-Proprietary",name:"Proprietary / Commercial",family:"Proprietary",category:"proprietary",obligations:{commercialRestriction:true}},{id:"CC-BY-NC-4.0",name:"Creative Commons Attribution Non Commercial 4.0 International",family:"CC",category:"proprietary",obligations:{attribution:true,commercialRestriction:true}},{id:"CC-BY-4.0",name:"Creative Commons Attribution 4.0 International",family:"CC",category:"permissive",obligations:X}],mu=du.map(pu),ki=new Map;for(let t of mu)ki.set(t.spdxId.toLowerCase(),t);function z(t){return ki.get(t.trim().toLowerCase())}function yr(t="Unknown"){return {spdxId:"NOASSERTION",name:t,family:"Unknown",category:"unknown",osiApproved:false,fsfLibre:false,deprecated:false,referenceUrl:"",riskLevel:"medium",obligations:{...Si}}}function xi(t){return t.trim().toLowerCase().replace(/^\(+|\)+$/g,"").replace(/[._]/g,"-").replace(/\s+/g," ").replace(/\s*-\s*/g,"-").replace(/\bversion\b/g,"v").replace(/\blicen[sc]e\b/g,"").replace(/\s+/g," ").trim()}var hu={mit:"MIT","mit license":"MIT","the mit license":"MIT",expat:"MIT",isc:"ISC",apache:"Apache-2.0","apache 2":"Apache-2.0",apache2:"Apache-2.0","apache 2.0":"Apache-2.0","apache-2":"Apache-2.0","apache license 2.0":"Apache-2.0","apache license version 2.0":"Apache-2.0","asl 2.0":"Apache-2.0",al2:"Apache-2.0",bsd:"BSD-3-Clause","bsd license":"BSD-3-Clause","bsd-2":"BSD-2-Clause","bsd 2-clause":"BSD-2-Clause","simplified bsd":"BSD-2-Clause",freebsd:"BSD-2-Clause","bsd-3":"BSD-3-Clause","bsd 3-clause":"BSD-3-Clause","new bsd":"BSD-3-Clause","modified bsd":"BSD-3-Clause","revised bsd":"BSD-3-Clause",gpl:"GPL-3.0-or-later",gplv2:"GPL-2.0-only",gpl2:"GPL-2.0-only","gpl-2":"GPL-2.0-only","gpl 2.0":"GPL-2.0-only","gpl-2.0":"GPL-2.0-only","gpl-2.0+":"GPL-2.0-or-later","gnu gpl v2":"GPL-2.0-only",gplv3:"GPL-3.0-only",gpl3:"GPL-3.0-only","gpl-3":"GPL-3.0-only","gpl 3.0":"GPL-3.0-only","gpl-3.0":"GPL-3.0-only","gpl-3.0+":"GPL-3.0-or-later","gnu gpl v3":"GPL-3.0-only","gnu general public v3":"GPL-3.0-only",lgpl:"LGPL-3.0-or-later","lgplv2.1":"LGPL-2.1-only","lgpl-2.1":"LGPL-2.1-only","lgpl 2.1":"LGPL-2.1-only",lgplv3:"LGPL-3.0-only","lgpl-3":"LGPL-3.0-only","lgpl-3.0":"LGPL-3.0-only","lgpl 3.0":"LGPL-3.0-only",agpl:"AGPL-3.0-or-later",agplv3:"AGPL-3.0-only","agpl-3":"AGPL-3.0-only","agpl-3.0":"AGPL-3.0-only","agpl 3.0":"AGPL-3.0-only","gnu agpl v3":"AGPL-3.0-only",mpl:"MPL-2.0","mpl 2.0":"MPL-2.0","mpl-2":"MPL-2.0","mozilla public 2.0":"MPL-2.0",epl:"EPL-2.0","eclipse public 2.0":"EPL-2.0","epl-2":"EPL-2.0",sspl:"SSPL-1.0","server side public":"SSPL-1.0",busl:"BUSL-1.1","business source":"BUSL-1.1",elastic:"Elastic-2.0","elastic-2":"Elastic-2.0","commons clause":"Commons-Clause",proprietary:"LicenseRef-Proprietary",commercial:"LicenseRef-Proprietary","see license in license":"LicenseRef-Proprietary",unlicensed:"LicenseRef-Proprietary","all rights reserved":"LicenseRef-Proprietary",cc0:"CC0-1.0","cc0 1.0":"CC0-1.0","public domain":"CC0-1.0","the unlicense":"Unlicense",wtfpl:"WTFPL",boost:"BSL-1.0",bsl:"BSL-1.0","zlib/libpng":"Zlib",python:"Python-2.0",psf:"PSF-2.0",artistic:"Artistic-2.0"},Ei=new Map;for(let[t,e]of Object.entries(hu))Ei.set(xi(t),e);function ji(t){return Ei.get(xi(t))}var gu=/\(|\)|\bWITH\b|\bAND\b|\bOR\b|[^\s()]+/gi;function yu(t){let e=(t??"").trim(),n=[],r=[],s=false,o=false,i=false,a=false,c=e.match(gu)??[];for(let u of c){let p=u.toUpperCase();if(u==="("||u===")")continue;if(p==="OR"){s=true,a=false;continue}if(p==="AND"){o=true,a=false;continue}if(p==="WITH"){a=true;continue}if(a){r.includes(u)||r.push(u),a=false;continue}let f=u;f.endsWith("+")&&(i=true,f=f.slice(0,-1)),f&&!n.includes(f)&&n.push(f);}let l=s?"OR":o?"AND":"SINGLE";return {licenseIds:n,exceptions:r,operator:l,orLater:i,normalized:vu(n,r,l,i,e)}}function vu(t,e,n,r,s){if(t.length===0)return s.trim();if(t.length===1){let i=t[0];return r&&!i.endsWith("+")&&(i+="+"),e.length>0&&(i+=` WITH ${e.join(" WITH ")}`),i}let o=n==="AND"?" AND ":" OR ";return t.join(o)}function bu(t){return /\b(?:AND|OR|WITH)\b|\+\s*$|\(/i.test(t)}var Go={"public-domain":0,permissive:1,"weak-copyleft":2,copyleft:3,"network-copyleft":4,proprietary:5,unknown:2};function Ae(t,e,n,r,s){return {spdxId:t.spdxId,name:t.name,expression:r??t.spdxId,family:t.family,category:t.category,riskLevel:t.riskLevel,osiApproved:t.osiApproved,fsfLibre:t.fsfLibre,obligations:t.obligations,matchStatus:e,confidence:n,components:s??[t.spdxId]}}function Ti(t){let e=t.toLowerCase();if(/\bagpl/.test(e))return z("AGPL-3.0-or-later");if(/\bsspl/.test(e))return z("SSPL-1.0");if(/\bbusl|business source/.test(e))return z("BUSL-1.1");if(/\blgpl/.test(e))return z("LGPL-3.0-or-later");if(/\bgpl/.test(e))return z("GPL-3.0-or-later");if(/\bmpl|mozilla/.test(e))return z("MPL-2.0");if(/\bepl|eclipse/.test(e))return z("EPL-2.0");if(/\bapache/.test(e))return z("Apache-2.0");if(/\bbsd/.test(e))return z("BSD-3-Clause");if(/\bmit\b/.test(e))return z("MIT");if(/\bisc\b/.test(e))return z("ISC");if(/commons clause/.test(e))return z("Commons-Clause");if(/proprietary|commercial|all rights reserved/.test(e))return z("LicenseRef-Proprietary");if(/public domain|cc0/.test(e))return z("CC0-1.0")}function wu(t){let e=(t??"").trim();if(!e||/^(unknown|noassertion|none|n\/a)$/i.test(e))return Ae(yr(),"unknown",0);let n=z(e);if(n)return Ae(n,"exact",1);if(bu(e))return Su(e);let r=ji(e);if(r){let o=z(r);if(o)return Ae(o,"alias",.95)}let s=Ti(e);return s?{...Ae(s,"fuzzy",.6),name:e.slice(0,120)}:Ae(yr(e.slice(0,120)),"unknown",0)}function Su(t){let e=yu(t);if(e.licenseIds.length===0)return Ae(yr(t.slice(0,120)),"unknown",0);let n=e.licenseIds.map(c=>{let l=z(c);if(l)return Ae(l,"exact",1);let u=ji(c);if(u){let f=z(u);if(f)return Ae(f,"alias",.95)}let p=Ti(c);return p?Ae(p,"fuzzy",.6):Ae(yr(c),"unknown",0)}),r=e.operator!=="OR",s=n[0];for(let c of n){let l=Go[c.category]>Go[s.category];(r?l:!l)&&(s=c);}let o=ku(r?n:[s]),i=n.map(c=>c.spdxId),a=s.category;return {spdxId:s.spdxId,name:e.normalized,expression:e.normalized,family:s.family,category:a,riskLevel:wi(a),osiApproved:n.every(c=>c.osiApproved),fsfLibre:n.every(c=>c.fsfLibre),obligations:o,matchStatus:"expression",confidence:Math.min(...n.map(c=>c.confidence))||.5,components:i}}function ku(t){let e={attribution:false,copyleft:false,networkCopyleft:false,discloseSource:false,patentGrant:false,commercialRestriction:false};for(let n of t)e.attribution||=n.obligations.attribution,e.copyleft||=n.obligations.copyleft,e.networkCopyleft||=n.obligations.networkCopyleft,e.discloseSource||=n.obligations.discloseSource,e.patentGrant||=n.obligations.patentGrant,e.commercialRestriction||=n.obligations.commercialRestriction;return e}function xu(t,e){let n=(t??"").trim();if(!n)return {raw:null,spdxId:null,source:"none",confidence:0};let r=wu(n);return {raw:n.slice(0,200),spdxId:r.matchStatus==="unknown"?null:r.spdxId,source:e,confidence:r.confidence}}var qo={react:"React","react-dom":"React DOM",vue:"Vue","@angular/core":"Angular",svelte:"Svelte","solid-js":"Solid",preact:"Preact",lit:"Lit",qwik:"Qwik","htmx.org":"htmx",alpinejs:"Alpine.js",stimulus:"Stimulus",next:"Next.js",nuxt:"Nuxt","@remix-run/react":"Remix","@remix-run/node":"Remix (Node)",gatsby:"Gatsby",astro:"Astro","@sveltejs/kit":"SvelteKit","@analogjs/platform":"Analog","@tanstack/start":"TanStack Start",express:"Express",fastify:"Fastify","@nestjs/core":"NestJS",hono:"Hono",koa:"Koa","@hapi/hapi":"Hapi",restify:"Restify","@elysiajs/eden":"Elysia",elysia:"Elysia","@adonisjs/core":"AdonisJS",moleculer:"Moleculer","@feathersjs/feathers":"Feathers",sails:"Sails",typescript:"TypeScript",redux:"Redux","@reduxjs/toolkit":"Redux Toolkit",zustand:"Zustand",mobx:"MobX",jotai:"Jotai",recoil:"Recoil",pinia:"Pinia",vuex:"Vuex","@tanstack/react-query":"TanStack Query",swr:"SWR",xstate:"XState","@ngrx/store":"NgRx",prisma:"Prisma","drizzle-orm":"Drizzle",typeorm:"TypeORM",sequelize:"Sequelize","@mikro-orm/core":"MikroORM",mongoose:"Mongoose",knex:"Knex",kysely:"Kysely",objection:"Objection.js",vite:"Vite",webpack:"webpack",rollup:"Rollup",esbuild:"esbuild",parcel:"Parcel",turbo:"Turbo",tsup:"tsup","@swc/core":"SWC",bun:"Bun",vitest:"Vitest",jest:"Jest","@playwright/test":"Playwright",cypress:"Cypress",mocha:"Mocha",ava:"AVA",storybook:"Storybook","@storybook/react":"Storybook"};async function Eu(t,e,n$1,r,s=Ne){let o$1=n$1?await n$1.findPackageJsonFiles(t):await j(t),i=[],a=new Map,c;try{let S=n$1?P=>n$1.pathExists(P):p,j=B.join(t,"package.json");if(await S(j))try{let P=n$1?await n$1.readJsonFile(j):await n(j);if(P.packageManager){let C=P.packageManager.split("@")[0]?.toLowerCase();C&&["pnpm","yarn","npm","bun"].includes(C)&&(c=C);}}catch{}c||await S(B.join(t,"pnpm-workspace.yaml"))&&(c="pnpm"),c||(await S(B.join(t,"pnpm-lock.yaml"))?c="pnpm":await S(B.join(t,"yarn.lock"))?c="yarn":await S(B.join(t,"package-lock.json"))?c="npm":await S(B.join(t,"bun.lockb"))&&(c="bun"));}catch{}let u=await Kl(t,{exists:S=>n$1?n$1.pathExists(S):p(S),readText:S=>n$1?n$1.readTextFile(S):o(S),readJson:S=>n$1?n$1.readJsonFile(S):n(S)}).catch(()=>null),p$1=r??n$1?.projectScanTimeout??18e4,f=typeof $n.availableParallelism=="function"?$n.availableParallelism():$n.cpus().length||4,d=Math.max(2,Math.min(16,f*2)),h=new a$1(d),g=new Set;if(await Promise.all(o$1.map(async S=>{try{let j=n$1?await n$1.readJsonFile(S):await n(S),P=[j.dependencies,j.devDependencies,j.peerDependencies,j.optionalDependencies];for(let C of P)if(C)for(let[E,y]of Object.entries(C))bi(y)&&g.add(E);}catch{}})),g.size>0)try{await e.prefetch([...g]);}catch{}let v=await Promise.all(o$1.map(async S=>h.run(async()=>{try{let j=ju(S,t,e,n$1,s,u),P=await $e(j,p$1);if(P.ok)return P.value;let C=B.relative(t,B.dirname(S));return n$1&&n$1.addStuckPath(C||"."),console.error(`Timeout scanning ${S} (>${p$1/1e3}s) \u2014 skipped`),n$1?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects"),null}catch(j){let P=j instanceof Error?j.message:String(j);return console.error(`Error scanning ${S}: ${P}`),null}})));for(let S of v)S&&(i.push(S),a.set(S.name,S.path));for(let S of i){let j=[];for(let P of S.dependencies){let C=a.get(P.package);C&&C!==S.path&&j.push({path:C,name:P.package,refType:"workspace"});}j.length>0&&(S.projectReferences=j),c&&(S.packageManager=c);}return i}async function ju(t,e,n$1,r,s,o=null){let i=r?await r.readJsonFile(t):await n(t),a=B.dirname(t),c=B.relative(e,a)||".",l=i.engines?.node??void 0,u,p,f,d;if(l){let y=$r(s,"nodejs"),b=me.minVersion(l);if(y&&b){let T=me.major(b);u=`${y.major}.0.0`,p=Math.max(0,y.major-T);}f=yt(s,"node",l);let x=it("node",l);x&&(d=gt(s,"nodejs",x));}let h=[{name:"dependencies",deps:i.dependencies},{name:"devDependencies",deps:i.devDependencies},{name:"peerDependencies",deps:i.peerDependencies},{name:"optionalDependencies",deps:i.optionalDependencies}],g=[],v=[],S={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=[];for(let y of h)if(y.deps)for(let[b,x]of Object.entries(y.deps))bi(x)&&j.push({pkg:b,section:y.name,spec:x});await n$1.prefetch(j.map(y=>y.pkg));let P=j.map(async y=>{let b=await n$1.get(y.pkg);return {...y,meta:b}}),C=await Promise.all(P);for(let{pkg:y,section:b,spec:x,meta:T}of C){let m=o?.resolve(y,x)??null,A=T.stableVersions.length>0?me.maxSatisfying(T.stableVersions,x)??null:null,$=m&&me.valid(m)?m:A,L=T.latestStableOverall,I=null,D="unknown";if($&&L){let un=me.major($);I=me.major(L)-un,I===0?D=me.eq($,L)?"current":"minor-behind":D="major-behind",I===0?S.current++:I===1?S.oneBehind++:S.twoPlusBehind++;}else S.unknown++;let fe=sl($,L,T.releaseDates),H=ol(fe);g.push({package:y,section:b,currentSpec:x,resolvedVersion:$,latestStable:L,majorsBehind:I,drift:D,license:xu(T.license,"registry"),ageDays:fe,libyears:H}),y in qo&&v.push({name:qo[y],currentVersion:$,latestVersion:L,majorsBehind:I});}for(let y of h)if(y.deps)for(let[b,x]of Object.entries(y.deps))x.trim().startsWith("workspace:")&&(g.push({package:b,section:y.name,currentSpec:x,resolvedVersion:null,latestStable:null,majorsBehind:null,drift:"unknown",license:{raw:null,spdxId:null,source:"none",confidence:0}}),S.unknown++);g.sort((y,b)=>{let x={"major-behind":0,"minor-behind":1,current:2,unknown:3},T=(x[y.drift]??9)-(x[b.drift]??9);return T!==0?T:y.package.localeCompare(b.package)});let E;try{E=r?await r.countFilesUnder(e,a):void 0;}catch{}return {type:"node",path:c,name:i.name??B.basename(a),runtime:l,runtimeLatest:u,runtimeMajorsBehind:p,runtimeEol:f,runtimeEolDate:d,frameworks:v,dependencies:g,dependencyAgeBuckets:S,libyears:il(g.map(y=>y.libyears))??void 0,fileCount:E}}var Ci=new Te({ignoreAttributes:false,attributeNamePrefix:"@_"}),Ho={"Microsoft.AspNetCore.App":"ASP.NET Core","Microsoft.AspNetCore.Mvc":"ASP.NET Core MVC","Microsoft.AspNetCore.Components":"Blazor","Microsoft.AspNetCore.Components.WebAssembly":"Blazor WASM","Microsoft.AspNetCore.SignalR":"SignalR","Microsoft.AspNetCore.OData":"OData","Microsoft.AspNetCore.Identity":"ASP.NET Identity","Microsoft.AspNetCore.Authentication.JwtBearer":"JWT Bearer Auth","Microsoft.AspNetCore.Diagnostics.HealthChecks":"Health Checks","Swashbuckle.AspNetCore":"Swashbuckle","NSwag.AspNetCore":"NSwag","Microsoft.EntityFrameworkCore":"EF Core","Microsoft.EntityFrameworkCore.SqlServer":"EF Core SQL Server","Microsoft.EntityFrameworkCore.Sqlite":"EF Core SQLite","Microsoft.EntityFrameworkCore.Design":"EF Core Design","Microsoft.EntityFrameworkCore.Tools":"EF Core Tools","Npgsql.EntityFrameworkCore.PostgreSQL":"EF Core PostgreSQL","Pomelo.EntityFrameworkCore.MySql":"EF Core MySQL (Pomelo)","MongoDB.EntityFrameworkCore":"EF Core MongoDB",Dapper:"Dapper","Dapper.Contrib":"Dapper Contrib",NHibernate:"NHibernate",Npgsql:"Npgsql",MySqlConnector:"MySqlConnector","MongoDB.Driver":"MongoDB Driver","StackExchange.Redis":"StackExchange.Redis","Microsoft.Data.SqlClient":"SqlClient","Oracle.ManagedDataAccess.Core":"Oracle (Managed)",Cassandra:"Cassandra Driver","Neo4j.Driver":"Neo4j Driver",Marten:"Marten",LiteDB:"LiteDB","RavenDB.Client":"RavenDB","Microsoft.Extensions.Hosting":".NET Hosting","Microsoft.Extensions.Hosting.Abstractions":".NET Hosting Abstractions","Microsoft.Extensions.DependencyInjection":".NET DI","Microsoft.Extensions.DependencyInjection.Abstractions":".NET DI Abstractions","Microsoft.Extensions.Configuration":".NET Configuration","Microsoft.Extensions.Configuration.Abstractions":".NET Configuration Abstractions","Microsoft.Extensions.Configuration.Binder":".NET Configuration Binder","Microsoft.Extensions.Configuration.EnvironmentVariables":".NET Configuration EnvVars","Microsoft.Extensions.Configuration.Json":".NET Configuration JSON","Microsoft.Extensions.Configuration.UserSecrets":".NET Configuration UserSecrets","Microsoft.Extensions.Logging":".NET Logging","Microsoft.Extensions.Logging.Abstractions":".NET Logging Abstractions","Microsoft.Extensions.Logging.Console":".NET Logging Console","Microsoft.Extensions.Logging.Debug":".NET Logging Debug","Microsoft.Extensions.Logging.EventSource":".NET Logging EventSource","Microsoft.Extensions.Options":".NET Options","Microsoft.Extensions.Options.ConfigurationExtensions":".NET Options Configuration","Microsoft.Extensions.Options.DataAnnotations":".NET Options DataAnnotations","Microsoft.Extensions.Caching.Memory":".NET Memory Cache","Microsoft.Extensions.Caching.Abstractions":".NET Caching Abstractions","Microsoft.Extensions.Caching.StackExchangeRedis":".NET Redis Cache","Microsoft.Extensions.Http":".NET HttpClientFactory","Microsoft.Extensions.Http.Resilience":".NET HttpClient Resilience","Microsoft.Extensions.Resilience":".NET Resilience","Microsoft.Extensions.Diagnostics":".NET Diagnostics","Microsoft.Extensions.Diagnostics.HealthChecks":".NET Health Checks (Extensions)","Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions":".NET Health Checks Abstractions","Microsoft.Extensions.FileProviders.Abstractions":".NET File Providers","Microsoft.Extensions.FileProviders.Physical":".NET File Providers Physical","Microsoft.Extensions.Localization":".NET Localization","Microsoft.Extensions.Localization.Abstractions":".NET Localization Abstractions","Microsoft.Extensions.Primitives":".NET Primitives","System.Text.Json":".NET System.Text.Json","System.Text.Encodings.Web":".NET System.Text.Encodings.Web","System.Net.Http.Json":".NET System.Net.Http.Json","System.ComponentModel.Annotations":".NET ComponentModel Annotations",MediatR:"MediatR",Wolverine:"Wolverine",Brighter:"Brighter",AutoMapper:"AutoMapper",Mapster:"Mapster","Riok.Mapperly":"Mapperly",FluentValidation:"FluentValidation","FluentValidation.AspNetCore":"FluentValidation ASP.NET","Newtonsoft.Json":"Newtonsoft.Json",MessagePack:"MessagePack","protobuf-net":"protobuf-net",CsvHelper:"CsvHelper",Serilog:"Serilog","Serilog.AspNetCore":"Serilog ASP.NET","Serilog.Sinks.Console":"Serilog Console","Serilog.Sinks.Seq":"Serilog Seq","Serilog.Sinks.File":"Serilog File","Serilog.Sinks.Elasticsearch":"Serilog Elasticsearch",NLog:"NLog","NLog.Web.AspNetCore":"NLog ASP.NET",log4net:"log4net",OpenTelemetry:"OpenTelemetry","OpenTelemetry.Extensions.Hosting":"OpenTelemetry Hosting","OpenTelemetry.Instrumentation.AspNetCore":"OpenTelemetry ASP.NET","OpenTelemetry.Exporter.Prometheus":"OpenTelemetry Prometheus","OpenTelemetry.Exporter.Jaeger":"OpenTelemetry Jaeger","OpenTelemetry.Exporter.OpenTelemetryProtocol":"OpenTelemetry OTLP","App.Metrics":"App.Metrics","prometheus-net":"Prometheus.NET","Elastic.Apm":"Elastic APM",xunit:"xUnit","xunit.runner.visualstudio":"xUnit Runner",NUnit:"NUnit",NUnit3TestAdapter:"NUnit Adapter","MSTest.TestFramework":"MSTest","MSTest.TestAdapter":"MSTest Adapter",Moq:"Moq",NSubstitute:"NSubstitute",FakeItEasy:"FakeItEasy",FluentAssertions:"FluentAssertions",Shouldly:"Shouldly",Bogus:"Bogus",AutoFixture:"AutoFixture","WireMock.Net":"WireMock.Net",Testcontainers:"Testcontainers",Respawn:"Respawn",BenchmarkDotNet:"BenchmarkDotNet","coverlet.collector":"Coverlet",SpecFlow:"SpecFlow",TUnit:"TUnit","Verify.Xunit":"Verify",Snapshooter:"Snapshooter",MassTransit:"MassTransit","MassTransit.RabbitMQ":"MassTransit RabbitMQ","MassTransit.Azure.ServiceBus.Core":"MassTransit Azure SB",NServiceBus:"NServiceBus","RabbitMQ.Client":"RabbitMQ Client","Confluent.Kafka":"Confluent Kafka","Azure.Messaging.ServiceBus":"Azure Service Bus","Azure.Messaging.EventHubs":"Azure Event Hubs","Amazon.SQS":"AWS SQS","Amazon.SNS":"AWS SNS",Rebus:"Rebus",EasyNetQ:"EasyNetQ",SlimMessageBus:"SlimMessageBus",CAP:"DotNetCore.CAP","AWSSDK.Core":"AWS SDK Core","AWSSDK.S3":"AWS SDK S3","AWSSDK.SQS":"AWS SDK SQS","AWSSDK.DynamoDBv2":"AWS SDK DynamoDB","AWSSDK.Lambda":"AWS SDK Lambda","AWSSDK.SecretsManager":"AWS SDK Secrets Manager","AWSSDK.CloudWatch":"AWS SDK CloudWatch","Azure.Storage.Blobs":"Azure Blob Storage","Azure.Identity":"Azure Identity","Azure.Security.KeyVault.Secrets":"Azure Key Vault","Azure.Cosmos":"Azure Cosmos DB","Microsoft.Azure.Functions.Worker":"Azure Functions","Google.Cloud.Storage.V1":"GCP Storage","Google.Cloud.PubSub.V1":"GCP Pub/Sub","Google.Cloud.Firestore":"GCP Firestore","Microsoft.Identity.Web":"Microsoft Identity Web","Microsoft.Identity.Client":"MSAL",IdentityServer4:"IdentityServer4","Duende.IdentityServer":"Duende IdentityServer","Microsoft.AspNetCore.Authentication.OpenIdConnect":"OpenID Connect",IdentityModel:"IdentityModel",Refit:"Refit",RestSharp:"RestSharp","Flurl.Http":"Flurl",Polly:"Polly","Polly.Extensions.Http":"Polly HTTP","Microsoft.Extensions.Http.Polly":"HttpClient Polly","Grpc.AspNetCore":"gRPC ASP.NET","Grpc.Net.Client":"gRPC Client","GraphQL.Server.All":"GraphQL Server","HotChocolate.AspNetCore":"Hot Chocolate (GraphQL)",Hangfire:"Hangfire","Hangfire.Core":"Hangfire Core","Hangfire.AspNetCore":"Hangfire ASP.NET",Quartz:"Quartz.NET","Quartz.Extensions.Hosting":"Quartz.NET Hosting",Coravel:"Coravel",EPPlus:"EPPlus",ClosedXML:"ClosedXML",iTextSharp:"iTextSharp",QuestPDF:"QuestPDF",ImageSharp:"ImageSharp","SixLabors.ImageSharp":"ImageSharp","LaunchDarkly.ServerSdk":"LaunchDarkly","Microsoft.FeatureManagement":"Feature Management","Microsoft.FeatureManagement.AspNetCore":"Feature Management ASP.NET","Dapr.Client":"Dapr","Steeltoe.Discovery.ClientCore":"Steeltoe",Ocelot:"Ocelot (API Gateway)","Yarp.ReverseProxy":"YARP","Microsoft.AspNetCore.SignalR.Client":"SignalR Client"};function ns(t){return t.replace(/\\/g,"/")}function Tu(t){let e=t.match(/^net(\d+)\.\d+$/);if(e?.[1])return parseInt(e[1],10);let n=t.match(/^netcoreapp(\d+)\.\d+$/);return n?.[1]?parseInt(n[1],10):(t.startsWith("netstandard")||t.match(/^net(\d)(\d+)?$/),null)}function zo(t){return t.endsWith(".csproj")||t.endsWith(".vbproj")}function rs(t){return B.basename(t).replace(/\.(cs|vb)proj$/i,"")}function Cu(t,e){let r=Ci.parse(t)?.Project;if(!r)return {targetFrameworks:[],packageReferences:[],projectReferences:[],projectName:rs(e)};let s=Array.isArray(r.PropertyGroup)?r.PropertyGroup:r.PropertyGroup?[r.PropertyGroup]:[],o=[];for(let l of s)if(l.TargetFramework&&o.push(String(l.TargetFramework)),l.TargetFrameworks){let u=String(l.TargetFrameworks).split(";").map(p=>p.trim()).filter(Boolean);o.push(...u);}let i=Array.isArray(r.ItemGroup)?r.ItemGroup:r.ItemGroup?[r.ItemGroup]:[],a=[],c=[];for(let l of i){let u=Array.isArray(l.PackageReference)?l.PackageReference:l.PackageReference?[l.PackageReference]:[];for(let f of u){let d=f["@_Include"]??f["@_include"]??"",h=f["@_Version"]??f["@_version"]??f.Version??"";d&&h&&a.push({name:String(d),version:String(h)});}let p=Array.isArray(l.ProjectReference)?l.ProjectReference:l.ProjectReference?[l.ProjectReference]:[];for(let f of p){let d=f["@_Include"]??f["@_include"]??"";d&&c.push(String(d).replace(/\\/g,"/"));}}return {targetFrameworks:[...new Set(o)],packageReferences:a,projectReferences:c,projectName:rs(e)}}function Au(t){let n=Ci.parse(t)?.packages;if(!n)return [];let r=Array.isArray(n.package)?n.package:n.package?[n.package]:[],s=[];for(let o of r){let i=o["@_id"]??o["@_Id"]??"",a=o["@_version"]??o["@_Version"]??"";i&&a&&s.push({name:String(i),version:String(a)});}return s}async function Pu(t,e,n,r,s=Ne){let o$1=n?await n.findFiles(t,zo):await i(t,zo),i$1=n?await n.findSolutionFiles(t):await k$1(t),a=new Set;for(let p of i$1)try{let f=n?await n.readTextFile(p):await o(p),d=B.dirname(p),h=/Project\("[^"]*"\)\s*=\s*"[^"]*",\s*"([^"]+\.(?:cs|vb)proj)"/g,g;for(;(g=h.exec(f))!==null;)if(g[1]){let v=B.resolve(d,g[1].replace(/\\/g,"/"));a.add(v);}}catch{}let c=new Set([...o$1,...a]),l=[],u=r??n?.projectScanTimeout??18e4;for(let p of c)try{let f=Mu(p,t,e,n,s),d=await $e(f,u);if(d.ok)l.push(d.value);else {let h=ns(B.relative(t,B.dirname(p)));n&&n.addStuckPath(h||"."),console.error(`Timeout scanning ${p} (>${u/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(f){let d=f instanceof Error?f.message:String(f);console.error(`Error scanning ${p}: ${d}`);}return l}async function Mu(t,e,n,r,s){let o$1=r?await r.readTextFile(t):await o(t),i=Cu(o$1,t),a=B.dirname(t);{let E=B.join(a,"packages.config");try{let y=r?await r.readTextFile(E):await o(E),b=new Set(i.packageReferences.map(x=>x.name.toLowerCase()));for(let x of Au(y))b.has(x.name.toLowerCase())||(i.packageReferences.push(x),b.add(x.name.toLowerCase()));}catch{}}let c=i.targetFrameworks[0],l=dn(s,"dotnet")?.major,u,p,f,d=c;if(c){let E=Tu(c);E!==null&&l!==void 0&&(u=Math.max(0,l-E)),p=yt(s,"dotnet",c);let y=it("dotnet",c);y&&(f=gt(s,"dotnet",y));}let h=[],g={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};if(n){let E=i.packageReferences.map(async b=>{let x=await n.get(b.name);return {ref:b,meta:x}}),y=await Promise.all(E);for(let{ref:b,meta:x}of y){let T=Ct.valid(b.version)?b.version:null,m=x.latestStableOverall,A=null,$="unknown";if(T&&m){let L=Ct.major(T);A=Ct.major(m)-L,A===0?$=Ct.eq(T,m)?"current":"minor-behind":A>0?$="major-behind":$="current",A<=0?g.current++:A===1?g.oneBehind++:g.twoPlusBehind++;}else g.unknown++;h.push({package:b.name,section:"dependencies",currentSpec:b.version,resolvedVersion:T,latestStable:m,majorsBehind:A,drift:$});}}else for(let E of i.packageReferences)h.push({package:E.name,section:"dependencies",currentSpec:E.version,resolvedVersion:E.version,latestStable:null,majorsBehind:null,drift:"unknown"}),g.unknown++;let v=[],S=new Map(h.map(E=>[E.package,E]));for(let E of i.packageReferences)if(E.name in Ho){let y=S.get(E.name);v.push({name:Ho[E.name],currentVersion:y?.resolvedVersion??E.version,latestVersion:y?.latestStable??null,majorsBehind:y?.majorsBehind??null});}let j=i.projectReferences.map(E=>{let y=B.resolve(a,E),b=ns(B.relative(e,B.dirname(y))),x=rs(y);return {path:b||".",name:x,refType:"project"}}),P;try{P=r?await r.countFilesUnder(e,a):void 0;}catch{}h.sort((E,y)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},x=(b[E.drift]??9)-(b[y.drift]??9);return x!==0?x:E.package.localeCompare(y.package)});let C=g;return {type:"dotnet",path:ns(B.relative(e,a))||".",name:i.projectName,targetFramework:d,runtime:c,runtimeLatest:l!==void 0?`net${l}.0`:void 0,runtimeMajorsBehind:u,runtimeEol:p,runtimeEolDate:f,frameworks:v,dependencies:h,dependencyAgeBuckets:C,projectReferences:j.length>0?j:void 0,fileCount:P}}function Ai(t){if(!t)return null;try{let e=Hr(t);return e&&typeof e=="object"?e:null}catch{return null}}function vr(t){return t.trim().toLowerCase().replace(/[-_.]+/g,"-")}function $u(t){let e=t.trim().replace(/^[=~^><!]+\s*/,"").split(/[,;\s]/)[0];return /^\d/.test(e)?e:null}function Lu(t){let e=new Map,r=Ai(t)?.package;if(!Array.isArray(r))return e;for(let s of r){if(!s||typeof s!="object")continue;let{name:o,version:i}=s;if(typeof o!="string"||typeof i!="string")continue;let a=vr(o);e.has(a)||e.set(a,i);}return e}function Nu(t){let e=new Map;if(!t||typeof t!="object")return e;let n=t;for(let r of ["default","develop"]){let s=n[r];if(!(!s||typeof s!="object"))for(let[o,i]of Object.entries(s)){let a=i&&typeof i=="object"?i.version:void 0;if(typeof a!="string")continue;let c=$u(a),l=vr(o);c&&!e.has(l)&&e.set(l,c);}}return e}var Ru=[["poetry","poetry.lock"],["uv","uv.lock"],["pdm","pdm.lock"]];async function Iu(t,e){for(let[r,s]of Ru){let o=B.join(t,s);if(await e.exists(o).catch(()=>false))try{let i=Lu(await e.readText(o));if(i.size)return {source:r,size:i.size,resolve:a=>i.get(vr(a))??null}}catch{}}let n=B.join(t,"Pipfile.lock");if(await e.exists(n).catch(()=>false))try{let r=Nu(await e.readJson(n));if(r.size)return {source:"pipfile",size:r.size,resolve:s=>r.get(vr(s))??null}}catch{}return null}var Wo={django:"Django",flask:"Flask",fastapi:"FastAPI",starlette:"Starlette",tornado:"Tornado",bottle:"Bottle",sanic:"Sanic",falcon:"Falcon",aiohttp:"aiohttp",quart:"Quart",litestar:"Litestar",robyn:"Robyn",sqlalchemy:"SQLAlchemy","django-rest-framework":"DRF",djangorestframework:"DRF",peewee:"Peewee","tortoise-orm":"Tortoise ORM",sqlmodel:"SQLModel",pony:"Pony ORM",alembic:"Alembic",psycopg2:"psycopg2","psycopg2-binary":"psycopg2",psycopg:"psycopg3",asyncpg:"asyncpg",pymongo:"PyMongo",motor:"Motor",redis:"redis-py",celery:"Celery",boto3:"AWS SDK (boto3)",botocore:"AWS SDK (botocore)",numpy:"NumPy",pandas:"pandas",scipy:"SciPy","scikit-learn":"scikit-learn",tensorflow:"TensorFlow",torch:"PyTorch",keras:"Keras",matplotlib:"Matplotlib",seaborn:"Seaborn",plotly:"Plotly",polars:"Polars",dask:"Dask",xgboost:"XGBoost",lightgbm:"LightGBM",transformers:"Transformers (HF)",langchain:"LangChain",openai:"OpenAI SDK",pytest:"pytest",unittest2:"unittest2",nose2:"nose2",tox:"tox",hypothesis:"Hypothesis","factory-boy":"factory_boy",faker:"Faker",coverage:"Coverage.py",responses:"responses",httpx:"HTTPX",uvicorn:"Uvicorn",gunicorn:"Gunicorn",hypercorn:"Hypercorn",dramatiq:"Dramatiq",rq:"RQ",huey:"Huey",pyjwt:"PyJWT",authlib:"Authlib","python-jose":"python-jose",passlib:"Passlib",cryptography:"cryptography",pydantic:"Pydantic",marshmallow:"Marshmallow",attrs:"attrs",cerberus:"Cerberus",msgpack:"msgpack",protobuf:"protobuf",requests:"Requests",urllib3:"urllib3",ansible:"Ansible",fabric:"Fabric",invoke:"Invoke",paramiko:"Paramiko",black:"Black",ruff:"Ruff",flake8:"Flake8",mypy:"mypy",pylint:"Pylint",isort:"isort",bandit:"Bandit",structlog:"structlog",loguru:"Loguru","sentry-sdk":"Sentry SDK","opentelemetry-api":"OpenTelemetry","prometheus-client":"prometheus-client"};function ms(t){let e=t.trim();if(!e||e.startsWith("#")||e.startsWith("-"))return null;let r=e.split(";")[0].trim().match(/^([A-Za-z0-9][-A-Za-z0-9_.]*[A-Za-z0-9]?)(?:\[.*?\])?\s*(.*)?$/);if(!r)return null;let s=r[1],o=(r[2]??"").trim(),i=s.toLowerCase().replace(/[_.]+/g,"-");return {name:s,spec:o,normalisedName:i}}function _u(t){return t.match(/^==\s*([^\s,;]+)/)?.[1]??null}function Fu(t){let e=t.replace(/^[vV]/,"").trim();if(/(?:a\d|b\d|rc\d|alpha|beta|dev|post)/i.test(e))return null;let n=e.split(".");for(;n.length<3;)n.push("0");return e=n.slice(0,3).join("."),At.valid(e)}function Ou(t){let e=[];for(let n of t.split(`
73
+ `)){let r=ms(n);r&&e.push(r);}return e}function Bu(t){let e={dependencies:[]},n=t.match(/^\s*name\s*=\s*"([^"]+)"/m);n&&(e.projectName=n[1]);let r=t.match(/^\s*requires-python\s*=\s*"([^"]+)"/m);r&&(e.pythonVersion=r[1]);let s=t.match(/^\s*dependencies\s*=\s*\[([\s\S]*?)\]/m);if(s){let i=s[1],a=/"([^"]+)"/g,c;for(;(c=a.exec(i))!==null;){let l=ms(c[1]);l&&e.dependencies.push(l);}}let o=t.match(/\[tool\.poetry\.dependencies\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(o){let i=o[1].split(`
74
+ `);for(let a of i){let c=a.match(/^\s*([A-Za-z0-9][-A-Za-z0-9_.]*)\s*=\s*(?:"([^"]+)"|{.*?version\s*=\s*"([^"]+)".*?})/);if(c){let l=c[1];if(l.toLowerCase()==="python"){e.pythonVersion=c[2]??c[3]??void 0;continue}let u=c[2]??c[3]??"",p=l.toLowerCase().replace(/[_.]+/g,"-");e.dependencies.push({name:l,spec:u?`==${u}`:"",normalisedName:p});}}}return e}function Vu(t){let e=[],n=t.match(/\[packages\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(n){let s=n[1].split(`
75
75
  `);for(let o of s){let i=o.match(/^\s*([A-Za-z0-9][-A-Za-z0-9_.]*)\s*=\s*(?:"([^"]+)"|{.*?version\s*=\s*"([^"]+)".*?}|\*|"[*]")/);if(i){let a=i[1],c=i[2]??i[3]??"",l=a.toLowerCase().replace(/[_.]+/g,"-");e.push({name:a,spec:c||"*",normalisedName:l});}}}let r=t.match(/\[dev-packages\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(r){let s=r[1].split(`
76
- `);for(let o of s){let i=o.match(/^\s*([A-Za-z0-9][-A-Za-z0-9_.]*)\s*=\s*(?:"([^"]+)"|{.*?version\s*=\s*"([^"]+)".*?}|\*|"[*]")/);if(i){let a=i[1],c=i[2]??i[3]??"",l=a.toLowerCase().replace(/[_.]+/g,"-");e.push({name:a,spec:c||"*",normalisedName:l});}}}return e}function Lu(t){let e={deps:[]},n=t.match(/\[metadata\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(n){let s=n[1].match(/^\s*name\s*=\s*(.+)$/m);s&&(e.name=s[1].trim());}let r=t.match(/\[options\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(r){let s=r[1].match(/^\s*python_requires\s*=\s*(.+)$/m);s&&(e.pythonVersion=s[1].trim());let o=r[1].match(/install_requires\s*=\s*\n((?:\s+.*\n?)*)/);if(o){let i=o[1];for(let a of i.split(`
77
- `)){let c=ds(a);c&&e.deps.push(c);}}}return e}var xi=new Set(["requirements.txt","requirements-dev.txt","requirements_dev.txt","requirements-test.txt","dev-requirements.txt","pyproject.toml","setup.py","setup.cfg","Pipfile"]);async function Nu(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,l=>xi.has(l)||/^requirements.*\.txt$/.test(l)):await Ru(t),i=new Map;for(let l of o){let u=B.dirname(l);i.has(u)||i.set(u,[]),i.get(u).push(l);}let a=[],c=r??n?.projectScanTimeout??18e4;for(let[l,u]of i)try{let p=Iu(l,u,t,e,n,s),f=await Me(p,c);if(f.ok)a.push(f.value);else {let d=B.relative(t,l);n&&n.addStuckPath(d||"."),console.error(`Timeout scanning Python project ${l} (>${c/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(p){let f=p instanceof Error?p.message:String(p);console.error(`Error scanning Python project ${l}: ${f}`);}return a}async function Ru(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>xi.has(n)||/^requirements.*\.txt$/.test(n))}async function Iu(t,e,n$1,r,s,o$1){let i=B.relative(n$1,t)||".",a=B.basename(t===n$1?n$1:t),c,l=new Map;for(let b of e){let k=B.basename(b),T=s?await s.readTextFile(b):await o(b);if(k==="pyproject.toml"){let m=Mu(T);m.projectName&&(a=m.projectName),m.pythonVersion&&(c=m.pythonVersion);for(let A of m.dependencies)l.has(A.normalisedName)||l.set(A.normalisedName,A);}else if(k==="setup.cfg"){let m=Lu(T);m.name&&(a=m.name),m.pythonVersion&&!c&&(c=m.pythonVersion);for(let A of m.deps)l.has(A.normalisedName)||l.set(A.normalisedName,A);}else if(k==="Pipfile")for(let m of $u(T))l.has(m.normalisedName)||l.set(m.normalisedName,m);else if(k.startsWith("requirements")&&k.endsWith(".txt"))for(let m of Pu(T))l.has(m.normalisedName)||l.set(m.normalisedName,m);}let u,p$1,f,d;if(c){let b=c.match(/(\d+)\.(\d+)/);if(b){let T=parseInt(b[1],10),m=parseInt(b[2],10),A=pn(o$1,"python");A&&(T===A.major?u=Math.max(0,A.minor-m):T<A.major&&(u=A.minor+(A.major-T)*10),p$1=`${A.major}.${A.minor}`);}f=yt(o$1,"python",c);let k=it("python",c);k&&(d=gt(o$1,"python",k));}let g=await Tu(t,{exists:b=>s?s.pathExists(b):p(b),readText:b=>s?s.readTextFile(b):o(b),readJson:b=>s?s.readJsonFile(b):n(b)}).catch(()=>null),v=[],w=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},C=[...l.values()].map(async b=>{let k=await r.get(b.normalisedName);return {dep:b,meta:k}}),x=await Promise.all(C);for(let{dep:b,meta:k}of x){let m=g?.resolve(b.normalisedName)??null??Cu(b.spec),A=m?Au(m):null,$=k.latestStableOverall,L=null,I="unknown";if(A&&$){let V=At.major(A);L=At.major($)-V,L===0?I=At.eq(A,$)?"current":"minor-behind":L>0?I="major-behind":I="current",L<=0?j.current++:L===1?j.oneBehind++:j.twoPlusBehind++;}else j.unknown++;v.push({package:b.name,section:"dependencies",currentSpec:b.spec||"*",resolvedVersion:A,latestStable:$,majorsBehind:L,drift:I}),b.normalisedName in Uo&&w.push({name:Uo[b.normalisedName],currentVersion:A,latestVersion:$,majorsBehind:L});}v.sort((b,k)=>{let T={"major-behind":0,"minor-behind":1,current:2,unknown:3},m=(T[b.drift]??9)-(T[k.drift]??9);return m!==0?m:b.package.localeCompare(k.package)});let y;try{y=s?await s.countFilesUnder(n$1,t):void 0;}catch{}return {type:"python",path:i,name:a,runtime:c,runtimeLatest:p$1,runtimeMajorsBehind:u,runtimeEol:f,runtimeEolDate:d,frameworks:w,dependencies:v,dependencyAgeBuckets:j,fileCount:y}}var _u=/^([^:=\s]+):([^:=\s]+):([^=\s]+)=/;function ji(t){let e=new Map;if(!t)return e;for(let n of t.split(`
78
- `)){let r=n.trim();if(!r||r.startsWith("#")||r.startsWith("empty="))continue;let s=_u.exec(r);if(!s)continue;let o=`${s[1]}:${s[2]}`;e.has(o)||e.set(o,s[3]);}return e}async function Fu(t,e){let n=B.join(t,"gradle.lockfile");if(!await e.exists(n).catch(()=>false))return null;try{let r=ji(await e.readText(n));return r.size?{size:r.size,resolve:s=>r.get(s)??null}:null}catch{return null}}var Ou=new je({ignoreAttributes:false,attributeNamePrefix:"@_"}),Go={"org.springframework.boot:spring-boot-starter-web":"Spring Boot Web","org.springframework.boot:spring-boot-starter":"Spring Boot","org.springframework.boot:spring-boot-starter-data-jpa":"Spring Data JPA","org.springframework.boot:spring-boot-starter-security":"Spring Security","org.springframework.boot:spring-boot-starter-webflux":"Spring WebFlux","org.springframework.boot:spring-boot-starter-actuator":"Spring Actuator","org.springframework.boot:spring-boot-starter-test":"Spring Boot Test","org.springframework:spring-core":"Spring Framework","org.springframework:spring-web":"Spring Web","org.springframework:spring-webmvc":"Spring MVC","org.springframework.cloud:spring-cloud-starter-netflix-eureka-client":"Spring Cloud Eureka","org.springframework.cloud:spring-cloud-starter-gateway":"Spring Cloud Gateway","org.springframework.kafka:spring-kafka":"Spring Kafka","jakarta.platform:jakarta.jakartaee-api":"Jakarta EE","jakarta.servlet:jakarta.servlet-api":"Jakarta Servlet","javax.servlet:javax.servlet-api":"Java Servlet (Legacy)","io.micronaut:micronaut-core":"Micronaut","io.micronaut:micronaut-http-server-netty":"Micronaut HTTP","io.quarkus:quarkus-core":"Quarkus","io.quarkus:quarkus-resteasy":"Quarkus RESTEasy","io.quarkus:quarkus-resteasy-reactive":"Quarkus RESTEasy Reactive","io.vertx:vertx-core":"Vert.x","io.vertx:vertx-web":"Vert.x Web","org.hibernate.orm:hibernate-core":"Hibernate","org.hibernate:hibernate-core":"Hibernate","org.mybatis:mybatis":"MyBatis","org.mybatis.spring.boot:mybatis-spring-boot-starter":"MyBatis Spring Boot","org.jooq:jooq":"jOOQ","org.flywaydb:flyway-core":"Flyway","org.liquibase:liquibase-core":"Liquibase","com.zaxxer:HikariCP":"HikariCP","org.postgresql:postgresql":"PostgreSQL JDBC","com.mysql:mysql-connector-j":"MySQL Connector","mysql:mysql-connector-java":"MySQL Connector (Legacy)","com.oracle.database.jdbc:ojdbc11":"Oracle JDBC","org.mongodb:mongodb-driver-sync":"MongoDB Driver","io.lettuce:lettuce-core":"Lettuce (Redis)","redis.clients:jedis":"Jedis (Redis)","org.apache.kafka:kafka-clients":"Apache Kafka","com.rabbitmq:amqp-client":"RabbitMQ Client","software.amazon.awssdk:sqs":"AWS SQS","software.amazon.awssdk:sns":"AWS SNS","com.squareup.okhttp3:okhttp":"OkHttp","com.squareup.retrofit2:retrofit":"Retrofit","org.apache.httpcomponents.client5:httpclient5":"Apache HttpClient 5","io.grpc:grpc-netty":"gRPC","com.graphql-java:graphql-java":"GraphQL Java","com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter":"Netflix DGS","com.fasterxml.jackson.core:jackson-databind":"Jackson","com.google.code.gson:gson":"Gson","junit:junit":"JUnit 4","org.junit.jupiter:junit-jupiter":"JUnit 5","org.junit.jupiter:junit-jupiter-api":"JUnit 5","org.mockito:mockito-core":"Mockito","org.assertj:assertj-core":"AssertJ","org.testcontainers:testcontainers":"Testcontainers","io.rest-assured:rest-assured":"REST Assured","org.awaitility:awaitility":"Awaitility","com.tngtech.archunit:archunit-junit5":"ArchUnit","org.hamcrest:hamcrest":"Hamcrest","org.slf4j:slf4j-api":"SLF4J","ch.qos.logback:logback-classic":"Logback","org.apache.logging.log4j:log4j-core":"Log4j2","org.projectlombok:lombok":"Lombok","org.mapstruct:mapstruct":"MapStruct","software.amazon.awssdk:bom":"AWS SDK v2","com.google.cloud:google-cloud-bom":"Google Cloud SDK","com.azure:azure-sdk-bom":"Azure SDK","io.jsonwebtoken:jjwt-api":"JJWT","com.nimbusds:nimbus-jose-jwt":"Nimbus JOSE+JWT","io.micrometer:micrometer-core":"Micrometer","io.opentelemetry:opentelemetry-api":"OpenTelemetry","io.prometheus:simpleclient":"Prometheus Client","io.projectreactor:reactor-core":"Project Reactor","io.reactivex.rxjava3:rxjava":"RxJava 3"};function Bu(t,e){let r=Ou.parse(t)?.project;if(!r)return {artifactId:B.basename(B.dirname(e)),dependencies:[],modules:[],properties:{}};let s={};if(r.properties&&typeof r.properties=="object")for(let[g,v]of Object.entries(r.properties))(typeof v=="string"||typeof v=="number")&&(s[g]=String(v));let o,i=["java.version","maven.compiler.source","maven.compiler.target","maven.compiler.release","java.source.version"];for(let g of i)if(s[g]){o=String(s[g]);break}let a=r.dependencies,l=(a?.dependency?Array.isArray(a.dependency)?a.dependency:[a.dependency]:[]).filter(g=>g.groupId&&g.artifactId).map(g=>({groupId:Xt(String(g.groupId??""),s),artifactId:Xt(String(g.artifactId??""),s),version:Xt(String(g.version??""),s),scope:g.scope?String(g.scope):void 0})),u=r.dependencyManagement?.dependencies,p=u?.dependency?Array.isArray(u.dependency)?u.dependency:[u.dependency]:[];for(let g of p)g.groupId&&g.artifactId&&g.version&&l.push({groupId:Xt(String(g.groupId),s),artifactId:Xt(String(g.artifactId),s),version:Xt(String(g.version),s),scope:g.scope?String(g.scope):void 0});let d=(r.modules?.module?Array.isArray(r.modules.module)?r.modules.module:[r.modules.module]:[]).map(String),h;return r.parent?.groupId&&r.parent?.artifactId&&(h={groupId:String(r.parent.groupId),artifactId:String(r.parent.artifactId),version:String(r.parent.version??"")}),{groupId:r.groupId?String(r.groupId):h?.groupId,artifactId:String(r.artifactId??B.basename(B.dirname(e))),version:r.version?String(r.version):h?.version,packaging:r.packaging?String(r.packaging):void 0,javaVersion:o,dependencies:l,modules:d,parent:h,properties:s}}function Xt(t,e){return t.replace(/\$\{([^}]+)\}/g,(n,r)=>e[r]??`\${${r}}`)}function Vu(t,e){let n=[],r=B.basename(B.dirname(e)),s,o=t.match(/(?:sourceCompatibility|targetCompatibility|javaVersion)\s*[=:]\s*['"]?(?:JavaVersion\.VERSION_)?(\d+)['"]?/);o&&(s=o[1]);let i=t.match(/JavaLanguageVersion\.of\((\d+)\)/);i&&(s=i[1]);let a=/(?:implementation|api|compileOnly|runtimeOnly|testImplementation|testRuntimeOnly|annotationProcessor|kapt)\s*(?:\(?\s*)?['"]([^'"]+)['"]/g,c;for(;(c=a.exec(t))!==null;){let p=c[1].split(":");p.length>=2&&n.push({groupId:p[0],artifactId:p[1],version:p[2]??"",configuration:c[0].split(/\s/)[0]});}let l=/(?:implementation|api|compileOnly|runtimeOnly|testImplementation|testRuntimeOnly|annotationProcessor|kapt)\s*\(\s*"([^"]+)"\s*\)/g;for(;(c=l.exec(t))!==null;){let p=c[1].split(":");if(p.length>=2){let f=`${p[0]}:${p[1]}`;n.some(d=>`${d.groupId}:${d.artifactId}`===f)||n.push({groupId:p[0],artifactId:p[1],version:p[2]??"",configuration:c[0].split(/\s/)[0]});}}let u=/(?:implementation|api)\s*(?:\(?\s*)?platform\s*\(\s*['"]([^'"]+)['"]\s*\)/g;for(;(c=u.exec(t))!==null;){let p=c[1].split(":");p.length>=2&&n.push({groupId:p[0],artifactId:p[1],version:p[2]??"",configuration:"platform"});}return {javaVersion:s,dependencies:n,projectName:r}}function Du(t){let e=t.trim();if(!e||e.includes("$")||/(?:[-.](?:SNAPSHOT|alpha|beta|rc|M\d+|CR\d+))/i.test(e))return null;e=e.replace(/\.(?:RELEASE|Final|GA)$/i,"");let n=e.split(".");for(;n.length<3;)n.push("0");return e=n.slice(0,3).join("."),Pt.valid(e)}var Ti=new Set(["pom.xml","build.gradle","build.gradle.kts"]);async function Uu(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,u=>Ti.has(u)):await Gu(t),i=new Map;for(let u of o){let p=B.dirname(u);i.has(p)||i.set(p,[]),i.get(p).push(u);}let a=[],c=r??n?.projectScanTimeout??18e4;for(let[u,p]of i)try{let f=qu(u,p,t,e,n,s),d=await Me(f,c);if(d.ok)a.push(d.value);else {let h=B.relative(t,u);n&&n.addStuckPath(h||"."),console.error(`Timeout scanning Java project ${u} (>${c/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(f){let d=f instanceof Error?f.message:String(f);console.error(`Error scanning Java project ${u}: ${d}`);}let l=new Map;for(let u of a)l.set(u.name,u.path);return a}async function Gu(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ti.has(n))}async function qu(t,e,n$1,r,s,o$1){let i=B.relative(n$1,t)||".",a=B.basename(t===n$1?n$1:t),c,l=new Map,u=[];for(let T of e){let m=B.basename(T),A=s?await s.readTextFile(T):await o(T);if(m==="pom.xml"){let $=Bu(A,T);$.artifactId&&(a=$.artifactId),$.javaVersion&&(c=$.javaVersion);for(let L of $.dependencies){let I=`${L.groupId}:${L.artifactId}`;!l.has(I)&&L.version&&!L.version.includes("${")&&l.set(I,L);}for(let L of $.modules)u.push({path:B.join(i,L),name:L,refType:"project"});}else if(m==="build.gradle"||m==="build.gradle.kts"){let $=Vu(A,T);$.projectName&&(a=$.projectName),$.javaVersion&&(c=$.javaVersion);for(let L of $.dependencies){let I=`${L.groupId}:${L.artifactId}`;!l.has(I)&&L.version&&l.set(I,L);}}}let p$1,f,d,h=Mr(o$1,"java")?.major,g=h!==void 0?String(h):void 0;if(c){let T=c.match(/^(1\.)?(\d+)/);if(T){let A=(T[1],parseInt(T[2],10));h!==void 0&&(p$1=Math.max(0,h-A));}f=yt(o$1,"java",c);let m=it("java",c);m&&(d=gt(o$1,"java",m));}let w=await Fu(t,{exists:T=>s?s.pathExists(T):p(T),readText:T=>s?s.readTextFile(T):o(T),readJson:T=>s?s.readJsonFile(T):n(T)}).catch(()=>null),j=[],P=[],C={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},y=[...l.entries()].map(async([T,m])=>{let A=await r.get(m.groupId,m.artifactId);return {key:T,dep:m,meta:A}}),b=await Promise.all(y);for(let{key:T,dep:m,meta:A}of b){let $=w?.resolve(T)??null,L=Du($??m.version),I=A.latestStableOverall,V=null,pe="unknown";if(L&&I){let H=Pt.major(L);V=Pt.major(I)-H,V===0?pe=Pt.eq(L,I)?"current":"minor-behind":V>0?pe="major-behind":pe="current",V<=0?C.current++:V===1?C.oneBehind++:C.twoPlusBehind++;}else C.unknown++;j.push({package:T,section:"dependencies",currentSpec:m.version,resolvedVersion:L,latestStable:I,majorsBehind:V,drift:pe}),T in Go&&P.push({name:Go[T],currentVersion:L,latestVersion:I,majorsBehind:V});}j.sort((T,m)=>{let A={"major-behind":0,"minor-behind":1,current:2,unknown:3},$=(A[T.drift]??9)-(A[m.drift]??9);return $!==0?$:T.package.localeCompare(m.package)});let k;try{k=s?await s.countFilesUnder(n$1,t):void 0;}catch{}return {type:"java",path:i,name:a,runtime:c?`Java ${c}`:void 0,runtimeLatest:g,runtimeMajorsBehind:p$1,runtimeEol:f,runtimeEolDate:d,targetFramework:c?`Java ${c}`:void 0,frameworks:P,dependencies:j,dependencyAgeBuckets:C,projectReferences:u.length>0?u:void 0,fileCount:k}}var Hu=/^ {4}([A-Za-z0-9._-]+) \(([^()]+)\)\s*$/;function zu(t){let e=new Map;if(!t)return e;for(let n of t.split(`
79
- `)){let r=Hu.exec(n);if(!r)continue;let s=r[1],o=r[2].split("-")[0].trim();/^\d/.test(o)&&(e.has(s)||e.set(s,o));}return e}async function Wu(t,e){let n=B.join(t,"Gemfile.lock");if(!await e.exists(n).catch(()=>false))return null;try{let r=zu(await e.readText(n));return r.size?{size:r.size,resolve:s=>r.get(s)??null}:null}catch{return null}}var qo={rails:"Ruby on Rails",sinatra:"Sinatra",hanami:"Hanami",padrino:"Padrino",roda:"Roda",grape:"Grape",cuba:"Cuba",camping:"Camping",ramaze:"Ramaze","jsonapi-resources":"JSONAPI::Resources",active_model_serializers:"AMS",blueprinter:"Blueprinter",alba:"Alba","grape-entity":"Grape Entity",jbuilder:"Jbuilder",graphql:"GraphQL Ruby",activerecord:"ActiveRecord",sequel:"Sequel","rom-rb":"ROM",mongoid:"Mongoid",redis:"redis-rb",pg:"pg (PostgreSQL)",mysql2:"mysql2",sqlite3:"sqlite3",sidekiq:"Sidekiq",resque:"Resque",delayed_job:"Delayed Job",good_job:"GoodJob",solid_queue:"Solid Queue",que:"Que",rspec:"RSpec","rspec-rails":"RSpec Rails",minitest:"Minitest",capybara:"Capybara",factory_bot:"FactoryBot",factory_bot_rails:"FactoryBot Rails",faker:"Faker","shoulda-matchers":"Shoulda Matchers",vcr:"VCR",webmock:"WebMock",simplecov:"SimpleCov",cucumber:"Cucumber",devise:"Devise",omniauth:"OmniAuth",pundit:"Pundit",cancancan:"CanCanCan",rodauth:"Rodauth",jwt:"JWT",doorkeeper:"Doorkeeper","turbo-rails":"Turbo","stimulus-rails":"Stimulus","importmap-rails":"Importmap Rails",sprockets:"Sprockets",webpacker:"Webpacker","cssbundling-rails":"CSS Bundling","jsbundling-rails":"JS Bundling","tailwindcss-rails":"Tailwind CSS Rails",propshaft:"Propshaft",faraday:"Faraday",httparty:"HTTParty","rest-client":"REST Client",typhoeus:"Typhoeus",httpx:"HTTPX",puma:"Puma",unicorn:"Unicorn",thin:"Thin",passenger:"Passenger",falcon:"Falcon",capistrano:"Capistrano",kamal:"Kamal",mina:"Mina","sentry-ruby":"Sentry","sentry-rails":"Sentry Rails",newrelic_rpm:"New Relic",datadog:"Datadog",lograge:"Lograge",rubocop:"RuboCop","rubocop-rails":"RuboCop Rails","rubocop-rspec":"RuboCop RSpec","rubocop-performance":"RuboCop Performance",brakeman:"Brakeman","bundler-audit":"Bundler Audit",standard:"Standard",kaminari:"Kaminari",pagy:"Pagy",ransack:"Ransack",searchkick:"Searchkick","elasticsearch-rails":"Elasticsearch Rails",carrierwave:"CarrierWave",shrine:"Shrine",active_storage:"Active Storage",activeadmin:"ActiveAdmin",administrate:"Administrate",avo:"Avo",aasm:"AASM",statesman:"Statesman",dotenv:"dotenv",figaro:"Figaro"};function Ju(t){let e=t.trim();if(!e||e.startsWith("#"))return null;let n=e.match(/^\s*gem\s+['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"])?/);if(!n)return null;let r=n[1],s=n[2]??"*";return {name:r,spec:s}}function Ku(t){if(t==="*")return null;let e=t.match(/(?:~>|>=|>|=|<=|<)?\s*(\d+(?:\.\d+)*)/);return e?e[1]:null}function Yu(t){let e=t.trim();if(/(?:\.pre|\.rc|\.beta|\.alpha|\.dev)/i.test(e))return null;let n=e.split(".");if(n.length<2)return null;for(;n.length<3;)n.push("0");let r=n.slice(0,3).join(".");return Mt.valid(r)}function Xu(t){let e=[],n="default",r=[];for(let s of t.split(/\r?\n/)){let o=s.trim(),i=o.match(/^\s*group\s+:(\w+)/);if(i){r.push(n);let u=i[1].toLowerCase();u==="development"||u==="dev"?n="development":u==="test"&&(n="test");}if(o==="end"&&r.length>0){n=r.pop();continue}let a=Ju(o);if(!a)continue;let c=n,l=o.match(/group:\s*(?::(\w+)|\[([^\]]+)\])/);if(l){let u=(l[1]??l[2]??"").toLowerCase();u.includes("development")||u.includes("dev")?c="development":u.includes("test")&&(c="test");}e.push({name:a.name,spec:a.spec,group:c});}return e}function Qu(t){let e=[];for(let n of t.split(/\r?\n/)){let s=n.trim().match(/\.add_(runtime_|development_)?dependency\s+['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"])?/);if(!s)continue;let o=s[1]??"runtime_",i=s[2],a=s[3]??"*";e.push({name:i,spec:a,group:o.startsWith("development")?"development":"default"});}return e}function Zu(t){return t.match(/^\s*ruby\s+['"]([^'"]+)['"]/m)?.[1]}var Ai=new Set(["Gemfile"]);function ms(t){return t.endsWith(".gemspec")}async function ep(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,l=>Ai.has(l)||ms(l)):await tp(t),i=new Map;for(let l of o){let u=B.dirname(l);i.has(u)||i.set(u,[]),i.get(u).push(l);}let a=[],c=r??n?.projectScanTimeout??18e4;for(let[l,u]of i)try{let p=np(l,u,t,e,n,s),f=await Me(p,c);if(f.ok)a.push(f.value);else {let d=B.relative(t,l);n&&n.addStuckPath(d||"."),console.error(`Timeout scanning Ruby project ${l} (>${c/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(p){let f=p instanceof Error?p.message:String(p);console.error(`Error scanning Ruby project ${l}: ${f}`);}return a}async function tp(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ai.has(n)||ms(n))}async function np(t,e,n$1,r,s,o$1){let i=B.relative(n$1,t)||".",a=B.basename(t===n$1?n$1:t),c,l=new Map;for(let b of e){let k=B.basename(b),T=s?await s.readTextFile(b):await o(b);if(k==="Gemfile"){let m=Zu(T);m&&(c=m);for(let A of Xu(T))l.has(A.name)||l.set(A.name,A);}else if(ms(k)){let m=k.replace(/\.gemspec$/,"");m&&(a=m);for(let A of Qu(T))l.has(A.name)||l.set(A.name,A);}}let u,p$1,f,d;if(c){let b=c.match(/(\d+)\.(\d+)/);if(b){let T=parseInt(b[1],10),m=parseInt(b[2],10),A=pn(o$1,"ruby");A&&(T===A.major?u=Math.max(0,A.minor-m):T<A.major&&(u=A.minor+(A.major-T)*10),p$1=`${A.major}.${A.minor}`);}f=yt(o$1,"ruby",c);let k=it("ruby",c);k&&(d=gt(o$1,"ruby",k));}let g=await Wu(t,{exists:b=>s?s.pathExists(b):p(b),readText:b=>s?s.readTextFile(b):o(b),readJson:b=>s?s.readJsonFile(b):n(b)}).catch(()=>null),v=[],w=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},C=[...l.values()].map(async b=>{let k=await r.get(b.name);return {dep:b,meta:k}}),x=await Promise.all(C);for(let{dep:b,meta:k}of x){let m=g?.resolve(b.name)??null??Ku(b.spec),A=m?Yu(m):null,$=k.latestStableOverall,L=null,I="unknown";if(A&&$){let pe=Mt.major(A);L=Mt.major($)-pe,L===0?I=Mt.eq(A,$)?"current":"minor-behind":L>0?I="major-behind":I="current",L<=0?j.current++:L===1?j.oneBehind++:j.twoPlusBehind++;}else j.unknown++;let V=b.group==="development"||b.group==="test"?"devDependencies":"dependencies";v.push({package:b.name,section:V,currentSpec:b.spec,resolvedVersion:A,latestStable:$,majorsBehind:L,drift:I}),b.name in qo&&w.push({name:qo[b.name],currentVersion:A,latestVersion:$,majorsBehind:L});}v.sort((b,k)=>{let T={"major-behind":0,"minor-behind":1,current:2,unknown:3},m=(T[b.drift]??9)-(T[k.drift]??9);return m!==0?m:b.package.localeCompare(k.package)});let y;try{y=s?await s.countFilesUnder(n$1,t):void 0;}catch{}return {type:"ruby",path:i,name:a,runtime:c,runtimeLatest:p$1,runtimeMajorsBehind:u,runtimeEol:f,runtimeEolDate:d,frameworks:w,dependencies:v,dependencyAgeBuckets:j,fileCount:y}}var Ho={vapor:"Vapor",hummingbird:"Hummingbird",perfect:"Perfect",kitura:"Kitura",alamofire:"Alamofire",moya:"Moya","apollo-ios":"Apollo iOS",fluent:"Fluent","sqlite.swift":"SQLite.swift","realm-swift":"Realm Swift","grdb.swift":"GRDB.swift",kingfisher:"Kingfisher",snapkit:"SnapKit",sdwebimage:"SDWebImage",rxswift:"RxSwift",combine:"Combine",reactiveswift:"ReactiveSwift",quick:"Quick",nimble:"Nimble",snapshotTesting:"SnapshotTesting",swiftlog:"SwiftLog",cocoalumberjack:"CocoaLumberjack",swinject:"Swinject",needle:"Needle",swiftyjson:"SwiftyJSON",promisekit:"PromiseKit",then:"Then"},St={major:6,minor:0};function rp(t){let e=[],n=/\.package\s*\(\s*url:\s*"([^"]+)"[^)]*?(from|exact|upToNextMajor|revision|branch):\s*"([^"]+)"/g,r;for(;(r=n.exec(t))!==null;){let s=r[1],o=r[2],i=r[3],c=s.match(/\/([^/]+?)(\.git)?$/)?.[1]??s,l="range",u=i;o==="exact"?l="exact":o==="branch"?l="branch":o==="revision"&&(l="revision"),e.push({name:c,url:s,version:u,type:l});}return e}function sp(t){let e=new Map;try{let n=JSON.parse(t);if(!n.pins)return e;for(let r of n.pins)!r.identity||!r.state?.version||e.set(r.identity.toLowerCase(),r.state.version);}catch{}return e}function op(t){return t.match(/\/\/\s*swift-tools-version:\s*(\d+\.\d+)/i)?.[1]}var Pi=new Set(["Package.swift"]);async function ip(t,e,n,r){let s=n?await n.findFiles(t,a=>Pi.has(a)):await ap(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=cp(c,a,t,e,n),u=await Me(l,i);if(u.ok)o.push(u.value);else {let p=B.relative(t,c);n&&n.addStuckPath(p||"."),console.error(`Timeout scanning Swift project ${c} (>${i/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(l){let u=l instanceof Error?l.message:String(l);console.error(`Error scanning Swift project ${c}: ${u}`);}}return o}async function ap(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Pi.has(n))}async function cp(t,e,n,r,s){let o$1=B.relative(n,t)||".",i=B.basename(t===n?n:t),a=s?await s.readTextFile(e):await o(e),c=op(a),l=rp(a),u=B.join(t,"Package.resolved"),p=new Map;try{let C=s?await s.readTextFile(u):await o(u);p=sp(C);}catch{}let f,d;if(c){let C=c.match(/(\d+)\.(\d+)/);if(C){let x=parseInt(C[1],10),y=parseInt(C[2],10);x===St.major?f=Math.max(0,St.minor-y):x<St.major&&(f=(St.major-x)*10+St.minor),d=`${St.major}.${St.minor}`;}}let h=[],g=[],v={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},w=l.map(async C=>{let x=await r.get(C.url);return {dep:C,meta:x}}),j=await Promise.all(w);for(let{dep:C,meta:x}of j){let y=p.get(C.name.toLowerCase())??(C.type==="exact"?C.version:null),b=y?Ie.valid(Ie.clean(y)):null,k=x.latestStableOverall,T=null,m="unknown";if(b&&k){let $=Ie.major(b);T=Ie.major(k)-$,T===0?m=Ie.eq(b,k)?"current":"minor-behind":T>0?m="major-behind":m="current",T<=0?v.current++:T===1?v.oneBehind++:v.twoPlusBehind++;}else v.unknown++;h.push({package:C.name,section:"dependencies",currentSpec:C.version,resolvedVersion:b,latestStable:k,majorsBehind:T,drift:m});let A=C.name.toLowerCase();A in Ho&&g.push({name:Ho[A],currentVersion:b,latestVersion:k,majorsBehind:T});}h.sort((C,x)=>{let y={"major-behind":0,"minor-behind":1,current:2,unknown:3},b=(y[C.drift]??9)-(y[x.drift]??9);return b!==0?b:C.package.localeCompare(x.package)});let P;try{P=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"swift",path:o$1,name:i,runtime:c,runtimeLatest:d,runtimeMajorsBehind:f,frameworks:g,dependencies:h,dependencyAgeBuckets:v,fileCount:P}}var zo={"github.com/gin-gonic/gin":"Gin","github.com/labstack/echo":"Echo","github.com/gofiber/fiber":"Fiber","github.com/gorilla/mux":"Gorilla Mux","github.com/go-chi/chi":"Chi","github.com/beego/beego":"Beego","github.com/revel/revel":"Revel","k8s.io/kubernetes":"Kubernetes","k8s.io/client-go":"Kubernetes Client","github.com/prometheus/prometheus":"Prometheus","github.com/prometheus/client_golang":"Prometheus Client","go.etcd.io/etcd":"etcd","github.com/hashicorp/consul":"Consul","github.com/hashicorp/vault":"Vault","github.com/traefik/traefik":"Traefik","github.com/istio/istio":"Istio","gorm.io/gorm":"GORM","github.com/jmoiron/sqlx":"sqlx","github.com/go-sql-driver/mysql":"MySQL Driver","github.com/lib/pq":"PostgreSQL Driver","go.mongodb.org/mongo-driver":"MongoDB Driver","github.com/redis/go-redis":"Redis Client","github.com/go-redis/redis":"go-redis","google.golang.org/grpc":"gRPC","google.golang.org/protobuf":"Protobuf","github.com/grpc-ecosystem/grpc-gateway":"gRPC Gateway","github.com/stretchr/testify":"Testify","github.com/onsi/ginkgo":"Ginkgo","github.com/onsi/gomega":"Gomega","github.com/golang/mock":"GoMock","go.uber.org/zap":"Zap","github.com/sirupsen/logrus":"Logrus","github.com/rs/zerolog":"Zerolog","github.com/spf13/viper":"Viper","github.com/spf13/cobra":"Cobra","github.com/urfave/cli":"urfave/cli","github.com/go-resty/resty":"Resty","github.com/json-iterator/go":"jsoniter","gopkg.in/yaml.v3":"YAML v3","github.com/segmentio/kafka-go":"kafka-go","github.com/rabbitmq/amqp091-go":"RabbitMQ","github.com/nats-io/nats.go":"NATS","github.com/google/uuid":"UUID","github.com/spf13/cast":"Cast","github.com/pkg/errors":"pkg/errors"};function lp(t){let e=[],n,r=false;for(let s of t.split(/\r?\n/)){let o=s.trim();if(o.startsWith("go ")){let l=o.match(/^go\s+(\d+\.\d+)/);l&&(n=l[1]);continue}if(o.startsWith("require (")){r=true;continue}if(o===")"&&r){r=false;continue}let i=o;if(r)i=o;else if(o.startsWith("require "))i=o.substring(8);else continue;let a=i.includes("// indirect");i=i.replace(/\/\/.*$/,"").trim();let c=i.split(/\s+/);if(c.length>=2){let[l,u]=c;l&&u&&e.push({path:l,version:u,indirect:a});}}return {goVersion:n,deps:e}}var Mi=new Set(["go.mod"]);async function up(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,c=>Mi.has(c)):await pp(t),i=[],a=r??n?.projectScanTimeout??18e4;for(let c of o){let l=B.dirname(c);try{let u=fp(l,c,t,e,n,s),p=await Me(u,a);if(p.ok)i.push(p.value);else {let f=B.relative(t,l);n&&n.addStuckPath(f||"."),console.error(`Timeout scanning Go project ${l} (>${a/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(u){let p=u instanceof Error?u.message:String(u);console.error(`Error scanning Go project ${l}: ${p}`);}}return i}async function pp(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Mi.has(n))}async function fp(t,e,n,r,s,o$1){let i=B.relative(n,t)||".",a=B.basename(t===n?n:t),c=s?await s.readTextFile(e):await o(e),{goVersion:l,deps:u}=lp(c),p=u.filter(y=>!y.indirect),f,d,h,g;if(l){let y=l.match(/(\d+)\.(\d+)/);if(y){let k=parseInt(y[1],10),T=parseInt(y[2],10),m=pn(o$1,"go");m&&(k===m.major?f=Math.max(0,m.minor-T):k<m.major&&(f=m.minor+(m.major-k)*100),d=`${m.major}.${m.minor}`);}h=yt(o$1,"go",l);let b=it("go",l);b&&(g=gt(o$1,"go",b));}let v=[],w=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},P=p.map(async y=>{let b=await r.get(y.path);return {dep:y,meta:b}}),C=await Promise.all(P);for(let{dep:y,meta:b}of C){let k=_e.valid(_e.clean(y.version)),T=b.latestStableOverall,m=null,A="unknown";if(k&&T){let $=_e.major(k);m=_e.major(T)-$,m===0?A=_e.eq(k,T)?"current":"minor-behind":m>0?A="major-behind":A="current",m<=0?j.current++:m===1?j.oneBehind++:j.twoPlusBehind++;}else j.unknown++;v.push({package:y.path,section:"dependencies",currentSpec:y.version,resolvedVersion:k,latestStable:T,majorsBehind:m,drift:A}),y.path in zo&&w.push({name:zo[y.path],currentVersion:k,latestVersion:T,majorsBehind:m});}v.sort((y,b)=>{let k={"major-behind":0,"minor-behind":1,current:2,unknown:3},T=(k[y.drift]??9)-(k[b.drift]??9);return T!==0?T:y.package.localeCompare(b.package)});let x;try{x=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"go",path:i,name:a,runtime:l,runtimeLatest:d,runtimeMajorsBehind:f,runtimeEol:h,runtimeEolDate:g,frameworks:w,dependencies:v,dependencyAgeBuckets:j,fileCount:x}}function dp(t){let e=new Map,r=ki(t)?.package;if(!Array.isArray(r))return e;for(let s of r){if(!s||typeof s!="object")continue;let{name:o,version:i}=s;if(typeof o!="string"||typeof i!="string")continue;let a=e.get(o)??[];a.includes(i)||a.push(i),e.set(o,a);}return e}function mp(t,e){if(!t||t.length===0)return null;let n=t.filter(r=>ut.valid(r));if(n.length===0)return null;if(n.length===1)return n[0];if(e){let r=ut.validRange(e)??ut.validRange(`^${e}`);if(r){let s=ut.maxSatisfying(n,r);if(s)return s}}return ut.maxSatisfying(n,"*")??n[0]}async function Wo(t,e){let n=B.join(t,"Cargo.lock");if(!await e.exists(n).catch(()=>false))return null;try{let r=dp(await e.readText(n));return r.size?{size:r.size,resolve:(s,o)=>mp(r.get(s),o)}:null}catch{return null}}var Jo={"actix-web":"Actix Web",rocket:"Rocket",axum:"Axum",warp:"Warp",tide:"Tide",poem:"Poem",tokio:"Tokio","async-std":"async-std",smol:"smol",serde:"Serde",serde_json:"Serde JSON",bincode:"Bincode",toml:"TOML",diesel:"Diesel",sqlx:"SQLx","sea-orm":"SeaORM",reqwest:"reqwest",hyper:"hyper",ureq:"ureq",clap:"clap",structopt:"structopt",log:"log",env_logger:"env_logger",tracing:"tracing","tracing-subscriber":"tracing-subscriber",anyhow:"anyhow",thiserror:"thiserror",eyre:"eyre",criterion:"Criterion",proptest:"proptest",mockall:"mockall",ring:"ring",rustls:"rustls",webpki:"webpki",bevy:"Bevy",wgpu:"wgpu",winit:"winit","wasm-bindgen":"wasm-bindgen","wasm-pack":"wasm-pack",substrate:"Substrate",ethers:"ethers-rs"};function hp(t){let e=[],n=null;for(let r of t.split(/\r?\n/)){let s=r.trim();if(s==="[dependencies]"){n="dependencies";continue}else if(s==="[dev-dependencies]"){n="dev-dependencies";continue}else if(s.startsWith("[")&&s.endsWith("]")){n=null;continue}if(!n)continue;let o=s.match(/^([\w-]+)\s*=\s*"([^"]+)"/);if(o){e.push({name:o[1],version:o[2],optional:false,features:[],isDev:n==="dev-dependencies"});continue}let i=s.match(/^([\w-]+)\s*=\s*\{([^}]+)\}/);if(i){let a=i[1],c=i[2],u=c.match(/version\s*=\s*"([^"]+)"/)?.[1]??"*",f=!!c.match(/optional\s*=\s*true/),d=c.match(/features\s*=\s*\[([^\]]*)\]/),h=d?d[1].split(",").map(g=>g.trim().replace(/"/g,"")):[];e.push({name:a,version:u,optional:f,features:h,isDev:n==="dev-dependencies"});}}return e}function gp(t){return t.match(/^\s*edition\s*=\s*"(\d+)"/m)?.[1]}var Li=new Set(["Cargo.toml"]);async function yp(t,e,n,r){let s=n?await n.findFiles(t,a=>Li.has(a)):await vp(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=bp(c,a,t,e,n),u=await Me(l,i);if(u.ok)o.push(u.value);else {let p=B.relative(t,c);n&&n.addStuckPath(p||"."),console.error(`Timeout scanning Rust project ${c} (>${i/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(l){let u=l instanceof Error?l.message:String(l);console.error(`Error scanning Rust project ${c}: ${u}`);}}return o}async function vp(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Li.has(n))}async function bp(t,e,n$1,r,s){let o$1=B.relative(n$1,t)||".",i=B.basename(t===n$1?n$1:t),a=s?await s.readTextFile(e):await o(e),c=gp(a),l=hp(a),u={exists:x=>s?s.pathExists(x):p(x),readText:x=>s?s.readTextFile(x):o(x),readJson:x=>s?s.readJsonFile(x):n(x)},p$1=await Wo(t,u).catch(()=>null);!p$1&&t!==n$1&&(p$1=await Wo(n$1,u).catch(()=>null));let f=l.filter(x=>!x.isDev),d,h;if(c){let x=parseInt(c,10),y=2024;d=Math.max(0,Math.floor((y-x)/3)),h=y.toString();}let g=[],v=[],w={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=f.map(async x=>{let y=await r.get(x.name);return {dep:x,meta:y}}),P=await Promise.all(j);for(let{dep:x,meta:y}of P){let b=p$1?.resolve(x.name,x.version)??null,k=b&&Ae.valid(b)?b:Ae.valid(Ae.coerce(x.version)),T=y.latestStableOverall,m=null,A="unknown";if(k&&T){let L=Ae.major(k);m=Ae.major(T)-L,m===0?A=Ae.eq(k,T)?"current":"minor-behind":m>0?A="major-behind":A="current",m<=0?w.current++:m===1?w.oneBehind++:w.twoPlusBehind++;}else w.unknown++;let $=x.isDev?"devDependencies":"dependencies";g.push({package:x.name,section:$,currentSpec:x.version,resolvedVersion:k,latestStable:T,majorsBehind:m,drift:A}),x.name in Jo&&v.push({name:Jo[x.name],currentVersion:k,latestVersion:T,majorsBehind:m});}g.sort((x,y)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},k=(b[x.drift]??9)-(b[y.drift]??9);return k!==0?k:x.package.localeCompare(y.package)});let C;try{C=s?await s.countFilesUnder(n$1,t):void 0;}catch{}return {type:"rust",path:o$1,name:i,runtime:c,runtimeLatest:h,runtimeMajorsBehind:d,frameworks:v,dependencies:g,dependencyAgeBuckets:w,fileCount:C}}var Ko={"laravel/framework":"Laravel","symfony/symfony":"Symfony","symfony/http-foundation":"Symfony HttpFoundation","cakephp/cakephp":"CakePHP","yiisoft/yii2":"Yii 2","codeigniter4/framework":"CodeIgniter","slim/slim":"Slim","laminas/laminas-mvc":"Laminas","roots/wordpress":"WordPress","johnpbloch/wordpress":"WordPress Core","doctrine/orm":"Doctrine ORM","doctrine/dbal":"Doctrine DBAL","illuminate/database":"Laravel Eloquent","propel/propel":"Propel","phpunit/phpunit":"PHPUnit","pestphp/pest":"Pest","behat/behat":"Behat","codeception/codeception":"Codeception","mockery/mockery":"Mockery","guzzlehttp/guzzle":"Guzzle","symfony/http-client":"Symfony HttpClient","twig/twig":"Twig","smarty/smarty":"Smarty","league/plates":"Plates","firebase/php-jwt":"PHP-JWT","lcobucci/jwt":"JWT","league/fractal":"Fractal","api-platform/core":"API Platform","symfony/console":"Symfony Console","monolog/monolog":"Monolog","nesbot/carbon":"Carbon","ramsey/uuid":"UUID","vlucas/phpdotenv":"PHP dotenv","phpstan/phpstan":"PHPStan","vimeo/psalm":"Psalm","friendsofphp/php-cs-fixer":"PHP CS Fixer","squizlabs/php_codesniffer":"PHP_CodeSniffer"},kt={major:8,minor:4};async function wp(t,e){let n$1=e?await e.readJsonFile(t):await n(t),r=[],s;if(n$1.require?.php&&(s=n$1.require.php),n$1.require&&typeof n$1.require=="object")for(let[o,i]of Object.entries(n$1.require))o==="php"||o.startsWith("ext-")||r.push({name:o,version:String(i),isDev:false});if(n$1["require-dev"]&&typeof n$1["require-dev"]=="object")for(let[o,i]of Object.entries(n$1["require-dev"]))o==="php"||o.startsWith("ext-")||r.push({name:o,version:String(i),isDev:true});return {phpVersion:s,deps:r}}async function Sp(t,e){let n$1=new Map;try{let r=e?await e.readJsonFile(t):await n(t);for(let s of r.packages??[])s.name&&s.version&&n$1.set(s.name,s.version);for(let s of r["packages-dev"]??[])s.name&&s.version&&n$1.set(s.name,s.version);}catch{}return n$1}function kp(t){return t.match(/(\d+)\.(\d+)/)?.[0]}var Ni=new Set(["composer.json"]);async function xp(t,e,n,r){let s=n?await n.findFiles(t,a=>Ni.has(a)):await Ep(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=jp(c,a,t,e,n),u=await Me(l,i);if(u.ok)o.push(u.value);else {let p=B.relative(t,c);n&&n.addStuckPath(p||"."),console.error(`Timeout scanning PHP project ${c} (>${i/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(l){let u=l instanceof Error?l.message:String(l);console.error(`Error scanning PHP project ${c}: ${u}`);}}return o}async function Ep(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ni.has(n))}async function jp(t,e,n,r,s){let o=B.relative(n,t)||".",i=B.basename(t===n?n:t),{phpVersion:a,deps:c}=await wp(e,s),l=B.join(t,"composer.lock"),u=new Map;try{u=await Sp(l,s);}catch{}let p=c.filter(x=>!x.isDev),f,d,h;if(a&&(h=kp(a),h)){let x=h.match(/(\d+)\.(\d+)/);if(x){let y=parseInt(x[1],10),b=parseInt(x[2],10);y===kt.major?f=Math.max(0,kt.minor-b):y<kt.major&&(f=kt.minor+(kt.major-y)*10),d=`${kt.major}.${kt.minor}`;}}let g=[],v=[],w={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=p.map(async x=>{let y=await r.get(x.name);return {dep:x,meta:y}}),P=await Promise.all(j);for(let{dep:x,meta:y}of P){let b=u.get(x.name),k=b?Fe.valid(Fe.clean(b)):null,T=y.latestStableOverall,m=null,A="unknown";if(k&&T){let L=Fe.major(k);m=Fe.major(T)-L,m===0?A=Fe.eq(k,T)?"current":"minor-behind":m>0?A="major-behind":A="current",m<=0?w.current++:m===1?w.oneBehind++:w.twoPlusBehind++;}else w.unknown++;let $=x.isDev?"devDependencies":"dependencies";g.push({package:x.name,section:$,currentSpec:x.version,resolvedVersion:k,latestStable:T,majorsBehind:m,drift:A}),x.name in Ko&&v.push({name:Ko[x.name],currentVersion:k,latestVersion:T,majorsBehind:m});}g.sort((x,y)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},k=(b[x.drift]??9)-(b[y.drift]??9);return k!==0?k:x.package.localeCompare(y.package)});let C;try{C=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"php",path:o,name:i,runtime:h,runtimeLatest:d,runtimeMajorsBehind:f,frameworks:v,dependencies:g,dependencyAgeBuckets:w,fileCount:C}}var Yo={flutter:"Flutter SDK",flutter_test:"Flutter Test",provider:"Provider",riverpod:"Riverpod",flutter_riverpod:"Flutter Riverpod",bloc:"BLoC",flutter_bloc:"Flutter BLoC",get:"GetX",mobx:"MobX",redux:"Redux",go_router:"GoRouter",auto_route:"AutoRoute",http:"http",dio:"Dio",retrofit:"Retrofit",graphql_flutter:"GraphQL Flutter",sqflite:"SQFlite",hive:"Hive",isar:"Isar",drift:"Drift",firebase_core:"Firebase Core",cloud_firestore:"Cloud Firestore",flutter_svg:"Flutter SVG",cached_network_image:"Cached Network Image",shimmer:"Shimmer",lottie:"Lottie",flutter_staggered_grid_view:"Staggered Grid View",mockito:"Mockito",mocktail:"Mocktail",integration_test:"Integration Test",test:"Test",intl:"Intl",shared_preferences:"Shared Preferences",path_provider:"Path Provider",package_info_plus:"Package Info Plus",url_launcher:"URL Launcher",image_picker:"Image Picker",json_serializable:"JSON Serializable",freezed:"Freezed",built_value:"Built Value",logger:"Logger",sentry_flutter:"Sentry Flutter",firebase_crashlytics:"Firebase Crashlytics",build_runner:"Build Runner",injectable:"Injectable",flutter_lints:"Flutter Lints",lint:"Lint"},xt={major:3,minor:6};function Tp(t){let e=[],n,r=null;for(let s of t.split(/\r?\n/)){let o=s.trim();if(o.startsWith("sdk:")){let a=o.match(/sdk:\s*['"]?>?=?\s*(\d[^<'"]*)/);a&&(n=a[1].trim());continue}if(o==="dependencies:"){r="dependencies";continue}else if(o==="dev_dependencies:"){r="dev_dependencies";continue}else if(/^\w+:/.test(s)){r=null;continue}if(!r)continue;let i=o.match(/^([\w_]+):\s*([^\s{]+)/);if(i){let a=i[1],c=i[2];if(c==="sdk:"||o.includes("sdk: flutter"))continue;e.push({name:a,version:c,isDev:r==="dev_dependencies"});}}return {dartVersion:n,deps:e}}async function Cp(t,e){let n=new Map;try{let r=e?await e.readTextFile(t):await o(t),s=null;for(let o of r.split(/\r?\n/)){let i=o.trim(),a=o.match(/^ {2}(\w+):$/);if(a){s=a[1];continue}if(s&&i.startsWith("version:")){let c=i.match(/version:\s*"?([^"]+)"?/);c&&(n.set(s,c[1]),s=null);}}}catch{}return n}function Ap(t){return t.match(/(\d+\.\d+\.\d+)/)?.[0]}var Ri=new Set(["pubspec.yaml"]);async function Pp(t,e,n,r){let s=n?await n.findFiles(t,a=>Ri.has(a)):await Mp(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=$p(c,a,t,e,n),u=await Me(l,i);if(u.ok)o.push(u.value);else {let p=B.relative(t,c);n&&n.addStuckPath(p||"."),console.error(`Timeout scanning Dart project ${c} (>${i/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(l){let u=l instanceof Error?l.message:String(l);console.error(`Error scanning Dart project ${c}: ${u}`);}}return o}async function Mp(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ri.has(n))}async function $p(t,e,n,r,s){let o$1=B.relative(n,t)||".",i=B.basename(t===n?n:t),a=s?await s.readTextFile(e):await o(e),{dartVersion:c,deps:l}=Tp(a),u=B.join(t,"pubspec.lock"),p=new Map;try{p=await Cp(u,s);}catch{}let f=l.filter(y=>!y.isDev),d,h,g;if(c&&(g=Ap(c),g)){let y=g.match(/(\d+)\.(\d+)/);if(y){let b=parseInt(y[1],10),k=parseInt(y[2],10);b===xt.major?d=Math.max(0,xt.minor-k):b<xt.major&&(d=xt.minor+(xt.major-b)*10),h=`${xt.major}.${xt.minor}`;}}let v=[],w=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},P=f.map(async y=>{let b=await r.get(y.name);return {dep:y,meta:b}}),C=await Promise.all(P);for(let{dep:y,meta:b}of C){let k=p.get(y.name),T=k?Oe.valid(Oe.clean(k)):null,m=b.latestStableOverall,A=null,$="unknown";if(T&&m){let I=Oe.major(T);A=Oe.major(m)-I,A===0?$=Oe.eq(T,m)?"current":"minor-behind":A>0?$="major-behind":$="current",A<=0?j.current++:A===1?j.oneBehind++:j.twoPlusBehind++;}else j.unknown++;let L=y.isDev?"devDependencies":"dependencies";v.push({package:y.name,section:L,currentSpec:y.version,resolvedVersion:T,latestStable:m,majorsBehind:A,drift:$}),y.name in Yo&&w.push({name:Yo[y.name],currentVersion:T,latestVersion:m,majorsBehind:A});}v.sort((y,b)=>{let k={"major-behind":0,"minor-behind":1,current:2,unknown:3},T=(k[y.drift]??9)-(k[b.drift]??9);return T!==0?T:y.package.localeCompare(b.package)});let x;try{x=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"dart",path:o$1,name:i,runtime:g,runtimeLatest:h,runtimeMajorsBehind:d,frameworks:w,dependencies:v,dependencyAgeBuckets:j,fileCount:x}}var Lp="https://hex.pm/api",Np=1e4,Rp=10;async function Ip(t,e,n,r=false){let s=W(e,"hex",t);if(s?.latest)return s.latest;if(r)return null;let o=async()=>{try{let i=new AbortController,a=setTimeout(()=>i.abort(),Np),c=`${Lp}/packages/${t}`,l=await fetch(c,{signal:i.signal,headers:{"User-Agent":"vibgrate-cli"}});if(clearTimeout(a),!l.ok)return null;let p=(await l.json()).releases;if(!p||p.length===0)return null;let f=p.filter(d=>!d.retired).map(d=>d.version).filter(d=>{try{return new vr.SemVer(d).prerelease.length===0}catch{return !1}});return f.length===0?null:(f.sort((d,h)=>{try{return (0,vr.gt)(d,h)?-1:1}catch{return 0}}),f[0])}catch(i){return i?.name==="AbortError",null}};return n?n.run(o):o()}async function _p(t,e,n=false){let r=new Map,s=new a$1(Rp),o=t.map(async i=>{let a=await Ip(i,e,s,n);a&&r.set(i,a);});return await Promise.all(o),r}var Fp=new Set(["mix.exs"]),Op=new Set(["phoenix","phoenix_live_view","phoenix_html","phoenix_ecto","phoenix_pubsub","ecto","ecto_sql","plug","plug_cowboy","cowboy","ranch","absinthe","absinthe_plug","guardian","comeonin","bcrypt_elixir","argon2_elixir","pbkdf2_elixir","ex_machina","mock","mox","excoveralls","credo","dialyxir","ex_doc","jason","poison","httpoison","tesla","finch","mint","hackney","timex","quantum","oban","broadway","gen_stage","flow","bamboo","swoosh","ex_aws","ex_aws_s3","redix","cachex","nebulex","floki","wallaby","hound"]);async function Bp(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s,o$1=n.match(/elixir:\s*"([^"]+)"/);o$1&&(s=o$1[1]);let i=/\{\s*:(\w+)\s*,\s*"([^"]+)"(?:,\s*(?:only|optional|runtime):\s*:(\w+))?\s*\}/g,a;for(;(a=i.exec(n))!==null;){let l=a[1],u=a[2],p=a[3];r.push({name:l,version:u,isDev:p==="dev"||p==="test"});}let c=/\{\s*:(\w+)\s*,\s*git:\s*"[^"]+"/g;for(;(a=c.exec(n))!==null;);return {elixirVersion:s,deps:r}}async function Vp(t,e){let n=new Map;try{let r=e?await e.readTextFile(t):await o(t),s=/"(\w+)":\s*\{\s*:hex\s*,\s*:\w+\s*,\s*"([^"]+)"/g,o$1;for(;(o$1=s.exec(r))!==null;){let i=o$1[1],a=o$1[2];n.set(i,a);}}catch{}return n}function Dp(t,e){try{let n=t.replace(/^[~><=\s]+/,""),r=(0,Se.minVersion)((0,Se.validRange)(n)||n);if(!r)return "unknown";if(!(0,Se.gt)(e,r.version))return "current";let s=(0,Se.minVersion)(e);return s?s.major>r.major?"major-behind":"minor-behind":"unknown"}catch{return "unknown"}}async function Up(t,e,n,r=false){let s=`${t}/mix.exs`;if(!(e?await e.pathExists(s):await p(s)))return null;let{elixirVersion:i,deps:a}=await Bp(s,e),c=`${t}/mix.lock`,l=await Vp(c,e),u=a.filter(v=>!v.isDev),p$1=u.map(v=>v.name),f=await _p(p$1,n,r),d=[],h=[],g={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let v of u){let w=l.get(v.name),j=w||v.version,P=f.get(v.name),C=P?Dp(j,P):"unknown",x=null;if(w&&P)try{let y=(0,Se.minVersion)((0,Se.validRange)(j)||j),b=(0,Se.minVersion)((0,Se.validRange)(P)||P);y&&b&&(x=b.major-y.major);}catch{}d.push({package:v.name,section:v.isDev?"devDependencies":"dependencies",currentSpec:v.version,resolvedVersion:w||null,latestStable:P||null,majorsBehind:x,drift:C}),C==="current"?g.current++:x===1?g.oneBehind++:x&&x>1?g.twoPlusBehind++:g.unknown++,Op.has(v.name)&&h.push({name:v.name,currentVersion:w||null,latestVersion:P||null,majorsBehind:x});}return {type:"elixir",path:B.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:B.basename(t),runtime:i,frameworks:h,dependencies:d,dependencyAgeBuckets:g}}async function Gp(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>Fp.has(c)):[],i=new Map;for(let c of o){let l=B.dirname(c);i.has(l)||i.set(l,[]),i.get(l).push(c);}let a=[];for(let[c]of i)try{let l=await Up(c,n,e,s);l&&(l.path=B.relative(t,c)||".",a.push(l));}catch(l){console.error(`Error scanning Elixir project at ${c}:`,l);}return a}var qp="https://hub.docker.com/v2",Hp=1e4,zp=10;function hs(t){let e,n,r,s,[o,i]=t.split(":");s=i;let a=o.split("/");return a.length>1&&(a[0].includes(".")||a[0]==="localhost")?(e=a[0],a.length===3?(n=a[1],r=a[2]):r=a[1]):a.length===2?(n=a[0],r=a[1]):r=o,{registry:e,namespace:n,image:r,tag:s}}async function Wp(t,e,n){let r=async()=>{try{let s=new AbortController,o=setTimeout(()=>s.abort(),Hp),i=`${qp}/repositories/${t}/${e}/tags?page_size=100`,a=await fetch(i,{signal:s.signal,headers:{"User-Agent":"vibgrate-cli"}});return clearTimeout(o),a.ok?((await a.json()).results||[]).map(u=>u.name):[]}catch(s){return s?.name==="AbortError"?[]:[]}};return n?n.run(r):r()}function Jp(t){let e=[];for(let n of t){if(["latest","master","main","stable","edge","dev"].includes(n))continue;let r=n.replace(/^v/,""),s=r.indexOf("-");s>0&&(r=r.substring(0,s));try{let o=new br.SemVer(r);o.prerelease.length===0&&e.push(o);}catch{}}return e.length===0?null:(e.sort((n,r)=>(0, br.gt)(n.version,r.version)?-1:1),e[0].version)}async function Kp(t,e,n,r=false){let s=hs(t),o=`${s.namespace||"library"}/${s.image}`,i=W(e,"docker",o);if(i?.latest)return i.latest;if(r||s.registry&&s.registry!=="docker.io")return null;let a=s.namespace||"library",c=await Wp(a,s.image,n);return Jp(c)}async function Yp(t,e,n=false){let r=new Map,s=new a$1(zp),o=t.map(async i=>{let a=await Kp(i,e,s,n);a&&r.set(i,a);});return await Promise.all(o),r}var Xp=new Set(["Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml"]);async function Qp(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s=/^FROM\s+(?:--platform=[^\s]+\s+)?([^\s]+)/gm,o$1;for(;(o$1=s.exec(n))!==null;){let i=o$1[1];if(i==="scratch")continue;let a=hs(i);r.push({name:`${a.namespace||"library"}/${a.image}`,currentTag:a.tag||"latest"});}return r}async function Zp(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s=/^\s*image:\s*([^\s#]+)/gm,o$1;for(;(o$1=s.exec(n))!==null;){let i=o$1[1].trim().replace(/["']/g,""),a=hs(i);r.push({name:`${a.namespace||"library"}/${a.image}`,currentTag:a.tag||"latest"});}return r}function ef(t,e){try{if(t==="latest"||t==="stable")return "current";let n=t.replace(/^v/,""),r=n.indexOf("-");r>0&&(n=n.substring(0,r));let s=new $t.SemVer(n),o=new $t.SemVer(e);return (0,$t.gt)(o.version,s.version)?o.major>s.major?"major-behind":"minor-behind":"current"}catch{return "unknown"}}async function tf(t,e,n,r=false){let s=[],o=`${t}/Dockerfile`;if(e?await e.pathExists(o):await p(o)){let d=await Qp(o,e);s.push(...d);}let a=["docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml"];for(let d of a){let h=`${t}/${d}`;if(e?await e.pathExists(h):await p(h)){let v=await Zp(h,e);s.push(...v);break}}if(s.length===0)return null;let c=new Map;for(let d of s)c.has(d.name)||c.set(d.name,d.currentTag);let l=Array.from(c.keys()),u=await Yp(l,n,r),p$1=[],f={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let d of l){let h=c.get(d),g=u.get(d),v=g?ef(h,g):"unknown",w=null;if(g)try{let j=h.replace(/^v/,"").split("-")[0],P=new $t.SemVer(j);w=new $t.SemVer(g).major-P.major;}catch{}p$1.push({package:d,section:"dependencies",currentSpec:h,resolvedVersion:h,latestStable:g||null,majorsBehind:w,drift:v}),v==="current"?f.current++:w===1?f.oneBehind++:w&&w>1?f.twoPlusBehind++:f.unknown++;}return {type:"docker",path:B.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:B.basename(t),frameworks:[],dependencies:p$1,dependencyAgeBuckets:f}}async function nf(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>Xp.has(c)):[],i=new Map;for(let c of o){let l=B.dirname(c);i.has(l)||i.set(l,[]),i.get(l).push(c);}let a=[];for(let[c]of i)try{let l=await tf(c,n,e,s);l&&(l.path=B.relative(t,c)||".",a.push(l));}catch(l){console.error(`Error scanning Docker project at ${c}:`,l);}return a}var rf="https://artifacthub.io/api/v1",sf=1e4,of=10;async function af(t,e,n,r,s=false){let o=e?`${e}/${t}`:t,i=W(n,"helm",o);if(i?.latest)return i.latest;if(s)return null;let a=async()=>{try{let c=new AbortController,l=setTimeout(()=>c.abort(),sf),u=`${rf}/packages/search?kind=0&ts_query_web=${encodeURIComponent(t)}&limit=10`,p=await fetch(u,{signal:c.signal,headers:{"User-Agent":"vibgrate-cli"}});if(clearTimeout(l),!p.ok)return null;let d=(await p.json()).packages||[],h=d.find(g=>g.name===t);return e&&d.length>1&&(h=d.find(g=>g.name===t&&g.repository?.name===e)||h),h?h.version:null}catch(c){return c?.name==="AbortError",null}};return r?r.run(a):a()}async function cf(t,e,n=false){let r=new Map,s=new a$1(of),o=t.map(async i=>{let a=await af(i.name,i.repo,e,s,n);if(a){let c=i.repo?`${i.repo}/${i.name}`:i.name;r.set(c,a);}});return await Promise.all(o),r}var lf=new Set(["Chart.yaml","Chart.yml"]);async function uf(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s,o$1,i,a=n.match(/^name:\s*(.+)$/m);a&&(s=a[1].trim().replace(/["']/g,""));let c=n.match(/^version:\s*(.+)$/m);c&&(o$1=c[1].trim().replace(/["']/g,""));let l=n.match(/^appVersion:\s*(.+)$/m);l&&(i=l[1].trim().replace(/["']/g,""));let u=n.match(/^dependencies:\s*$/m);if(u){let p=u.index+u[0].length,f=n.substring(p),d=/^\s*-\s+name:\s*(.+)$/gm,h;for(;(h=d.exec(f))!==null;){let g=h[1].trim().replace(/["']/g,""),v=h.index,w=d.exec(f),j=w?w.index:f.length;d.lastIndex=v+1;let P=f.substring(v,j),C=P.match(/version:\s*(.+)$/m),x=C?C[1].trim().replace(/["']/g,""):"*",y=P.match(/repository:\s*(.+)$/m),b=y?y[1].trim().replace(/["']/g,""):void 0,k=P.match(/condition:\s*(.+)$/m),T=k?k[1].trim().replace(/["']/g,""):void 0;r.push({name:g,version:x,repository:b,condition:T});}}return {chartName:s,chartVersion:o$1,appVersion:i,dependencies:r}}async function pf(t,e){let n=new Map;try{let r=e?await e.readTextFile(t):await o(t),s=/^\s*-\s+name:\s*(.+)$/gm,o$1;for(;(o$1=s.exec(r))!==null;){let i=o$1[1].trim().replace(/["']/g,""),a=o$1.index,c=s.exec(r),l=c?c.index:r.length;s.lastIndex=a+1;let p=r.substring(a,l).match(/version:\s*(.+)$/m);if(p){let f=p[1].trim().replace(/["']/g,"");n.set(i,f);}}}catch{}return n}function ff(t,e){try{let n=t.replace(/^[~^><=\s]+/,""),r=(0,ke.minVersion)((0,ke.validRange)(n)||n);if(!r)return "unknown";if(!(0,ke.gt)(e,r.version))return "current";let s=(0,ke.minVersion)(e);return s?s.major>r.major?"major-behind":"minor-behind":"unknown"}catch{return "unknown"}}async function df(t,e,n,r=false){let s=null;for(let h of ["Chart.yaml","Chart.yml"]){let g=`${t}/${h}`;if(e?await e.pathExists(g):await p(g)){s=g;break}}if(!s)return null;let{chartName:o,appVersion:i,dependencies:a}=await uf(s,e),c=`${t}/Chart.lock`,l=await pf(c,e),u=a.map(h=>({name:h.name,repo:h.repository})),p$1=await cf(u,n,r),f=[],d={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let h of a){let g=l.get(h.name),v=g||h.version,w=h.repository?`${h.repository}/${h.name}`:h.name,j=p$1.get(w),P=j?ff(v,j):"unknown",C=null;if(j)try{let x=(0,ke.minVersion)((0,ke.validRange)(v)||v),y=(0,ke.minVersion)((0,ke.validRange)(j)||j);x&&y&&(C=y.major-x.major);}catch{}f.push({package:h.name,section:"dependencies",currentSpec:h.version,resolvedVersion:g||null,latestStable:j||null,majorsBehind:C,drift:P}),P==="current"?d.current++:C===1?d.oneBehind++:C&&C>1?d.twoPlusBehind++:d.unknown++;}return {type:"helm",path:B.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:o||B.basename(t),runtime:i,frameworks:[],dependencies:f,dependencyAgeBuckets:d}}async function mf(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>lf.has(c)):[],i=new Map;for(let c of o){let l=B.dirname(c);i.has(l)||i.set(l,[]),i.get(l).push(c);}let a=[];for(let[c]of i)try{let l=await df(c,n,e,s);l&&(l.path=B.relative(t,c)||".",a.push(l));}catch(l){console.error(`Error scanning Helm chart at ${c}:`,l);}return a}var Ii="https://registry.terraform.io/v1",_i=1e4,hf=10;async function gf(t,e,n,r,s=false){let o=`${t}/${e}`,i=W(n,"terraform",o);if(i?.latest)return i.latest;if(s)return null;let a=async()=>{try{let c=new AbortController,l=setTimeout(()=>c.abort(),_i),u=`${Ii}/providers/${t}/${e}/versions`,p=await fetch(u,{signal:c.signal,headers:{"User-Agent":"vibgrate-cli"}});if(clearTimeout(l),!p.ok)return null;let d=(await p.json()).versions||[];if(d.length===0)return null;let h=[];for(let g of d)try{let v=new rn.SemVer(g.version);v.prerelease.length===0&&h.push(v);}catch{}return h.length===0?null:(h.sort((g,v)=>(0,rn.gt)(g.version,v.version)?-1:1),h[0].version)}catch(c){return c?.name==="AbortError",null}};return r?r.run(a):a()}async function yf(t,e,n,r,s,o=false){let i=`${t}/${e}/${n}`,a=W(r,"terraform",i);if(a?.latest)return a.latest;if(o)return null;let c=async()=>{try{let l=new AbortController,u=setTimeout(()=>l.abort(),_i),p=`${Ii}/modules/${t}/${e}/${n}/versions`,f=await fetch(p,{signal:l.signal,headers:{"User-Agent":"vibgrate-cli"}});if(clearTimeout(u),!f.ok)return null;let h=(await f.json()).modules||[];if(h.length===0||!h[0].versions)return null;let g=h[0].versions,v=[];for(let w of g)try{let j=new rn.SemVer(w.version);j.prerelease.length===0&&v.push(j);}catch{}return v.length===0?null:(v.sort((w,j)=>(0,rn.gt)(w.version,j.version)?-1:1),v[0].version)}catch(l){return l?.name==="AbortError",null}};return s?s.run(c):c()}async function vf(t,e,n=false){let r=new Map,s=new a$1(hf),o=t.map(async i=>{let a=null,c;i.type==="provider"?(c=`${i.namespace}/${i.name}`,a=await gf(i.namespace,i.name,e,s,n)):(c=`${i.namespace}/${i.name}/${i.provider}`,a=await yf(i.namespace,i.name,i.provider,e,s,n)),a&&r.set(c,a);});return await Promise.all(o),r}async function bf(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s=[],o$1,i=n.match(/terraform\s*\{[^}]*required_version\s*=\s*"([^"]+)"/s);i&&(o$1=i[1]);let a=n.match(/required_providers\s*\{([^}]+)\}/s);if(a){let f=a[1],d=/(\w+)\s*=\s*\{([^}]+)\}/g,h;for(;(h=d.exec(f))!==null;){let g=h[2],v=g.match(/source\s*=\s*"([^"]+)"/);if(!v)continue;let w=v[1],j=g.match(/version\s*=\s*"([^"]+)"/),P=j?j[1]:void 0;r.push({source:w,version:P});}}let c=/provider\s+"(\w+)"\s*\{([^}]+)\}/g,l;for(;(l=c.exec(n))!==null;){let f=l[1],h=l[2].match(/version\s*=\s*"([^"]+)"/);h&&(r.find(v=>v.source.endsWith(`/${f}`))||r.push({source:`hashicorp/${f}`,version:h[1]}));}let u=/module\s+"[^"]+"\s*\{([^}]+)\}/g,p;for(;(p=u.exec(n))!==null;){let f=p[1],d=f.match(/source\s*=\s*"([^"]+)"/);if(!d)continue;let h=d[1];if(h.startsWith("./")||h.startsWith("../")||h.startsWith("git::"))continue;let g=f.match(/version\s*=\s*"([^"]+)"/),v=g?g[1]:void 0;s.push({source:h,version:v});}return {terraformVersion:o$1,providers:r,modules:s}}async function wf(t,e){let n=new Map;try{let r=e?await e.readTextFile(t):await o(t),s=/provider\s+"[^"]*\/([^/"]+\/[^/"]+)"\s*\{([^}]+)\}/g,o$1;for(;(o$1=s.exec(r))!==null;){let i=o$1[1],c=o$1[2].match(/version\s*=\s*"([^"]+)"/);c&&n.set(i,c[1]);}}catch{}return n}function Xo(t,e){try{let n=t.replace(/^[~><=\s]+/,""),r=(0,re.minVersion)((0,re.validRange)(n)||n);if(!r)return "unknown";if(!(0,re.gt)(e,r.version))return "current";let s=(0,re.minVersion)(e);return s?s.major>r.major?"major-behind":"minor-behind":"unknown"}catch{return "unknown"}}async function Sf(t,e,n,r=false){let s=[];if(e){let v=await e.findFiles(t,w=>w.endsWith(".tf"));s.push(...v);}else {let v=["main.tf","variables.tf","outputs.tf","versions.tf","providers.tf"];for(let w of v){let j=`${t}/${w}`;await p(j)&&s.push(j);}}if(s.length===0)return null;let o,i=[],a=[];for(let v of s){let{terraformVersion:w,providers:j,modules:P}=await bf(v,e);w&&!o&&(o=w),i.push(...j),a.push(...P);}let c=new Map;for(let v of i)c.has(v.source)||c.set(v.source,v.version);let l=new Map;for(let v of a)l.has(v.source)||l.set(v.source,v.version);let u=`${t}/.terraform.lock.hcl`,p$1=await wf(u,e),f=[];for(let[v]of c){let[w,j]=v.split("/");f.push({type:"provider",namespace:w,name:j});}for(let[v]of l){let w=v.split("/");if(w.length===3){let[j,P,C]=w;f.push({type:"module",namespace:j,name:P,provider:C});}}let d=await vf(f,n,r),h=[],g={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let[v,w]of c){let j=p$1.get(v),P=j||w||"unknown",C=d.get(v),x=C&&P!=="unknown"?Xo(P,C):"unknown",y=null;if(C&&P!=="unknown")try{let b=(0,re.minVersion)((0,re.validRange)(P)||P),k=(0,re.minVersion)((0,re.validRange)(C)||C);b&&k&&(y=k.major-b.major);}catch{}h.push({package:`provider:${v}`,section:"dependencies",currentSpec:w||"unknown",resolvedVersion:j||null,latestStable:C||null,majorsBehind:y,drift:x}),x==="current"?g.current++:y===1?g.oneBehind++:y&&y>1?g.twoPlusBehind++:g.unknown++;}for(let[v,w]of l){let j=w||"unknown",P=d.get(v),C=P&&j!=="unknown"?Xo(j,P):"unknown",x=null;if(P&&j!=="unknown")try{let y=(0,re.minVersion)((0,re.validRange)(j)||j),b=(0,re.minVersion)((0,re.validRange)(P)||P);y&&b&&(x=b.major-y.major);}catch{}h.push({package:`module:${v}`,section:"dependencies",currentSpec:w||"unknown",resolvedVersion:null,latestStable:P||null,majorsBehind:x,drift:C}),C==="current"?g.current++:x===1?g.oneBehind++:x&&x>1?g.twoPlusBehind++:g.unknown++;}return {type:"terraform",path:B.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:B.basename(t),runtime:o,frameworks:[],dependencies:h,dependencyAgeBuckets:g}}async function kf(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>c.endsWith(".tf")):[],i=new Map;for(let c of o){let l=B.dirname(c);i.has(l)||i.set(l,[]),i.get(l).push(c);}let a=[];for(let[c]of i)try{let l=await Sf(c,n,e,s);l&&(l.path=B.relative(t,c)||".",a.push(l));}catch(l){console.error(`Error scanning Terraform project at ${c}:`,l);}return a}var Qo=[{name:"go.mod",type:"go"},{name:"Cargo.toml",type:"rust"},{name:"composer.json",type:"php"},{name:"Package.swift",type:"swift"},{name:"pubspec.yaml",type:"dart"},{name:"build.gradle.kts",type:"kotlin"},{name:"build.sbt",type:"scala"},{name:"DESCRIPTION",type:"r"},{name:"Podfile",type:"objective-c"},{name:"mix.exs",type:"elixir"},{name:"cpanfile",type:"perl"},{name:"Project.toml",type:"julia"},{name:"deps.edn",type:"clojure"},{name:"build.gradle",type:"groovy"},{name:"tsconfig.json",type:"typescript"},{name:"Makefile",type:"c"},{name:"CMakeLists.txt",type:"cpp"},{name:"*.vbp",type:"visual-basic"}],xf=[{extensions:[".m",".mm"],type:"objective-c"},{extensions:[".c",".h"],type:"c"},{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],type:"cpp"},{extensions:[".cob",".cbl",".cpy"],type:"cobol"},{extensions:[".f",".for",".f90",".f95",".f03",".f08"],type:"fortran"},{extensions:[".pas",".pp",".lpr"],type:"pascal"},{extensions:[".adb",".ads",".ada"],type:"ada"},{extensions:[".asm",".s",".s43",".s65"],type:"assembly"},{extensions:[".rpg",".rpgle",".sqlrpgle"],type:"rpg"}];function Et(t,e="unknown"){return {package:t,section:"dependencies",currentSpec:e,resolvedVersion:null,latestStable:null,majorsBehind:null,drift:"unknown"}}function Qt(t,e,n=1){let r=new Set;for(let s of t.split(/\r?\n/)){let o=s.match(e);o?.[n]&&r.add(o[n]);}return [...r]}function Ef(t,e){return B.basename(t)||B.basename(e)}function jf(t){return /^\s*(CC|CFLAGS|LDFLAGS)\s*[:?+]?=/m.test(t)||/\b(gcc|clang)\b/.test(t)||/\.(c|o)\b/.test(t)}function Wr(t,e,n,r,s,o=[]){let i=r||".",a=`${n}:${i}`;e.has(a)||(e.add(a),t.push({type:n,path:i,name:Ef(i,s),frameworks:[],dependencies:o,dependencyAgeBuckets:{current:0,oneBehind:0,twoPlusBehind:0,unknown:o.length}}));}async function Tf(t,e){let n$1=B.basename(t),r=async()=>e?e.readTextFile(t):o(t);if(n$1==="composer.json"){let o=e?await e.readJsonFile(t):await n(t);if(!o||typeof o!="object")return [];let i=new Set;for(let a of ["require","require-dev"]){let c=o[a];if(c&&typeof c=="object")for(let l of Object.keys(c))i.add(l);}return [...i].map(a=>Et(a))}let s=await r();return s?n$1==="go.mod"?Qt(s,/^\s*require\s+([^\s]+)\s+(.+)$/).map(o=>Et(o)):n$1==="Cargo.toml"?Qt(s,/^\s*([A-Za-z0-9_\-]+)\s*=\s*['"{]/).map(o=>Et(o)):n$1==="pubspec.yaml"?Qt(s,/^\s{2,}([A-Za-z0-9_\-]+):\s*.+$/).map(o=>Et(o)):n$1==="mix.exs"?Qt(s,/\{\s*:([a-zA-Z0-9_]+),/).map(o=>Et(o)):n$1==="cpanfile"?Qt(s,/^\s*requires\s+['"]([^'"]+)['"]/).map(o=>Et(o)):n$1==="build.sbt"?Qt(s,/"([A-Za-z0-9_.\-]+)"\s*%{1,2}\s*"([A-Za-z0-9_.\-]+)"/,2).map(o=>Et(o)):[]:[]}function Cf(t){let e=new Map;for(let n of t){if(!n.isFile)continue;let r=B.extname(n.name).toLowerCase();if(r)for(let s of xf){if(!s.extensions.includes(r))continue;let o=B.dirname(n.relPath)||".";e.has(o)||e.set(o,new Set),e.get(o)?.add(s.type);}}return e}async function Af(t,e){let n=e?await e.walkDir(t):[],r=n.filter(c=>c.isFile&&Qo.some(l=>l.name===c.name||l.name.startsWith("*.")&&c.name.endsWith(l.name.slice(1)))),s=new Set(n.filter(c=>c.isFile&&c.name.endsWith(".sh")).map(c=>B.dirname(c.relPath)||".")),o$1=[],i=new Set;for(let c of r){let l=Qo.find(f=>f.name===c.name||f.name.startsWith("*.")&&c.name.endsWith(f.name.slice(1)));if(!l)continue;if(c.name==="Makefile"){let f=e?await e.readTextFile(c.absPath):await o(c.absPath);if(!jf(f))continue}let u=B.dirname(c.relPath)||".",p=await Tf(c.absPath,e);Wr(o$1,i,l.type,u,t,p);}for(let c of s)Wr(o$1,i,"shell",c,t);let a=Cf(n);for(let[c,l]of a)for(let u of l)Wr(o$1,i,u,c,t);return o$1}var Pf=10,Mf=1048576,$f=5,Lf=20,Nf=2621440,Rf=10,If=30,_f=5242880,Ff=25,ss=25,os=10,is=3,Ly=1;function Jr(t,e,n,r){let s=0;return t.fileCount!==void 0&&t.fileCount>=1&&t.fileCount<e&&s++,t.sizeBytes!==void 0&&t.sizeBytes>0&&t.sizeBytes<n&&s++,t.dependencyCount!==void 0&&t.dependencyCount<r&&s++,s}function Of(t){return Jr(t,Pf,Mf,$f)>=2?"nano":Jr(t,Lf,Nf,Rf)>=2?"micro":Jr(t,If,_f,Ff)>=2?"small":"standard"}function Bf(t){switch(t){case "nano":return "nano";case "micro":case "function":return "micro";case "small":return "small";default:return "standard"}}function Ny(t){switch(t){case "nano":return 1/ss;case "micro":return 1/os;case "small":return 1/is;default:return 1}}function Vf(t){let e=0,n=0,r=0,s=0;for(let i of t)switch(Bf(i.classification)){case "nano":e++;break;case "micro":n++;break;case "small":r++;break;default:s++;break}let o=s+r/is+n/os+e/ss;return {nanoCount:e,microCount:n,smallCount:r,standardCount:s,totalScanned:e+n+r+s,nanoBillingRatio:ss,microBillingRatio:os,smallBillingRatio:is,billableProjectsRaw:Math.round(o*100)/100,billableProjects:Math.floor(o)}}var Df={N:.85,A:.62,L:.55,P:.2},Uf={L:.77,H:.44},Gf={N:.85,R:.62},qf={N:.85,L:.62,H:.27},Hf={N:.85,L:.68,H:.5},Kr={H:.56,L:.22,N:0};function zf(t){let e=Math.round(t*1e5);return e%1e4===0?e/1e5:(Math.floor(e/1e4)+1)/10}function Fi(t){if(!t||typeof t!="string")return null;let e=t.trim().split("/");if(!e.length||!/^CVSS:3\.[01]$/i.test(e[0]))return null;let n={};for(let g of e.slice(1)){let[v,w]=g.split(":");v&&w&&(n[v.toUpperCase()]=w.toUpperCase());}let r=n.S==="C",s=Df[n.AV],o=Uf[n.AC],i=Gf[n.UI],a=(r?Hf:qf)[n.PR],c=Kr[n.C],l=Kr[n.I],u=Kr[n.A];if([s,o,i,a,c,l,u].some(g=>g===void 0))return null;let p=1-(1-c)*(1-l)*(1-u),f=r?7.52*(p-.029)-3.25*Math.pow(p-.02,15):6.42*p;if(f<=0)return 0;let d=8.22*s*o*a*i,h=Math.min(r?1.08*(f+d):f+d,10);return zf(h)}function Oi(t){return t>=9?"critical":t>=7?"high":t>=4?"moderate":t>0?"low":"unknown"}function lr(t){switch(t){case "critical":return 4;case "high":return 3;case "moderate":return 2;case "low":return 1;default:return 0}}function Bi(t){switch((t??"").trim().toLowerCase()){case "critical":return "critical";case "high":return "high";case "moderate":case "medium":return "moderate";case "low":return "low";default:return "unknown"}}var Wf="https://api.osv.dev/v1/querybatch",Jf="https://api.osv.dev/v1/vulns/",Kf=15e3,Zo=500,Yf=3,Xf=250,Qf=new Set([408,425,429,500,502,503,504]);function Zf(t){switch(t){case "node":case "typescript":return "npm";case "python":return "pypi";case "java":return "maven";case "dotnet":return "nuget";case "go":return "go";case "rust":return "cargo";case "php":return "composer";case "ruby":return "rubygems";case "dart":return "pub";case "elixir":return "hex";default:return null}}function ed(t){switch(t){case "npm":return "npm";case "pypi":return "PyPI";case "maven":return "Maven";case "nuget":return "NuGet";case "go":return "Go";case "cargo":return "crates.io";case "composer":return "Packagist";case "rubygems":return "RubyGems";case "pub":return "Pub";case "hex":return "Hex"}}function td(){return {low:0,moderate:0,high:0,critical:0,unknown:0}}function nn(t){return `${t.ecosystem}\0${t.package}\0${t.version}`}function nd(t){let e=new Set,n=[];for(let r of t){let s=Zf(r.type);if(s)for(let o of r.dependencies){if(!o.resolvedVersion)continue;let i={ecosystem:s,package:o.package,version:o.resolvedVersion},a=nn(i);e.has(a)||(e.add(a),n.push(i));}}return n.sort((r,s)=>r.ecosystem.localeCompare(s.ecosystem)||r.package.localeCompare(s.package)||r.version.localeCompare(s.version)),n}function Vi(t,e,n){if(n&&n.includes(t))return true;let r=me.valid(me.coerce(t));if(!r)return false;for(let s of e??[]){let o=s.introduced&&s.introduced!=="0"?me.valid(me.coerce(s.introduced)):"0.0.0",i=s.fixed?me.valid(me.coerce(s.fixed)):null,a=o?me.gte(r,o):true,c=i?me.lt(r,i):true;if(a&&c)return true}return false}function rd(t,e){let n=t.severity?.find(p=>(p.type??"").toUpperCase().startsWith("CVSS_V3"))?.score??null,r=Fi(n),s=e.toLowerCase(),o=(t.affected??[]).filter(p=>(p.package?.name??"").toLowerCase()===s),i=t.database_specific?.severity??o.map(p=>p.ecosystem_specific?.severity??p.database_specific?.severity).find(Boolean)??null,a=r!=null?Oi(r):Bi(i),c=[],l=[],u=[];for(let p of o){for(let f of p.ranges??[]){let d,h=false;for(let g of f.events??[])g.introduced!==void 0&&(d=g.introduced==="0"?void 0:g.introduced,h=true),g.fixed&&(c.includes(g.fixed)||c.push(g.fixed),l.push({introduced:d,fixed:g.fixed}),h=false,d=void 0);h&&l.push({introduced:d});}for(let f of p.versions??[])u.includes(f)||u.push(f);}return {id:t.id??"UNKNOWN",aliases:Array.isArray(t.aliases)?t.aliases:[],summary:t.summary??null,severity:a,cvss:r,cvssVector:n,fixedVersions:c,published:t.published??null,withdrawn:t.withdrawn??null,references:(t.references??[]).map(p=>p.url).filter(p=>!!p),...l.length?{affectedRanges:l}:{},...u.length?{affectedVersions:u}:{}}}function Di(t){let e=typeof t.cvss=="number"?t.cvss:Fi(t.cvssVector??null),n=t.severity?Bi(t.severity):e!=null?Oi(e):"unknown";return {id:t.id,aliases:t.aliases??[],summary:t.summary??null,severity:n,cvss:e,cvssVector:t.cvssVector??null,fixedVersions:(t.ranges??[]).map(r=>r.fixed).filter(r=>!!r),published:t.published??null,withdrawn:t.withdrawn??null,references:t.references??[],...t.ranges?.length?{affectedRanges:t.ranges}:{},...t.versions?.length?{affectedVersions:t.versions}:{}}}function sd(t){return new Promise(e=>setTimeout(e,t))}async function Ui(t,e,n){return n.run(async()=>{for(let r=0;;r++){let s=new AbortController,o=setTimeout(()=>s.abort(),Kf);try{let i=await fetch(t,{...e,signal:s.signal});if(i.ok)return {ok:!0,data:await i.json()};if(!Qf.has(i.status))return {ok:!1}}catch{}finally{clearTimeout(o);}if(r>=Yf)return {ok:false};await sd(Xf*2**r);}})}async function od(t,e){let n=new Map,r=true;for(let s=0;s<t.length;s+=Zo){let o=t.slice(s,s+Zo),i=JSON.stringify({queries:o.map(l=>({version:l.version,package:{name:l.package,ecosystem:ed(l.ecosystem)}}))}),a=await Ui(Wf,{method:"POST",body:i,headers:{"content-type":"application/json"}},e);if(!a.ok){r=false;continue}let c=a.data;if(!c?.results){r=false;continue}for(let l=0;l<o.length;l++){let u=(c.results[l]?.vulns??[]).map(p=>p.id).filter(p=>!!p);u.length&&n.set(nn(o[l]),u);}}return {idsByTarget:n,allBatchesOk:r}}async function id(t,e){let n=new Map;return await Promise.all([...t].map(async r=>{let s=await Ui(`${Jf}${encodeURIComponent(r)}`,{method:"GET"},e);s.ok&&s.data&&n.set(r,s.data);})),n}function Gi(t,e){e.sort((s,o)=>s.ecosystem.localeCompare(o.ecosystem)||s.package.localeCompare(o.package)||s.version.localeCompare(o.version));let n=td(),r=0;for(let s of e){s.advisories.sort((i,a)=>lr(a.severity)-lr(i.severity)||i.id.localeCompare(a.id)),r+=s.advisories.length;let o=s.advisories.reduce((i,a)=>lr(a.severity)>lr(i)?a.severity:i,"unknown");n[o]++;}return {source:t,packages:e,totalAdvisories:r,severityCounts:n}}function as(){return {source:"none",packages:[],totalAdvisories:0,severityCounts:{low:0,moderate:0,high:0,critical:0,unknown:0}}}async function ad(t,e){if(t.length===0)return as();if(e.offline)return ei(t,e.manifest);let{idsByTarget:n,allBatchesOk:r}=await od(t,e.sem);if(n.size===0){let c=ei(t,e.manifest);return c.packages.length?c:{...as(),source:r?"osv":"unreachable"}}let s=new Set;for(let c of n.values())for(let l of c)s.add(l);let o=await id(s,e.sem),i=qi(t,e.manifest),a=[];for(let c of t){let l=n.get(nn(c))??[],u=[],p=new Set;for(let f of l){let d=o.get(f);!d||d.withdrawn||(u.push(rd(d,c.package)),p.add(f));}for(let f of i.get(nn(c))??[])p.has(f.id)||u.push(f);u.length&&a.push({...c,advisories:u});}return Gi("osv",a)}function qi(t,e){let n=new Map;if(!e)return n;for(let r of t){let o=(W(e,r.ecosystem,r.package)?.vulns??[]).filter(i=>!i.withdrawn&&Vi(r.version,i.ranges,i.versions));o.length&&n.set(nn(r),o.map(Di));}return n}function ei(t,e){let n=qi(t,e);if(n.size===0)return as();let r=[];for(let s of t){let o=n.get(nn(s));o?.length&&r.push({...s,advisories:o});}return Gi("manifest",r)}var cd="vibgrate/vulnerability";function ld(t){switch(t){case "critical":case "high":return "error";case "moderate":return "warning";default:return "note"}}function ud(t){let e=[];for(let n of t.packages)for(let r of n.advisories){let s=r.aliases.find(l=>l.startsWith("CVE-")),o=s&&s!==r.id?`${r.id} (${s})`:r.id,i=r.fixedVersions.length?` \u2014 fixed in ${r.fixedVersions.join(", ")}`:" \u2014 no fix available",a=r.cvss!=null?` ${r.cvss}`:"",c=r.introduced!=null?` \u2014 introduced by ${r.introduced.authorName} in ${r.introduced.shortSha}${r.exposureDays!=null?` (${r.exposureDays}d exposed)`:""}`:"";e.push({ruleId:cd,level:ld(r.severity),message:`${n.package}@${n.version}: ${o} (${r.severity}${a})${i}${c}`,location:n.package,details:{ecosystem:n.ecosystem,package:n.package,installedVersion:n.version,advisoryId:r.id,aliases:r.aliases,severity:r.severity,cvss:r.cvss,fixedVersions:r.fixedVersions,...r.introduced?{introducedBy:r.introduced.authorName,introducedSha:r.introduced.shortSha,introducedDate:r.introduced.date,exposureDays:r.exposureDays}:{}}});}return e}var pd=new Set(["node_modules",".git","dist","build","out",".vibgrate","vendor",".venv","venv","env","__pycache__","target",".next",".nuxt","coverage",".cache"]),ti=8e3,fd=12,dd=1048576,md=5,hd={npm:new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts",".vue",".svelte"]),pypi:new Set([".py"])};function gd(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yd(t,e){let n=gd(e);return t==="npm"?new RegExp(`(?:from\\s+|require\\(\\s*|import\\(\\s*)['"]${n}(?:/[^'"]*)?['"]`,"g"):t==="pypi"?new RegExp(`^\\s*(?:import\\s+${n}(?:[.\\s]|$)|from\\s+${n}(?:[.\\s]))`,"gm"):null}function vd(t,e,n){let r={importSites:0,filesTouched:0,sampleFiles:[]};if(n==="unknown")return r;let s=hd[n],o=yd(n,e);if(!s||!o)return r;let i=0,a=0,c=[],l=0,u=(p,f)=>{if(f>fd||l>=ti)return;let d;try{d=sn.readdirSync(p,{withFileTypes:!0});}catch{return}d.sort((h,g)=>h.name.localeCompare(g.name));for(let h of d){if(l>=ti)return;if(h.isDirectory()){if(pd.has(h.name)||h.name.startsWith("."))continue;u(B.join(p,h.name),f+1);}else if(h.isFile()&&s.has(B.extname(h.name))){l++;let g=B.join(p,h.name),v;try{if(sn.statSync(g).size>dd)continue;v=sn.readFileSync(g,"utf8");}catch{continue}o.lastIndex=0;let w=v.match(o);w&&w.length&&(i+=w.length,a++,c.length<md&&c.push(B.relative(t,g).replace(/\\/g,"/")));}}};return u(t,0),c.sort(),{importSites:i,filesTouched:a,sampleFiles:c}}function bd(t,e,n){let r=t?Be.valid(Be.coerce(t)):null,s=e?Be.valid(Be.coerce(e)):null;if(!r||!s)return {majorsBehind:n??null,interimMajors:[]};let o=Be.major(r),i=Be.major(s),a=n??Math.max(0,i-o),c=[];for(let l=o+1;l<i;l++)c.push(`${l}.x`);return {majorsBehind:a,interimMajors:c}}function wd(t,e){let n=e.filesTouched;return !t||t<=0?n>0?"low":"none":n===0?"low":n>20||t>=2&&n>5?"high":n>5||t>=2?"moderate":"low"}function Sd(t,e,n){return t!=null&&t>=2?"multi-major-plan":t===1?"single-major":e&&n&&e!==n?"patch-minor":"current"}function Ry(t,e,n={}){let{majorsBehind:r,interimMajors:s}=bd(e.currentVersion,e.latestVersion,e.majorsBehind),o=vd(t,e.package,e.ecosystem),i=wd(r,o),a=Sd(r,e.currentVersion,e.latestVersion),c=n.fixesVulnerabilities??[],l=[];return s.length&&l.push(`Step through ${s.join(" \u2192 ")} before the latest major rather than jumping directly.`),o.filesTouched===0&&r&&r>0?l.push("No direct source usage found \u2014 likely a transitive or config-only dependency; upgrade risk is mostly indirect."):o.filesTouched>0&&l.push(`Used at ${o.importSites} import site(s) across ${o.filesTouched} file(s) \u2014 review these when upgrading.`),c.length&&l.push(`Upgrading also remediates ${c.length} open advisory(ies): ${c.join(", ")}.`),{package:e.package,ecosystem:e.ecosystem,currentVersion:e.currentVersion,latestVersion:e.latestVersion,majorsBehind:r,interimMajors:s,usage:o,blastRadius:i,recommendation:a,fixesVulnerabilities:c,notes:l}}var kd=12e3,xd=100,Yr={source:"none",repositoryUrl:null,releasesScanned:0,breakingReleases:[],notes:[]},Ed={npm:"npmjs.org",pypi:"pypi.org",maven:"repo1.maven.org",nuget:"nuget.org",go:"proxy.golang.org",cargo:"crates.io",composer:"packagist.org",rubygems:"rubygems.org",pub:"pub.dev",hex:"hex.pm"},Hi=[{re:/breaking[\s-]?change/i,label:"breaking change"},{re:/\bbreaking\b/i,label:"breaking"},{re:/\bdrop(?:ped|s)?\s+support\b/i,label:"dropped support"},{re:/\bremoved?\b/i,label:"removal"},{re:/\bdeprecat/i,label:"deprecation"},{re:/\bmigrat/i,label:"migration"},{re:/\brenamed?\b/i,label:"rename"},{re:/\bno longer\b/i,label:"no longer supported"},{re:/\bincompatib/i,label:"incompatibility"}];function jd(t){if(!t)return [];let e=new Set;for(let{re:n,label:r}of Hi)n.test(t)&&e.add(r);return [...e]}function Td(t){if(!t)return null;for(let{re:e}of Hi){let n=e.exec(t);if(n&&n.index!=null){let r=Math.max(0,n.index-60),s=t.slice(r,n.index+100).replace(/\s+/g," ").trim();return (r>0?"\u2026":"")+s+(n.index+100<t.length?"\u2026":"")}}return null}function Cd(t){if(!t)return null;let e=t.match(/github\.com[/:]([^/]+)\/([^/#?]+?)(?:\.git)?(?:[/#?].*)?$/i);return e?{owner:e[1],repo:e[2]}:null}function Ad(t,e){let n=t.trim();if(e){for(let r of [`${e}@`,`${e}-v`,`${e}-`,`${e}/`,`${e}_`])if(n.startsWith(r)){n=n.slice(r.length);break}}return n=n.replace(/^v/i,""),K.valid(K.coerce(n))}function Pd(t,e,n){let r=K.valid(K.coerce(t)),s=K.valid(K.coerce(e)),o=K.valid(K.coerce(n));return !r||!s||!o?false:K.gt(r,s)&&K.lte(r,o)}function Md(t,e,n,r){let s=[];for(let o of t){if(o.draft)continue;let i=o.tag_name??o.name??"",a=Ad(i,r);if(!a||!Pd(a,e,n))continue;let c=[o.name,o.body].filter(Boolean).join(`
80
- `),l=jd(c);l.length&&s.push({version:a,tag:i,url:o.html_url??null,date:o.published_at??null,signals:l,excerpt:Td(c)});}return s.sort((o,i)=>K.lt(o.version,i.version)?-1:K.gt(o.version,i.version)?1:o.tag.localeCompare(i.tag)),s}async function zi(t){let e=new AbortController,n=setTimeout(()=>e.abort(),kd);try{let r=await fetch(t,{signal:e.signal,headers:{"user-agent":"vibgrate-cli",accept:"application/json"}});return r.ok?await r.json():null}catch{return null}finally{clearTimeout(n);}}async function $d(t,e){let n=Ed[t];if(!n)return null;let s=(await zi(`https://packages.ecosyste.ms/api/v1/registries/${n}/packages/${encodeURIComponent(e)}`))?.repository_url;return typeof s=="string"?s:null}async function Iy(t,e,n,r,s={}){if(t==="unknown"||!n||!r)return Yr;let o=s.repositoryUrl??await $d(t,e),i=Cd(o);if(!i)return {...Yr,repositoryUrl:o??null,notes:["no GitHub repository resolved for this package \u2014 changelog signals unavailable"]};let a=s.fetchReleases?await s.fetchReleases(i.owner,i.repo):await zi(`https://api.github.com/repos/${i.owner}/${i.repo}/releases?per_page=${xd}`);if(!Array.isArray(a))return {...Yr,repositoryUrl:o,notes:["could not fetch releases (network, rate limit, or no GitHub Releases)"]};let c=Md(a,n,r,e),l=[];return a.length===0?l.push("the repository publishes no GitHub Releases"):c.length===0&&l.push("no breaking-change signals found in releases across this version span"),{source:"github-releases",repositoryUrl:o,releasesScanned:a.length,breakingReleases:c,notes:l}}var Nd=15e3,Rd=64*1024*1024,Wi=500,Id="";function Sr(t,e){return new Promise(n=>{execFile("git",e,{cwd:t,timeout:Nd,maxBuffer:Rd,windowsHide:true,encoding:"utf8",env:{...process.env,GIT_TERMINAL_PROMPT:"0",GIT_OPTIONAL_LOCKS:"0",GIT_PAGER:"cat"}},(r,s)=>{n(r?{ok:false,stdout:""}:{ok:true,stdout:typeof s=="string"?s:String(s)});});})}var ni=new Map;function Ji(t){return t.split(B.sep).join("/")}async function _n(t){let e=B.resolve(t),n=ni.get(e);if(n!==void 0)return n;let r=await Sr(e,["rev-parse","--show-toplevel"]),s=r.ok&&r.stdout.trim()||null;return ni.set(e,s),s}async function _d(t){return await _n(t)!==null}async function Fd(t){let e=await _n(t);if(!e)return null;let n=await Sr(e,["rev-parse","HEAD"]);return n.ok&&n.stdout.trim()||null}async function Od(t,e,n={}){let r=await _n(t);if(!r)return [];let s=Math.max(1,n.maxCommits??Wi),o=["%H","%h","%an","%ae","%aI","%s"].join("%x1f"),i=await Sr(r,["log",`--max-count=${s}`,"--follow",`--format=${o}`,"--",Ji(e)]);if(!i.ok)return [];let a=[];for(let c of i.stdout.split(`
81
- `)){if(!c)continue;let l=c.split(Id);l.length<6||a.push({sha:l[0],shortSha:l[1],authorName:l[2],authorEmail:l[3],date:l[4],subject:l[5]});}return a.reverse(),a}async function Bd(t,e,n){if(!/^[0-9a-f]{4,40}$/i.test(e))return null;let r=await _n(t);if(!r)return null;let s=await Sr(r,["show",`${e}:${Ji(n)}`]);return s.ok?s.stdout:null}var Ki=3,Yi="version-timeline.json";function he(t,e,n){if(!e||!n)return;let r=t.get(e);if(r===void 0){t.set(e,n);return}let s=pt.valid(pt.coerce(r)),o=pt.valid(pt.coerce(n));s&&o?pt.gt(o,s)&&t.set(e,n):n>r&&t.set(e,n);}function cs(t){let e=new Map,n;try{n=JSON.parse(t);}catch{return e}if(!n||typeof n!="object")return e;let r=n,s=r.packages;if(s&&typeof s=="object"){let i=new Map;for(let a of Object.keys(s).sort()){if(!a)continue;let c="node_modules/",l=a.lastIndexOf(c);if(l===-1)continue;let u=a.slice(l+c.length);if(!u)continue;let p=s[a],f=p&&typeof p=="object"?p.version:void 0;if(typeof f!="string")continue;let d=a.split(c).length-1,h=i.get(u);(h===void 0||d<h)&&(e.set(u,f),i.set(u,d));}return e}let o=r.dependencies;return o&&typeof o=="object"&&Xi(o,e),e}function Xi(t,e){for(let n of Object.keys(t).sort()){let r=t[n];if(!r||typeof r!="object")continue;let s=r;typeof s.version=="string"&&!e.has(n)&&e.set(n,s.version),s.dependencies&&typeof s.dependencies=="object"&&Xi(s.dependencies,e);}}function Vd(t){let e=t.replace(/^\//,""),n=-1;for(let i=e.startsWith("@")?1:0;i<e.length-1;i++)if(e[i]==="@"&&/[0-9]/.test(e[i+1])){n=i;break}let r,s;if(n>0)r=e.slice(0,n),s=e.slice(n+1);else {let i=e.lastIndexOf("/");if(i<=0)return null;r=e.slice(0,i),s=e.slice(i+1);}let o=s.match(/^[0-9][^_(\s]*/);return !r||!o?null:{name:r,version:o[0]}}function Dd(t){let e=new Map,n=false;for(let r of t.split(`
82
- `)){if(/^\S/.test(r)){n=/^packages:\s*$/.test(r);continue}if(!n)continue;let s=r.match(/^ {2}(\S.*?):\s*$/);if(!s)continue;let o=s[1].trim();(o.startsWith("'")&&o.endsWith("'")||o.startsWith('"')&&o.endsWith('"'))&&(o=o.slice(1,-1));let i=Vd(o);i&&he(e,i.name,i.version);}return e}function Ud(t){let e=t.split(",")[0].trim().replace(/^"/,"").replace(/"$/,""),n=e.indexOf("@",e.startsWith("@")?1:0);return n<=0?null:e.slice(0,n)}function Gd(t){let e=new Map,n=null;for(let r of t.split(`
83
- `)){if(!r.trim()||r.trimStart().startsWith("#"))continue;if(/^\S/.test(r)||r.startsWith('"')){n=Ud(r.replace(/:\s*$/,""));continue}let s=r.match(/^\s+version:?\s+"?([^"\s]+)"?/);s&&n&&he(e,n,s[1]);}return e}function ri(t){let e=new Map;for(let n of t.split(/\[\[package\]\]/)){let r=n.match(/^\s*name\s*=\s*"([^"]+)"/m),s=n.match(/^\s*version\s*=\s*"([^"]+)"/m);r&&s&&he(e,r[1],s[1]);}return e}function qd(t){let e=new Map,n;try{n=JSON.parse(t);}catch{return e}let r=n;for(let s of ["packages","packages-dev"]){let o=r?.[s];if(Array.isArray(o)){for(let i of o)if(i&&typeof i=="object"){let a=i.name,c=i.version;typeof a=="string"&&typeof c=="string"&&he(e,a,c.replace(/^v/,""));}}}return e}function Hd(t){let e=new Map,n=false;for(let r of t.split(`
84
- `)){if(/^\S/.test(r)){n=false;continue}if(/^ {2}specs:\s*$/.test(r)){n=true;continue}if(!n)continue;let s=r.match(/^ {4}(\S+) \(([^)]+)\)\s*$/);s&&he(e,s[1],s[2].split("-")[0].trim());}return e}function zd(t){let e=new Map,n=false;for(let r of t.split(`
85
- `)){let s=r.replace(/\/\/.*$/,"").trim();if(!s)continue;if(n){if(s===")"){n=false;continue}let i=s.match(/^(\S+)\s+(v\S+)/);i&&he(e,i[1],i[2]);continue}if(s==="require ("){n=true;continue}let o=s.match(/^require\s+(\S+)\s+(v\S+)/);o&&he(e,o[1],o[2]);}return e}function Wd(t){let e=new Map,n;try{n=JSON.parse(t);}catch{return e}let r=n;for(let s of ["default","develop"]){let o=r?.[s];if(!(!o||typeof o!="object"))for(let[i,a]of Object.entries(o)){let c=a&&typeof a=="object"?a.version:void 0;typeof c=="string"&&he(e,i,c.replace(/^==/,"").trim());}}return e}function Jd(t){let e=new Map,n=false,r=null;for(let s of t.split(`
86
- `)){if(/^\S/.test(s)){n=/^packages:\s*$/.test(s),r=null;continue}if(!n)continue;let o=s.match(/^ {2}(\S+):\s*$/);if(o){r=o[1];continue}let i=s.match(/^ {4}version:\s*"?([^"\s]+)"?/);i&&r&&he(e,r,i[1]);}return e}function Kd(t){let e=new Map,n=/"([^"]+)"\s*=>\s*\{:hex,\s*:\w+,\s*"([^"]+)"/g,r;for(;(r=n.exec(t))!==null;)he(e,r[1],r[2]);return e}function Yd(t){let e=new Map,n;try{n=JSON.parse(t);}catch{return e}let r=n?.dependencies;if(!r||typeof r!="object")return e;for(let s of Object.values(r))if(!(!s||typeof s!="object"))for(let[o,i]of Object.entries(s)){let a=i&&typeof i=="object"?i.resolved:void 0;typeof a=="string"&&he(e,o,a);}return e}var Xd=new je({ignoreAttributes:true,parseTagValue:false,trimValues:true});function Qd(t){return t==null?[]:Array.isArray(t)?t:[t]}function Zd(t){return !!t&&!t.includes("${")&&!/[[\](),]/.test(t)}function em(t){let e=new Map;if(!t)return e;let n;try{n=Xd.parse(t);}catch{return e}let r=n?.project;if(!r||typeof r!="object")return e;let s={},o=r.properties;if(o&&typeof o=="object")for(let[l,u]of Object.entries(o))u!=null&&typeof u!="object"&&(s[l]=String(u));let i=r.version!=null?String(r.version):r.parent?.version!=null?String(r.parent.version):void 0;i&&(s["project.version"]=i,s["project.parent.version"]=i);let a=l=>l.replace(/\$\{([^}]+)\}/g,(u,p)=>s[p]??`\${${p}}`),c=r.dependencies?.dependency;for(let l of Qd(c)){if(!l||typeof l!="object")continue;let u=l;if(u.version==null)continue;let p=u.groupId!=null?a(String(u.groupId)).trim():"",f=u.artifactId!=null?a(String(u.artifactId)).trim():"";if(!p||!f)continue;let d=a(String(u.version)).trim();Zd(d)&&he(e,`${p}:${f}`,d);}return e}var Qi=[{ecosystem:"npm",basename:"package-lock.json",parse:cs},{ecosystem:"npm",basename:"npm-shrinkwrap.json",parse:cs},{ecosystem:"npm",basename:"pnpm-lock.yaml",parse:Dd},{ecosystem:"npm",basename:"yarn.lock",parse:Gd},{ecosystem:"pypi",basename:"poetry.lock",parse:ri},{ecosystem:"pypi",basename:"Pipfile.lock",parse:Wd},{ecosystem:"cargo",basename:"Cargo.lock",parse:ri},{ecosystem:"composer",basename:"composer.lock",parse:qd},{ecosystem:"rubygems",basename:"Gemfile.lock",parse:Hd},{ecosystem:"go",basename:"go.mod",parse:zd},{ecosystem:"pub",basename:"pubspec.lock",parse:Jd},{ecosystem:"hex",basename:"mix.lock",parse:Kd},{ecosystem:"nuget",basename:"packages.lock.json",parse:Yd},{ecosystem:"maven",basename:"gradle.lockfile",parse:ji},{ecosystem:"maven",basename:"pom.xml",parse:em}];function Oy(t,e){let n=B.basename(t),r=Qi.find(s=>s.basename===n);return r?r.parse(e):cs(e)}function tm(){let t=[],e=new Map;for(let n of Qi)e.has(n.ecosystem)||(e.set(n.ecosystem,[]),t.push(n.ecosystem)),e.get(n.ecosystem).push({basename:n.basename,parse:n.parse});return t.map(n=>({ecosystem:n,candidates:e.get(n)}))}async function nm(t){try{let e=await xe.readFile(B.join(t,Yi),"utf8"),n=JSON.parse(e);if(n?.schema===Ki&&n.timelines)return n.timelines}catch{}return null}async function rm(t,e){try{await xe.mkdir(t,{recursive:!0});let n={schema:Ki,timelines:e};await xe.writeFile(B.join(t,Yi),JSON.stringify(n,null,2));}catch{}}async function sm(t,e,n,r,s){let o=await Od(t,n,{maxCommits:s});if(!o.length)return null;let i=new Map,a=new Map,c=new Map,l=(p,f)=>{let d=c.get(p);d||(d=[],c.set(p,d)),d.push(f);};for(let p of o){let f=await Bd(t,p.sha,n);if(f==null)continue;let d=r(f);for(let[h,g]of i)g!==null&&!d.has(h)&&(i.set(h,null),l(h,{version:null,commit:p}));for(let[h,g]of d){if(i.get(h)===g)continue;i.set(h,g);let v=a.get(h);v||(v=[],a.set(h,v)),v.push({version:g,commit:p}),l(h,{version:g,commit:p});}}if(a.size===0)return null;let u=[...a.keys()].sort().map(p=>({ecosystem:e,name:p,changes:a.get(p),presence:c.get(p)}));return {ecosystem:e,lockfile:n,packages:u}}async function om(t,e={}){if(!await _n(t))return null;let r=await Fd(t);if(e.cacheDir&&r){let a=await nm(e.cacheDir);if(a&&a.head===r)return a}let s=e.maxCommits??Wi,o=[];for(let{ecosystem:a,candidates:c}of tm())for(let{basename:l,parse:u}of c){let p=await sm(t,a,l,u,s);if(p){o.push(p);break}}if(o.length===0)return null;let i={head:r,ecosystems:o};return e.cacheDir&&r&&await rm(e.cacheDir,i),i}function Zi(t,e,n){return t.ecosystems.find(r=>r.ecosystem===e)?.packages.find(r=>r.name===n)}function By(t,e){for(let n of t.ecosystems){let r=n.packages.find(s=>s.name===e);if(r)return r}}var ea={critical:7,high:30,moderate:90,low:180,unknown:null};function ls(t,e){let n=Date.parse(t),r=Date.parse(e);return !Number.isFinite(n)||!Number.isFinite(r)?null:Math.max(0,Math.round((r-n)/864e5))}function im(t){let e=t.fixedVersions.map(n=>$e.valid($e.coerce(n))).filter(n=>!!n);return e.length?e.sort($e.compare)[0]??null:null}function ta(t,e){if(e.affectedRanges&&e.affectedRanges.length||e.affectedVersions&&e.affectedVersions.length)return Vi(t,e.affectedRanges,e.affectedVersions);let n=im(e);if(!n)return true;let r=$e.valid($e.coerce(t));return r?$e.lt(r,n):false}function us(t){return {sha:t.sha,shortSha:t.shortSha,authorName:t.authorName,authorEmail:t.authorEmail,date:t.date,subject:t.subject}}function am(t,e){if(!t||!t.changes.length)return null;let n=null;for(let r=t.changes.length-1;r>=0;r--){let s=t.changes[r];if(ta(s.version,e))n=us(s.commit);else break}return n}function cm(t,e,n){if(!t)return [];let r=t.presence??t.changes.map(i=>({version:i.version,commit:i.commit})),s=[],o=null;for(let i of r){let a=i.version!=null&&ta(i.version,e);if(a&&!o)o=us(i.commit);else if(!a&&o){let c=us(i.commit);s.push({introduced:o,remediated:c,exposureDays:ls(o.date,c.date),open:false}),o=null;}}return o&&s.push({introduced:o,remediated:null,exposureDays:ls(o.date,n),open:true}),s}function lm(){return {low:0,moderate:0,high:0,critical:0,unknown:0}}function um(t,e,n=ea,r=[]){let s=lm(),o=0,i=0,a=0,c=null,l=0,u=0;for(let d of t.packages)for(let h of d.advisories){o++,s[h.severity]++;let g=h.exposureDays??null;if(g!=null){a++,l+=g,u++,(c==null||g>c)&&(c=g);let v=n[h.severity];v!=null&&g>v&&i++;}}let p=r.length,f=r.reduce((d,h)=>d+h,0);return {openCount:o,openBySeverity:s,slaDays:n,slaBreaches:i,maxOpenExposureDays:c,meanOpenExposureDays:u>0?Math.round(l/u):null,attributedCount:a,remediatedCount:p,meanRemediationDays:p>0?Math.round(f/p):null,maxRemediationDays:p>0?Math.max(...r):null}}function pm(t,e,n,r){if(!e)return [];let s=new Set,o=[],i=(a,c)=>{let l=`${a.ecosystem}\0${a.name}\0${c.id}`;if(!s.has(l)){s.add(l);for(let u of cm(a,c,n))!u.open&&u.exposureDays!=null&&o.push(u.exposureDays);}};for(let a of t.packages){let c=Zi(e,a.ecosystem,a.package);if(c)for(let l of a.advisories)i(c,l);}if(r)for(let a of e.ecosystems)for(let c of a.packages){let l=W(r,c.ecosystem,c.name);for(let u of l?.vulns??[])u.withdrawn||i(c,Di(u));}return o}function fm(t,e,n,r={}){let s=r.slaDays??ea;for(let i of t.packages){let a=e?Zi(e,i.ecosystem,i.package):void 0;for(let c of i.advisories){let l=am(a,c);c.introduced=l,c.exposureDays=l?ls(l.date,n):null;}}let o=pm(t,e,n,r.manifest);return t.cra=um(t,n,s,o),t}var dm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;baseUrl="https://api.nuget.org/v3-flatcontainer";get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"nuget",t);if(r){let s=(r.versions??[]).filter(a=>Ve.valid(a)&&Ve.prerelease(a)===null),i=[...s].sort(Ve.rcompare)[0]??null;return {latest:r.latest??i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`${this.baseUrl}/${t.toLowerCase()}/index.json`,o=await fetch(s,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let c=((await o.json()).versions??[]).filter(p=>Ve.valid(p)&&Ve.prerelease(p)===null),u=[...c].sort(Ve.rcompare)[0]??null;return {latest:u,stableVersions:c,latestStableOverall:u}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}};function ur(t){let e=t.replace(/^[vV]/,"").trim();if(/(?:a|b|rc|alpha|beta|dev|post)\d*/i.test(e))return null;let n=e.split(".");for(;n.length<3;)n.push("0");return e=n.slice(0,3).join("."),$n.valid(e)}var mm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"pypi",t);if(r){let s=[];for(let a of r.versions??[]){let c=ur(a);c&&s.push(c);}let i=[...s].sort($n.rcompare)[0]??null;return {latest:r.latest?ur(r.latest)??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://pypi.org/pypi/${encodeURIComponent(t)}/json`,o=await fetch(s,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let i=await o.json(),a=Object.keys(i.releases??{}),c=[];for(let d of a){let h=ur(d);h&&c.push(h);}let l=i.info?.version??null,u=l?ur(l):null,f=[...c].sort($n.rcompare)[0]??u??null;return {latest:u??f,stableVersions:c,latestStableOverall:f}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}};function Xr(t){let e=t.trim();if(/(?:[-.](?:SNAPSHOT|alpha|beta|rc|M\d+|CR\d+))/i.test(e))return null;e=e.replace(/\.(?:RELEASE|Final|GA)$/i,"");let n=e.split(".");for(;n.length<3;)n.push("0");return e=n.slice(0,3).join("."),Ln.valid(e)}var hm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t,e){let n=`${t}:${e}`,r=this.meta.get(n);if(r)return r;let s=this.sem.run(async()=>{let o=`${t}:${e}`,i=W(this.manifest,"maven",o);if(i){let a=[];for(let u of i.versions??[]){let p=Xr(u);p&&a.push(p);}let l=[...a].sort(Ln.rcompare)[0]??null;return {latest:i.latest?Xr(i.latest)??l:l,stableVersions:a,latestStableOverall:l}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let a=`https://search.maven.org/solrsearch/select?q=g:%22${encodeURIComponent(t)}%22+AND+a:%22${encodeURIComponent(e)}%22&core=gav&rows=100&wt=json`,c=await fetch(a,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!c.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let p=((await c.json()).response?.docs??[]).map(g=>g.v).filter(g=>typeof g=="string"),f=[];for(let g of p){let v=Xr(g);v&&f.push(v);}let h=[...f].sort(Ln.rcompare)[0]??null;return {latest:h,stableVersions:f,latestStableOverall:h}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(n,s),s}};function Qr(t){let e=t.trim();if(/(?:\.pre|\.rc|\.beta|\.alpha|\.dev)/i.test(e))return null;let n=e.split(".");if(n.length<2)return null;for(;n.length<3;)n.push("0");let r=n.slice(0,3).join(".");return Nn.valid(r)}var gm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"rubygems",t);if(r){let s=[];for(let a of r.versions??[]){let c=Qr(a);c&&s.push(c);}let i=[...s].sort(Nn.rcompare)[0]??null;return {latest:r.latest?Qr(r.latest)??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://rubygems.org/api/v1/versions/${encodeURIComponent(t)}.json`,o=await fetch(s,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let i=await o.json();if(!Array.isArray(i))return {latest:null,stableVersions:[],latestStableOverall:null};let a=[];for(let u of i){if(u.prerelease)continue;let p=u.number;if(!p)continue;let f=Qr(p);f&&a.push(f);}let l=[...a].sort(Nn.rcompare)[0]??null;return {latest:l,stableVersions:a,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},ym=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"swift",t);if(r){let s=[];for(let a of r.versions??[]){let c=ce.valid(ce.clean(a));c&&s.push(c);}let i=[...s].sort(ce.rcompare)[0]??null;return {latest:r.latest?ce.valid(ce.clean(r.latest))??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=t.match(/github\.com[/:]([^/]+\/[^/]+?)(\.git)?$/i);if(!s)return {latest:null,stableVersions:[],latestStableOverall:null};let o=s[1],i=`https://api.github.com/repos/${o}/releases`,a=await fetch(i,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/vnd.github+json","User-Agent":"vibgrate-cli"}});if(!a.ok)return this.fetchFromTags(o);let c=await a.json();if(!Array.isArray(c))return {latest:null,stableVersions:[],latestStableOverall:null};let l=[];for(let f of c){if(f.prerelease||f.draft)continue;let d=f.tag_name;if(!d)continue;let h=ce.valid(ce.clean(d));h&&l.push(h);}let p=[...l].sort(ce.rcompare)[0]??null;return {latest:p,stableVersions:l,latestStableOverall:p}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}async fetchFromTags(t){try{let e=`https://api.github.com/repos/${t}/tags`,n=await fetch(e,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/vnd.github+json","User-Agent":"vibgrate-cli"}});if(!n.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let r=await n.json();if(!Array.isArray(r))return {latest:null,stableVersions:[],latestStableOverall:null};let s=[];for(let a of r){let c=a.name;if(!c||/(?:alpha|beta|rc|pre|dev)/i.test(c))continue;let l=ce.valid(ce.clean(c));l&&s.push(l);}let i=[...s].sort(ce.rcompare)[0]??null;return {latest:i,stableVersions:s,latestStableOverall:i}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}}},vm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"go",t);if(r){let s=[];for(let a of r.versions??[]){let c=ye.valid(ye.clean(a));c&&s.push(c);}let i=[...s].sort(ye.rcompare)[0]??null;return {latest:r.latest?ye.valid(ye.clean(r.latest))??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let o=`https://proxy.golang.org/${encodeURIComponent(t)}/@v/list`,i=await fetch(o,{signal:AbortSignal.timeout(1e4),headers:{Accept:"text/plain"}});if(!i.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let c=(await i.text()).split(`
87
- `).filter(Boolean),l=[];for(let f of c){if(/[+-](?:alpha|beta|rc|pre|dev)/i.test(f)||/v\d+\.\d+\.\d+-\d{14}-[a-f0-9]+/.test(f))continue;let d=ye.valid(ye.clean(f));d&&l.push(d);}let p=[...l].sort(ye.rcompare)[0]??null;return {latest:p,stableVersions:l,latestStableOverall:p}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},bm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"cargo",t);if(r){let s=[];for(let a of r.versions??[]){let c=ve.valid(ve.clean(a));c&&s.push(c);}let i=[...s].sort(ve.rcompare)[0]??null;return {latest:r.latest?ve.valid(ve.clean(r.latest))??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://crates.io/api/v1/crates/${encodeURIComponent(t)}`,o=await fetch(s,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json","User-Agent":"vibgrate-cli (https://github.com/vibgrate/vibgrate-cli)"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let i=await o.json();if(!i.versions)return {latest:null,stableVersions:[],latestStableOverall:null};let a=[];for(let u of i.versions){if(u.yanked||!u.num||/[+-](?:alpha|beta|rc|pre|dev)/i.test(u.num))continue;let p=ve.valid(ve.clean(u.num));p&&a.push(p);}let l=[...a].sort(ve.rcompare)[0]??null;return {latest:l,stableVersions:a,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},wm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"composer",t);if(r){let s=[];for(let a of r.versions??[]){let c=be.valid(be.clean(a));c&&s.push(c);}let i=[...s].sort(be.rcompare)[0]??null;return {latest:r.latest?be.valid(be.clean(r.latest))??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://repo.packagist.org/p2/${encodeURIComponent(t)}.json`,o=await fetch(s,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let i=await o.json();if(!i.packages)return {latest:null,stableVersions:[],latestStableOverall:null};let a=i.packages[t];if(!a||!Array.isArray(a))return {latest:null,stableVersions:[],latestStableOverall:null};let c=[];for(let p of a){let f=p.version??p.version_normalized;if(!f||f==="dev-master"||f.startsWith("dev-")||/[+-](?:alpha|beta|rc|pre|dev)/i.test(f))continue;let d=be.valid(be.clean(f));d&&c.push(d);}let u=[...c].sort(be.rcompare)[0]??null;return {latest:u,stableVersions:c,latestStableOverall:u}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},Sm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"pub",t);if(r){let s=[];for(let a of r.versions??[]){let c=we.valid(we.clean(a));c&&s.push(c);}let i=[...s].sort(we.rcompare)[0]??null;return {latest:r.latest?we.valid(we.clean(r.latest))??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://pub.dev/api/packages/${encodeURIComponent(t)}`,o=await fetch(s,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let i=await o.json();if(!i.versions)return {latest:null,stableVersions:[],latestStableOverall:null};let a=[];for(let u of i.versions){if(!u.version||/[+-](?:alpha|beta|rc|pre|dev)/i.test(u.version))continue;let p=we.valid(we.clean(u.version));p&&a.push(p);}let l=[...a].sort(we.rcompare)[0]??null;return {latest:l,stableVersions:a,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}};async function na(t){try{return await km(t)}catch{return {type:"unknown"}}}async function km(t){let e=await xm(t);if(!e)return {type:"unknown"};let n=B.join(e,"HEAD"),r;try{r=(await xe.readFile(n,"utf8")).trim();}catch{return {type:"unknown"}}let s,o;if(r.startsWith("ref: ")){let a=r.slice(5);o=a.startsWith("refs/heads/")?a.slice(11):a,s=await Em(e,a);}else /^[0-9a-f]{40}$/i.test(r)&&(s=r);let i=await jm(e);return {type:"git",sha:s??void 0,shortSha:s?s.slice(0,7):void 0,branch:o??void 0,remoteUrl:i}}async function xm(t){let e=B.resolve(t),n=B.parse(e).root;for(;e!==n;){let r=B.join(e,".git");try{let s=await xe.stat(r);if(s.isDirectory())return r;if(s.isFile()){let o=(await xe.readFile(r,"utf8")).trim();if(o.startsWith("gitdir: "))return B.resolve(e,o.slice(8))}}catch{}e=B.dirname(e);}return null}async function Em(t,e){let n=B.join(t,e);try{let s=(await xe.readFile(n,"utf8")).trim();if(/^[0-9a-f]{40}$/i.test(s))return s}catch{}let r=B.join(t,"packed-refs");try{let s=await xe.readFile(r,"utf8");for(let o of s.split(`
88
- `)){if(o.startsWith("#")||o.startsWith("^"))continue;let i=o.trim().split(" ");if(i.length>=2&&i[1]===e)return i[0]}}catch{}}async function jm(t){let e=await Tm(t);if(e)try{let r=(await xe.readFile(e,"utf8")).match(/\[remote\s+"origin"\]([\s\S]*?)(?=\n\[|$)/);return r?r[1]?.match(/\n\s*url\s*=\s*(.+)\s*/)?.[1]?.trim():void 0}catch{return}}async function Tm(t){let e=B.join(t,"config");try{if((await xe.stat(e)).isFile())return e}catch{}let n=B.join(t,"commondir");try{let r=(await xe.readFile(n,"utf8")).trim();if(!r)return;let s=B.resolve(t,r),o=B.join(s,"config");if((await xe.stat(o)).isFile())return o}catch{return}}function Vy(t){let e=t.trim();if(!e)return null;let n=Ee.valid(e)?`>=${e}`:e;return Ee.validRange(n)?n:null}function Cm(t,e){if(Ee.valid(t)&&Ee.satisfies(t,e))return true;let n=Ee.valid(Ee.coerce(t));return n!=null&&Ee.satisfies(n,e)}function Dy(t,e){let n=[],r=false,s=null;for(let o of t.changes){let i=Cm(o.version,e);i!==r&&n.push({kind:i?"entered":"left",commit:o.commit,version:o.version,previousVersion:s}),r=i,s=o.version;}return n}function Re(t){return t.replace(/[^a-zA-Z0-9_]/g,"_")}function Zt(t){return t.replace(/"/g,'\\"')}function en(t){return t===void 0||Number.isNaN(t)?"scoreUnknown":t>=80?"scoreHigh":t>=50?"scoreModerate":"scoreLow"}function Pn(t){let e=t.drift?.score;return typeof e=="number"?`${t.name} (${e})`:t.name}function gs(){return ["classDef scoreHigh fill:#1e293b,stroke:#10b981,color:#f1f5f9,stroke-width:2px","classDef scoreModerate fill:#1e293b,stroke:#f59e0b,color:#f1f5f9,stroke-width:2px","classDef scoreLow fill:#1e293b,stroke:#ef4444,color:#f1f5f9,stroke-width:2px","classDef scoreUnknown fill:#1e293b,stroke:#64748b,color:#94a3b8,stroke-width:2px"]}function Am(t){let e=["flowchart LR"],n=new Map(t.map(i=>[i.path,i])),r=[],s=new Set;for(let i of t){let a=Re(i.projectId||i.path||i.name);for(let c of i.projectReferences??[]){let l=n.get(c.path);if(!l)continue;let u=Re(l.projectId||l.path||l.name);r.push(`${a} --> ${u}`),s.add(a),s.add(u);}}let o=s.size===0;for(let i of t){let a=Re(i.projectId||i.path||i.name);!o&&!s.has(a)||(e.push(`${a}["${Zt(Pn(i))}"]`),e.push(`class ${a} ${en(i.drift?.score)}`));}return e.push(...r),e.push(...gs()),{mermaid:e.join(`
89
- `)}}function Pm(t,e){let n=["flowchart LR"],r=new Map(e.map(a=>[a.path,a])),s=e.filter(a=>a.projectReferences?.some(c=>c.path===t.path)),o=(t.projectReferences??[]).map(a=>r.get(a.path)).filter(a=>!!a),i=Re(t.projectId||t.path||t.name);n.push(`${i}["${Zt(Pn(t))}"]`),n.push(`class ${i} ${en(t.drift?.score)}`);for(let a of s){let c=Re(a.projectId||a.path||a.name);n.push(`${c}["${Zt(Pn(a))}"]`),n.push(`class ${c} ${en(a.drift?.score)}`),n.push(`${c} --> ${i}`);}for(let a of o){let c=Re(a.projectId||a.path||a.name);n.push(`${c}["${Zt(Pn(a))}"]`),n.push(`class ${c} ${en(a.drift?.score)}`),n.push(`${i} --> ${c}`);}return n.push(...gs()),{mermaid:n.join(`
90
- `)}}function Mm(t,e){let n=["flowchart TB"],r=Re(t.solutionId||t.path||t.name),s=t.drift?.score,o=typeof s=="number"?` (${s})`:" (n/a)";n.push(`${r}["${Zt(`${t.name}${o}`)}"]`),n.push(`class ${r} ${en(s)}`);let i=new Map(e.map(a=>[a.path,a]));for(let a of t.projectPaths){let c=i.get(a);if(!c)continue;let l=Re(c.projectId||c.path||c.name);n.push(`${l}["${Zt(Pn(c))}"]`),n.push(`class ${l} ${en(c.drift?.score)}`),n.push(`${r} --> ${l}`);for(let u of c.projectReferences??[]){let p=i.get(u.path);if(!p)continue;let f=Re(p.projectId||p.path||p.name);n.push(`${l} --> ${f}`);}}return n.push(...gs()),{mermaid:n.join(`
91
- `)}}var Lm=createRequire(import.meta.url),Nm=Lm("../package.json");Nm.version;var Rm="https://registry.npmjs.org/@vibgrate%2fcli/latest",oa=B.join(Mn.homedir(),".vibgrate"),Im=B.join(oa,"update-check.json");async function Hy(){try{let t=new AbortController,e=setTimeout(()=>t.abort(),1e4);e.unref?.();let n;try{n=await fetch(Rm,{headers:{Accept:"application/json"},signal:t.signal});}finally{clearTimeout(e);}if(!n.ok)return null;let s=(await n.json()).version;return !s||!sa.default.valid(s)?null:(await _m({latest:s,checkedAt:Date.now()}),s)}catch{return null}}async function _m(t){try{await xe.mkdir(oa,{recursive:!0}),await xe.writeFile(Im,JSON.stringify(t),"utf-8");}catch{}}var Fm=[{category:"pricing",pattern:/price|pricing|billing|subscri|trial|credit|plan|tier|upgrade|premium|pro|enterprise/i},{category:"auth",pattern:/sign[- ]?in|sign[- ]?up|log[- ]?in|log[- ]?out|auth|sso|oauth|password|register|invite|onboard/i},{category:"dashboard",pattern:/dashboard|overview|home|main|summary|stats/i},{category:"settings",pattern:/setting|config|preference|option|profile|account/i},{category:"users",pattern:/user|member|team|role|permission|access|admin|owner/i},{category:"integrations",pattern:/integrat|connect|webhook|api[- ]?key|sync|import|export/i},{category:"reports",pattern:/report|analy|metric|chart|graph|insight|track/i},{category:"workflows",pattern:/workflow|automat|schedule|trigger|action|job|task|pipeline/i},{category:"projects",pattern:/project|workspace|organization|folder|repo/i},{category:"navigation",pattern:/menu|nav|sidebar|header|footer|breadcrumb/i}];function Om(t,e=3){let n=t.topEvidence,r=n.filter(u=>u.kind==="dependency").map(u=>u.value).slice(0,10),s=Um(n.filter(u=>u.kind==="route").map(u=>u.value)).slice(0,15),o=n.filter(u=>u.kind!=="dependency"&&u.kind!=="route"&&u.kind!=="feature_flag"),i=new Map,a={};for(let u of o){let p=Bm(u.value);i.has(p)||i.set(p,new Set);let f=Vm(u.value);f.length>=3&&i.get(p).add(f);}let c=[];for(let[u,p]of i){let f=Dm([...p]);a[u]=f.length;for(let d of f.slice(0,e))c.push({kind:"text",value:d,category:u});}let l=n.filter(u=>u.kind==="feature_flag");return l.length>0&&(a.feature_flags=l.length,c.push({kind:"feature_flag",value:"feature flags detected",category:"feature_flags"})),{samples:c,categoryCounts:a,originalCount:n.length,dependencies:r,routes:s,detectedFrameworks:t.detectedFrameworks}}function Bm(t){for(let{category:e,pattern:n}of Fm)if(n.test(t))return e;return "general"}function Vm(t){return t.toLowerCase().replace(/[^a-z0-9\s-]/g," ").replace(/\s+/g," ").trim().slice(0,60)}function Dm(t){let e=t.sort((r,s)=>s.length-r.length),n=[];for(let r of e)n.some(o=>{let i=r.slice(0,6);return o.startsWith(i)||o.includes(r)||r.includes(o)})||n.push(r);return n}function Um(t){let e=new Set,n=[];for(let r of t){let s=r.replace(/:[a-z_]+/gi,":param").replace(/\[\[*\.*\.*[a-z_]+\]*\]/gi,":param").replace(/\/+$/,"").toLowerCase();e.has(s)||(e.add(s),n.push(r));}return n}var qm=promisify(ia.gzip),ge=50;function xn(t){let e=t.match(/^(.+?)\s*\(/);return e?e[1].trim():t.trim()}function Hm(t){return {databaseTechnologies:t.databaseTechnologies.slice(0,10),connectionStrings:[],connectionPoolSettings:t.connectionPoolSettings.slice(0,ge),replicationSettings:t.replicationSettings.slice(0,20),readReplicaSettings:t.readReplicaSettings.slice(0,20),failoverSettings:t.failoverSettings.slice(0,20),collationAndEncoding:t.collationAndEncoding.slice(0,20),queryTimeoutDefaults:t.queryTimeoutDefaults.slice(0,20),manualIndexes:t.manualIndexes.map(xn).slice(0,ge),tables:t.tables.map(xn).slice(0,ge),views:t.views.map(xn).slice(0,ge),storedProcedures:t.storedProcedures.map(xn).slice(0,ge),triggers:t.triggers.map(xn).slice(0,ge),rowLevelSecurityPolicies:t.rowLevelSecurityPolicies.slice(0,20),otherServices:t.otherServices.slice(0,20)}}function zm(t){let e=new Set;return {integrations:t.integrations.filter(r=>{let s=r.provider.split(":")[0];return e.has(s)?false:(e.add(s),true)}).slice(0,ge).map(r=>({provider:r.provider,endpoint:"",version:r.version,parameters:[],configOptions:[],authHints:[],files:[]})),openApiSpecifications:t.openApiSpecifications.slice(0,10),webhookUrls:t.webhookUrls.slice(0,20),callbackEndpoints:t.callbackEndpoints.slice(0,20),apiVersionPins:t.apiVersionPins.slice(0,20),tokenExpirationPolicies:t.tokenExpirationPolicies.slice(0,20),rateLimitOverrides:t.rateLimitOverrides.slice(0,20),customHeaders:t.customHeaders.slice(0,20),corsPolicies:t.corsPolicies.slice(0,20),oauthScopes:t.oauthScopes.slice(0,20),apiTokens:[]}}function Wm(t){return {faviconFiles:t.faviconFiles.slice(0,1),productLogos:[]}}function Jm(t){let e={...t};if(e.extended){let n={...e.extended};if(n.dataStores&&(n.dataStores=Hm(n.dataStores)),n.apiSurface&&(n.apiSurface=zm(n.apiSurface)),n.assetBranding&&(n.assetBranding=Wm(n.assetBranding)),n.uiPurpose){let r=Om(n.uiPurpose);n.uiPurpose={enabled:n.uiPurpose.enabled,detectedFrameworks:r.detectedFrameworks,evidenceCount:r.originalCount,capped:n.uiPurpose.capped,topEvidence:[],unknownSignals:[],compacted:r};}if(n.runtimeConfiguration&&(n.runtimeConfiguration={...n.runtimeConfiguration,environmentVariables:n.runtimeConfiguration.environmentVariables.slice(0,100),hiddenConfigFiles:n.runtimeConfiguration.hiddenConfigFiles.slice(0,ge),startupArguments:n.runtimeConfiguration.startupArguments.slice(0,100)}),n.operationalResilience){let r=n.operationalResilience;n.operationalResilience={implicitTimeouts:r.implicitTimeouts.slice(0,30),defaultPaginationSize:r.defaultPaginationSize.slice(0,30),implicitRetryLogic:r.implicitRetryLogic.slice(0,30),defaultLocale:r.defaultLocale.slice(0,20),defaultCurrency:r.defaultCurrency.slice(0,20),implicitTimezone:r.implicitTimezone.slice(0,20),defaultCharacterEncoding:r.defaultCharacterEncoding.slice(0,20),sessionStores:r.sessionStores.slice(0,20),distributedLocks:r.distributedLocks.slice(0,20),jobSchedulers:r.jobSchedulers.slice(0,30),idempotencyKeys:r.idempotencyKeys.slice(0,20),rateLimitingCounters:r.rateLimitingCounters.slice(0,20),circuitBreakerState:r.circuitBreakerState.slice(0,20),abTestToggles:r.abTestToggles.slice(0,20),regionalEnablementRules:r.regionalEnablementRules.slice(0,20),betaAccessGroups:r.betaAccessGroups.slice(0,20),licensingEnforcementLogic:r.licensingEnforcementLogic.slice(0,20),killSwitches:r.killSwitches.slice(0,20),connectorRetryLogic:r.connectorRetryLogic.slice(0,20),apiPollingIntervals:r.apiPollingIntervals.slice(0,20),fieldMappings:r.fieldMappings.slice(0,20),schemaRegistryRules:r.schemaRegistryRules.slice(0,20),deadLetterQueueBehavior:r.deadLetterQueueBehavior.slice(0,20),dataMaskingRules:r.dataMaskingRules.slice(0,20),transformationLogic:r.transformationLogic.slice(0,20),timezoneHandling:r.timezoneHandling.slice(0,20),encryptionSettings:r.encryptionSettings.slice(0,30),hardcodedSecretSignals:r.hardcodedSecretSignals.slice(0,20)};}n.dependencyGraph&&(n.dependencyGraph={...n.dependencyGraph,phantomDependencies:n.dependencyGraph.phantomDependencies.slice(0,ge),phantomDependencyDetails:n.dependencyGraph.phantomDependencyDetails?.slice(0,ge),duplicatedPackages:n.dependencyGraph.duplicatedPackages.slice(0,ge)}),e.extended=n;}return e}async function Km(t){let e=JSON.stringify(t);return qm(e,{level:9})}async function Wy(t){let e=Jm(t);return {body:await Km(e),contentEncoding:"gzip"}}function Ym(t){let n=t.replace(/[\x00-\x1F\x7F\uFEFF\u200B-\u200D\u2060]/g,"").trim().match(/^vibgrate\+(https?):?\/\/([^:]+):([^@]+)@([^/]+)\/(.+)$/);return n?{scheme:n[1],keyId:n[2],secret:n[3],host:n[4],workspaceId:n[5]}:null}async function Jy(t,e,n){let r=e,s=new URL(`${t.scheme}://${r}/v1/ingest/scan/preflight`);n?.repositoryName&&s.searchParams.set("repository",n.repositoryName),n?.vcsSha&&s.searchParams.set("vcsSha",n.vcsSha);let o=String(Date.now()),i=await fetch(s.toString(),{method:"GET",headers:{"X-Vibgrate-Timestamp":o,Authorization:`VibgrateDSN ${t.keyId}:${t.secret}`}}),a=await i.json();if(!i.ok&&a.status!=="error")throw new Error(`HTTP ${i.status}: ${JSON.stringify(a)}`);return a}async function Xm(t){let e=B.join(t,"package.json"),n$1=B.basename(t);if(await p(e))try{let r=await n(e);typeof r.name=="string"&&r.name.trim()&&(n$1=r.name.trim());}catch{}return n$1}var Qm=new Set(["node_modules",".git",".vibgrate",".wrangler",".next","dist","build","out",".turbo",".cache","coverage","bin","obj",".vs","TestResults",".nuxt",".output",".svelte-kit"]);async function Ky(t,e){let n=e??await na(t);if(n.type==="git"&&n.sha)return {vcsSha:n.sha,method:"git_sha"};let r=await Zm(t);return r?{treeHash:r,method:"tree_metadata"}:{method:"unknown"}}async function Zm(t,e){let n=e?.maxFilesPerDirectory??500,r=[];async function s(i,a){let c;try{c=await xe.readdir(i,{withFileTypes:!0});}catch{return}let l=c.filter(u=>u.isFile());if(l.length>n){r.push(`${a||"."}|dir_overflow|${l.length}`);return}for(let u of c){if(u.isDirectory()){if(Qm.has(u.name))continue;let d=a?`${a}/${u.name}`:u.name;await s(B.join(i,u.name),d);continue}if(!u.isFile())continue;let p=a?`${a}/${u.name}`:u.name,f=B.join(i,u.name);try{let d=await xe.stat(f);r.push(`${p}|${d.size}|${d.mtimeMs}`);}catch{}}}if(await s(B.resolve(t),""),r.length===0)return;r.sort();let o=fs.createHash("sha256");for(let i of r)o.update(i),o.update(`
92
- `);return o.digest("hex")}var rh="https://api.vibgrate.com",sh=1e3*60*60*24,oh=5e3;function Zr(t){return !!t&&typeof t=="object"&&typeof t.generatedAt=="string"&&typeof t.products=="object"&&t.products!==null}var ih=class{apiBase;offline;manifest;cacheDir;fetchImpl;resolution=null;constructor(t={}){this.apiBase=(t.apiBase??process.env.VIBGRATE_API_BASE??rh).replace(/\/+$/,""),this.offline=t.offline??false,this.manifest=t.manifest,this.cacheDir=t.cacheDir??B.join(Mn.homedir(),".vibgrate","cache"),this.fetchImpl=t.fetchImpl??globalThis.fetch;}resolve(){return this.resolution||(this.resolution=this.doResolve()),this.resolution}get cacheFile(){return B.join(this.cacheDir,"runtimes.json")}async doResolve(){let t;if(!this.offline){let n=await this.readCache();if(n){if(Date.now()-Date.parse(n.fetchedAt)<sh)return {catalog:n.catalog,source:"cache"};t=n.catalog;}let r=await this.fetchFromApi();if(r)return await this.writeCache(r),{catalog:r,source:"api"}}let e=this.manifest?.runtimes;return Zr(e)?{catalog:e,source:"manifest"}:t&&Date.parse(t.generatedAt)>Date.parse(Ne.generatedAt)?{catalog:t,source:"cache"}:{catalog:Ne,source:"bundled"}}async fetchFromApi(){if(!this.fetchImpl)return null;let t=new AbortController,e=setTimeout(()=>t.abort(),oh);try{let n=await this.fetchImpl(`${this.apiBase}/v1/reference/runtimes`,{signal:t.signal,headers:{Accept:"application/json"}});if(!n.ok)return null;let r=await n.json();return Zr(r)?r:null}catch{return null}finally{clearTimeout(e);}}async readCache(){try{let t=await readFile(this.cacheFile,"utf8"),e=JSON.parse(t);if(e&&typeof e.fetchedAt=="string"&&Zr(e.catalog))return e}catch{}return null}async writeCache(t){try{await mkdir(this.cacheDir,{recursive:!0});let e={fetchedAt:new Date().toISOString(),catalog:t};await writeFile(this.cacheFile,JSON.stringify(e),"utf8");}catch{}}},ph=class la{constructor(e){this.outPath=e;}events=[];start=Date.now();lastThrottled=new Map;flushed=false;static fromEnv(){let e=process.env.VIBGRATE_TRACE_EVENTS;return e?new la(e):null}record(e,n={}){this.flushed||this.events.push({t:Date.now()-this.start,op:e,...n});}recordThrottled(e,n,r={},s=120){if(this.flushed)return;let o=Date.now(),i=this.lastThrottled.get(e)??0;o-i<s||(this.lastThrottled.set(e,o),this.record(n,r));}flush(e){if(this.flushed)return;this.flushed=true;let n={traceVersion:1,cliVersion:e.cliVersion,workspace:basename(e.rootDir)||e.rootDir,recordedAt:new Date().toISOString(),durationMs:Date.now()-this.start,events:this.events};try{mkdirSync(dirname(this.outPath),{recursive:!0}),writeFileSync(this.outPath,JSON.stringify(n));}catch{}}},pr=[E.cyan(" \u256D\u2500\u2500\u2500\u256E")+E.greenBright("\u279C"),E.cyan(" \u256D\u2524")+E.greenBright("\u25C9 \u25C9")+E.cyan("\u251C\u256E"),E.cyan(" \u2570\u2524")+E.dim("\u2500\u2500\u2500")+E.cyan("\u251C\u256F"),E.cyan(" \u2570\u2500\u2500\u2500\u256F")];function si(t){return [E.bold.white(" V I B G R A T E"),E.dim(" Drift Intelligence Engine")+E.dim(` v${t}`)]}var oi=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],fh=class{steps=[];stats={projects:0,dependencies:0,frameworks:0,findings:{warnings:0,errors:0,notes:0}};spinnerFrame=0;timer=null;lastRowCount=0;startTime=Date.now();isTTY;useLiveUpdates;rootDir="";lastFrame="";cursorHidden=false;estimatedTotalMs=null;stepEstimates=new Map;stepStartTimes=new Map;stepTimings=[];lastLoggedStates=new Map;version;trace;constructor(t,e="unknown"){if(this.version=e,this.trace=ph.fromEnv(),this.isTTY=process.stderr.isTTY??false,this.useLiveUpdates=this.isTTY&&process.env.VIBGRATE_PROGRESS_MODE!=="plain",this.rootDir=t,this.isTTY){let n=()=>{this.cursorHidden&&(process.stderr.write("\x1B[?25h"),this.cursorHidden=false);};process.on("exit",n),process.on("SIGINT",()=>{n(),process.exit(130);}),process.on("SIGTERM",()=>{n(),process.exit(143);});}}setEstimatedTotal(t){this.estimatedTotalMs=t,this.trace?.record("setEstimatedTotal",{estimatedMs:t});}setStepEstimates(t){this.stepEstimates=t;}getStepTimings(){return [...this.stepTimings]}setSteps(t){if(this.steps=t.map(e=>({...e,status:"pending",weight:e.weight??1})),this.trace?.record("setSteps",{steps:t.map(e=>({id:e.id,label:e.label,weight:e.weight??1}))}),this.isTTY){let e=["",` ${pr[0]} ${si(this.version)[0]}`,` ${pr[1]} ${si(this.version)[1]}`,` ${pr[2]}`,` ${pr[3]} ${E.dim(this.rootDir)}`,""].join(`
76
+ `);for(let o of s){let i=o.match(/^\s*([A-Za-z0-9][-A-Za-z0-9_.]*)\s*=\s*(?:"([^"]+)"|{.*?version\s*=\s*"([^"]+)".*?}|\*|"[*]")/);if(i){let a=i[1],c=i[2]??i[3]??"",l=a.toLowerCase().replace(/[_.]+/g,"-");e.push({name:a,spec:c||"*",normalisedName:l});}}}return e}function Du(t){let e={deps:[]},n=t.match(/\[metadata\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(n){let s=n[1].match(/^\s*name\s*=\s*(.+)$/m);s&&(e.name=s[1].trim());}let r=t.match(/\[options\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(r){let s=r[1].match(/^\s*python_requires\s*=\s*(.+)$/m);s&&(e.pythonVersion=s[1].trim());let o=r[1].match(/install_requires\s*=\s*\n((?:\s+.*\n?)*)/);if(o){let i=o[1];for(let a of i.split(`
77
+ `)){let c=ms(a);c&&e.deps.push(c);}}}return e}var Pi=new Set(["requirements.txt","requirements-dev.txt","requirements_dev.txt","requirements-test.txt","dev-requirements.txt","pyproject.toml","setup.py","setup.cfg","Pipfile"]);async function Uu(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,l=>Pi.has(l)||/^requirements.*\.txt$/.test(l)):await Gu(t),i=new Map;for(let l of o){let u=B.dirname(l);i.has(u)||i.set(u,[]),i.get(u).push(l);}let a=[],c=r??n?.projectScanTimeout??18e4;for(let[l,u]of i)try{let p=qu(l,u,t,e,n,s),f=await $e(p,c);if(f.ok)a.push(f.value);else {let d=B.relative(t,l);n&&n.addStuckPath(d||"."),console.error(`Timeout scanning Python project ${l} (>${c/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(p){let f=p instanceof Error?p.message:String(p);console.error(`Error scanning Python project ${l}: ${f}`);}return a}async function Gu(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Pi.has(n)||/^requirements.*\.txt$/.test(n))}async function qu(t,e,n$1,r,s,o$1){let i=B.relative(n$1,t)||".",a=B.basename(t===n$1?n$1:t),c,l=new Map;for(let b of e){let x=B.basename(b),T=s?await s.readTextFile(b):await o(b);if(x==="pyproject.toml"){let m=Bu(T);m.projectName&&(a=m.projectName),m.pythonVersion&&(c=m.pythonVersion);for(let A of m.dependencies)l.has(A.normalisedName)||l.set(A.normalisedName,A);}else if(x==="setup.cfg"){let m=Du(T);m.name&&(a=m.name),m.pythonVersion&&!c&&(c=m.pythonVersion);for(let A of m.deps)l.has(A.normalisedName)||l.set(A.normalisedName,A);}else if(x==="Pipfile")for(let m of Vu(T))l.has(m.normalisedName)||l.set(m.normalisedName,m);else if(x.startsWith("requirements")&&x.endsWith(".txt"))for(let m of Ou(T))l.has(m.normalisedName)||l.set(m.normalisedName,m);}let u,p$1,f,d;if(c){let b=c.match(/(\d+)\.(\d+)/);if(b){let T=parseInt(b[1],10),m=parseInt(b[2],10),A=dn(o$1,"python");A&&(T===A.major?u=Math.max(0,A.minor-m):T<A.major&&(u=A.minor+(A.major-T)*10),p$1=`${A.major}.${A.minor}`);}f=yt(o$1,"python",c);let x=it("python",c);x&&(d=gt(o$1,"python",x));}let g=await Iu(t,{exists:b=>s?s.pathExists(b):p(b),readText:b=>s?s.readTextFile(b):o(b),readJson:b=>s?s.readJsonFile(b):n(b)}).catch(()=>null),v=[],S=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},C=[...l.values()].map(async b=>{let x=await r.get(b.normalisedName);return {dep:b,meta:x}}),E=await Promise.all(C);for(let{dep:b,meta:x}of E){let m=g?.resolve(b.normalisedName)??null??_u(b.spec),A=m?Fu(m):null,$=x.latestStableOverall,L=null,I="unknown";if(A&&$){let D=At.major(A);L=At.major($)-D,L===0?I=At.eq(A,$)?"current":"minor-behind":L>0?I="major-behind":I="current",L<=0?j.current++:L===1?j.oneBehind++:j.twoPlusBehind++;}else j.unknown++;v.push({package:b.name,section:"dependencies",currentSpec:b.spec||"*",resolvedVersion:A,latestStable:$,majorsBehind:L,drift:I}),b.normalisedName in Wo&&S.push({name:Wo[b.normalisedName],currentVersion:A,latestVersion:$,majorsBehind:L});}v.sort((b,x)=>{let T={"major-behind":0,"minor-behind":1,current:2,unknown:3},m=(T[b.drift]??9)-(T[x.drift]??9);return m!==0?m:b.package.localeCompare(x.package)});let y;try{y=s?await s.countFilesUnder(n$1,t):void 0;}catch{}return {type:"python",path:i,name:a,runtime:c,runtimeLatest:p$1,runtimeMajorsBehind:u,runtimeEol:f,runtimeEolDate:d,frameworks:S,dependencies:v,dependencyAgeBuckets:j,fileCount:y}}var Hu=/^([^:=\s]+):([^:=\s]+):([^=\s]+)=/;function $i(t){let e=new Map;if(!t)return e;for(let n of t.split(`
78
+ `)){let r=n.trim();if(!r||r.startsWith("#")||r.startsWith("empty="))continue;let s=Hu.exec(r);if(!s)continue;let o=`${s[1]}:${s[2]}`;e.has(o)||e.set(o,s[3]);}return e}async function zu(t,e){let n=B.join(t,"gradle.lockfile");if(!await e.exists(n).catch(()=>false))return null;try{let r=$i(await e.readText(n));return r.size?{size:r.size,resolve:s=>r.get(s)??null}:null}catch{return null}}var Wu=new Te({ignoreAttributes:false,attributeNamePrefix:"@_"}),Jo={"org.springframework.boot:spring-boot-starter-web":"Spring Boot Web","org.springframework.boot:spring-boot-starter":"Spring Boot","org.springframework.boot:spring-boot-starter-data-jpa":"Spring Data JPA","org.springframework.boot:spring-boot-starter-security":"Spring Security","org.springframework.boot:spring-boot-starter-webflux":"Spring WebFlux","org.springframework.boot:spring-boot-starter-actuator":"Spring Actuator","org.springframework.boot:spring-boot-starter-test":"Spring Boot Test","org.springframework:spring-core":"Spring Framework","org.springframework:spring-web":"Spring Web","org.springframework:spring-webmvc":"Spring MVC","org.springframework.cloud:spring-cloud-starter-netflix-eureka-client":"Spring Cloud Eureka","org.springframework.cloud:spring-cloud-starter-gateway":"Spring Cloud Gateway","org.springframework.kafka:spring-kafka":"Spring Kafka","jakarta.platform:jakarta.jakartaee-api":"Jakarta EE","jakarta.servlet:jakarta.servlet-api":"Jakarta Servlet","javax.servlet:javax.servlet-api":"Java Servlet (Legacy)","io.micronaut:micronaut-core":"Micronaut","io.micronaut:micronaut-http-server-netty":"Micronaut HTTP","io.quarkus:quarkus-core":"Quarkus","io.quarkus:quarkus-resteasy":"Quarkus RESTEasy","io.quarkus:quarkus-resteasy-reactive":"Quarkus RESTEasy Reactive","io.vertx:vertx-core":"Vert.x","io.vertx:vertx-web":"Vert.x Web","org.hibernate.orm:hibernate-core":"Hibernate","org.hibernate:hibernate-core":"Hibernate","org.mybatis:mybatis":"MyBatis","org.mybatis.spring.boot:mybatis-spring-boot-starter":"MyBatis Spring Boot","org.jooq:jooq":"jOOQ","org.flywaydb:flyway-core":"Flyway","org.liquibase:liquibase-core":"Liquibase","com.zaxxer:HikariCP":"HikariCP","org.postgresql:postgresql":"PostgreSQL JDBC","com.mysql:mysql-connector-j":"MySQL Connector","mysql:mysql-connector-java":"MySQL Connector (Legacy)","com.oracle.database.jdbc:ojdbc11":"Oracle JDBC","org.mongodb:mongodb-driver-sync":"MongoDB Driver","io.lettuce:lettuce-core":"Lettuce (Redis)","redis.clients:jedis":"Jedis (Redis)","org.apache.kafka:kafka-clients":"Apache Kafka","com.rabbitmq:amqp-client":"RabbitMQ Client","software.amazon.awssdk:sqs":"AWS SQS","software.amazon.awssdk:sns":"AWS SNS","com.squareup.okhttp3:okhttp":"OkHttp","com.squareup.retrofit2:retrofit":"Retrofit","org.apache.httpcomponents.client5:httpclient5":"Apache HttpClient 5","io.grpc:grpc-netty":"gRPC","com.graphql-java:graphql-java":"GraphQL Java","com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter":"Netflix DGS","com.fasterxml.jackson.core:jackson-databind":"Jackson","com.google.code.gson:gson":"Gson","junit:junit":"JUnit 4","org.junit.jupiter:junit-jupiter":"JUnit 5","org.junit.jupiter:junit-jupiter-api":"JUnit 5","org.mockito:mockito-core":"Mockito","org.assertj:assertj-core":"AssertJ","org.testcontainers:testcontainers":"Testcontainers","io.rest-assured:rest-assured":"REST Assured","org.awaitility:awaitility":"Awaitility","com.tngtech.archunit:archunit-junit5":"ArchUnit","org.hamcrest:hamcrest":"Hamcrest","org.slf4j:slf4j-api":"SLF4J","ch.qos.logback:logback-classic":"Logback","org.apache.logging.log4j:log4j-core":"Log4j2","org.projectlombok:lombok":"Lombok","org.mapstruct:mapstruct":"MapStruct","software.amazon.awssdk:bom":"AWS SDK v2","com.google.cloud:google-cloud-bom":"Google Cloud SDK","com.azure:azure-sdk-bom":"Azure SDK","io.jsonwebtoken:jjwt-api":"JJWT","com.nimbusds:nimbus-jose-jwt":"Nimbus JOSE+JWT","io.micrometer:micrometer-core":"Micrometer","io.opentelemetry:opentelemetry-api":"OpenTelemetry","io.prometheus:simpleclient":"Prometheus Client","io.projectreactor:reactor-core":"Project Reactor","io.reactivex.rxjava3:rxjava":"RxJava 3"};function Ju(t,e){let r=Wu.parse(t)?.project;if(!r)return {artifactId:B.basename(B.dirname(e)),dependencies:[],modules:[],properties:{}};let s={};if(r.properties&&typeof r.properties=="object")for(let[g,v]of Object.entries(r.properties))(typeof v=="string"||typeof v=="number")&&(s[g]=String(v));let o,i=["java.version","maven.compiler.source","maven.compiler.target","maven.compiler.release","java.source.version"];for(let g of i)if(s[g]){o=String(s[g]);break}let a=r.dependencies,l=(a?.dependency?Array.isArray(a.dependency)?a.dependency:[a.dependency]:[]).filter(g=>g.groupId&&g.artifactId).map(g=>({groupId:Xt(String(g.groupId??""),s),artifactId:Xt(String(g.artifactId??""),s),version:Xt(String(g.version??""),s),scope:g.scope?String(g.scope):void 0})),u=r.dependencyManagement?.dependencies,p=u?.dependency?Array.isArray(u.dependency)?u.dependency:[u.dependency]:[];for(let g of p)g.groupId&&g.artifactId&&g.version&&l.push({groupId:Xt(String(g.groupId),s),artifactId:Xt(String(g.artifactId),s),version:Xt(String(g.version),s),scope:g.scope?String(g.scope):void 0});let d=(r.modules?.module?Array.isArray(r.modules.module)?r.modules.module:[r.modules.module]:[]).map(String),h;return r.parent?.groupId&&r.parent?.artifactId&&(h={groupId:String(r.parent.groupId),artifactId:String(r.parent.artifactId),version:String(r.parent.version??"")}),{groupId:r.groupId?String(r.groupId):h?.groupId,artifactId:String(r.artifactId??B.basename(B.dirname(e))),version:r.version?String(r.version):h?.version,packaging:r.packaging?String(r.packaging):void 0,javaVersion:o,dependencies:l,modules:d,parent:h,properties:s}}function Xt(t,e){return t.replace(/\$\{([^}]+)\}/g,(n,r)=>e[r]??`\${${r}}`)}function Ku(t,e){let n=[],r=B.basename(B.dirname(e)),s,o=t.match(/(?:sourceCompatibility|targetCompatibility|javaVersion)\s*[=:]\s*['"]?(?:JavaVersion\.VERSION_)?(\d+)['"]?/);o&&(s=o[1]);let i=t.match(/JavaLanguageVersion\.of\((\d+)\)/);i&&(s=i[1]);let a=/(?:implementation|api|compileOnly|runtimeOnly|testImplementation|testRuntimeOnly|annotationProcessor|kapt)\s*(?:\(?\s*)?['"]([^'"]+)['"]/g,c;for(;(c=a.exec(t))!==null;){let p=c[1].split(":");p.length>=2&&n.push({groupId:p[0],artifactId:p[1],version:p[2]??"",configuration:c[0].split(/\s/)[0]});}let l=/(?:implementation|api|compileOnly|runtimeOnly|testImplementation|testRuntimeOnly|annotationProcessor|kapt)\s*\(\s*"([^"]+)"\s*\)/g;for(;(c=l.exec(t))!==null;){let p=c[1].split(":");if(p.length>=2){let f=`${p[0]}:${p[1]}`;n.some(d=>`${d.groupId}:${d.artifactId}`===f)||n.push({groupId:p[0],artifactId:p[1],version:p[2]??"",configuration:c[0].split(/\s/)[0]});}}let u=/(?:implementation|api)\s*(?:\(?\s*)?platform\s*\(\s*['"]([^'"]+)['"]\s*\)/g;for(;(c=u.exec(t))!==null;){let p=c[1].split(":");p.length>=2&&n.push({groupId:p[0],artifactId:p[1],version:p[2]??"",configuration:"platform"});}return {javaVersion:s,dependencies:n,projectName:r}}function Yu(t){let e=t.trim();if(!e||e.includes("$")||/(?:[-.](?:SNAPSHOT|alpha|beta|rc|M\d+|CR\d+))/i.test(e))return null;e=e.replace(/\.(?:RELEASE|Final|GA)$/i,"");let n=e.split(".");for(;n.length<3;)n.push("0");return e=n.slice(0,3).join("."),Pt.valid(e)}var Li=new Set(["pom.xml","build.gradle","build.gradle.kts"]);async function Xu(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,u=>Li.has(u)):await Qu(t),i=new Map;for(let u of o){let p=B.dirname(u);i.has(p)||i.set(p,[]),i.get(p).push(u);}let a=[],c=r??n?.projectScanTimeout??18e4;for(let[u,p]of i)try{let f=Zu(u,p,t,e,n,s),d=await $e(f,c);if(d.ok)a.push(d.value);else {let h=B.relative(t,u);n&&n.addStuckPath(h||"."),console.error(`Timeout scanning Java project ${u} (>${c/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(f){let d=f instanceof Error?f.message:String(f);console.error(`Error scanning Java project ${u}: ${d}`);}let l=new Map;for(let u of a)l.set(u.name,u.path);return a}async function Qu(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Li.has(n))}async function Zu(t,e,n$1,r,s,o$1){let i=B.relative(n$1,t)||".",a=B.basename(t===n$1?n$1:t),c,l=new Map,u=[];for(let T of e){let m=B.basename(T),A=s?await s.readTextFile(T):await o(T);if(m==="pom.xml"){let $=Ju(A,T);$.artifactId&&(a=$.artifactId),$.javaVersion&&(c=$.javaVersion);for(let L of $.dependencies){let I=`${L.groupId}:${L.artifactId}`;!l.has(I)&&L.version&&!L.version.includes("${")&&l.set(I,L);}for(let L of $.modules)u.push({path:B.join(i,L),name:L,refType:"project"});}else if(m==="build.gradle"||m==="build.gradle.kts"){let $=Ku(A,T);$.projectName&&(a=$.projectName),$.javaVersion&&(c=$.javaVersion);for(let L of $.dependencies){let I=`${L.groupId}:${L.artifactId}`;!l.has(I)&&L.version&&l.set(I,L);}}}let p$1,f,d,h=$r(o$1,"java")?.major,g=h!==void 0?String(h):void 0;if(c){let T=c.match(/^(1\.)?(\d+)/);if(T){let A=(T[1],parseInt(T[2],10));h!==void 0&&(p$1=Math.max(0,h-A));}f=yt(o$1,"java",c);let m=it("java",c);m&&(d=gt(o$1,"java",m));}let S=await zu(t,{exists:T=>s?s.pathExists(T):p(T),readText:T=>s?s.readTextFile(T):o(T),readJson:T=>s?s.readJsonFile(T):n(T)}).catch(()=>null),j=[],P=[],C={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},y=[...l.entries()].map(async([T,m])=>{let A=await r.get(m.groupId,m.artifactId);return {key:T,dep:m,meta:A}}),b=await Promise.all(y);for(let{key:T,dep:m,meta:A}of b){let $=S?.resolve(T)??null,L=Yu($??m.version),I=A.latestStableOverall,D=null,fe="unknown";if(L&&I){let H=Pt.major(L);D=Pt.major(I)-H,D===0?fe=Pt.eq(L,I)?"current":"minor-behind":D>0?fe="major-behind":fe="current",D<=0?C.current++:D===1?C.oneBehind++:C.twoPlusBehind++;}else C.unknown++;j.push({package:T,section:"dependencies",currentSpec:m.version,resolvedVersion:L,latestStable:I,majorsBehind:D,drift:fe}),T in Jo&&P.push({name:Jo[T],currentVersion:L,latestVersion:I,majorsBehind:D});}j.sort((T,m)=>{let A={"major-behind":0,"minor-behind":1,current:2,unknown:3},$=(A[T.drift]??9)-(A[m.drift]??9);return $!==0?$:T.package.localeCompare(m.package)});let x;try{x=s?await s.countFilesUnder(n$1,t):void 0;}catch{}return {type:"java",path:i,name:a,runtime:c?`Java ${c}`:void 0,runtimeLatest:g,runtimeMajorsBehind:p$1,runtimeEol:f,runtimeEolDate:d,targetFramework:c?`Java ${c}`:void 0,frameworks:P,dependencies:j,dependencyAgeBuckets:C,projectReferences:u.length>0?u:void 0,fileCount:x}}var ep=/^ {4}([A-Za-z0-9._-]+) \(([^()]+)\)\s*$/;function tp(t){let e=new Map;if(!t)return e;for(let n of t.split(`
79
+ `)){let r=ep.exec(n);if(!r)continue;let s=r[1],o=r[2].split("-")[0].trim();/^\d/.test(o)&&(e.has(s)||e.set(s,o));}return e}async function np(t,e){let n=B.join(t,"Gemfile.lock");if(!await e.exists(n).catch(()=>false))return null;try{let r=tp(await e.readText(n));return r.size?{size:r.size,resolve:s=>r.get(s)??null}:null}catch{return null}}var Ko={rails:"Ruby on Rails",sinatra:"Sinatra",hanami:"Hanami",padrino:"Padrino",roda:"Roda",grape:"Grape",cuba:"Cuba",camping:"Camping",ramaze:"Ramaze","jsonapi-resources":"JSONAPI::Resources",active_model_serializers:"AMS",blueprinter:"Blueprinter",alba:"Alba","grape-entity":"Grape Entity",jbuilder:"Jbuilder",graphql:"GraphQL Ruby",activerecord:"ActiveRecord",sequel:"Sequel","rom-rb":"ROM",mongoid:"Mongoid",redis:"redis-rb",pg:"pg (PostgreSQL)",mysql2:"mysql2",sqlite3:"sqlite3",sidekiq:"Sidekiq",resque:"Resque",delayed_job:"Delayed Job",good_job:"GoodJob",solid_queue:"Solid Queue",que:"Que",rspec:"RSpec","rspec-rails":"RSpec Rails",minitest:"Minitest",capybara:"Capybara",factory_bot:"FactoryBot",factory_bot_rails:"FactoryBot Rails",faker:"Faker","shoulda-matchers":"Shoulda Matchers",vcr:"VCR",webmock:"WebMock",simplecov:"SimpleCov",cucumber:"Cucumber",devise:"Devise",omniauth:"OmniAuth",pundit:"Pundit",cancancan:"CanCanCan",rodauth:"Rodauth",jwt:"JWT",doorkeeper:"Doorkeeper","turbo-rails":"Turbo","stimulus-rails":"Stimulus","importmap-rails":"Importmap Rails",sprockets:"Sprockets",webpacker:"Webpacker","cssbundling-rails":"CSS Bundling","jsbundling-rails":"JS Bundling","tailwindcss-rails":"Tailwind CSS Rails",propshaft:"Propshaft",faraday:"Faraday",httparty:"HTTParty","rest-client":"REST Client",typhoeus:"Typhoeus",httpx:"HTTPX",puma:"Puma",unicorn:"Unicorn",thin:"Thin",passenger:"Passenger",falcon:"Falcon",capistrano:"Capistrano",kamal:"Kamal",mina:"Mina","sentry-ruby":"Sentry","sentry-rails":"Sentry Rails",newrelic_rpm:"New Relic",datadog:"Datadog",lograge:"Lograge",rubocop:"RuboCop","rubocop-rails":"RuboCop Rails","rubocop-rspec":"RuboCop RSpec","rubocop-performance":"RuboCop Performance",brakeman:"Brakeman","bundler-audit":"Bundler Audit",standard:"Standard",kaminari:"Kaminari",pagy:"Pagy",ransack:"Ransack",searchkick:"Searchkick","elasticsearch-rails":"Elasticsearch Rails",carrierwave:"CarrierWave",shrine:"Shrine",active_storage:"Active Storage",activeadmin:"ActiveAdmin",administrate:"Administrate",avo:"Avo",aasm:"AASM",statesman:"Statesman",dotenv:"dotenv",figaro:"Figaro"};function rp(t){let e=t.trim();if(!e||e.startsWith("#"))return null;let n=e.match(/^\s*gem\s+['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"])?/);if(!n)return null;let r=n[1],s=n[2]??"*";return {name:r,spec:s}}function sp(t){if(t==="*")return null;let e=t.match(/(?:~>|>=|>|=|<=|<)?\s*(\d+(?:\.\d+)*)/);return e?e[1]:null}function op(t){let e=t.trim();if(/(?:\.pre|\.rc|\.beta|\.alpha|\.dev)/i.test(e))return null;let n=e.split(".");if(n.length<2)return null;for(;n.length<3;)n.push("0");let r=n.slice(0,3).join(".");return Mt.valid(r)}function ip(t){let e=[],n="default",r=[];for(let s of t.split(/\r?\n/)){let o=s.trim(),i=o.match(/^\s*group\s+:(\w+)/);if(i){r.push(n);let u=i[1].toLowerCase();u==="development"||u==="dev"?n="development":u==="test"&&(n="test");}if(o==="end"&&r.length>0){n=r.pop();continue}let a=rp(o);if(!a)continue;let c=n,l=o.match(/group:\s*(?::(\w+)|\[([^\]]+)\])/);if(l){let u=(l[1]??l[2]??"").toLowerCase();u.includes("development")||u.includes("dev")?c="development":u.includes("test")&&(c="test");}e.push({name:a.name,spec:a.spec,group:c});}return e}function ap(t){let e=[];for(let n of t.split(/\r?\n/)){let s=n.trim().match(/\.add_(runtime_|development_)?dependency\s+['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"])?/);if(!s)continue;let o=s[1]??"runtime_",i=s[2],a=s[3]??"*";e.push({name:i,spec:a,group:o.startsWith("development")?"development":"default"});}return e}function cp(t){return t.match(/^\s*ruby\s+['"]([^'"]+)['"]/m)?.[1]}var Ri=new Set(["Gemfile"]);function hs(t){return t.endsWith(".gemspec")}async function lp(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,l=>Ri.has(l)||hs(l)):await up(t),i=new Map;for(let l of o){let u=B.dirname(l);i.has(u)||i.set(u,[]),i.get(u).push(l);}let a=[],c=r??n?.projectScanTimeout??18e4;for(let[l,u]of i)try{let p=pp(l,u,t,e,n,s),f=await $e(p,c);if(f.ok)a.push(f.value);else {let d=B.relative(t,l);n&&n.addStuckPath(d||"."),console.error(`Timeout scanning Ruby project ${l} (>${c/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(p){let f=p instanceof Error?p.message:String(p);console.error(`Error scanning Ruby project ${l}: ${f}`);}return a}async function up(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ri.has(n)||hs(n))}async function pp(t,e,n$1,r,s,o$1){let i=B.relative(n$1,t)||".",a=B.basename(t===n$1?n$1:t),c,l=new Map;for(let b of e){let x=B.basename(b),T=s?await s.readTextFile(b):await o(b);if(x==="Gemfile"){let m=cp(T);m&&(c=m);for(let A of ip(T))l.has(A.name)||l.set(A.name,A);}else if(hs(x)){let m=x.replace(/\.gemspec$/,"");m&&(a=m);for(let A of ap(T))l.has(A.name)||l.set(A.name,A);}}let u,p$1,f,d;if(c){let b=c.match(/(\d+)\.(\d+)/);if(b){let T=parseInt(b[1],10),m=parseInt(b[2],10),A=dn(o$1,"ruby");A&&(T===A.major?u=Math.max(0,A.minor-m):T<A.major&&(u=A.minor+(A.major-T)*10),p$1=`${A.major}.${A.minor}`);}f=yt(o$1,"ruby",c);let x=it("ruby",c);x&&(d=gt(o$1,"ruby",x));}let g=await np(t,{exists:b=>s?s.pathExists(b):p(b),readText:b=>s?s.readTextFile(b):o(b),readJson:b=>s?s.readJsonFile(b):n(b)}).catch(()=>null),v=[],S=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},C=[...l.values()].map(async b=>{let x=await r.get(b.name);return {dep:b,meta:x}}),E=await Promise.all(C);for(let{dep:b,meta:x}of E){let m=g?.resolve(b.name)??null??sp(b.spec),A=m?op(m):null,$=x.latestStableOverall,L=null,I="unknown";if(A&&$){let fe=Mt.major(A);L=Mt.major($)-fe,L===0?I=Mt.eq(A,$)?"current":"minor-behind":L>0?I="major-behind":I="current",L<=0?j.current++:L===1?j.oneBehind++:j.twoPlusBehind++;}else j.unknown++;let D=b.group==="development"||b.group==="test"?"devDependencies":"dependencies";v.push({package:b.name,section:D,currentSpec:b.spec,resolvedVersion:A,latestStable:$,majorsBehind:L,drift:I}),b.name in Ko&&S.push({name:Ko[b.name],currentVersion:A,latestVersion:$,majorsBehind:L});}v.sort((b,x)=>{let T={"major-behind":0,"minor-behind":1,current:2,unknown:3},m=(T[b.drift]??9)-(T[x.drift]??9);return m!==0?m:b.package.localeCompare(x.package)});let y;try{y=s?await s.countFilesUnder(n$1,t):void 0;}catch{}return {type:"ruby",path:i,name:a,runtime:c,runtimeLatest:p$1,runtimeMajorsBehind:u,runtimeEol:f,runtimeEolDate:d,frameworks:S,dependencies:v,dependencyAgeBuckets:j,fileCount:y}}var Yo={vapor:"Vapor",hummingbird:"Hummingbird",perfect:"Perfect",kitura:"Kitura",alamofire:"Alamofire",moya:"Moya","apollo-ios":"Apollo iOS",fluent:"Fluent","sqlite.swift":"SQLite.swift","realm-swift":"Realm Swift","grdb.swift":"GRDB.swift",kingfisher:"Kingfisher",snapkit:"SnapKit",sdwebimage:"SDWebImage",rxswift:"RxSwift",combine:"Combine",reactiveswift:"ReactiveSwift",quick:"Quick",nimble:"Nimble",snapshotTesting:"SnapshotTesting",swiftlog:"SwiftLog",cocoalumberjack:"CocoaLumberjack",swinject:"Swinject",needle:"Needle",swiftyjson:"SwiftyJSON",promisekit:"PromiseKit",then:"Then"},St={major:6,minor:0};function fp(t){let e=[],n=/\.package\s*\(\s*url:\s*"([^"]+)"[^)]*?(from|exact|upToNextMajor|revision|branch):\s*"([^"]+)"/g,r;for(;(r=n.exec(t))!==null;){let s=r[1],o=r[2],i=r[3],c=s.match(/\/([^/]+?)(\.git)?$/)?.[1]??s,l="range",u=i;o==="exact"?l="exact":o==="branch"?l="branch":o==="revision"&&(l="revision"),e.push({name:c,url:s,version:u,type:l});}return e}function dp(t){let e=new Map;try{let n=JSON.parse(t);if(!n.pins)return e;for(let r of n.pins)!r.identity||!r.state?.version||e.set(r.identity.toLowerCase(),r.state.version);}catch{}return e}function mp(t){return t.match(/\/\/\s*swift-tools-version:\s*(\d+\.\d+)/i)?.[1]}var Ii=new Set(["Package.swift"]);async function hp(t,e,n,r){let s=n?await n.findFiles(t,a=>Ii.has(a)):await gp(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=yp(c,a,t,e,n),u=await $e(l,i);if(u.ok)o.push(u.value);else {let p=B.relative(t,c);n&&n.addStuckPath(p||"."),console.error(`Timeout scanning Swift project ${c} (>${i/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(l){let u=l instanceof Error?l.message:String(l);console.error(`Error scanning Swift project ${c}: ${u}`);}}return o}async function gp(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ii.has(n))}async function yp(t,e,n,r,s){let o$1=B.relative(n,t)||".",i=B.basename(t===n?n:t),a=s?await s.readTextFile(e):await o(e),c=mp(a),l=fp(a),u=B.join(t,"Package.resolved"),p=new Map;try{let C=s?await s.readTextFile(u):await o(u);p=dp(C);}catch{}let f,d;if(c){let C=c.match(/(\d+)\.(\d+)/);if(C){let E=parseInt(C[1],10),y=parseInt(C[2],10);E===St.major?f=Math.max(0,St.minor-y):E<St.major&&(f=(St.major-E)*10+St.minor),d=`${St.major}.${St.minor}`;}}let h=[],g=[],v={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},S=l.map(async C=>{let E=await r.get(C.url);return {dep:C,meta:E}}),j=await Promise.all(S);for(let{dep:C,meta:E}of j){let y=p.get(C.name.toLowerCase())??(C.type==="exact"?C.version:null),b=y?Ie.valid(Ie.clean(y)):null,x=E.latestStableOverall,T=null,m="unknown";if(b&&x){let $=Ie.major(b);T=Ie.major(x)-$,T===0?m=Ie.eq(b,x)?"current":"minor-behind":T>0?m="major-behind":m="current",T<=0?v.current++:T===1?v.oneBehind++:v.twoPlusBehind++;}else v.unknown++;h.push({package:C.name,section:"dependencies",currentSpec:C.version,resolvedVersion:b,latestStable:x,majorsBehind:T,drift:m});let A=C.name.toLowerCase();A in Yo&&g.push({name:Yo[A],currentVersion:b,latestVersion:x,majorsBehind:T});}h.sort((C,E)=>{let y={"major-behind":0,"minor-behind":1,current:2,unknown:3},b=(y[C.drift]??9)-(y[E.drift]??9);return b!==0?b:C.package.localeCompare(E.package)});let P;try{P=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"swift",path:o$1,name:i,runtime:c,runtimeLatest:d,runtimeMajorsBehind:f,frameworks:g,dependencies:h,dependencyAgeBuckets:v,fileCount:P}}var Xo={"github.com/gin-gonic/gin":"Gin","github.com/labstack/echo":"Echo","github.com/gofiber/fiber":"Fiber","github.com/gorilla/mux":"Gorilla Mux","github.com/go-chi/chi":"Chi","github.com/beego/beego":"Beego","github.com/revel/revel":"Revel","k8s.io/kubernetes":"Kubernetes","k8s.io/client-go":"Kubernetes Client","github.com/prometheus/prometheus":"Prometheus","github.com/prometheus/client_golang":"Prometheus Client","go.etcd.io/etcd":"etcd","github.com/hashicorp/consul":"Consul","github.com/hashicorp/vault":"Vault","github.com/traefik/traefik":"Traefik","github.com/istio/istio":"Istio","gorm.io/gorm":"GORM","github.com/jmoiron/sqlx":"sqlx","github.com/go-sql-driver/mysql":"MySQL Driver","github.com/lib/pq":"PostgreSQL Driver","go.mongodb.org/mongo-driver":"MongoDB Driver","github.com/redis/go-redis":"Redis Client","github.com/go-redis/redis":"go-redis","google.golang.org/grpc":"gRPC","google.golang.org/protobuf":"Protobuf","github.com/grpc-ecosystem/grpc-gateway":"gRPC Gateway","github.com/stretchr/testify":"Testify","github.com/onsi/ginkgo":"Ginkgo","github.com/onsi/gomega":"Gomega","github.com/golang/mock":"GoMock","go.uber.org/zap":"Zap","github.com/sirupsen/logrus":"Logrus","github.com/rs/zerolog":"Zerolog","github.com/spf13/viper":"Viper","github.com/spf13/cobra":"Cobra","github.com/urfave/cli":"urfave/cli","github.com/go-resty/resty":"Resty","github.com/json-iterator/go":"jsoniter","gopkg.in/yaml.v3":"YAML v3","github.com/segmentio/kafka-go":"kafka-go","github.com/rabbitmq/amqp091-go":"RabbitMQ","github.com/nats-io/nats.go":"NATS","github.com/google/uuid":"UUID","github.com/spf13/cast":"Cast","github.com/pkg/errors":"pkg/errors"};function vp(t){let e=[],n,r=false;for(let s of t.split(/\r?\n/)){let o=s.trim();if(o.startsWith("go ")){let l=o.match(/^go\s+(\d+\.\d+)/);l&&(n=l[1]);continue}if(o.startsWith("require (")){r=true;continue}if(o===")"&&r){r=false;continue}let i=o;if(r)i=o;else if(o.startsWith("require "))i=o.substring(8);else continue;let a=i.includes("// indirect");i=i.replace(/\/\/.*$/,"").trim();let c=i.split(/\s+/);if(c.length>=2){let[l,u]=c;l&&u&&e.push({path:l,version:u,indirect:a});}}return {goVersion:n,deps:e}}var _i=new Set(["go.mod"]);async function bp(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,c=>_i.has(c)):await wp(t),i=[],a=r??n?.projectScanTimeout??18e4;for(let c of o){let l=B.dirname(c);try{let u=Sp(l,c,t,e,n,s),p=await $e(u,a);if(p.ok)i.push(p.value);else {let f=B.relative(t,l);n&&n.addStuckPath(f||"."),console.error(`Timeout scanning Go project ${l} (>${a/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(u){let p=u instanceof Error?u.message:String(u);console.error(`Error scanning Go project ${l}: ${p}`);}}return i}async function wp(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>_i.has(n))}async function Sp(t,e,n,r,s,o$1){let i=B.relative(n,t)||".",a=B.basename(t===n?n:t),c=s?await s.readTextFile(e):await o(e),{goVersion:l,deps:u}=vp(c),p=u.filter(y=>!y.indirect),f,d,h,g;if(l){let y=l.match(/(\d+)\.(\d+)/);if(y){let x=parseInt(y[1],10),T=parseInt(y[2],10),m=dn(o$1,"go");m&&(x===m.major?f=Math.max(0,m.minor-T):x<m.major&&(f=m.minor+(m.major-x)*100),d=`${m.major}.${m.minor}`);}h=yt(o$1,"go",l);let b=it("go",l);b&&(g=gt(o$1,"go",b));}let v=[],S=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},P=p.map(async y=>{let b=await r.get(y.path);return {dep:y,meta:b}}),C=await Promise.all(P);for(let{dep:y,meta:b}of C){let x=_e.valid(_e.clean(y.version)),T=b.latestStableOverall,m=null,A="unknown";if(x&&T){let $=_e.major(x);m=_e.major(T)-$,m===0?A=_e.eq(x,T)?"current":"minor-behind":m>0?A="major-behind":A="current",m<=0?j.current++:m===1?j.oneBehind++:j.twoPlusBehind++;}else j.unknown++;v.push({package:y.path,section:"dependencies",currentSpec:y.version,resolvedVersion:x,latestStable:T,majorsBehind:m,drift:A}),y.path in Xo&&S.push({name:Xo[y.path],currentVersion:x,latestVersion:T,majorsBehind:m});}v.sort((y,b)=>{let x={"major-behind":0,"minor-behind":1,current:2,unknown:3},T=(x[y.drift]??9)-(x[b.drift]??9);return T!==0?T:y.package.localeCompare(b.package)});let E;try{E=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"go",path:i,name:a,runtime:l,runtimeLatest:d,runtimeMajorsBehind:f,runtimeEol:h,runtimeEolDate:g,frameworks:S,dependencies:v,dependencyAgeBuckets:j,fileCount:E}}function kp(t){let e=new Map,r=Ai(t)?.package;if(!Array.isArray(r))return e;for(let s of r){if(!s||typeof s!="object")continue;let{name:o,version:i}=s;if(typeof o!="string"||typeof i!="string")continue;let a=e.get(o)??[];a.includes(i)||a.push(i),e.set(o,a);}return e}function xp(t,e){if(!t||t.length===0)return null;let n=t.filter(r=>ut.valid(r));if(n.length===0)return null;if(n.length===1)return n[0];if(e){let r=ut.validRange(e)??ut.validRange(`^${e}`);if(r){let s=ut.maxSatisfying(n,r);if(s)return s}}return ut.maxSatisfying(n,"*")??n[0]}async function Qo(t,e){let n=B.join(t,"Cargo.lock");if(!await e.exists(n).catch(()=>false))return null;try{let r=kp(await e.readText(n));return r.size?{size:r.size,resolve:(s,o)=>xp(r.get(s),o)}:null}catch{return null}}var Zo={"actix-web":"Actix Web",rocket:"Rocket",axum:"Axum",warp:"Warp",tide:"Tide",poem:"Poem",tokio:"Tokio","async-std":"async-std",smol:"smol",serde:"Serde",serde_json:"Serde JSON",bincode:"Bincode",toml:"TOML",diesel:"Diesel",sqlx:"SQLx","sea-orm":"SeaORM",reqwest:"reqwest",hyper:"hyper",ureq:"ureq",clap:"clap",structopt:"structopt",log:"log",env_logger:"env_logger",tracing:"tracing","tracing-subscriber":"tracing-subscriber",anyhow:"anyhow",thiserror:"thiserror",eyre:"eyre",criterion:"Criterion",proptest:"proptest",mockall:"mockall",ring:"ring",rustls:"rustls",webpki:"webpki",bevy:"Bevy",wgpu:"wgpu",winit:"winit","wasm-bindgen":"wasm-bindgen","wasm-pack":"wasm-pack",substrate:"Substrate",ethers:"ethers-rs"};function Ep(t){let e=[],n=null;for(let r of t.split(/\r?\n/)){let s=r.trim();if(s==="[dependencies]"){n="dependencies";continue}else if(s==="[dev-dependencies]"){n="dev-dependencies";continue}else if(s.startsWith("[")&&s.endsWith("]")){n=null;continue}if(!n)continue;let o=s.match(/^([\w-]+)\s*=\s*"([^"]+)"/);if(o){e.push({name:o[1],version:o[2],optional:false,features:[],isDev:n==="dev-dependencies"});continue}let i=s.match(/^([\w-]+)\s*=\s*\{([^}]+)\}/);if(i){let a=i[1],c=i[2],u=c.match(/version\s*=\s*"([^"]+)"/)?.[1]??"*",f=!!c.match(/optional\s*=\s*true/),d=c.match(/features\s*=\s*\[([^\]]*)\]/),h=d?d[1].split(",").map(g=>g.trim().replace(/"/g,"")):[];e.push({name:a,version:u,optional:f,features:h,isDev:n==="dev-dependencies"});}}return e}function jp(t){return t.match(/^\s*edition\s*=\s*"(\d+)"/m)?.[1]}var Oi=new Set(["Cargo.toml"]);async function Tp(t,e,n,r){let s=n?await n.findFiles(t,a=>Oi.has(a)):await Cp(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=Ap(c,a,t,e,n),u=await $e(l,i);if(u.ok)o.push(u.value);else {let p=B.relative(t,c);n&&n.addStuckPath(p||"."),console.error(`Timeout scanning Rust project ${c} (>${i/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(l){let u=l instanceof Error?l.message:String(l);console.error(`Error scanning Rust project ${c}: ${u}`);}}return o}async function Cp(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Oi.has(n))}async function Ap(t,e,n$1,r,s){let o$1=B.relative(n$1,t)||".",i=B.basename(t===n$1?n$1:t),a=s?await s.readTextFile(e):await o(e),c=jp(a),l=Ep(a),u={exists:E=>s?s.pathExists(E):p(E),readText:E=>s?s.readTextFile(E):o(E),readJson:E=>s?s.readJsonFile(E):n(E)},p$1=await Qo(t,u).catch(()=>null);!p$1&&t!==n$1&&(p$1=await Qo(n$1,u).catch(()=>null));let f=l.filter(E=>!E.isDev),d,h;if(c){let E=parseInt(c,10),y=2024;d=Math.max(0,Math.floor((y-E)/3)),h=y.toString();}let g=[],v=[],S={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=f.map(async E=>{let y=await r.get(E.name);return {dep:E,meta:y}}),P=await Promise.all(j);for(let{dep:E,meta:y}of P){let b=p$1?.resolve(E.name,E.version)??null,x=b&&Pe.valid(b)?b:Pe.valid(Pe.coerce(E.version)),T=y.latestStableOverall,m=null,A="unknown";if(x&&T){let L=Pe.major(x);m=Pe.major(T)-L,m===0?A=Pe.eq(x,T)?"current":"minor-behind":m>0?A="major-behind":A="current",m<=0?S.current++:m===1?S.oneBehind++:S.twoPlusBehind++;}else S.unknown++;let $=E.isDev?"devDependencies":"dependencies";g.push({package:E.name,section:$,currentSpec:E.version,resolvedVersion:x,latestStable:T,majorsBehind:m,drift:A}),E.name in Zo&&v.push({name:Zo[E.name],currentVersion:x,latestVersion:T,majorsBehind:m});}g.sort((E,y)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},x=(b[E.drift]??9)-(b[y.drift]??9);return x!==0?x:E.package.localeCompare(y.package)});let C;try{C=s?await s.countFilesUnder(n$1,t):void 0;}catch{}return {type:"rust",path:o$1,name:i,runtime:c,runtimeLatest:h,runtimeMajorsBehind:d,frameworks:v,dependencies:g,dependencyAgeBuckets:S,fileCount:C}}var ei={"laravel/framework":"Laravel","symfony/symfony":"Symfony","symfony/http-foundation":"Symfony HttpFoundation","cakephp/cakephp":"CakePHP","yiisoft/yii2":"Yii 2","codeigniter4/framework":"CodeIgniter","slim/slim":"Slim","laminas/laminas-mvc":"Laminas","roots/wordpress":"WordPress","johnpbloch/wordpress":"WordPress Core","doctrine/orm":"Doctrine ORM","doctrine/dbal":"Doctrine DBAL","illuminate/database":"Laravel Eloquent","propel/propel":"Propel","phpunit/phpunit":"PHPUnit","pestphp/pest":"Pest","behat/behat":"Behat","codeception/codeception":"Codeception","mockery/mockery":"Mockery","guzzlehttp/guzzle":"Guzzle","symfony/http-client":"Symfony HttpClient","twig/twig":"Twig","smarty/smarty":"Smarty","league/plates":"Plates","firebase/php-jwt":"PHP-JWT","lcobucci/jwt":"JWT","league/fractal":"Fractal","api-platform/core":"API Platform","symfony/console":"Symfony Console","monolog/monolog":"Monolog","nesbot/carbon":"Carbon","ramsey/uuid":"UUID","vlucas/phpdotenv":"PHP dotenv","phpstan/phpstan":"PHPStan","vimeo/psalm":"Psalm","friendsofphp/php-cs-fixer":"PHP CS Fixer","squizlabs/php_codesniffer":"PHP_CodeSniffer"},kt={major:8,minor:4};async function Pp(t,e){let n$1=e?await e.readJsonFile(t):await n(t),r=[],s;if(n$1.require?.php&&(s=n$1.require.php),n$1.require&&typeof n$1.require=="object")for(let[o,i]of Object.entries(n$1.require))o==="php"||o.startsWith("ext-")||r.push({name:o,version:String(i),isDev:false});if(n$1["require-dev"]&&typeof n$1["require-dev"]=="object")for(let[o,i]of Object.entries(n$1["require-dev"]))o==="php"||o.startsWith("ext-")||r.push({name:o,version:String(i),isDev:true});return {phpVersion:s,deps:r}}async function Mp(t,e){let n$1=new Map;try{let r=e?await e.readJsonFile(t):await n(t);for(let s of r.packages??[])s.name&&s.version&&n$1.set(s.name,s.version);for(let s of r["packages-dev"]??[])s.name&&s.version&&n$1.set(s.name,s.version);}catch{}return n$1}function $p(t){return t.match(/(\d+)\.(\d+)/)?.[0]}var Bi=new Set(["composer.json"]);async function Lp(t,e,n,r){let s=n?await n.findFiles(t,a=>Bi.has(a)):await Np(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=Rp(c,a,t,e,n),u=await $e(l,i);if(u.ok)o.push(u.value);else {let p=B.relative(t,c);n&&n.addStuckPath(p||"."),console.error(`Timeout scanning PHP project ${c} (>${i/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(l){let u=l instanceof Error?l.message:String(l);console.error(`Error scanning PHP project ${c}: ${u}`);}}return o}async function Np(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Bi.has(n))}async function Rp(t,e,n,r,s){let o=B.relative(n,t)||".",i=B.basename(t===n?n:t),{phpVersion:a,deps:c}=await Pp(e,s),l=B.join(t,"composer.lock"),u=new Map;try{u=await Mp(l,s);}catch{}let p=c.filter(E=>!E.isDev),f,d,h;if(a&&(h=$p(a),h)){let E=h.match(/(\d+)\.(\d+)/);if(E){let y=parseInt(E[1],10),b=parseInt(E[2],10);y===kt.major?f=Math.max(0,kt.minor-b):y<kt.major&&(f=kt.minor+(kt.major-y)*10),d=`${kt.major}.${kt.minor}`;}}let g=[],v=[],S={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=p.map(async E=>{let y=await r.get(E.name);return {dep:E,meta:y}}),P=await Promise.all(j);for(let{dep:E,meta:y}of P){let b=u.get(E.name),x=b?Fe.valid(Fe.clean(b)):null,T=y.latestStableOverall,m=null,A="unknown";if(x&&T){let L=Fe.major(x);m=Fe.major(T)-L,m===0?A=Fe.eq(x,T)?"current":"minor-behind":m>0?A="major-behind":A="current",m<=0?S.current++:m===1?S.oneBehind++:S.twoPlusBehind++;}else S.unknown++;let $=E.isDev?"devDependencies":"dependencies";g.push({package:E.name,section:$,currentSpec:E.version,resolvedVersion:x,latestStable:T,majorsBehind:m,drift:A}),E.name in ei&&v.push({name:ei[E.name],currentVersion:x,latestVersion:T,majorsBehind:m});}g.sort((E,y)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},x=(b[E.drift]??9)-(b[y.drift]??9);return x!==0?x:E.package.localeCompare(y.package)});let C;try{C=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"php",path:o,name:i,runtime:h,runtimeLatest:d,runtimeMajorsBehind:f,frameworks:v,dependencies:g,dependencyAgeBuckets:S,fileCount:C}}var ti={flutter:"Flutter SDK",flutter_test:"Flutter Test",provider:"Provider",riverpod:"Riverpod",flutter_riverpod:"Flutter Riverpod",bloc:"BLoC",flutter_bloc:"Flutter BLoC",get:"GetX",mobx:"MobX",redux:"Redux",go_router:"GoRouter",auto_route:"AutoRoute",http:"http",dio:"Dio",retrofit:"Retrofit",graphql_flutter:"GraphQL Flutter",sqflite:"SQFlite",hive:"Hive",isar:"Isar",drift:"Drift",firebase_core:"Firebase Core",cloud_firestore:"Cloud Firestore",flutter_svg:"Flutter SVG",cached_network_image:"Cached Network Image",shimmer:"Shimmer",lottie:"Lottie",flutter_staggered_grid_view:"Staggered Grid View",mockito:"Mockito",mocktail:"Mocktail",integration_test:"Integration Test",test:"Test",intl:"Intl",shared_preferences:"Shared Preferences",path_provider:"Path Provider",package_info_plus:"Package Info Plus",url_launcher:"URL Launcher",image_picker:"Image Picker",json_serializable:"JSON Serializable",freezed:"Freezed",built_value:"Built Value",logger:"Logger",sentry_flutter:"Sentry Flutter",firebase_crashlytics:"Firebase Crashlytics",build_runner:"Build Runner",injectable:"Injectable",flutter_lints:"Flutter Lints",lint:"Lint"},xt={major:3,minor:6};function Ip(t){let e=[],n,r=null;for(let s of t.split(/\r?\n/)){let o=s.trim();if(o.startsWith("sdk:")){let a=o.match(/sdk:\s*['"]?>?=?\s*(\d[^<'"]*)/);a&&(n=a[1].trim());continue}if(o==="dependencies:"){r="dependencies";continue}else if(o==="dev_dependencies:"){r="dev_dependencies";continue}else if(/^\w+:/.test(s)){r=null;continue}if(!r)continue;let i=o.match(/^([\w_]+):\s*([^\s{]+)/);if(i){let a=i[1],c=i[2];if(c==="sdk:"||o.includes("sdk: flutter"))continue;e.push({name:a,version:c,isDev:r==="dev_dependencies"});}}return {dartVersion:n,deps:e}}async function _p(t,e){let n=new Map;try{let r=e?await e.readTextFile(t):await o(t),s=null;for(let o of r.split(/\r?\n/)){let i=o.trim(),a=o.match(/^ {2}(\w+):$/);if(a){s=a[1];continue}if(s&&i.startsWith("version:")){let c=i.match(/version:\s*"?([^"]+)"?/);c&&(n.set(s,c[1]),s=null);}}}catch{}return n}function Fp(t){return t.match(/(\d+\.\d+\.\d+)/)?.[0]}var Vi=new Set(["pubspec.yaml"]);async function Op(t,e,n,r){let s=n?await n.findFiles(t,a=>Vi.has(a)):await Bp(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=Vp(c,a,t,e,n),u=await $e(l,i);if(u.ok)o.push(u.value);else {let p=B.relative(t,c);n&&n.addStuckPath(p||"."),console.error(`Timeout scanning Dart project ${c} (>${i/1e3}s) \u2014 skipped`),n?.shouldShowTimeoutHint()&&console.error(" Tip: increase projectScanTimeout in vibgrate.config.ts (or --project-scan-timeout <seconds>) for large projects");}}catch(l){let u=l instanceof Error?l.message:String(l);console.error(`Error scanning Dart project ${c}: ${u}`);}}return o}async function Bp(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Vi.has(n))}async function Vp(t,e,n,r,s){let o$1=B.relative(n,t)||".",i=B.basename(t===n?n:t),a=s?await s.readTextFile(e):await o(e),{dartVersion:c,deps:l}=Ip(a),u=B.join(t,"pubspec.lock"),p=new Map;try{p=await _p(u,s);}catch{}let f=l.filter(y=>!y.isDev),d,h,g;if(c&&(g=Fp(c),g)){let y=g.match(/(\d+)\.(\d+)/);if(y){let b=parseInt(y[1],10),x=parseInt(y[2],10);b===xt.major?d=Math.max(0,xt.minor-x):b<xt.major&&(d=xt.minor+(xt.major-b)*10),h=`${xt.major}.${xt.minor}`;}}let v=[],S=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},P=f.map(async y=>{let b=await r.get(y.name);return {dep:y,meta:b}}),C=await Promise.all(P);for(let{dep:y,meta:b}of C){let x=p.get(y.name),T=x?Oe.valid(Oe.clean(x)):null,m=b.latestStableOverall,A=null,$="unknown";if(T&&m){let I=Oe.major(T);A=Oe.major(m)-I,A===0?$=Oe.eq(T,m)?"current":"minor-behind":A>0?$="major-behind":$="current",A<=0?j.current++:A===1?j.oneBehind++:j.twoPlusBehind++;}else j.unknown++;let L=y.isDev?"devDependencies":"dependencies";v.push({package:y.name,section:L,currentSpec:y.version,resolvedVersion:T,latestStable:m,majorsBehind:A,drift:$}),y.name in ti&&S.push({name:ti[y.name],currentVersion:T,latestVersion:m,majorsBehind:A});}v.sort((y,b)=>{let x={"major-behind":0,"minor-behind":1,current:2,unknown:3},T=(x[y.drift]??9)-(x[b.drift]??9);return T!==0?T:y.package.localeCompare(b.package)});let E;try{E=s?await s.countFilesUnder(n,t):void 0;}catch{}return {type:"dart",path:o$1,name:i,runtime:g,runtimeLatest:h,runtimeMajorsBehind:d,frameworks:S,dependencies:v,dependencyAgeBuckets:j,fileCount:E}}var Dp="https://hex.pm/api",Up=1e4,Gp=10;async function qp(t,e,n,r=false){let s=W(e,"hex",t);if(s?.latest)return s.latest;if(r)return null;let o=async()=>{try{let i=new AbortController,a=setTimeout(()=>i.abort(),Up),c=`${Dp}/packages/${t}`,l=await fetch(c,{signal:i.signal,headers:{"User-Agent":"vibgrate-cli"}});if(clearTimeout(a),!l.ok)return null;let p=(await l.json()).releases;if(!p||p.length===0)return null;let f=p.filter(d=>!d.retired).map(d=>d.version).filter(d=>{try{return new wr.SemVer(d).prerelease.length===0}catch{return !1}});return f.length===0?null:(f.sort((d,h)=>{try{return (0,wr.gt)(d,h)?-1:1}catch{return 0}}),f[0])}catch(i){return i?.name==="AbortError",null}};return n?n.run(o):o()}async function Hp(t,e,n=false){let r=new Map,s=new a$1(Gp),o=t.map(async i=>{let a=await qp(i,e,s,n);a&&r.set(i,a);});return await Promise.all(o),r}var zp=new Set(["mix.exs"]),Wp=new Set(["phoenix","phoenix_live_view","phoenix_html","phoenix_ecto","phoenix_pubsub","ecto","ecto_sql","plug","plug_cowboy","cowboy","ranch","absinthe","absinthe_plug","guardian","comeonin","bcrypt_elixir","argon2_elixir","pbkdf2_elixir","ex_machina","mock","mox","excoveralls","credo","dialyxir","ex_doc","jason","poison","httpoison","tesla","finch","mint","hackney","timex","quantum","oban","broadway","gen_stage","flow","bamboo","swoosh","ex_aws","ex_aws_s3","redix","cachex","nebulex","floki","wallaby","hound"]);async function Jp(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s,o$1=n.match(/elixir:\s*"([^"]+)"/);o$1&&(s=o$1[1]);let i=/\{\s*:(\w+)\s*,\s*"([^"]+)"(?:,\s*(?:only|optional|runtime):\s*:(\w+))?\s*\}/g,a;for(;(a=i.exec(n))!==null;){let l=a[1],u=a[2],p=a[3];r.push({name:l,version:u,isDev:p==="dev"||p==="test"});}let c=/\{\s*:(\w+)\s*,\s*git:\s*"[^"]+"/g;for(;(a=c.exec(n))!==null;);return {elixirVersion:s,deps:r}}async function Kp(t,e){let n=new Map;try{let r=e?await e.readTextFile(t):await o(t),s=/"(\w+)":\s*\{\s*:hex\s*,\s*:\w+\s*,\s*"([^"]+)"/g,o$1;for(;(o$1=s.exec(r))!==null;){let i=o$1[1],a=o$1[2];n.set(i,a);}}catch{}return n}function Yp(t,e){try{let n=t.replace(/^[~><=\s]+/,""),r=(0,ke.minVersion)((0,ke.validRange)(n)||n);if(!r)return "unknown";if(!(0,ke.gt)(e,r.version))return "current";let s=(0,ke.minVersion)(e);return s?s.major>r.major?"major-behind":"minor-behind":"unknown"}catch{return "unknown"}}async function Xp(t,e,n,r=false){let s=`${t}/mix.exs`;if(!(e?await e.pathExists(s):await p(s)))return null;let{elixirVersion:i,deps:a}=await Jp(s,e),c=`${t}/mix.lock`,l=await Kp(c,e),u=a.filter(v=>!v.isDev),p$1=u.map(v=>v.name),f=await Hp(p$1,n,r),d=[],h=[],g={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let v of u){let S=l.get(v.name),j=S||v.version,P=f.get(v.name),C=P?Yp(j,P):"unknown",E=null;if(S&&P)try{let y=(0,ke.minVersion)((0,ke.validRange)(j)||j),b=(0,ke.minVersion)((0,ke.validRange)(P)||P);y&&b&&(E=b.major-y.major);}catch{}d.push({package:v.name,section:v.isDev?"devDependencies":"dependencies",currentSpec:v.version,resolvedVersion:S||null,latestStable:P||null,majorsBehind:E,drift:C}),C==="current"?g.current++:E===1?g.oneBehind++:E&&E>1?g.twoPlusBehind++:g.unknown++,Wp.has(v.name)&&h.push({name:v.name,currentVersion:S||null,latestVersion:P||null,majorsBehind:E});}return {type:"elixir",path:B.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:B.basename(t),runtime:i,frameworks:h,dependencies:d,dependencyAgeBuckets:g}}async function Qp(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>zp.has(c)):[],i=new Map;for(let c of o){let l=B.dirname(c);i.has(l)||i.set(l,[]),i.get(l).push(c);}let a=[];for(let[c]of i)try{let l=await Xp(c,n,e,s);l&&(l.path=B.relative(t,c)||".",a.push(l));}catch(l){console.error(`Error scanning Elixir project at ${c}:`,l);}return a}var Zp="https://hub.docker.com/v2",ef=1e4,tf=10;function gs(t){let e,n,r,s,[o,i]=t.split(":");s=i;let a=o.split("/");return a.length>1&&(a[0].includes(".")||a[0]==="localhost")?(e=a[0],a.length===3?(n=a[1],r=a[2]):r=a[1]):a.length===2?(n=a[0],r=a[1]):r=o,{registry:e,namespace:n,image:r,tag:s}}async function nf(t,e,n){let r=async()=>{try{let s=new AbortController,o=setTimeout(()=>s.abort(),ef),i=`${Zp}/repositories/${t}/${e}/tags?page_size=100`,a=await fetch(i,{signal:s.signal,headers:{"User-Agent":"vibgrate-cli"}});return clearTimeout(o),a.ok?((await a.json()).results||[]).map(u=>u.name):[]}catch(s){return s?.name==="AbortError"?[]:[]}};return n?n.run(r):r()}function rf(t){let e=[];for(let n of t){if(["latest","master","main","stable","edge","dev"].includes(n))continue;let r=n.replace(/^v/,""),s=r.indexOf("-");s>0&&(r=r.substring(0,s));try{let o=new Sr.SemVer(r);o.prerelease.length===0&&e.push(o);}catch{}}return e.length===0?null:(e.sort((n,r)=>(0, Sr.gt)(n.version,r.version)?-1:1),e[0].version)}async function sf(t,e,n,r=false){let s=gs(t),o=`${s.namespace||"library"}/${s.image}`,i=W(e,"docker",o);if(i?.latest)return i.latest;if(r||s.registry&&s.registry!=="docker.io")return null;let a=s.namespace||"library",c=await nf(a,s.image,n);return rf(c)}async function of(t,e,n=false){let r=new Map,s=new a$1(tf),o=t.map(async i=>{let a=await sf(i,e,s,n);a&&r.set(i,a);});return await Promise.all(o),r}var af=new Set(["Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml"]);async function cf(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s=/^FROM\s+(?:--platform=[^\s]+\s+)?([^\s]+)/gm,o$1;for(;(o$1=s.exec(n))!==null;){let i=o$1[1];if(i==="scratch")continue;let a=gs(i);r.push({name:`${a.namespace||"library"}/${a.image}`,currentTag:a.tag||"latest"});}return r}async function lf(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s=/^\s*image:\s*([^\s#]+)/gm,o$1;for(;(o$1=s.exec(n))!==null;){let i=o$1[1].trim().replace(/["']/g,""),a=gs(i);r.push({name:`${a.namespace||"library"}/${a.image}`,currentTag:a.tag||"latest"});}return r}function uf(t,e){try{if(t==="latest"||t==="stable")return "current";let n=t.replace(/^v/,""),r=n.indexOf("-");r>0&&(n=n.substring(0,r));let s=new $t.SemVer(n),o=new $t.SemVer(e);return (0,$t.gt)(o.version,s.version)?o.major>s.major?"major-behind":"minor-behind":"current"}catch{return "unknown"}}async function pf(t,e,n,r=false){let s=[],o=`${t}/Dockerfile`;if(e?await e.pathExists(o):await p(o)){let d=await cf(o,e);s.push(...d);}let a=["docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml"];for(let d of a){let h=`${t}/${d}`;if(e?await e.pathExists(h):await p(h)){let v=await lf(h,e);s.push(...v);break}}if(s.length===0)return null;let c=new Map;for(let d of s)c.has(d.name)||c.set(d.name,d.currentTag);let l=Array.from(c.keys()),u=await of(l,n,r),p$1=[],f={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let d of l){let h=c.get(d),g=u.get(d),v=g?uf(h,g):"unknown",S=null;if(g)try{let j=h.replace(/^v/,"").split("-")[0],P=new $t.SemVer(j);S=new $t.SemVer(g).major-P.major;}catch{}p$1.push({package:d,section:"dependencies",currentSpec:h,resolvedVersion:h,latestStable:g||null,majorsBehind:S,drift:v}),v==="current"?f.current++:S===1?f.oneBehind++:S&&S>1?f.twoPlusBehind++:f.unknown++;}return {type:"docker",path:B.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:B.basename(t),frameworks:[],dependencies:p$1,dependencyAgeBuckets:f}}async function ff(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>af.has(c)):[],i=new Map;for(let c of o){let l=B.dirname(c);i.has(l)||i.set(l,[]),i.get(l).push(c);}let a=[];for(let[c]of i)try{let l=await pf(c,n,e,s);l&&(l.path=B.relative(t,c)||".",a.push(l));}catch(l){console.error(`Error scanning Docker project at ${c}:`,l);}return a}var df="https://artifacthub.io/api/v1",mf=1e4,hf=10;async function gf(t,e,n,r,s=false){let o=e?`${e}/${t}`:t,i=W(n,"helm",o);if(i?.latest)return i.latest;if(s)return null;let a=async()=>{try{let c=new AbortController,l=setTimeout(()=>c.abort(),mf),u=`${df}/packages/search?kind=0&ts_query_web=${encodeURIComponent(t)}&limit=10`,p=await fetch(u,{signal:c.signal,headers:{"User-Agent":"vibgrate-cli"}});if(clearTimeout(l),!p.ok)return null;let d=(await p.json()).packages||[],h=d.find(g=>g.name===t);return e&&d.length>1&&(h=d.find(g=>g.name===t&&g.repository?.name===e)||h),h?h.version:null}catch(c){return c?.name==="AbortError",null}};return r?r.run(a):a()}async function yf(t,e,n=false){let r=new Map,s=new a$1(hf),o=t.map(async i=>{let a=await gf(i.name,i.repo,e,s,n);if(a){let c=i.repo?`${i.repo}/${i.name}`:i.name;r.set(c,a);}});return await Promise.all(o),r}var vf=new Set(["Chart.yaml","Chart.yml"]);async function bf(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s,o$1,i,a=n.match(/^name:\s*(.+)$/m);a&&(s=a[1].trim().replace(/["']/g,""));let c=n.match(/^version:\s*(.+)$/m);c&&(o$1=c[1].trim().replace(/["']/g,""));let l=n.match(/^appVersion:\s*(.+)$/m);l&&(i=l[1].trim().replace(/["']/g,""));let u=n.match(/^dependencies:\s*$/m);if(u){let p=u.index+u[0].length,f=n.substring(p),d=/^\s*-\s+name:\s*(.+)$/gm,h;for(;(h=d.exec(f))!==null;){let g=h[1].trim().replace(/["']/g,""),v=h.index,S=d.exec(f),j=S?S.index:f.length;d.lastIndex=v+1;let P=f.substring(v,j),C=P.match(/version:\s*(.+)$/m),E=C?C[1].trim().replace(/["']/g,""):"*",y=P.match(/repository:\s*(.+)$/m),b=y?y[1].trim().replace(/["']/g,""):void 0,x=P.match(/condition:\s*(.+)$/m),T=x?x[1].trim().replace(/["']/g,""):void 0;r.push({name:g,version:E,repository:b,condition:T});}}return {chartName:s,chartVersion:o$1,appVersion:i,dependencies:r}}async function wf(t,e){let n=new Map;try{let r=e?await e.readTextFile(t):await o(t),s=/^\s*-\s+name:\s*(.+)$/gm,o$1;for(;(o$1=s.exec(r))!==null;){let i=o$1[1].trim().replace(/["']/g,""),a=o$1.index,c=s.exec(r),l=c?c.index:r.length;s.lastIndex=a+1;let p=r.substring(a,l).match(/version:\s*(.+)$/m);if(p){let f=p[1].trim().replace(/["']/g,"");n.set(i,f);}}}catch{}return n}function Sf(t,e){try{let n=t.replace(/^[~^><=\s]+/,""),r=(0,xe.minVersion)((0,xe.validRange)(n)||n);if(!r)return "unknown";if(!(0,xe.gt)(e,r.version))return "current";let s=(0,xe.minVersion)(e);return s?s.major>r.major?"major-behind":"minor-behind":"unknown"}catch{return "unknown"}}async function kf(t,e,n,r=false){let s=null;for(let h of ["Chart.yaml","Chart.yml"]){let g=`${t}/${h}`;if(e?await e.pathExists(g):await p(g)){s=g;break}}if(!s)return null;let{chartName:o,appVersion:i,dependencies:a}=await bf(s,e),c=`${t}/Chart.lock`,l=await wf(c,e),u=a.map(h=>({name:h.name,repo:h.repository})),p$1=await yf(u,n,r),f=[],d={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let h of a){let g=l.get(h.name),v=g||h.version,S=h.repository?`${h.repository}/${h.name}`:h.name,j=p$1.get(S),P=j?Sf(v,j):"unknown",C=null;if(j)try{let E=(0,xe.minVersion)((0,xe.validRange)(v)||v),y=(0,xe.minVersion)((0,xe.validRange)(j)||j);E&&y&&(C=y.major-E.major);}catch{}f.push({package:h.name,section:"dependencies",currentSpec:h.version,resolvedVersion:g||null,latestStable:j||null,majorsBehind:C,drift:P}),P==="current"?d.current++:C===1?d.oneBehind++:C&&C>1?d.twoPlusBehind++:d.unknown++;}return {type:"helm",path:B.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:o||B.basename(t),runtime:i,frameworks:[],dependencies:f,dependencyAgeBuckets:d}}async function xf(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>vf.has(c)):[],i=new Map;for(let c of o){let l=B.dirname(c);i.has(l)||i.set(l,[]),i.get(l).push(c);}let a=[];for(let[c]of i)try{let l=await kf(c,n,e,s);l&&(l.path=B.relative(t,c)||".",a.push(l));}catch(l){console.error(`Error scanning Helm chart at ${c}:`,l);}return a}var Di="https://registry.terraform.io/v1",Ui=1e4,Ef=10;async function jf(t,e,n,r,s=false){let o=`${t}/${e}`,i=W(n,"terraform",o);if(i?.latest)return i.latest;if(s)return null;let a=async()=>{try{let c=new AbortController,l=setTimeout(()=>c.abort(),Ui),u=`${Di}/providers/${t}/${e}/versions`,p=await fetch(u,{signal:c.signal,headers:{"User-Agent":"vibgrate-cli"}});if(clearTimeout(l),!p.ok)return null;let d=(await p.json()).versions||[];if(d.length===0)return null;let h=[];for(let g of d)try{let v=new sn.SemVer(g.version);v.prerelease.length===0&&h.push(v);}catch{}return h.length===0?null:(h.sort((g,v)=>(0,sn.gt)(g.version,v.version)?-1:1),h[0].version)}catch(c){return c?.name==="AbortError",null}};return r?r.run(a):a()}async function Tf(t,e,n,r,s,o=false){let i=`${t}/${e}/${n}`,a=W(r,"terraform",i);if(a?.latest)return a.latest;if(o)return null;let c=async()=>{try{let l=new AbortController,u=setTimeout(()=>l.abort(),Ui),p=`${Di}/modules/${t}/${e}/${n}/versions`,f=await fetch(p,{signal:l.signal,headers:{"User-Agent":"vibgrate-cli"}});if(clearTimeout(u),!f.ok)return null;let h=(await f.json()).modules||[];if(h.length===0||!h[0].versions)return null;let g=h[0].versions,v=[];for(let S of g)try{let j=new sn.SemVer(S.version);j.prerelease.length===0&&v.push(j);}catch{}return v.length===0?null:(v.sort((S,j)=>(0,sn.gt)(S.version,j.version)?-1:1),v[0].version)}catch(l){return l?.name==="AbortError",null}};return s?s.run(c):c()}async function Cf(t,e,n=false){let r=new Map,s=new a$1(Ef),o=t.map(async i=>{let a=null,c;i.type==="provider"?(c=`${i.namespace}/${i.name}`,a=await jf(i.namespace,i.name,e,s,n)):(c=`${i.namespace}/${i.name}/${i.provider}`,a=await Tf(i.namespace,i.name,i.provider,e,s,n)),a&&r.set(c,a);});return await Promise.all(o),r}async function Af(t,e){let n=e?await e.readTextFile(t):await o(t),r=[],s=[],o$1,i=n.match(/terraform\s*\{[^}]*required_version\s*=\s*"([^"]+)"/s);i&&(o$1=i[1]);let a=n.match(/required_providers\s*\{([^}]+)\}/s);if(a){let f=a[1],d=/(\w+)\s*=\s*\{([^}]+)\}/g,h;for(;(h=d.exec(f))!==null;){let g=h[2],v=g.match(/source\s*=\s*"([^"]+)"/);if(!v)continue;let S=v[1],j=g.match(/version\s*=\s*"([^"]+)"/),P=j?j[1]:void 0;r.push({source:S,version:P});}}let c=/provider\s+"(\w+)"\s*\{([^}]+)\}/g,l;for(;(l=c.exec(n))!==null;){let f=l[1],h=l[2].match(/version\s*=\s*"([^"]+)"/);h&&(r.find(v=>v.source.endsWith(`/${f}`))||r.push({source:`hashicorp/${f}`,version:h[1]}));}let u=/module\s+"[^"]+"\s*\{([^}]+)\}/g,p;for(;(p=u.exec(n))!==null;){let f=p[1],d=f.match(/source\s*=\s*"([^"]+)"/);if(!d)continue;let h=d[1];if(h.startsWith("./")||h.startsWith("../")||h.startsWith("git::"))continue;let g=f.match(/version\s*=\s*"([^"]+)"/),v=g?g[1]:void 0;s.push({source:h,version:v});}return {terraformVersion:o$1,providers:r,modules:s}}async function Pf(t,e){let n=new Map;try{let r=e?await e.readTextFile(t):await o(t),s=/provider\s+"[^"]*\/([^/"]+\/[^/"]+)"\s*\{([^}]+)\}/g,o$1;for(;(o$1=s.exec(r))!==null;){let i=o$1[1],c=o$1[2].match(/version\s*=\s*"([^"]+)"/);c&&n.set(i,c[1]);}}catch{}return n}function ni(t,e){try{let n=t.replace(/^[~><=\s]+/,""),r=(0,re.minVersion)((0,re.validRange)(n)||n);if(!r)return "unknown";if(!(0,re.gt)(e,r.version))return "current";let s=(0,re.minVersion)(e);return s?s.major>r.major?"major-behind":"minor-behind":"unknown"}catch{return "unknown"}}async function Mf(t,e,n,r=false){let s=[];if(e){let v=await e.findFiles(t,S=>S.endsWith(".tf"));s.push(...v);}else {let v=["main.tf","variables.tf","outputs.tf","versions.tf","providers.tf"];for(let S of v){let j=`${t}/${S}`;await p(j)&&s.push(j);}}if(s.length===0)return null;let o,i=[],a=[];for(let v of s){let{terraformVersion:S,providers:j,modules:P}=await Af(v,e);S&&!o&&(o=S),i.push(...j),a.push(...P);}let c=new Map;for(let v of i)c.has(v.source)||c.set(v.source,v.version);let l=new Map;for(let v of a)l.has(v.source)||l.set(v.source,v.version);let u=`${t}/.terraform.lock.hcl`,p$1=await Pf(u,e),f=[];for(let[v]of c){let[S,j]=v.split("/");f.push({type:"provider",namespace:S,name:j});}for(let[v]of l){let S=v.split("/");if(S.length===3){let[j,P,C]=S;f.push({type:"module",namespace:j,name:P,provider:C});}}let d=await Cf(f,n,r),h=[],g={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let[v,S]of c){let j=p$1.get(v),P=j||S||"unknown",C=d.get(v),E=C&&P!=="unknown"?ni(P,C):"unknown",y=null;if(C&&P!=="unknown")try{let b=(0,re.minVersion)((0,re.validRange)(P)||P),x=(0,re.minVersion)((0,re.validRange)(C)||C);b&&x&&(y=x.major-b.major);}catch{}h.push({package:`provider:${v}`,section:"dependencies",currentSpec:S||"unknown",resolvedVersion:j||null,latestStable:C||null,majorsBehind:y,drift:E}),E==="current"?g.current++:y===1?g.oneBehind++:y&&y>1?g.twoPlusBehind++:g.unknown++;}for(let[v,S]of l){let j=S||"unknown",P=d.get(v),C=P&&j!=="unknown"?ni(j,P):"unknown",E=null;if(P&&j!=="unknown")try{let y=(0,re.minVersion)((0,re.validRange)(j)||j),b=(0,re.minVersion)((0,re.validRange)(P)||P);y&&b&&(E=b.major-y.major);}catch{}h.push({package:`module:${v}`,section:"dependencies",currentSpec:S||"unknown",resolvedVersion:null,latestStable:P||null,majorsBehind:E,drift:C}),C==="current"?g.current++:E===1?g.oneBehind++:E&&E>1?g.twoPlusBehind++:g.unknown++;}return {type:"terraform",path:B.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:B.basename(t),runtime:o,frameworks:[],dependencies:h,dependencyAgeBuckets:g}}async function $f(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>c.endsWith(".tf")):[],i=new Map;for(let c of o){let l=B.dirname(c);i.has(l)||i.set(l,[]),i.get(l).push(c);}let a=[];for(let[c]of i)try{let l=await Mf(c,n,e,s);l&&(l.path=B.relative(t,c)||".",a.push(l));}catch(l){console.error(`Error scanning Terraform project at ${c}:`,l);}return a}var ri=[{name:"go.mod",type:"go"},{name:"Cargo.toml",type:"rust"},{name:"composer.json",type:"php"},{name:"Package.swift",type:"swift"},{name:"pubspec.yaml",type:"dart"},{name:"build.gradle.kts",type:"kotlin"},{name:"build.sbt",type:"scala"},{name:"DESCRIPTION",type:"r"},{name:"Podfile",type:"objective-c"},{name:"mix.exs",type:"elixir"},{name:"cpanfile",type:"perl"},{name:"Project.toml",type:"julia"},{name:"deps.edn",type:"clojure"},{name:"build.gradle",type:"groovy"},{name:"tsconfig.json",type:"typescript"},{name:"Makefile",type:"c"},{name:"CMakeLists.txt",type:"cpp"},{name:"*.vbp",type:"visual-basic"}],Lf=[{extensions:[".m",".mm"],type:"objective-c"},{extensions:[".c",".h"],type:"c"},{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],type:"cpp"},{extensions:[".cob",".cbl",".cpy"],type:"cobol"},{extensions:[".f",".for",".f90",".f95",".f03",".f08"],type:"fortran"},{extensions:[".pas",".pp",".lpr"],type:"pascal"},{extensions:[".adb",".ads",".ada"],type:"ada"},{extensions:[".asm",".s",".s43",".s65"],type:"assembly"},{extensions:[".rpg",".rpgle",".sqlrpgle"],type:"rpg"}];function Et(t,e="unknown"){return {package:t,section:"dependencies",currentSpec:e,resolvedVersion:null,latestStable:null,majorsBehind:null,drift:"unknown"}}function Qt(t,e,n=1){let r=new Set;for(let s of t.split(/\r?\n/)){let o=s.match(e);o?.[n]&&r.add(o[n]);}return [...r]}function Nf(t,e){return B.basename(t)||B.basename(e)}function Rf(t){return /^\s*(CC|CFLAGS|LDFLAGS)\s*[:?+]?=/m.test(t)||/\b(gcc|clang)\b/.test(t)||/\.(c|o)\b/.test(t)}function Jr(t,e,n,r,s,o=[]){let i=r||".",a=`${n}:${i}`;e.has(a)||(e.add(a),t.push({type:n,path:i,name:Nf(i,s),frameworks:[],dependencies:o,dependencyAgeBuckets:{current:0,oneBehind:0,twoPlusBehind:0,unknown:o.length}}));}async function If(t,e){let n$1=B.basename(t),r=async()=>e?e.readTextFile(t):o(t);if(n$1==="composer.json"){let o=e?await e.readJsonFile(t):await n(t);if(!o||typeof o!="object")return [];let i=new Set;for(let a of ["require","require-dev"]){let c=o[a];if(c&&typeof c=="object")for(let l of Object.keys(c))i.add(l);}return [...i].map(a=>Et(a))}let s=await r();return s?n$1==="go.mod"?Qt(s,/^\s*require\s+([^\s]+)\s+(.+)$/).map(o=>Et(o)):n$1==="Cargo.toml"?Qt(s,/^\s*([A-Za-z0-9_\-]+)\s*=\s*['"{]/).map(o=>Et(o)):n$1==="pubspec.yaml"?Qt(s,/^\s{2,}([A-Za-z0-9_\-]+):\s*.+$/).map(o=>Et(o)):n$1==="mix.exs"?Qt(s,/\{\s*:([a-zA-Z0-9_]+),/).map(o=>Et(o)):n$1==="cpanfile"?Qt(s,/^\s*requires\s+['"]([^'"]+)['"]/).map(o=>Et(o)):n$1==="build.sbt"?Qt(s,/"([A-Za-z0-9_.\-]+)"\s*%{1,2}\s*"([A-Za-z0-9_.\-]+)"/,2).map(o=>Et(o)):[]:[]}function _f(t){let e=new Map;for(let n of t){if(!n.isFile)continue;let r=B.extname(n.name).toLowerCase();if(r)for(let s of Lf){if(!s.extensions.includes(r))continue;let o=B.dirname(n.relPath)||".";e.has(o)||e.set(o,new Set),e.get(o)?.add(s.type);}}return e}async function Ff(t,e){let n=e?await e.walkDir(t):[],r=n.filter(c=>c.isFile&&ri.some(l=>l.name===c.name||l.name.startsWith("*.")&&c.name.endsWith(l.name.slice(1)))),s=new Set(n.filter(c=>c.isFile&&c.name.endsWith(".sh")).map(c=>B.dirname(c.relPath)||".")),o$1=[],i=new Set;for(let c of r){let l=ri.find(f=>f.name===c.name||f.name.startsWith("*.")&&c.name.endsWith(f.name.slice(1)));if(!l)continue;if(c.name==="Makefile"){let f=e?await e.readTextFile(c.absPath):await o(c.absPath);if(!Rf(f))continue}let u=B.dirname(c.relPath)||".",p=await If(c.absPath,e);Jr(o$1,i,l.type,u,t,p);}for(let c of s)Jr(o$1,i,"shell",c,t);let a=_f(n);for(let[c,l]of a)for(let u of l)Jr(o$1,i,u,c,t);return o$1}var Of=10,Bf=1048576,Vf=5,Df=20,Uf=2621440,Gf=10,qf=30,Hf=5242880,zf=25,os=25,is=10,as=3,Gy=1;function Kr(t,e,n,r){let s=0;return t.fileCount!==void 0&&t.fileCount>=1&&t.fileCount<e&&s++,t.sizeBytes!==void 0&&t.sizeBytes>0&&t.sizeBytes<n&&s++,t.dependencyCount!==void 0&&t.dependencyCount<r&&s++,s}function Wf(t){return Kr(t,Of,Bf,Vf)>=2?"nano":Kr(t,Df,Uf,Gf)>=2?"micro":Kr(t,qf,Hf,zf)>=2?"small":"standard"}function Jf(t){switch(t){case "nano":return "nano";case "micro":case "function":return "micro";case "small":return "small";default:return "standard"}}function qy(t){switch(t){case "nano":return 1/os;case "micro":return 1/is;case "small":return 1/as;default:return 1}}function Kf(t){let e=0,n=0,r=0,s=0;for(let i of t)switch(Jf(i.classification)){case "nano":e++;break;case "micro":n++;break;case "small":r++;break;default:s++;break}let o=s+r/as+n/is+e/os;return {nanoCount:e,microCount:n,smallCount:r,standardCount:s,totalScanned:e+n+r+s,nanoBillingRatio:os,microBillingRatio:is,smallBillingRatio:as,billableProjectsRaw:Math.round(o*100)/100,billableProjects:Math.floor(o)}}var Yf={N:.85,A:.62,L:.55,P:.2},Xf={L:.77,H:.44},Qf={N:.85,R:.62},Zf={N:.85,L:.62,H:.27},ed={N:.85,L:.68,H:.5},Yr={H:.56,L:.22,N:0};function td(t){let e=Math.round(t*1e5);return e%1e4===0?e/1e5:(Math.floor(e/1e4)+1)/10}function Gi(t){if(!t||typeof t!="string")return null;let e=t.trim().split("/");if(!e.length||!/^CVSS:3\.[01]$/i.test(e[0]))return null;let n={};for(let g of e.slice(1)){let[v,S]=g.split(":");v&&S&&(n[v.toUpperCase()]=S.toUpperCase());}let r=n.S==="C",s=Yf[n.AV],o=Xf[n.AC],i=Qf[n.UI],a=(r?ed:Zf)[n.PR],c=Yr[n.C],l=Yr[n.I],u=Yr[n.A];if([s,o,i,a,c,l,u].some(g=>g===void 0))return null;let p=1-(1-c)*(1-l)*(1-u),f=r?7.52*(p-.029)-3.25*Math.pow(p-.02,15):6.42*p;if(f<=0)return 0;let d=8.22*s*o*a*i,h=Math.min(r?1.08*(f+d):f+d,10);return td(h)}function qi(t){return t>=9?"critical":t>=7?"high":t>=4?"moderate":t>0?"low":"unknown"}function ur(t){switch(t){case "critical":return 4;case "high":return 3;case "moderate":return 2;case "low":return 1;default:return 0}}function Hi(t){switch((t??"").trim().toLowerCase()){case "critical":return "critical";case "high":return "high";case "moderate":case "medium":return "moderate";case "low":return "low";default:return "unknown"}}var nd="https://api.osv.dev/v1/querybatch",rd="https://api.osv.dev/v1/vulns/",sd=15e3,si=500,od=3,id=250,ad=new Set([408,425,429,500,502,503,504]);function cd(t){switch(t){case "node":case "typescript":return "npm";case "python":return "pypi";case "java":return "maven";case "dotnet":return "nuget";case "go":return "go";case "rust":return "cargo";case "php":return "composer";case "ruby":return "rubygems";case "dart":return "pub";case "elixir":return "hex";default:return null}}function ld(t){switch(t){case "npm":return "npm";case "pypi":return "PyPI";case "maven":return "Maven";case "nuget":return "NuGet";case "go":return "Go";case "cargo":return "crates.io";case "composer":return "Packagist";case "rubygems":return "RubyGems";case "pub":return "Pub";case "hex":return "Hex"}}function ud(){return {low:0,moderate:0,high:0,critical:0,unknown:0}}function rn(t){return `${t.ecosystem}\0${t.package}\0${t.version}`}function pd(t){let e=new Set,n=[];for(let r of t){let s=cd(r.type);if(s)for(let o of r.dependencies){if(!o.resolvedVersion)continue;let i={ecosystem:s,package:o.package,version:o.resolvedVersion},a=rn(i);e.has(a)||(e.add(a),n.push(i));}}return n.sort((r,s)=>r.ecosystem.localeCompare(s.ecosystem)||r.package.localeCompare(s.package)||r.version.localeCompare(s.version)),n}function zi(t,e,n){if(n&&n.includes(t))return true;let r=he.valid(he.coerce(t));if(!r)return false;for(let s of e??[]){let o=s.introduced&&s.introduced!=="0"?he.valid(he.coerce(s.introduced)):"0.0.0",i=s.fixed?he.valid(he.coerce(s.fixed)):null,a=o?he.gte(r,o):true,c=i?he.lt(r,i):true;if(a&&c)return true}return false}function fd(t,e){let n=t.severity?.find(p=>(p.type??"").toUpperCase().startsWith("CVSS_V3"))?.score??null,r=Gi(n),s=e.toLowerCase(),o=(t.affected??[]).filter(p=>(p.package?.name??"").toLowerCase()===s),i=t.database_specific?.severity??o.map(p=>p.ecosystem_specific?.severity??p.database_specific?.severity).find(Boolean)??null,a=r!=null?qi(r):Hi(i),c=[],l=[],u=[];for(let p of o){for(let f of p.ranges??[]){let d,h=false;for(let g of f.events??[])g.introduced!==void 0&&(d=g.introduced==="0"?void 0:g.introduced,h=true),g.fixed&&(c.includes(g.fixed)||c.push(g.fixed),l.push({introduced:d,fixed:g.fixed}),h=false,d=void 0);h&&l.push({introduced:d});}for(let f of p.versions??[])u.includes(f)||u.push(f);}return {id:t.id??"UNKNOWN",aliases:Array.isArray(t.aliases)?t.aliases:[],summary:t.summary??null,severity:a,cvss:r,cvssVector:n,fixedVersions:c,published:t.published??null,withdrawn:t.withdrawn??null,references:(t.references??[]).map(p=>p.url).filter(p=>!!p),...l.length?{affectedRanges:l}:{},...u.length?{affectedVersions:u}:{}}}function Wi(t){let e=typeof t.cvss=="number"?t.cvss:Gi(t.cvssVector??null),n=t.severity?Hi(t.severity):e!=null?qi(e):"unknown";return {id:t.id,aliases:t.aliases??[],summary:t.summary??null,severity:n,cvss:e,cvssVector:t.cvssVector??null,fixedVersions:(t.ranges??[]).map(r=>r.fixed).filter(r=>!!r),published:t.published??null,withdrawn:t.withdrawn??null,references:t.references??[],...t.ranges?.length?{affectedRanges:t.ranges}:{},...t.versions?.length?{affectedVersions:t.versions}:{}}}function dd(t){return new Promise(e=>setTimeout(e,t))}async function Ji(t,e,n){return n.run(async()=>{for(let r=0;;r++){let s=new AbortController,o=setTimeout(()=>s.abort(),sd);try{let i=await fetch(t,{...e,signal:s.signal});if(i.ok)return {ok:!0,data:await i.json()};if(!ad.has(i.status))return {ok:!1}}catch{}finally{clearTimeout(o);}if(r>=od)return {ok:false};await dd(id*2**r);}})}async function md(t,e){let n=new Map,r=true;for(let s=0;s<t.length;s+=si){let o=t.slice(s,s+si),i=JSON.stringify({queries:o.map(l=>({version:l.version,package:{name:l.package,ecosystem:ld(l.ecosystem)}}))}),a=await Ji(nd,{method:"POST",body:i,headers:{"content-type":"application/json"}},e);if(!a.ok){r=false;continue}let c=a.data;if(!c?.results){r=false;continue}for(let l=0;l<o.length;l++){let u=(c.results[l]?.vulns??[]).map(p=>p.id).filter(p=>!!p);u.length&&n.set(rn(o[l]),u);}}return {idsByTarget:n,allBatchesOk:r}}async function hd(t,e){let n=new Map;return await Promise.all([...t].map(async r=>{let s=await Ji(`${rd}${encodeURIComponent(r)}`,{method:"GET"},e);s.ok&&s.data&&n.set(r,s.data);})),n}function Ki(t,e){e.sort((s,o)=>s.ecosystem.localeCompare(o.ecosystem)||s.package.localeCompare(o.package)||s.version.localeCompare(o.version));let n=ud(),r=0;for(let s of e){s.advisories.sort((i,a)=>ur(a.severity)-ur(i.severity)||i.id.localeCompare(a.id)),r+=s.advisories.length;let o=s.advisories.reduce((i,a)=>ur(a.severity)>ur(i)?a.severity:i,"unknown");n[o]++;}return {source:t,packages:e,totalAdvisories:r,severityCounts:n}}function cs(){return {source:"none",packages:[],totalAdvisories:0,severityCounts:{low:0,moderate:0,high:0,critical:0,unknown:0}}}async function gd(t,e){if(t.length===0)return cs();if(e.offline)return oi(t,e.manifest);let{idsByTarget:n,allBatchesOk:r}=await md(t,e.sem);if(n.size===0){let c=oi(t,e.manifest);return c.packages.length?c:{...cs(),source:r?"osv":"unreachable"}}let s=new Set;for(let c of n.values())for(let l of c)s.add(l);let o=await hd(s,e.sem),i=Yi(t,e.manifest),a=[];for(let c of t){let l=n.get(rn(c))??[],u=[],p=new Set;for(let f of l){let d=o.get(f);!d||d.withdrawn||(u.push(fd(d,c.package)),p.add(f));}for(let f of i.get(rn(c))??[])p.has(f.id)||u.push(f);u.length&&a.push({...c,advisories:u});}return Ki("osv",a)}function Yi(t,e){let n=new Map;if(!e)return n;for(let r of t){let o=(W(e,r.ecosystem,r.package)?.vulns??[]).filter(i=>!i.withdrawn&&zi(r.version,i.ranges,i.versions));o.length&&n.set(rn(r),o.map(Wi));}return n}function oi(t,e){let n=Yi(t,e);if(n.size===0)return cs();let r=[];for(let s of t){let o=n.get(rn(s));o?.length&&r.push({...s,advisories:o});}return Ki("manifest",r)}var yd="vibgrate/vulnerability";function vd(t){switch(t){case "critical":case "high":return "error";case "moderate":return "warning";default:return "note"}}function bd(t){let e=[];for(let n of t.packages)for(let r of n.advisories){let s=r.aliases.find(l=>l.startsWith("CVE-")),o=s&&s!==r.id?`${r.id} (${s})`:r.id,i=r.fixedVersions.length?` \u2014 fixed in ${r.fixedVersions.join(", ")}`:" \u2014 no fix available",a=r.cvss!=null?` ${r.cvss}`:"",c=r.introduced!=null?` \u2014 introduced by ${r.introduced.authorName} in ${r.introduced.shortSha}${r.exposureDays!=null?` (${r.exposureDays}d exposed)`:""}`:"";e.push({ruleId:yd,level:vd(r.severity),message:`${n.package}@${n.version}: ${o} (${r.severity}${a})${i}${c}`,location:n.package,details:{ecosystem:n.ecosystem,package:n.package,installedVersion:n.version,advisoryId:r.id,aliases:r.aliases,severity:r.severity,cvss:r.cvss,fixedVersions:r.fixedVersions,...r.introduced?{introducedBy:r.introduced.authorName,introducedSha:r.introduced.shortSha,introducedDate:r.introduced.date,exposureDays:r.exposureDays}:{}}});}return e}var wd=new Set(["node_modules",".git","dist","build","out",".vibgrate","vendor",".venv","venv","env","__pycache__","target",".next",".nuxt","coverage",".cache"]),ii=8e3,Sd=12,kd=1048576,xd=5,Ed={npm:new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts",".vue",".svelte"]),pypi:new Set([".py"])};function jd(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Td(t,e){let n=jd(e);return t==="npm"?new RegExp(`(?:from\\s+|require\\(\\s*|import\\(\\s*)['"]${n}(?:/[^'"]*)?['"]`,"g"):t==="pypi"?new RegExp(`^\\s*(?:import\\s+${n}(?:[.\\s]|$)|from\\s+${n}(?:[.\\s]))`,"gm"):null}function Cd(t,e,n){let r={importSites:0,filesTouched:0,sampleFiles:[]};if(n==="unknown")return r;let s=Ed[n],o=Td(n,e);if(!s||!o)return r;let i=0,a=0,c=[],l=0,u=(p,f)=>{if(f>Sd||l>=ii)return;let d;try{d=on.readdirSync(p,{withFileTypes:!0});}catch{return}d.sort((h,g)=>h.name.localeCompare(g.name));for(let h of d){if(l>=ii)return;if(h.isDirectory()){if(wd.has(h.name)||h.name.startsWith("."))continue;u(B.join(p,h.name),f+1);}else if(h.isFile()&&s.has(B.extname(h.name))){l++;let g=B.join(p,h.name),v;try{if(on.statSync(g).size>kd)continue;v=on.readFileSync(g,"utf8");}catch{continue}o.lastIndex=0;let S=v.match(o);S&&S.length&&(i+=S.length,a++,c.length<xd&&c.push(B.relative(t,g).replace(/\\/g,"/")));}}};return u(t,0),c.sort(),{importSites:i,filesTouched:a,sampleFiles:c}}function Ad(t,e,n){let r=t?Be.valid(Be.coerce(t)):null,s=e?Be.valid(Be.coerce(e)):null;if(!r||!s)return {majorsBehind:n??null,interimMajors:[]};let o=Be.major(r),i=Be.major(s),a=n??Math.max(0,i-o),c=[];for(let l=o+1;l<i;l++)c.push(`${l}.x`);return {majorsBehind:a,interimMajors:c}}function Pd(t,e){let n=e.filesTouched;return !t||t<=0?n>0?"low":"none":n===0?"low":n>20||t>=2&&n>5?"high":n>5||t>=2?"moderate":"low"}function Md(t,e,n){return t!=null&&t>=2?"multi-major-plan":t===1?"single-major":e&&n&&e!==n?"patch-minor":"current"}function Hy(t,e,n={}){let{majorsBehind:r,interimMajors:s}=Ad(e.currentVersion,e.latestVersion,e.majorsBehind),o=Cd(t,e.package,e.ecosystem),i=Pd(r,o),a=Md(r,e.currentVersion,e.latestVersion),c=n.fixesVulnerabilities??[],l=[];return s.length&&l.push(`Step through ${s.join(" \u2192 ")} before the latest major rather than jumping directly.`),o.filesTouched===0&&r&&r>0?l.push("No direct source usage found \u2014 likely a transitive or config-only dependency; upgrade risk is mostly indirect."):o.filesTouched>0&&l.push(`Used at ${o.importSites} import site(s) across ${o.filesTouched} file(s) \u2014 review these when upgrading.`),c.length&&l.push(`Upgrading also remediates ${c.length} open advisory(ies): ${c.join(", ")}.`),{package:e.package,ecosystem:e.ecosystem,currentVersion:e.currentVersion,latestVersion:e.latestVersion,majorsBehind:r,interimMajors:s,usage:o,blastRadius:i,recommendation:a,fixesVulnerabilities:c,notes:l}}var $d=12e3,Ld=100,Xr={source:"none",repositoryUrl:null,releasesScanned:0,breakingReleases:[],notes:[]},Nd={npm:"npmjs.org",pypi:"pypi.org",maven:"repo1.maven.org",nuget:"nuget.org",go:"proxy.golang.org",cargo:"crates.io",composer:"packagist.org",rubygems:"rubygems.org",pub:"pub.dev",hex:"hex.pm"},Xi=[{re:/breaking[\s-]?change/i,label:"breaking change"},{re:/\bbreaking\b/i,label:"breaking"},{re:/\bdrop(?:ped|s)?\s+support\b/i,label:"dropped support"},{re:/\bremoved?\b/i,label:"removal"},{re:/\bdeprecat/i,label:"deprecation"},{re:/\bmigrat/i,label:"migration"},{re:/\brenamed?\b/i,label:"rename"},{re:/\bno longer\b/i,label:"no longer supported"},{re:/\bincompatib/i,label:"incompatibility"}];function Rd(t){if(!t)return [];let e=new Set;for(let{re:n,label:r}of Xi)n.test(t)&&e.add(r);return [...e]}function Id(t){if(!t)return null;for(let{re:e}of Xi){let n=e.exec(t);if(n&&n.index!=null){let r=Math.max(0,n.index-60),s=t.slice(r,n.index+100).replace(/\s+/g," ").trim();return (r>0?"\u2026":"")+s+(n.index+100<t.length?"\u2026":"")}}return null}function _d(t){if(!t)return null;let e=t.match(/github\.com[/:]([^/]+)\/([^/#?]+?)(?:\.git)?(?:[/#?].*)?$/i);return e?{owner:e[1],repo:e[2]}:null}function Fd(t,e){let n=t.trim();if(e){for(let r of [`${e}@`,`${e}-v`,`${e}-`,`${e}/`,`${e}_`])if(n.startsWith(r)){n=n.slice(r.length);break}}return n=n.replace(/^v/i,""),K.valid(K.coerce(n))}function Od(t,e,n){let r=K.valid(K.coerce(t)),s=K.valid(K.coerce(e)),o=K.valid(K.coerce(n));return !r||!s||!o?false:K.gt(r,s)&&K.lte(r,o)}function Bd(t,e,n,r){let s=[];for(let o of t){if(o.draft)continue;let i=o.tag_name??o.name??"",a=Fd(i,r);if(!a||!Od(a,e,n))continue;let c=[o.name,o.body].filter(Boolean).join(`
80
+ `),l=Rd(c);l.length&&s.push({version:a,tag:i,url:o.html_url??null,date:o.published_at??null,signals:l,excerpt:Id(c)});}return s.sort((o,i)=>K.lt(o.version,i.version)?-1:K.gt(o.version,i.version)?1:o.tag.localeCompare(i.tag)),s}async function Qi(t){let e=new AbortController,n=setTimeout(()=>e.abort(),$d);try{let r=await fetch(t,{signal:e.signal,headers:{"user-agent":"vibgrate-cli",accept:"application/json"}});return r.ok?await r.json():null}catch{return null}finally{clearTimeout(n);}}async function Vd(t,e){let n=Nd[t];if(!n)return null;let s=(await Qi(`https://packages.ecosyste.ms/api/v1/registries/${n}/packages/${encodeURIComponent(e)}`))?.repository_url;return typeof s=="string"?s:null}async function zy(t,e,n,r,s={}){if(t==="unknown"||!n||!r)return Xr;let o=s.repositoryUrl??await Vd(t,e),i=_d(o);if(!i)return {...Xr,repositoryUrl:o??null,notes:["no GitHub repository resolved for this package \u2014 changelog signals unavailable"]};let a=s.fetchReleases?await s.fetchReleases(i.owner,i.repo):await Qi(`https://api.github.com/repos/${i.owner}/${i.repo}/releases?per_page=${Ld}`);if(!Array.isArray(a))return {...Xr,repositoryUrl:o,notes:["could not fetch releases (network, rate limit, or no GitHub Releases)"]};let c=Bd(a,n,r,e),l=[];return a.length===0?l.push("the repository publishes no GitHub Releases"):c.length===0&&l.push("no breaking-change signals found in releases across this version span"),{source:"github-releases",repositoryUrl:o,releasesScanned:a.length,breakingReleases:c,notes:l}}var Ud=15e3,Gd=64*1024*1024,Zi=500,qd="";function Fn(t,e){return new Promise(n=>{execFile("git",e,{cwd:t,timeout:Ud,maxBuffer:Gd,windowsHide:true,encoding:"utf8",env:{...process.env,GIT_TERMINAL_PROMPT:"0",GIT_OPTIONAL_LOCKS:"0",GIT_PAGER:"cat"}},(r,s)=>{n(r?{ok:false,stdout:""}:{ok:true,stdout:typeof s=="string"?s:String(s)});});})}var ai=new Map;function ea(t){return t.split(B.sep).join("/")}async function cn(t){let e=B.resolve(t),n=ai.get(e);if(n!==void 0)return n;let r=await Fn(e,["rev-parse","--show-toplevel"]),s=r.ok&&r.stdout.trim()||null;return ai.set(e,s),s}async function Hd(t){return await cn(t)!==null}async function zd(t){let e=await cn(t);if(!e)return null;let n=await Fn(e,["rev-parse","HEAD"]);return n.ok&&n.stdout.trim()||null}async function Wd(t,e,n={}){let r=await cn(t);if(!r)return [];let s=Math.max(1,n.maxCommits??Zi),o=["%H","%h","%an","%ae","%aI","%s"].join("%x1f"),i=await Fn(r,["log",`--max-count=${s}`,"--follow",`--format=${o}`,"--",ea(e)]);if(!i.ok)return [];let a=[];for(let c of i.stdout.split(`
81
+ `)){if(!c)continue;let l=c.split(qd);l.length<6||a.push({sha:l[0],shortSha:l[1],authorName:l[2],authorEmail:l[3],date:l[4],subject:l[5]});}return a.reverse(),a}async function Jd(t,e,n){if(!/^[0-9a-f]{4,40}$/i.test(e))return null;let r=await cn(t);if(!r)return null;let s=await Fn(r,["show",`${e}:${ea(n)}`]);return s.ok?s.stdout:null}async function Kd(t){let e=await cn(t);if(!e)return;let n=await Fn(e,["status","--porcelain","--untracked-files=normal"]);if(n.ok)return n.stdout.trim().length>0}var ta=3,na="version-timeline.json";function ge(t,e,n){if(!e||!n)return;let r=t.get(e);if(r===void 0){t.set(e,n);return}let s=pt.valid(pt.coerce(r)),o=pt.valid(pt.coerce(n));s&&o?pt.gt(o,s)&&t.set(e,n):n>r&&t.set(e,n);}function ls(t){let e=new Map,n;try{n=JSON.parse(t);}catch{return e}if(!n||typeof n!="object")return e;let r=n,s=r.packages;if(s&&typeof s=="object"){let i=new Map;for(let a of Object.keys(s).sort()){if(!a)continue;let c="node_modules/",l=a.lastIndexOf(c);if(l===-1)continue;let u=a.slice(l+c.length);if(!u)continue;let p=s[a],f=p&&typeof p=="object"?p.version:void 0;if(typeof f!="string")continue;let d=a.split(c).length-1,h=i.get(u);(h===void 0||d<h)&&(e.set(u,f),i.set(u,d));}return e}let o=r.dependencies;return o&&typeof o=="object"&&ra(o,e),e}function ra(t,e){for(let n of Object.keys(t).sort()){let r=t[n];if(!r||typeof r!="object")continue;let s=r;typeof s.version=="string"&&!e.has(n)&&e.set(n,s.version),s.dependencies&&typeof s.dependencies=="object"&&ra(s.dependencies,e);}}function Yd(t){let e=t.replace(/^\//,""),n=-1;for(let i=e.startsWith("@")?1:0;i<e.length-1;i++)if(e[i]==="@"&&/[0-9]/.test(e[i+1])){n=i;break}let r,s;if(n>0)r=e.slice(0,n),s=e.slice(n+1);else {let i=e.lastIndexOf("/");if(i<=0)return null;r=e.slice(0,i),s=e.slice(i+1);}let o=s.match(/^[0-9][^_(\s]*/);return !r||!o?null:{name:r,version:o[0]}}function Xd(t){let e=new Map,n=false;for(let r of t.split(`
82
+ `)){if(/^\S/.test(r)){n=/^packages:\s*$/.test(r);continue}if(!n)continue;let s=r.match(/^ {2}(\S.*?):\s*$/);if(!s)continue;let o=s[1].trim();(o.startsWith("'")&&o.endsWith("'")||o.startsWith('"')&&o.endsWith('"'))&&(o=o.slice(1,-1));let i=Yd(o);i&&ge(e,i.name,i.version);}return e}function Qd(t){let e=t.split(",")[0].trim().replace(/^"/,"").replace(/"$/,""),n=e.indexOf("@",e.startsWith("@")?1:0);return n<=0?null:e.slice(0,n)}function Zd(t){let e=new Map,n=null;for(let r of t.split(`
83
+ `)){if(!r.trim()||r.trimStart().startsWith("#"))continue;if(/^\S/.test(r)||r.startsWith('"')){n=Qd(r.replace(/:\s*$/,""));continue}let s=r.match(/^\s+version:?\s+"?([^"\s]+)"?/);s&&n&&ge(e,n,s[1]);}return e}function ci(t){let e=new Map;for(let n of t.split(/\[\[package\]\]/)){let r=n.match(/^\s*name\s*=\s*"([^"]+)"/m),s=n.match(/^\s*version\s*=\s*"([^"]+)"/m);r&&s&&ge(e,r[1],s[1]);}return e}function em(t){let e=new Map,n;try{n=JSON.parse(t);}catch{return e}let r=n;for(let s of ["packages","packages-dev"]){let o=r?.[s];if(Array.isArray(o)){for(let i of o)if(i&&typeof i=="object"){let a=i.name,c=i.version;typeof a=="string"&&typeof c=="string"&&ge(e,a,c.replace(/^v/,""));}}}return e}function tm(t){let e=new Map,n=false;for(let r of t.split(`
84
+ `)){if(/^\S/.test(r)){n=false;continue}if(/^ {2}specs:\s*$/.test(r)){n=true;continue}if(!n)continue;let s=r.match(/^ {4}(\S+) \(([^)]+)\)\s*$/);s&&ge(e,s[1],s[2].split("-")[0].trim());}return e}function nm(t){let e=new Map,n=false;for(let r of t.split(`
85
+ `)){let s=r.replace(/\/\/.*$/,"").trim();if(!s)continue;if(n){if(s===")"){n=false;continue}let i=s.match(/^(\S+)\s+(v\S+)/);i&&ge(e,i[1],i[2]);continue}if(s==="require ("){n=true;continue}let o=s.match(/^require\s+(\S+)\s+(v\S+)/);o&&ge(e,o[1],o[2]);}return e}function rm(t){let e=new Map,n;try{n=JSON.parse(t);}catch{return e}let r=n;for(let s of ["default","develop"]){let o=r?.[s];if(!(!o||typeof o!="object"))for(let[i,a]of Object.entries(o)){let c=a&&typeof a=="object"?a.version:void 0;typeof c=="string"&&ge(e,i,c.replace(/^==/,"").trim());}}return e}function sm(t){let e=new Map,n=false,r=null;for(let s of t.split(`
86
+ `)){if(/^\S/.test(s)){n=/^packages:\s*$/.test(s),r=null;continue}if(!n)continue;let o=s.match(/^ {2}(\S+):\s*$/);if(o){r=o[1];continue}let i=s.match(/^ {4}version:\s*"?([^"\s]+)"?/);i&&r&&ge(e,r,i[1]);}return e}function om(t){let e=new Map,n=/"([^"]+)"\s*=>\s*\{:hex,\s*:\w+,\s*"([^"]+)"/g,r;for(;(r=n.exec(t))!==null;)ge(e,r[1],r[2]);return e}function im(t){let e=new Map,n;try{n=JSON.parse(t);}catch{return e}let r=n?.dependencies;if(!r||typeof r!="object")return e;for(let s of Object.values(r))if(!(!s||typeof s!="object"))for(let[o,i]of Object.entries(s)){let a=i&&typeof i=="object"?i.resolved:void 0;typeof a=="string"&&ge(e,o,a);}return e}var am=new Te({ignoreAttributes:true,parseTagValue:false,trimValues:true});function cm(t){return t==null?[]:Array.isArray(t)?t:[t]}function lm(t){return !!t&&!t.includes("${")&&!/[[\](),]/.test(t)}function um(t){let e=new Map;if(!t)return e;let n;try{n=am.parse(t);}catch{return e}let r=n?.project;if(!r||typeof r!="object")return e;let s={},o=r.properties;if(o&&typeof o=="object")for(let[l,u]of Object.entries(o))u!=null&&typeof u!="object"&&(s[l]=String(u));let i=r.version!=null?String(r.version):r.parent?.version!=null?String(r.parent.version):void 0;i&&(s["project.version"]=i,s["project.parent.version"]=i);let a=l=>l.replace(/\$\{([^}]+)\}/g,(u,p)=>s[p]??`\${${p}}`),c=r.dependencies?.dependency;for(let l of cm(c)){if(!l||typeof l!="object")continue;let u=l;if(u.version==null)continue;let p=u.groupId!=null?a(String(u.groupId)).trim():"",f=u.artifactId!=null?a(String(u.artifactId)).trim():"";if(!p||!f)continue;let d=a(String(u.version)).trim();lm(d)&&ge(e,`${p}:${f}`,d);}return e}var sa=[{ecosystem:"npm",basename:"package-lock.json",parse:ls},{ecosystem:"npm",basename:"npm-shrinkwrap.json",parse:ls},{ecosystem:"npm",basename:"pnpm-lock.yaml",parse:Xd},{ecosystem:"npm",basename:"yarn.lock",parse:Zd},{ecosystem:"pypi",basename:"poetry.lock",parse:ci},{ecosystem:"pypi",basename:"Pipfile.lock",parse:rm},{ecosystem:"cargo",basename:"Cargo.lock",parse:ci},{ecosystem:"composer",basename:"composer.lock",parse:em},{ecosystem:"rubygems",basename:"Gemfile.lock",parse:tm},{ecosystem:"go",basename:"go.mod",parse:nm},{ecosystem:"pub",basename:"pubspec.lock",parse:sm},{ecosystem:"hex",basename:"mix.lock",parse:om},{ecosystem:"nuget",basename:"packages.lock.json",parse:im},{ecosystem:"maven",basename:"gradle.lockfile",parse:$i},{ecosystem:"maven",basename:"pom.xml",parse:um}];function Ky(t,e){let n=B.basename(t),r=sa.find(s=>s.basename===n);return r?r.parse(e):ls(e)}function pm(){let t=[],e=new Map;for(let n of sa)e.has(n.ecosystem)||(e.set(n.ecosystem,[]),t.push(n.ecosystem)),e.get(n.ecosystem).push({basename:n.basename,parse:n.parse});return t.map(n=>({ecosystem:n,candidates:e.get(n)}))}async function fm(t){try{let e=await Ee.readFile(B.join(t,na),"utf8"),n=JSON.parse(e);if(n?.schema===ta&&n.timelines)return n.timelines}catch{}return null}async function dm(t,e){try{await Ee.mkdir(t,{recursive:!0});let n={schema:ta,timelines:e};await Ee.writeFile(B.join(t,na),JSON.stringify(n,null,2));}catch{}}async function mm(t,e,n,r,s){let o=await Wd(t,n,{maxCommits:s});if(!o.length)return null;let i=new Map,a=new Map,c=new Map,l=(p,f)=>{let d=c.get(p);d||(d=[],c.set(p,d)),d.push(f);};for(let p of o){let f=await Jd(t,p.sha,n);if(f==null)continue;let d=r(f);for(let[h,g]of i)g!==null&&!d.has(h)&&(i.set(h,null),l(h,{version:null,commit:p}));for(let[h,g]of d){if(i.get(h)===g)continue;i.set(h,g);let v=a.get(h);v||(v=[],a.set(h,v)),v.push({version:g,commit:p}),l(h,{version:g,commit:p});}}if(a.size===0)return null;let u=[...a.keys()].sort().map(p=>({ecosystem:e,name:p,changes:a.get(p),presence:c.get(p)}));return {ecosystem:e,lockfile:n,packages:u}}async function hm(t,e={}){if(!await cn(t))return null;let r=await zd(t);if(e.cacheDir&&r){let a=await fm(e.cacheDir);if(a&&a.head===r)return a}let s=e.maxCommits??Zi,o=[];for(let{ecosystem:a,candidates:c}of pm())for(let{basename:l,parse:u}of c){let p=await mm(t,a,l,u,s);if(p){o.push(p);break}}if(o.length===0)return null;let i={head:r,ecosystems:o};return e.cacheDir&&r&&await dm(e.cacheDir,i),i}function oa(t,e,n){return t.ecosystems.find(r=>r.ecosystem===e)?.packages.find(r=>r.name===n)}function Yy(t,e){for(let n of t.ecosystems){let r=n.packages.find(s=>s.name===e);if(r)return r}}var ia={critical:7,high:30,moderate:90,low:180,unknown:null};function us(t,e){let n=Date.parse(t),r=Date.parse(e);return !Number.isFinite(n)||!Number.isFinite(r)?null:Math.max(0,Math.round((r-n)/864e5))}function gm(t){let e=t.fixedVersions.map(n=>Le.valid(Le.coerce(n))).filter(n=>!!n);return e.length?e.sort(Le.compare)[0]??null:null}function aa(t,e){if(e.affectedRanges&&e.affectedRanges.length||e.affectedVersions&&e.affectedVersions.length)return zi(t,e.affectedRanges,e.affectedVersions);let n=gm(e);if(!n)return true;let r=Le.valid(Le.coerce(t));return r?Le.lt(r,n):false}function ps(t){return {sha:t.sha,shortSha:t.shortSha,authorName:t.authorName,authorEmail:t.authorEmail,date:t.date,subject:t.subject}}function ym(t,e){if(!t||!t.changes.length)return null;let n=null;for(let r=t.changes.length-1;r>=0;r--){let s=t.changes[r];if(aa(s.version,e))n=ps(s.commit);else break}return n}function vm(t,e,n){if(!t)return [];let r=t.presence??t.changes.map(i=>({version:i.version,commit:i.commit})),s=[],o=null;for(let i of r){let a=i.version!=null&&aa(i.version,e);if(a&&!o)o=ps(i.commit);else if(!a&&o){let c=ps(i.commit);s.push({introduced:o,remediated:c,exposureDays:us(o.date,c.date),open:false}),o=null;}}return o&&s.push({introduced:o,remediated:null,exposureDays:us(o.date,n),open:true}),s}function bm(){return {low:0,moderate:0,high:0,critical:0,unknown:0}}function wm(t,e,n=ia,r=[]){let s=bm(),o=0,i=0,a=0,c=null,l=0,u=0;for(let d of t.packages)for(let h of d.advisories){o++,s[h.severity]++;let g=h.exposureDays??null;if(g!=null){a++,l+=g,u++,(c==null||g>c)&&(c=g);let v=n[h.severity];v!=null&&g>v&&i++;}}let p=r.length,f=r.reduce((d,h)=>d+h,0);return {openCount:o,openBySeverity:s,slaDays:n,slaBreaches:i,maxOpenExposureDays:c,meanOpenExposureDays:u>0?Math.round(l/u):null,attributedCount:a,remediatedCount:p,meanRemediationDays:p>0?Math.round(f/p):null,maxRemediationDays:p>0?Math.max(...r):null}}function Sm(t,e,n,r){if(!e)return [];let s=new Set,o=[],i=(a,c)=>{let l=`${a.ecosystem}\0${a.name}\0${c.id}`;if(!s.has(l)){s.add(l);for(let u of vm(a,c,n))!u.open&&u.exposureDays!=null&&o.push(u.exposureDays);}};for(let a of t.packages){let c=oa(e,a.ecosystem,a.package);if(c)for(let l of a.advisories)i(c,l);}if(r)for(let a of e.ecosystems)for(let c of a.packages){let l=W(r,c.ecosystem,c.name);for(let u of l?.vulns??[])u.withdrawn||i(c,Wi(u));}return o}function km(t,e,n,r={}){let s=r.slaDays??ia;for(let i of t.packages){let a=e?oa(e,i.ecosystem,i.package):void 0;for(let c of i.advisories){let l=ym(a,c);c.introduced=l,c.exposureDays=l?us(l.date,n):null;}}let o=Sm(t,e,n,r.manifest);return t.cra=wm(t,n,s,o),t}var xm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;baseUrl="https://api.nuget.org/v3-flatcontainer";get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"nuget",t);if(r){let s=(r.versions??[]).filter(a=>Ve.valid(a)&&Ve.prerelease(a)===null),i=[...s].sort(Ve.rcompare)[0]??null;return {latest:r.latest??i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`${this.baseUrl}/${t.toLowerCase()}/index.json`,o=await fetch(s,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let c=((await o.json()).versions??[]).filter(p=>Ve.valid(p)&&Ve.prerelease(p)===null),u=[...c].sort(Ve.rcompare)[0]??null;return {latest:u,stableVersions:c,latestStableOverall:u}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}};function pr(t){let e=t.replace(/^[vV]/,"").trim();if(/(?:a|b|rc|alpha|beta|dev|post)\d*/i.test(e))return null;let n=e.split(".");for(;n.length<3;)n.push("0");return e=n.slice(0,3).join("."),Ln.valid(e)}var Em=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"pypi",t);if(r){let s=[];for(let a of r.versions??[]){let c=pr(a);c&&s.push(c);}let i=[...s].sort(Ln.rcompare)[0]??null;return {latest:r.latest?pr(r.latest)??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://pypi.org/pypi/${encodeURIComponent(t)}/json`,o=await fetch(s,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let i=await o.json(),a=Object.keys(i.releases??{}),c=[];for(let d of a){let h=pr(d);h&&c.push(h);}let l=i.info?.version??null,u=l?pr(l):null,f=[...c].sort(Ln.rcompare)[0]??u??null;return {latest:u??f,stableVersions:c,latestStableOverall:f}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}};function Qr(t){let e=t.trim();if(/(?:[-.](?:SNAPSHOT|alpha|beta|rc|M\d+|CR\d+))/i.test(e))return null;e=e.replace(/\.(?:RELEASE|Final|GA)$/i,"");let n=e.split(".");for(;n.length<3;)n.push("0");return e=n.slice(0,3).join("."),Nn.valid(e)}var jm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t,e){let n=`${t}:${e}`,r=this.meta.get(n);if(r)return r;let s=this.sem.run(async()=>{let o=`${t}:${e}`,i=W(this.manifest,"maven",o);if(i){let a=[];for(let u of i.versions??[]){let p=Qr(u);p&&a.push(p);}let l=[...a].sort(Nn.rcompare)[0]??null;return {latest:i.latest?Qr(i.latest)??l:l,stableVersions:a,latestStableOverall:l}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let a=`https://search.maven.org/solrsearch/select?q=g:%22${encodeURIComponent(t)}%22+AND+a:%22${encodeURIComponent(e)}%22&core=gav&rows=100&wt=json`,c=await fetch(a,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!c.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let p=((await c.json()).response?.docs??[]).map(g=>g.v).filter(g=>typeof g=="string"),f=[];for(let g of p){let v=Qr(g);v&&f.push(v);}let h=[...f].sort(Nn.rcompare)[0]??null;return {latest:h,stableVersions:f,latestStableOverall:h}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(n,s),s}};function Zr(t){let e=t.trim();if(/(?:\.pre|\.rc|\.beta|\.alpha|\.dev)/i.test(e))return null;let n=e.split(".");if(n.length<2)return null;for(;n.length<3;)n.push("0");let r=n.slice(0,3).join(".");return Rn.valid(r)}var Tm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"rubygems",t);if(r){let s=[];for(let a of r.versions??[]){let c=Zr(a);c&&s.push(c);}let i=[...s].sort(Rn.rcompare)[0]??null;return {latest:r.latest?Zr(r.latest)??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://rubygems.org/api/v1/versions/${encodeURIComponent(t)}.json`,o=await fetch(s,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let i=await o.json();if(!Array.isArray(i))return {latest:null,stableVersions:[],latestStableOverall:null};let a=[];for(let u of i){if(u.prerelease)continue;let p=u.number;if(!p)continue;let f=Zr(p);f&&a.push(f);}let l=[...a].sort(Rn.rcompare)[0]??null;return {latest:l,stableVersions:a,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},Cm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"swift",t);if(r){let s=[];for(let a of r.versions??[]){let c=ce.valid(ce.clean(a));c&&s.push(c);}let i=[...s].sort(ce.rcompare)[0]??null;return {latest:r.latest?ce.valid(ce.clean(r.latest))??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=t.match(/github\.com[/:]([^/]+\/[^/]+?)(\.git)?$/i);if(!s)return {latest:null,stableVersions:[],latestStableOverall:null};let o=s[1],i=`https://api.github.com/repos/${o}/releases`,a=await fetch(i,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/vnd.github+json","User-Agent":"vibgrate-cli"}});if(!a.ok)return this.fetchFromTags(o);let c=await a.json();if(!Array.isArray(c))return {latest:null,stableVersions:[],latestStableOverall:null};let l=[];for(let f of c){if(f.prerelease||f.draft)continue;let d=f.tag_name;if(!d)continue;let h=ce.valid(ce.clean(d));h&&l.push(h);}let p=[...l].sort(ce.rcompare)[0]??null;return {latest:p,stableVersions:l,latestStableOverall:p}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}async fetchFromTags(t){try{let e=`https://api.github.com/repos/${t}/tags`,n=await fetch(e,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/vnd.github+json","User-Agent":"vibgrate-cli"}});if(!n.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let r=await n.json();if(!Array.isArray(r))return {latest:null,stableVersions:[],latestStableOverall:null};let s=[];for(let a of r){let c=a.name;if(!c||/(?:alpha|beta|rc|pre|dev)/i.test(c))continue;let l=ce.valid(ce.clean(c));l&&s.push(l);}let i=[...s].sort(ce.rcompare)[0]??null;return {latest:i,stableVersions:s,latestStableOverall:i}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}}},Am=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"go",t);if(r){let s=[];for(let a of r.versions??[]){let c=ve.valid(ve.clean(a));c&&s.push(c);}let i=[...s].sort(ve.rcompare)[0]??null;return {latest:r.latest?ve.valid(ve.clean(r.latest))??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let o=`https://proxy.golang.org/${encodeURIComponent(t)}/@v/list`,i=await fetch(o,{signal:AbortSignal.timeout(1e4),headers:{Accept:"text/plain"}});if(!i.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let c=(await i.text()).split(`
87
+ `).filter(Boolean),l=[];for(let f of c){if(/[+-](?:alpha|beta|rc|pre|dev)/i.test(f)||/v\d+\.\d+\.\d+-\d{14}-[a-f0-9]+/.test(f))continue;let d=ve.valid(ve.clean(f));d&&l.push(d);}let p=[...l].sort(ve.rcompare)[0]??null;return {latest:p,stableVersions:l,latestStableOverall:p}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},Pm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"cargo",t);if(r){let s=[];for(let a of r.versions??[]){let c=be.valid(be.clean(a));c&&s.push(c);}let i=[...s].sort(be.rcompare)[0]??null;return {latest:r.latest?be.valid(be.clean(r.latest))??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://crates.io/api/v1/crates/${encodeURIComponent(t)}`,o=await fetch(s,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json","User-Agent":"vibgrate-cli (https://github.com/vibgrate/vibgrate-cli)"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let i=await o.json();if(!i.versions)return {latest:null,stableVersions:[],latestStableOverall:null};let a=[];for(let u of i.versions){if(u.yanked||!u.num||/[+-](?:alpha|beta|rc|pre|dev)/i.test(u.num))continue;let p=be.valid(be.clean(u.num));p&&a.push(p);}let l=[...a].sort(be.rcompare)[0]??null;return {latest:l,stableVersions:a,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},Mm=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"composer",t);if(r){let s=[];for(let a of r.versions??[]){let c=we.valid(we.clean(a));c&&s.push(c);}let i=[...s].sort(we.rcompare)[0]??null;return {latest:r.latest?we.valid(we.clean(r.latest))??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://repo.packagist.org/p2/${encodeURIComponent(t)}.json`,o=await fetch(s,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let i=await o.json();if(!i.packages)return {latest:null,stableVersions:[],latestStableOverall:null};let a=i.packages[t];if(!a||!Array.isArray(a))return {latest:null,stableVersions:[],latestStableOverall:null};let c=[];for(let p of a){let f=p.version??p.version_normalized;if(!f||f==="dev-master"||f.startsWith("dev-")||/[+-](?:alpha|beta|rc|pre|dev)/i.test(f))continue;let d=we.valid(we.clean(f));d&&c.push(d);}let u=[...c].sort(we.rcompare)[0]??null;return {latest:u,stableVersions:c,latestStableOverall:u}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},$m=class{constructor(t,e,n=false){this.sem=t,this.manifest=e,this.offline=n;}meta=new Map;get(t){let e=this.meta.get(t);if(e)return e;let n=this.sem.run(async()=>{let r=W(this.manifest,"pub",t);if(r){let s=[];for(let a of r.versions??[]){let c=Se.valid(Se.clean(a));c&&s.push(c);}let i=[...s].sort(Se.rcompare)[0]??null;return {latest:r.latest?Se.valid(Se.clean(r.latest))??i:i,stableVersions:s,latestStableOverall:i}}if(this.offline)return {latest:null,stableVersions:[],latestStableOverall:null};try{let s=`https://pub.dev/api/packages/${encodeURIComponent(t)}`,o=await fetch(s,{signal:AbortSignal.timeout(1e4),headers:{Accept:"application/json"}});if(!o.ok)return {latest:null,stableVersions:[],latestStableOverall:null};let i=await o.json();if(!i.versions)return {latest:null,stableVersions:[],latestStableOverall:null};let a=[];for(let u of i.versions){if(!u.version||/[+-](?:alpha|beta|rc|pre|dev)/i.test(u.version))continue;let p=Se.valid(Se.clean(u.version));p&&a.push(p);}let l=[...a].sort(Se.rcompare)[0]??null;return {latest:l,stableVersions:a,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},Lm=/^(?:access[_-]?token|private[_-]?token|api[_-]?key|apikey|token|secret|password|passwd|auth|authorization|x-token|sig|signature|key)$/i;function Nm(t){let e=t.replace(/\/\/[^@/]+@/,"//"),n=e.indexOf("?");if(n===-1)return e;let r=e.slice(0,n),s=e.slice(n+1).split("&").filter(o=>!Lm.test(o.split("=")[0]??""));return s.length?`${r}?${s.join("&")}`:r}async function ca(t){try{return await Rm(t)}catch{return {type:"unknown"}}}async function Rm(t){let e=await Im(t);if(!e)return {type:"unknown"};let n=B.join(e,"HEAD"),r;try{r=(await Ee.readFile(n,"utf8")).trim();}catch{return {type:"unknown"}}let s,o;if(r.startsWith("ref: ")){let a=r.slice(5);o=a.startsWith("refs/heads/")?a.slice(11):a,s=await _m(e,a);}else /^[0-9a-f]{40}$/i.test(r)&&(s=r);let i=await Fm(e);return {type:"git",sha:s??void 0,shortSha:s?s.slice(0,7):void 0,branch:o??void 0,remoteUrl:i}}async function Im(t){let e=B.resolve(t),n=B.parse(e).root;for(;e!==n;){let r=B.join(e,".git");try{let s=await Ee.stat(r);if(s.isDirectory())return r;if(s.isFile()){let o=(await Ee.readFile(r,"utf8")).trim();if(o.startsWith("gitdir: "))return B.resolve(e,o.slice(8))}}catch{}e=B.dirname(e);}return null}async function _m(t,e){let n=B.join(t,e);try{let s=(await Ee.readFile(n,"utf8")).trim();if(/^[0-9a-f]{40}$/i.test(s))return s}catch{}let r=B.join(t,"packed-refs");try{let s=await Ee.readFile(r,"utf8");for(let o of s.split(`
88
+ `)){if(o.startsWith("#")||o.startsWith("^"))continue;let i=o.trim().split(" ");if(i.length>=2&&i[1]===e)return i[0]}}catch{}}async function Fm(t){let e=await Om(t);if(e)try{let r=(await Ee.readFile(e,"utf8")).match(/\[remote\s+"origin"\]([\s\S]*?)(?=\n\[|$)/);if(!r)return;let o=r[1]?.match(/\n\s*url\s*=\s*(.+)\s*/)?.[1]?.trim();return o?Nm(o):void 0}catch{return}}async function Om(t){let e=B.join(t,"config");try{if((await Ee.stat(e)).isFile())return e}catch{}let n=B.join(t,"commondir");try{let r=(await Ee.readFile(n,"utf8")).trim();if(!r)return;let s=B.resolve(t,r),o=B.join(s,"config");if((await Ee.stat(o)).isFile())return o}catch{return}}function Xy(t){let e=t.trim();if(!e)return null;let n=je.valid(e)?`>=${e}`:e;return je.validRange(n)?n:null}function Bm(t,e){if(je.valid(t)&&je.satisfies(t,e))return true;let n=je.valid(je.coerce(t));return n!=null&&je.satisfies(n,e)}function Qy(t,e){let n=[],r=false,s=null;for(let o of t.changes){let i=Bm(o.version,e);i!==r&&n.push({kind:i?"entered":"left",commit:o.commit,version:o.version,previousVersion:s}),r=i,s=o.version;}return n}function Re(t){return t.replace(/[^a-zA-Z0-9_]/g,"_")}function en(t){return t.replace(/"/g,'\\"')}function tn(t){return t===void 0||Number.isNaN(t)?"scoreUnknown":t>=80?"scoreHigh":t>=50?"scoreModerate":"scoreLow"}function Mn(t){let e=t.drift?.score;return typeof e=="number"?`${t.name} (${e})`:t.name}function ys(){return ["classDef scoreHigh fill:#1e293b,stroke:#10b981,color:#f1f5f9,stroke-width:2px","classDef scoreModerate fill:#1e293b,stroke:#f59e0b,color:#f1f5f9,stroke-width:2px","classDef scoreLow fill:#1e293b,stroke:#ef4444,color:#f1f5f9,stroke-width:2px","classDef scoreUnknown fill:#1e293b,stroke:#64748b,color:#94a3b8,stroke-width:2px"]}function Vm(t){let e=["flowchart LR"],n=new Map(t.map(i=>[i.path,i])),r=[],s=new Set;for(let i of t){let a=Re(i.projectId||i.path||i.name);for(let c of i.projectReferences??[]){let l=n.get(c.path);if(!l)continue;let u=Re(l.projectId||l.path||l.name);r.push(`${a} --> ${u}`),s.add(a),s.add(u);}}let o=s.size===0;for(let i of t){let a=Re(i.projectId||i.path||i.name);!o&&!s.has(a)||(e.push(`${a}["${en(Mn(i))}"]`),e.push(`class ${a} ${tn(i.drift?.score)}`));}return e.push(...r),e.push(...ys()),{mermaid:e.join(`
89
+ `)}}function Dm(t,e){let n=["flowchart LR"],r=new Map(e.map(a=>[a.path,a])),s=e.filter(a=>a.projectReferences?.some(c=>c.path===t.path)),o=(t.projectReferences??[]).map(a=>r.get(a.path)).filter(a=>!!a),i=Re(t.projectId||t.path||t.name);n.push(`${i}["${en(Mn(t))}"]`),n.push(`class ${i} ${tn(t.drift?.score)}`);for(let a of s){let c=Re(a.projectId||a.path||a.name);n.push(`${c}["${en(Mn(a))}"]`),n.push(`class ${c} ${tn(a.drift?.score)}`),n.push(`${c} --> ${i}`);}for(let a of o){let c=Re(a.projectId||a.path||a.name);n.push(`${c}["${en(Mn(a))}"]`),n.push(`class ${c} ${tn(a.drift?.score)}`),n.push(`${i} --> ${c}`);}return n.push(...ys()),{mermaid:n.join(`
90
+ `)}}function Um(t,e){let n=["flowchart TB"],r=Re(t.solutionId||t.path||t.name),s=t.drift?.score,o=typeof s=="number"?` (${s})`:" (n/a)";n.push(`${r}["${en(`${t.name}${o}`)}"]`),n.push(`class ${r} ${tn(s)}`);let i=new Map(e.map(a=>[a.path,a]));for(let a of t.projectPaths){let c=i.get(a);if(!c)continue;let l=Re(c.projectId||c.path||c.name);n.push(`${l}["${en(Mn(c))}"]`),n.push(`class ${l} ${tn(c.drift?.score)}`),n.push(`${r} --> ${l}`);for(let u of c.projectReferences??[]){let p=i.get(u.path);if(!p)continue;let f=Re(p.projectId||p.path||p.name);n.push(`${l} --> ${f}`);}}return n.push(...ys()),{mermaid:n.join(`
91
+ `)}}var qm=createRequire(import.meta.url),Hm=qm("../package.json");Hm.version;var zm="https://registry.npmjs.org/@vibgrate%2fcli/latest",pa=B.join($n.homedir(),".vibgrate"),Wm=B.join(pa,"update-check.json");async function n0(){try{let t=new AbortController,e=setTimeout(()=>t.abort(),1e4);e.unref?.();let n;try{n=await fetch(zm,{headers:{Accept:"application/json"},signal:t.signal});}finally{clearTimeout(e);}if(!n.ok)return null;let s=(await n.json()).version;return !s||!ua.default.valid(s)?null:(await Jm({latest:s,checkedAt:Date.now()}),s)}catch{return null}}async function Jm(t){try{await Ee.mkdir(pa,{recursive:!0}),await Ee.writeFile(Wm,JSON.stringify(t),"utf-8");}catch{}}var Km=[{category:"pricing",pattern:/price|pricing|billing|subscri|trial|credit|plan|tier|upgrade|premium|pro|enterprise/i},{category:"auth",pattern:/sign[- ]?in|sign[- ]?up|log[- ]?in|log[- ]?out|auth|sso|oauth|password|register|invite|onboard/i},{category:"dashboard",pattern:/dashboard|overview|home|main|summary|stats/i},{category:"settings",pattern:/setting|config|preference|option|profile|account/i},{category:"users",pattern:/user|member|team|role|permission|access|admin|owner/i},{category:"integrations",pattern:/integrat|connect|webhook|api[- ]?key|sync|import|export/i},{category:"reports",pattern:/report|analy|metric|chart|graph|insight|track/i},{category:"workflows",pattern:/workflow|automat|schedule|trigger|action|job|task|pipeline/i},{category:"projects",pattern:/project|workspace|organization|folder|repo/i},{category:"navigation",pattern:/menu|nav|sidebar|header|footer|breadcrumb/i}];function Ym(t,e=3){let n=t.topEvidence,r=n.filter(u=>u.kind==="dependency").map(u=>u.value).slice(0,10),s=eh(n.filter(u=>u.kind==="route").map(u=>u.value)).slice(0,15),o=n.filter(u=>u.kind!=="dependency"&&u.kind!=="route"&&u.kind!=="feature_flag"),i=new Map,a={};for(let u of o){let p=Xm(u.value);i.has(p)||i.set(p,new Set);let f=Qm(u.value);f.length>=3&&i.get(p).add(f);}let c=[];for(let[u,p]of i){let f=Zm([...p]);a[u]=f.length;for(let d of f.slice(0,e))c.push({kind:"text",value:d,category:u});}let l=n.filter(u=>u.kind==="feature_flag");return l.length>0&&(a.feature_flags=l.length,c.push({kind:"feature_flag",value:"feature flags detected",category:"feature_flags"})),{samples:c,categoryCounts:a,originalCount:n.length,dependencies:r,routes:s,detectedFrameworks:t.detectedFrameworks}}function Xm(t){for(let{category:e,pattern:n}of Km)if(n.test(t))return e;return "general"}function Qm(t){return t.toLowerCase().replace(/[^a-z0-9\s-]/g," ").replace(/\s+/g," ").trim().slice(0,60)}function Zm(t){let e=t.sort((r,s)=>s.length-r.length),n=[];for(let r of e)n.some(o=>{let i=r.slice(0,6);return o.startsWith(i)||o.includes(r)||r.includes(o)})||n.push(r);return n}function eh(t){let e=new Set,n=[];for(let r of t){let s=r.replace(/:[a-z_]+/gi,":param").replace(/\[\[*\.*\.*[a-z_]+\]*\]/gi,":param").replace(/\/+$/,"").toLowerCase();e.has(s)||(e.add(s),n.push(r));}return n}var nh=promisify(fa.gzip),ye=50;function En(t){let e=t.match(/^(.+?)\s*\(/);return e?e[1].trim():t.trim()}function rh(t){return {databaseTechnologies:t.databaseTechnologies.slice(0,10),connectionStrings:[],connectionPoolSettings:t.connectionPoolSettings.slice(0,ye),replicationSettings:t.replicationSettings.slice(0,20),readReplicaSettings:t.readReplicaSettings.slice(0,20),failoverSettings:t.failoverSettings.slice(0,20),collationAndEncoding:t.collationAndEncoding.slice(0,20),queryTimeoutDefaults:t.queryTimeoutDefaults.slice(0,20),manualIndexes:t.manualIndexes.map(En).slice(0,ye),tables:t.tables.map(En).slice(0,ye),views:t.views.map(En).slice(0,ye),storedProcedures:t.storedProcedures.map(En).slice(0,ye),triggers:t.triggers.map(En).slice(0,ye),rowLevelSecurityPolicies:t.rowLevelSecurityPolicies.slice(0,20),otherServices:t.otherServices.slice(0,20)}}function sh(t){let e=new Set;return {integrations:t.integrations.filter(r=>{let s=r.provider.split(":")[0];return e.has(s)?false:(e.add(s),true)}).slice(0,ye).map(r=>({provider:r.provider,endpoint:"",version:r.version,parameters:[],configOptions:[],authHints:[],files:[]})),openApiSpecifications:t.openApiSpecifications.slice(0,10),webhookUrls:t.webhookUrls.slice(0,20),callbackEndpoints:t.callbackEndpoints.slice(0,20),apiVersionPins:t.apiVersionPins.slice(0,20),tokenExpirationPolicies:t.tokenExpirationPolicies.slice(0,20),rateLimitOverrides:t.rateLimitOverrides.slice(0,20),customHeaders:t.customHeaders.slice(0,20),corsPolicies:t.corsPolicies.slice(0,20),oauthScopes:t.oauthScopes.slice(0,20),apiTokens:[]}}function oh(t){return {faviconFiles:t.faviconFiles.slice(0,1),productLogos:[]}}function ih(t){let e={...t};if(e.extended){let n={...e.extended};if(n.dataStores&&(n.dataStores=rh(n.dataStores)),n.apiSurface&&(n.apiSurface=sh(n.apiSurface)),n.assetBranding&&(n.assetBranding=oh(n.assetBranding)),n.uiPurpose){let r=Ym(n.uiPurpose);n.uiPurpose={enabled:n.uiPurpose.enabled,detectedFrameworks:r.detectedFrameworks,evidenceCount:r.originalCount,capped:n.uiPurpose.capped,topEvidence:[],unknownSignals:[],compacted:r};}if(n.runtimeConfiguration&&(n.runtimeConfiguration={...n.runtimeConfiguration,environmentVariables:n.runtimeConfiguration.environmentVariables.slice(0,100),hiddenConfigFiles:n.runtimeConfiguration.hiddenConfigFiles.slice(0,ye),startupArguments:n.runtimeConfiguration.startupArguments.slice(0,100)}),n.operationalResilience){let r=n.operationalResilience;n.operationalResilience={implicitTimeouts:r.implicitTimeouts.slice(0,30),defaultPaginationSize:r.defaultPaginationSize.slice(0,30),implicitRetryLogic:r.implicitRetryLogic.slice(0,30),defaultLocale:r.defaultLocale.slice(0,20),defaultCurrency:r.defaultCurrency.slice(0,20),implicitTimezone:r.implicitTimezone.slice(0,20),defaultCharacterEncoding:r.defaultCharacterEncoding.slice(0,20),sessionStores:r.sessionStores.slice(0,20),distributedLocks:r.distributedLocks.slice(0,20),jobSchedulers:r.jobSchedulers.slice(0,30),idempotencyKeys:r.idempotencyKeys.slice(0,20),rateLimitingCounters:r.rateLimitingCounters.slice(0,20),circuitBreakerState:r.circuitBreakerState.slice(0,20),abTestToggles:r.abTestToggles.slice(0,20),regionalEnablementRules:r.regionalEnablementRules.slice(0,20),betaAccessGroups:r.betaAccessGroups.slice(0,20),licensingEnforcementLogic:r.licensingEnforcementLogic.slice(0,20),killSwitches:r.killSwitches.slice(0,20),connectorRetryLogic:r.connectorRetryLogic.slice(0,20),apiPollingIntervals:r.apiPollingIntervals.slice(0,20),fieldMappings:r.fieldMappings.slice(0,20),schemaRegistryRules:r.schemaRegistryRules.slice(0,20),deadLetterQueueBehavior:r.deadLetterQueueBehavior.slice(0,20),dataMaskingRules:r.dataMaskingRules.slice(0,20),transformationLogic:r.transformationLogic.slice(0,20),timezoneHandling:r.timezoneHandling.slice(0,20),encryptionSettings:r.encryptionSettings.slice(0,30),hardcodedSecretSignals:r.hardcodedSecretSignals.slice(0,20)};}n.dependencyGraph&&(n.dependencyGraph={...n.dependencyGraph,phantomDependencies:n.dependencyGraph.phantomDependencies.slice(0,ye),phantomDependencyDetails:n.dependencyGraph.phantomDependencyDetails?.slice(0,ye),duplicatedPackages:n.dependencyGraph.duplicatedPackages.slice(0,ye)}),e.extended=n;}return e}async function ah(t){let e=JSON.stringify(t);return nh(e,{level:9})}async function s0(t){let e=ih(t);return {body:await ah(e),contentEncoding:"gzip"}}function ch(t){let n=t.replace(/[\x00-\x1F\x7F\uFEFF\u200B-\u200D\u2060]/g,"").trim().match(/^vibgrate\+(https?):?\/\/([^:]+):([^@]+)@([^/]+)\/(.+)$/);return n?{scheme:n[1],keyId:n[2],secret:n[3],host:n[4],workspaceId:n[5]}:null}async function o0(t,e,n){let r=e,s=new URL(`${t.scheme}://${r}/v1/ingest/scan/preflight`);n?.repositoryName&&s.searchParams.set("repository",n.repositoryName),n?.vcsSha&&s.searchParams.set("vcsSha",n.vcsSha);let o=String(Date.now()),i=await fetch(s.toString(),{method:"GET",headers:{"X-Vibgrate-Timestamp":o,Authorization:`VibgrateDSN ${t.keyId}:${t.secret}`}}),a=await i.json();if(!i.ok&&a.status!=="error")throw new Error(`HTTP ${i.status}: ${JSON.stringify(a)}`);return a}async function lh(t){let e=B.join(t,"package.json"),n$1=B.basename(t);if(await p(e))try{let r=await n(e);typeof r.name=="string"&&r.name.trim()&&(n$1=r.name.trim());}catch{}return n$1}var uh=new Set(["node_modules",".git",".vibgrate",".wrangler",".next","dist","build","out",".turbo",".cache","coverage","bin","obj",".vs","TestResults",".nuxt",".output",".svelte-kit"]);async function i0(t,e){let n=e??await ca(t);if(n.type==="git"&&n.sha)return {vcsSha:n.sha,method:"git_sha"};let r=await ph(t);return r?{treeHash:r,method:"tree_metadata"}:{method:"unknown"}}async function ph(t,e){let n=e?.maxFilesPerDirectory??500,r=[];async function s(i,a){let c;try{c=await Ee.readdir(i,{withFileTypes:!0});}catch{return}let l=c.filter(u=>u.isFile());if(l.length>n){r.push(`${a||"."}|dir_overflow|${l.length}`);return}for(let u of c){if(u.isDirectory()){if(uh.has(u.name))continue;let d=a?`${a}/${u.name}`:u.name;await s(B.join(i,u.name),d);continue}if(!u.isFile())continue;let p=a?`${a}/${u.name}`:u.name,f=B.join(i,u.name);try{let d=await Ee.stat(f);r.push(`${p}|${d.size}|${d.mtimeMs}`);}catch{}}}if(await s(B.resolve(t),""),r.length===0)return;r.sort();let o=ds.createHash("sha256");for(let i of r)o.update(i),o.update(`
92
+ `);return o.digest("hex")}var hh="https://api.vibgrate.com",gh=1e3*60*60*24,yh=5e3;function es(t){return !!t&&typeof t=="object"&&typeof t.generatedAt=="string"&&typeof t.products=="object"&&t.products!==null}var vh=class{apiBase;offline;manifest;cacheDir;fetchImpl;resolution=null;constructor(t={}){this.apiBase=(t.apiBase??process.env.VIBGRATE_API_BASE??hh).replace(/\/+$/,""),this.offline=t.offline??false,this.manifest=t.manifest,this.cacheDir=t.cacheDir??B.join($n.homedir(),".vibgrate","cache"),this.fetchImpl=t.fetchImpl??globalThis.fetch;}resolve(){return this.resolution||(this.resolution=this.doResolve()),this.resolution}get cacheFile(){return B.join(this.cacheDir,"runtimes.json")}async doResolve(){let t;if(!this.offline){let n=await this.readCache();if(n){if(Date.now()-Date.parse(n.fetchedAt)<gh)return {catalog:n.catalog,source:"cache"};t=n.catalog;}let r=await this.fetchFromApi();if(r)return await this.writeCache(r),{catalog:r,source:"api"}}let e=this.manifest?.runtimes;return es(e)?{catalog:e,source:"manifest"}:t&&Date.parse(t.generatedAt)>Date.parse(Ne.generatedAt)?{catalog:t,source:"cache"}:{catalog:Ne,source:"bundled"}}async fetchFromApi(){if(!this.fetchImpl)return null;let t=new AbortController,e=setTimeout(()=>t.abort(),yh);try{let n=await this.fetchImpl(`${this.apiBase}/v1/reference/runtimes`,{signal:t.signal,headers:{Accept:"application/json"}});if(!n.ok)return null;let r=await n.json();return es(r)?r:null}catch{return null}finally{clearTimeout(e);}}async readCache(){try{let t=await readFile(this.cacheFile,"utf8"),e=JSON.parse(t);if(e&&typeof e.fetchedAt=="string"&&es(e.catalog))return e}catch{}return null}async writeCache(t){try{await mkdir(this.cacheDir,{recursive:!0});let e={fetchedAt:new Date().toISOString(),catalog:t};await writeFile(this.cacheFile,JSON.stringify(e),"utf8");}catch{}}},xh=class ha{constructor(e){this.outPath=e;}events=[];start=Date.now();lastThrottled=new Map;flushed=false;static fromEnv(){let e=process.env.VIBGRATE_TRACE_EVENTS;return e?new ha(e):null}record(e,n={}){this.flushed||this.events.push({t:Date.now()-this.start,op:e,...n});}recordThrottled(e,n,r={},s=120){if(this.flushed)return;let o=Date.now(),i=this.lastThrottled.get(e)??0;o-i<s||(this.lastThrottled.set(e,o),this.record(n,r));}flush(e){if(this.flushed)return;this.flushed=true;let n={traceVersion:1,cliVersion:e.cliVersion,workspace:basename(e.rootDir)||e.rootDir,recordedAt:new Date().toISOString(),durationMs:Date.now()-this.start,events:this.events};try{mkdirSync(dirname(this.outPath),{recursive:!0}),writeFileSync(this.outPath,JSON.stringify(n));}catch{}}},fr=[k.cyan(" \u256D\u2500\u2500\u2500\u256E")+k.greenBright("\u279C"),k.cyan(" \u256D\u2524")+k.greenBright("\u25C9 \u25C9")+k.cyan("\u251C\u256E"),k.cyan(" \u2570\u2524")+k.dim("\u2500\u2500\u2500")+k.cyan("\u251C\u256F"),k.cyan(" \u2570\u2500\u2500\u2500\u256F")];function li(t){return [k.bold.white(" V I B G R A T E"),k.dim(" Drift Intelligence Engine")+k.dim(` v${t}`)]}var ui=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Eh=class{steps=[];stats={projects:0,dependencies:0,frameworks:0,findings:{warnings:0,errors:0,notes:0}};spinnerFrame=0;timer=null;lastRowCount=0;startTime=Date.now();isTTY;useLiveUpdates;rootDir="";lastFrame="";cursorHidden=false;estimatedTotalMs=null;stepEstimates=new Map;stepStartTimes=new Map;stepTimings=[];lastLoggedStates=new Map;version;trace;constructor(t,e="unknown"){if(this.version=e,this.trace=xh.fromEnv(),this.isTTY=process.stderr.isTTY??false,this.useLiveUpdates=this.isTTY&&process.env.VIBGRATE_PROGRESS_MODE!=="plain",this.rootDir=t,this.isTTY){let n=()=>{this.cursorHidden&&(process.stderr.write("\x1B[?25h"),this.cursorHidden=false);};process.on("exit",n),process.on("SIGINT",()=>{n(),process.exit(130);}),process.on("SIGTERM",()=>{n(),process.exit(143);});}}setEstimatedTotal(t){this.estimatedTotalMs=t,this.trace?.record("setEstimatedTotal",{estimatedMs:t});}setStepEstimates(t){this.stepEstimates=t;}getStepTimings(){return [...this.stepTimings]}setSteps(t){if(this.steps=t.map(e=>({...e,status:"pending",weight:e.weight??1})),this.trace?.record("setSteps",{steps:t.map(e=>({id:e.id,label:e.label,weight:e.weight??1}))}),this.isTTY){let e=["",` ${fr[0]} ${li(this.version)[0]}`,` ${fr[1]} ${li(this.version)[1]}`,` ${fr[2]}`,` ${fr[3]} ${k.dim(this.rootDir)}`,""].join(`
93
93
  `)+`
94
- `;process.stderr.write(e),this.useLiveUpdates&&this.startSpinner();}this.render();}insertStepBefore(t,e){let n=this.steps.findIndex(s=>s.id===t),r={...e,status:"pending",weight:e.weight??1};n>=0?this.steps.splice(n,0,r):this.steps.push(r),this.trace?.record("insertStepBefore",{beforeId:t,step:{id:e.id,label:e.label,weight:e.weight??1}});}startStep(t,e){let n=this.steps.find(r=>r.id===t);n&&(n.status="active",n.detail=void 0,n.count=void 0,n.subProgress=0,n.subTotal=e),this.stepStartTimes.set(t,Date.now()),this.trace?.record("startStep",{id:t,subTotal:e}),this.render();}completeStep(t,e,n){let r=this.steps.find(o=>o.id===t);r&&(r.status="done",r.detail=e,r.count=n);let s=this.stepStartTimes.get(t);s&&this.stepTimings.push({id:t,durationMs:Date.now()-s}),this.trace?.record("completeStep",{id:t,detail:e,count:n}),this.render();}skipStep(t){let e=this.steps.find(n=>n.id===t);e&&(e.status="skipped",e.detail="disabled"),this.trace?.record("skipStep",{id:t}),this.render();}updateStepProgress(t,e,n,r){let s=this.steps.find(o=>o.id===t);s&&(s.subProgress=e,n!==void 0&&(s.subTotal=n),r!==void 0&&(s.subLabel=r)),this.trace?.recordThrottled(`sub:${t}`,"updateStepProgress",{id:t,current:e,total:n,label:r}),this.render();}updateStats(t){Object.assign(this.stats,t),this.traceStats(true),this.render();}addProjects(t){this.stats.projects+=t,this.traceStats(),this.render();}addDependencies(t){this.stats.dependencies+=t,this.traceStats(),this.render();}addFrameworks(t){this.stats.frameworks+=t,this.traceStats(),this.render();}addFindings(t,e,n){this.stats.findings.warnings+=t,this.stats.findings.errors+=e,this.stats.findings.notes+=n,this.traceStats(),this.render();}traceStats(t=false){if(!this.trace)return;let e={stats:{...this.stats,findings:{...this.stats.findings},treeSummary:this.stats.treeSummary?{...this.stats.treeSummary}:void 0}};t?this.trace.record("stats",e):this.trace.recordThrottled("stats","stats",e);}finish(){if(this.timer&&(clearInterval(this.timer),this.timer=null),this.isTTY){let n="";this.lastRowCount>0&&(n+=`\x1B[${this.lastRowCount}A`,n+="\x1B[J"),n+="\x1B[?25h",n&&process.stderr.write(n),this.cursorHidden=false,this.lastRowCount=0;}let t=this.formatElapsed(Date.now()-this.startTime),e=this.steps.filter(n=>n.status==="done").length;process.stderr.write(E.dim(` \u2714 ${e} scanners completed in ${t}
94
+ `;process.stderr.write(e),this.useLiveUpdates&&this.startSpinner();}this.render();}insertStepBefore(t,e){let n=this.steps.findIndex(s=>s.id===t),r={...e,status:"pending",weight:e.weight??1};n>=0?this.steps.splice(n,0,r):this.steps.push(r),this.trace?.record("insertStepBefore",{beforeId:t,step:{id:e.id,label:e.label,weight:e.weight??1}});}startStep(t,e){let n=this.steps.find(r=>r.id===t);n&&(n.status="active",n.detail=void 0,n.count=void 0,n.subProgress=0,n.subTotal=e),this.stepStartTimes.set(t,Date.now()),this.trace?.record("startStep",{id:t,subTotal:e}),this.render();}completeStep(t,e,n){let r=this.steps.find(o=>o.id===t);r&&(r.status="done",r.detail=e,r.count=n);let s=this.stepStartTimes.get(t);s&&this.stepTimings.push({id:t,durationMs:Date.now()-s}),this.trace?.record("completeStep",{id:t,detail:e,count:n}),this.render();}skipStep(t){let e=this.steps.find(n=>n.id===t);e&&(e.status="skipped",e.detail="disabled"),this.trace?.record("skipStep",{id:t}),this.render();}updateStepProgress(t,e,n,r){let s=this.steps.find(o=>o.id===t);s&&(s.subProgress=e,n!==void 0&&(s.subTotal=n),r!==void 0&&(s.subLabel=r)),this.trace?.recordThrottled(`sub:${t}`,"updateStepProgress",{id:t,current:e,total:n,label:r}),this.render();}updateStats(t){Object.assign(this.stats,t),this.traceStats(true),this.render();}addProjects(t){this.stats.projects+=t,this.traceStats(),this.render();}addDependencies(t){this.stats.dependencies+=t,this.traceStats(),this.render();}addFrameworks(t){this.stats.frameworks+=t,this.traceStats(),this.render();}addFindings(t,e,n){this.stats.findings.warnings+=t,this.stats.findings.errors+=e,this.stats.findings.notes+=n,this.traceStats(),this.render();}traceStats(t=false){if(!this.trace)return;let e={stats:{...this.stats,findings:{...this.stats.findings},treeSummary:this.stats.treeSummary?{...this.stats.treeSummary}:void 0}};t?this.trace.record("stats",e):this.trace.recordThrottled("stats","stats",e);}finish(){if(this.timer&&(clearInterval(this.timer),this.timer=null),this.isTTY){let n="";this.lastRowCount>0&&(n+=`\x1B[${this.lastRowCount}A`,n+="\x1B[J"),n+="\x1B[?25h",n&&process.stderr.write(n),this.cursorHidden=false,this.lastRowCount=0;}let t=this.formatElapsed(Date.now()-this.startTime),e=this.steps.filter(n=>n.status==="done").length;process.stderr.write(k.dim(` \u2714 ${e} scanners completed in ${t}
95
95
 
96
- `)),this.trace?.record("finish",{doneCount:e,elapsedMs:Date.now()-this.startTime,summary:`${e} scanners completed in ${t}`}),this.trace?.flush({cliVersion:this.version,rootDir:this.rootDir}),this.isTTY&&process.platform==="win32"&&process.stdout.write("\x1B[0G\x1B[K");}startSpinner(){this.cursorHidden||(process.stderr.write("\x1B[?25l"),this.cursorHidden=true),this.timer=setInterval(()=>{this.spinnerFrame=(this.spinnerFrame+1)%oi.length,this.render();},120);}clearLines(){}render(){if(!this.useLiveUpdates){this.renderCI();return}let t=[];for(let h of this.steps)t.push(this.renderStep(h));t.push("");let e=this.steps.reduce((h,g)=>h+(g.weight??1),0),n=0;for(let h of this.steps){let g=h.weight??1;if(h.status==="done"||h.status==="skipped")n+=g;else if(h.status==="active"&&h.subTotal&&h.subTotal>0&&h.subProgress!==void 0)n+=g*Math.min(h.subProgress/h.subTotal,.99);else if(h.status==="active"){let v=this.stepStartTimes.get(h.id),w=this.stepEstimates.get(h.id);if(v&&w&&w>0){let j=Date.now()-v;n+=g*Math.min(j/w,.95);}}}let r=n/Math.max(e,1),s=e>0?Math.min(Math.round(r*100),99):0,i=vl(r,30),a=Date.now()-this.startTime,c=this.formatElapsed(a),l=this.computeEtaString(a,n,e),u=this.stats.treeSummary?E.dim(` \xB7 ${this.stats.treeSummary.totalFiles.toLocaleString()} files \xB7 ${this.stats.treeSummary.totalDirs.toLocaleString()} dirs`):"";t.push(` ${i} ${E.bold.white(`${s}%`)} ${E.dim(c)}${l}${u}`),t.push(""),t.push(this.renderStats()),t.push("");let p=t.join(`
96
+ `)),this.trace?.record("finish",{doneCount:e,elapsedMs:Date.now()-this.startTime,summary:`${e} scanners completed in ${t}`}),this.trace?.flush({cliVersion:this.version,rootDir:this.rootDir}),this.isTTY&&process.platform==="win32"&&process.stdout.write("\x1B[0G\x1B[K");}startSpinner(){this.cursorHidden||(process.stderr.write("\x1B[?25l"),this.cursorHidden=true),this.timer=setInterval(()=>{this.spinnerFrame=(this.spinnerFrame+1)%ui.length,this.render();},120);}clearLines(){}render(){if(!this.useLiveUpdates){this.renderCI();return}let t=[];for(let h of this.steps)t.push(this.renderStep(h));t.push("");let e=this.steps.reduce((h,g)=>h+(g.weight??1),0),n=0;for(let h of this.steps){let g=h.weight??1;if(h.status==="done"||h.status==="skipped")n+=g;else if(h.status==="active"&&h.subTotal&&h.subTotal>0&&h.subProgress!==void 0)n+=g*Math.min(h.subProgress/h.subTotal,.99);else if(h.status==="active"){let v=this.stepStartTimes.get(h.id),S=this.stepEstimates.get(h.id);if(v&&S&&S>0){let j=Date.now()-v;n+=g*Math.min(j/S,.95);}}}let r=n/Math.max(e,1),s=e>0?Math.min(Math.round(r*100),99):0,i=El(r,30),a=Date.now()-this.startTime,c=this.formatElapsed(a),l=this.computeEtaString(a,n,e),u=this.stats.treeSummary?k.dim(` \xB7 ${this.stats.treeSummary.totalFiles.toLocaleString()} files \xB7 ${this.stats.treeSummary.totalDirs.toLocaleString()} dirs`):"";t.push(` ${i} ${k.bold.white(`${s}%`)} ${k.dim(c)}${l}${u}`),t.push(""),t.push(this.renderStats()),t.push("");let p=t.join(`
97
97
  `)+`
98
- `,f=this.countRenderedRows(t);if(p===this.lastFrame&&this.lastRowCount===f)return;this.lastFrame=p;let d="";this.lastRowCount>0&&(d+=`\x1B[${this.lastRowCount}A`,d+="\x1B[J"),d+=p,process.stderr.write(d),this.lastRowCount=f;}countRenderedRows(t){let e=Math.max(process.stderr.columns??80,20);return t.reduce((n,r)=>n+this.countWrappedRows(r,e),0)}countWrappedRows(t,e){let n=Math.max(this.getDisplayWidth(t),1);return Math.max(1,Math.ceil(n/e))}getDisplayWidth(t){let e=this.stripAnsi(t).replace(/\r/g,""),n=0;for(let r of e){let s=r.codePointAt(0);s!==void 0&&(s>=0&&s<32||s>=127&&s<160||(n+=this.isWideCodePoint(s)?2:1));}return n}stripAnsi(t){return t.replace(/\x1b(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07\x1b]*(?:\x07|\x1b\\))/g,"")}isWideCodePoint(t){return t>=4352&&(t<=4447||t===9001||t===9002||t>=11904&&t<=42191&&t!==12351||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510||t>=127744&&t<=128591||t>=129280&&t<=129535||t>=131072&&t<=262141)}renderStep(t){let e=oi[this.spinnerFrame],n,r,s="";switch(t.status){case "done":n=E.green("\u2714"),r=E.white(t.label);break;case "active":if(n=E.cyan(e),r=E.bold.white(t.label),t.subTotal&&t.subTotal>0&&t.subProgress!==void 0&&t.subProgress>0&&(s=E.dim(` \xB7 ${t.subProgress.toLocaleString()} / ${t.subTotal.toLocaleString()}`)),t.subLabel){let i=t.subLabel.length>50?"\u2026"+t.subLabel.slice(-49):t.subLabel;s+=E.dim(` ${i}`);}break;case "skipped":n=E.dim("\u25CC"),r=E.dim.strikethrough(t.label);break;default:n=E.dim("\u25CB"),r=E.dim(t.label);break}return t.detail&&(s=E.dim(` \xB7 ${t.detail}`)),t.count!==void 0&&t.count>0&&(s+=E.cyan(` (${t.count})`)),` ${n} ${r}${s}`}renderStats(){let t=this.stats.projects,e=this.stats.dependencies,n=this.stats.frameworks,r=this.stats.findings.warnings,s=this.stats.findings.errors,o=this.stats.findings.notes,i=[E.bold.white(` ${t}`)+E.dim(` project${t!==1?"s":""}`),E.white(`${e}`)+E.dim(` dep${e!==1?"s":""}`),E.white(`${n}`)+E.dim(` framework${n!==1?"s":""}`)],a=[];return s>0&&a.push(E.red(`${s} \u2716`)),r>0&&a.push(E.yellow(`${r} \u26A0`)),o>0&&a.push(E.blue(`${o} \u2139`)),a.length>0&&i.push(a.join(E.dim(" \xB7 "))),` ${E.dim("\u2503")} ${i.join(E.dim(" \u2502 "))}`}renderCI(){for(let t of this.steps){let e=t.status==="done"?[t.status,t.detail??"",t.count?.toString()??""].join("|"):t.status;if(this.lastLoggedStates.get(t.id)!==e){if(this.lastLoggedStates.set(t.id,e),t.status==="active"){process.stderr.write(` \u25C9 ${t.label}...
98
+ `,f=this.countRenderedRows(t);if(p===this.lastFrame&&this.lastRowCount===f)return;this.lastFrame=p;let d="";this.lastRowCount>0&&(d+=`\x1B[${this.lastRowCount}A`,d+="\x1B[J"),d+=p,process.stderr.write(d),this.lastRowCount=f;}countRenderedRows(t){let e=Math.max(process.stderr.columns??80,20);return t.reduce((n,r)=>n+this.countWrappedRows(r,e),0)}countWrappedRows(t,e){let n=Math.max(this.getDisplayWidth(t),1);return Math.max(1,Math.ceil(n/e))}getDisplayWidth(t){let e=this.stripAnsi(t).replace(/\r/g,""),n=0;for(let r of e){let s=r.codePointAt(0);s!==void 0&&(s>=0&&s<32||s>=127&&s<160||(n+=this.isWideCodePoint(s)?2:1));}return n}stripAnsi(t){return t.replace(/\x1b(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07\x1b]*(?:\x07|\x1b\\))/g,"")}isWideCodePoint(t){return t>=4352&&(t<=4447||t===9001||t===9002||t>=11904&&t<=42191&&t!==12351||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510||t>=127744&&t<=128591||t>=129280&&t<=129535||t>=131072&&t<=262141)}renderStep(t){let e=ui[this.spinnerFrame],n,r,s="";switch(t.status){case "done":n=k.green("\u2714"),r=k.white(t.label);break;case "active":if(n=k.cyan(e),r=k.bold.white(t.label),t.subTotal&&t.subTotal>0&&t.subProgress!==void 0&&t.subProgress>0&&(s=k.dim(` \xB7 ${t.subProgress.toLocaleString()} / ${t.subTotal.toLocaleString()}`)),t.subLabel){let i=t.subLabel.length>50?"\u2026"+t.subLabel.slice(-49):t.subLabel;s+=k.dim(` ${i}`);}break;case "skipped":n=k.dim("\u25CC"),r=k.dim.strikethrough(t.label);break;default:n=k.dim("\u25CB"),r=k.dim(t.label);break}return t.detail&&(s=k.dim(` \xB7 ${t.detail}`)),t.count!==void 0&&t.count>0&&(s+=k.cyan(` (${t.count})`)),` ${n} ${r}${s}`}renderStats(){let t=this.stats.projects,e=this.stats.dependencies,n=this.stats.frameworks,r=this.stats.findings.warnings,s=this.stats.findings.errors,o=this.stats.findings.notes,i=[k.bold.white(` ${t}`)+k.dim(` project${t!==1?"s":""}`),k.white(`${e}`)+k.dim(` dep${e!==1?"s":""}`),k.white(`${n}`)+k.dim(` framework${n!==1?"s":""}`)],a=[];return s>0&&a.push(k.red(`${s} \u2716`)),r>0&&a.push(k.yellow(`${r} \u26A0`)),o>0&&a.push(k.blue(`${o} \u2139`)),a.length>0&&i.push(a.join(k.dim(" \xB7 "))),` ${k.dim("\u2503")} ${i.join(k.dim(" \u2502 "))}`}renderCI(){for(let t of this.steps){let e=t.status==="done"?[t.status,t.detail??"",t.count?.toString()??""].join("|"):t.status;if(this.lastLoggedStates.get(t.id)!==e){if(this.lastLoggedStates.set(t.id,e),t.status==="active"){process.stderr.write(` \u25C9 ${t.label}...
99
99
  `);continue}if(t.status==="done"){let n=this.formatLoggedStepDetail(t);process.stderr.write(` \u2714 ${t.label}${n}
100
100
  `);continue}if(t.status==="skipped"){let n=t.detail?` \xB7 ${t.detail}`:"";process.stderr.write(` \u25CC ${t.label}${n}
101
- `);}}}}formatLoggedStepDetail(t){let e="";return t.detail&&(e+=` \xB7 ${t.detail}`),t.count!==void 0&&t.count>0&&(e+=` (${t.count})`),e}formatElapsed(t){let e=t/1e3;if(e<90)return `${e.toFixed(1)}s`;let n=Math.floor(e/60),r=Math.floor(e%60);return `${n}m ${r.toString().padStart(2,"0")}s`}computeEtaString(t,e,n){if(n===0||t<2e3)return "";let r=e/n;if(r<.03){if(this.estimatedTotalMs!==null&&this.estimatedTotalMs>0){let i=Math.max(0,this.estimatedTotalMs-t);if(i>1e3)return E.dim(` \xB7 ~${this.formatElapsed(i)} left`)}return ""}let s=t/r*(1-r),o;if(this.estimatedTotalMs!==null&&this.estimatedTotalMs>0){let i=Math.max(0,this.estimatedTotalMs-t),a=Math.max(.1,1-r),c=i*a+s*(1-a);o=Math.min(i,c);}else o=s;return o<1500?"":E.dim(` \xB7 ~${this.formatElapsed(o)} left`)}},ua="scan_history.json",ii=10;async function pa(t){let e=B.join(t,".vibgrate",ua);try{let n=await xe.readFile(e,"utf8"),r=JSON.parse(n);return r.version===1&&Array.isArray(r.records)?r:null}catch{return null}}async function dh(t,e){let n=B.join(t,".vibgrate"),r=B.join(n,ua),s,o=await pa(t);o?(s=o,s.records.push(e),s.records.length>ii&&(s.records=s.records.slice(-ii))):s={version:1,records:[e]};try{await xe.mkdir(n,{recursive:!0}),await xe.writeFile(r,JSON.stringify(s,null,2)+`
102
- `,"utf8");}catch{}}function mh(t,e){if(!t||t.records.length===0)return null;let n=t.records.filter(s=>{if(s.totalFiles===0||e===0)return false;let o=e/s.totalFiles;return o>=.33&&o<=3});if(n.length>0){let s=0,o=0;for(let i=0;i<n.length;i++){let a=n[i],c=i+1,l=e/a.totalFiles;s+=a.totalDurationMs*l*c,o+=c;}return Math.round(s/o)}let r=t.records[t.records.length-1];if(r.totalFiles>0&&e>0){let s=e/r.totalFiles;return Math.round(r.totalDurationMs*s)}return r.totalDurationMs}function hh(t,e){let n=new Map;if(!t||t.records.length===0)return n;let r=null;for(let o=t.records.length-1;o>=0;o--){let i=t.records[o];if(i.steps.length>0){r=i;break}}if(!r)return n;let s=r.totalFiles>0&&e>0?e/r.totalFiles:1;for(let o of r.steps)n.set(o.id,Math.round(o.durationMs*s));return n}async function gh(t,e){let n=await e.findSolutionFiles(t),r=[];for(let s of n)try{let o=await e.readTextFile(s),i=B.dirname(s),c=[B.basename(t),B.relative(t,s).replace(/\\/g,"/")].join("/"),l=new Set,u=/Project\("[^"]*"\)\s*=\s*"([^"]*)",\s*"([^"]+\.(?:cs|vb)proj)"/g,p;for(;(p=u.exec(o))!==null;){let d=p[2],h=B.resolve(i,d.replace(/\\/g,"/"));l.add(B.relative(t,h).replace(/\\/g,"/"));}let f=B.basename(s,B.extname(s));r.push({path:c,name:f,type:"dotnet-sln",projectPaths:[...l]});}catch{}return r}async function t0(t,e$1,n$1){let r$1=e$1.vibgrateVersion??"unknown",s$1=Date.now(),o=await Jc(t),i=new a$1(e$1.concurrency),a=e$1.packageManifest?await Wl(e$1.packageManifest):void 0,c=e$1.offline===true,l=e$1.maxPrivacy===true,u=new eu(t,i,a,c),p$1=new dm(i,a,c),f=new mm(i,a,c),d$1=new hm(i,a,c),h=new gm(i,a,c),g=new ym(i,a,c),v=new vm(i,a,c),w=new bm(i,a,c),j=new wm(i,a,c),P=new Sm(i,a,c),C=new d,x=[...new Set([...o.exclude??[],...e$1.exclude??[]])];C.setExcludePatterns(x);let y=(e$1.projectScanTimeout??o.projectScanTimeout??180)*1e3;C.setMaxFileSize(o.maxFileSizeToScan??5242880),C.setProjectScanTimeout(y);let b=o.scanners,k=0,T=S=>{k+=S;},m=new fh(t,r$1),A=[{id:"config",label:"Loading configuration"},{id:"discovery",label:"Discovering workspace",weight:3},{id:"vcs",label:"Detecting version control"},{id:"walk",label:"Indexing files",weight:8},{id:"drift",label:"Computing drift score"},{id:"findings",label:"Generating findings"}];if(e$1.postScan&&A.push({id:"map",label:"Building code map"}),m.setSteps(A),m.completeStep("config","loaded"),!(c?true:await tu(t))){m.finish();let S=["",E.red.bold(" \u2716 Vibgrate cannot connect to the npm registry to check package versions."),"",E.dim(" Possible causes:"),E.dim(" \u2022 No internet connection"),E.dim(" \u2022 Corporate proxy/firewall blocking registry.npmjs.org"),E.dim(" \u2022 npm is not installed or not in PATH"),"",E.dim(" Try running: ")+E.cyan("npm view npm dist-tags.latest"),""].join(`
103
- `);throw new Error(S)}let I=await new ih({offline:c,manifest:a}).resolve(),V=I.catalog,pe=e(t,x);m.startStep("discovery");let H=await pe;m.updateStats({treeSummary:H}),m.completeStep("discovery",`${H.totalFiles.toLocaleString()} files \xB7 ${H.totalDirs.toLocaleString()} dirs`);let cn=await pa(t),vs=mh(cn,H.totalFiles);m.setEstimatedTotal(vs),m.setStepEstimates(hh(cn,H.totalFiles)),m.startStep("vcs");let Le=await na(t),fa=Le.type!=="unknown"?`${Le.type}${Le.branch?` ${Le.branch}`:""}${Le.shortSha?` @ ${Le.shortSha}`:""}`:"none detected";m.completeStep("vcs",fa),m.startStep("walk",H.totalFiles),await C.walkDir(t,(S,M)=>{m.updateStepProgress("walk",S,H.totalFiles,M);});let Fn=C.getWalkSummary(t);Fn&&(Fn.totalFiles!==H.totalFiles||Fn.totalDirs!==H.totalDirs)&&m.updateStats({treeSummary:Fn}),m.completeStep("walk",`${H.totalFiles.toLocaleString()} files indexed`);let qe=await hu(t,u,C,y,V);if(qe.length>0){m.insertStepBefore("drift",{id:"node",label:"Found Node projects",weight:4}),m.startStep("node");for(let S of qe)m.addDependencies(S.dependencies.length),m.addFrameworks(S.frameworks.length);k+=qe.length,m.addProjects(qe.length),m.completeStep("node",`${qe.length} project${qe.length!==1?"s":""}`,qe.length);}let He=await wu(t,p$1,C,y,V);if(He.length>0){m.insertStepBefore("drift",{id:"dotnet",label:"Found .NET projects",weight:2}),m.startStep("dotnet");for(let S of He)m.addDependencies(S.dependencies.length),m.addFrameworks(S.frameworks.length);k+=He.length,m.addProjects(He.length),m.completeStep("dotnet",`${He.length} project${He.length!==1?"s":""}`,He.length);}let ze=await Nu(t,f,C,y,V);if(ze.length>0){m.insertStepBefore("drift",{id:"python",label:"Found Python projects",weight:3}),m.startStep("python");for(let S of ze)m.addDependencies(S.dependencies.length),m.addFrameworks(S.frameworks.length);k+=ze.length,m.addProjects(ze.length),m.completeStep("python",`${ze.length} project${ze.length!==1?"s":""}`,ze.length);}let We=await Uu(t,d$1,C,y,V);if(We.length>0){m.insertStepBefore("drift",{id:"java",label:"Found Java projects",weight:3}),m.startStep("java");for(let S of We)m.addDependencies(S.dependencies.length),m.addFrameworks(S.frameworks.length);k+=We.length,m.addProjects(We.length),m.completeStep("java",`${We.length} project${We.length!==1?"s":""}`,We.length);}let Je=await ep(t,h,C,y,V);if(Je.length>0){m.insertStepBefore("drift",{id:"ruby",label:"Found Ruby projects",weight:2}),m.startStep("ruby");for(let S of Je)m.addDependencies(S.dependencies.length),m.addFrameworks(S.frameworks.length);k+=Je.length,m.addProjects(Je.length),m.completeStep("ruby",`${Je.length} project${Je.length!==1?"s":""}`,Je.length);}let Ke=await ip(t,g,C,y);if(Ke.length>0){m.insertStepBefore("drift",{id:"swift",label:"Found Swift projects",weight:2}),m.startStep("swift");for(let S of Ke)m.addDependencies(S.dependencies.length),m.addFrameworks(S.frameworks.length);k+=Ke.length,m.addProjects(Ke.length),m.completeStep("swift",`${Ke.length} project${Ke.length!==1?"s":""}`,Ke.length);}let Ye=await up(t,v,C,y,V);if(Ye.length>0){m.insertStepBefore("drift",{id:"go",label:"Found Go projects",weight:2}),m.startStep("go");for(let S of Ye)m.addDependencies(S.dependencies.length),m.addFrameworks(S.frameworks.length);k+=Ye.length,m.addProjects(Ye.length),m.completeStep("go",`${Ye.length} project${Ye.length!==1?"s":""}`,Ye.length);}let Xe=await yp(t,w,C,y);if(Xe.length>0){m.insertStepBefore("drift",{id:"rust",label:"Found Rust projects",weight:2}),m.startStep("rust");for(let S of Xe)m.addDependencies(S.dependencies.length),m.addFrameworks(S.frameworks.length);k+=Xe.length,m.addProjects(Xe.length),m.completeStep("rust",`${Xe.length} project${Xe.length!==1?"s":""}`,Xe.length);}let Qe=await xp(t,j,C,y);if(Qe.length>0){m.insertStepBefore("drift",{id:"php",label:"Found PHP projects",weight:2}),m.startStep("php");for(let S of Qe)m.addDependencies(S.dependencies.length),m.addFrameworks(S.frameworks.length);k+=Qe.length,m.addProjects(Qe.length),m.completeStep("php",`${Qe.length} project${Qe.length!==1?"s":""}`,Qe.length);}let Ze=await Pp(t,P,C,y);if(Ze.length>0){m.insertStepBefore("drift",{id:"dart",label:"Found Dart projects",weight:2}),m.startStep("dart");for(let S of Ze)m.addDependencies(S.dependencies.length),m.addFrameworks(S.frameworks.length);k+=Ze.length,m.addProjects(Ze.length),m.completeStep("dart",`${Ze.length} project${Ze.length!==1?"s":""}`,Ze.length);}let et=await Gp(t,a,C,y,c);if(et.length>0){m.insertStepBefore("drift",{id:"elixir",label:"Found Elixir projects",weight:2}),m.startStep("elixir");for(let S of et)m.addDependencies(S.dependencies.length),S.frameworks&&m.addFrameworks(S.frameworks.length);k+=et.length,m.addProjects(et.length),m.completeStep("elixir",`${et.length} project${et.length!==1?"s":""}`,et.length);}let tt=await nf(t,a,C,y,c);if(tt.length>0){m.insertStepBefore("drift",{id:"docker",label:"Found Docker images",weight:2}),m.startStep("docker");for(let S of tt)m.addDependencies(S.dependencies.length);k+=tt.length,m.addProjects(tt.length),m.completeStep("docker",`${tt.length} project${tt.length!==1?"s":""}`,tt.length);}let nt=await mf(t,a,C,y,c);if(nt.length>0){m.insertStepBefore("drift",{id:"helm",label:"Found Helm charts",weight:2}),m.startStep("helm");for(let S of nt)m.addDependencies(S.dependencies.length),S.frameworks&&m.addFrameworks(S.frameworks.length);k+=nt.length,m.addProjects(nt.length),m.completeStep("helm",`${nt.length} project${nt.length!==1?"s":""}`,nt.length);}let rt=await kf(t,a,C,y,c);if(rt.length>0){m.insertStepBefore("drift",{id:"terraform",label:"Found Terraform configs",weight:2}),m.startStep("terraform");for(let S of rt)m.addDependencies(S.dependencies.length);k+=rt.length,m.addProjects(rt.length),m.completeStep("terraform",`${rt.length} project${rt.length!==1?"s":""}`,rt.length);}let st=await Af(t,C);if(st.length>0){m.insertStepBefore("drift",{id:"polyglot",label:"Found additional language projects",weight:2}),m.startStep("polyglot");for(let S of st)m.addDependencies(S.dependencies.length),m.addFrameworks(S.frameworks.length);k+=st.length,m.addProjects(st.length),m.completeStep("polyglot",`${st.length} project${st.length!==1?"s":""}`,st.length);}let da=new Set(["docker","helm","terraform"]),jr=S=>da.has(S.type)?`${S.type}:${S.path}`:S.path,ma=[...qe,...He,...ze,...We,...Je,...Ke,...Ye,...Xe,...Qe,...Ze,...et,...tt,...nt,...rt,...st],On=new Map;for(let S of ma){let M=On.get(jr(S));if(!M)On.set(jr(S),S);else {let D=Ar=>Ar.dependencies.filter(mt=>mt.resolvedVersion||mt.latestStable).length,ot=D(S)>D(M)||D(S)===D(M)&&S.dependencies.length>M.dependencies.length,dt=ot?S:M,ln=ot?M:S;if(ln.projectReferences?.length)if(!dt.projectReferences)dt.projectReferences=ln.projectReferences;else {let Ar=new Set(dt.projectReferences.map(mt=>mt.path));for(let mt of ln.projectReferences)Ar.has(mt.path)||dt.projectReferences.push(mt);}On.set(jr(S),dt);}}let se=[...On.values()],bs=e$1.dsn||process.env.VIBGRATE_DSN,ws=(bs?Ym(bs):null)?.workspaceId;for(let S of se){S.drift=Hr([S]),S.projectId=ll(S.path,S.name,ws);let M=B.resolve(t,S.path);try{let D=await C.sourceMetricsUnder(t,M);S.fileCount===void 0&&(S.fileCount=D.fileCount),S.sizeBytes=D.sizeBytes;}catch{}S.dependencyCount=S.dependencies.length,S.classification=Of({fileCount:S.fileCount,sizeBytes:S.sizeBytes,dependencyCount:S.dependencyCount});}let Ss=B.join(t,".vibgrate","solutions.json"),ks=new Map;if(await p(Ss))try{let S=await n(Ss);for(let M of S.solutions??[])M.path&&M.solutionId&&ks.set(M.path,M.solutionId);}catch{}let Bt=(await gh(t,C)).map(S=>({solutionId:ks.get(S.path)??ul(S.path,S.name,ws),path:S.path,name:S.name,type:S.type,projectPaths:S.projectPaths})),Tr=new Map(se.map(S=>[S.path,S]));for(let S of Bt){let M=S.projectPaths.map(D=>Tr.get(D)??Tr.get(B.dirname(D).replace(/\\/g,"/"))).filter(D=>!!D);S.drift=M.length>0?Hr(M):void 0;for(let D of M)D.solutionId=S.solutionId,D.solutionName=S.name;}for(let S of se)S.relationshipDiagram=Pm(S,se);for(let S of Bt)S.relationshipDiagram=Mm(S,se);let ha=Am(se),Vt={};n$1&&await n$1({rootDir:t,opts:e$1,config:o,scanners:b,maxPrivacyMode:l,allProjects:se,solutions:Bt,projectsByPath:Tr,fileCache:C,progress:m,runtimeCatalog:V,extended:Vt,addFilesScanned:T});let xs=(Date.now()-Date.parse(V.generatedAt))/(1e3*60*60*24),ga=Number.isFinite(xs)&&xs>30;Vt.runtimeCatalogInfo={generatedAt:V.generatedAt,source:I.source,stale:ga};let Es=[];if(e$1.vulns){m.insertStepBefore("drift",{id:"vulns",label:"Scanning for vulnerabilities",weight:3}),m.startStep("vulns");let S=nd(se),M=await ad(S,{sem:i,offline:c,manifest:a}),D=a!=null;if((M.packages.length>0||D)&&await _d(t)){let dt=!e$1.noLocalArtifacts&&!l?B.join(t,".vibgrate"):void 0,ln=await om(t,{cacheDir:dt});fm(M,ln,new Date().toISOString(),{manifest:a});}(M.source!=="none"||M.packages.length>0||M.cra!=null&&M.cra.remediatedCount>0)&&(Vt.vulnerabilities=M),Es=ud(M);let ot=M.packages.length;m.completeStep("vulns",ot>0?`${M.totalAdvisories} advisor${M.totalAdvisories===1?"y":"ies"} across ${ot} package${ot===1?"":"s"}`:M.source==="unreachable"?"OSV unreachable \u2014 not checked":"none found");}m.startStep("drift");let Cr=Hr(se);m.completeStep("drift",`${Cr.score}/100 \u2014 ${Cr.riskLevel} risk`),m.startStep("findings");let Bn=[...cl(se,o),...Es],Vn=Bn.filter(S=>S.level==="warning").length,Dn=Bn.filter(S=>S.level==="error").length,Un=Bn.filter(S=>S.level==="note").length;m.addFindings(Vn,Dn,Un);let Gn=[];if(Dn>0&&Gn.push(`${Dn} error${Dn!==1?"s":""}`),Vn>0&&Gn.push(`${Vn} warning${Vn!==1?"s":""}`),Un>0&&Gn.push(`${Un} note${Un!==1?"s":""}`),m.completeStep("findings",Gn.join(", ")||"none"),e$1.postScan){m.startStep("map");try{let S=await e$1.postScan((M,D,ot)=>m.updateStepProgress("map",M,D,ot));m.completeStep("map",S||"done");}catch{m.completeStep("map","skipped (map build failed)");}}m.finish();let Dt=C.stuckPaths,Ut=C.skippedLargeFiles;if(Dt.length>0){console.log(E.yellow(`
104
- \u26A0 ${Dt.length} path${Dt.length===1?"":"s"} timed out (>${Math.round(y/1e3)}s) and ${Dt.length===1?"was":"were"} skipped:`));for(let D of Dt)console.log(E.dim(` \u2192 ${D}`));let S=Dt.map(D=>`${D}/**`);await Kc(t,S)&&console.log(E.green("\u2714")+` Added ${S.length} pattern${S.length!==1?"s":""} to exclude list in config`);}if(Ut.length>0){let M=((o.maxFileSizeToScan??5242880)/1048576).toFixed(0);console.log(E.yellow(`
105
- \u26A0 ${Ut.length} file${Ut.length===1?"":"s"} skipped (>${M} MB):`));for(let D of Ut.slice(0,10))console.log(E.dim(` \u2192 ${D}`));Ut.length>10&&console.log(E.dim(` \u2026 and ${Ut.length-10} more`));}C.clear(),se.length===0&&console.log(E.yellow("No projects found."));let js=Date.now()-s$1,ya=await yh(t,Le.remoteUrl,Vt.buildDeploy?.ci,e$1.repositoryName),va=Vf(se),fe={schemaVersion:"1.0",timestamp:new Date().toISOString(),vibgrateVersion:r$1,rootPath:B.basename(t),...Le.type!=="unknown"?{vcs:Le}:{},repository:ya,projects:se,...Bt.length>0?{solutions:Bt}:{},drift:Cr,findings:Bn,...Object.keys(Vt).length>0?{extended:Vt}:{},durationMs:js,filesScanned:k,treeSummary:H,relationshipDiagram:ha,billing:va};if(e$1.baseline){let S=B.resolve(e$1.baseline);if(await p(S))try{let M=await n(S);fe.baseline=S,fe.delta=fe.drift.score-M.drift.score;}catch{console.error(E.yellow(`Warning: Could not read baseline file: ${S}`));}}if(!e$1.noLocalArtifacts&&!l){let S=B.join(t,".vibgrate");await q(S),await r(B.join(S,"scan_result.json"),fe),await r(B.join(S,"solutions.json"),{scannedAt:fe.timestamp,solutions:Bt.map(M=>({solutionId:M.solutionId,name:M.name,path:M.path,type:M.type,projectPaths:M.projectPaths}))});}if(!e$1.noLocalArtifacts&&!l&&await dh(t,{timestamp:fe.timestamp,totalDurationMs:js,totalFiles:H.totalFiles,totalDirs:H.totalDirs,steps:m.getStepTimings()}),!e$1.noLocalArtifacts&&!l){let S={};for(let M of se)M.drift&&M.path&&(S[M.path]={projectId:M.projectId,name:M.name,type:M.type,path:M.path,score:M.drift.score,riskLevel:M.drift.riskLevel,components:M.drift.components,measured:M.drift.measured,scannedAt:fe.timestamp,vibgrateVersion:r$1,solutionId:M.solutionId,solutionName:M.solutionName});if(Object.keys(S).length>0){let M=B.join(t,".vibgrate");await q(M),await r(B.join(M,"project_scores.json"),S);}}if(e$1.format==="json"){let S=JSON.stringify(fe,null,2);e$1.out?(await s(B.resolve(e$1.out),S),console.log(E.green("\u2714")+` JSON written to ${e$1.out}`)):console.log(S);}else if(e$1.format==="sarif"){let S=Pl(fe),M=JSON.stringify(S,null,2);e$1.out?(await s(B.resolve(e$1.out),M),console.log(E.green("\u2714")+` SARIF written to ${e$1.out}`)):console.log(M);}else if(e$1.format==="md"){let S=Ll(fe);console.log(S),e$1.out&&await s(B.resolve(e$1.out),S);}else {let S=El(fe);console.log(S),e$1.out&&await s(B.resolve(e$1.out),S);}return fe}async function yh(t,e,n$1,r){let s=r?.trim()?r.trim():await Xm(t),o,i=B.join(t,"package.json");if(await p(i))try{let a=await n(i);typeof a.version=="string"&&a.version.trim()&&(o=a.version.trim());}catch{}return {name:s,...o?{version:o}:{},...n$1&&n$1.length>0?{pipeline:n$1.join(",")}:{},...e?{remoteUrl:e}:{}}}/*! Bundled license information:
101
+ `);}}}}formatLoggedStepDetail(t){let e="";return t.detail&&(e+=` \xB7 ${t.detail}`),t.count!==void 0&&t.count>0&&(e+=` (${t.count})`),e}formatElapsed(t){let e=t/1e3;if(e<90)return `${e.toFixed(1)}s`;let n=Math.floor(e/60),r=Math.floor(e%60);return `${n}m ${r.toString().padStart(2,"0")}s`}computeEtaString(t,e,n){if(n===0||t<2e3)return "";let r=e/n;if(r<.03){if(this.estimatedTotalMs!==null&&this.estimatedTotalMs>0){let i=Math.max(0,this.estimatedTotalMs-t);if(i>1e3)return k.dim(` \xB7 ~${this.formatElapsed(i)} left`)}return ""}let s=t/r*(1-r),o;if(this.estimatedTotalMs!==null&&this.estimatedTotalMs>0){let i=Math.max(0,this.estimatedTotalMs-t),a=Math.max(.1,1-r),c=i*a+s*(1-a);o=Math.min(i,c);}else o=s;return o<1500?"":k.dim(` \xB7 ~${this.formatElapsed(o)} left`)}},ga="scan_history.json",pi=10;async function ya(t){let e=B.join(t,".vibgrate",ga);try{let n=await Ee.readFile(e,"utf8"),r=JSON.parse(n);return r.version===1&&Array.isArray(r.records)?r:null}catch{return null}}async function jh(t,e){let n=B.join(t,".vibgrate"),r=B.join(n,ga),s,o=await ya(t);o?(s=o,s.records.push(e),s.records.length>pi&&(s.records=s.records.slice(-pi))):s={version:1,records:[e]};try{await Ee.mkdir(n,{recursive:!0}),await Ee.writeFile(r,JSON.stringify(s,null,2)+`
102
+ `,"utf8");}catch{}}function Th(t,e){if(!t||t.records.length===0)return null;let n=t.records.filter(s=>{if(s.totalFiles===0||e===0)return false;let o=e/s.totalFiles;return o>=.33&&o<=3});if(n.length>0){let s=0,o=0;for(let i=0;i<n.length;i++){let a=n[i],c=i+1,l=e/a.totalFiles;s+=a.totalDurationMs*l*c,o+=c;}return Math.round(s/o)}let r=t.records[t.records.length-1];if(r.totalFiles>0&&e>0){let s=e/r.totalFiles;return Math.round(r.totalDurationMs*s)}return r.totalDurationMs}function Ch(t,e){let n=new Map;if(!t||t.records.length===0)return n;let r=null;for(let o=t.records.length-1;o>=0;o--){let i=t.records[o];if(i.steps.length>0){r=i;break}}if(!r)return n;let s=r.totalFiles>0&&e>0?e/r.totalFiles:1;for(let o of r.steps)n.set(o.id,Math.round(o.durationMs*s));return n}async function Ah(t,e){let n=await e.findSolutionFiles(t),r=[];for(let s of n)try{let o=await e.readTextFile(s),i=B.dirname(s),c=[B.basename(t),B.relative(t,s).replace(/\\/g,"/")].join("/"),l=new Set,u=/Project\("[^"]*"\)\s*=\s*"([^"]*)",\s*"([^"]+\.(?:cs|vb)proj)"/g,p;for(;(p=u.exec(o))!==null;){let d=p[2],h=B.resolve(i,d.replace(/\\/g,"/"));l.add(B.relative(t,h).replace(/\\/g,"/"));}let f=B.basename(s,B.extname(s));r.push({path:c,name:f,type:"dotnet-sln",projectPaths:[...l]});}catch{}return r}async function f0(t,e$1,n$1){let r$1=e$1.vibgrateVersion??"unknown",s$1=Date.now(),o=await el(t),i=new a$1(e$1.concurrency),a=e$1.packageManifest?await nu(e$1.packageManifest):void 0,c=e$1.offline===true,l=e$1.maxPrivacy===true,u=new lu(t,i,a,c),p$1=new xm(i,a,c),f=new Em(i,a,c),d$1=new jm(i,a,c),h=new Tm(i,a,c),g=new Cm(i,a,c),v=new Am(i,a,c),S=new Pm(i,a,c),j=new Mm(i,a,c),P=new $m(i,a,c),C=new d,E=[...new Set([...o.exclude??[],...e$1.exclude??[]])];C.setExcludePatterns(E);let y=(e$1.projectScanTimeout??o.projectScanTimeout??180)*1e3;C.setMaxFileSize(o.maxFileSizeToScan??5242880),C.setProjectScanTimeout(y);let b=o.scanners,x=0,T=w=>{x+=w;},m=new Eh(t,r$1),A=[{id:"config",label:"Loading configuration"},{id:"discovery",label:"Discovering workspace",weight:3},{id:"vcs",label:"Detecting version control"},{id:"walk",label:"Indexing files",weight:8},{id:"drift",label:"Computing drift score"},{id:"findings",label:"Generating findings"}];if(e$1.postScan&&A.push({id:"map",label:"Building code map"}),m.setSteps(A),m.completeStep("config","loaded"),!(c?true:await uu(t))){m.finish();let w=["",k.red.bold(" \u2716 Vibgrate cannot connect to the npm registry to check package versions."),"",k.dim(" Possible causes:"),k.dim(" \u2022 No internet connection"),k.dim(" \u2022 Corporate proxy/firewall blocking registry.npmjs.org"),k.dim(" \u2022 npm is not installed or not in PATH"),"",k.dim(" Try running: ")+k.cyan("npm view npm dist-tags.latest"),""].join(`
103
+ `);throw new Error(w)}let I=await new vh({offline:c,manifest:a}).resolve(),D=I.catalog,fe=e(t,E);m.startStep("discovery");let H=await fe;m.updateStats({treeSummary:H}),m.completeStep("discovery",`${H.totalFiles.toLocaleString()} files \xB7 ${H.totalDirs.toLocaleString()} dirs`);let un=await ya(t),bs=Th(un,H.totalFiles);m.setEstimatedTotal(bs),m.setStepEstimates(Ch(un,H.totalFiles)),m.startStep("vcs");let le=await ca(t);le.type==="git"&&le.sha&&(le.dirty=await Kd(t));let va=le.type!=="unknown"?`${le.type}${le.branch?` ${le.branch}`:""}${le.shortSha?` @ ${le.shortSha}`:""}${le.dirty?" (dirty)":""}`:"none detected";m.completeStep("vcs",va),m.startStep("walk",H.totalFiles),await C.walkDir(t,(w,M)=>{m.updateStepProgress("walk",w,H.totalFiles,M);});let On=C.getWalkSummary(t);On&&(On.totalFiles!==H.totalFiles||On.totalDirs!==H.totalDirs)&&m.updateStats({treeSummary:On}),m.completeStep("walk",`${H.totalFiles.toLocaleString()} files indexed`);let qe=await Eu(t,u,C,y,D);if(qe.length>0){m.insertStepBefore("drift",{id:"node",label:"Found Node projects",weight:4}),m.startStep("node");for(let w of qe)m.addDependencies(w.dependencies.length),m.addFrameworks(w.frameworks.length);x+=qe.length,m.addProjects(qe.length),m.completeStep("node",`${qe.length} project${qe.length!==1?"s":""}`,qe.length);}let He=await Pu(t,p$1,C,y,D);if(He.length>0){m.insertStepBefore("drift",{id:"dotnet",label:"Found .NET projects",weight:2}),m.startStep("dotnet");for(let w of He)m.addDependencies(w.dependencies.length),m.addFrameworks(w.frameworks.length);x+=He.length,m.addProjects(He.length),m.completeStep("dotnet",`${He.length} project${He.length!==1?"s":""}`,He.length);}let ze=await Uu(t,f,C,y,D);if(ze.length>0){m.insertStepBefore("drift",{id:"python",label:"Found Python projects",weight:3}),m.startStep("python");for(let w of ze)m.addDependencies(w.dependencies.length),m.addFrameworks(w.frameworks.length);x+=ze.length,m.addProjects(ze.length),m.completeStep("python",`${ze.length} project${ze.length!==1?"s":""}`,ze.length);}let We=await Xu(t,d$1,C,y,D);if(We.length>0){m.insertStepBefore("drift",{id:"java",label:"Found Java projects",weight:3}),m.startStep("java");for(let w of We)m.addDependencies(w.dependencies.length),m.addFrameworks(w.frameworks.length);x+=We.length,m.addProjects(We.length),m.completeStep("java",`${We.length} project${We.length!==1?"s":""}`,We.length);}let Je=await lp(t,h,C,y,D);if(Je.length>0){m.insertStepBefore("drift",{id:"ruby",label:"Found Ruby projects",weight:2}),m.startStep("ruby");for(let w of Je)m.addDependencies(w.dependencies.length),m.addFrameworks(w.frameworks.length);x+=Je.length,m.addProjects(Je.length),m.completeStep("ruby",`${Je.length} project${Je.length!==1?"s":""}`,Je.length);}let Ke=await hp(t,g,C,y);if(Ke.length>0){m.insertStepBefore("drift",{id:"swift",label:"Found Swift projects",weight:2}),m.startStep("swift");for(let w of Ke)m.addDependencies(w.dependencies.length),m.addFrameworks(w.frameworks.length);x+=Ke.length,m.addProjects(Ke.length),m.completeStep("swift",`${Ke.length} project${Ke.length!==1?"s":""}`,Ke.length);}let Ye=await bp(t,v,C,y,D);if(Ye.length>0){m.insertStepBefore("drift",{id:"go",label:"Found Go projects",weight:2}),m.startStep("go");for(let w of Ye)m.addDependencies(w.dependencies.length),m.addFrameworks(w.frameworks.length);x+=Ye.length,m.addProjects(Ye.length),m.completeStep("go",`${Ye.length} project${Ye.length!==1?"s":""}`,Ye.length);}let Xe=await Tp(t,S,C,y);if(Xe.length>0){m.insertStepBefore("drift",{id:"rust",label:"Found Rust projects",weight:2}),m.startStep("rust");for(let w of Xe)m.addDependencies(w.dependencies.length),m.addFrameworks(w.frameworks.length);x+=Xe.length,m.addProjects(Xe.length),m.completeStep("rust",`${Xe.length} project${Xe.length!==1?"s":""}`,Xe.length);}let Qe=await Lp(t,j,C,y);if(Qe.length>0){m.insertStepBefore("drift",{id:"php",label:"Found PHP projects",weight:2}),m.startStep("php");for(let w of Qe)m.addDependencies(w.dependencies.length),m.addFrameworks(w.frameworks.length);x+=Qe.length,m.addProjects(Qe.length),m.completeStep("php",`${Qe.length} project${Qe.length!==1?"s":""}`,Qe.length);}let Ze=await Op(t,P,C,y);if(Ze.length>0){m.insertStepBefore("drift",{id:"dart",label:"Found Dart projects",weight:2}),m.startStep("dart");for(let w of Ze)m.addDependencies(w.dependencies.length),m.addFrameworks(w.frameworks.length);x+=Ze.length,m.addProjects(Ze.length),m.completeStep("dart",`${Ze.length} project${Ze.length!==1?"s":""}`,Ze.length);}let et=await Qp(t,a,C,y,c);if(et.length>0){m.insertStepBefore("drift",{id:"elixir",label:"Found Elixir projects",weight:2}),m.startStep("elixir");for(let w of et)m.addDependencies(w.dependencies.length),w.frameworks&&m.addFrameworks(w.frameworks.length);x+=et.length,m.addProjects(et.length),m.completeStep("elixir",`${et.length} project${et.length!==1?"s":""}`,et.length);}let tt=await ff(t,a,C,y,c);if(tt.length>0){m.insertStepBefore("drift",{id:"docker",label:"Found Docker images",weight:2}),m.startStep("docker");for(let w of tt)m.addDependencies(w.dependencies.length);x+=tt.length,m.addProjects(tt.length),m.completeStep("docker",`${tt.length} project${tt.length!==1?"s":""}`,tt.length);}let nt=await xf(t,a,C,y,c);if(nt.length>0){m.insertStepBefore("drift",{id:"helm",label:"Found Helm charts",weight:2}),m.startStep("helm");for(let w of nt)m.addDependencies(w.dependencies.length),w.frameworks&&m.addFrameworks(w.frameworks.length);x+=nt.length,m.addProjects(nt.length),m.completeStep("helm",`${nt.length} project${nt.length!==1?"s":""}`,nt.length);}let rt=await $f(t,a,C,y,c);if(rt.length>0){m.insertStepBefore("drift",{id:"terraform",label:"Found Terraform configs",weight:2}),m.startStep("terraform");for(let w of rt)m.addDependencies(w.dependencies.length);x+=rt.length,m.addProjects(rt.length),m.completeStep("terraform",`${rt.length} project${rt.length!==1?"s":""}`,rt.length);}let st=await Ff(t,C);if(st.length>0){m.insertStepBefore("drift",{id:"polyglot",label:"Found additional language projects",weight:2}),m.startStep("polyglot");for(let w of st)m.addDependencies(w.dependencies.length),m.addFrameworks(w.frameworks.length);x+=st.length,m.addProjects(st.length),m.completeStep("polyglot",`${st.length} project${st.length!==1?"s":""}`,st.length);}let ba=new Set(["docker","helm","terraform"]),Tr=w=>ba.has(w.type)?`${w.type}:${w.path}`:w.path,wa=[...qe,...He,...ze,...We,...Je,...Ke,...Ye,...Xe,...Qe,...Ze,...et,...tt,...nt,...rt,...st],Bn=new Map;for(let w of wa){let M=Bn.get(Tr(w));if(!M)Bn.set(Tr(w),w);else {let V=Pr=>Pr.dependencies.filter(mt=>mt.resolvedVersion||mt.latestStable).length,ot=V(w)>V(M)||V(w)===V(M)&&w.dependencies.length>M.dependencies.length,dt=ot?w:M,pn=ot?M:w;if(pn.projectReferences?.length)if(!dt.projectReferences)dt.projectReferences=pn.projectReferences;else {let Pr=new Set(dt.projectReferences.map(mt=>mt.path));for(let mt of pn.projectReferences)Pr.has(mt.path)||dt.projectReferences.push(mt);}Bn.set(Tr(w),dt);}}let se=[...Bn.values()],ws=e$1.dsn||process.env.VIBGRATE_DSN,Ss=ws?ch(ws):null,ks=Ss?.workspaceId;for(let w of se){w.drift=zr([w]),w.projectId=hl(w.path,w.name,ks);let M=B.resolve(t,w.path);try{let V=await C.sourceMetricsUnder(t,M);w.fileCount===void 0&&(w.fileCount=V.fileCount),w.sizeBytes=V.sizeBytes;}catch{}w.dependencyCount=w.dependencies.length,w.classification=Wf({fileCount:w.fileCount,sizeBytes:w.sizeBytes,dependencyCount:w.dependencyCount});}let xs=B.join(t,".vibgrate","solutions.json"),Es=new Map;if(await p(xs))try{let w=await n(xs);for(let M of w.solutions??[])M.path&&M.solutionId&&Es.set(M.path,M.solutionId);}catch{}let Bt=(await Ah(t,C)).map(w=>({solutionId:Es.get(w.path)??gl(w.path,w.name,ks),path:w.path,name:w.name,type:w.type,projectPaths:w.projectPaths})),Cr=new Map(se.map(w=>[w.path,w]));for(let w of Bt){let M=w.projectPaths.map(V=>Cr.get(V)??Cr.get(B.dirname(V).replace(/\\/g,"/"))).filter(V=>!!V);w.drift=M.length>0?zr(M):void 0;for(let V of M)V.solutionId=w.solutionId,V.solutionName=w.name;}for(let w of se)w.relationshipDiagram=Dm(w,se);for(let w of Bt)w.relationshipDiagram=Um(w,se);let Sa=Vm(se),Vt={};n$1&&await n$1({rootDir:t,opts:e$1,config:o,scanners:b,maxPrivacyMode:l,allProjects:se,solutions:Bt,projectsByPath:Cr,fileCache:C,progress:m,runtimeCatalog:D,extended:Vt,addFilesScanned:T});let js=(Date.now()-Date.parse(D.generatedAt))/(1e3*60*60*24),ka=Number.isFinite(js)&&js>30;Vt.runtimeCatalogInfo={generatedAt:D.generatedAt,source:I.source,stale:ka};let Ts=[];if(e$1.vulns){m.insertStepBefore("drift",{id:"vulns",label:"Scanning for vulnerabilities",weight:3}),m.startStep("vulns");let w=pd(se),M=await gd(w,{sem:i,offline:c,manifest:a}),V=a!=null;if((M.packages.length>0||V)&&await Hd(t)){let dt=!e$1.noLocalArtifacts&&!l?B.join(t,".vibgrate"):void 0,pn=await hm(t,{cacheDir:dt});km(M,pn,new Date().toISOString(),{manifest:a});}(M.source!=="none"||M.packages.length>0||M.cra!=null&&M.cra.remediatedCount>0)&&(Vt.vulnerabilities=M),Ts=bd(M);let ot=M.packages.length;m.completeStep("vulns",ot>0?`${M.totalAdvisories} advisor${M.totalAdvisories===1?"y":"ies"} across ${ot} package${ot===1?"":"s"}`:M.source==="unreachable"?"OSV unreachable \u2014 not checked":"none found");}m.startStep("drift");let Ar=zr(se);m.completeStep("drift",`${Ar.score}/100 \u2014 ${Ar.riskLevel} risk`),m.startStep("findings");let Vn=[...ml(se,o),...Ts],Dn=Vn.filter(w=>w.level==="warning").length,Un=Vn.filter(w=>w.level==="error").length,Gn=Vn.filter(w=>w.level==="note").length;m.addFindings(Dn,Un,Gn);let qn=[];if(Un>0&&qn.push(`${Un} error${Un!==1?"s":""}`),Dn>0&&qn.push(`${Dn} warning${Dn!==1?"s":""}`),Gn>0&&qn.push(`${Gn} note${Gn!==1?"s":""}`),m.completeStep("findings",qn.join(", ")||"none"),e$1.postScan){m.startStep("map");try{let w=await e$1.postScan((M,V,ot)=>m.updateStepProgress("map",M,V,ot));m.completeStep("map",w||"done");}catch{m.completeStep("map","skipped (map build failed)");}}m.finish();let Dt=C.stuckPaths,Ut=C.skippedLargeFiles;if(Dt.length>0){console.log(k.yellow(`
104
+ \u26A0 ${Dt.length} path${Dt.length===1?"":"s"} timed out (>${Math.round(y/1e3)}s) and ${Dt.length===1?"was":"were"} skipped:`));for(let V of Dt)console.log(k.dim(` \u2192 ${V}`));let w=Dt.map(V=>`${V}/**`);await tl(t,w)&&console.log(k.green("\u2714")+` Added ${w.length} pattern${w.length!==1?"s":""} to exclude list in config`);}if(Ut.length>0){let M=((o.maxFileSizeToScan??5242880)/1048576).toFixed(0);console.log(k.yellow(`
105
+ \u26A0 ${Ut.length} file${Ut.length===1?"":"s"} skipped (>${M} MB):`));for(let V of Ut.slice(0,10))console.log(k.dim(` \u2192 ${V}`));Ut.length>10&&console.log(k.dim(` \u2026 and ${Ut.length-10} more`));}C.clear(),se.length===0&&console.log(k.yellow("No projects found."));let Cs=Date.now()-s$1,xa=await Ph(t,le.remoteUrl,Vt.buildDeploy?.ci,e$1.repositoryName),Ea=Kf(se),de={schemaVersion:"1.0",timestamp:new Date().toISOString(),vibgrateVersion:r$1,rootPath:B.basename(t),...le.type!=="unknown"?{vcs:le}:{},repository:xa,projects:se,...Bt.length>0?{solutions:Bt}:{},drift:Ar,findings:Vn,...Object.keys(Vt).length>0?{extended:Vt}:{},durationMs:Cs,filesScanned:x,treeSummary:H,relationshipDiagram:Sa,billing:Ea};if(e$1.baseline){let w=B.resolve(e$1.baseline);if(await p(w))try{let M=await n(w),V=B.relative(t,w);de.baseline=!V||V.startsWith("..")?B.basename(w):V,de.delta=de.drift.score-M.drift.score;}catch{console.error(k.yellow(`Warning: Could not read baseline file: ${w}`));}}if(!e$1.noLocalArtifacts&&!l){let w=B.join(t,".vibgrate");await q(w),await r(B.join(w,"scan_result.json"),de),await r(B.join(w,"solutions.json"),{scannedAt:de.timestamp,solutions:Bt.map(M=>({solutionId:M.solutionId,name:M.name,path:M.path,type:M.type,projectPaths:M.projectPaths}))});}if(!e$1.noLocalArtifacts&&!l&&await jh(t,{timestamp:de.timestamp,totalDurationMs:Cs,totalFiles:H.totalFiles,totalDirs:H.totalDirs,steps:m.getStepTimings()}),!e$1.noLocalArtifacts&&!l){let w={};for(let M of se)M.drift&&M.path&&(w[M.path]={projectId:M.projectId,name:M.name,type:M.type,path:M.path,score:M.drift.score,riskLevel:M.drift.riskLevel,components:M.drift.components,measured:M.drift.measured,scannedAt:de.timestamp,vibgrateVersion:r$1,solutionId:M.solutionId,solutionName:M.solutionName});if(Object.keys(w).length>0){let M=B.join(t,".vibgrate");await q(M),await r(B.join(M,"project_scores.json"),w);}}if(e$1.format==="json"){let w=JSON.stringify(de,null,2);e$1.out?(await s(B.resolve(e$1.out),w),console.log(k.green("\u2714")+` JSON written to ${e$1.out}`)):console.log(w);}else if(e$1.format==="sarif"){let w=Ol(de),M=JSON.stringify(w,null,2);e$1.out?(await s(B.resolve(e$1.out),M),console.log(k.green("\u2714")+` SARIF written to ${e$1.out}`)):console.log(M);}else if(e$1.format==="md"){let w=Dl(de);console.log(w),e$1.out&&await s(B.resolve(e$1.out),w);}else {let w=Ll(de,{free:!Ss});console.log(w),e$1.out&&await s(B.resolve(e$1.out),w);}return de}async function Ph(t,e,n$1,r){let s=r?.trim()?r.trim():await lh(t),o,i=B.join(t,"package.json");if(await p(i))try{let a=await n(i);typeof a.version=="string"&&a.version.trim()&&(o=a.version.trim());}catch{}return {name:s,...o?{version:o}:{},...n$1&&n$1.length>0?{pipeline:n$1.join(",")}:{},...e?{remoteUrl:e}:{}}}/*! Bundled license information:
106
106
 
107
107
  smol-toml/dist/date.js:
108
108
  smol-toml/dist/error.js:
@@ -140,4 +140,4 @@ smol-toml/dist/index.js:
140
140
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
141
141
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
142
142
  *)
143
- */export{Of as $,Am as $a,wu as A,Fd as Aa,Nu as B,Od as Ba,Uu as C,Bd as Ca,ep as D,cs as Da,ip as E,Oy as Ea,up as F,om as Fa,yp as G,Zi as Ga,xp as H,By as Ha,Pp as I,ea as Ia,Gp as J,ta as Ja,nf as K,am as Ka,mf as L,cm as La,kf as M,um as Ma,Af as N,fm as Na,Pf as O,dm as Oa,Mf as P,mm as Pa,$f as Q,hm as Qa,Lf as R,gm as Ra,Nf as S,ym as Sa,Rf as T,vm as Ta,If as U,bm as Ua,_f as V,wm as Va,Ff as W,Sm as Wa,ss as X,na as Xa,os as Y,Vy as Ya,is as Z,Cm as Za,Ly as _,Dy as _a,Jc as a,Bf as aa,Pm as ab,yy as b,Ny as ba,Mm as bb,Kc as c,Vf as ca,Hy as cb,Qc as d,Fi as da,Om as db,Zc as e,Oi as ea,Wy as eb,el as f,lr as fa,Ym as fb,tl as g,Bi as ga,Jy as gb,Mo as h,Zf as ha,Xm as hb,Hr as i,nd as ia,Ky as ib,cl as j,Vi as ja,Zm as jb,ll as k,rd as ka,t0 as kb,ul as l,ad as la,pl as m,cd as ma,fl as n,ud as na,No as o,vd as oa,vy as p,bd as pa,by as q,Ry as qa,wy as r,jd as ra,Sy as s,Cd as sa,El as t,Ad as ta,Pl as u,Pd as ua,Ll as v,Md as va,Wl as w,Iy as wa,eu as x,Wi as xa,tu as y,_n as ya,hu as z,_d as za};
143
+ */export{Wf as $,Vm as $a,Pu as A,zd as Aa,Uu as B,Wd as Ba,Xu as C,Jd as Ca,lp as D,ls as Da,hp as E,Ky as Ea,bp as F,hm as Fa,Tp as G,oa as Ga,Lp as H,Yy as Ha,Op as I,ia as Ia,Qp as J,aa as Ja,ff as K,ym as Ka,xf as L,vm as La,$f as M,wm as Ma,Ff as N,km as Na,Of as O,xm as Oa,Bf as P,Em as Pa,Vf as Q,jm as Qa,Df as R,Tm as Ra,Uf as S,Cm as Sa,Gf as T,Am as Ta,qf as U,Pm as Ua,Hf as V,Mm as Va,zf as W,$m as Wa,os as X,ca as Xa,is as Y,Xy as Ya,as as Z,Bm as Za,Gy as _,Qy as _a,el as a,Jf as aa,Dm as ab,Ay as b,qy as ba,Um as bb,tl as c,Kf as ca,n0 as cb,sl as d,Gi as da,Ym as db,ol as e,qi as ea,s0 as eb,il as f,ur as fa,ch as fb,al as g,Hi as ga,o0 as gb,Lo as h,cd as ha,lh as hb,zr as i,pd as ia,i0 as ib,ml as j,zi as ja,ph as jb,hl as k,fd as ka,f0 as kb,gl as l,gd as la,yl as m,yd as ma,vl as n,bd as na,Io as o,Cd as oa,Py as p,Ad as pa,My as q,Hy as qa,$y as r,Rd as ra,Ly as s,_d as sa,Ll as t,Fd as ta,Ol as u,Od as ua,Dl as v,Bd as va,nu as w,zy as wa,lu as x,Zi as xa,uu as y,cn as ya,Eu as z,Hd as za};