@preventive/triage 1.0.0-alpha.62 → 1.0.0-alpha.63

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 +1 @@
1
- import{a as e}from"./chunk-GO7FT4OD.js";import{c as t,d as n,e as r,h as i,i as a,j as o,m as s,n as c,o as l,p as u}from"./chunk-OBNHCORJ.js";import{a as d}from"./chunk-7GJNLCXF.js";import"./chunk-PXK7EU4V.js";import{a as f,c as p}from"./chunk-JCIIBLKR.js";import{l as m,p as h,q as g,v as _}from"./chunk-65PLAG3I.js";import{b as v}from"./chunk-IYPY47MC.js";import"./chunk-QRKFPLA4.js";import"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";function y(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 b=e=>e.subarray(0,8e3).includes(0),x=(e,t)=>(e+Math.imul(t,97)>>>0)%107927,S=e=>Uint8Array.from({length:256},(t,n)=>Number(n===10||e.includes(String.fromCodePoint(n)))),C=S(``),w=S(`,;={}`);function T(e,t=C){let n=!b(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(x(a,o),s),s=0,a=0,o=0)}s>0&&i(x(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 E(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 D(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?D(s,c,n*o):E(s,c);return Math.trunc(l*6e4/o)}var k=/^[\w-]{6,}$/u,A=/[\dA-Z]/u,ee=/^(?:\.[\w-]+)+$/u,te=/^[\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&&te.test(a)&&ee.test(i)&&/[A-Za-z]/u.test(a)&&A.test(a)&&t.push([e.slice(0,n),a,i])}return t}var M=e=>e.replaceAll(/\d/gu,`0`).replaceAll(/[a-z]/gu,`a`).replaceAll(/[A-Z]/gu,`A`);function ne(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&&M(e[1])!==M(r)}return!1}function re(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 ie(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 ae({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,re(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)ie(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&&ne(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}function oe(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 N=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}},se=new Set([`file`,`contiguous-file`]),ce=new Set([`fifo`,`character-device`,`block-device`]),le=/(?:^|\/)\.{0,2}(?:\/|$)/u;function ue(e){if(!Number.isInteger(e)||e<0||e>4095)throw RangeError(`a mode must be an integer from 0 to 0o7777, not ${e}`)}function de(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===``:le.test(e))throw new N(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 N(`a name must be well-formed Unicode`,e,n)}}function fe(e,t,n){if(typeof e!=`string`||e===``)throw new N(`a link must name its target`,t,n);if(!e.isWellFormed())throw new N(`a link target must be well-formed Unicode`,t,n);return e}function pe(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 P=e=>typeof e==`string`?d(e):e;function me(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(de(r,i,t,n),a!==void 0&&ue(a),se.has(i))return{path:r,type:`file`,mode:a??420,data:pe(s)};if(i===`symlink`||i===`hardlink`)return{path:r,type:i,target:fe(o,r,t)};if(i===`directory`)return{path:r,type:i};throw ce.has(i)?new N(`a ${i} is neither a file nor a link`,r,t):TypeError(`${JSON.stringify(i)} is not an entry type`)}function F(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:oe(P(e.data),P(t.data)):!1}function he(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 N(`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 N(`a hard link must name a file or a link in the tree`,e.path,n);return{...i,path:e.path}}function I(e,t,n){let r=new Map;for(let i of e){let e=me(i,t,n);if(e.type!==`directory`||e.path!==`.`){if(r.has(e.path))throw new N(`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 N(`a path lies under a ${n.type===`symlink`?`link`:`file`}`,e,t)}a.type===`hardlink`?i.set(e,he(a,r,t)):a.type!==`directory`&&i.set(e,a)}return i}var ge=100,_e=4,L=e=>e.slice(e.lastIndexOf(`/`)+1);function R(t,n){if(t.type===`symlink`)return`l${t.target}`;let r=n(t);return`f${r.length}:${e(r)}`}function ve({sources:e,dests:t,sourceNames:n,destNames:r,used:i,record:a,bytes:o}){let s=Map.groupBy(e.keys(),t=>R(e[t],o));for(let c=0;c<t.length;c++){let l=-1,u=ge;for(let a of s.get(R(t[c],o))??[])if(!i.has(a)&&F(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 ye=new Map([[`.ts`,`.js`],[`.mts`,`.mjs`],[`.cts`,`.cjs`],[`.tsx`,`.jsx`]]),be=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,ye.get(r)??r])}function xe(e){let{dirs:t,stem:n,extension:r}=z(e),i=[n,be.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 Se(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 Ce(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=xe(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 we(e,t,n){let r=G(e),i=t<6e4&&r.remaining.length*r.open.length<=n*n;Se(e,r,i,t),Ce(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 Te({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 Ee(e,t){if(e.length<_e){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 De({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)Ee(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)}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 q(e,t,{minimum:n,limit:r,byPath:i}){let a=new Map,o=new Set;if(e.length===0||t.length===0)return a;let s=new Map,c=new Map,l=new Map,u=e=>e.type===`file`?c.get(e)??c.set(e,P(e.data)).get(e):null,d=e=>s.get(e)??s.set(e,T(e)).get(e),f=e=>l.get(e)??l.set(e,T(e,w)).get(e),p={sources:e,dests:t,pairs:a,used:o,sourceNames:e.map(e=>L(e.path)),destNames:t.map(e=>L(e.path)),record(e,t,n){a.set(e,{source:t,score:n}),o.add(t)},bytes:u,scoreOf:(n,r,i)=>O(u(e[n]),u(t[r]),i,d),punctuatedScoreOf:(n,r,i)=>O(u(e[n]),u(t[r]),i,f,!0)};if(ve(p),i&&we(p,n,r),n>=6e4)return a;Te(p,G(p),K(n));let m=G(p);if(m.remaining.length*m.open.length>r*r)return a;let h=i?ae(p,m,K(n),e=>H(p,m,e,n)):[];return De(p,G(p),n,h),a}var Oe=50,ke=1e3;function J(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 Ae(e){if(e===!1)return null;let t=e===!0?Oe: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 je({renamesByPath:e,renameLimit:t,renameGroup:n,paths:r,lines:i}){if(typeof e!=`boolean`)throw TypeError(`renamesByPath must be a boolean, not ${typeof e}`);if(t!==1/0&&!(Number.isSafeInteger(t)&&t>=0))throw RangeError(`renameLimit must be a whole number or Infinity, not ${t}`);if(n!==null&&typeof n!=`function`)throw TypeError(`renameGroup must be a function, not ${typeof n}`);if(r!==`tree`&&r!==`keys`)throw RangeError(`paths must be 'tree' or 'keys', not ${r}`);if(typeof i!=`boolean`)throw TypeError(`lines must be a boolean, not ${typeof i}`)}var Me=(e,t)=>F(e,t)&&(e.type!==`file`||e.mode===t.mode),Y=(e,t,n,r=null)=>({status:e,old:t,new:n,similarity:r}),Ne=/\.d\.(?:[^./]+\.)?[cm]?ts$/u,Pe=e=>e.endsWith(`.mts`)?`module`:e.endsWith(`.cts`)?`commonjs`:null,Fe=/^export\s*\{\s*\}\s*;?$/u;function Ie(e){if(e===null)return{proven:!0,runtime:``,loads:!1};try{return t(e)===void 0?{proven:!1}:y(e.data)}catch{return{proven:!1}}}function Le(e){if(![e.old,e.new].filter(e=>e!==null).every(e=>e.type===`file`&&Ne.test(e.path))||e.old&&e.new&&e.old.mode!==e.new.mode)return e;let t=Ie(e.new),n=Ie(e.old);return!n.proven||!t.proven||n.runtime!==t.runtime&&!(e.old===null&&Fe.test(t.runtime))||n.loads&&e.old&&e.new&&e.old.path!==e.new.path&&Pe(e.old.path)!==Pe(e.new.path)?e:{...e,typeOnly:!0}}function Re(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?Me(a,e)||r.push(Y(`modified`,a,e)):r.push(Y(`type-changed`,a,e))}for(let[r,i]of t)e.has(r)||n.push(i);return i.sort((e,t)=>J(e.path,t.path)),n.sort((e,t)=>J(e.path,t.path)),{changes:r,deleted:i,added:n}}function ze(e,t,{group:n,...r}){if(n===null)return q(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 q(a.map(t=>e[t]),s.map(e=>t[e]),r))i.set(s[n],{source:a[o],score:c})}return i}function Be(e,t,{renames:i=!0,renamesByPath:a=!0,renameLimit:o=ke,renameGroup:s=null,paths:c=`tree`,lines:l=!0,horizon:u,whitespace:d,ignoreCase:f}={}){let p=Ae(i);je({renamesByPath:a,renameLimit:o,renameGroup:s,paths:c,lines:l});let m=n({horizon:u,whitespace:d,ignoreCase:f}),h=c===`keys`,{changes:g,deleted:_,added:v}=Re(I(e,`old`,h),I(t,`new`,h)),y=p===null?new Map:ze(_,v,{minimum:p,limit:o,byPath:a,group:s});for(let[e,t]of v.entries()){let n=y.get(e);g.push(n===void 0?Y(`added`,null,t):Y(`renamed`,_[n.source],t,Math.trunc(n.score*100/6e4)))}let b=new Set(y.values().map(({source:e})=>e));for(let[e,t]of _.entries())b.has(e)||g.push(Y(`deleted`,t,null));return g.sort((e,t)=>J((e.new??e.old).path,(t.new??t.old).path)),(l?g.map(e=>({...e,...r(e.old,e.new,m)})):g).map(Le)}function X(e,t,n){let r=new Map,o=new Set,s=0;for(let a of e){let e=i(n,a);e===null||!t.has(e)||(r.set(a,e),o.add(e),e!==a&&s++)}for(let n of e)r.has(n)||!t.has(n)||o.has(n)||(r.set(n,n),o.add(n));let c=r.size;for(let s of e){if(r.has(s))continue;let e=i(n,s)??a(n,s);for(;t.has(e)||o.has(e);)e=`../${e}`;r.set(s,e),o.add(e)}return{paths:r,paired:c,moved:s}}function Ve(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=X(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,...X(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 He(e,t){let n=[...e],r=new Set(t),i=Ve(n,r);return{root:i,paths:X(n,r,i).paths}}function Ue(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,o(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 We(e,t,n=new Map,r=new Map,i=null,a=()=>!1){let o=e=>{let t=n.get(e)??r.get(e);return t===void 0?[...new Set([e,Ze(i,e)??e])]:[t]},s=[],c=[],u=[],d=new Set;for(let n of e.values()){let e=o(n.parent).map(e=>t.get(l(e,n.specifier,n.conditions,n.platform))).find(Boolean),i=r.get(n.target)??n.target;if(e){if(d.add(e.key),!o(n.target).includes(e.target)){let{target:t,...n}=e;s.push({...n,baseTarget:i,otherTarget:t})}continue}let u=o(n.parent).find(a);if(u===void 0)continue;let{specifier:f,conditions:p,platform:m}=n;c.push({key:l(u,f,p,m),parent:u,specifier:f,conditions:p,platform:m,baseTarget:i,otherTarget:null})}for(let e of t.values()){if(d.has(e.key)||!a(e.parent))continue;let{target:t,...n}=e;u.push({...n,baseTarget:null,otherTarget:t})}for(let e of[s,c,u])e.sort((e,t)=>e.key.localeCompare(t.key));return{changed:s,onlyBase:c,onlyOther:u,totalChanges:s.length+c.length+u.length}}function Z(e){return m(e)??0}function Ge(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 Q(e){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 Ke(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 qe(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 Je(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 Ye=250;function Xe(e,t,n,r,i){let a=(e,t,n)=>e.filter(({path:e})=>e!==``&&e.isWellFormed()).map(({path:e},r)=>({name:e,data:Je(t.get(e),`${n}${r}`)})),o={paths:`keys`,renameGroup:i,renameLimit:Ye,lines:!1},s=Be(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 Ze(e,t){return e?e.base===``?`${e.other}${t}`:t.startsWith(e.base)?t.slice(e.base.length):null:t}function Qe(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function $e(e,t,n,r=He(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=Ke(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=Qe(),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=Ge(r,i),u=l(s.get(n),n),d=Z(r),h=o?d:Z(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=Z(e.get(n));p+=t,h+=t,a.baseBytes+=t,a.onlyBaseFiles++,u.push({path:n,...c(n),bytes:t})}else{let e=Z(t.get(n));m+=e,g+=e,a.otherBytes+=e,a.onlyOtherFiles++,d.push({path:n,bytes:e})}}let S=Xe(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=Ge(i,a),c=Z(i),u=o?c:Z(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(qe(`path`)),C.sort($(`pkg`)),w.sort($(`pkg`)),T.sort(qe(`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 et(e,t,n=null){let[r,i]=[e,t],[a,o]=s(r,i,n),l=c(r,a),d=c(i,o),m=He(l.keys(),d.keys()),y=Ue(h(r),h(i),m),b=$e(l,d,e=>v(e,{packageDir:y?.get(e)}),m,[Q(r),Q(i)]),x=_(r),S=_(i),C=(e,t)=>{let n=0;for(let r of t)n+=e.get(r)??0;return n};Object.assign(b.totals,{baseLines:C(x,l.keys()),otherLines:C(S,d.keys())});for(let e of b.files.onlyBase)e.lines=x.get(e.basePath??e.path)??0;for(let e of b.files.onlyOther)e.lines=S.get(e.path)??0;for(let e of b.files.changed)Object.assign(e,{baseLines:x.get(e.basePath??e.path)??0,otherLines:S.get(e.path)??0});let w=new Set([...b.files.onlyOther,...b.files.changed.filter(e=>e.modified!==!1)].map(e=>e.path));b.resolutions=We(u(r,a),u(i,o),new Map(b.files.changed.filter(e=>e.renamedFrom!=null).map(e=>[e.basePath,e.path])),b.files.basePaths,b.files.root,e=>d.has(e)&&!w.has(e));let T=e=>v(``,{packageDir:e}),E=g(r,a?l.keys():null,T),D=g(i,o?d.keys():null,T);return b.versionUpdates=p(E,D),b.packageRows=f(b.packages,E,D),b.scope=n??``,b}export{et as prepareComparison};
1
+ import{a as e}from"./chunk-GO7FT4OD.js";import{c as t,d as n,e as r,h as i,i as a,j as o,m as s,n as c,o as l,p as u}from"./chunk-24AKGEH3.js";import{a as d}from"./chunk-7GJNLCXF.js";import"./chunk-PXK7EU4V.js";import{a as f,c as p}from"./chunk-JCIIBLKR.js";import{l as m,p as h,q as g,v as _}from"./chunk-65PLAG3I.js";import{b as v}from"./chunk-IYPY47MC.js";import"./chunk-QRKFPLA4.js";import"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";function y(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 b=e=>e.subarray(0,8e3).includes(0),x=(e,t)=>(e+Math.imul(t,97)>>>0)%107927,S=e=>Uint8Array.from({length:256},(t,n)=>Number(n===10||e.includes(String.fromCodePoint(n)))),C=S(``),w=S(`,;={}`);function T(e,t=C){let n=!b(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(x(a,o),s),s=0,a=0,o=0)}s>0&&i(x(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 E(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 D(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?D(s,c,n*o):E(s,c);return Math.trunc(l*6e4/o)}var k=/^[\w-]{6,}$/u,A=/[\dA-Z]/u,ee=/^(?:\.[\w-]+)+$/u,te=/^[\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&&te.test(a)&&ee.test(i)&&/[A-Za-z]/u.test(a)&&A.test(a)&&t.push([e.slice(0,n),a,i])}return t}var M=e=>e.replaceAll(/\d/gu,`0`).replaceAll(/[a-z]/gu,`a`).replaceAll(/[A-Z]/gu,`A`);function ne(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&&M(e[1])!==M(r)}return!1}function re(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 ie(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 ae({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,re(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)ie(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&&ne(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}function oe(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 N=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}},se=new Set([`file`,`contiguous-file`]),ce=new Set([`fifo`,`character-device`,`block-device`]),le=/(?:^|\/)\.{0,2}(?:\/|$)/u;function ue(e){if(!Number.isInteger(e)||e<0||e>4095)throw RangeError(`a mode must be an integer from 0 to 0o7777, not ${e}`)}function de(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===``:le.test(e))throw new N(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 N(`a name must be well-formed Unicode`,e,n)}}function fe(e,t,n){if(typeof e!=`string`||e===``)throw new N(`a link must name its target`,t,n);if(!e.isWellFormed())throw new N(`a link target must be well-formed Unicode`,t,n);return e}function pe(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 P=e=>typeof e==`string`?d(e):e;function me(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(de(r,i,t,n),a!==void 0&&ue(a),se.has(i))return{path:r,type:`file`,mode:a??420,data:pe(s)};if(i===`symlink`||i===`hardlink`)return{path:r,type:i,target:fe(o,r,t)};if(i===`directory`)return{path:r,type:i};throw ce.has(i)?new N(`a ${i} is neither a file nor a link`,r,t):TypeError(`${JSON.stringify(i)} is not an entry type`)}function F(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:oe(P(e.data),P(t.data)):!1}function he(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 N(`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 N(`a hard link must name a file or a link in the tree`,e.path,n);return{...i,path:e.path}}function I(e,t,n){let r=new Map;for(let i of e){let e=me(i,t,n);if(e.type!==`directory`||e.path!==`.`){if(r.has(e.path))throw new N(`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 N(`a path lies under a ${n.type===`symlink`?`link`:`file`}`,e,t)}a.type===`hardlink`?i.set(e,he(a,r,t)):a.type!==`directory`&&i.set(e,a)}return i}var ge=100,_e=4,L=e=>e.slice(e.lastIndexOf(`/`)+1);function R(t,n){if(t.type===`symlink`)return`l${t.target}`;let r=n(t);return`f${r.length}:${e(r)}`}function ve({sources:e,dests:t,sourceNames:n,destNames:r,used:i,record:a,bytes:o}){let s=Map.groupBy(e.keys(),t=>R(e[t],o));for(let c=0;c<t.length;c++){let l=-1,u=ge;for(let a of s.get(R(t[c],o))??[])if(!i.has(a)&&F(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 ye=new Map([[`.ts`,`.js`],[`.mts`,`.mjs`],[`.cts`,`.cjs`],[`.tsx`,`.jsx`]]),be=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,ye.get(r)??r])}function xe(e){let{dirs:t,stem:n,extension:r}=z(e),i=[n,be.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 Se(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 Ce(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=xe(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 we(e,t,n){let r=G(e),i=t<6e4&&r.remaining.length*r.open.length<=n*n;Se(e,r,i,t),Ce(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 Te({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 Ee(e,t){if(e.length<_e){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 De({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)Ee(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)}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 q(e,t,{minimum:n,limit:r,byPath:i}){let a=new Map,o=new Set;if(e.length===0||t.length===0)return a;let s=new Map,c=new Map,l=new Map,u=e=>e.type===`file`?c.get(e)??c.set(e,P(e.data)).get(e):null,d=e=>s.get(e)??s.set(e,T(e)).get(e),f=e=>l.get(e)??l.set(e,T(e,w)).get(e),p={sources:e,dests:t,pairs:a,used:o,sourceNames:e.map(e=>L(e.path)),destNames:t.map(e=>L(e.path)),record(e,t,n){a.set(e,{source:t,score:n}),o.add(t)},bytes:u,scoreOf:(n,r,i)=>O(u(e[n]),u(t[r]),i,d),punctuatedScoreOf:(n,r,i)=>O(u(e[n]),u(t[r]),i,f,!0)};if(ve(p),i&&we(p,n,r),n>=6e4)return a;Te(p,G(p),K(n));let m=G(p);if(m.remaining.length*m.open.length>r*r)return a;let h=i?ae(p,m,K(n),e=>H(p,m,e,n)):[];return De(p,G(p),n,h),a}var Oe=50,ke=1e3;function J(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 Ae(e){if(e===!1)return null;let t=e===!0?Oe: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 je({renamesByPath:e,renameLimit:t,renameGroup:n,paths:r,lines:i}){if(typeof e!=`boolean`)throw TypeError(`renamesByPath must be a boolean, not ${typeof e}`);if(t!==1/0&&!(Number.isSafeInteger(t)&&t>=0))throw RangeError(`renameLimit must be a whole number or Infinity, not ${t}`);if(n!==null&&typeof n!=`function`)throw TypeError(`renameGroup must be a function, not ${typeof n}`);if(r!==`tree`&&r!==`keys`)throw RangeError(`paths must be 'tree' or 'keys', not ${r}`);if(typeof i!=`boolean`)throw TypeError(`lines must be a boolean, not ${typeof i}`)}var Me=(e,t)=>F(e,t)&&(e.type!==`file`||e.mode===t.mode),Y=(e,t,n,r=null)=>({status:e,old:t,new:n,similarity:r}),Ne=/\.d\.(?:[^./]+\.)?[cm]?ts$/u,Pe=e=>e.endsWith(`.mts`)?`module`:e.endsWith(`.cts`)?`commonjs`:null,Fe=/^export\s*\{\s*\}\s*;?$/u;function Ie(e){if(e===null)return{proven:!0,runtime:``,loads:!1};try{return t(e)===void 0?{proven:!1}:y(e.data)}catch{return{proven:!1}}}function Le(e){if(![e.old,e.new].filter(e=>e!==null).every(e=>e.type===`file`&&Ne.test(e.path))||e.old&&e.new&&e.old.mode!==e.new.mode)return e;let t=Ie(e.new),n=Ie(e.old);return!n.proven||!t.proven||n.runtime!==t.runtime&&!(e.old===null&&Fe.test(t.runtime))||n.loads&&e.old&&e.new&&e.old.path!==e.new.path&&Pe(e.old.path)!==Pe(e.new.path)?e:{...e,typeOnly:!0}}function Re(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?Me(a,e)||r.push(Y(`modified`,a,e)):r.push(Y(`type-changed`,a,e))}for(let[r,i]of t)e.has(r)||n.push(i);return i.sort((e,t)=>J(e.path,t.path)),n.sort((e,t)=>J(e.path,t.path)),{changes:r,deleted:i,added:n}}function ze(e,t,{group:n,...r}){if(n===null)return q(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 q(a.map(t=>e[t]),s.map(e=>t[e]),r))i.set(s[n],{source:a[o],score:c})}return i}function Be(e,t,{renames:i=!0,renamesByPath:a=!0,renameLimit:o=ke,renameGroup:s=null,paths:c=`tree`,lines:l=!0,horizon:u,whitespace:d,ignoreCase:f}={}){let p=Ae(i);je({renamesByPath:a,renameLimit:o,renameGroup:s,paths:c,lines:l});let m=n({horizon:u,whitespace:d,ignoreCase:f}),h=c===`keys`,{changes:g,deleted:_,added:v}=Re(I(e,`old`,h),I(t,`new`,h)),y=p===null?new Map:ze(_,v,{minimum:p,limit:o,byPath:a,group:s});for(let[e,t]of v.entries()){let n=y.get(e);g.push(n===void 0?Y(`added`,null,t):Y(`renamed`,_[n.source],t,Math.trunc(n.score*100/6e4)))}let b=new Set(y.values().map(({source:e})=>e));for(let[e,t]of _.entries())b.has(e)||g.push(Y(`deleted`,t,null));return g.sort((e,t)=>J((e.new??e.old).path,(t.new??t.old).path)),(l?g.map(e=>({...e,...r(e.old,e.new,m)})):g).map(Le)}function X(e,t,n){let r=new Map,o=new Set,s=0;for(let a of e){let e=i(n,a);e===null||!t.has(e)||(r.set(a,e),o.add(e),e!==a&&s++)}for(let n of e)r.has(n)||!t.has(n)||o.has(n)||(r.set(n,n),o.add(n));let c=r.size;for(let s of e){if(r.has(s))continue;let e=i(n,s)??a(n,s);for(;t.has(e)||o.has(e);)e=`../${e}`;r.set(s,e),o.add(e)}return{paths:r,paired:c,moved:s}}function Ve(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=X(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,...X(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 He(e,t){let n=[...e],r=new Set(t),i=Ve(n,r);return{root:i,paths:X(n,r,i).paths}}function Ue(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,o(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 We(e,t,n=new Map,r=new Map,i=null,a=()=>!1){let o=e=>{let t=n.get(e)??r.get(e);return t===void 0?[...new Set([e,Ze(i,e)??e])]:[t]},s=[],c=[],u=[],d=new Set;for(let n of e.values()){let e=o(n.parent).map(e=>t.get(l(e,n.specifier,n.conditions,n.platform))).find(Boolean),i=r.get(n.target)??n.target;if(e){if(d.add(e.key),!o(n.target).includes(e.target)){let{target:t,...n}=e;s.push({...n,baseTarget:i,otherTarget:t})}continue}let u=o(n.parent).find(a);if(u===void 0)continue;let{specifier:f,conditions:p,platform:m}=n;c.push({key:l(u,f,p,m),parent:u,specifier:f,conditions:p,platform:m,baseTarget:i,otherTarget:null})}for(let e of t.values()){if(d.has(e.key)||!a(e.parent))continue;let{target:t,...n}=e;u.push({...n,baseTarget:null,otherTarget:t})}for(let e of[s,c,u])e.sort((e,t)=>e.key.localeCompare(t.key));return{changed:s,onlyBase:c,onlyOther:u,totalChanges:s.length+c.length+u.length}}function Z(e){return m(e)??0}function Ge(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 Q(e){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 Ke(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 qe(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 Je(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 Ye=250;function Xe(e,t,n,r,i){let a=(e,t,n)=>e.filter(({path:e})=>e!==``&&e.isWellFormed()).map(({path:e},r)=>({name:e,data:Je(t.get(e),`${n}${r}`)})),o={paths:`keys`,renameGroup:i,renameLimit:Ye,lines:!1},s=Be(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 Ze(e,t){return e?e.base===``?`${e.other}${t}`:t.startsWith(e.base)?t.slice(e.base.length):null:t}function Qe(){return{baseBytes:0,otherBytes:0,onlyBaseFiles:0,onlyOtherFiles:0,changedFiles:0}}function $e(e,t,n,r=He(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=Ke(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=Qe(),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=Ge(r,i),u=l(s.get(n),n),d=Z(r),h=o?d:Z(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=Z(e.get(n));p+=t,h+=t,a.baseBytes+=t,a.onlyBaseFiles++,u.push({path:n,...c(n),bytes:t})}else{let e=Z(t.get(n));m+=e,g+=e,a.otherBytes+=e,a.onlyOtherFiles++,d.push({path:n,bytes:e})}}let S=Xe(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=Ge(i,a),c=Z(i),u=o?c:Z(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(qe(`path`)),C.sort($(`pkg`)),w.sort($(`pkg`)),T.sort(qe(`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 et(e,t,n=null){let[r,i]=[e,t],[a,o]=s(r,i,n),l=c(r,a),d=c(i,o),m=He(l.keys(),d.keys()),y=Ue(h(r),h(i),m),b=$e(l,d,e=>v(e,{packageDir:y?.get(e)}),m,[Q(r),Q(i)]),x=_(r),S=_(i),C=(e,t)=>{let n=0;for(let r of t)n+=e.get(r)??0;return n};Object.assign(b.totals,{baseLines:C(x,l.keys()),otherLines:C(S,d.keys())});for(let e of b.files.onlyBase)e.lines=x.get(e.basePath??e.path)??0;for(let e of b.files.onlyOther)e.lines=S.get(e.path)??0;for(let e of b.files.changed)Object.assign(e,{baseLines:x.get(e.basePath??e.path)??0,otherLines:S.get(e.path)??0});let w=new Set([...b.files.onlyOther,...b.files.changed.filter(e=>e.modified!==!1)].map(e=>e.path));b.resolutions=We(u(r,a),u(i,o),new Map(b.files.changed.filter(e=>e.renamedFrom!=null).map(e=>[e.basePath,e.path])),b.files.basePaths,b.files.root,e=>d.has(e)&&!w.has(e));let T=e=>v(``,{packageDir:e}),E=g(r,a?l.keys():null,T),D=g(i,o?d.keys():null,T);return b.versionUpdates=p(E,D),b.packageRows=f(b.packages,E,D),b.scope=n??``,b}export{et as prepareComparison};
package/out/compare.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as e,b as t,f as n,g as r,j as i,k as a,l as o}from"./chunk-OBNHCORJ.js";import{k as s}from"./chunk-7GJNLCXF.js";import"./chunk-PXK7EU4V.js";import"./chunk-R3NZFXVR.js";import{$a as c,$d as l,Ad as u,Bd as d,Cd as f,Dd as p,Ed as m,Fd as h,Gd as g,Ie as _,Je as v,Ld as y,Ma as b,Md as x,Na as S,Nd as C,Oa as w,Od as ee,Pa as te,Qa as ne,Ra as T,Rd as re,Sa as ie,Sc as ae,Sd as oe,Ta as se,Tc as ce,Td as le,Uc as E,Ud as ue,Vc as de,Wc as fe,Xc as pe,Za as me,_a as he,ab as ge,ae as _e,bb as ve,be as ye,cd as be,ce as xe,de as Se,ee as Ce,fe as we,gd as Te,ge as Ee,hd as De,he as Oe,id as ke,ie as Ae,ja as je,jd as Me,je as Ne,kd as Pe,ke as Fe,ld as Ie,md as Le,me as Re,nd as ze,od as Be,pd as Ve,qd as He,rd as Ue,td as We,uc as Ge,ud as Ke,va as qe,vc as Je,vd as Ye,w as D,wc as Xe,wd as Ze,xd as Qe,yd as $e,yf as et,zd as tt,zf as nt}from"./chunk-BZP3CT2V.js";import"./chunk-JCIIBLKR.js";import"./chunk-E3LFSUDJ.js";import"./chunk-JMG5DXII.js";import"./chunk-J2FWBXFV.js";import{$ as rt,_ as O,aa as it,ba as at,ea as ot,qa as st,s as ct,ta as lt}from"./chunk-DCBXCBLL.js";import{b as ut,c as dt,k,l as A}from"./chunk-65PLAG3I.js";import"./chunk-NRPC74AM.js";import"./chunk-7BKKYVWR.js";import"./chunk-7C7DWL7I.js";import"./chunk-PNHBZGDD.js";import"./chunk-VFWMQ3LG.js";import{I as j,J as ft,a as M,za as pt}from"./chunk-F3UI65ZI.js";import"./chunk-IZ6MYRYB.js";import"./chunk-WCPJDAYA.js";import{e as mt}from"./chunk-IYPY47MC.js";import{a as N,d as P}from"./chunk-PWFUOLZK.js";import{i as ht,m as gt}from"./chunk-PTFQKLKO.js";import{a as _t}from"./chunk-QRKFPLA4.js";import{D as vt,d as yt}from"./chunk-74AEKRES.js";import"./chunk-C4Z6ZBXV.js";import{c as F,g as I,j as bt}from"./chunk-2XUEZHIP.js";import{b as xt}from"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";function St(e){return e===0?`±0`:`${e>0?`+`:`−`}${Math.abs(e).toLocaleString()}`}function Ct(e){return e===0?`±0 B`:`${e>0?`+`:`−`}${j(Math.abs(e))}`}function wt(e){return e>0?`up`:e<0?`down`:``}function Tt({onlyBase:e,onlyOther:t,changed:n}){return[[`removed`,`−`,e],[`added`,`+`,t],[`repointed`,``,n]].filter(([,,e])=>e.length>0).map(([e,t,n])=>F`<span class="${`bundle-compare-chip ${e===`repointed`?`changed`:e}`}">${t}${n.length.toLocaleString()} ${e} ${n.length===1?`resolution`:`resolutions`}</span>`)}function Et(e,t){if(!t)return``;let n=e/t*100;return`${n>0?`+`:n<0?`−`:`±`}${Math.abs(n).toFixed(1)}%`}function Dt(e){let t=e.totals,n=e.versionUpdates?.totals??{baseDeps:0,otherDeps:0},r=n.baseDeps>0||n.otherDeps>0,i=n.otherDeps-n.baseDeps,a=Et(t.byteDelta,t.baseBytes);return F`<div class="bundle-compare-stats">${r?F`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Deps</span> <span class="bundle-compare-metric-value">${n.baseDeps.toLocaleString()} → ${n.otherDeps.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${wt(i)}`}">${St(i)}</span></div>`:I}<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Size</span> <span class="bundle-compare-metric-value">${j(t.baseBytes)} → ${j(t.otherBytes)}</span> <span class="${`bundle-compare-metric-delta ${wt(t.byteDelta)}`}">${Ct(t.byteDelta)}${a?F`${` `}<span class="bundle-compare-pct">(${a})</span>`:I}</span></div>${t.baseLines>0||t.otherLines>0?F`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">LoC</span> <span class="bundle-compare-metric-value">${t.baseLines.toLocaleString()} → ${t.otherLines.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${wt(t.otherLines-t.baseLines)}`}">${St(t.otherLines-t.baseLines)}</span></div>`:I}<div class="bundle-compare-files"><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Files</span> <span class="bundle-compare-metric-value">${t.baseFiles.toLocaleString()} → ${t.otherFiles.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${wt(t.fileDelta)}`}">${St(t.fileDelta)}</span></div><div class="bundle-compare-chips">${t.onlyBaseFiles>0?F`<span class="bundle-compare-chip removed">−${t.onlyBaseFiles.toLocaleString()} removed</span>`:I} ${t.onlyOtherFiles>0?F`<span class="bundle-compare-chip added">+${t.onlyOtherFiles.toLocaleString()} added</span>`:I} ${t.changedFiles>0?F`<span class="bundle-compare-chip changed">${t.changedFiles.toLocaleString()} changed${t.renamedFiles>0?` (${t.renamedFiles.toLocaleString()} renamed)`:``}</span>`:I} <span class="bundle-compare-chip unchanged">${t.unchangedFiles.toLocaleString()} unchanged</span> ${e.resolutions?Tt(e.resolutions):I}</div></div></div>`}var Ot=24;function L(e,t=e=>e.id){return e.map(e=>({id:t(e),integrity:t(e),kind:e.format,format:e.format,detail:e.detail,...e.date&&{date:e.date},...e.dateWarning&&{dateWarning:e.dateWarning},filename:e.name,displayLabel:e.displayLabel,size:`—`,summary:null}))}function kt(e){if(!e)return I;let t=({name:e=``,detail:t=``}={})=>e.length+Math.min(t.length,Ot)*.87+1,n=(e.choices??[]).reduce((e,n)=>Math.max(e,t(n)),Math.max(`Choose a ${e.noun??`bundle`}\u2026`.length,t(e.widest)));return N({"--compare-select-chars":`${Math.ceil(n)}`})}function At({source:e,label:t=`Compare`,from:n,to:r,clear:i,swap:a,extras:o=I,comparison:s=null,disabled:c=!1,openLine:l}){let u=e?.noun??`bundle`,d=`${u[0].toUpperCase()}${u.slice(1)}`,f=(t,n)=>e?.select?e.select(t,t.label??n):F`<bundle-selector .bundles="${t.options}" .value="${t.value}" .noun="${u}" .versions="${!!e}" label="${t.label??n}" placeholder="${t.placeholder??`Choose a ${u}\u2026`}" ?disabled="${c}" @bundle-change="${e=>{e.stopPropagation(),t.pick(e.detail.value)}}"></bundle-selector>`;return F`<div class="${e?`bundle-compare-picker is-versions`:`bundle-compare-picker`}" style="${kt(e)}" @compare-open-line="${e=>l?.(e.detail)}"><div class="bundle-compare-select-wrap"><span class="bundle-compare-select-hint">${t}</span> ${f(n,`${d} to compare with`)} ${i?F`<button type="button" class="bundle-compare-clear" aria-label="${i.label??`Clear comparison`}" ?disabled="${c}" @click="${i.run}">×</button>`:I}</div><span class="bundle-compare-arrow" aria-hidden="true">→</span><div class="bundle-compare-select-wrap">${f(r,`${d} to compare`)} ${a?F`<button type="button" class="bundle-compare-swap" ?disabled="${c}" @click="${a}" aria-label="${`Swap the two ${u}s`}"><span class="bundle-compare-swap-icon" aria-hidden="true">↔</span>Swap</button>`:I}</div>${o}${s?e?.badges?.(s.base,s.other,s.files)??I:I}</div>`}function jt(e,t=I){return F`<div class="bundle-compare-summary">${Dt(e)}${t}</div>`}function Mt(e,t=I){return F`<header class="bundle-compare-head">${e}${t}</header>`}var Nt=4,Pt=5e3,Ft=3e5,It=e=>!(e>=400&&e<500&&e!==429),Lt=e=>e?.integrity===`(empty)`,R=new Map;function Rt(){for(let[e,t]of R){if(R.size<=Nt)break;t.state.status!==`loading`&&R.delete(e)}}function zt(e){e.notify?.();for(let t of e.waiting.splice(0))t()}var Bt=null,Vt=(e,t)=>!!(e.managedId&&t.managedId)||!(!t.npm&&!t.npmPatch||!e.npm&&!Lt(e));function Ht(e,t,n){if(e.managedId&&t.managedId)return ie(e.managedId,t.managedId,{scope:n});if(Vt(e,t)){let{name:n,version:r,patch:i}=t.npm??t.npmPatch;return se(n,r,e.npm?.version??`(empty)`,{otherName:e.npm?.name??n,...i?{patch:i}:{}})}return import(`./chunk-EQ5EQXV5.js`).then(r=>(Bt=r,r.prepareComparison(e,t,n)))}async function Ut(e,t,n,r,i){let a;try{a={status:`ready`,diff:await Ht(n,r,i)}}catch(n){if(n?.name===`AbortError`){R.get(e)===t&&R.delete(e),zt(t);return}if(a={status:`error`,message:n?.message??String(n)},It(n?.status)){let e=Math.min(Pt*2**t.failures,Ft);Object.assign(t,{retryAt:Date.now()+e,failures:t.failures+1}),setTimeout(()=>{t.notify?.()},e)?.unref?.()}}a.status===`ready`&&(t.failures=0),t.state=a,zt(t),Rt()}var Wt=new WeakMap,Gt=0,Kt=e=>(Wt.has(e)||Wt.set(e,++Gt),Wt.get(e));function qt(e,t,n,r=!1){let i=Vt(e,t)?`${e.integrity}\0${t.integrity}\0${n??``}`:`${Kt(e)}\0${Kt(t)}\0${n??``}\0here`,a=R.get(i);return R.delete(i),(!a||r&&a.state.status===`error`||a.retryAt!==void 0&&Date.now()>=a.retryAt)&&(a={state:{status:`loading`},notify:a?.notify??null,waiting:[],failures:a?.failures??0},Bt&&!Vt(e,t)?a.state={status:`ready`,diff:Bt.prepareComparison(e,t,n??``)}:Ut(i,a,e,t,n??``)),R.set(i,a),Rt(),a}function Jt(e,t,n,r){let i=qt(e,t,n);return i.notify=r,i.state}function Yt(e,t,n=null){return new Promise((r,i)=>{let a=(o=!1)=>{let s=qt(e,t,n,o),{state:c}=s;c.status===`loading`?s.waiting.push(()=>a()):c.status===`ready`?r(c.diff):i(Error(c.message))};a(!0)})}function Xt(e,t){let{head:n,from:i,to:a,tail:o}=r(e,t);return F`${n}{<span class="bundle-compare-rename-from">${i}</span> → <span class="bundle-compare-rename-to">${a}</span>}${o}`}function Zt({from:e,to:t}){return F`<span class="bundle-compare-rename-from">${e}</span> → <span class="bundle-compare-rename-to">${t}</span>`}function Qt(e){let t=new Map;if(!e)return t;for(let n of e.onlyBase)t.set(n.path,{kind:`removed`,basePath:n.basePath,baseBytes:n.bytes,otherBytes:null});for(let n of e.onlyOther)t.set(n.path,{kind:`added`,baseBytes:null,otherBytes:n.bytes});for(let n of e.changed){let e={...n.meta?{meta:n.meta}:{}};t.set(n.path,n.renamedFrom==null?{kind:`changed`,basePath:n.basePath,baseBytes:n.baseBytes,otherBytes:n.otherBytes,...n.modified===!1?{modified:!1}:{},...e}:{kind:`renamed`,basePath:n.basePath,renamedFrom:n.renamedFrom,modified:n.modified,baseBytes:n.baseBytes,otherBytes:n.otherBytes,...e})}return t}function z(e,t,n,{kind:r,basePath:i=n}){let a=r===`added`?``:k(e).get(i),o=r===`removed`?``:k(t).get(n);return r===`repointed`&&(a=o??=a),{before:a,after:o}}var $t=new WeakMap,en=Object.freeze([]);function tn(e){if(!e)return en;let t=$t.get(e);return t||$t.set(e,t=[...e.onlyBase,...e.onlyOther,...e.changed]),t}function nn(e){return e.baseTarget===null?`added`:e.otherTarget===null?`removed`:`repointed`}function rn(e,t,n,r=[]){let i=Qt(n);if(!n)return i;for(let n of r){if(!i.has(n.parent)){let r=A(k(t).get(n.parent)??k(e).get(n.parent));i.set(n.parent,{kind:`repointed`,baseBytes:r,otherBytes:r})}let r=i.get(n.parent);r.repointed=[...r.repointed??[],n]}return i}function an(e,t,n){return[...rn(e,t,n.files,tn(n.resolutions))].map(([n,r])=>({path:n,...r,...z(e,t,n,r)}))}function on(e,{maxBytes:t,maxLines:n}){let r=0,i=0;for(let{before:a,after:o}of e)for(let e of[a,o])if(r+=A(e)??0,r>=t||(typeof e==`string`&&e!==``&&(i+=(e.match(/\n/gu)?.length??0)+ +!e.endsWith(`
1
+ import{a as e,b as t,f as n,g as r,j as i,k as a,l as o}from"./chunk-24AKGEH3.js";import{k as s}from"./chunk-7GJNLCXF.js";import"./chunk-PXK7EU4V.js";import"./chunk-R3NZFXVR.js";import{$a as c,$d as l,Ad as u,Bd as d,Cd as f,Dd as p,Ed as m,Fd as h,Gd as g,Ie as _,Je as v,Ld as y,Ma as b,Md as x,Na as S,Nd as C,Oa as w,Od as ee,Pa as te,Qa as ne,Ra as T,Rd as re,Sa as ie,Sc as ae,Sd as oe,Ta as se,Tc as ce,Td as le,Uc as E,Ud as ue,Vc as de,Wc as fe,Xc as pe,Za as me,_a as he,ab as ge,ae as _e,bb as ve,be as ye,cd as be,ce as xe,de as Se,ee as Ce,fe as we,gd as Te,ge as Ee,hd as De,he as Oe,id as ke,ie as Ae,ja as je,jd as Me,je as Ne,kd as Pe,ke as Fe,ld as Ie,md as Le,me as Re,nd as ze,od as Be,pd as Ve,qd as He,rd as Ue,td as We,uc as Ge,ud as Ke,va as qe,vc as Je,vd as Ye,w as D,wc as Xe,wd as Ze,xd as Qe,yd as $e,yf as et,zd as tt,zf as nt}from"./chunk-BZP3CT2V.js";import"./chunk-JCIIBLKR.js";import"./chunk-E3LFSUDJ.js";import"./chunk-JMG5DXII.js";import"./chunk-J2FWBXFV.js";import{$ as rt,_ as O,aa as it,ba as at,ea as ot,qa as st,s as ct,ta as lt}from"./chunk-DCBXCBLL.js";import{b as ut,c as dt,k,l as A}from"./chunk-65PLAG3I.js";import"./chunk-NRPC74AM.js";import"./chunk-7BKKYVWR.js";import"./chunk-7C7DWL7I.js";import"./chunk-PNHBZGDD.js";import"./chunk-VFWMQ3LG.js";import{I as j,J as ft,a as M,za as pt}from"./chunk-F3UI65ZI.js";import"./chunk-IZ6MYRYB.js";import"./chunk-WCPJDAYA.js";import{e as mt}from"./chunk-IYPY47MC.js";import{a as N,d as P}from"./chunk-PWFUOLZK.js";import{i as ht,m as gt}from"./chunk-PTFQKLKO.js";import{a as _t}from"./chunk-QRKFPLA4.js";import{D as vt,d as yt}from"./chunk-74AEKRES.js";import"./chunk-C4Z6ZBXV.js";import{c as F,g as I,j as bt}from"./chunk-2XUEZHIP.js";import{b as xt}from"./chunk-TUII34K2.js";import"./chunk-OOJM4CTU.js";function St(e){return e===0?`±0`:`${e>0?`+`:`−`}${Math.abs(e).toLocaleString()}`}function Ct(e){return e===0?`±0 B`:`${e>0?`+`:`−`}${j(Math.abs(e))}`}function wt(e){return e>0?`up`:e<0?`down`:``}function Tt({onlyBase:e,onlyOther:t,changed:n}){return[[`removed`,`−`,e],[`added`,`+`,t],[`repointed`,``,n]].filter(([,,e])=>e.length>0).map(([e,t,n])=>F`<span class="${`bundle-compare-chip ${e===`repointed`?`changed`:e}`}">${t}${n.length.toLocaleString()} ${e} ${n.length===1?`resolution`:`resolutions`}</span>`)}function Et(e,t){if(!t)return``;let n=e/t*100;return`${n>0?`+`:n<0?`−`:`±`}${Math.abs(n).toFixed(1)}%`}function Dt(e){let t=e.totals,n=e.versionUpdates?.totals??{baseDeps:0,otherDeps:0},r=n.baseDeps>0||n.otherDeps>0,i=n.otherDeps-n.baseDeps,a=Et(t.byteDelta,t.baseBytes);return F`<div class="bundle-compare-stats">${r?F`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Deps</span> <span class="bundle-compare-metric-value">${n.baseDeps.toLocaleString()} → ${n.otherDeps.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${wt(i)}`}">${St(i)}</span></div>`:I}<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Size</span> <span class="bundle-compare-metric-value">${j(t.baseBytes)} → ${j(t.otherBytes)}</span> <span class="${`bundle-compare-metric-delta ${wt(t.byteDelta)}`}">${Ct(t.byteDelta)}${a?F`${` `}<span class="bundle-compare-pct">(${a})</span>`:I}</span></div>${t.baseLines>0||t.otherLines>0?F`<div class="bundle-compare-metric"><span class="bundle-compare-metric-label">LoC</span> <span class="bundle-compare-metric-value">${t.baseLines.toLocaleString()} → ${t.otherLines.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${wt(t.otherLines-t.baseLines)}`}">${St(t.otherLines-t.baseLines)}</span></div>`:I}<div class="bundle-compare-files"><div class="bundle-compare-metric"><span class="bundle-compare-metric-label">Files</span> <span class="bundle-compare-metric-value">${t.baseFiles.toLocaleString()} → ${t.otherFiles.toLocaleString()}</span> <span class="${`bundle-compare-metric-delta ${wt(t.fileDelta)}`}">${St(t.fileDelta)}</span></div><div class="bundle-compare-chips">${t.onlyBaseFiles>0?F`<span class="bundle-compare-chip removed">−${t.onlyBaseFiles.toLocaleString()} removed</span>`:I} ${t.onlyOtherFiles>0?F`<span class="bundle-compare-chip added">+${t.onlyOtherFiles.toLocaleString()} added</span>`:I} ${t.changedFiles>0?F`<span class="bundle-compare-chip changed">${t.changedFiles.toLocaleString()} changed${t.renamedFiles>0?` (${t.renamedFiles.toLocaleString()} renamed)`:``}</span>`:I} <span class="bundle-compare-chip unchanged">${t.unchangedFiles.toLocaleString()} unchanged</span> ${e.resolutions?Tt(e.resolutions):I}</div></div></div>`}var Ot=24;function L(e,t=e=>e.id){return e.map(e=>({id:t(e),integrity:t(e),kind:e.format,format:e.format,detail:e.detail,...e.date&&{date:e.date},...e.dateWarning&&{dateWarning:e.dateWarning},filename:e.name,displayLabel:e.displayLabel,size:`—`,summary:null}))}function kt(e){if(!e)return I;let t=({name:e=``,detail:t=``}={})=>e.length+Math.min(t.length,Ot)*.87+1,n=(e.choices??[]).reduce((e,n)=>Math.max(e,t(n)),Math.max(`Choose a ${e.noun??`bundle`}\u2026`.length,t(e.widest)));return N({"--compare-select-chars":`${Math.ceil(n)}`})}function At({source:e,label:t=`Compare`,from:n,to:r,clear:i,swap:a,extras:o=I,comparison:s=null,disabled:c=!1,openLine:l}){let u=e?.noun??`bundle`,d=`${u[0].toUpperCase()}${u.slice(1)}`,f=(t,n)=>e?.select?e.select(t,t.label??n):F`<bundle-selector .bundles="${t.options}" .value="${t.value}" .noun="${u}" .versions="${!!e}" label="${t.label??n}" placeholder="${t.placeholder??`Choose a ${u}\u2026`}" ?disabled="${c}" @bundle-change="${e=>{e.stopPropagation(),t.pick(e.detail.value)}}"></bundle-selector>`;return F`<div class="${e?`bundle-compare-picker is-versions`:`bundle-compare-picker`}" style="${kt(e)}" @compare-open-line="${e=>l?.(e.detail)}"><div class="bundle-compare-select-wrap"><span class="bundle-compare-select-hint">${t}</span> ${f(n,`${d} to compare with`)} ${i?F`<button type="button" class="bundle-compare-clear" aria-label="${i.label??`Clear comparison`}" ?disabled="${c}" @click="${i.run}">×</button>`:I}</div><span class="bundle-compare-arrow" aria-hidden="true">→</span><div class="bundle-compare-select-wrap">${f(r,`${d} to compare`)} ${a?F`<button type="button" class="bundle-compare-swap" ?disabled="${c}" @click="${a}" aria-label="${`Swap the two ${u}s`}"><span class="bundle-compare-swap-icon" aria-hidden="true">↔</span>Swap</button>`:I}</div>${o}${s?e?.badges?.(s.base,s.other,s.files)??I:I}</div>`}function jt(e,t=I){return F`<div class="bundle-compare-summary">${Dt(e)}${t}</div>`}function Mt(e,t=I){return F`<header class="bundle-compare-head">${e}${t}</header>`}var Nt=4,Pt=5e3,Ft=3e5,It=e=>!(e>=400&&e<500&&e!==429),Lt=e=>e?.integrity===`(empty)`,R=new Map;function Rt(){for(let[e,t]of R){if(R.size<=Nt)break;t.state.status!==`loading`&&R.delete(e)}}function zt(e){e.notify?.();for(let t of e.waiting.splice(0))t()}var Bt=null,Vt=(e,t)=>!!(e.managedId&&t.managedId)||!(!t.npm&&!t.npmPatch||!e.npm&&!Lt(e));function Ht(e,t,n){if(e.managedId&&t.managedId)return ie(e.managedId,t.managedId,{scope:n});if(Vt(e,t)){let{name:n,version:r,patch:i}=t.npm??t.npmPatch;return se(n,r,e.npm?.version??`(empty)`,{otherName:e.npm?.name??n,...i?{patch:i}:{}})}return import(`./chunk-WL3SPQB4.js`).then(r=>(Bt=r,r.prepareComparison(e,t,n)))}async function Ut(e,t,n,r,i){let a;try{a={status:`ready`,diff:await Ht(n,r,i)}}catch(n){if(n?.name===`AbortError`){R.get(e)===t&&R.delete(e),zt(t);return}if(a={status:`error`,message:n?.message??String(n)},It(n?.status)){let e=Math.min(Pt*2**t.failures,Ft);Object.assign(t,{retryAt:Date.now()+e,failures:t.failures+1}),setTimeout(()=>{t.notify?.()},e)?.unref?.()}}a.status===`ready`&&(t.failures=0),t.state=a,zt(t),Rt()}var Wt=new WeakMap,Gt=0,Kt=e=>(Wt.has(e)||Wt.set(e,++Gt),Wt.get(e));function qt(e,t,n,r=!1){let i=Vt(e,t)?`${e.integrity}\0${t.integrity}\0${n??``}`:`${Kt(e)}\0${Kt(t)}\0${n??``}\0here`,a=R.get(i);return R.delete(i),(!a||r&&a.state.status===`error`||a.retryAt!==void 0&&Date.now()>=a.retryAt)&&(a={state:{status:`loading`},notify:a?.notify??null,waiting:[],failures:a?.failures??0},Bt&&!Vt(e,t)?a.state={status:`ready`,diff:Bt.prepareComparison(e,t,n??``)}:Ut(i,a,e,t,n??``)),R.set(i,a),Rt(),a}function Jt(e,t,n,r){let i=qt(e,t,n);return i.notify=r,i.state}function Yt(e,t,n=null){return new Promise((r,i)=>{let a=(o=!1)=>{let s=qt(e,t,n,o),{state:c}=s;c.status===`loading`?s.waiting.push(()=>a()):c.status===`ready`?r(c.diff):i(Error(c.message))};a(!0)})}function Xt(e,t){let{head:n,from:i,to:a,tail:o}=r(e,t);return F`${n}{<span class="bundle-compare-rename-from">${i}</span> → <span class="bundle-compare-rename-to">${a}</span>}${o}`}function Zt({from:e,to:t}){return F`<span class="bundle-compare-rename-from">${e}</span> → <span class="bundle-compare-rename-to">${t}</span>`}function Qt(e){let t=new Map;if(!e)return t;for(let n of e.onlyBase)t.set(n.path,{kind:`removed`,basePath:n.basePath,baseBytes:n.bytes,otherBytes:null});for(let n of e.onlyOther)t.set(n.path,{kind:`added`,baseBytes:null,otherBytes:n.bytes});for(let n of e.changed){let e={...n.meta?{meta:n.meta}:{}};t.set(n.path,n.renamedFrom==null?{kind:`changed`,basePath:n.basePath,baseBytes:n.baseBytes,otherBytes:n.otherBytes,...n.modified===!1?{modified:!1}:{},...e}:{kind:`renamed`,basePath:n.basePath,renamedFrom:n.renamedFrom,modified:n.modified,baseBytes:n.baseBytes,otherBytes:n.otherBytes,...e})}return t}function z(e,t,n,{kind:r,basePath:i=n}){let a=r===`added`?``:k(e).get(i),o=r===`removed`?``:k(t).get(n);return r===`repointed`&&(a=o??=a),{before:a,after:o}}var $t=new WeakMap,en=Object.freeze([]);function tn(e){if(!e)return en;let t=$t.get(e);return t||$t.set(e,t=[...e.onlyBase,...e.onlyOther,...e.changed]),t}function nn(e){return e.baseTarget===null?`added`:e.otherTarget===null?`removed`:`repointed`}function rn(e,t,n,r=[]){let i=Qt(n);if(!n)return i;for(let n of r){if(!i.has(n.parent)){let r=A(k(t).get(n.parent)??k(e).get(n.parent));i.set(n.parent,{kind:`repointed`,baseBytes:r,otherBytes:r})}let r=i.get(n.parent);r.repointed=[...r.repointed??[],n]}return i}function an(e,t,n){return[...rn(e,t,n.files,tn(n.resolutions))].map(([n,r])=>({path:n,...r,...z(e,t,n,r)}))}function on(e,{maxBytes:t,maxLines:n}){let r=0,i=0;for(let{before:a,after:o}of e)for(let e of[a,o])if(r+=A(e)??0,r>=t||(typeof e==`string`&&e!==``&&(i+=(e.match(/\n/gu)?.length??0)+ +!e.endsWith(`
2
2
  `)),i>=n))return!1;return!0}function B(e){if(e===``)return[];let t=e.split(`
3
3
  `);return t.at(-1)===``&&t.pop(),t}var sn=e=>e===``||e.endsWith(`
4
4
  `),cn=e=>e.replace(/[ \t\n\v\f\r]+$/u,``).replaceAll(/[ \t\n\v\f\r]+/gu,` `);function V(e,t,n=!1){return s(e,t,{horizon:0,whitespace:n?`change`:`none`}).map(({a0:e,a1:t,b0:n,b1:r})=>({a0:e,a1:t,b0:n,b1:r}))}function ln(e,t,n,r=!1){if(!Array.isArray(n))return!1;let i=B(e),a=B(t),o=r?(e,t)=>cn(e)===cn(t):(e,t)=>e===t,s=0,c=0;for(let l of[...n,{a0:i.length,a1:i.length,b0:a.length,b1:a.length,last:!0}]){let{a0:n,a1:u,b0:d,b1:f}=l??{};if(![n,u,d,f].every(Number.isInteger)||n<s||d<c||u<n||f<d||u>i.length||f>a.length||!l.last&&u===n&&f===d||n-s!==d-c||l.last&&n>s&&!r&&sn(e)!==sn(t))return!1;for(;s<n;s++,c++)if(!o(i[s],a[c]))return!1;s=u,c=f}return!0}var un=3,H=20,dn=4;function fn(e,t,{ignoreWhitespace:n=!1,changes:r=null,marks:i=null}={}){let a=B(e),o=B(t),s=r?.blocks??V(e,t,n),c={a:e!==``&&!e.endsWith(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preventive/triage",
3
- "version": "1.0.0-alpha.62",
3
+ "version": "1.0.0-alpha.63",
4
4
  "description": "Client & relay server for triaging of automated reports",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "author": {
@@ -430,7 +430,7 @@
430
430
  "@exodus/stasis": "1.0.0-rc.4",
431
431
  "@exodus/stasis-core": "1.0.0-rc.4",
432
432
  "@preventive/archive": "^1.4.1",
433
- "@preventive/compare": "^1.2.12",
433
+ "@preventive/compare": "^1.2.13",
434
434
  "@preventive/diff": "^1.1.1",
435
435
  "@preventive/lockfile": "^1.3.0",
436
436
  "@preventive/publishers": "^1.1.0",
File without changes