@preventive/triage 1.0.0-alpha.87 → 1.0.0-alpha.88

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 +0,0 @@
1
- import{a as e}from"./chunk-GO7FT4OD.js";import{b as t,c as n,d as r,e as i}from"./chunk-RAM3GDAD.js";import{c as a,d as o,e as s,f as c,h as l,k as u,l as d,m as f,o as p,q as m}from"./chunk-3YPZ7UBC.js";import"./chunk-N57OWFKY.js";import{a as h}from"./chunk-7YFJUT2P.js";import"./chunk-PXK7EU4V.js";import{m as g,q as _,s as v,w as y}from"./chunk-KP2XM324.js";import"./chunk-DUASGS2O.js";import{b}from"./chunk-IYPY47MC.js";import"./chunk-QRKFPLA4.js";import"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";function x(e){if(e instanceof Uint8Array)return{proven:!1,reason:`unsupported`,at:null};if(typeof e!=`string`)throw TypeError(`a text must be a string or its UTF-8 bytes, not ${typeof e}`);if(!e.isWellFormed())throw TypeError(`a text must be a well-formed string`);return{proven:!1,reason:`unsupported`,at:null}}var S=e=>e.subarray(0,8e3).includes(0),C=(e,t)=>(e+Math.imul(t,97)>>>0)%107927,w=e=>Uint8Array.from({length:256},(t,n)=>Number(n===10||e.includes(String.fromCodePoint(n)))),T=w(``),E=w(`,;={}`);function D(e,t=T){let n=!S(e),r=new Map,i=(e,t)=>r.set(e,(r.get(e)??0)+t),a=0,o=0,s=0;for(let r=0;r<e.length;r++){let c=e[r];if(n&&c===13&&e[r+1]===10)continue;let l=a;a=(a<<7^o>>>25)+c>>>0,o=(o<<7^l>>>25)>>>0,!(++s<64&&t[c]===0)&&(i(C(a,o),s),s=0,a=0,o=0)}s>0&&i(C(a,o),s);let c=Uint32Array.from(r.keys()).sort();return{hashes:c,bytes:Float64Array.from(c,e=>r.get(e)),total:r.values().reduce((e,t)=>e+t,0)}}function ee(e,t){let n=0;for(let r=0,i=0;r<e.hashes.length&&i<t.hashes.length;)e.hashes[r]<t.hashes[i]?r++:e.hashes[r]>t.hashes[i]?i++:n+=Math.min(e.bytes[r++],t.bytes[i++]);return n}function te(e,t,n){let r=0,i=e.total,a=t.total;for(let o=0,s=0;o<e.hashes.length&&s<t.hashes.length;)if(e.hashes[o]<t.hashes[s]?i-=e.bytes[o++]:(e.hashes[o]>t.hashes[s]||(r+=Math.min(e.bytes[o],t.bytes[s]),i-=e.bytes[o++]),a-=t.bytes[s++]),(r+Math.min(i,a))*6e4<n)return 0;return r}function O(e,t,n,r,i=!1){if(e===null||t===null||t.length===0)return 0;let a=Math.abs(e.length-t.length),o=Math.max(e.length,t.length);if(o*(6e4-n)<a*6e4)return 0;let s=r(e),c=r(t),l=i?te(s,c,n*o):ee(s,c);return Math.trunc(l*6e4/o)}var k=/^[\w-]{6,}$/u,A=/[\dA-Z]/u,ne=/^(?:\.[\w-]+)+$/u,re=/^[\w-]{8,32}$/u;function j(e){let t=[];for(let n=e.length-1;n>0;n--){if(e[n]!==`-`&&e[n]!==`.`)continue;let r=e.indexOf(`.`,n+1),i=e.slice(r),a=e.slice(n+1,r);r!==-1&&re.test(a)&&ne.test(i)&&/[A-Za-z]/u.test(a)&&A.test(a)&&t.push([e.slice(0,n),a,i])}return t}var ie=e=>e.replaceAll(/\d/gu,`0`).replaceAll(/[a-z]/gu,`a`).replaceAll(/[A-Z]/gu,`A`);function ae(e,t){let n=j(t);for(let[t,r,i]of j(e)){let e=n.find(e=>e[2]===i);if(e&&e[1]!==r)return e[0]===t&&ie(e[1])!==ie(r)}return!1}function oe(e){let t=e.lastIndexOf(`/`),n=e.slice(t+1),r=n.lastIndexOf(`.`),i=r>0?n.slice(r):``;return{name:n,key:`${e.slice(0,t+1)}\0${i}\0${n.length}`}}function se(e,t){let n=e.length,r=0;for(;r<e.length&&e[r]===t[r];)r++;for(;n>r&&e[n-1]===t[n-1];)n--;for(;r>0&&!`-._`.includes(e[r-1]);)r--;for(;n<e.length&&e[n]!==`.`;)n++;let i=e.slice(r,n),a=t.slice(r,n);return r>0&&k.test(i)&&k.test(a)&&(A.test(i)||A.test(a))}function ce({sources:e,dests:t,pairs:n,used:r,record:i,punctuatedScoreOf:a},{remaining:o,open:s},c,l){let u=(e,t)=>new Map(t.filter(t=>e[t].type===`file`).map(t=>[t,oe(e[t].path)])),d=u(t,s),f=u(e,o),p=Map.groupBy(f.keys(),e=>f.get(e).key),m=Map.groupBy(d.keys(),e=>d.get(e).key),h=[];for(let[e,t]of m){let n=p.get(e)??[];for(let e of t)for(let t of n)se(f.get(t).name,d.get(e).name)&&h.push({s:t,d:e})}let g=Map.groupBy(h,({d:e})=>e),_=Map.groupBy(h,({s:e})=>e),v=[];for(let{s:e,d:t}of h){let n=_.get(e).length===1&&g.get(t).length===1&&ae(f.get(e).name,d.get(t).name),r=a(e,t,n?0:c);(n||r>=c)&&v.push({s:e,d:t,score:r})}let y=[],b=new Set,x=new Set;for(let e of v.sort((e,t)=>t.score-e.score))n.has(e.d)||r.has(e.s)||(x.has(e.s)||b.has(e.d)||l(e)?(y.push(e),x.add(e.s),b.add(e.d)):i(e.d,e.s,e.score));return y}var le=/(?<![\p{L}\p{N}_$])(?:0[box][\d_a-f]+n?|\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d+)?n?)|(?<![\p{N}.])\.\d[\d_]*(?:e[+-]?\d+)?/giu;function ue(e){let t=e.toLowerCase(),n=/^0[box]|n$/u.test(t)?null:/^([^e]*)(?:e([+-]?)0*(\d+))?$/u.exec(t);if(!n)return t;let[,r=``,i=``,a=``]=n,o=(r.startsWith(`.`)?`0${r}`:r).replace(/(\.\d+?)0+$/u,`$1`).replace(/\.$/u,``),s=/^0+$/u.test(a);return a===``||s&&o.includes(`.`)?o:`${o}e${i===`-`&&!s?`-`:``}${a}`}var de=e=>e.replaceAll(le,ue).replaceAll(/,(?=(?:\s|\/\/[^\n\r\u2028\u2029]*(?![^\n\r\u2028\u2029])|\/\*(?:[^*]|\*(?!\/))*\*\/)*[\])}>])/gu,``).replaceAll(/(?<!\\)\\+(?=["'])/gu,e=>e.slice(e.length%2)).replaceAll(/[\s();]/gu,``).replaceAll(`'`,`"`);function fe(e,t){let n=e.length;if(n!==t.length)return!1;let r=0;if(n>=32&&(e.byteOffset&3)==(t.byteOffset&3)){for(let n=4-(e.byteOffset&3)&3;r<n;r++)if(e[r]!==t[r])return!1;let i=n-r>>>2,a=new Int32Array(e.buffer,e.byteOffset+r,i),o=new Int32Array(t.buffer,t.byteOffset+r,i);for(let e=0;e<i;e++)if(a[e]!==o[e])return!1;r+=i*4}for(;r<n;r++)if(e[r]!==t[r])return!1;return!0}var M=class extends Error{constructor(e,t,n){let r=n===void 0?``:` in the ${n} tree`;super(t===void 0?e:`${e}: ${JSON.stringify(t)}${r}`),this.name=`CompareError`,this.path=t,this.tree=n}},pe=new Set([`file`,`contiguous-file`]),me=new Set([`fifo`,`character-device`,`block-device`]),he=/(?:^|\/)\.{0,2}(?:\/|$)/u;function ge(e){if(!Number.isInteger(e)||e<0||e>4095)throw RangeError(`a mode must be an integer from 0 to 0o7777, not ${e}`)}function _e(e,t,n,r){if(typeof e!=`string`)throw TypeError(`an entry's name must be a string, not ${typeof e}`);if(e!==`.`||t!==`directory`){if(r?e===``:he.test(e))throw new M(r?`a name must not be empty`:"a name must be a relative path with no empty, `.` or `..` segment",e,n);if(!e.isWellFormed())throw new M(`a name must be well-formed Unicode`,e,n)}}function ve(e,t,n){if(typeof e!=`string`||e===``)throw new M(`a link must name its target`,t,n);if(!e.isWellFormed())throw new M(`a link target must be well-formed Unicode`,t,n);return e}function ye(e){if(e===void 0)return new Uint8Array;if(e instanceof Uint8Array)return e;if(typeof e!=`string`)throw TypeError(`a file's data must be a string or a Uint8Array, not ${typeof e}`);if(!e.isWellFormed())throw TypeError(`a file's text must be well-formed Unicode`);return e}var N=e=>typeof e==`string`?h(e):e;function be(e,t,n){if(typeof e!=`object`||!e)throw TypeError(`an entry must be an object, not ${e===null?`null`:typeof e}`);let{name:r,type:i=`file`,mode:a,linkname:o,data:s}=e;if(_e(r,i,t,n),a!==void 0&&ge(a),pe.has(i))return{path:r,type:`file`,mode:a??420,data:ye(s)};if(i===`symlink`||i===`hardlink`)return{path:r,type:i,target:ve(o,r,t)};if(i===`directory`)return{path:r,type:i};throw me.has(i)?new M(`a ${i} is neither a file nor a link`,r,t):TypeError(`${JSON.stringify(i)} is not an entry type`)}function P(e,t){return e.type===t.type?e.type===`symlink`?e.target===t.target:e.data===t.data?!0:typeof e.data==`string`&&typeof t.data==`string`?!1:fe(N(e.data),N(t.data)):!1}function xe(e,t,n){let r=new Set([e.path]),i=t.get(e.target);for(;i?.type===`hardlink`;){if(r.has(i.path))throw new M(`a hard link leads back to itself`,e.path,n);r.add(i.path),i=t.get(i.target)}if(i===void 0||i.type===`directory`)throw new M(`a hard link must name a file or a link in the tree`,e.path,n);return{...i,path:e.path}}function F(e,t,n){let r=new Map;for(let i of e){let e=be(i,t,n);if(e.type!==`directory`||e.path!==`.`){if(r.has(e.path))throw new M(`a name is given twice`,e.path,t);r.set(e.path,e)}}let i=new Map;for(let[e,a]of r){for(let i=n?-1:e.lastIndexOf(`/`);i>0;i=e.lastIndexOf(`/`,i-1)){let n=r.get(e.slice(0,i));if(n!==void 0&&n.type!==`directory`)throw new M(`a path lies under a ${n.type===`symlink`?`link`:`file`}`,e,t)}a.type===`hardlink`?i.set(e,xe(a,r,t)):a.type!==`directory`&&i.set(e,a)}return i}var Se=100,Ce=4,I=e=>e.slice(e.lastIndexOf(`/`)+1);function L(t,n){if(t.type===`symlink`)return`l${t.target}`;let r=n(t);return`f${r.length}:${e(r)}`}function we({sources:e,dests:t,sourceNames:n,destNames:r,used:i,record:a,bytes:o}){let s=Map.groupBy(e.keys(),t=>L(e[t],o));for(let c=0;c<t.length;c++){let l=-1,u=Se;for(let a of s.get(L(t[c],o))??[])if(!i.has(a)&&P(e[a],t[c])&&((l===-1||n[a]===r[c])&&(l=a),n[a]===r[c]||--u===0))break;l!==-1&&a(c,l,6e4)}}var Te=new Map([[`.ts`,`.js`],[`.mts`,`.mjs`],[`.cts`,`.cjs`],[`.tsx`,`.jsx`]]),R=new Map([...[`.js`,`.mjs`,`.cjs`,`.jsx`,`.ts`,`.mts`,`.cts`,`.tsx`].map(e=>[e,`script`]),...[`.css`,`.scss`,`.sass`,`.less`].map(e=>[e,`style`])]);function z(e){let t=e.split(`/`),n=t.pop(),r=n.lastIndexOf(`.`);return r>0?{dirs:t,stem:n.slice(0,r),extension:n.slice(r)}:{dirs:t,stem:n,extension:``}}function B(e){let{dirs:t,stem:n,extension:r}=z(e);return JSON.stringify([t.map(e=>e===`lib`||e===`src`?null:e),n,Te.get(r)??r])}function Ee(e){let{dirs:t,stem:n,extension:r}=z(e),i=[n,R.get(r)??r],a=t.lastIndexOf(`node_modules`),o=a===-1?0:a+(t[a+1]?.startsWith(`@`)?3:2),s=[JSON.stringify([...i,t])];for(let e=o;e<t.length;e++)s.push(JSON.stringify([...i,t.toSpliced(e,1,null)]));return s}var V=(e,t)=>Math.max(t,e+Math.trunc((6e4-e)/2));function H({pairs:e,used:t,scoreOf:n},{remaining:r,open:i},{s:a,d:o,score:s},c){let l=V(s,c);return i.some(t=>t!==o&&!e.has(t)&&n(a,t,l)>=l)||r.some(e=>e!==a&&!t.has(e)&&n(e,o,l)>=l)}function De(e,t,n,r){let{sources:i,dests:a,pairs:o,used:s,record:c,scoreOf:l}=e,u=Map.groupBy(t.remaining.filter(e=>i[e].type===`file`),e=>B(i[e].path)),d=t.open.filter(e=>a[e].type===`file`).flatMap(e=>(u.get(B(a[e].path))??[]).map(t=>({s:t,d:e,score:l(t,e,0)})));for(let i of d.sort((e,t)=>t.score-e.score))o.has(i.d)||s.has(i.s)||n&&H(e,t,i,r)||c(i.d,i.s,i.score)}function Oe(e,t,n,r){let{sources:i,dests:a,pairs:o,used:s,record:c,scoreOf:l}=e,u=new Map,d=(e,t,n)=>new Map(t.filter(t=>e[t].type===`file`).map(t=>{let r=Ee(e[t].path);for(let e of r)(u.get(e)??u.set(e,{sources:[],dests:[]}).get(e))[n].push(t);return[t,r]})),f=d(a,t.open.filter(e=>!o.has(e)),`dests`),p=d(i,t.remaining.filter(e=>!s.has(e)),`sources`),m=(e,t)=>{let n=new Set(e.flatMap(e=>u.get(e)[t]));return n.size===1?[...n][0]:-1};for(let[i,a]of p){let o=m(a,`dests`);if(o===-1||m(f.get(o),`sources`)!==i)continue;let s={s:i,d:o,score:l(i,o,0)};n&&H(e,t,s,r)||c(o,i,s.score)}}function ke(e,t,n){let r=G(e),i=t<6e4&&r.remaining.length*r.open.length<=n*n;De(e,r,i,t),Oe(e,r,i,t)}function U(e,t){let n=new Map;for(let r of t)n.set(e[r],n.has(e[r])?-1:r);return n}function Ae({sourceNames:e,destNames:t,record:n,scoreOf:r},{remaining:i,open:a},o){let s=U(t,a),c=U(e,i);for(let t of i){let i=s.get(e[t]);if(i===void 0||i===-1||c.get(e[t])===-1)continue;let a=r(t,i,o);a>=o&&n(i,t,a)}}var W=(e,t)=>t.score-e.score||t.nameScore-e.nameScore;function je(e,t){if(e.length<Ce){e.push(t);return}let n=0;for(let t=1;t<e.length;t++)W(e[t],e[n])>0&&(n=t);W(e[n],t)>0&&(e[n]=t)}function Me({sourceNames:e,destNames:t,pairs:n,used:r,record:i,scoreOf:a},{remaining:o,open:s},c,l){let u=[];for(let n of s){let r=[];for(let i of o)je(r,{score:a(i,n,c),nameScore:+(e[i]===t[n]),dst:n,src:i});u.push(...r)}let d=0,f=e=>{for(;d<l.length&&V(l[d].score,c)>e;d++){let{s:e,d:t,score:a}=l[d];!n.has(t)&&!r.has(e)&&i(t,e,a)}};for(let{dst:e,src:t,score:a}of u.sort(W)){if(a<c)break;f(a),!n.has(e)&&!r.has(t)&&i(e,t,a)}f(-1/0)}function Ne(e){if(e.type!==`file`||!R.has(z(e.path).extension))return null;let t=typeof e.data==`string`?e.data:a(e);return t===void 0?null:N(de(t))}function Pe(e,t){let n=new Map,r=new Map,i=e=>r.has(e)?r.get(e):r.set(e,Ne(e)).get(e),a=e=>n.get(e)??n.set(e,D(e,E)).get(e);Me({...e,scoreOf:(t,n,r)=>O(i(e.sources[t]),i(e.dests[n]),r,a)},G(e),K(t),[])}var G=({sources:e,dests:t,pairs:n,used:r})=>({remaining:e.keys().filter(e=>!r.has(e)).toArray(),open:t.keys().filter(e=>!n.has(e)).toArray()}),K=e=>V(e,e);function Fe(e,t,{minimum:n,limit:r,byPath:i,byForm:a=!1}){let o=new Map,s=new Set;if(e.length===0||t.length===0)return o;let c=new Map,l=new Map,u=new Map,d=e=>e.type===`file`?l.get(e)??l.set(e,N(e.data)).get(e):null,f=e=>c.get(e)??c.set(e,D(e)).get(e),p=e=>u.get(e)??u.set(e,D(e,E)).get(e),m={sources:e,dests:t,pairs:o,used:s,sourceNames:e.map(e=>I(e.path)),destNames:t.map(e=>I(e.path)),record(e,t,n){o.set(e,{source:t,score:n}),s.add(t)},bytes:d,scoreOf:(n,r,i)=>O(d(e[n]),d(t[r]),i,f),punctuatedScoreOf:(n,r,i)=>O(d(e[n]),d(t[r]),i,p,!0)};if(we(m),i&&ke(m,n,r),n>=6e4)return o;Ae(m,G(m),K(n));let h=G(m);if(h.remaining.length*h.open.length>r*r)return o;let g=i?ce(m,h,K(n),e=>H(m,h,e,n)):[];return Me(m,G(m),n,g),a&&Pe(m,n),o}var Ie=50,Le=1e3;function q(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return e.codePointAt(r)-t.codePointAt(r);return e.length-t.length}function Re(e){if(e===!1)return null;let t=e===!0?Ie:e;if(typeof t!=`number`)throw TypeError(`renames must be a boolean or a percentage, not ${typeof e}`);if(!(t>0&&t<=100))throw RangeError(`renames must be a percentage above 0 and at most 100, not ${e}`);return Math.max(1,Math.trunc(6e4*t/100))}function ze({renamesByPath:e,renamesByForm:t,renameLimit:n,renameGroup:r,paths:i,lines:a}){if(o(`renamesByPath`,e),o(`renamesByForm`,t),s(`renameLimit`,n),r!==null&&typeof r!=`function`)throw TypeError(`renameGroup must be a function, not ${typeof r}`);if(i!==`tree`&&i!==`keys`)throw RangeError(`paths must be 'tree' or 'keys', not ${i}`);o(`lines`,a)}var Be=(e,t)=>P(e,t)&&(e.type!==`file`||e.mode===t.mode),J=(e,t,n,r=null)=>({status:e,old:t,new:n,similarity:r}),Ve=/\.d\.(?:[^./]+\.)?[cm]?ts$/u,He=e=>e.endsWith(`.mts`)?`module`:e.endsWith(`.cts`)?`commonjs`:null,Ue=/^export\s*\{\s*\}\s*;?$/u;function We(e){if(e===null)return{proven:!0,runtime:``,loads:!1};try{return a(e)===void 0?{proven:!1}:x(e.data)}catch{return{proven:!1}}}function Ge(e){if(![e.old,e.new].filter(e=>e!==null).every(e=>e.type===`file`&&Ve.test(e.path))||e.old&&e.new&&e.old.mode!==e.new.mode)return e;let t=We(e.new),n=We(e.old);return!n.proven||!t.proven||n.runtime!==t.runtime&&!(e.old===null&&Ue.test(t.runtime))||n.loads&&e.old&&e.new&&e.old.path!==e.new.path&&He(e.old.path)!==He(e.new.path)?e:{...e,typeOnly:!0}}function Ke(e,t){let n=[],r=[],i=[];for(let[n,a]of e){let e=t.get(n);e===void 0?i.push(a):e.type===a.type?Be(a,e)||r.push(J(`modified`,a,e)):r.push(J(`type-changed`,a,e))}for(let[r,i]of t)e.has(r)||n.push(i);return i.sort((e,t)=>q(e.path,t.path)),n.sort((e,t)=>q(e.path,t.path)),{changes:r,deleted:i,added:n}}function qe(e,t,{group:n,...r}){if(n===null)return Fe(e,t,r);let i=new Map,a=e=>Map.groupBy(e.keys(),t=>n(e[t].path)),o=a(e);for(let[n,s]of a(t)){let a=o.get(n);if(a!==void 0)for(let[n,{source:o,score:c}]of Fe(a.map(t=>e[t]),s.map(e=>t[e]),r))i.set(s[n],{source:a[o],score:c})}return i}function Je(e,t,{renames:n=!0,renamesByPath:r=!0,renamesByForm:i=!1,renameLimit:a=Le,renameGroup:o=null,paths:s=`tree`,lines:u=!0,horizon:d,whitespace:f,ignoreCase:p,shortest:m}={}){let h=Re(n);ze({renamesByPath:r,renamesByForm:i,renameLimit:a,renameGroup:o,paths:s,lines:u});let g=c({horizon:d,whitespace:f,ignoreCase:p,shortest:m}),_=s===`keys`,{changes:v,deleted:y,added:b}=Ke(F(e,`old`,_),F(t,`new`,_)),x=h===null?new Map:qe(y,b,{minimum:h,limit:a,byPath:r,byForm:i,group:o});for(let[e,t]of b.entries()){let n=x.get(e);v.push(n===void 0?J(`added`,null,t):J(`renamed`,y[n.source],t,Math.trunc(n.score*100/6e4)))}let S=new Set(x.values().map(({source:e})=>e));for(let[e,t]of y.entries())S.has(e)||v.push(J(`deleted`,t,null));return v.sort((e,t)=>q((e.new??e.old).path,(t.new??t.old).path)),(u?v.map(e=>({...e,...l(e.old,e.new,g)})):v).map(Ge)}function Y(e,t,n){let r=new Map,i=new Set,a=0;for(let o of e){let e=u(n,o);e===null||!t.has(e)||(r.set(o,e),i.add(e),e!==o&&a++)}for(let n of e)r.has(n)||!t.has(n)||i.has(n)||(r.set(n,n),i.add(n));let o=r.size;for(let a of e){if(r.has(a))continue;let e=u(n,a)??d(n,a);for(;t.has(e)||i.has(e);)e=`../${e}`;r.set(a,e),i.add(e)}return{paths:r,paired:o,moved:a}}function Ye(e,t){let n=new Set(e),r=new Set(t),i=(e,t)=>{let n=new Map;for(let r of e)for(let e=r.indexOf(`/`);e!==-1;e=r.indexOf(`/`,e+1)){let i=r.slice(0,e+1);t.has(r.slice(e+1))&&n.set(i,(n.get(i)??0)+1)}let r=null,i=!1;for(let[e,t]of n)t>(n.get(r)??0)?[r,i]=[e,!1]:t===n.get(r)&&(i=!0);return i?null:r},a=Y(n,r,null).paired,o=[[{base:``,other:i(r,n)},n],[{base:i(n,r),other:``},r]].filter(([e])=>e.base!==null&&e.other!==null).map(([e,t])=>({root:e,side:t,...Y(n,r,e)})).filter(({side:e,paired:t,moved:n})=>t>a&&n*2>=e.size);return o.length===2&&o[0].paired===o[1].paired?null:o.toSorted((e,t)=>t.paired-e.paired)[0]?.root??null}function Xe(e,t){let n=[...e],r=new Set(t),i=Ye(n,r);return{root:i,paths:Y(n,r,i).paths}}function Ze(e,t,n){if(!e&&!t)return null;let r=[...e??[]],i=Map.groupBy(r,([,e])=>e),a=new Map(i.entries().map(([e,t])=>[e,f(n,e,t.map(([t])=>t.slice(e.length+1)))]));return new Map([...r.map(([e,t])=>[n.paths.get(e)??e,a.get(t)]),...t??[]])}function Qe(e,t,n=new Map,i=new Map,a=null,o=()=>!1){let s=e=>{let t=n.get(e)??i.get(e);return t===void 0?[...new Set([e,it(a,e)??e])]:[t]},c=[],l=[],u=[],d=new Set;for(let n of e.values()){let e=s(n.parent).map(e=>t.get(r(e,n.specifier,n.conditions,n.platform))).find(Boolean),a=i.get(n.target)??n.target;if(e){if(d.add(e.key),!s(n.target).includes(e.target)){let{target:t,...n}=e;c.push({...n,baseTarget:a,otherTarget:t})}continue}let u=s(n.parent).find(o);if(u===void 0)continue;let{specifier:f,conditions:p,platform:m}=n;l.push({key:r(u,f,p,m),parent:u,specifier:f,conditions:p,platform:m,baseTarget:a,otherTarget:null})}for(let e of t.values()){if(d.has(e.key)||!o(e.parent))continue;let{target:t,...n}=e;u.push({...n,baseTarget:null,otherTarget:t})}for(let e of[c,l,u])e.sort((e,t)=>e.key.localeCompare(t.key));return{changed:c,onlyBase:l,onlyOther:u,totalChanges:c.length+l.length+u.length}}function X(e){return g(e)??0}function $e(e,t){return e===t||e?.format===`base64`&&t?.format===`base64`&&e.data===t.data||e?.format===`digest`&&t?.format===`digest`&&e.digest===t.digest}function Z(e){if(e?.npmExecutable instanceof Set)return t=>({executable:e.npmExecutable.has(t)});if(e?.kind!==`stasis`||!e.bundle)return null;let{formats:t,executable:n,entries:r}=e.bundle;return e=>({format:t?.get(e),executable:n?.has(e)??!1,entry:r?.has(e)??!1})}function et(e,t){return!e||!t?[]:[`format`,`executable`,`entry`].filter(n=>e[n]!==t[n]).map(n=>({field:n,from:e[n],to:t[n]}))}function Q(e){return(t,n)=>Math.abs(n.delta)-Math.abs(t.delta)||t[e].localeCompare(n[e])}function $(e){return(t,n)=>n.bytes-t.bytes||t[e].localeCompare(n[e])}function tt(e,t){return typeof e==`string`?`\0text\0${e.toWellFormed()}`:e?.format===`base64`?`\0base64\0${e.data}`:e?.format===`digest`?`\0digest\0${e.digest}`:`\0none\0${t}`}var nt=250;function rt(e,t,n,r,i){let a=(e,t,n)=>e.filter(({path:e})=>e!==``&&e.isWellFormed()).map(({path:e},r)=>({name:e,data:tt(t.get(e),`${n}${r}`)})),o={paths:`keys`,renameGroup:i,renameLimit:nt,renamesByForm:!0,lines:!1},s=Je(a(e,n,`a`),a(t,r,`b`),o);return new Map(s.filter(({status:e})=>e===`renamed`).map(e=>[e.old.path,e.new.path]))}function it(e,t){return e?e.base===``?`${e.other}${t}`:t.startsWith(e.base)?t.slice(e.base.length):null:t}function at(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function ot(e,t,n,r=Xe(e.keys(),t.keys()),i=[]){let{root:a,paths:o}=r,s=new Map([...o].map(([e,t])=>[t,e]));e=new Map([...e].map(([e,t])=>[o.get(e),t]));let c=e=>s.get(e)===e?{}:{basePath:s.get(e)},l=(e,t)=>{let n=et(i[0]?.(e),i[1]?.(t));return n.length>0?{meta:n}:{}},u=[],d=[],f=[],p=0,m=0,h=0,g=0,_=0,v=0,y=new Map,b=e=>{let t=n(e),r=y.get(t);return r||(r=at(),y.set(t,r)),r},x=new Set([...e.keys(),...t.keys()]);for(let n of x){let r=e.has(n),i=t.has(n),a=b(n);if(r&&i){let r=e.get(n),i=t.get(n),o=$e(r,i),u=l(s.get(n),n),d=X(r),h=o?d:X(i);if(p+=d,m+=h,a.baseBytes+=d,a.otherBytes+=h,o&&!u.meta)v++;else{let e=h-d;f.push({path:n,...c(n),baseBytes:d,otherBytes:h,delta:e,...u,...o?{modified:!1}:{}}),_+=e,a.changedFiles++}}else if(r){let t=X(e.get(n));p+=t,h+=t,a.baseBytes+=t,a.onlyBaseFiles++,u.push({path:n,...c(n),bytes:t})}else{let e=X(t.get(n));m+=e,g+=e,a.otherBytes+=e,a.onlyOtherFiles++,d.push({path:n,bytes:e})}}let S=rt(u,d,e,t,n);if(S.size>0){let n=new Set(S.values());for(let[n,r]of S){let i=e.get(n),a=t.get(r),o=$e(i,a),c=X(i),u=o?c:X(a);h-=c,g-=u,f.push({path:r,renamedFrom:n,basePath:s.get(n),baseBytes:c,otherBytes:u,delta:u-c,modified:!o,...l(s.get(n),r)}),_+=u-c;let d=b(n);d.onlyBaseFiles--,d.onlyOtherFiles--,d.changedFiles++}u.splice(0,u.length,...u.filter(e=>!S.has(e.path))),d.splice(0,d.length,...d.filter(e=>!n.has(e.path)))}let C=[],w=[],T=[],E=[];for(let[e,t]of y){let n=t.baseBytes>0||t.onlyBaseFiles>0||t.changedFiles>0,r=t.otherBytes>0||t.onlyOtherFiles>0||t.changedFiles>0,i=t.onlyBaseFiles+t.onlyOtherFiles+t.changedFiles;n&&!r?C.push({pkg:e,bytes:t.baseBytes}):r&&!n?w.push({pkg:e,bytes:t.otherBytes}):i>0||t.baseBytes!==t.otherBytes?T.push({pkg:e,baseBytes:t.baseBytes,otherBytes:t.otherBytes,delta:t.otherBytes-t.baseBytes}):E.push({pkg:e,bytes:t.baseBytes})}return u.sort($(`path`)),d.sort($(`path`)),f.sort(Q(`path`)),C.sort($(`pkg`)),w.sort($(`pkg`)),T.sort(Q(`pkg`)),{totals:{baseFiles:e.size,baseBytes:p,otherFiles:t.size,otherBytes:m,onlyBaseFiles:u.length,onlyBaseBytes:h,onlyOtherFiles:d.length,onlyOtherBytes:g,changedFiles:f.length,renamedFiles:S.size,changedDelta:_,unchangedFiles:v,fileDelta:t.size-e.size,byteDelta:m-p,identical:u.length===0&&d.length===0&&f.length===0},files:{onlyBase:u,onlyOther:d,changed:f,root:a,basePaths:o},packages:{onlyBase:C,onlyOther:w,changed:T,unchanged:E}}}function st(e,r,a=null){let[o,s]=[e,r],[c,l]=t(o,s,a),u=n(o,c),d=n(s,l),f=Xe(u.keys(),d.keys()),h=Ze(_(o),_(s),f),g=ot(u,d,e=>b(e,{packageDir:h?.get(e)}),f,[Z(o),Z(s)]),x=y(o),S=y(s),C=(e,t)=>{let n=0;for(let r of t)n+=e.get(r)??0;return n};Object.assign(g.totals,{baseLines:C(x,u.keys()),otherLines:C(S,d.keys())});for(let e of g.files.onlyBase)e.lines=x.get(e.basePath??e.path)??0;for(let e of g.files.onlyOther)e.lines=S.get(e.path)??0;for(let e of g.files.changed)Object.assign(e,{baseLines:x.get(e.basePath??e.path)??0,otherLines:S.get(e.path)??0});let w=new Set([...g.files.onlyOther,...g.files.changed.filter(e=>e.modified!==!1)].map(e=>e.path));g.resolutions=Qe(i(o,c),i(s,l),new Map(g.files.changed.filter(e=>e.renamedFrom!=null).map(e=>[e.basePath,e.path])),g.files.basePaths,g.files.root,e=>d.has(e)&&!w.has(e));let T=e=>b(``,{packageDir:e}),E=v(o,c?u.keys():null,T),D=v(s,l?d.keys():null,T);return g.versionUpdates=m(E,D),g.packageRows=p(g.packages,E,D),g.scope=a??``,g}export{st as prepareComparison};
@@ -1 +0,0 @@
1
- import{jb as e,lb as t}from"./chunk-ZPIUN4FW.js";import{n,q as r,w as i}from"./chunk-KP2XM324.js";import{a}from"./chunk-74JZTGTO.js";import{b as o}from"./chunk-IYPY47MC.js";import{D as s,J as c,L as l,q as u}from"./chunk-QRKFPLA4.js";function d(e){let{data:t}=l(e);return t&&f(t)>0?t:null}function f(e){return(c(e)??[]).filter(t=>(Array.isArray(t)?t:[t]).some(t=>t&&typeof t==`object`&&u(t,t.source??e.source))).length}function p(e,t){let n=[],r=new Map;for(let{name:t,content:i,fallbackRepo:a}of e){if(typeof i!=`string`)continue;let e=d(i);if(!e)continue;let o=c(e),l=s(e)??s({repo:{github:a}}),u=new Set(l?[l]:[]);if(!l)for(let e of o.flat()){if(/(?:^|\/)(?:node_modules|dependencies)\//u.test(e?.file??``))continue;let t=s(e);t&&u.add(t)}for(let e of u)r.set(e,{id:e,label:e});n.push({id:t,filename:t,repoIds:[...u],analyzer:e.source,appFindings:f(e)})}let i=new Set(n.map(e=>e.id));return{merge:{bundles:[],results:[]},link:{reports:n,repositories:[...r.values()],workspaces:t.map(e=>({id:e.id,label:e.name,reports:e.reports.filter(e=>i.has(e))})).filter(e=>e.reports.length>0)}}}function m(e,t){let n=(e.reports??[]).filter(e=>e.visible&&e.repoId!=null).flatMap(e=>{let t=d(e.content??``);return t?[{id:e.id,filename:e.filename,repoIds:[e.repoId],repo:e.repoFullName,directory:e.repoDirectory,analyzer:e.analyzer,appFindings:f(t)}]:[]}),r=new Map((e.repos??[]).map(e=>[e.repoId,{id:e.repoId,label:e.fullName}]));for(let e of n)r.has(e.repoIds[0])||r.set(e.repoIds[0],{id:e.repoIds[0],label:e.repo??String(e.repoIds[0])});let i=t.results??[],o=new Set(i.map(e=>e.bundleId));return{merge:{bundles:(t.bundles??[]).filter(e=>o.has(e.id)).map(e=>({...e,size:a(e.byteSize)})),results:i},link:{repositories:[...r.values()].filter(e=>n.some(t=>t.repoIds.includes(e.id))),reports:n}}}var h=new Map([[`openai/gpt-6-astra`,`GPT-6 Astra`],[`openai/gpt-6-astra-pro`,`GPT-6 Astra Pro`],[`openai/gpt-5.6-sol`,`GPT-5.6 Sol`],[`openai/gpt-5.6-terra`,`GPT-5.6 Terra`],[`openai/gpt-5.6-luna`,`GPT-5.6 Luna`],[`anthropic/claude-fable-5.1`,`Claude Fable 5.1`],[`anthropic/claude-opus-5`,`Claude Opus 5`],[`anthropic/claude-sonnet-5`,`Claude Sonnet 5`],[`moonshotai/kimi-k3`,`Kimi K3`],[`z-ai/glm-5.3`,`GLM 5.3`],[`qwen/qwen3.8-max`,`Qwen3.8 Max`],[`qwen/qwen4-max`,`Qwen4 Max`],[`deepseek/deepseek-v4.1-flash`,`DeepSeek V4.1 Flash`],[`deepseek/deepseek-v4-pro`,`DeepSeek V4 Pro`]]),g=new Map([[`openai`,`OpenAI`],[`anthropic`,`Anthropic`],[`moonshotai`,`Moonshot AI`],[`google`,`Google`],[`nvidia`,`NVIDIA`],[`qwen`,`Qwen`],[`deepseek`,`DeepSeek`],[`x-ai`,`xAI`],[`z-ai`,`Z.ai`],[`mistralai`,`Mistral AI`],[`meta`,`Meta`],[`unbiased`,`Unbiased`]]),_=new Map([[`meta-llama`,`meta`]]),v=new Map([[`gpt`,`GPT`],[`gptoss`,`GPT OSS`],[`oss`,`OSS`],[`o`,`O`],[`ai`,`AI`],[`api`,`API`],[`4o`,`4o`],[`k3`,`K3`],[`k4`,`K4`],[`qwen`,`Qwen`],[`kimi`,`Kimi`],[`mimo`,`MiMo`],[`gemini`,`Gemini`],[`claude`,`Claude`],[`fable`,`Fable`],[`opus`,`Opus`],[`sonnet`,`Sonnet`],[`astra`,`Astra`],[`terra`,`Terra`],[`luna`,`Luna`],[`codex`,`Codex`],[`deepseek`,`DeepSeek`],[`nemotron`,`Nemotron`],[`gemma`,`Gemma`]]);function y(e){let t=e.replace(/:free$/u,``).replaceAll(`_`,`-`).split(`-`).filter(Boolean),n=[];for(let e=0;e<t.length;e++){let r=t[e],i=t[e+1];if(/^\d+$/u.test(r)&&/^\d+$/u.test(i??``)){n.push(`${r}.${i}`),e++;continue}let a=v.get(r.toLowerCase());n.push(a??(/^(?:[a-z]+\d+|\d+[a-z]+)$/iu.test(r)?r.toUpperCase():r[0]?.toUpperCase()+r.slice(1)))}return n.join(` `).replace(/^GPT (\d)/u,`GPT-$1`)}function b(e){return h.get(e)??y(e.includes(`/`)?e.slice(e.indexOf(`/`)+1):e)}function x(e){let t=e.includes(`/`)?e.split(`/`)[0].replace(/^~/u,``):`other`,n=_.get(t)??t;return{key:n,name:g.get(n)??(n===`other`?`Other`:y(n))}}function S(e){return e===`xhigh`?`Extra high`:e?e[0].toUpperCase()+e.slice(1):`Unavailable`}function C(e){return e.efforts.includes(`max`)?`max`:e.efforts.at(-1)??null}async function w(e,t=fetch){let n=await t(`/api/admin/scan/models`,{credentials:`same-origin`,headers:{accept:`application/json`},signal:e});if(!n.ok)throw Error(`HTTP ${n.status}`);return T(await n.json())}function T(e){if(!Array.isArray(e?.models))throw Error(`No model catalogue returned`);let t=e.models.filter(e=>typeof e?.id==`string`&&e.id.length>0).map(e=>({id:e.id,efforts:Array.isArray(e.efforts)?[...new Set(e.efforts.filter(e=>typeof e==`string`&&e.length>0))]:[]}));if(t.length===0)throw Error(`No models available`);return{models:t,defaultModel:t.find(t=>t.id===e.defaultModel)?.id??t[0].id}}function E(e,t=[]){let n=new Map,r=e.flatMap(e=>{let r=t.filter(t=>t.bundles?.includes(e.integrity));return(r.length>0?r.map(e=>({id:e.id,label:e.name})):[{id:`unattached`,label:`Unattached`}]).map(t=>(n.set(t.id,t),{id:e.integrity,integrity:e.integrity,filename:e.name,repoId:t.id,repo:t.label,files:null,reasons:[],size:`—`}))});return{repositories:[...n.values()],bundles:r,reports:[],scans:[]}}function D(s,c){if(c.error)throw Error(c.error);let l=r(c),u=c.kind===`stasis`?c.bundle?.formats:null,d=i(c),f=[...n(c)].filter(([,e])=>e!=null).map(([e,t])=>({path:e,format:u?.get(e)??null,bytes:t,lines:d.get(e)??0,size:a(t),module:o(e,{packageDir:l?.get(e)})})),p=e(c,f.map(e=>e.path)),m=[{id:`all`,label:`All`,filePaths:null},...t(p).map(e=>{let t;return{...e,get filePaths(){return t??=[...p.files(e.id)]}}})];return{...s,files:f,reasons:m,size:a(c.size)}}export{E as a,D as b,p as c,m as d,b as e,x as f,S as g,C as h,w as i,T as j};
File without changes