@vibgrate/cli 2026.630.4 → 2026.701.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +1,27 @@
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 xe from'fs/promises';import {readFile,mkdtemp,rm as rm$1,mkdir,writeFile}from'fs/promises';import U from'typescript';import*as as from'crypto';import k from'chalk';import*as Cn 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 Xi from'zlib';import {promisify}from'util';function ua(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 pa(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 Ts(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 Un(t){return t.major*1e3+t.minor}function Cs(t,e){if(typeof t.releaseDate!="string")return true;let n=Date.parse(t.releaseDate);return Number.isNaN(n)?true:n<=e}function fa(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 Gn(t,e){return t.products[e]?.cycles??[]}function pn(t,e,n=Date.now()){let r=null;for(let s of Gn(t,e)){if(!Cs(s,n))continue;let o=Ts(s.cycle);o&&(!r||Un(o)>Un(r))&&(r=o);}return r}function Cr(t,e,n=Date.now()){let r=null;for(let s of Gn(t,e)){if(!Cs(s,n)||!fa(s,n))continue;let o=Ts(s.cycle);o&&(!r||Un(o)>Un(r))&&(r=o);}return r}function gt(t,e,n){let r=Gn(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=ua(e);if(!s)return null;let o=it(e,n);return o?pa(o,Gn(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 As=":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",da=As+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",ma="["+As+"]["+da+"]*",ha=new RegExp("^"+ma+"$");function qn(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 Ar=function(t){let e=ha.exec(t);return !(e===null||typeof e>"u")};function Ps(t){return typeof t<"u"}var fn=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],Hn=["__proto__","constructor","prototype"];var ga={allowBooleanAttributes:false,unpairedTags:[]};function Rs(t,e){e=Object.assign({},ga,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=Ls(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--),!Ea(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=ba(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=Ns(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=Ns(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=Ls(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=ka(t,o);if(p==-1)return G("InvalidChar","char '&' is not expected.",te(t,o));o=p;}else if(s===true&&!Ms(t[o]))return G("InvalidXml","Extra text at the end",te(t,o));t[o]==="<"&&o--;}}else {if(Ms(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 Ms(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 Ls(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 ya='"',va="'";function ba(t,e){let n="",r="",s=false;for(;e<t.length;e++){if(t[e]===ya||t[e]===va)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 wa=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Ns(t,e){let n=qn(t,wa),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(!xa(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 Sa(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 ka(t,e){if(e++,t[e]===";")return -1;if(t[e]==="#")return e++,Sa(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 xa(t){return Ar(t)}function Ea(t){return Ar(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 zn={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:'"'},Pr={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"}),Ta=new Set("!?\\\\/[]$%{}^&*()<>|+");function Ws(t){if(t[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t}"`);for(let e of t)if(Ta.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",Wn="base",Mr="all";function Ca(t){return !t||t===vt?new Set([vt]):t===Mr?new Set([Mr]):t===Wn?new Set([Wn]):Array.isArray(t)?new Set(t):new Set([vt])}var oe=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Aa=new Set([9,10,13]);function Pa(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=Ca(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=Pa(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))Ws(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){Ws(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=Wn;}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(Mr)?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:Wn}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!Aa.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 Js=t=>fn.includes(t)?"__"+t:t,Ma={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:Js};function $a(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(Hn.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function Ks(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"}:Ks(true)}var Ys=function(t){let e=Object.assign({},Ma,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&&$a(r,s);return e.onDangerousProperty===null&&(e.onDangerousProperty=Js),e.processEntities=Ks(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 Jn;typeof Symbol!="function"?Jn="@@xmlMetadata":Jn=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][Jn]={startIndex:n});}static getMetaDataSymbol(){return Jn}};var Xs=":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",La=Xs+"\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040",Qs=":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}",Na=Qs+"\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040",Zs=(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)}},Ra=Zs(Xs,La),Ia=Zs(Qs,Na,"u"),_a=(t="1.0")=>t==="1.1"?Ia:Ra;var $r=(t,{xmlVersion:e="1.0"}={})=>_a(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&&!$r(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($r(t,{xmlVersion:e}))return t;throw new Error(`Invalid entity name ${t}`)}var Fa=[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],Kn=255,Yn=new Map,eo=65535,to=1632,Ht=to,Oa=eo-to+1,Xn=new Uint8Array(Oa).fill(Kn);for(let t of Fa)for(let e=0;e<10;e++){let n=t+e;n<=eo?Xn[n-Ht]=e:Yn.set(n,e);}var no=48,ro=57,so=45,Qn=new Set([8722,65293,65123]);function Ba(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>=no&&o<=ro||o===so)){if(o<Ht){if(Qn.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(Yn.has(a)){n=s;break}}}continue}if(Xn[o-Ht]!==Kn||Qn.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>=no&&o<=ro||o===so){r.push(t[s]);continue}if(o<Ht){r.push(Qn.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=Yn.get(c);if(l!==void 0){r.push(String.fromCharCode(l+48)),s++;continue}}}r.push(t[s]);continue}if(Qn.has(o)){r.push("-");continue}let i=Xn[o-Ht];r.push(i!==Kn?String.fromCharCode(i+48):t[s]);}return r.join("")}var oo=Ba;var Va=/^[-+]?0x[a-fA-F0-9]+$/,Da=/^0b[01]+$/,Ua=/^0o[0-7]+$/,Ga=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,qa={hex:true,binary:false,octal:false,leadingZeros:true,decimalPoint:".",eNotation:true,infinity:"original",unicode:false};function Nr(t,e={}){if(e=Object.assign({},qa,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=oo(n),n==="0"))return 0;if(e.hex&&Va.test(n))return Lr(n,16);if(e.binary&&Da.test(n))return Lr(n,2);if(e.octal&&Ua.test(n))return Lr(n,8);if(isFinite(n)){if(n.includes("e")||n.includes("E"))return za(t,n,e);{let r=Ga.exec(n);if(r){let s=r[1]||"",o=r[2],i=Wa(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 Ja(t,Number(n),e)}var Ha=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function za(t,e,n){if(!n.eNotation)return t;let r=e.match(Ha);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 Wa(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 Lr(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 Ja(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 Rr(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 Ir=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 Ir(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 Ka=[{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}],io=Ka;var Ya=[{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:/\?>/}],ao=Ya;var Xa=[{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}],co=Xa;var Qa=[{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}],Zn=Qa;var Za=[{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}],ec=[...Zn,...Za],lo=ec;var tc=[{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}],uo=tc;var nc=[{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,}\)/}],po=nc;var le=`["'\\s]*:`,rc=[{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__["']\]/}],fo=rc;var sc=[{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\[/}],mo=sc;var ho={HTML:io,XML:ao,SVG:co,SQL:Zn,"SQL-STRICT":lo,SHELL:uo,REDOS:po,NOSQL:fo,LOG:mo},er=ho,Jt=Object.freeze(Object.fromEntries(Object.keys(ho).map(t=>[t,t])));function oc(t){if(typeof t!="string")throw new TypeError(`is-unsafe: first argument must be a string, got ${typeof t}`)}function ic(t){if(!(t instanceof RegExp)){if(typeof t=="string"){if(!er[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"||!er[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 go(t,e){let n=er[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 yo(t,e){if(oc(t),ic(e),e instanceof RegExp)return e.test(t);if(typeof e=="string")return go(t,e)!==null;for(let n of e)if(go(t,n)!==null)return true;return false}function ac(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 cc(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=dc,this.parseTextData=lc,this.resolveNameSpace=uc,this.buildAttributesMap=fc,this.isItStopNode=yc,this.replaceEntitiesValue=hc,this.readStopNodeData=wc,this.saveTextToParentTag=gc,this.addChild=mc,this.ignoreAttributesFn=Rr(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={...Pr,...zn}),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)=>yo(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 lc(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?Or(t,a.parseTagValue,a.numberParseOptions):t}}function uc(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 pc=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function fc(t,e,n,r=false){let s=this.options;if(r===true||s.ignoreAttributes!==true&&typeof t=="string"){let o=qn(t,pc),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 y=g;s.trimValues&&(y=y.trim()),y=this.replaceEntitiesValue(y,n,this.readonlyMatcher),c[d]=y,u[h]=y,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=vo(g,s),o[d][4]!==void 0){let y=c[d],w=s.attributeValueProcessor(h,y,p);w==null?a[g]=y:typeof w!=typeof y||w!==y?a[g]=w:a[g]=Or(y,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 dc=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=_r(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=Fr(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=Fr(t,a,s.removeNSPrefix);if(!u){let v=t.substring(Math.max(0,a-50),Math.min(i,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${v}"`)}let p=u.tagName,f=u.rawTagName,d=u.tagExp,h=u.attrExpPresent,g=u.closeIndex;if({tagName:p,tagExp:d}=_r(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 y=n;y&&s.unpairedTagsSet.has(y.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=cc(f),p!==e.tagname&&this.matcher.push(p,{},C),p!==d&&h&&(j=this.buildAttributesMap(d,this.matcher,p),j&&(ac(j,s))),p!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let E=a;if(this.isCurrentNodeStopNode){let v="";if(w)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,v=x.tagContent;}let b=new ie(p);j&&(b[":@"]=j),b.add(s.textNodeName,v),this.matcher.pop(),this.isCurrentNodeStopNode=false,this.addChild(n,b,this.readonlyMatcher,E);}else {if(w){({tagName:p,tagExp:d}=_r(s.transformTagName,p,d,s));let v=new ie(p);j&&(v[":@"]=j),this.addChild(n,v,this.readonlyMatcher,E),this.matcher.pop(),this.isCurrentNodeStopNode=false;}else if(s.unpairedTagsSet.has(p)){let v=new ie(p);j&&(v[":@"]=j),this.addChild(n,v,this.readonlyMatcher,E),this.matcher.pop(),this.isCurrentNodeStopNode=false,a=u.closeIndex;continue}else {let v=new ie(p);if(this.tagsNodeStack.length>s.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),j&&(v[":@"]=j),this.addChild(n,v,this.readonlyMatcher,E),n=v;}r="",a=g;}}}else r+=t[a];return e.child};function mc(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 hc(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 gc(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 yc(){return this.stopNodeExpressionsSet.size===0?false:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function vc(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 bc(t,e,n,r){let s=t.indexOf(e,n);if(s===-1)throw new Error(r);return s}function Fr(t,e,n,r=">"){let s=vc(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 wc(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=bc(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=Fr(t,n,false);a&&((a&&a.tagName)===e&&a.tagExp[a.tagExp.length-1]!=="/"&&s++,n=a.closeIndex);}}}function Or(t,e,n){if(e&&typeof t=="string"){let r=t.trim();return r==="true"?true:r==="false"?false:Nr(t,n)}else return Ps(t)?t:""}function _r(t,e,n,r){if(t){let s=t(e);n===e&&(n=s),e=s;}return e=vo(e,r),{tagName:e,tagExp:n}}function vo(t,e){if(Hn.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 Br=ie.getMetaDataSymbol();function Sc(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 Vr(t,e,n,r){return bo(t,e,n,r)}function bo(t,e,n,r){let s,o={};for(let i=0;i<t.length;i++){let a=t[i],c=kc(a);if(c!==void 0&&c!==e.textNodeName){let l=Sc(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=bo(a[c],e,n,r),u=Ec(l,e);if(Object.keys(l).length===0&&e.alwaysCreateTextNode&&(l[e.textNodeName]=""),a[":@"]?xc(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[Br]!==void 0&&typeof l=="object"&&l!==null&&(l[Br]=a[Br]),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 kc(t){let e=Object.keys(t);for(let n=0;n<e.length;n++){let r=e[n];if(r!==":@")return r}}function xc(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 Ec(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=Ys(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=Rs(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:Vr(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 jc=/^(\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(jc);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 Tc(t,e){let n=t.slice(0,e).split(/\r\n|\n|\r/g);return [n.length,n.pop().length+1]}function Cc(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,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 us from'crypto';import E from'chalk';import*as An 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 sa from'zlib';import {promisify}from'util';function ya(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 va(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 Ps(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 Gn(t){return t.major*1e3+t.minor}function Ms(t,e){if(typeof t.releaseDate!="string")return true;let n=Date.parse(t.releaseDate);return Number.isNaN(n)?true:n<=e}function ba(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 qn(t,e){return t.products[e]?.cycles??[]}function pn(t,e,n=Date.now()){let r=null;for(let s of qn(t,e)){if(!Ms(s,n))continue;let o=Ps(s.cycle);o&&(!r||Gn(o)>Gn(r))&&(r=o);}return r}function Ar(t,e,n=Date.now()){let r=null;for(let s of qn(t,e)){if(!Ms(s,n)||!ba(s,n))continue;let o=Ps(s.cycle);o&&(!r||Gn(o)>Gn(r))&&(r=o);}return r}function gt(t,e,n){let r=qn(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=ya(e);if(!s)return null;let o=it(e,n);return o?va(o,qn(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 $s=":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",wa=$s+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Sa="["+$s+"]["+wa+"]*",ka=new RegExp("^"+Sa+"$");function Hn(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 Pr=function(t){let e=ka.exec(t);return !(e===null||typeof e>"u")};function Ls(t){return typeof t<"u"}var fn=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],zn=["__proto__","constructor","prototype"];var xa={allowBooleanAttributes:false,unpairedTags:[]};function Fs(t,e){e=Object.assign({},xa,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=Rs(t,o),o.err)return o}else if(t[o]==="<"){let i=o;if(o++,t[o]==="!"){o=Is(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--),!$a(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=Ta(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=_s(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=_s(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=Is(t,o);continue}else if(t[o+1]==="?"){if(o=Rs(t,++o),o.err)return o}else break;else if(t[o]==="&"){let p=Pa(t,o);if(p==-1)return G("InvalidChar","char '&' is not expected.",te(t,o));o=p;}else if(s===true&&!Ns(t[o]))return G("InvalidXml","Extra text at the end",te(t,o));t[o]==="<"&&o--;}}else {if(Ns(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 Ns(t){return t===" "||t===" "||t===`
3
+ `||t==="\r"}function Rs(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 Is(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 Ea='"',ja="'";function Ta(t,e){let n="",r="",s=false;for(;e<t.length;e++){if(t[e]===Ea||t[e]===ja)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 Ca=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function _s(t,e){let n=Hn(t,Ca),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(!Ma(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 Aa(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 Pa(t,e){if(e++,t[e]===";")return -1;if(t[e]==="#")return e++,Aa(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 Ma(t){return Pr(t)}function $a(t){return Pr(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 Wn={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:'"'},Mr={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"}),Na=new Set("!?\\\\/[]$%{}^&*()<>|+");function Ys(t){if(t[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t}"`);for(let e of t)if(Na.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",Jn="base",$r="all";function Ra(t){return !t||t===vt?new Set([vt]):t===$r?new Set([$r]):t===Jn?new Set([Jn]):Array.isArray(t)?new Set(t):new Set([vt])}var oe=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Ia=new Set([9,10,13]);function _a(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=Ra(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=_a(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))Ys(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){Ys(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=Jn;}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($r)?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:Jn}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!Ia.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 Xs=t=>fn.includes(t)?"__"+t:t,Fa={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:Xs};function Oa(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(zn.some(r=>n===r.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function Qs(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"}:Qs(true)}var Zs=function(t){let e=Object.assign({},Fa,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&&Oa(r,s);return e.onDangerousProperty===null&&(e.onDangerousProperty=Xs),e.processEntities=Qs(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 Kn;typeof Symbol!="function"?Kn="@@xmlMetadata":Kn=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][Kn]={startIndex:n});}static getMetaDataSymbol(){return Kn}};var eo=":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",Ba=eo+"\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040",to=":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}",Va=to+"\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040",no=(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)}},Da=no(eo,Ba),Ua=no(to,Va,"u"),Ga=(t="1.0")=>t==="1.1"?Ua:Da;var Lr=(t,{xmlVersion:e="1.0"}={})=>Ga(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&&!Lr(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(Lr(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],Yn=255,Xn=new Map,ro=65535,so=1632,Ht=so,Ha=ro-so+1,Qn=new Uint8Array(Ha).fill(Yn);for(let t of qa)for(let e=0;e<10;e++){let n=t+e;n<=ro?Qn[n-Ht]=e:Xn.set(n,e);}var oo=48,io=57,ao=45,Zn=new Set([8722,65293,65123]);function za(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>=oo&&o<=io||o===ao)){if(o<Ht){if(Zn.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(Xn.has(a)){n=s;break}}}continue}if(Qn[o-Ht]!==Yn||Zn.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>=oo&&o<=io||o===ao){r.push(t[s]);continue}if(o<Ht){r.push(Zn.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=Xn.get(c);if(l!==void 0){r.push(String.fromCharCode(l+48)),s++;continue}}}r.push(t[s]);continue}if(Zn.has(o)){r.push("-");continue}let i=Qn[o-Ht];r.push(i!==Yn?String.fromCharCode(i+48):t[s]);}return r.join("")}var co=za;var Wa=/^[-+]?0x[a-fA-F0-9]+$/,Ja=/^0b[01]+$/,Ka=/^0o[0-7]+$/,Ya=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Xa={hex:true,binary:false,octal:false,leadingZeros:true,decimalPoint:".",eNotation:true,infinity:"original",unicode:false};function Rr(t,e={}){if(e=Object.assign({},Xa,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=co(n),n==="0"))return 0;if(e.hex&&Wa.test(n))return Nr(n,16);if(e.binary&&Ja.test(n))return Nr(n,2);if(e.octal&&Ka.test(n))return Nr(n,8);if(isFinite(n)){if(n.includes("e")||n.includes("E"))return Za(t,n,e);{let r=Ya.exec(n);if(r){let s=r[1]||"",o=r[2],i=ec(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 tc(t,Number(n),e)}var Qa=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Za(t,e,n){if(!n.eNotation)return t;let r=e.match(Qa);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 ec(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 Nr(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 tc(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 Ir(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 _r=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 _r(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 nc=[{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}],lo=nc;var rc=[{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:/\?>/}],uo=rc;var sc=[{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}],po=sc;var oc=[{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}],er=oc;var ic=[{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}],ac=[...er,...ic],fo=ac;var cc=[{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}],mo=cc;var lc=[{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,}\)/}],ho=lc;var le=`["'\\s]*:`,uc=[{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__["']\]/}],go=uc;var pc=[{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\[/}],yo=pc;var vo={HTML:lo,XML:uo,SVG:po,SQL:er,"SQL-STRICT":fo,SHELL:mo,REDOS:ho,NOSQL:go,LOG:yo},tr=vo,Jt=Object.freeze(Object.fromEntries(Object.keys(vo).map(t=>[t,t])));function fc(t){if(typeof t!="string")throw new TypeError(`is-unsafe: first argument must be a string, got ${typeof t}`)}function dc(t){if(!(t instanceof RegExp)){if(typeof t=="string"){if(!tr[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"||!tr[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 bo(t,e){let n=tr[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 wo(t,e){if(fc(t),dc(e),e instanceof RegExp)return e.test(t);if(typeof e=="string")return bo(t,e)!==null;for(let n of e)if(bo(t,n)!==null)return true;return false}function mc(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 hc(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=wc,this.parseTextData=gc,this.resolveNameSpace=yc,this.buildAttributesMap=bc,this.isItStopNode=Ec,this.replaceEntitiesValue=kc,this.readStopNodeData=Cc,this.saveTextToParentTag=xc,this.addChild=Sc,this.ignoreAttributesFn=Ir(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={...Mr,...Wn}),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)=>wo(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 gc(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?Br(t,a.parseTagValue,a.numberParseOptions):t}}function yc(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 vc=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function bc(t,e,n,r=false){let s=this.options;if(r===true||s.ignoreAttributes!==true&&typeof t=="string"){let o=Hn(t,vc),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 y=g;s.trimValues&&(y=y.trim()),y=this.replaceEntitiesValue(y,n,this.readonlyMatcher),c[d]=y,u[h]=y,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=So(g,s),o[d][4]!==void 0){let y=c[d],w=s.attributeValueProcessor(h,y,p);w==null?a[g]=y:typeof w!=typeof y||w!==y?a[g]=w:a[g]=Br(y,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 wc=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=Fr(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=Or(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=Or(t,a,s.removeNSPrefix);if(!u){let v=t.substring(Math.max(0,a-50),Math.min(i,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${v}"`)}let p=u.tagName,f=u.rawTagName,d=u.tagExp,h=u.attrExpPresent,g=u.closeIndex;if({tagName:p,tagExp:d}=Fr(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 y=n;y&&s.unpairedTagsSet.has(y.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=hc(f),p!==e.tagname&&this.matcher.push(p,{},C),p!==d&&h&&(j=this.buildAttributesMap(d,this.matcher,p),j&&(mc(j,s))),p!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let x=a;if(this.isCurrentNodeStopNode){let v="";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,v=k.tagContent;}let b=new ie(p);j&&(b[":@"]=j),b.add(s.textNodeName,v),this.matcher.pop(),this.isCurrentNodeStopNode=false,this.addChild(n,b,this.readonlyMatcher,x);}else {if(w){({tagName:p,tagExp:d}=Fr(s.transformTagName,p,d,s));let v=new ie(p);j&&(v[":@"]=j),this.addChild(n,v,this.readonlyMatcher,x),this.matcher.pop(),this.isCurrentNodeStopNode=false;}else if(s.unpairedTagsSet.has(p)){let v=new ie(p);j&&(v[":@"]=j),this.addChild(n,v,this.readonlyMatcher,x),this.matcher.pop(),this.isCurrentNodeStopNode=false,a=u.closeIndex;continue}else {let v=new ie(p);if(this.tagsNodeStack.length>s.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),j&&(v[":@"]=j),this.addChild(n,v,this.readonlyMatcher,x),n=v;}r="",a=g;}}}else r+=t[a];return e.child};function Sc(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 kc(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 xc(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 Ec(){return this.stopNodeExpressionsSet.size===0?false:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function jc(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 Tc(t,e,n,r){let s=t.indexOf(e,n);if(s===-1)throw new Error(r);return s}function Or(t,e,n,r=">"){let s=jc(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 Cc(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=Tc(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=Or(t,n,false);a&&((a&&a.tagName)===e&&a.tagExp[a.tagExp.length-1]!=="/"&&s++,n=a.closeIndex);}}}function Br(t,e,n){if(e&&typeof t=="string"){let r=t.trim();return r==="true"?true:r==="false"?false:Rr(t,n)}else return Ls(t)?t:""}function Fr(t,e,n,r){if(t){let s=t(e);n===e&&(n=s),e=s;}return e=So(e,r),{tagName:e,tagExp:n}}function So(t,e){if(zn.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 Vr=ie.getMetaDataSymbol();function Ac(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 Dr(t,e,n,r){return ko(t,e,n,r)}function ko(t,e,n,r){let s,o={};for(let i=0;i<t.length;i++){let a=t[i],c=Pc(a);if(c!==void 0&&c!==e.textNodeName){let l=Ac(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=ko(a[c],e,n,r),u=$c(l,e);if(Object.keys(l).length===0&&e.alwaysCreateTextNode&&(l[e.textNodeName]=""),a[":@"]?Mc(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[Vr]!==void 0&&typeof l=="object"&&l!==null&&(l[Vr]=a[Vr]),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 Pc(t){let e=Object.keys(t);for(let n=0;n<e.length;n++){let r=e[n];if(r!==":@")return r}}function Mc(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 $c(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=Zs(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=Fs(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:Dr(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 Lc=/^(\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(Lc);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 Nc(t,e){let n=t.slice(0,e).split(/\r\n|\n|\r/g);return [n.length,n.pop().length+1]}function Rc(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]=Tc(n.toml,n.ptr),o=Cc(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]=Nc(n.toml,n.ptr),o=Rc(n.toml,r,s);super(`Invalid TOML document: ${e}
7
7
 
8
- ${o}`,n),this.line=r,this.column=s,this.codeblock=o;}};var Ac=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,Pc=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Mc=/^[+-]?0[0-9_]/;function tr(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 Ic=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,_c=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Fc=/^[+-]?0[0-9_]/;function nr(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 wo(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=Ac.test(t);if(s||Pc.test(t)){if(Mc.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 nr(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 xo(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=Ic.test(t);if(s||_c.test(t)){if(Fc.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 rr(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
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===`
17
17
  `||s==="\r"&&t[e+1]===`
18
- `);)e++;if(r||s!=="#")break;e=Yt(t,e);}return e}function So(t,e,n,r,s=false){if(!r)return e=nr(t,e),e<0?t.length:e;for(let o=e;o<t.length;o++){let i=t[o];if(i==="#")o=nr(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 Eo(t,e,n,r,s=false){if(!r)return e=rr(t,e),e<0?t.length:e;for(let o=e;o<t.length;o++){let i=t[o];if(i==="#")o=rr(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 $c(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==="["?xo(t,e,r,s):ko(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]=tr(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=So(t,e,",",n),a=$c(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++),[wo(a[0],t,e,s),i]}var Lc=/^[a-zA-Z0-9-_]+[ \t]*$/;function rr(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]=tr(t,e);r=t.indexOf(".",c);let l=t.slice(c,r<0||r>o?o:r),u=nr(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(!Lc.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 ko(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]=rr(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 xo(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 Eo(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 Dr(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=rr(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=Eo(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=rr(t,a),l=Eo(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),hr=b(a(),1),Se=b(a(),1),gr=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),An=b(a(),1),Pn=b(a(),1),Mn=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),Ki=b(a(),1);var Nc=["vibgrate.config.ts","vibgrate.config.js","vibgrate.config.json"],Rc="VIBGRATE_TRUST_CONFIG";function Ic(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function kn(t,e){if(U.isParenthesizedExpression(t))return kn(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 kn(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]=kn(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 kn(n,e)}throw new Error("Non-static expression in config")}function _c(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=kn(o.expression,s);return Ic(i)?{...lr,...i}:null}return null}var Fc=5242880,Oc=180,lr={exclude:[],maxFileSizeToScan:Fc,projectScanTimeout:Oc,thresholds:{failOnError:{eolDays:180,frameworkMajorLag:3,dependencyTwoPlusPercent:50},warn:{frameworkMajorLag:2,dependencyTwoPlusPercent:30}}};async function Bc(t){let e=lr;for(let r of Nc){let s=B.join(t,r);if(await p(s)){if(r.endsWith(".json")){let a=await o(s);e={...lr,...JSON.parse(a)};break}let o$1=await o(s),i=null;try{i=_c(o$1,s);}catch{i=null;}if(i){e=i;break}if(process.env[Rc]==="1")try{let a=await import(s);e={...lr,...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 Xg(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 Oc(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==="["?To(t,e,r,s):jo(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]=nr(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=Eo(t,e,",",n),a=Oc(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++),[xo(a[0],t,e,s),i]}var Bc=/^[a-zA-Z0-9-_]+[ \t]*$/;function sr(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]=nr(t,e);r=t.indexOf(".",c);let l=t.slice(c,r<0||r>o?o:r),u=rr(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(!Bc.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 jo(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]=sr(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 To(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 Co(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 Ur(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=sr(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=Co(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=sr(t,a),l=Co(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),gr=b(a(),1),Se=b(a(),1),yr=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),Pn=b(a(),1),Mn=b(a(),1),$n=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),na=b(a(),1);var Vc=["vibgrate.config.ts","vibgrate.config.js","vibgrate.config.json"],Dc="VIBGRATE_TRUST_CONFIG";function Uc(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function kn(t,e){if(U.isParenthesizedExpression(t))return kn(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 kn(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]=kn(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 kn(n,e)}throw new Error("Non-static expression in config")}function Gc(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=kn(o.expression,s);return Uc(i)?{...ur,...i}:null}return null}var qc=5242880,Hc=180,ur={exclude:[],maxFileSizeToScan:qc,projectScanTimeout:Hc,thresholds:{failOnError:{eolDays:180,frameworkMajorLag:3,dependencyTwoPlusPercent:50},warn:{frameworkMajorLag:2,dependencyTwoPlusPercent:30}}};async function zc(t){let e=ur;for(let r of Vc){let s=B.join(t,r);if(await p(s)){if(r.endsWith(".json")){let a=await o(s);e={...ur,...JSON.parse(a)};break}let o$1=await o(s),i=null;try{i=Gc(o$1,s);}catch{i=null;}if(i){e=i;break}if(process.env[Dc]==="1")try{let a=await import(s);e={...ur,...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 hy(t){let e=B.join(t,"vibgrate.config.ts");return await xe.writeFile(e,`import type { VibgrateConfig } from '@vibgrate/cli';
25
25
 
26
26
  const config: VibgrateConfig = {
27
27
  // exclude: ['legacy/**'],
@@ -41,10 +41,10 @@ const config: VibgrateConfig = {
41
41
  };
42
42
 
43
43
  export default config;
44
- `,"utf8"),e}async function Vc(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)+`
44
+ `,"utf8"),e}async function Wc(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
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 Dc=864e5,Uc=365.25;function Gc(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)/Dc;return a>0?a:0}function qc(t){return t===null?null:t/Uc}function Hc(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 zc(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 jo="driftscore-2.0",To={failOnError:{eolDays:180,frameworkMajorLag:3,dependencyTwoPlusPercent:50},warn:{frameworkMajorLag:2,dependencyTwoPlusPercent:30}};function Zo(t,e,n){return Math.min(n,Math.max(e,t))}function Wc(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 Jc(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 Zo(100-(o*.6+i*.4),0,100)}function Kc(t){let e=0,n=0,r=0,s=0;for(let l of t)e+=l.dependencyAgeBuckets.current,n+=l.dependencyAgeBuckets.oneBehind,r+=l.dependencyAgeBuckets.twoPlusBehind,s+=l.dependencyAgeBuckets.unknown;let o=e+n+r;if(o===0)return null;let i=e/o,a=n/o,c=r/o;return Zo(Math.round(i*100-a*10-c*40),0,100)}var Co=1e3*60*60*24*30;function Yc(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*Co?n=Math.min(n,40):o<=12*Co&&(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 Xc(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:zc({total:n,max:s,measured:r})}function Qc(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 Ur(t){let e=Wc(t),n=Jc(t),r=Kc(t),s=Yc(t),o=Xc(t),i=[{score:e,weight:.25},{score:n,weight:.25},{score:r,weight:.3},{score:s,weight:.2},{score:o,weight:.15}],a=Qc(t)??void 0,c=y=>100-y,l=()=>{let y={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&&(y.freshnessScore=c(Math.round(o))),y},u=i.filter(y=>y.score!==null);if(u.length===0)return {score:0,riskLevel:"low",components:l(),methodologyVersion:jo,...a!==void 0?{confidence:a}:{}};let p=u.reduce((y,w)=>y+w.weight,0),f=0;for(let y of u)f+=y.score*(y.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:jo,...a!==void 0?{confidence:a}:{}}}function Zc(t,e){let n={failOnError:{...To.failOnError,...e?.thresholds?.failOnError},warn:{...To.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 el(t,e,n){let r=n?`${t}:${e}:${n}`:`${t}:${e}`;return as.createHash("sha256").update(r).digest("hex").slice(0,16)}function tl(t,e,n){let r=n?`${t}:${e}:${n}`:`${t}:${e}`;return as.createHash("sha256").update(r).digest("hex").slice(0,16)}var nl=20,rl=50,Ao={red:"#E5484D",amber:"#F5A524",green:"#30A46C",unknown:"#6B7280"},Qg="#24292F";function Zg(t){if(t==null||!Number.isFinite(t))return "unknown";let e=Math.round(t);return e<=nl?"green":e<=rl?"amber":"red"}function e0(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 t0(t){return Ao[t]??Ao.unknown}function sl(t){let e=[];e.push(""),e.push(k.bold.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),e.push(k.bold.cyan("\u2551 Vibgrate Drift Report \u2551")),e.push(k.bold.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),e.push("");for(let a of t.projects){if(e.push(k.bold(` \u2500\u2500 ${a.name} `)+k.dim(`(${a.type}) ${a.path}`)),a.runtime){let u=a.runtimeMajorsBehind!==void 0&&a.runtimeMajorsBehind>0?k.yellow(` (${a.runtimeMajorsBehind} major${a.runtimeMajorsBehind>1?"s":""} behind)`):k.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?k.green("current"):k.yellow(`${u.majorsBehind} behind`):k.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(` ${k.green(`${c.current} current`)} ${k.yellow(`${c.oneBehind} 1-behind`)} ${k.red(`${c.twoPlusBehind} 2+ behind`)} ${k.dim(`${c.unknown} unknown`)}`)),e.push("");}if(t.delta!==void 0){let a=t.delta<0?k.green(`${t.delta}`):t.delta>0?k.red(`+${t.delta}`):k.dim("0");e.push(k.bold(" Drift Delta: ")+a+" (vs baseline)"),e.push("");}if(t.extended&&e.push(...il(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?k.red(`${a.length} error${a.length!==1?"s":""}`):"",c.length>0?k.yellow(`${c.length} warning${c.length!==1?"s":""}`):"",l.length>0?k.blue(`${l.length} note${l.length!==1?"s":""}`):""].filter(Boolean).join(k.dim(", "));e.push(k.bold.underline(" Findings")+k.dim(` (${u})`));for(let p of t.findings){let f=p.level==="error"?k.red("\u2716"):p.level==="warning"?k.yellow("\u26A0"):k.blue("\u2139");e.push(` ${f} ${p.message}`),e.push(k.dim(` ${p.ruleId} in ${p.location}`));}e.push("");}let n=cl(t);if(n.length>0){e.push(k.bold.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),e.push(k.bold.cyan("\u2551 Top Priority Actions \u2551")),e.push(k.bold.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),e.push("");for(let a=0;a<n.length;a++){let c=n[a],l=k.bold.cyan(` ${a+1}.`);e.push(`${l} ${k.bold(c.title)}`),e.push(k.dim(` ${c.explanation}`)),c.impact&&e.push(` Impact: ${k.green(c.impact)}`),e.push("");}}if(t.extended?.architecture&&e.push(...al(t.extended.architecture)),t.solutions&&t.solutions.length>0){e.push(k.bold.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),e.push(k.bold.cyan("\u2551 Solution Drift Summary \u2551")),e.push(k.bold.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),e.push("");for(let a of t.solutions){let c=a.drift?.score,l=typeof c=="number"?c<=30?k.green:c<=60?k.yellow:k.red:k.dim;e.push(` \u2022 ${a.name} (${a.projectPaths.length} projects) \u2014 ${typeof c=="number"?l(`${c}/100`):k.dim("n/a")}`);}e.push("");}let r=t.drift.score<=30?k.green:t.drift.score<=60?k.yellow:k.red;e.push(k.bold.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),e.push(k.bold.cyan("\u2551 Drift Score Summary \u2551")),e.push(k.bold.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),e.push(""),e.push(k.bold(" Drift Score: ")+r.bold(`${t.drift.score}/100`)),e.push(k.bold(" Risk Level: ")+ol(t.drift.riskLevel)),e.push(k.bold(" Projects: ")+`${t.projects.length}`);let s=t.billing;if(s&&(e.push(k.bold(" Classified: ")+`${k.cyan(s.nanoCount)} nano \xB7 ${k.cyan(s.microCount)} micro \xB7 ${k.cyan(s.smallCount)} small \xB7 ${k.cyan(s.standardCount)} standard`),e.push(k.bold(" Billable: ")+k.bold.white(`${s.billableProjects}`)+k.dim(` \xB7 ${s.totalScanned} detected \u2192 ${s.billableProjects} billable (micro-project pricing)`))),t.vcs){let a=[t.vcs.type];t.vcs.branch&&a.push(t.vcs.branch),t.vcs.shortSha&&a.push(k.dim(t.vcs.shortSha)),e.push(k.bold(" VCS: ")+a.join(" "));}e.push("");let o=new Set(t.drift.measured??["runtime","framework","dependency","eol"]);e.push(" "+k.bold.underline("Score Breakdown")),e.push(` Runtime: ${o.has("runtime")?xn(t.drift.components.runtimeScore):k.dim("n/a")}`),e.push(` Frameworks: ${o.has("framework")?xn(t.drift.components.frameworkScore):k.dim("n/a")}`),e.push(` Dependencies: ${o.has("dependency")?xn(t.drift.components.dependencyScore):k.dim("n/a")}`),e.push(` EOL Risk: ${o.has("eol")?xn(t.drift.components.eolScore):k.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(k.dim(` ${i.join(" \xB7 ")}`)),e.push(""),e.join(`
47
- `)}function ol(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 xn(t){let n=Math.round(t/100*20),r=20-n;return (t<=30?k.green:t<=60?k.yellow:k.red)("\u2588".repeat(n))+k.dim("\u2591".repeat(r))+` ${Math.round(t)}`}var Po={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=Po[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=Po[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 al(t){let e=[];if(e.push(k.bold.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),e.push(k.bold.cyan("\u2551 Architecture Layers \u2551")),e.push(k.bold.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),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 ${xn(n.driftScore)} risk ${r}`);}e.push("");}return e}function cl(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(`
46
+ `,"utf8"),!0}catch{return false}}var Jc=864e5,Kc=365.25;function Yc(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)/Jc;return a>0?a:0}function Xc(t){return t===null?null:t/Kc}function Qc(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 Zc(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 Ao="driftscore-2.0",Po={failOnError:{eolDays:180,frameworkMajorLag:3,dependencyTwoPlusPercent:50},warn:{frameworkMajorLag:2,dependencyTwoPlusPercent:30}};function oi(t,e,n){return Math.min(n,Math.max(e,t))}function el(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 tl(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 oi(100-(o*.6+i*.4),0,100)}function nl(t){let e=0,n=0,r=0,s=0;for(let l of t)e+=l.dependencyAgeBuckets.current,n+=l.dependencyAgeBuckets.oneBehind,r+=l.dependencyAgeBuckets.twoPlusBehind,s+=l.dependencyAgeBuckets.unknown;let o=e+n+r;if(o===0)return null;let i=e/o,a=n/o,c=r/o;return oi(Math.round(i*100-a*10-c*40),0,100)}var Mo=1e3*60*60*24*30;function rl(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*Mo?n=Math.min(n,40):o<=12*Mo&&(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 sl(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:Zc({total:n,max:s,measured:r})}function ol(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 Gr(t){let e=el(t),n=tl(t),r=nl(t),s=rl(t),o=sl(t),i=[{score:e,weight:.25},{score:n,weight:.25},{score:r,weight:.3},{score:s,weight:.2},{score:o,weight:.15}],a=ol(t)??void 0,c=y=>100-y,l=()=>{let y={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&&(y.freshnessScore=c(Math.round(o))),y},u=i.filter(y=>y.score!==null);if(u.length===0)return {score:0,riskLevel:"low",components:l(),methodologyVersion:Ao,...a!==void 0?{confidence:a}:{}};let p=u.reduce((y,w)=>y+w.weight,0),f=0;for(let y of u)f+=y.score*(y.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:Ao,...a!==void 0?{confidence:a}:{}}}function il(t,e){let n={failOnError:{...Po.failOnError,...e?.thresholds?.failOnError},warn:{...Po.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 al(t,e,n){let r=n?`${t}:${e}:${n}`:`${t}:${e}`;return us.createHash("sha256").update(r).digest("hex").slice(0,16)}function cl(t,e,n){let r=n?`${t}:${e}:${n}`:`${t}:${e}`;return us.createHash("sha256").update(r).digest("hex").slice(0,16)}var ll=20,ul=50,$o={red:"#E5484D",amber:"#F5A524",green:"#30A46C",unknown:"#6B7280"},gy="#24292F";function yy(t){if(t==null||!Number.isFinite(t))return "unknown";let e=Math.round(t);return e<=ll?"green":e<=ul?"amber":"red"}function vy(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 by(t){return $o[t]??$o.unknown}var pl=["","\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589"],fl="\u2588";function qr(t,e,n){return Math.round(t+(e-t)*n)}function Qr(t,e,n){return {r:qr(t.r,e.r,n),g:qr(t.g,e.g,n),b:qr(t.b,e.b,n)}}function dl({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 ii(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(dl(Qr(n,r,e>1?f/(e-1):0))),u="";for(let f=0;f<a;f++)u+=l(f)(fl);let p=a;return c>0&&(u+=l(a)(pl[c]),p++),u+=E.dim(s.repeat(Math.max(e-p,0))),u}var ml={r:63,g:176,b:164},hl={r:79,g:227,b:193};function gl(t,e){return ii(t,e,ml,hl)}var yl={r:63,g:176,b:106},No={r:224,g:168,b:48},vl={r:224,g:83,b:83};function bl(t){let e=Number.isFinite(t)?Math.max(0,Math.min(t,100)):0;return e<=50?Qr(yl,No,e/50):Qr(No,vl,(e-50)/50)}function wl(t,e=20){let n=Number.isFinite(t)?Math.max(0,Math.min(t,100)):0,r=bl(n);return `${ii(n/100,e,r,r)} ${Math.round(n)}`}var Sl=42;function xn(t,e=E.cyan,n=Sl){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 kl(t){let e=[];e.push(""),e.push(...xn("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(...El(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=Tl(t);if(n.length>0){e.push(...xn("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(...jl(t.extended.architecture)),t.solutions&&t.solutions.length>0){e.push(...xn("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(...xn("Drift Score Summary")),e.push(""),e.push(E.bold(" Drift Score: ")+r.bold(`${t.drift.score}/100`)),e.push(E.bold(" Risk Level: ")+xl(t.drift.riskLevel)),e.push(E.bold(" Projects: ")+`${t.projects.length}`);let s=t.billing;if(s&&(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`),e.push(E.bold(" Billable: ")+E.bold.white(`${s.billableProjects}`)+E.dim(` \xB7 ${s.totalScanned} detected \u2192 ${s.billableProjects} billable (micro-project pricing)`))),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")?En(t.drift.components.runtimeScore):E.dim("n/a")}`),e.push(` Frameworks: ${o.has("framework")?En(t.drift.components.frameworkScore):E.dim("n/a")}`),e.push(` Dependencies: ${o.has("dependency")?En(t.drift.components.dependencyScore):E.dim("n/a")}`),e.push(` EOL Risk: ${o.has("eol")?En(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 xl(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 En(t){return wl(t,20)}var Io={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 El(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=Io[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=Io[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 jl(t){let e=[];if(e.push(...xn("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 ${En(n.driftScore)} risk ${r}`);}e.push("");}return e}function Tl(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(`
@@ -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){a.slice(0,4).map(d=>`${d.name} (${d.versions.length}v)`).join(", ");let l=`${a.length} packages have 3+ versions installed. Run \`npm dedupe\` to reduce bundle size and install time.`,u=[],p=0;for(let d of a){if(p>=8)break;u.push(`
69
69
  ${d.name}: ${d.versions.join(", ")} (${d.consumers} consumer${d.consumers!==1?"s":""})`),p++;}let f=a.length-p;l+=u.join(""),f>0&&(l+=`
70
- ... and ${f} more`),e.push({title:"Deduplicate heavily-versioned packages",explanation:l,severity:35});}}return e.sort((i,a)=>a.severity-i.severity),e.slice(0,5)}function ll(t){let e=ul(t.findings),n=t.findings.map(r=>pl(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 ul(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 pl(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 fl(t){let e=[],n=t.billing;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&&(e.push(`| **Classification** | ${n.nanoCount} nano \xB7 ${n.microCount} micro \xB7 ${n.smallCount} small \xB7 ${n.standardCount} standard |`),e.push(`| **Billable Projects** | ${n.billableProjects} (${n.totalScanned} detected \u2192 ${n.billableProjects} billable) |`));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 ml=/^node_modules\/((?:@[^/]+\/)?[^/]+)$/;function hl(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=ml.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 gl(t){let e=t.indexOf("@",t.startsWith("@")?1:0);return e>0?t.slice(0,e):null}function yl(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=gl(a);c&&(e.set(a,i),n.set(c,i));}r=[];}}return {bySpec:e,byName:n}}function vl(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=vl(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 wl(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=hl(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}=yl(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 jl(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 ni(t,e){try{return JSON.parse(t)}catch{throw new Error(`Invalid JSON in package version manifest: ${e}`)}}async function Tl(t){let e=await mkdtemp(B.join(Cn.tmpdir(),"vibgrate-manifest-"));try{await jl("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 ni(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 Cl(t){let e=B.resolve(t);if(e.toLowerCase().endsWith(".zip"))return Tl(e);let n=await readFile(e,"utf8");return ni(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 jn(t){return t.filter(e=>ft.valid(e)&&ft.prerelease(e)===null)}function pr(t){let e=jn(t);return e.length===0?null:e.sort(ft.rcompare)[0]??null}function Al(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 sr(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=ri(a.license??a.licenses),s=Al(a.time);}let o=jn(n),i=pr(o);return !e&&i&&(e=i),{latest:e,stableVersions:o,latestStableOverall:i,license:r,...s?{releaseDates:s}:{}}}function ri(t){if(!t)return null;if(typeof t=="string")return t.trim()||null;if(Array.isArray(t)){let e=t.map(ri).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 Pl=24,Ml=7e3,$l=3e4,Ll=process.platform==="win32"?"npm.cmd":"npm";function Nl(t,e=process.platform){let n=e==="win32"?Ml:$l,r=[],s=[],o=0;for(let i of t){let a=i.length+1;(s.length>=Pl||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 En(t,e){return new Promise((n,r)=>{let s=spawn(Ll,["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 Rl=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=jn(s.versions??[]),i=pr(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 Nl(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 En([...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],sr(n[r]));else if(n&&typeof n=="object"){let r=n,s=0;for(let o of t)o in r&&(e.set(o,sr(r[o])),s++);s===0&&t.length===1&&e.set(t[0],sr(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=jn(e.versions??[]),r=pr(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 En([t,"dist-tags.latest","versions","license","licenses","time"],this.cwd);return sr(e)}catch{let e=null,n=[];try{let o=await En([t,"dist-tags"],this.cwd);o&&typeof o=="object"&&typeof o.latest=="string"&&(e=o.latest);}catch{}try{let o=await En([t,"versions"],this.cwd);Array.isArray(o)?n=o.map(String):typeof o=="string"&&(n=[o]);}catch{}let r=jn(n),s=pr(r);return !e&&s&&(e=s),{latest:e,stableVersions:r,latestStableOverall:s,license:null}}}};async function Il(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 En(["npm","dist-tags.latest"],t);return typeof e=="string"&&e.length>0}catch{return false}}}function si(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 oi(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 ii={attribution:false,copyleft:false,networkCopyleft:false,discloseSource:false,patentGrant:false,commercialRestriction:false};function _l(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:oi(t.category),obligations:{...ii,...t.obligations??{}}}}var X={attribution:true},Fl={attribution:true,patentGrant:true},ue={attribution:true,copyleft:true,discloseSource:true},at={attribution:true,copyleft:true,discloseSource:true},or={attribution:true,copyleft:true,networkCopyleft:true,discloseSource:true},Ol=[{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:Fl},{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:{...or,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:{...or,patentGrant:true}},{id:"SSPL-1.0",name:"Server Side Public License 1.0",family:"SSPL",category:"network-copyleft",obligations:or},{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:or},{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}],Bl=Ol.map(_l),ai=new Map;for(let t of Bl)ai.set(t.spdxId.toLowerCase(),t);function z(t){return ai.get(t.trim().toLowerCase())}function fr(t="Unknown"){return {spdxId:"NOASSERTION",name:t,family:"Unknown",category:"unknown",osiApproved:false,fsfLibre:false,deprecated:false,referenceUrl:"",riskLevel:"medium",obligations:{...ii}}}function ci(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 Vl={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"},li=new Map;for(let[t,e]of Object.entries(Vl))li.set(ci(t),e);function ui(t){return li.get(ci(t))}var Dl=/\(|\)|\bWITH\b|\bAND\b|\bOR\b|[^\s()]+/gi;function Ul(t){let e=(t??"").trim(),n=[],r=[],s=false,o=false,i=false,a=false,c=e.match(Dl)??[];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:Gl(n,r,l,i,e)}}function Gl(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 ql(t){return /\b(?:AND|OR|WITH)\b|\+\s*$|\(/i.test(t)}var Mo={"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 pi(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 Hl(t){let e=(t??"").trim();if(!e||/^(unknown|noassertion|none|n\/a)$/i.test(e))return Ce(fr(),"unknown",0);let n=z(e);if(n)return Ce(n,"exact",1);if(ql(e))return zl(e);let r=ui(e);if(r){let o=z(r);if(o)return Ce(o,"alias",.95)}let s=pi(e);return s?{...Ce(s,"fuzzy",.6),name:e.slice(0,120)}:Ce(fr(e.slice(0,120)),"unknown",0)}function zl(t){let e=Ul(t);if(e.licenseIds.length===0)return Ce(fr(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=ui(c);if(u){let f=z(u);if(f)return Ce(f,"alias",.95)}let p=pi(c);return p?Ce(p,"fuzzy",.6):Ce(fr(c),"unknown",0)}),r=e.operator!=="OR",s=n[0];for(let c of n){let l=Mo[c.category]>Mo[s.category];(r?l:!l)&&(s=c);}let o=Wl(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:oi(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 Wl(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 Jl(t,e){let n=(t??"").trim();if(!n)return {raw:null,spdxId:null,source:"none",confidence:0};let r=Hl(n);return {raw:n.slice(0,200),spdxId:r.matchStatus==="unknown"?null:r.spdxId,source:e,confidence:r.confidence}}var $o={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 Kl(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 wl(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 Cn.availableParallelism=="function"?Cn.availableParallelism():Cn.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[E,v]of Object.entries(C))si(v)&&g.add(E);}catch{}})),g.size>0)try{await e.prefetch([...g]);}catch{}let y=await Promise.all(o$1.map(async w=>h.run(async()=>{try{let j=Yl(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 y)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 Yl(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 v=Cr(s,"nodejs"),b=de.minVersion(l);if(v&&b){let T=de.major(b);u=`${v.major}.0.0`,p=Math.max(0,v.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=[],y=[],w={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=[];for(let v of h)if(v.deps)for(let[b,x]of Object.entries(v.deps))si(x)&&j.push({pkg:b,section:v.name,spec:x});await n$1.prefetch(j.map(v=>v.pkg));let P=j.map(async v=>{let b=await n$1.get(v.pkg);return {...v,meta:b}}),C=await Promise.all(P);for(let{pkg:v,section:b,spec:x,meta:T}of C){let m=o?.resolve(v,x)??null,A=T.stableVersions.length>0?de.maxSatisfying(T.stableVersions,x)??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=Gc($,L,T.releaseDates),H=qc(pe);g.push({package:v,section:b,currentSpec:x,resolvedVersion:$,latestStable:L,majorsBehind:I,drift:V,license:Jl(T.license,"registry"),ageDays:pe,libyears:H}),v in $o&&y.push({name:$o[v],currentVersion:$,latestVersion:L,majorsBehind:I});}for(let v of h)if(v.deps)for(let[b,x]of Object.entries(v.deps))x.trim().startsWith("workspace:")&&(g.push({package:b,section:v.name,currentSpec:x,resolvedVersion:null,latestStable:null,majorsBehind:null,drift:"unknown",license:{raw:null,spdxId:null,source:"none",confidence:0}}),w.unknown++);g.sort((v,b)=>{let x={"major-behind":0,"minor-behind":1,current:2,unknown:3},T=(x[v.drift]??9)-(x[b.drift]??9);return T!==0?T:v.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:y,dependencies:g,dependencyAgeBuckets:w,libyears:Hc(g.map(v=>v.libyears))??void 0,fileCount:E}}var fi=new je({ignoreAttributes:false,attributeNamePrefix:"@_"}),Lo={"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 Yr(t){return t.replace(/\\/g,"/")}function Xl(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 No(t){return t.endsWith(".csproj")||t.endsWith(".vbproj")}function Xr(t){return B.basename(t).replace(/\.(cs|vb)proj$/i,"")}function Ql(t,e){let r=fi.parse(t)?.Project;if(!r)return {targetFrameworks:[],packageReferences:[],projectReferences:[],projectName:Xr(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:Xr(e)}}function Zl(t){let n=fi.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 eu(t,e,n,r,s=Ne){let o$1=n?await n.findFiles(t,No):await i(t,No),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 y=B.resolve(d,g[1].replace(/\\/g,"/"));a.add(y);}}catch{}let c=new Set([...o$1,...a]),l=[],u=r??n?.projectScanTimeout??18e4;for(let p of c)try{let f=tu(p,t,e,n,s),d=await Me(f,u);if(d.ok)l.push(d.value);else {let h=Yr(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 tu(t,e,n,r,s){let o$1=r?await r.readTextFile(t):await o(t),i=Ql(o$1,t),a=B.dirname(t);{let E=B.join(a,"packages.config");try{let v=r?await r.readTextFile(E):await o(E),b=new Set(i.packageReferences.map(x=>x.name.toLowerCase()));for(let x of Zl(v))b.has(x.name.toLowerCase())||(i.packageReferences.push(x),b.add(x.name.toLowerCase()));}catch{}}let c=i.targetFrameworks[0],l=pn(s,"dotnet")?.major,u,p,f,d=c;if(c){let E=Xl(c);E!==null&&l!==void 0&&(u=Math.max(0,l-E)),p=yt(s,"dotnet",c);let v=it("dotnet",c);v&&(f=gt(s,"dotnet",v));}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}}),v=await Promise.all(E);for(let{ref:b,meta:x}of v){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 y=[],w=new Map(h.map(E=>[E.package,E]));for(let E of i.packageReferences)if(E.name in Lo){let v=w.get(E.name);y.push({name:Lo[E.name],currentVersion:v?.resolvedVersion??E.version,latestVersion:v?.latestStable??null,majorsBehind:v?.majorsBehind??null});}let j=i.projectReferences.map(E=>{let v=B.resolve(a,E),b=Yr(B.relative(e,B.dirname(v))),x=Xr(v);return {path:b||".",name:x,refType:"project"}}),P;try{P=r?await r.countFilesUnder(e,a):void 0;}catch{}h.sort((E,v)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},x=(b[E.drift]??9)-(b[v.drift]??9);return x!==0?x:E.package.localeCompare(v.package)});let C=g;return {type:"dotnet",path:Yr(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:y,dependencies:h,dependencyAgeBuckets:C,projectReferences:j.length>0?j:void 0,fileCount:P}}function di(t){if(!t)return null;try{let e=Dr(t);return e&&typeof e=="object"?e:null}catch{return null}}function dr(t){return t.trim().toLowerCase().replace(/[-_.]+/g,"-")}function nu(t){let e=t.trim().replace(/^[=~^><!]+\s*/,"").split(/[,;\s]/)[0];return /^\d/.test(e)?e:null}function ru(t){let e=new Map,r=di(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=dr(o);e.has(a)||e.set(a,i);}return e}function su(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=nu(a),l=dr(o);c&&!e.has(l)&&e.set(l,c);}}return e}var ou=[["poetry","poetry.lock"],["uv","uv.lock"],["pdm","pdm.lock"]];async function iu(t,e){for(let[r,s]of ou){let o=B.join(t,s);if(await e.exists(o).catch(()=>false))try{let i=ru(await e.readText(o));if(i.size)return {source:r,size:i.size,resolve:a=>i.get(dr(a))??null}}catch{}}let n=B.join(t,"Pipfile.lock");if(await e.exists(n).catch(()=>false))try{let r=su(await e.readJson(n));if(r.size)return {source:"pipfile",size:r.size,resolve:s=>r.get(dr(s))??null}}catch{}return null}var Ro={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 cs(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 au(t){return t.match(/^==\s*([^\s,;]+)/)?.[1]??null}function cu(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 lu(t){let e=[];for(let n of t.split(`
73
- `)){let r=cs(n);r&&e.push(r);}return e}function uu(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=cs(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 pu(t){let e=[],n=t.match(/\[packages\]([\s\S]*?)(?=\n\s*\[|\n*$)/);if(n){let s=n[1].split(`
70
+ ... and ${f} more`),e.push({title:"Deduplicate heavily-versioned packages",explanation:l,severity:35});}}return e.sort((i,a)=>a.severity-i.severity),e.slice(0,5)}function Cl(t){let e=Al(t.findings),n=t.findings.map(r=>Pl(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 Al(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 Pl(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 Ml(t){let e=[],n=t.billing;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&&(e.push(`| **Classification** | ${n.nanoCount} nano \xB7 ${n.microCount} micro \xB7 ${n.smallCount} small \xB7 ${n.standardCount} standard |`),e.push(`| **Billable Projects** | ${n.billableProjects} (${n.totalScanned} detected \u2192 ${n.billableProjects} billable) |`));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 Ll=/^node_modules\/((?:@[^/]+\/)?[^/]+)$/;function Nl(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=Ll.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 Rl(t){let e=t.indexOf("@",t.startsWith("@")?1:0);return e>0?t.slice(0,e):null}function Il(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=Rl(a);c&&(e.set(a,i),n.set(c,i));}r=[];}}return {bySpec:e,byName:n}}function _l(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 Fl(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=_l(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 Ol(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=Fl(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=Nl(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}=Il(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 Gl(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 li(t,e){try{return JSON.parse(t)}catch{throw new Error(`Invalid JSON in package version manifest: ${e}`)}}async function ql(t){let e=await mkdtemp(B.join(An.tmpdir(),"vibgrate-manifest-"));try{await Gl("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 li(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 Hl(t){let e=B.resolve(t);if(e.toLowerCase().endsWith(".zip"))return ql(e);let n=await readFile(e,"utf8");return li(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 Tn(t){return t.filter(e=>ft.valid(e)&&ft.prerelease(e)===null)}function fr(t){let e=Tn(t);return e.length===0?null:e.sort(ft.rcompare)[0]??null}function zl(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 or(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=ui(a.license??a.licenses),s=zl(a.time);}let o=Tn(n),i=fr(o);return !e&&i&&(e=i),{latest:e,stableVersions:o,latestStableOverall:i,license:r,...s?{releaseDates:s}:{}}}function ui(t){if(!t)return null;if(typeof t=="string")return t.trim()||null;if(Array.isArray(t)){let e=t.map(ui).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 Wl=24,Jl=7e3,Kl=3e4,Yl=process.platform==="win32"?"npm.cmd":"npm";function Xl(t,e=process.platform){let n=e==="win32"?Jl:Kl,r=[],s=[],o=0;for(let i of t){let a=i.length+1;(s.length>=Wl||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 jn(t,e){return new Promise((n,r)=>{let s=spawn(Yl,["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 Ql=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=Tn(s.versions??[]),i=fr(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 Xl(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 jn([...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],or(n[r]));else if(n&&typeof n=="object"){let r=n,s=0;for(let o of t)o in r&&(e.set(o,or(r[o])),s++);s===0&&t.length===1&&e.set(t[0],or(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=Tn(e.versions??[]),r=fr(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 jn([t,"dist-tags.latest","versions","license","licenses","time"],this.cwd);return or(e)}catch{let e=null,n=[];try{let o=await jn([t,"dist-tags"],this.cwd);o&&typeof o=="object"&&typeof o.latest=="string"&&(e=o.latest);}catch{}try{let o=await jn([t,"versions"],this.cwd);Array.isArray(o)?n=o.map(String):typeof o=="string"&&(n=[o]);}catch{}let r=Tn(n),s=fr(r);return !e&&s&&(e=s),{latest:e,stableVersions:r,latestStableOverall:s,license:null}}}};async function Zl(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 jn(["npm","dist-tags.latest"],t);return typeof e=="string"&&e.length>0}catch{return false}}}function pi(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 fi(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 di={attribution:false,copyleft:false,networkCopyleft:false,discloseSource:false,patentGrant:false,commercialRestriction:false};function eu(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:fi(t.category),obligations:{...di,...t.obligations??{}}}}var X={attribution:true},tu={attribution:true,patentGrant:true},ue={attribution:true,copyleft:true,discloseSource:true},at={attribution:true,copyleft:true,discloseSource:true},ir={attribution:true,copyleft:true,networkCopyleft:true,discloseSource:true},nu=[{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:tu},{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:{...ir,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:{...ir,patentGrant:true}},{id:"SSPL-1.0",name:"Server Side Public License 1.0",family:"SSPL",category:"network-copyleft",obligations:ir},{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:ir},{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}],ru=nu.map(eu),mi=new Map;for(let t of ru)mi.set(t.spdxId.toLowerCase(),t);function z(t){return mi.get(t.trim().toLowerCase())}function dr(t="Unknown"){return {spdxId:"NOASSERTION",name:t,family:"Unknown",category:"unknown",osiApproved:false,fsfLibre:false,deprecated:false,referenceUrl:"",riskLevel:"medium",obligations:{...di}}}function hi(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 su={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"},gi=new Map;for(let[t,e]of Object.entries(su))gi.set(hi(t),e);function yi(t){return gi.get(hi(t))}var ou=/\(|\)|\bWITH\b|\bAND\b|\bOR\b|[^\s()]+/gi;function iu(t){let e=(t??"").trim(),n=[],r=[],s=false,o=false,i=false,a=false,c=e.match(ou)??[];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:au(n,r,l,i,e)}}function au(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 cu(t){return /\b(?:AND|OR|WITH)\b|\+\s*$|\(/i.test(t)}var _o={"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 vi(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 lu(t){let e=(t??"").trim();if(!e||/^(unknown|noassertion|none|n\/a)$/i.test(e))return Ce(dr(),"unknown",0);let n=z(e);if(n)return Ce(n,"exact",1);if(cu(e))return uu(e);let r=yi(e);if(r){let o=z(r);if(o)return Ce(o,"alias",.95)}let s=vi(e);return s?{...Ce(s,"fuzzy",.6),name:e.slice(0,120)}:Ce(dr(e.slice(0,120)),"unknown",0)}function uu(t){let e=iu(t);if(e.licenseIds.length===0)return Ce(dr(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=yi(c);if(u){let f=z(u);if(f)return Ce(f,"alias",.95)}let p=vi(c);return p?Ce(p,"fuzzy",.6):Ce(dr(c),"unknown",0)}),r=e.operator!=="OR",s=n[0];for(let c of n){let l=_o[c.category]>_o[s.category];(r?l:!l)&&(s=c);}let o=pu(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:fi(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 pu(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 fu(t,e){let n=(t??"").trim();if(!n)return {raw:null,spdxId:null,source:"none",confidence:0};let r=lu(n);return {raw:n.slice(0,200),spdxId:r.matchStatus==="unknown"?null:r.spdxId,source:e,confidence:r.confidence}}var Fo={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 du(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 Ol(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 An.availableParallelism=="function"?An.availableParallelism():An.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,v]of Object.entries(C))pi(v)&&g.add(x);}catch{}})),g.size>0)try{await e.prefetch([...g]);}catch{}let y=await Promise.all(o$1.map(async w=>h.run(async()=>{try{let j=mu(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 y)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 mu(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 v=Ar(s,"nodejs"),b=de.minVersion(l);if(v&&b){let T=de.major(b);u=`${v.major}.0.0`,p=Math.max(0,v.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=[],y=[],w={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=[];for(let v of h)if(v.deps)for(let[b,k]of Object.entries(v.deps))pi(k)&&j.push({pkg:b,section:v.name,spec:k});await n$1.prefetch(j.map(v=>v.pkg));let P=j.map(async v=>{let b=await n$1.get(v.pkg);return {...v,meta:b}}),C=await Promise.all(P);for(let{pkg:v,section:b,spec:k,meta:T}of C){let m=o?.resolve(v,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=Yc($,L,T.releaseDates),H=Xc(pe);g.push({package:v,section:b,currentSpec:k,resolvedVersion:$,latestStable:L,majorsBehind:I,drift:V,license:fu(T.license,"registry"),ageDays:pe,libyears:H}),v in Fo&&y.push({name:Fo[v],currentVersion:$,latestVersion:L,majorsBehind:I});}for(let v of h)if(v.deps)for(let[b,k]of Object.entries(v.deps))k.trim().startsWith("workspace:")&&(g.push({package:b,section:v.name,currentSpec:k,resolvedVersion:null,latestStable:null,majorsBehind:null,drift:"unknown",license:{raw:null,spdxId:null,source:"none",confidence:0}}),w.unknown++);g.sort((v,b)=>{let k={"major-behind":0,"minor-behind":1,current:2,unknown:3},T=(k[v.drift]??9)-(k[b.drift]??9);return T!==0?T:v.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:y,dependencies:g,dependencyAgeBuckets:w,libyears:Qc(g.map(v=>v.libyears))??void 0,fileCount:x}}var bi=new je({ignoreAttributes:false,attributeNamePrefix:"@_"}),Oo={"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 Zr(t){return t.replace(/\\/g,"/")}function hu(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 Bo(t){return t.endsWith(".csproj")||t.endsWith(".vbproj")}function es(t){return B.basename(t).replace(/\.(cs|vb)proj$/i,"")}function gu(t,e){let r=bi.parse(t)?.Project;if(!r)return {targetFrameworks:[],packageReferences:[],projectReferences:[],projectName:es(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:es(e)}}function yu(t){let n=bi.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 vu(t,e,n,r,s=Ne){let o$1=n?await n.findFiles(t,Bo):await i(t,Bo),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 y=B.resolve(d,g[1].replace(/\\/g,"/"));a.add(y);}}catch{}let c=new Set([...o$1,...a]),l=[],u=r??n?.projectScanTimeout??18e4;for(let p of c)try{let f=bu(p,t,e,n,s),d=await Me(f,u);if(d.ok)l.push(d.value);else {let h=Zr(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 bu(t,e,n,r,s){let o$1=r?await r.readTextFile(t):await o(t),i=gu(o$1,t),a=B.dirname(t);{let x=B.join(a,"packages.config");try{let v=r?await r.readTextFile(x):await o(x),b=new Set(i.packageReferences.map(k=>k.name.toLowerCase()));for(let k of yu(v))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=hu(c);x!==null&&l!==void 0&&(u=Math.max(0,l-x)),p=yt(s,"dotnet",c);let v=it("dotnet",c);v&&(f=gt(s,"dotnet",v));}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}}),v=await Promise.all(x);for(let{ref:b,meta:k}of v){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 y=[],w=new Map(h.map(x=>[x.package,x]));for(let x of i.packageReferences)if(x.name in Oo){let v=w.get(x.name);y.push({name:Oo[x.name],currentVersion:v?.resolvedVersion??x.version,latestVersion:v?.latestStable??null,majorsBehind:v?.majorsBehind??null});}let j=i.projectReferences.map(x=>{let v=B.resolve(a,x),b=Zr(B.relative(e,B.dirname(v))),k=es(v);return {path:b||".",name:k,refType:"project"}}),P;try{P=r?await r.countFilesUnder(e,a):void 0;}catch{}h.sort((x,v)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},k=(b[x.drift]??9)-(b[v.drift]??9);return k!==0?k:x.package.localeCompare(v.package)});let C=g;return {type:"dotnet",path:Zr(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:y,dependencies:h,dependencyAgeBuckets:C,projectReferences:j.length>0?j:void 0,fileCount:P}}function wi(t){if(!t)return null;try{let e=Ur(t);return e&&typeof e=="object"?e:null}catch{return null}}function mr(t){return t.trim().toLowerCase().replace(/[-_.]+/g,"-")}function wu(t){let e=t.trim().replace(/^[=~^><!]+\s*/,"").split(/[,;\s]/)[0];return /^\d/.test(e)?e:null}function Su(t){let e=new Map,r=wi(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=mr(o);e.has(a)||e.set(a,i);}return e}function ku(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=wu(a),l=mr(o);c&&!e.has(l)&&e.set(l,c);}}return e}var xu=[["poetry","poetry.lock"],["uv","uv.lock"],["pdm","pdm.lock"]];async function Eu(t,e){for(let[r,s]of xu){let o=B.join(t,s);if(await e.exists(o).catch(()=>false))try{let i=Su(await e.readText(o));if(i.size)return {source:r,size:i.size,resolve:a=>i.get(mr(a))??null}}catch{}}let n=B.join(t,"Pipfile.lock");if(await e.exists(n).catch(()=>false))try{let r=ku(await e.readJson(n));if(r.size)return {source:"pipfile",size:r.size,resolve:s=>r.get(mr(s))??null}}catch{}return null}var Vo={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 ps(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 ju(t){return t.match(/^==\s*([^\s,;]+)/)?.[1]??null}function Tu(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 Cu(t){let e=[];for(let n of t.split(`
73
+ `)){let r=ps(n);r&&e.push(r);}return e}function Au(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=ps(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 Pu(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 fu(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=cs(a);c&&e.deps.push(c);}}}return e}var mi=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 du(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,l=>mi.has(l)||/^requirements.*\.txt$/.test(l)):await mu(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=hu(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 mu(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>mi.has(n)||/^requirements.*\.txt$/.test(n))}async function hu(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=uu(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=fu(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 pu(T))l.has(m.normalisedName)||l.set(m.normalisedName,m);else if(x.startsWith("requirements")&&x.endsWith(".txt"))for(let m of lu(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 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),y=[],w=[],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??au(b.spec),A=m?cu(m):null,$=x.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++;y.push({package:b.name,section:"dependencies",currentSpec:b.spec||"*",resolvedVersion:A,latestStable:$,majorsBehind:L,drift:I}),b.normalisedName in Ro&&w.push({name:Ro[b.normalisedName],currentVersion:A,latestVersion:$,majorsBehind:L});}y.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 v;try{v=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:y,dependencyAgeBuckets:j,fileCount:v}}var gu=/^([^:=\s]+):([^:=\s]+):([^=\s]+)=/;function gi(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=gu.exec(r);if(!s)continue;let o=`${s[1]}:${s[2]}`;e.has(o)||e.set(o,s[3]);}return e}async function yu(t,e){let n=B.join(t,"gradle.lockfile");if(!await e.exists(n).catch(()=>false))return null;try{let r=gi(await e.readText(n));return r.size?{size:r.size,resolve:s=>r.get(s)??null}:null}catch{return null}}var vu=new je({ignoreAttributes:false,attributeNamePrefix:"@_"}),Io={"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=vu.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,y]of Object.entries(r.properties))(typeof y=="string"||typeof y=="number")&&(s[g]=String(y));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 wu(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 Su(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 yi=new Set(["pom.xml","build.gradle","build.gradle.kts"]);async function ku(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,u=>yi.has(u)):await xu(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=Eu(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 xu(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>yi.has(n))}async function Eu(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 $=wu(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=Cr(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 yu(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},v=[...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(v);for(let{key:T,dep:m,meta:A}of b){let $=w?.resolve(T)??null,L=Su($??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 Io&&P.push({name:Io[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 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 ju=/^ {4}([A-Za-z0-9._-]+) \(([^()]+)\)\s*$/;function Tu(t){let e=new Map;if(!t)return e;for(let n of t.split(`
79
- `)){let r=ju.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 Cu(t,e){let n=B.join(t,"Gemfile.lock");if(!await e.exists(n).catch(()=>false))return null;try{let r=Tu(await e.readText(n));return r.size?{size:r.size,resolve:s=>r.get(s)??null}:null}catch{return null}}var _o={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 Au(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 Pu(t){if(t==="*")return null;let e=t.match(/(?:~>|>=|>|=|<=|<)?\s*(\d+(?:\.\d+)*)/);return e?e[1]:null}function Mu(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 $u(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=Au(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 Lu(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 Nu(t){return t.match(/^\s*ruby\s+['"]([^'"]+)['"]/m)?.[1]}var bi=new Set(["Gemfile"]);function ls(t){return t.endsWith(".gemspec")}async function Ru(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,l=>bi.has(l)||ls(l)):await Iu(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=_u(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 Iu(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>bi.has(n)||ls(n))}async function _u(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=Nu(T);m&&(c=m);for(let A of $u(T))l.has(A.name)||l.set(A.name,A);}else if(ls(x)){let m=x.replace(/\.gemspec$/,"");m&&(a=m);for(let A of Lu(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 x=it("ruby",c);x&&(d=gt(o$1,"ruby",x));}let g=await Cu(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),y=[],w=[],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??Pu(b.spec),A=m?Mu(m):null,$=x.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";y.push({package:b.name,section:V,currentSpec:b.spec,resolvedVersion:A,latestStable:$,majorsBehind:L,drift:I}),b.name in _o&&w.push({name:_o[b.name],currentVersion:A,latestVersion:$,majorsBehind:L});}y.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 v;try{v=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:y,dependencyAgeBuckets:j,fileCount:v}}var Fo={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 Fu(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 Ou(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 Bu(t){return t.match(/\/\/\s*swift-tools-version:\s*(\d+\.\d+)/i)?.[1]}var wi=new Set(["Package.swift"]);async function Vu(t,e,n,r){let s=n?await n.findFiles(t,a=>wi.has(a)):await Du(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=Uu(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 Du(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>wi.has(n))}async function Uu(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=Bu(a),l=Fu(a),u=B.join(t,"Package.resolved"),p=new Map;try{let C=s?await s.readTextFile(u):await o(u);p=Ou(C);}catch{}let f,d;if(c){let C=c.match(/(\d+)\.(\d+)/);if(C){let E=parseInt(C[1],10),v=parseInt(C[2],10);E===St.major?f=Math.max(0,St.minor-v):E<St.major&&(f=(St.major-E)*10+St.minor),d=`${St.major}.${St.minor}`;}}let h=[],g=[],y={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},w=l.map(async C=>{let E=await r.get(C.url);return {dep:C,meta:E}}),j=await Promise.all(w);for(let{dep:C,meta:E}of j){let v=p.get(C.name.toLowerCase())??(C.type==="exact"?C.version:null),b=v?Ie.valid(Ie.clean(v)):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?y.current++:T===1?y.oneBehind++:y.twoPlusBehind++;}else y.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 Fo&&g.push({name:Fo[A],currentVersion:b,latestVersion:x,majorsBehind:T});}h.sort((C,E)=>{let v={"major-behind":0,"minor-behind":1,current:2,unknown:3},b=(v[C.drift]??9)-(v[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:y,fileCount:P}}var Oo={"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 Gu(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 Si=new Set(["go.mod"]);async function qu(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,c=>Si.has(c)):await Hu(t),i=[],a=r??n?.projectScanTimeout??18e4;for(let c of o){let l=B.dirname(c);try{let u=zu(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 Hu(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Si.has(n))}async function zu(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}=Gu(c),p=u.filter(v=>!v.indirect),f,d,h,g;if(l){let v=l.match(/(\d+)\.(\d+)/);if(v){let x=parseInt(v[1],10),T=parseInt(v[2],10),m=pn(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 y=[],w=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},P=p.map(async v=>{let b=await r.get(v.path);return {dep:v,meta:b}}),C=await Promise.all(P);for(let{dep:v,meta:b}of C){let x=_e.valid(_e.clean(v.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++;y.push({package:v.path,section:"dependencies",currentSpec:v.version,resolvedVersion:x,latestStable:T,majorsBehind:m,drift:A}),v.path in Oo&&w.push({name:Oo[v.path],currentVersion:x,latestVersion:T,majorsBehind:m});}y.sort((v,b)=>{let x={"major-behind":0,"minor-behind":1,current:2,unknown:3},T=(x[v.drift]??9)-(x[b.drift]??9);return T!==0?T:v.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:w,dependencies:y,dependencyAgeBuckets:j,fileCount:E}}function Wu(t){let e=new Map,r=di(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 Ju(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 Bo(t,e){let n=B.join(t,"Cargo.lock");if(!await e.exists(n).catch(()=>false))return null;try{let r=Wu(await e.readText(n));return r.size?{size:r.size,resolve:(s,o)=>Ju(r.get(s),o)}:null}catch{return null}}var Vo={"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 Ku(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 Yu(t){return t.match(/^\s*edition\s*=\s*"(\d+)"/m)?.[1]}var xi=new Set(["Cargo.toml"]);async function Xu(t,e,n,r){let s=n?await n.findFiles(t,a=>xi.has(a)):await Qu(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=Zu(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 Qu(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>xi.has(n))}async function Zu(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=Yu(a),l=Ku(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 Bo(t,u).catch(()=>null);!p$1&&t!==n$1&&(p$1=await Bo(n$1,u).catch(()=>null));let f=l.filter(E=>!E.isDev),d,h;if(c){let E=parseInt(c,10),v=2024;d=Math.max(0,Math.floor((v-E)/3)),h=v.toString();}let g=[],y=[],w={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=f.map(async E=>{let v=await r.get(E.name);return {dep:E,meta:v}}),P=await Promise.all(j);for(let{dep:E,meta:v}of P){let b=p$1?.resolve(E.name,E.version)??null,x=b&&Ae.valid(b)?b:Ae.valid(Ae.coerce(E.version)),T=v.latestStableOverall,m=null,A="unknown";if(x&&T){let L=Ae.major(x);m=Ae.major(T)-L,m===0?A=Ae.eq(x,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 $=E.isDev?"devDependencies":"dependencies";g.push({package:E.name,section:$,currentSpec:E.version,resolvedVersion:x,latestStable:T,majorsBehind:m,drift:A}),E.name in Vo&&y.push({name:Vo[E.name],currentVersion:x,latestVersion:T,majorsBehind:m});}g.sort((E,v)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},x=(b[E.drift]??9)-(b[v.drift]??9);return x!==0?x:E.package.localeCompare(v.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:y,dependencies:g,dependencyAgeBuckets:w,fileCount:C}}var Do={"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 ep(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 tp(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 np(t){return t.match(/(\d+)\.(\d+)/)?.[0]}var Ei=new Set(["composer.json"]);async function rp(t,e,n,r){let s=n?await n.findFiles(t,a=>Ei.has(a)):await sp(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=op(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 sp(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ei.has(n))}async function op(t,e,n,r,s){let o=B.relative(n,t)||".",i=B.basename(t===n?n:t),{phpVersion:a,deps:c}=await ep(e,s),l=B.join(t,"composer.lock"),u=new Map;try{u=await tp(l,s);}catch{}let p=c.filter(E=>!E.isDev),f,d,h;if(a&&(h=np(a),h)){let E=h.match(/(\d+)\.(\d+)/);if(E){let v=parseInt(E[1],10),b=parseInt(E[2],10);v===kt.major?f=Math.max(0,kt.minor-b):v<kt.major&&(f=kt.minor+(kt.major-v)*10),d=`${kt.major}.${kt.minor}`;}}let g=[],y=[],w={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=p.map(async E=>{let v=await r.get(E.name);return {dep:E,meta:v}}),P=await Promise.all(j);for(let{dep:E,meta:v}of P){let b=u.get(E.name),x=b?Fe.valid(Fe.clean(b)):null,T=v.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?w.current++:m===1?w.oneBehind++:w.twoPlusBehind++;}else w.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 Do&&y.push({name:Do[E.name],currentVersion:x,latestVersion:T,majorsBehind:m});}g.sort((E,v)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},x=(b[E.drift]??9)-(b[v.drift]??9);return x!==0?x:E.package.localeCompare(v.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:y,dependencies:g,dependencyAgeBuckets:w,fileCount:C}}var Uo={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 ap(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 cp(t){return t.match(/(\d+\.\d+\.\d+)/)?.[0]}var ji=new Set(["pubspec.yaml"]);async function lp(t,e,n,r){let s=n?await n.findFiles(t,a=>ji.has(a)):await up(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=pp(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 up(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>ji.has(n))}async function pp(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 ap(u,s);}catch{}let f=l.filter(v=>!v.isDev),d,h,g;if(c&&(g=cp(c),g)){let v=g.match(/(\d+)\.(\d+)/);if(v){let b=parseInt(v[1],10),x=parseInt(v[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 y=[],w=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},P=f.map(async v=>{let b=await r.get(v.name);return {dep:v,meta:b}}),C=await Promise.all(P);for(let{dep:v,meta:b}of C){let x=p.get(v.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=v.isDev?"devDependencies":"dependencies";y.push({package:v.name,section:L,currentSpec:v.version,resolvedVersion:T,latestStable:m,majorsBehind:A,drift:$}),v.name in Uo&&w.push({name:Uo[v.name],currentVersion:T,latestVersion:m,majorsBehind:A});}y.sort((v,b)=>{let x={"major-behind":0,"minor-behind":1,current:2,unknown:3},T=(x[v.drift]??9)-(x[b.drift]??9);return T!==0?T:v.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:w,dependencies:y,dependencyAgeBuckets:j,fileCount:E}}var fp="https://hex.pm/api",dp=1e4,mp=10;async function hp(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(),dp),c=`${fp}/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 hr.SemVer(d).prerelease.length===0}catch{return !1}});return f.length===0?null:(f.sort((d,h)=>{try{return (0,hr.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 gp(t,e,n=false){let r=new Map,s=new a$1(mp),o=t.map(async i=>{let a=await hp(i,e,s,n);a&&r.set(i,a);});return await Promise.all(o),r}var yp=new Set(["mix.exs"]),vp=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;){a[1];}return {elixirVersion:s,deps:r}}async function wp(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 Sp(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 kp(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 wp(c,e),u=a.filter(y=>!y.isDev),p$1=u.map(y=>y.name),f=await gp(p$1,n,r),d=[],h=[],g={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let y of u){let w=l.get(y.name),j=w||y.version,P=f.get(y.name),C=P?Sp(j,P):"unknown",E=null;if(w&&P)try{let v=(0,Se.minVersion)((0,Se.validRange)(j)||j),b=(0,Se.minVersion)((0,Se.validRange)(P)||P);v&&b&&(E=b.major-v.major);}catch{}d.push({package:y.name,section:y.isDev?"devDependencies":"dependencies",currentSpec:y.version,resolvedVersion:w||null,latestStable:P||null,majorsBehind:E,drift:C}),C==="current"?g.current++:E===1?g.oneBehind++:E&&E>1?g.twoPlusBehind++:g.unknown++,vp.has(y.name)&&h.push({name:y.name,currentVersion:w||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 xp(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>yp.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 kp(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 Ep="https://hub.docker.com/v2",jp=1e4,Tp=10;function us(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 Cp(t,e,n){let r=async()=>{try{let s=new AbortController,o=setTimeout(()=>s.abort(),jp),i=`${Ep}/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 Ap(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 gr.SemVer(r);o.prerelease.length===0&&e.push(o);}catch{}}return e.length===0?null:(e.sort((n,r)=>(0, gr.gt)(n.version,r.version)?-1:1),e[0].version)}async function Pp(t,e,n,r=false){let s=us(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 Cp(a,s.image,n);return Ap(c)}async function Mp(t,e,n=false){let r=new Map,s=new a$1(Tp),o=t.map(async i=>{let a=await Pp(i,e,s,n);a&&r.set(i,a);});return await Promise.all(o),r}var $p=new Set(["Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml"]);async function Lp(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=us(i);r.push({name:`${a.namespace||"library"}/${a.image}`,currentTag:a.tag||"latest"});}return r}async function Np(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=us(i);r.push({name:`${a.namespace||"library"}/${a.image}`,currentTag:a.tag||"latest"});}return r}function Rp(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 Ip(t,e,n,r=false){let s=[],o=`${t}/Dockerfile`;if(e?await e.pathExists(o):await p(o)){let d=await Lp(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 y=await Np(h,e);s.push(...y);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 Mp(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),y=g?Rp(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:y}),y==="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 _p(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>$p.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 Ip(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 Fp="https://artifacthub.io/api/v1",Op=1e4,Bp=10;async function Vp(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(),Op),u=`${Fp}/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 Dp(t,e,n=false){let r=new Map,s=new a$1(Bp),o=t.map(async i=>{let a=await Vp(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 Up=new Set(["Chart.yaml","Chart.yml"]);async function Gp(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,""),y=h.index,w=d.exec(f),j=w?w.index:f.length;d.lastIndex=y+1;let P=f.substring(y,j),C=P.match(/version:\s*(.+)$/m),E=C?C[1].trim().replace(/["']/g,""):"*",v=P.match(/repository:\s*(.+)$/m),b=v?v[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 qp(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 Hp(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 zp(t,e,n,r=false){let s=null;for(let g of ["Chart.yaml","Chart.yml"]){let y=`${t}/${g}`;if(e?await e.pathExists(y):await p(y)){s=y;break}}if(!s)return null;let{chartName:o,chartVersion:i,appVersion:a,dependencies:c}=await Gp(s,e),l=`${t}/Chart.lock`,u=await qp(l,e),p$1=c.map(g=>({name:g.name,repo:g.repository})),f=await Dp(p$1,n,r),d=[],h={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let g of c){let y=u.get(g.name),w=y||g.version,j=g.repository?`${g.repository}/${g.name}`:g.name,P=f.get(j),C=P?Hp(w,P):"unknown",E=null;if(P)try{let v=(0,ke.minVersion)((0,ke.validRange)(w)||w),b=(0,ke.minVersion)((0,ke.validRange)(P)||P);v&&b&&(E=b.major-v.major);}catch{}d.push({package:g.name,section:"dependencies",currentSpec:g.version,resolvedVersion:y||null,latestStable:P||null,majorsBehind:E,drift:C}),C==="current"?h.current++:E===1?h.oneBehind++:E&&E>1?h.twoPlusBehind++:h.unknown++;}return {type:"helm",path:B.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:o||B.basename(t),runtime:a,frameworks:[],dependencies:d,dependencyAgeBuckets:h}}async function Wp(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>Up.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 zp(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 Ti="https://registry.terraform.io/v1",Ci=1e4,Jp=10;async function Kp(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(),Ci),u=`${Ti}/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 y=new rn.SemVer(g.version);y.prerelease.length===0&&h.push(y);}catch{}return h.length===0?null:(h.sort((g,y)=>(0,rn.gt)(g.version,y.version)?-1:1),h[0].version)}catch(c){return c?.name==="AbortError",null}};return r?r.run(a):a()}async function Yp(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(),Ci),p=`${Ti}/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,y=[];for(let w of g)try{let j=new rn.SemVer(w.version);j.prerelease.length===0&&y.push(j);}catch{}return y.length===0?null:(y.sort((w,j)=>(0,rn.gt)(w.version,j.version)?-1:1),y[0].version)}catch(l){return l?.name==="AbortError",null}};return s?s.run(c):c()}async function Xp(t,e,n=false){let r=new Map,s=new a$1(Jp),o=t.map(async i=>{let a=null,c;i.type==="provider"?(c=`${i.namespace}/${i.name}`,a=await Kp(i.namespace,i.name,e,s,n)):(c=`${i.namespace}/${i.name}/${i.provider}`,a=await Yp(i.namespace,i.name,i.provider,e,s,n)),a&&r.set(c,a);});return await Promise.all(o),r}async function Qp(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],y=g.match(/source\s*=\s*"([^"]+)"/);if(!y)continue;let w=y[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(y=>y.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*"([^"]+)"/),y=g?g[1]:void 0;s.push({source:h,version:y});}return {terraformVersion:o$1,providers:r,modules:s}}async function Zp(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 Go(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 ef(t,e,n,r=false){let s=[];if(e){let y=await e.findFiles(t,w=>w.endsWith(".tf"));s.push(...y);}else {let y=["main.tf","variables.tf","outputs.tf","versions.tf","providers.tf"];for(let w of y){let j=`${t}/${w}`;await p(j)&&s.push(j);}}if(s.length===0)return null;let o,i=[],a=[];for(let y of s){let{terraformVersion:w,providers:j,modules:P}=await Qp(y,e);w&&!o&&(o=w),i.push(...j),a.push(...P);}let c=new Map;for(let y of i)c.has(y.source)||c.set(y.source,y.version);let l=new Map;for(let y of a)l.has(y.source)||l.set(y.source,y.version);let u=`${t}/.terraform.lock.hcl`,p$1=await Zp(u,e),f=[];for(let[y]of c){let[w,j]=y.split("/");f.push({type:"provider",namespace:w,name:j});}for(let[y]of l){let w=y.split("/");if(w.length===3){let[j,P,C]=w;f.push({type:"module",namespace:j,name:P,provider:C});}}let d=await Xp(f,n,r),h=[],g={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let[y,w]of c){let j=p$1.get(y),P=j||w||"unknown",C=d.get(y),E=C&&P!=="unknown"?Go(P,C):"unknown",v=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&&(v=x.major-b.major);}catch{}h.push({package:`provider:${y}`,section:"dependencies",currentSpec:w||"unknown",resolvedVersion:j||null,latestStable:C||null,majorsBehind:v,drift:E}),E==="current"?g.current++:v===1?g.oneBehind++:v&&v>1?g.twoPlusBehind++:g.unknown++;}for(let[y,w]of l){let j=w||"unknown",P=d.get(y),C=P&&j!=="unknown"?Go(j,P):"unknown",E=null;if(P&&j!=="unknown")try{let v=(0,re.minVersion)((0,re.validRange)(j)||j),b=(0,re.minVersion)((0,re.validRange)(P)||P);v&&b&&(E=b.major-v.major);}catch{}h.push({package:`module:${y}`,section:"dependencies",currentSpec:w||"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 tf(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 ef(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"}],nf=[{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 rf(t,e){return B.basename(t)||B.basename(e)}function sf(t){return /^\s*(CC|CFLAGS|LDFLAGS)\s*[:?+]?=/m.test(t)||/\b(gcc|clang)\b/.test(t)||/\.(c|o)\b/.test(t)}function Gr(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:rf(i,s),frameworks:[],dependencies:o,dependencyAgeBuckets:{current:0,oneBehind:0,twoPlusBehind:0,unknown:o.length}}));}async function of(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 af(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 nf){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 cf(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(!sf(f))continue}let u=B.dirname(c.relPath)||".",p=await of(c.absPath,e);Gr(o$1,i,l.type,u,t,p);}for(let c of s)Gr(o$1,i,"shell",c,t);let a=af(n);for(let[c,l]of a)for(let u of l)Gr(o$1,i,u,c,t);return o$1}var lf=10,uf=1048576,pf=5,ff=20,df=2621440,mf=10,hf=30,gf=5242880,yf=25,Zr=25,es=10,ts=3,u0=1;function qr(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 vf(t){return qr(t,lf,uf,pf)>=2?"nano":qr(t,ff,df,mf)>=2?"micro":qr(t,hf,gf,yf)>=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 p0(t){switch(t){case "nano":return 1/Zr;case "micro":return 1/es;case "small":return 1/ts;default:return 1}}function wf(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/ts+n/es+e/Zr;return {nanoCount:e,microCount:n,smallCount:r,standardCount:s,totalScanned:e+n+r+s,nanoBillingRatio:Zr,microBillingRatio:es,smallBillingRatio:ts,billableProjectsRaw:Math.round(o*100)/100,billableProjects:Math.floor(o)}}var Sf={N:.85,A:.62,L:.55,P:.2},kf={L:.77,H:.44},xf={N:.85,R:.62},Ef={N:.85,L:.62,H:.27},jf={N:.85,L:.68,H:.5},Hr={H:.56,L:.22,N:0};function Tf(t){let e=Math.round(t*1e5);return e%1e4===0?e/1e5:(Math.floor(e/1e4)+1)/10}function Ai(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[y,w]=g.split(":");y&&w&&(n[y.toUpperCase()]=w.toUpperCase());}let r=n.S==="C",s=Sf[n.AV],o=kf[n.AC],i=xf[n.UI],a=(r?jf:Ef)[n.PR],c=Hr[n.C],l=Hr[n.I],u=Hr[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 Tf(h)}function Pi(t){return t>=9?"critical":t>=7?"high":t>=4?"moderate":t>0?"low":"unknown"}function ir(t){switch(t){case "critical":return 4;case "high":return 3;case "moderate":return 2;case "low":return 1;default:return 0}}function Mi(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 Cf="https://api.osv.dev/v1/querybatch",Af="https://api.osv.dev/v1/vulns/",Pf=15e3,Ho=500,Mf=3,$f=250,Lf=new Set([408,425,429,500,502,503,504]);function Nf(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 Rf(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 If(){return {low:0,moderate:0,high:0,critical:0,unknown:0}}function nn(t){return `${t.ecosystem}\0${t.package}\0${t.version}`}function _f(t){let e=new Set,n=[];for(let r of t){let s=Nf(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 $i(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 Ff(t,e){let n=t.severity?.find(p=>(p.type??"").toUpperCase().startsWith("CVSS_V3"))?.score??null,r=Ai(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?Pi(r):Mi(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 Li(t){let e=typeof t.cvss=="number"?t.cvss:Ai(t.cvssVector??null),n=t.severity?Mi(t.severity):e!=null?Pi(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 Of(t){return new Promise(e=>setTimeout(e,t))}async function Ni(t,e,n){return n.run(async()=>{for(let r=0;;r++){let s=new AbortController,o=setTimeout(()=>s.abort(),Pf);try{let i=await fetch(t,{...e,signal:s.signal});if(i.ok)return {ok:!0,data:await i.json()};if(!Lf.has(i.status))return {ok:!1}}catch{}finally{clearTimeout(o);}if(r>=Mf)return {ok:false};await Of($f*2**r);}})}async function Bf(t,e){let n=new Map,r=true;for(let s=0;s<t.length;s+=Ho){let o=t.slice(s,s+Ho),i=JSON.stringify({queries:o.map(l=>({version:l.version,package:{name:l.package,ecosystem:Rf(l.ecosystem)}}))}),a=await Ni(Cf,{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 Vf(t,e){let n=new Map;return await Promise.all([...t].map(async r=>{let s=await Ni(`${Af}${encodeURIComponent(r)}`,{method:"GET"},e);s.ok&&s.data&&n.set(r,s.data);})),n}function Ri(t,e){e.sort((s,o)=>s.ecosystem.localeCompare(o.ecosystem)||s.package.localeCompare(o.package)||s.version.localeCompare(o.version));let n=If(),r=0;for(let s of e){s.advisories.sort((i,a)=>ir(a.severity)-ir(i.severity)||i.id.localeCompare(a.id)),r+=s.advisories.length;let o=s.advisories.reduce((i,a)=>ir(a.severity)>ir(i)?a.severity:i,"unknown");n[o]++;}return {source:t,packages:e,totalAdvisories:r,severityCounts:n}}function ns(){return {source:"none",packages:[],totalAdvisories:0,severityCounts:{low:0,moderate:0,high:0,critical:0,unknown:0}}}async function Df(t,e){if(t.length===0)return ns();if(e.offline)return zo(t,e.manifest);let{idsByTarget:n,allBatchesOk:r}=await Bf(t,e.sem);if(n.size===0){let c=zo(t,e.manifest);return c.packages.length?c:{...ns(),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 Vf(s,e.sem),i=Ii(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(Ff(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 Ri("osv",a)}function Ii(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&&$i(r.version,i.ranges,i.versions));o.length&&n.set(nn(r),o.map(Li));}return n}function zo(t,e){let n=Ii(t,e);if(n.size===0)return ns();let r=[];for(let s of t){let o=n.get(nn(s));o?.length&&r.push({...s,advisories:o});}return Ri("manifest",r)}var Uf="vibgrate/vulnerability";function Gf(t){switch(t){case "critical":case "high":return "error";case "moderate":return "warning";default:return "note"}}function qf(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:Uf,level:Gf(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 Hf=new Set(["node_modules",".git","dist","build","out",".vibgrate","vendor",".venv","venv","env","__pycache__","target",".next",".nuxt","coverage",".cache"]),Wo=8e3,zf=12,Wf=1048576,Jf=5,Kf={npm:new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts",".vue",".svelte"]),pypi:new Set([".py"])};function Yf(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xf(t,e){let n=Yf(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 Qf(t,e,n){let r={importSites:0,filesTouched:0,sampleFiles:[]};if(n==="unknown")return r;let s=Kf[n],o=Xf(n,e);if(!s||!o)return r;let i=0,a=0,c=[],l=0,u=(p,f)=>{if(f>zf||l>=Wo)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>=Wo)return;if(h.isDirectory()){if(Hf.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),y;try{if(sn.statSync(g).size>Wf)continue;y=sn.readFileSync(g,"utf8");}catch{continue}o.lastIndex=0;let w=y.match(o);w&&w.length&&(i+=w.length,a++,c.length<Jf&&c.push(B.relative(t,g).replace(/\\/g,"/")));}}};return u(t,0),c.sort(),{importSites:i,filesTouched:a,sampleFiles:c}}function Zf(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 ed(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 td(t,e,n){return t!=null&&t>=2?"multi-major-plan":t===1?"single-major":e&&n&&e!==n?"patch-minor":"current"}function f0(t,e,n={}){let{majorsBehind:r,interimMajors:s}=Zf(e.currentVersion,e.latestVersion,e.majorsBehind),o=Qf(t,e.package,e.ecosystem),i=ed(r,o),a=td(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 nd=12e3,rd=100,zr={source:"none",repositoryUrl:null,releasesScanned:0,breakingReleases:[],notes:[]},sd={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"},_i=[{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 od(t){if(!t)return [];let e=new Set;for(let{re:n,label:r}of _i)n.test(t)&&e.add(r);return [...e]}function id(t){if(!t)return null;for(let{re:e}of _i){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 ad(t){if(!t)return null;let e=t.match(/github\.com[/:]([^/]+)\/([^/#?]+?)(?:\.git)?(?:[/#?].*)?$/i);return e?{owner:e[1],repo:e[2]}:null}function cd(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 ld(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 ud(t,e,n,r){let s=[];for(let o of t){if(o.draft)continue;let i=o.tag_name??o.name??"",a=cd(i,r);if(!a||!ld(a,e,n))continue;let c=[o.name,o.body].filter(Boolean).join(`
80
- `),l=od(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 Fi(t){let e=new AbortController,n=setTimeout(()=>e.abort(),nd);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 pd(t,e){let n=sd[t];if(!n)return null;let s=(await Fi(`https://packages.ecosyste.ms/api/v1/registries/${n}/packages/${encodeURIComponent(e)}`))?.repository_url;return typeof s=="string"?s:null}async function d0(t,e,n,r,s={}){if(t==="unknown"||!n||!r)return zr;let o=s.repositoryUrl??await pd(t,e),i=ad(o);if(!i)return {...zr,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 Fi(`https://api.github.com/repos/${i.owner}/${i.repo}/releases?per_page=${rd}`);if(!Array.isArray(a))return {...zr,repositoryUrl:o,notes:["could not fetch releases (network, rate limit, or no GitHub Releases)"]};let c=ud(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 dd=15e3,md=64*1024*1024,Oi=500,hd="";function vr(t,e){return new Promise(n=>{execFile("git",e,{cwd:t,timeout:dd,maxBuffer:md,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 Jo=new Map;function Bi(t){return t.split(B.sep).join("/")}async function Nn(t){let e=B.resolve(t),n=Jo.get(e);if(n!==void 0)return n;let r=await vr(e,["rev-parse","--show-toplevel"]),s=r.ok&&r.stdout.trim()||null;return Jo.set(e,s),s}async function gd(t){return await Nn(t)!==null}async function yd(t){let e=await Nn(t);if(!e)return null;let n=await vr(e,["rev-parse","HEAD"]);return n.ok&&n.stdout.trim()||null}async function vd(t,e,n={}){let r=await Nn(t);if(!r)return [];let s=Math.max(1,n.maxCommits??Oi),o=["%H","%h","%an","%ae","%aI","%s"].join("%x1f"),i=await vr(r,["log",`--max-count=${s}`,"--follow",`--format=${o}`,"--",Bi(e)]);if(!i.ok)return [];let a=[];for(let c of i.stdout.split(`
81
- `)){if(!c)continue;let l=c.split(hd);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 Nn(t);if(!r)return null;let s=await vr(r,["show",`${e}:${Bi(n)}`]);return s.ok?s.stdout:null}var Vi=3,Di="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 rs(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"&&Ui(o,e),e}function Ui(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"&&Ui(s.dependencies,e);}}function wd(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 Sd(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=wd(o);i&&he(e,i.name,i.version);}return e}function kd(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 xd(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=kd(r.replace(/:\s*$/,""));continue}let s=r.match(/^\s+version:?\s+"?([^"\s]+)"?/);s&&n&&he(e,n,s[1]);}return e}function Ko(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 Ed(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 jd(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 Td(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 Cd(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 Ad(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 Pd(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 Md(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 $d=new je({ignoreAttributes:true,parseTagValue:false,trimValues:true});function Ld(t){return t==null?[]:Array.isArray(t)?t:[t]}function Nd(t){return !!t&&!t.includes("${")&&!/[[\](),]/.test(t)}function Rd(t){let e=new Map;if(!t)return e;let n;try{n=$d.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 Ld(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();Nd(d)&&he(e,`${p}:${f}`,d);}return e}var Gi=[{ecosystem:"npm",basename:"package-lock.json",parse:rs},{ecosystem:"npm",basename:"npm-shrinkwrap.json",parse:rs},{ecosystem:"npm",basename:"pnpm-lock.yaml",parse:Sd},{ecosystem:"npm",basename:"yarn.lock",parse:xd},{ecosystem:"pypi",basename:"poetry.lock",parse:Ko},{ecosystem:"pypi",basename:"Pipfile.lock",parse:Cd},{ecosystem:"cargo",basename:"Cargo.lock",parse:Ko},{ecosystem:"composer",basename:"composer.lock",parse:Ed},{ecosystem:"rubygems",basename:"Gemfile.lock",parse:jd},{ecosystem:"go",basename:"go.mod",parse:Td},{ecosystem:"pub",basename:"pubspec.lock",parse:Ad},{ecosystem:"hex",basename:"mix.lock",parse:Pd},{ecosystem:"nuget",basename:"packages.lock.json",parse:Md},{ecosystem:"maven",basename:"gradle.lockfile",parse:gi},{ecosystem:"maven",basename:"pom.xml",parse:Rd}];function g0(t,e){let n=B.basename(t),r=Gi.find(s=>s.basename===n);return r?r.parse(e):rs(e)}function Id(){let t=[],e=new Map;for(let n of Gi)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 _d(t){try{let e=await xe.readFile(B.join(t,Di),"utf8"),n=JSON.parse(e);if(n?.schema===Vi&&n.timelines)return n.timelines}catch{}return null}async function Fd(t,e){try{await xe.mkdir(t,{recursive:!0});let n={schema:Vi,timelines:e};await xe.writeFile(B.join(t,Di),JSON.stringify(n,null,2));}catch{}}async function Od(t,e,n,r,s){let o=await vd(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 y=a.get(h);y||(y=[],a.set(h,y)),y.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 Bd(t,e={}){if(!await Nn(t))return null;let r=await yd(t);if(e.cacheDir&&r){let a=await _d(e.cacheDir);if(a&&a.head===r)return a}let s=e.maxCommits??Oi,o=[];for(let{ecosystem:a,candidates:c}of Id())for(let{basename:l,parse:u}of c){let p=await Od(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 Fd(e.cacheDir,i),i}function qi(t,e,n){return t.ecosystems.find(r=>r.ecosystem===e)?.packages.find(r=>r.name===n)}function y0(t,e){for(let n of t.ecosystems){let r=n.packages.find(s=>s.name===e);if(r)return r}}var Hi={critical:7,high:30,moderate:90,low:180,unknown:null};function ss(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 Vd(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 zi(t,e){if(e.affectedRanges&&e.affectedRanges.length||e.affectedVersions&&e.affectedVersions.length)return $i(t,e.affectedRanges,e.affectedVersions);let n=Vd(e);if(!n)return true;let r=$e.valid($e.coerce(t));return r?$e.lt(r,n):false}function os(t){return {sha:t.sha,shortSha:t.shortSha,authorName:t.authorName,authorEmail:t.authorEmail,date:t.date,subject:t.subject}}function Dd(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(zi(s.version,e))n=os(s.commit);else break}return n}function Ud(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&&zi(i.version,e);if(a&&!o)o=os(i.commit);else if(!a&&o){let c=os(i.commit);s.push({introduced:o,remediated:c,exposureDays:ss(o.date,c.date),open:false}),o=null;}}return o&&s.push({introduced:o,remediated:null,exposureDays:ss(o.date,n),open:true}),s}function Gd(){return {low:0,moderate:0,high:0,critical:0,unknown:0}}function qd(t,e,n=Hi,r=[]){let s=Gd(),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 y=n[h.severity];y!=null&&g>y&&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 Hd(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 Ud(a,c,n))!u.open&&u.exposureDays!=null&&o.push(u.exposureDays);}};for(let a of t.packages){let c=qi(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,Li(u));}return o}function zd(t,e,n,r={}){let s=r.slaDays??Hi;for(let i of t.packages){let a=e?qi(e,i.ecosystem,i.package):void 0;for(let c of i.advisories){let l=Dd(a,c);c.introduced=l,c.exposureDays=l?ss(l.date,n):null;}}let o=Hd(t,e,n,r.manifest);return t.cra=qd(t,n,s,o),t}var Wd=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 ar(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("."),An.valid(e)}var Jd=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=ar(a);c&&s.push(c);}let i=[...s].sort(An.rcompare)[0]??null;return {latest:r.latest?ar(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=ar(d);h&&c.push(h);}let l=i.info?.version??null,u=l?ar(l):null,f=[...c].sort(An.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 Wr(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("."),Pn.valid(e)}var Kd=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=Wr(u);p&&a.push(p);}let l=[...a].sort(Pn.rcompare)[0]??null;return {latest:i.latest?Wr(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 y=Wr(g);y&&f.push(y);}let h=[...f].sort(Pn.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 Jr(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 Mn.valid(r)}var Yd=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=Jr(a);c&&s.push(c);}let i=[...s].sort(Mn.rcompare)[0]??null;return {latest:r.latest?Jr(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=Jr(p);f&&a.push(f);}let l=[...a].sort(Mn.rcompare)[0]??null;return {latest:l,stableVersions:a,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},Xd=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}}}},Qd=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}},Zd=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}},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,"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}},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,"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 Wi(t){try{return await nm(t)}catch{return {type:"unknown"}}}async function nm(t){let e=await rm(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 sm(e,a);}else /^[0-9a-f]{40}$/i.test(r)&&(s=r);let i=await om(e);return {type:"git",sha:s??void 0,shortSha:s?s.slice(0,7):void 0,branch:o??void 0,remoteUrl:i}}async function rm(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 sm(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 om(t){let e=await im(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 im(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 v0(t){let e=t.trim();if(!e)return null;let n=Ee.valid(e)?`>=${e}`:e;return Ee.validRange(n)?n:null}function am(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 b0(t,e){let n=[],r=false,s=null;for(let o of t.changes){let i=am(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 Tn(t){let e=t.drift?.score;return typeof e=="number"?`${t.name} (${e})`:t.name}function ps(){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 cm(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(Tn(i))}"]`),e.push(`class ${a} ${en(i.drift?.score)}`));}return e.push(...r),e.push(...ps()),{mermaid:e.join(`
89
- `)}}function lm(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(Tn(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(Tn(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(Tn(a))}"]`),n.push(`class ${c} ${en(a.drift?.score)}`),n.push(`${i} --> ${c}`);}return n.push(...ps()),{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}["${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(Tn(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(...ps()),{mermaid:n.join(`
91
- `)}}var fm=createRequire(import.meta.url),dm=fm("../package.json");dm.version;var mm="https://registry.npmjs.org/@vibgrate%2fcli/latest",Yi=B.join(Cn.homedir(),".vibgrate"),hm=B.join(Yi,"update-check.json");async function x0(){try{let t=new AbortController,e=setTimeout(()=>t.abort(),1e4);e.unref?.();let n;try{n=await fetch(mm,{headers:{Accept:"application/json"},signal:t.signal});}finally{clearTimeout(e);}if(!n.ok)return null;let s=(await n.json()).version;return !s||!Ki.default.valid(s)?null:(await gm({latest:s,checkedAt:Date.now()}),s)}catch{return null}}async function gm(t){try{await xe.mkdir(Yi,{recursive:!0}),await xe.writeFile(hm,JSON.stringify(t),"utf-8");}catch{}}var ym=[{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 vm(t,e=3){let n=t.topEvidence,r=n.filter(u=>u.kind==="dependency").map(u=>u.value).slice(0,10),s=km(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=wm(u.value);f.length>=3&&i.get(p).add(f);}let c=[];for(let[u,p]of i){let f=Sm([...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 ym)if(n.test(t))return e;return "general"}function wm(t){return t.toLowerCase().replace(/[^a-z0-9\s-]/g," ").replace(/\s+/g," ").trim().slice(0,60)}function Sm(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 km(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 Em=promisify(Xi.gzip),ge=50;function Sn(t){let e=t.match(/^(.+?)\s*\(/);return e?e[1].trim():t.trim()}function jm(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(Sn).slice(0,ge),tables:t.tables.map(Sn).slice(0,ge),views:t.views.map(Sn).slice(0,ge),storedProcedures:t.storedProcedures.map(Sn).slice(0,ge),triggers:t.triggers.map(Sn).slice(0,ge),rowLevelSecurityPolicies:t.rowLevelSecurityPolicies.slice(0,20),otherServices:t.otherServices.slice(0,20)}}function Tm(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 Cm(t){return {faviconFiles:t.faviconFiles.slice(0,1),productLogos:[]}}function Am(t){let e={...t};if(e.extended){let n={...e.extended};if(n.dataStores&&(n.dataStores=jm(n.dataStores)),n.apiSurface&&(n.apiSurface=Tm(n.apiSurface)),n.assetBranding&&(n.assetBranding=Cm(n.assetBranding)),n.uiPurpose){let r=vm(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 Pm(t){let e=JSON.stringify(t);return Em(e,{level:9})}async function j0(t){let e=Am(t);return {body:await Pm(e),contentEncoding:"gzip"}}function Mm(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 T0(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 $m(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 Lm=new Set(["node_modules",".git",".vibgrate",".wrangler",".next","dist","build","out",".turbo",".cache","coverage","bin","obj",".vs","TestResults",".nuxt",".output",".svelte-kit"]);async function C0(t,e){let n=e??await Wi(t);if(n.type==="git"&&n.sha)return {vcsSha:n.sha,method:"git_sha"};let r=await Nm(t);return r?{treeHash:r,method:"tree_metadata"}:{method:"unknown"}}async function Nm(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(Lm.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=as.createHash("sha256");for(let i of r)o.update(i),o.update(`
92
- `);return o.digest("hex")}var Fm="https://api.vibgrate.com",Om=1e3*60*60*24,Bm=5e3;function Kr(t){return !!t&&typeof t=="object"&&typeof t.generatedAt=="string"&&typeof t.products=="object"&&t.products!==null}var Vm=class{apiBase;offline;manifest;cacheDir;fetchImpl;resolution=null;constructor(t={}){this.apiBase=(t.apiBase??process.env.VIBGRATE_API_BASE??Fm).replace(/\/+$/,""),this.offline=t.offline??false,this.manifest=t.manifest,this.cacheDir=t.cacheDir??B.join(Cn.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)<Om)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 Kr(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(),Bm);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 Kr(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"&&Kr(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{}}},Hm=class ea{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 ea(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{}}},cr=[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 Yo(t){return [k.bold.white(" V I B G R A T E"),k.dim(" Drift Intelligence Engine")+k.dim(` v${t}`)]}var Xo=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],zm=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=Hm.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=["",` ${cr[0]} ${Yo(this.version)[0]}`,` ${cr[1]} ${Yo(this.version)[1]}`,` ${cr[2]}`,` ${cr[3]} ${k.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 Mu(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=ps(a);c&&e.deps.push(c);}}}return e}var Si=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 $u(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,l=>Si.has(l)||/^requirements.*\.txt$/.test(l)):await Lu(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=Nu(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 Lu(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Si.has(n)||/^requirements.*\.txt$/.test(n))}async function Nu(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=Au(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=Mu(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 Pu(T))l.has(m.normalisedName)||l.set(m.normalisedName,m);else if(k.startsWith("requirements")&&k.endsWith(".txt"))for(let m of Cu(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 Eu(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),y=[],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??ju(b.spec),A=m?Tu(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++;y.push({package:b.name,section:"dependencies",currentSpec:b.spec||"*",resolvedVersion:A,latestStable:$,majorsBehind:L,drift:I}),b.normalisedName in Vo&&w.push({name:Vo[b.normalisedName],currentVersion:A,latestVersion:$,majorsBehind:L});}y.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 v;try{v=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:y,dependencyAgeBuckets:j,fileCount:v}}var Ru=/^([^:=\s]+):([^:=\s]+):([^=\s]+)=/;function xi(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=Ru.exec(r);if(!s)continue;let o=`${s[1]}:${s[2]}`;e.has(o)||e.set(o,s[3]);}return e}async function Iu(t,e){let n=B.join(t,"gradle.lockfile");if(!await e.exists(n).catch(()=>false))return null;try{let r=xi(await e.readText(n));return r.size?{size:r.size,resolve:s=>r.get(s)??null}:null}catch{return null}}var _u=new je({ignoreAttributes:false,attributeNamePrefix:"@_"}),Do={"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 Fu(t,e){let r=_u.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,y]of Object.entries(r.properties))(typeof y=="string"||typeof y=="number")&&(s[g]=String(y));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 Ou(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 Bu(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 Ei=new Set(["pom.xml","build.gradle","build.gradle.kts"]);async function Vu(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,u=>Ei.has(u)):await Du(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=Uu(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 Du(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ei.has(n))}async function Uu(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 $=Fu(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 $=Ou(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=Ar(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 Iu(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},v=[...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(v);for(let{key:T,dep:m,meta:A}of b){let $=w?.resolve(T)??null,L=Bu($??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 Do&&P.push({name:Do[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 Gu=/^ {4}([A-Za-z0-9._-]+) \(([^()]+)\)\s*$/;function qu(t){let e=new Map;if(!t)return e;for(let n of t.split(`
79
+ `)){let r=Gu.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 Hu(t,e){let n=B.join(t,"Gemfile.lock");if(!await e.exists(n).catch(()=>false))return null;try{let r=qu(await e.readText(n));return r.size?{size:r.size,resolve:s=>r.get(s)??null}:null}catch{return null}}var Uo={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 zu(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 Wu(t){if(t==="*")return null;let e=t.match(/(?:~>|>=|>|=|<=|<)?\s*(\d+(?:\.\d+)*)/);return e?e[1]:null}function Ju(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 Ku(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=zu(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 Yu(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 Xu(t){return t.match(/^\s*ruby\s+['"]([^'"]+)['"]/m)?.[1]}var Ti=new Set(["Gemfile"]);function fs(t){return t.endsWith(".gemspec")}async function Qu(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,l=>Ti.has(l)||fs(l)):await Zu(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=ep(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 Zu(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ti.has(n)||fs(n))}async function ep(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=Xu(T);m&&(c=m);for(let A of Ku(T))l.has(A.name)||l.set(A.name,A);}else if(fs(k)){let m=k.replace(/\.gemspec$/,"");m&&(a=m);for(let A of Yu(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 Hu(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),y=[],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??Wu(b.spec),A=m?Ju(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";y.push({package:b.name,section:V,currentSpec:b.spec,resolvedVersion:A,latestStable:$,majorsBehind:L,drift:I}),b.name in Uo&&w.push({name:Uo[b.name],currentVersion:A,latestVersion:$,majorsBehind:L});}y.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 v;try{v=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:y,dependencyAgeBuckets:j,fileCount:v}}var Go={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 tp(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 np(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 rp(t){return t.match(/\/\/\s*swift-tools-version:\s*(\d+\.\d+)/i)?.[1]}var Ci=new Set(["Package.swift"]);async function sp(t,e,n,r){let s=n?await n.findFiles(t,a=>Ci.has(a)):await op(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=ip(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 op(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ci.has(n))}async function ip(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=rp(a),l=tp(a),u=B.join(t,"Package.resolved"),p=new Map;try{let C=s?await s.readTextFile(u):await o(u);p=np(C);}catch{}let f,d;if(c){let C=c.match(/(\d+)\.(\d+)/);if(C){let x=parseInt(C[1],10),v=parseInt(C[2],10);x===St.major?f=Math.max(0,St.minor-v):x<St.major&&(f=(St.major-x)*10+St.minor),d=`${St.major}.${St.minor}`;}}let h=[],g=[],y={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 v=p.get(C.name.toLowerCase())??(C.type==="exact"?C.version:null),b=v?Ie.valid(Ie.clean(v)):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?y.current++:T===1?y.oneBehind++:y.twoPlusBehind++;}else y.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 Go&&g.push({name:Go[A],currentVersion:b,latestVersion:k,majorsBehind:T});}h.sort((C,x)=>{let v={"major-behind":0,"minor-behind":1,current:2,unknown:3},b=(v[C.drift]??9)-(v[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:y,fileCount:P}}var qo={"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 ap(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 Ai=new Set(["go.mod"]);async function cp(t,e,n,r,s=Ne){let o=n?await n.findFiles(t,c=>Ai.has(c)):await lp(t),i=[],a=r??n?.projectScanTimeout??18e4;for(let c of o){let l=B.dirname(c);try{let u=up(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 lp(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Ai.has(n))}async function up(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}=ap(c),p=u.filter(v=>!v.indirect),f,d,h,g;if(l){let v=l.match(/(\d+)\.(\d+)/);if(v){let k=parseInt(v[1],10),T=parseInt(v[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 y=[],w=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},P=p.map(async v=>{let b=await r.get(v.path);return {dep:v,meta:b}}),C=await Promise.all(P);for(let{dep:v,meta:b}of C){let k=_e.valid(_e.clean(v.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++;y.push({package:v.path,section:"dependencies",currentSpec:v.version,resolvedVersion:k,latestStable:T,majorsBehind:m,drift:A}),v.path in qo&&w.push({name:qo[v.path],currentVersion:k,latestVersion:T,majorsBehind:m});}y.sort((v,b)=>{let k={"major-behind":0,"minor-behind":1,current:2,unknown:3},T=(k[v.drift]??9)-(k[b.drift]??9);return T!==0?T:v.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:y,dependencyAgeBuckets:j,fileCount:x}}function pp(t){let e=new Map,r=wi(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 fp(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 Ho(t,e){let n=B.join(t,"Cargo.lock");if(!await e.exists(n).catch(()=>false))return null;try{let r=pp(await e.readText(n));return r.size?{size:r.size,resolve:(s,o)=>fp(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 dp(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 mp(t){return t.match(/^\s*edition\s*=\s*"(\d+)"/m)?.[1]}var Mi=new Set(["Cargo.toml"]);async function hp(t,e,n,r){let s=n?await n.findFiles(t,a=>Mi.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 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 gp(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Mi.has(n))}async function yp(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=mp(a),l=dp(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 Ho(t,u).catch(()=>null);!p$1&&t!==n$1&&(p$1=await Ho(n$1,u).catch(()=>null));let f=l.filter(x=>!x.isDev),d,h;if(c){let x=parseInt(c,10),v=2024;d=Math.max(0,Math.floor((v-x)/3)),h=v.toString();}let g=[],y=[],w={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=f.map(async x=>{let v=await r.get(x.name);return {dep:x,meta:v}}),P=await Promise.all(j);for(let{dep:x,meta:v}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=v.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 zo&&y.push({name:zo[x.name],currentVersion:k,latestVersion:T,majorsBehind:m});}g.sort((x,v)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},k=(b[x.drift]??9)-(b[v.drift]??9);return k!==0?k:x.package.localeCompare(v.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:y,dependencies:g,dependencyAgeBuckets:w,fileCount:C}}var Wo={"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 vp(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 bp(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 wp(t){return t.match(/(\d+)\.(\d+)/)?.[0]}var $i=new Set(["composer.json"]);async function Sp(t,e,n,r){let s=n?await n.findFiles(t,a=>$i.has(a)):await kp(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=xp(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 kp(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>$i.has(n))}async function xp(t,e,n,r,s){let o=B.relative(n,t)||".",i=B.basename(t===n?n:t),{phpVersion:a,deps:c}=await vp(e,s),l=B.join(t,"composer.lock"),u=new Map;try{u=await bp(l,s);}catch{}let p=c.filter(x=>!x.isDev),f,d,h;if(a&&(h=wp(a),h)){let x=h.match(/(\d+)\.(\d+)/);if(x){let v=parseInt(x[1],10),b=parseInt(x[2],10);v===kt.major?f=Math.max(0,kt.minor-b):v<kt.major&&(f=kt.minor+(kt.major-v)*10),d=`${kt.major}.${kt.minor}`;}}let g=[],y=[],w={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},j=p.map(async x=>{let v=await r.get(x.name);return {dep:x,meta:v}}),P=await Promise.all(j);for(let{dep:x,meta:v}of P){let b=u.get(x.name),k=b?Fe.valid(Fe.clean(b)):null,T=v.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 Wo&&y.push({name:Wo[x.name],currentVersion:k,latestVersion:T,majorsBehind:m});}g.sort((x,v)=>{let b={"major-behind":0,"minor-behind":1,current:2,unknown:3},k=(b[x.drift]??9)-(b[v.drift]??9);return k!==0?k:x.package.localeCompare(v.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:y,dependencies:g,dependencyAgeBuckets:w,fileCount:C}}var Jo={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 Ep(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 jp(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 Tp(t){return t.match(/(\d+\.\d+\.\d+)/)?.[0]}var Li=new Set(["pubspec.yaml"]);async function Cp(t,e,n,r){let s=n?await n.findFiles(t,a=>Li.has(a)):await Ap(t),o=[],i=r??n?.projectScanTimeout??18e4;for(let a of s){let c=B.dirname(a);try{let l=Pp(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 Ap(t){let{findFiles:e}=await import('./fs-PXXYZATK-ZP2RBR47.js');return e(t,n=>Li.has(n))}async function Pp(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}=Ep(a),u=B.join(t,"pubspec.lock"),p=new Map;try{p=await jp(u,s);}catch{}let f=l.filter(v=>!v.isDev),d,h,g;if(c&&(g=Tp(c),g)){let v=g.match(/(\d+)\.(\d+)/);if(v){let b=parseInt(v[1],10),k=parseInt(v[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 y=[],w=[],j={current:0,oneBehind:0,twoPlusBehind:0,unknown:0},P=f.map(async v=>{let b=await r.get(v.name);return {dep:v,meta:b}}),C=await Promise.all(P);for(let{dep:v,meta:b}of C){let k=p.get(v.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=v.isDev?"devDependencies":"dependencies";y.push({package:v.name,section:L,currentSpec:v.version,resolvedVersion:T,latestStable:m,majorsBehind:A,drift:$}),v.name in Jo&&w.push({name:Jo[v.name],currentVersion:T,latestVersion:m,majorsBehind:A});}y.sort((v,b)=>{let k={"major-behind":0,"minor-behind":1,current:2,unknown:3},T=(k[v.drift]??9)-(k[b.drift]??9);return T!==0?T:v.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:y,dependencyAgeBuckets:j,fileCount:x}}var Mp="https://hex.pm/api",$p=1e4,Lp=10;async function Np(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(),$p),c=`${Mp}/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 gr.SemVer(d).prerelease.length===0}catch{return !1}});return f.length===0?null:(f.sort((d,h)=>{try{return (0,gr.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 Rp(t,e,n=false){let r=new Map,s=new a$1(Lp),o=t.map(async i=>{let a=await Np(i,e,s,n);a&&r.set(i,a);});return await Promise.all(o),r}var Ip=new Set(["mix.exs"]),_p=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 Fp(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;){a[1];}return {elixirVersion:s,deps:r}}async function Op(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 Bp(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 Vp(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 Fp(s,e),c=`${t}/mix.lock`,l=await Op(c,e),u=a.filter(y=>!y.isDev),p$1=u.map(y=>y.name),f=await Rp(p$1,n,r),d=[],h=[],g={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let y of u){let w=l.get(y.name),j=w||y.version,P=f.get(y.name),C=P?Bp(j,P):"unknown",x=null;if(w&&P)try{let v=(0,Se.minVersion)((0,Se.validRange)(j)||j),b=(0,Se.minVersion)((0,Se.validRange)(P)||P);v&&b&&(x=b.major-v.major);}catch{}d.push({package:y.name,section:y.isDev?"devDependencies":"dependencies",currentSpec:y.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++,_p.has(y.name)&&h.push({name:y.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 Dp(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>Ip.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 Vp(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 Up="https://hub.docker.com/v2",Gp=1e4,qp=10;function ds(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 Hp(t,e,n){let r=async()=>{try{let s=new AbortController,o=setTimeout(()=>s.abort(),Gp),i=`${Up}/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 zp(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 yr.SemVer(r);o.prerelease.length===0&&e.push(o);}catch{}}return e.length===0?null:(e.sort((n,r)=>(0, yr.gt)(n.version,r.version)?-1:1),e[0].version)}async function Wp(t,e,n,r=false){let s=ds(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 Hp(a,s.image,n);return zp(c)}async function Jp(t,e,n=false){let r=new Map,s=new a$1(qp),o=t.map(async i=>{let a=await Wp(i,e,s,n);a&&r.set(i,a);});return await Promise.all(o),r}var Kp=new Set(["Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml"]);async function Yp(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=ds(i);r.push({name:`${a.namespace||"library"}/${a.image}`,currentTag:a.tag||"latest"});}return r}async function Xp(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=ds(i);r.push({name:`${a.namespace||"library"}/${a.image}`,currentTag:a.tag||"latest"});}return r}function Qp(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 Zp(t,e,n,r=false){let s=[],o=`${t}/Dockerfile`;if(e?await e.pathExists(o):await p(o)){let d=await Yp(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 y=await Xp(h,e);s.push(...y);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 Jp(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),y=g?Qp(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:y}),y==="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 ef(t,e,n,r,s=false){let o=n?await n.findFiles(t,c=>Kp.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 Zp(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 tf="https://artifacthub.io/api/v1",nf=1e4,rf=10;async function sf(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(),nf),u=`${tf}/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 of(t,e,n=false){let r=new Map,s=new a$1(rf),o=t.map(async i=>{let a=await sf(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 af=new Set(["Chart.yaml","Chart.yml"]);async function cf(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,""),y=h.index,w=d.exec(f),j=w?w.index:f.length;d.lastIndex=y+1;let P=f.substring(y,j),C=P.match(/version:\s*(.+)$/m),x=C?C[1].trim().replace(/["']/g,""):"*",v=P.match(/repository:\s*(.+)$/m),b=v?v[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 lf(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 uf(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 pf(t,e,n,r=false){let s=null;for(let g of ["Chart.yaml","Chart.yml"]){let y=`${t}/${g}`;if(e?await e.pathExists(y):await p(y)){s=y;break}}if(!s)return null;let{chartName:o,chartVersion:i,appVersion:a,dependencies:c}=await cf(s,e),l=`${t}/Chart.lock`,u=await lf(l,e),p$1=c.map(g=>({name:g.name,repo:g.repository})),f=await of(p$1,n,r),d=[],h={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let g of c){let y=u.get(g.name),w=y||g.version,j=g.repository?`${g.repository}/${g.name}`:g.name,P=f.get(j),C=P?uf(w,P):"unknown",x=null;if(P)try{let v=(0,ke.minVersion)((0,ke.validRange)(w)||w),b=(0,ke.minVersion)((0,ke.validRange)(P)||P);v&&b&&(x=b.major-v.major);}catch{}d.push({package:g.name,section:"dependencies",currentSpec:g.version,resolvedVersion:y||null,latestStable:P||null,majorsBehind:x,drift:C}),C==="current"?h.current++:x===1?h.oneBehind++:x&&x>1?h.twoPlusBehind++:h.unknown++;}return {type:"helm",path:B.relative(t.includes("/")?t.split("/").slice(0,-1).join("/"):".",t)||".",name:o||B.basename(t),runtime:a,frameworks:[],dependencies:d,dependencyAgeBuckets:h}}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 Helm chart at ${c}:`,l);}return a}var Ni="https://registry.terraform.io/v1",Ri=1e4,df=10;async function mf(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(),Ri),u=`${Ni}/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 y=new rn.SemVer(g.version);y.prerelease.length===0&&h.push(y);}catch{}return h.length===0?null:(h.sort((g,y)=>(0,rn.gt)(g.version,y.version)?-1:1),h[0].version)}catch(c){return c?.name==="AbortError",null}};return r?r.run(a):a()}async function hf(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(),Ri),p=`${Ni}/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,y=[];for(let w of g)try{let j=new rn.SemVer(w.version);j.prerelease.length===0&&y.push(j);}catch{}return y.length===0?null:(y.sort((w,j)=>(0,rn.gt)(w.version,j.version)?-1:1),y[0].version)}catch(l){return l?.name==="AbortError",null}};return s?s.run(c):c()}async function gf(t,e,n=false){let r=new Map,s=new a$1(df),o=t.map(async i=>{let a=null,c;i.type==="provider"?(c=`${i.namespace}/${i.name}`,a=await mf(i.namespace,i.name,e,s,n)):(c=`${i.namespace}/${i.name}/${i.provider}`,a=await hf(i.namespace,i.name,i.provider,e,s,n)),a&&r.set(c,a);});return await Promise.all(o),r}async function yf(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],y=g.match(/source\s*=\s*"([^"]+)"/);if(!y)continue;let w=y[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(y=>y.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*"([^"]+)"/),y=g?g[1]:void 0;s.push({source:h,version:y});}return {terraformVersion:o$1,providers:r,modules:s}}async function vf(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 Ko(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 bf(t,e,n,r=false){let s=[];if(e){let y=await e.findFiles(t,w=>w.endsWith(".tf"));s.push(...y);}else {let y=["main.tf","variables.tf","outputs.tf","versions.tf","providers.tf"];for(let w of y){let j=`${t}/${w}`;await p(j)&&s.push(j);}}if(s.length===0)return null;let o,i=[],a=[];for(let y of s){let{terraformVersion:w,providers:j,modules:P}=await yf(y,e);w&&!o&&(o=w),i.push(...j),a.push(...P);}let c=new Map;for(let y of i)c.has(y.source)||c.set(y.source,y.version);let l=new Map;for(let y of a)l.has(y.source)||l.set(y.source,y.version);let u=`${t}/.terraform.lock.hcl`,p$1=await vf(u,e),f=[];for(let[y]of c){let[w,j]=y.split("/");f.push({type:"provider",namespace:w,name:j});}for(let[y]of l){let w=y.split("/");if(w.length===3){let[j,P,C]=w;f.push({type:"module",namespace:j,name:P,provider:C});}}let d=await gf(f,n,r),h=[],g={current:0,oneBehind:0,twoPlusBehind:0,unknown:0};for(let[y,w]of c){let j=p$1.get(y),P=j||w||"unknown",C=d.get(y),x=C&&P!=="unknown"?Ko(P,C):"unknown",v=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&&(v=k.major-b.major);}catch{}h.push({package:`provider:${y}`,section:"dependencies",currentSpec:w||"unknown",resolvedVersion:j||null,latestStable:C||null,majorsBehind:v,drift:x}),x==="current"?g.current++:v===1?g.oneBehind++:v&&v>1?g.twoPlusBehind++:g.unknown++;}for(let[y,w]of l){let j=w||"unknown",P=d.get(y),C=P&&j!=="unknown"?Ko(j,P):"unknown",x=null;if(P&&j!=="unknown")try{let v=(0,re.minVersion)((0,re.validRange)(j)||j),b=(0,re.minVersion)((0,re.validRange)(P)||P);v&&b&&(x=b.major-v.major);}catch{}h.push({package:`module:${y}`,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 wf(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 bf(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 Yo=[{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"}],Sf=[{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 kf(t,e){return B.basename(t)||B.basename(e)}function xf(t){return /^\s*(CC|CFLAGS|LDFLAGS)\s*[:?+]?=/m.test(t)||/\b(gcc|clang)\b/.test(t)||/\.(c|o)\b/.test(t)}function Hr(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:kf(i,s),frameworks:[],dependencies:o,dependencyAgeBuckets:{current:0,oneBehind:0,twoPlusBehind:0,unknown:o.length}}));}async function Ef(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 jf(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 Sf){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 Tf(t,e){let n=e?await e.walkDir(t):[],r=n.filter(c=>c.isFile&&Yo.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=Yo.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(!xf(f))continue}let u=B.dirname(c.relPath)||".",p=await Ef(c.absPath,e);Hr(o$1,i,l.type,u,t,p);}for(let c of s)Hr(o$1,i,"shell",c,t);let a=jf(n);for(let[c,l]of a)for(let u of l)Hr(o$1,i,u,c,t);return o$1}var Cf=10,Af=1048576,Pf=5,Mf=20,$f=2621440,Lf=10,Nf=30,Rf=5242880,If=25,ns=25,rs=10,ss=3,My=1;function zr(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 _f(t){return zr(t,Cf,Af,Pf)>=2?"nano":zr(t,Mf,$f,Lf)>=2?"micro":zr(t,Nf,Rf,If)>=2?"small":"standard"}function Ff(t){switch(t){case "nano":return "nano";case "micro":case "function":return "micro";case "small":return "small";default:return "standard"}}function $y(t){switch(t){case "nano":return 1/ns;case "micro":return 1/rs;case "small":return 1/ss;default:return 1}}function Of(t){let e=0,n=0,r=0,s=0;for(let i of t)switch(Ff(i.classification)){case "nano":e++;break;case "micro":n++;break;case "small":r++;break;default:s++;break}let o=s+r/ss+n/rs+e/ns;return {nanoCount:e,microCount:n,smallCount:r,standardCount:s,totalScanned:e+n+r+s,nanoBillingRatio:ns,microBillingRatio:rs,smallBillingRatio:ss,billableProjectsRaw:Math.round(o*100)/100,billableProjects:Math.floor(o)}}var Bf={N:.85,A:.62,L:.55,P:.2},Vf={L:.77,H:.44},Df={N:.85,R:.62},Uf={N:.85,L:.62,H:.27},Gf={N:.85,L:.68,H:.5},Wr={H:.56,L:.22,N:0};function qf(t){let e=Math.round(t*1e5);return e%1e4===0?e/1e5:(Math.floor(e/1e4)+1)/10}function Ii(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[y,w]=g.split(":");y&&w&&(n[y.toUpperCase()]=w.toUpperCase());}let r=n.S==="C",s=Bf[n.AV],o=Vf[n.AC],i=Df[n.UI],a=(r?Gf:Uf)[n.PR],c=Wr[n.C],l=Wr[n.I],u=Wr[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 qf(h)}function _i(t){return t>=9?"critical":t>=7?"high":t>=4?"moderate":t>0?"low":"unknown"}function ar(t){switch(t){case "critical":return 4;case "high":return 3;case "moderate":return 2;case "low":return 1;default:return 0}}function Fi(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 Hf="https://api.osv.dev/v1/querybatch",zf="https://api.osv.dev/v1/vulns/",Wf=15e3,Xo=500,Jf=3,Kf=250,Yf=new Set([408,425,429,500,502,503,504]);function Xf(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 Qf(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 Zf(){return {low:0,moderate:0,high:0,critical:0,unknown:0}}function nn(t){return `${t.ecosystem}\0${t.package}\0${t.version}`}function ed(t){let e=new Set,n=[];for(let r of t){let s=Xf(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 Oi(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 td(t,e){let n=t.severity?.find(p=>(p.type??"").toUpperCase().startsWith("CVSS_V3"))?.score??null,r=Ii(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?_i(r):Fi(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 Bi(t){let e=typeof t.cvss=="number"?t.cvss:Ii(t.cvssVector??null),n=t.severity?Fi(t.severity):e!=null?_i(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 nd(t){return new Promise(e=>setTimeout(e,t))}async function Vi(t,e,n){return n.run(async()=>{for(let r=0;;r++){let s=new AbortController,o=setTimeout(()=>s.abort(),Wf);try{let i=await fetch(t,{...e,signal:s.signal});if(i.ok)return {ok:!0,data:await i.json()};if(!Yf.has(i.status))return {ok:!1}}catch{}finally{clearTimeout(o);}if(r>=Jf)return {ok:false};await nd(Kf*2**r);}})}async function rd(t,e){let n=new Map,r=true;for(let s=0;s<t.length;s+=Xo){let o=t.slice(s,s+Xo),i=JSON.stringify({queries:o.map(l=>({version:l.version,package:{name:l.package,ecosystem:Qf(l.ecosystem)}}))}),a=await Vi(Hf,{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 sd(t,e){let n=new Map;return await Promise.all([...t].map(async r=>{let s=await Vi(`${zf}${encodeURIComponent(r)}`,{method:"GET"},e);s.ok&&s.data&&n.set(r,s.data);})),n}function Di(t,e){e.sort((s,o)=>s.ecosystem.localeCompare(o.ecosystem)||s.package.localeCompare(o.package)||s.version.localeCompare(o.version));let n=Zf(),r=0;for(let s of e){s.advisories.sort((i,a)=>ar(a.severity)-ar(i.severity)||i.id.localeCompare(a.id)),r+=s.advisories.length;let o=s.advisories.reduce((i,a)=>ar(a.severity)>ar(i)?a.severity:i,"unknown");n[o]++;}return {source:t,packages:e,totalAdvisories:r,severityCounts:n}}function os(){return {source:"none",packages:[],totalAdvisories:0,severityCounts:{low:0,moderate:0,high:0,critical:0,unknown:0}}}async function od(t,e){if(t.length===0)return os();if(e.offline)return Qo(t,e.manifest);let{idsByTarget:n,allBatchesOk:r}=await rd(t,e.sem);if(n.size===0){let c=Qo(t,e.manifest);return c.packages.length?c:{...os(),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 sd(s,e.sem),i=Ui(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(td(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 Di("osv",a)}function Ui(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&&Oi(r.version,i.ranges,i.versions));o.length&&n.set(nn(r),o.map(Bi));}return n}function Qo(t,e){let n=Ui(t,e);if(n.size===0)return os();let r=[];for(let s of t){let o=n.get(nn(s));o?.length&&r.push({...s,advisories:o});}return Di("manifest",r)}var id="vibgrate/vulnerability";function ad(t){switch(t){case "critical":case "high":return "error";case "moderate":return "warning";default:return "note"}}function cd(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:id,level:ad(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 ld=new Set(["node_modules",".git","dist","build","out",".vibgrate","vendor",".venv","venv","env","__pycache__","target",".next",".nuxt","coverage",".cache"]),Zo=8e3,ud=12,pd=1048576,fd=5,dd={npm:new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts",".vue",".svelte"]),pypi:new Set([".py"])};function md(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hd(t,e){let n=md(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 gd(t,e,n){let r={importSites:0,filesTouched:0,sampleFiles:[]};if(n==="unknown")return r;let s=dd[n],o=hd(n,e);if(!s||!o)return r;let i=0,a=0,c=[],l=0,u=(p,f)=>{if(f>ud||l>=Zo)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>=Zo)return;if(h.isDirectory()){if(ld.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),y;try{if(sn.statSync(g).size>pd)continue;y=sn.readFileSync(g,"utf8");}catch{continue}o.lastIndex=0;let w=y.match(o);w&&w.length&&(i+=w.length,a++,c.length<fd&&c.push(B.relative(t,g).replace(/\\/g,"/")));}}};return u(t,0),c.sort(),{importSites:i,filesTouched:a,sampleFiles:c}}function yd(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 vd(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 bd(t,e,n){return t!=null&&t>=2?"multi-major-plan":t===1?"single-major":e&&n&&e!==n?"patch-minor":"current"}function Ly(t,e,n={}){let{majorsBehind:r,interimMajors:s}=yd(e.currentVersion,e.latestVersion,e.majorsBehind),o=gd(t,e.package,e.ecosystem),i=vd(r,o),a=bd(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 wd=12e3,Sd=100,Jr={source:"none",repositoryUrl:null,releasesScanned:0,breakingReleases:[],notes:[]},kd={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"},Gi=[{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 xd(t){if(!t)return [];let e=new Set;for(let{re:n,label:r}of Gi)n.test(t)&&e.add(r);return [...e]}function Ed(t){if(!t)return null;for(let{re:e}of Gi){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 jd(t){if(!t)return null;let e=t.match(/github\.com[/:]([^/]+)\/([^/#?]+?)(?:\.git)?(?:[/#?].*)?$/i);return e?{owner:e[1],repo:e[2]}:null}function Td(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 Cd(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 Ad(t,e,n,r){let s=[];for(let o of t){if(o.draft)continue;let i=o.tag_name??o.name??"",a=Td(i,r);if(!a||!Cd(a,e,n))continue;let c=[o.name,o.body].filter(Boolean).join(`
80
+ `),l=xd(c);l.length&&s.push({version:a,tag:i,url:o.html_url??null,date:o.published_at??null,signals:l,excerpt:Ed(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(),wd);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 Pd(t,e){let n=kd[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 Ny(t,e,n,r,s={}){if(t==="unknown"||!n||!r)return Jr;let o=s.repositoryUrl??await Pd(t,e),i=jd(o);if(!i)return {...Jr,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=${Sd}`);if(!Array.isArray(a))return {...Jr,repositoryUrl:o,notes:["could not fetch releases (network, rate limit, or no GitHub Releases)"]};let c=Ad(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 $d=15e3,Ld=64*1024*1024,Hi=500,Nd="";function br(t,e){return new Promise(n=>{execFile("git",e,{cwd:t,timeout:$d,maxBuffer:Ld,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 ei=new Map;function zi(t){return t.split(B.sep).join("/")}async function Rn(t){let e=B.resolve(t),n=ei.get(e);if(n!==void 0)return n;let r=await br(e,["rev-parse","--show-toplevel"]),s=r.ok&&r.stdout.trim()||null;return ei.set(e,s),s}async function Rd(t){return await Rn(t)!==null}async function Id(t){let e=await Rn(t);if(!e)return null;let n=await br(e,["rev-parse","HEAD"]);return n.ok&&n.stdout.trim()||null}async function _d(t,e,n={}){let r=await Rn(t);if(!r)return [];let s=Math.max(1,n.maxCommits??Hi),o=["%H","%h","%an","%ae","%aI","%s"].join("%x1f"),i=await br(r,["log",`--max-count=${s}`,"--follow",`--format=${o}`,"--",zi(e)]);if(!i.ok)return [];let a=[];for(let c of i.stdout.split(`
81
+ `)){if(!c)continue;let l=c.split(Nd);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 Fd(t,e,n){if(!/^[0-9a-f]{4,40}$/i.test(e))return null;let r=await Rn(t);if(!r)return null;let s=await br(r,["show",`${e}:${zi(n)}`]);return s.ok?s.stdout:null}var Wi=3,Ji="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 is(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"&&Ki(o,e),e}function Ki(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"&&Ki(s.dependencies,e);}}function Od(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 Bd(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=Od(o);i&&he(e,i.name,i.version);}return e}function Vd(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 Dd(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=Vd(r.replace(/:\s*$/,""));continue}let s=r.match(/^\s+version:?\s+"?([^"\s]+)"?/);s&&n&&he(e,n,s[1]);}return e}function ti(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 Ud(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 Gd(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 qd(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 Hd(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 zd(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 Wd(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 Jd(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 Kd=new je({ignoreAttributes:true,parseTagValue:false,trimValues:true});function Yd(t){return t==null?[]:Array.isArray(t)?t:[t]}function Xd(t){return !!t&&!t.includes("${")&&!/[[\](),]/.test(t)}function Qd(t){let e=new Map;if(!t)return e;let n;try{n=Kd.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 Yd(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();Xd(d)&&he(e,`${p}:${f}`,d);}return e}var Yi=[{ecosystem:"npm",basename:"package-lock.json",parse:is},{ecosystem:"npm",basename:"npm-shrinkwrap.json",parse:is},{ecosystem:"npm",basename:"pnpm-lock.yaml",parse:Bd},{ecosystem:"npm",basename:"yarn.lock",parse:Dd},{ecosystem:"pypi",basename:"poetry.lock",parse:ti},{ecosystem:"pypi",basename:"Pipfile.lock",parse:Hd},{ecosystem:"cargo",basename:"Cargo.lock",parse:ti},{ecosystem:"composer",basename:"composer.lock",parse:Ud},{ecosystem:"rubygems",basename:"Gemfile.lock",parse:Gd},{ecosystem:"go",basename:"go.mod",parse:qd},{ecosystem:"pub",basename:"pubspec.lock",parse:zd},{ecosystem:"hex",basename:"mix.lock",parse:Wd},{ecosystem:"nuget",basename:"packages.lock.json",parse:Jd},{ecosystem:"maven",basename:"gradle.lockfile",parse:xi},{ecosystem:"maven",basename:"pom.xml",parse:Qd}];function _y(t,e){let n=B.basename(t),r=Yi.find(s=>s.basename===n);return r?r.parse(e):is(e)}function Zd(){let t=[],e=new Map;for(let n of Yi)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 em(t){try{let e=await xe.readFile(B.join(t,Ji),"utf8"),n=JSON.parse(e);if(n?.schema===Wi&&n.timelines)return n.timelines}catch{}return null}async function tm(t,e){try{await xe.mkdir(t,{recursive:!0});let n={schema:Wi,timelines:e};await xe.writeFile(B.join(t,Ji),JSON.stringify(n,null,2));}catch{}}async function nm(t,e,n,r,s){let o=await _d(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 Fd(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 y=a.get(h);y||(y=[],a.set(h,y)),y.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 rm(t,e={}){if(!await Rn(t))return null;let r=await Id(t);if(e.cacheDir&&r){let a=await em(e.cacheDir);if(a&&a.head===r)return a}let s=e.maxCommits??Hi,o=[];for(let{ecosystem:a,candidates:c}of Zd())for(let{basename:l,parse:u}of c){let p=await nm(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 tm(e.cacheDir,i),i}function Xi(t,e,n){return t.ecosystems.find(r=>r.ecosystem===e)?.packages.find(r=>r.name===n)}function Fy(t,e){for(let n of t.ecosystems){let r=n.packages.find(s=>s.name===e);if(r)return r}}var Qi={critical:7,high:30,moderate:90,low:180,unknown:null};function as(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 sm(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 Zi(t,e){if(e.affectedRanges&&e.affectedRanges.length||e.affectedVersions&&e.affectedVersions.length)return Oi(t,e.affectedRanges,e.affectedVersions);let n=sm(e);if(!n)return true;let r=$e.valid($e.coerce(t));return r?$e.lt(r,n):false}function cs(t){return {sha:t.sha,shortSha:t.shortSha,authorName:t.authorName,authorEmail:t.authorEmail,date:t.date,subject:t.subject}}function om(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(Zi(s.version,e))n=cs(s.commit);else break}return n}function im(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&&Zi(i.version,e);if(a&&!o)o=cs(i.commit);else if(!a&&o){let c=cs(i.commit);s.push({introduced:o,remediated:c,exposureDays:as(o.date,c.date),open:false}),o=null;}}return o&&s.push({introduced:o,remediated:null,exposureDays:as(o.date,n),open:true}),s}function am(){return {low:0,moderate:0,high:0,critical:0,unknown:0}}function cm(t,e,n=Qi,r=[]){let s=am(),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 y=n[h.severity];y!=null&&g>y&&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 lm(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 im(a,c,n))!u.open&&u.exposureDays!=null&&o.push(u.exposureDays);}};for(let a of t.packages){let c=Xi(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,Bi(u));}return o}function um(t,e,n,r={}){let s=r.slaDays??Qi;for(let i of t.packages){let a=e?Xi(e,i.ecosystem,i.package):void 0;for(let c of i.advisories){let l=om(a,c);c.introduced=l,c.exposureDays=l?as(l.date,n):null;}}let o=lm(t,e,n,r.manifest);return t.cra=cm(t,n,s,o),t}var pm=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 cr(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("."),Pn.valid(e)}var fm=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=cr(a);c&&s.push(c);}let i=[...s].sort(Pn.rcompare)[0]??null;return {latest:r.latest?cr(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=cr(d);h&&c.push(h);}let l=i.info?.version??null,u=l?cr(l):null,f=[...c].sort(Pn.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 Kr(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("."),Mn.valid(e)}var dm=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=Kr(u);p&&a.push(p);}let l=[...a].sort(Mn.rcompare)[0]??null;return {latest:i.latest?Kr(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 y=Kr(g);y&&f.push(y);}let h=[...f].sort(Mn.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 Yr(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 $n.valid(r)}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,"rubygems",t);if(r){let s=[];for(let a of r.versions??[]){let c=Yr(a);c&&s.push(c);}let i=[...s].sort($n.rcompare)[0]??null;return {latest:r.latest?Yr(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=Yr(p);f&&a.push(f);}let l=[...a].sort($n.rcompare)[0]??null;return {latest:l,stableVersions:a,latestStableOverall:l}}catch{return {latest:null,stableVersions:[],latestStableOverall:null}}});return this.meta.set(t,n),n}},hm=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}}}},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,"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}},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,"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}},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,"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}},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,"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 ea(t){try{return await wm(t)}catch{return {type:"unknown"}}}async function wm(t){let e=await Sm(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 km(e,a);}else /^[0-9a-f]{40}$/i.test(r)&&(s=r);let i=await xm(e);return {type:"git",sha:s??void 0,shortSha:s?s.slice(0,7):void 0,branch:o??void 0,remoteUrl:i}}async function Sm(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 km(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 xm(t){let e=await Em(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 Em(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 Oy(t){let e=t.trim();if(!e)return null;let n=Ee.valid(e)?`>=${e}`:e;return Ee.validRange(n)?n:null}function jm(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 By(t,e){let n=[],r=false,s=null;for(let o of t.changes){let i=jm(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 Cn(t){let e=t.drift?.score;return typeof e=="number"?`${t.name} (${e})`:t.name}function ms(){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 Tm(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(Cn(i))}"]`),e.push(`class ${a} ${en(i.drift?.score)}`));}return e.push(...r),e.push(...ms()),{mermaid:e.join(`
89
+ `)}}function Cm(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(Cn(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(Cn(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(Cn(a))}"]`),n.push(`class ${c} ${en(a.drift?.score)}`),n.push(`${i} --> ${c}`);}return n.push(...ms()),{mermaid:n.join(`
90
+ `)}}function Am(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(Cn(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(...ms()),{mermaid:n.join(`
91
+ `)}}var Mm=createRequire(import.meta.url),$m=Mm("../package.json");$m.version;var Lm="https://registry.npmjs.org/@vibgrate%2fcli/latest",ra=B.join(An.homedir(),".vibgrate"),Nm=B.join(ra,"update-check.json");async function Gy(){try{let t=new AbortController,e=setTimeout(()=>t.abort(),1e4);e.unref?.();let n;try{n=await fetch(Lm,{headers:{Accept:"application/json"},signal:t.signal});}finally{clearTimeout(e);}if(!n.ok)return null;let s=(await n.json()).version;return !s||!na.default.valid(s)?null:(await Rm({latest:s,checkedAt:Date.now()}),s)}catch{return null}}async function Rm(t){try{await xe.mkdir(ra,{recursive:!0}),await xe.writeFile(Nm,JSON.stringify(t),"utf-8");}catch{}}var Im=[{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 _m(t,e=3){let n=t.topEvidence,r=n.filter(u=>u.kind==="dependency").map(u=>u.value).slice(0,10),s=Vm(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=Fm(u.value);i.has(p)||i.set(p,new Set);let f=Om(u.value);f.length>=3&&i.get(p).add(f);}let c=[];for(let[u,p]of i){let f=Bm([...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 Fm(t){for(let{category:e,pattern:n}of Im)if(n.test(t))return e;return "general"}function Om(t){return t.toLowerCase().replace(/[^a-z0-9\s-]/g," ").replace(/\s+/g," ").trim().slice(0,60)}function Bm(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 Vm(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 Um=promisify(sa.gzip),ge=50;function Sn(t){let e=t.match(/^(.+?)\s*\(/);return e?e[1].trim():t.trim()}function Gm(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(Sn).slice(0,ge),tables:t.tables.map(Sn).slice(0,ge),views:t.views.map(Sn).slice(0,ge),storedProcedures:t.storedProcedures.map(Sn).slice(0,ge),triggers:t.triggers.map(Sn).slice(0,ge),rowLevelSecurityPolicies:t.rowLevelSecurityPolicies.slice(0,20),otherServices:t.otherServices.slice(0,20)}}function qm(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 Hm(t){return {faviconFiles:t.faviconFiles.slice(0,1),productLogos:[]}}function zm(t){let e={...t};if(e.extended){let n={...e.extended};if(n.dataStores&&(n.dataStores=Gm(n.dataStores)),n.apiSurface&&(n.apiSurface=qm(n.apiSurface)),n.assetBranding&&(n.assetBranding=Hm(n.assetBranding)),n.uiPurpose){let r=_m(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 Wm(t){let e=JSON.stringify(t);return Um(e,{level:9})}async function Hy(t){let e=zm(t);return {body:await Wm(e),contentEncoding:"gzip"}}function Jm(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 zy(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 Km(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 Ym=new Set(["node_modules",".git",".vibgrate",".wrangler",".next","dist","build","out",".turbo",".cache","coverage","bin","obj",".vs","TestResults",".nuxt",".output",".svelte-kit"]);async function Wy(t,e){let n=e??await ea(t);if(n.type==="git"&&n.sha)return {vcsSha:n.sha,method:"git_sha"};let r=await Xm(t);return r?{treeHash:r,method:"tree_metadata"}:{method:"unknown"}}async function Xm(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(Ym.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=us.createHash("sha256");for(let i of r)o.update(i),o.update(`
92
+ `);return o.digest("hex")}var th="https://api.vibgrate.com",nh=1e3*60*60*24,rh=5e3;function Xr(t){return !!t&&typeof t=="object"&&typeof t.generatedAt=="string"&&typeof t.products=="object"&&t.products!==null}var sh=class{apiBase;offline;manifest;cacheDir;fetchImpl;resolution=null;constructor(t={}){this.apiBase=(t.apiBase??process.env.VIBGRATE_API_BASE??th).replace(/\/+$/,""),this.offline=t.offline??false,this.manifest=t.manifest,this.cacheDir=t.cacheDir??B.join(An.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)<nh)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 Xr(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(),rh);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 Xr(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"&&Xr(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{}}},lh=class aa{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 aa(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{}}},lr=[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 ni(t){return [E.bold.white(" V I B G R A T E"),E.dim(" Drift Intelligence Engine")+E.dim(` v${t}`)]}var ri=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],uh=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=lh.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=["",` ${lr[0]} ${ni(this.version)[0]}`,` ${lr[1]} ${ni(this.version)[1]}`,` ${lr[2]}`,` ${lr[3]} ${E.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(k.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(E.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)%Xo.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 y=this.stepStartTimes.get(h.id),w=this.stepEstimates.get(h.id);if(y&&w&&w>0){let j=Date.now()-y;n+=g*Math.min(j/w,.95);}}}let r=e>0?Math.min(Math.round(n/e*100),99):0,s=30,o=Math.round(n/Math.max(e,1)*s),i=k.greenBright("\u2501".repeat(Math.min(o,s)))+k.dim("\u254C".repeat(Math.max(s-o,0))),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(`${r}%`)} ${k.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)%ri.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 y=this.stepStartTimes.get(h.id),w=this.stepEstimates.get(h.id);if(y&&w&&w>0){let j=Date.now()-y;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=gl(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(`
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=Xo[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}...
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=ri[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}...
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 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`)}},ta="scan_history.json",Qo=10;async function na(t){let e=B.join(t,".vibgrate",ta);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 Wm(t,e){let n=B.join(t,".vibgrate"),r=B.join(n,ta),s,o=await na(t);o?(s=o,s.records.push(e),s.records.length>Qo&&(s.records=s.records.slice(-Qo))):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 Jm(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 Km(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 Ym(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 N0(t,e$1,n$1){let r$1=e$1.vibgrateVersion??"unknown",s$1=Date.now(),o=await Bc(t),i=new a$1(e$1.concurrency),a=e$1.packageManifest?await Cl(e$1.packageManifest):void 0,c=e$1.offline===true,l=e$1.maxPrivacy===true,u=new Rl(t,i,a,c),p$1=new Wd(i,a,c),f=new Jd(i,a,c),d$1=new Kd(i,a,c),h=new Yd(i,a,c),g=new Xd(i,a,c),y=new Qd(i,a,c),w=new Zd(i,a,c),j=new em(i,a,c),P=new tm(i,a,c),C=new d,E=[...new Set([...o.exclude??[],...e$1.exclude??[]])];C.setExcludePatterns(E);let v=(e$1.projectScanTimeout??o.projectScanTimeout??180)*1e3;C.setMaxFileSize(o.maxFileSizeToScan??5242880),C.setProjectScanTimeout(v);let b=o.scanners,x=0,T=S=>{x+=S;},m=new zm(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 Il(t))){m.finish();let S=["",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(S)}let I=await new Vm({offline:c,manifest:a}).resolve(),V=I.catalog,pe=e(t,E);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 na(t),ds=Jm(cn,H.totalFiles);m.setEstimatedTotal(ds),m.setStepEstimates(Km(cn,H.totalFiles)),m.startStep("vcs");let Le=await Wi(t),ra=Le.type!=="unknown"?`${Le.type}${Le.branch?` ${Le.branch}`:""}${Le.shortSha?` @ ${Le.shortSha}`:""}`:"none detected";m.completeStep("vcs",ra),m.startStep("walk",H.totalFiles),await C.walkDir(t,(S,M)=>{m.updateStepProgress("walk",S,H.totalFiles,M);});let Rn=C.getWalkSummary(t);Rn&&(Rn.totalFiles!==H.totalFiles||Rn.totalDirs!==H.totalDirs)&&m.updateStats({treeSummary:Rn}),m.completeStep("walk",`${H.totalFiles.toLocaleString()} files indexed`);let qe=await Kl(t,u,C,v,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);x+=qe.length,m.addProjects(qe.length),m.completeStep("node",`${qe.length} project${qe.length!==1?"s":""}`,qe.length);}let He=await eu(t,p$1,C,v,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);x+=He.length,m.addProjects(He.length),m.completeStep("dotnet",`${He.length} project${He.length!==1?"s":""}`,He.length);}let ze=await du(t,f,C,v,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);x+=ze.length,m.addProjects(ze.length),m.completeStep("python",`${ze.length} project${ze.length!==1?"s":""}`,ze.length);}let We=await ku(t,d$1,C,v,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);x+=We.length,m.addProjects(We.length),m.completeStep("java",`${We.length} project${We.length!==1?"s":""}`,We.length);}let Je=await Ru(t,h,C,v,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);x+=Je.length,m.addProjects(Je.length),m.completeStep("ruby",`${Je.length} project${Je.length!==1?"s":""}`,Je.length);}let Ke=await Vu(t,g,C,v);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);x+=Ke.length,m.addProjects(Ke.length),m.completeStep("swift",`${Ke.length} project${Ke.length!==1?"s":""}`,Ke.length);}let Ye=await qu(t,y,C,v,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);x+=Ye.length,m.addProjects(Ye.length),m.completeStep("go",`${Ye.length} project${Ye.length!==1?"s":""}`,Ye.length);}let Xe=await Xu(t,w,C,v);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);x+=Xe.length,m.addProjects(Xe.length),m.completeStep("rust",`${Xe.length} project${Xe.length!==1?"s":""}`,Xe.length);}let Qe=await rp(t,j,C,v);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);x+=Qe.length,m.addProjects(Qe.length),m.completeStep("php",`${Qe.length} project${Qe.length!==1?"s":""}`,Qe.length);}let Ze=await lp(t,P,C,v);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);x+=Ze.length,m.addProjects(Ze.length),m.completeStep("dart",`${Ze.length} project${Ze.length!==1?"s":""}`,Ze.length);}let et=await xp(t,a,C,v,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);x+=et.length,m.addProjects(et.length),m.completeStep("elixir",`${et.length} project${et.length!==1?"s":""}`,et.length);}let tt=await _p(t,a,C,v,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);x+=tt.length,m.addProjects(tt.length),m.completeStep("docker",`${tt.length} project${tt.length!==1?"s":""}`,tt.length);}let nt=await Wp(t,a,C,v,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);x+=nt.length,m.addProjects(nt.length),m.completeStep("helm",`${nt.length} project${nt.length!==1?"s":""}`,nt.length);}let rt=await tf(t,a,C,v,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);x+=rt.length,m.addProjects(rt.length),m.completeStep("terraform",`${rt.length} project${rt.length!==1?"s":""}`,rt.length);}let st=await cf(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);x+=st.length,m.addProjects(st.length),m.completeStep("polyglot",`${st.length} project${st.length!==1?"s":""}`,st.length);}let sa=new Set(["docker","helm","terraform"]),kr=S=>sa.has(S.type)?`${S.type}:${S.path}`:S.path,oa=[...qe,...He,...ze,...We,...Je,...Ke,...Ye,...Xe,...Qe,...Ze,...et,...tt,...nt,...rt,...st],In=new Map;for(let S of oa){let M=In.get(kr(S));if(!M)In.set(kr(S),S);else {let D=jr=>jr.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 jr=new Set(dt.projectReferences.map(mt=>mt.path));for(let mt of ln.projectReferences)jr.has(mt.path)||dt.projectReferences.push(mt);}In.set(kr(S),dt);}}let se=[...In.values()],ms=e$1.dsn||process.env.VIBGRATE_DSN,hs=(ms?Mm(ms):null)?.workspaceId;for(let S of se){S.drift=Ur([S]),S.projectId=el(S.path,S.name,hs);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=vf({fileCount:S.fileCount,sizeBytes:S.sizeBytes,dependencyCount:S.dependencyCount});}let gs=B.join(t,".vibgrate","solutions.json"),ys=new Map;if(await p(gs))try{let S=await n(gs);for(let M of S.solutions??[])M.path&&M.solutionId&&ys.set(M.path,M.solutionId);}catch{}let Bt=(await Ym(t,C)).map(S=>({solutionId:ys.get(S.path)??tl(S.path,S.name,hs),path:S.path,name:S.name,type:S.type,projectPaths:S.projectPaths})),xr=new Map(se.map(S=>[S.path,S]));for(let S of Bt){let M=S.projectPaths.map(D=>xr.get(D)??xr.get(B.dirname(D).replace(/\\/g,"/"))).filter(D=>!!D);S.drift=M.length>0?Ur(M):void 0;for(let D of M)D.solutionId=S.solutionId,D.solutionName=S.name;}for(let S of se)S.relationshipDiagram=lm(S,se);for(let S of Bt)S.relationshipDiagram=um(S,se);let ia=cm(se),Vt={};n$1&&await n$1({rootDir:t,opts:e$1,config:o,scanners:b,maxPrivacyMode:l,allProjects:se,solutions:Bt,projectsByPath:xr,fileCache:C,progress:m,runtimeCatalog:V,extended:Vt,addFilesScanned:T});let vs=(Date.now()-Date.parse(V.generatedAt))/(1e3*60*60*24),aa=Number.isFinite(vs)&&vs>30;Vt.runtimeCatalogInfo={generatedAt:V.generatedAt,source:I.source,stale:aa};let bs=[];if(e$1.vulns){m.insertStepBefore("drift",{id:"vulns",label:"Scanning for vulnerabilities",weight:3}),m.startStep("vulns");let S=_f(se),M=await Df(S,{sem:i,offline:c,manifest:a}),D=a!=null;if((M.packages.length>0||D)&&await gd(t)){let dt=!e$1.noLocalArtifacts&&!l?B.join(t,".vibgrate"):void 0,ln=await Bd(t,{cacheDir:dt});zd(M,ln,new Date().toISOString(),{manifest:a});}(M.source!=="none"||M.packages.length>0||M.cra!=null&&M.cra.remediatedCount>0)&&(Vt.vulnerabilities=M),bs=qf(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 Er=Ur(se);m.completeStep("drift",`${Er.score}/100 \u2014 ${Er.riskLevel} risk`),m.startStep("findings");let _n=[...Zc(se,o),...bs],Fn=_n.filter(S=>S.level==="warning").length,On=_n.filter(S=>S.level==="error").length,Bn=_n.filter(S=>S.level==="note").length;m.addFindings(Fn,On,Bn);let Vn=[];if(On>0&&Vn.push(`${On} error${On!==1?"s":""}`),Fn>0&&Vn.push(`${Fn} warning${Fn!==1?"s":""}`),Bn>0&&Vn.push(`${Bn} note${Bn!==1?"s":""}`),m.completeStep("findings",Vn.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(k.yellow(`
104
- \u26A0 ${Dt.length} path${Dt.length===1?"":"s"} timed out (>${Math.round(v/1e3)}s) and ${Dt.length===1?"was":"were"} skipped:`));for(let D of Dt)console.log(k.dim(` \u2192 ${D}`));let S=Dt.map(D=>`${D}/**`);await Vc(t,S)&&console.log(k.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(k.yellow(`
105
- \u26A0 ${Ut.length} file${Ut.length===1?"":"s"} skipped (>${M} MB):`));for(let D of Ut.slice(0,10))console.log(k.dim(` \u2192 ${D}`));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 ws=Date.now()-s$1,ca=await Xm(t,Le.remoteUrl,Vt.buildDeploy?.ci,e$1.repositoryName),la=wf(se),fe={schemaVersion:"1.0",timestamp:new Date().toISOString(),vibgrateVersion:r$1,rootPath:B.basename(t),...Le.type!=="unknown"?{vcs:Le}:{},repository:ca,projects:se,...Bt.length>0?{solutions:Bt}:{},drift:Er,findings:_n,...Object.keys(Vt).length>0?{extended:Vt}:{},durationMs:ws,filesScanned:x,treeSummary:H,relationshipDiagram:ia,billing:la};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(k.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 Wm(t,{timestamp:fe.timestamp,totalDurationMs:ws,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(k.green("\u2714")+` JSON written to ${e$1.out}`)):console.log(S);}else if(e$1.format==="sarif"){let S=ll(fe),M=JSON.stringify(S,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 S=fl(fe);console.log(S),e$1.out&&await s(B.resolve(e$1.out),S);}else {let S=sl(fe);console.log(S),e$1.out&&await s(B.resolve(e$1.out),S);}return fe}async function Xm(t,e,n$1,r){let s=r?.trim()?r.trim():await $m(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 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`)}},ca="scan_history.json",si=10;async function la(t){let e=B.join(t,".vibgrate",ca);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 ph(t,e){let n=B.join(t,".vibgrate"),r=B.join(n,ca),s,o=await la(t);o?(s=o,s.records.push(e),s.records.length>si&&(s.records=s.records.slice(-si))):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 fh(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 dh(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 mh(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 Zy(t,e$1,n$1){let r$1=e$1.vibgrateVersion??"unknown",s$1=Date.now(),o=await zc(t),i=new a$1(e$1.concurrency),a=e$1.packageManifest?await Hl(e$1.packageManifest):void 0,c=e$1.offline===true,l=e$1.maxPrivacy===true,u=new Ql(t,i,a,c),p$1=new pm(i,a,c),f=new fm(i,a,c),d$1=new dm(i,a,c),h=new mm(i,a,c),g=new hm(i,a,c),y=new gm(i,a,c),w=new ym(i,a,c),j=new vm(i,a,c),P=new bm(i,a,c),C=new d,x=[...new Set([...o.exclude??[],...e$1.exclude??[]])];C.setExcludePatterns(x);let v=(e$1.projectScanTimeout??o.projectScanTimeout??180)*1e3;C.setMaxFileSize(o.maxFileSizeToScan??5242880),C.setProjectScanTimeout(v);let b=o.scanners,k=0,T=S=>{k+=S;},m=new uh(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 Zl(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 sh({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 la(t),gs=fh(cn,H.totalFiles);m.setEstimatedTotal(gs),m.setStepEstimates(dh(cn,H.totalFiles)),m.startStep("vcs");let Le=await ea(t),ua=Le.type!=="unknown"?`${Le.type}${Le.branch?` ${Le.branch}`:""}${Le.shortSha?` @ ${Le.shortSha}`:""}`:"none detected";m.completeStep("vcs",ua),m.startStep("walk",H.totalFiles),await C.walkDir(t,(S,M)=>{m.updateStepProgress("walk",S,H.totalFiles,M);});let In=C.getWalkSummary(t);In&&(In.totalFiles!==H.totalFiles||In.totalDirs!==H.totalDirs)&&m.updateStats({treeSummary:In}),m.completeStep("walk",`${H.totalFiles.toLocaleString()} files indexed`);let qe=await du(t,u,C,v,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 vu(t,p$1,C,v,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 $u(t,f,C,v,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 Vu(t,d$1,C,v,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 Qu(t,h,C,v,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 sp(t,g,C,v);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 cp(t,y,C,v,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 hp(t,w,C,v);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 Sp(t,j,C,v);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 Cp(t,P,C,v);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 Dp(t,a,C,v,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 ef(t,a,C,v,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 ff(t,a,C,v,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 wf(t,a,C,v,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 Tf(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 pa=new Set(["docker","helm","terraform"]),xr=S=>pa.has(S.type)?`${S.type}:${S.path}`:S.path,fa=[...qe,...He,...ze,...We,...Je,...Ke,...Ye,...Xe,...Qe,...Ze,...et,...tt,...nt,...rt,...st],_n=new Map;for(let S of fa){let M=_n.get(xr(S));if(!M)_n.set(xr(S),S);else {let D=Tr=>Tr.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 Tr=new Set(dt.projectReferences.map(mt=>mt.path));for(let mt of ln.projectReferences)Tr.has(mt.path)||dt.projectReferences.push(mt);}_n.set(xr(S),dt);}}let se=[..._n.values()],ys=e$1.dsn||process.env.VIBGRATE_DSN,vs=(ys?Jm(ys):null)?.workspaceId;for(let S of se){S.drift=Gr([S]),S.projectId=al(S.path,S.name,vs);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=_f({fileCount:S.fileCount,sizeBytes:S.sizeBytes,dependencyCount:S.dependencyCount});}let bs=B.join(t,".vibgrate","solutions.json"),ws=new Map;if(await p(bs))try{let S=await n(bs);for(let M of S.solutions??[])M.path&&M.solutionId&&ws.set(M.path,M.solutionId);}catch{}let Bt=(await mh(t,C)).map(S=>({solutionId:ws.get(S.path)??cl(S.path,S.name,vs),path:S.path,name:S.name,type:S.type,projectPaths:S.projectPaths})),Er=new Map(se.map(S=>[S.path,S]));for(let S of Bt){let M=S.projectPaths.map(D=>Er.get(D)??Er.get(B.dirname(D).replace(/\\/g,"/"))).filter(D=>!!D);S.drift=M.length>0?Gr(M):void 0;for(let D of M)D.solutionId=S.solutionId,D.solutionName=S.name;}for(let S of se)S.relationshipDiagram=Cm(S,se);for(let S of Bt)S.relationshipDiagram=Am(S,se);let da=Tm(se),Vt={};n$1&&await n$1({rootDir:t,opts:e$1,config:o,scanners:b,maxPrivacyMode:l,allProjects:se,solutions:Bt,projectsByPath:Er,fileCache:C,progress:m,runtimeCatalog:V,extended:Vt,addFilesScanned:T});let Ss=(Date.now()-Date.parse(V.generatedAt))/(1e3*60*60*24),ma=Number.isFinite(Ss)&&Ss>30;Vt.runtimeCatalogInfo={generatedAt:V.generatedAt,source:I.source,stale:ma};let ks=[];if(e$1.vulns){m.insertStepBefore("drift",{id:"vulns",label:"Scanning for vulnerabilities",weight:3}),m.startStep("vulns");let S=ed(se),M=await od(S,{sem:i,offline:c,manifest:a}),D=a!=null;if((M.packages.length>0||D)&&await Rd(t)){let dt=!e$1.noLocalArtifacts&&!l?B.join(t,".vibgrate"):void 0,ln=await rm(t,{cacheDir:dt});um(M,ln,new Date().toISOString(),{manifest:a});}(M.source!=="none"||M.packages.length>0||M.cra!=null&&M.cra.remediatedCount>0)&&(Vt.vulnerabilities=M),ks=cd(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 jr=Gr(se);m.completeStep("drift",`${jr.score}/100 \u2014 ${jr.riskLevel} risk`),m.startStep("findings");let Fn=[...il(se,o),...ks],On=Fn.filter(S=>S.level==="warning").length,Bn=Fn.filter(S=>S.level==="error").length,Vn=Fn.filter(S=>S.level==="note").length;m.addFindings(On,Bn,Vn);let Dn=[];if(Bn>0&&Dn.push(`${Bn} error${Bn!==1?"s":""}`),On>0&&Dn.push(`${On} warning${On!==1?"s":""}`),Vn>0&&Dn.push(`${Vn} note${Vn!==1?"s":""}`),m.completeStep("findings",Dn.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(v/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 Wc(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 xs=Date.now()-s$1,ha=await hh(t,Le.remoteUrl,Vt.buildDeploy?.ci,e$1.repositoryName),ga=Of(se),fe={schemaVersion:"1.0",timestamp:new Date().toISOString(),vibgrateVersion:r$1,rootPath:B.basename(t),...Le.type!=="unknown"?{vcs:Le}:{},repository:ha,projects:se,...Bt.length>0?{solutions:Bt}:{},drift:jr,findings:Fn,...Object.keys(Vt).length>0?{extended:Vt}:{},durationMs:xs,filesScanned:k,treeSummary:H,relationshipDiagram:da,billing:ga};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 ph(t,{timestamp:fe.timestamp,totalDurationMs:xs,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=Cl(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=Ml(fe);console.log(S),e$1.out&&await s(B.resolve(e$1.out),S);}else {let S=kl(fe);console.log(S),e$1.out&&await s(B.resolve(e$1.out),S);}return fe}async function hh(t,e,n$1,r){let s=r?.trim()?r.trim():await Km(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{vf as $,cm as $a,eu as A,yd as Aa,du as B,vd as Ba,ku as C,bd as Ca,Ru as D,rs as Da,Vu as E,g0 as Ea,qu as F,Bd as Fa,Xu as G,qi as Ga,rp as H,y0 as Ha,lp as I,Hi as Ia,xp as J,zi as Ja,_p as K,Dd as Ka,Wp as L,Ud as La,tf as M,qd as Ma,cf as N,zd as Na,lf as O,Wd as Oa,uf as P,Jd as Pa,pf as Q,Kd as Qa,ff as R,Yd as Ra,df as S,Xd as Sa,mf as T,Qd as Ta,hf as U,Zd as Ua,gf as V,em as Va,yf as W,tm as Wa,Zr as X,Wi as Xa,es as Y,v0 as Ya,ts as Z,am as Za,u0 as _,b0 as _a,Bc as a,bf as aa,lm as ab,Xg as b,p0 as ba,um as bb,Vc as c,wf as ca,x0 as cb,Gc as d,Ai as da,vm as db,qc as e,Pi as ea,j0 as eb,Hc as f,ir as fa,Mm as fb,zc as g,Mi as ga,T0 as gb,jo as h,Nf as ha,$m as hb,Ur as i,_f as ia,C0 as ib,Zc as j,$i as ja,Nm as jb,el as k,Ff as ka,N0 as kb,tl as l,Df as la,nl as m,Uf as ma,rl as n,qf as na,Ao as o,Qf as oa,Qg as p,Zf as pa,Zg as q,f0 as qa,e0 as r,od as ra,t0 as s,ad as sa,sl as t,cd as ta,ll as u,ld as ua,fl as v,ud as va,Cl as w,d0 as wa,Rl as x,Oi as xa,Il as y,Nn as ya,Kl as z,gd as za};
143
+ */export{_f as $,Tm as $a,vu as A,Id as Aa,$u as B,_d as Ba,Vu as C,Fd as Ca,Qu as D,is as Da,sp as E,_y as Ea,cp as F,rm as Fa,hp as G,Xi as Ga,Sp as H,Fy as Ha,Cp as I,Qi as Ia,Dp as J,Zi as Ja,ef as K,om as Ka,ff as L,im as La,wf as M,cm as Ma,Tf as N,um as Na,Cf as O,pm as Oa,Af as P,fm as Pa,Pf as Q,dm as Qa,Mf as R,mm as Ra,$f as S,hm as Sa,Lf as T,gm as Ta,Nf as U,ym as Ua,Rf as V,vm as Va,If as W,bm as Wa,ns as X,ea as Xa,rs as Y,Oy as Ya,ss as Z,jm as Za,My as _,By as _a,zc as a,Ff as aa,Cm as ab,hy as b,$y as ba,Am as bb,Wc as c,Of as ca,Gy as cb,Yc as d,Ii as da,_m as db,Xc as e,_i as ea,Hy as eb,Qc as f,ar as fa,Jm as fb,Zc as g,Fi as ga,zy as gb,Ao as h,Xf as ha,Km as hb,Gr as i,ed as ia,Wy as ib,il as j,Oi as ja,Xm as jb,al as k,td as ka,Zy as kb,cl as l,od as la,ll as m,id as ma,ul as n,cd as na,$o as o,gd as oa,gy as p,yd as pa,yy as q,Ly as qa,vy as r,xd as ra,by as s,jd as sa,kl as t,Td as ta,Cl as u,Cd as ua,Ml as v,Ad as va,Hl as w,Ny as wa,Ql as x,Hi as xa,Zl as y,Rn as ya,du as z,Rd as za};