@visulima/cerebro 1.1.31 → 1.1.32

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,374 @@
1
- var yt=Object.defineProperty;var M=(t,r)=>yt(t,"name",{value:r,configurable:!0});import{existsSync as se,readFileSync as bt,mkdirSync as wt,writeFileSync as jt}from"node:fs";import{findCacheDirSync as At}from"@visulima/find-cache-dir";import{get as Ot}from"node:https";var Mt=Object.defineProperty,zt=M((t,r)=>Mt(t,"name",{value:r,configurable:!0}),"o$1");const Pt=zt((t,r)=>{const a=t.split(".").map(Number),l=r.split(".").map(Number);for(const[f,h]of a.entries()){if(h>l[f])return!0;if(h<l[f])return!1}return!1},"semverGt");var _t=Object.defineProperty,St=M((t,r)=>_t(t,"name",{value:r,configurable:!0}),"le"),Ct=Object.defineProperty,L=St((t,r)=>Ct(t,"name",{value:r,configurable:!0}),"Z"),kt=Object.defineProperty,Et=L((t,r)=>kt(t,"name",{value:r,configurable:!0}),"t");const Nt=/^[A-Z]:\//i,O=Et((t="")=>t&&t.replaceAll("\\","/").replace(Nt,r=>r.toUpperCase()),"normalizeWindowsPath");var Zt=Object.defineProperty,u=L((t,r)=>Zt(t,"name",{value:r,configurable:!0}),"u$1");let ae=u(()=>{var t=(()=>{var r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,f=Object.prototype.hasOwnProperty,h=u((e,n)=>{for(var o in n)r(e,o,{get:n[o],enumerable:!0})},"q"),m=u((e,n,o,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of l(n))!f.call(e,s)&&s!==o&&r(e,s,{get:u(()=>n[s],"get"),enumerable:!(i=a(n,s))||i.enumerable});return e},"H"),g=u(e=>m(r({},"__esModule",{value:!0}),e),"J"),v={};h(v,{zeptomatch:u(()=>$t,"zeptomatch")});var R=u(e=>Array.isArray(e),"A"),P=u(e=>typeof e=="function","d"),de=u(e=>e.length===0,"Q"),he=u(e=>typeof e=="number","W"),ge=u(e=>typeof e=="object"&&e!==null,"K"),me=u(e=>e instanceof RegExp,"X"),W=u(e=>typeof e=="string","b"),A=u(e=>e===void 0,"h"),xe=u(e=>{const n=new Map;return o=>{const i=n.get(o);if(i)return i;const s=e(o);return n.set(o,s),s}},"Y"),$e=u((e,n,o={})=>{const i={cache:{},input:e,index:0,indexMax:0,options:o,output:[]};if(j(n)(i)&&i.index===e.length)return i.output;throw new Error(`Failed to parse at index ${i.indexMax}`)},"rr"),c=u((e,n)=>R(e)?ve(e,n):W(e)?be(e,n):ye(e,n),"i"),ve=u((e,n)=>{const o={};for(const i of e){if(i.length!==1)throw new Error(`Invalid character: "${i}"`);const s=i.charCodeAt(0);o[s]=!0}return i=>{const s=i.index,p=i.input;for(;i.index<p.length&&p.charCodeAt(i.index)in o;)i.index+=1;const d=i.index;if(d>s){if(!A(n)&&!i.options.silent){const $=i.input.slice(s,d),y=P(n)?n($,p,String(s)):n;A(y)||i.output.push(y)}i.indexMax=Math.max(i.indexMax,i.index)}return!0}},"er"),ye=u((e,n)=>{const o=e.source,i=e.flags.replace(/y|$/,"y"),s=new RegExp(o,i);return C(p=>{s.lastIndex=p.index;const d=s.exec(p.input);if(d){if(!A(n)&&!p.options.silent){const $=P(n)?n(...d,p.input,String(p.index)):n;A($)||p.output.push($)}return p.index+=d[0].length,p.indexMax=Math.max(p.indexMax,p.index),!0}else return!1})},"nr"),be=u((e,n)=>o=>{if(o.input.startsWith(e,o.index)){if(!A(n)&&!o.options.silent){const i=P(n)?n(e,o.input,String(o.index)):n;A(i)||o.output.push(i)}return o.index+=e.length,o.indexMax=Math.max(o.indexMax,o.index),!0}else return!1},"tr"),F=u((e,n,o,i)=>{const s=j(e);return C(k(J(p=>{let d=0;for(;d<o;){const $=p.index;if(!s(p)||(d+=1,p.index===$))break}return d>=n}),i))},"C"),we=u((e,n)=>F(e,0,1,n),"ar"),_=u((e,n)=>F(e,0,1/0,n),"f"),S=u((e,n)=>{const o=e.map(j);return C(k(J(i=>{for(let s=0,p=o.length;s<p;s++)if(!o[s](i))return!1;return!0}),n))},"x"),b=u((e,n)=>{const o=e.map(j);return C(k(i=>{for(let s=0,p=o.length;s<p;s++)if(o[s](i))return!0;return!1},n))},"l"),J=u((e,n=!1)=>{const o=j(e);return i=>{const s=i.index,p=i.output.length,d=o(i);return(!d||n)&&(i.index=s,i.output.length!==p&&(i.output.length=p)),d}},"M"),k=u((e,n)=>{const o=j(e);return n?i=>{if(i.options.silent)return o(i);const s=i.output.length;if(o(i)){const p=i.output.splice(s,1/0),d=n(p);return A(d)||i.output.push(d),!0}else return!1}:o},"_"),C=(()=>{let e=0;return n=>{const o=j(n),i=e+=1;return s=>{var p;if(s.options.memoization===!1)return o(s);const d=s.index,$=(p=s.cache)[i]||(p[i]=new Map),y=$.get(d);if(y===!1)return!1;if(he(y))return s.index=y,!0;if(y)return s.index=y.index,y.output?.length&&s.output.push(...y.output),!0;{const ne=s.output.length;if(o(s)){const re=s.index,oe=s.output.length;if(oe>ne){const vt=s.output.slice(ne,oe);$.set(d,{index:re,output:vt})}else $.set(d,re);return!0}else return $.set(d,!1),!1}}}})(),q=u(e=>{let n;return o=>(n||(n=j(e())),n(o))},"E"),j=xe(e=>{if(P(e))return de(e)?q(e):e;if(W(e)||me(e))return c(e);if(R(e))return S(e);if(ge(e))return b(Object.values(e));throw new Error("Invalid rule")}),G="abcdefghijklmnopqrstuvwxyz",je=u(e=>{let n="";for(;e>0;){const o=(e-1)%26;n=G[o]+n,e=Math.floor((e-1)/26)}return n},"ir"),T=u(e=>{let n=0;for(let o=0,i=e.length;o<i;o++)n=n*26+G.indexOf(e[o])+1;return n},"z"),E=u((e,n)=>{if(n<e)return E(n,e);const o=[];for(;e<=n;)o.push(e++);return o},"S"),Ae=u((e,n,o)=>E(e,n).map(i=>String(i).padStart(o,"0")),"or"),V=u((e,n)=>E(T(e),T(n)).map(je),"O"),w=u(e=>e,"p"),B=u(e=>Oe(n=>$e(n,e,{memoization:!1}).join("")),"R"),Oe=u(e=>{const n={};return o=>n[o]??(n[o]=e(o))},"ur"),Me=c(/^\*\*\/\*$/,".*"),ze=c(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/,(e,n,o)=>`.*${n?"":"(?:^|/)"}${o.replaceAll(".","\\.")}`),Pe=c(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/,(e,n,o,i)=>`.*${n?"":"(?:^|/)"}${o.replaceAll(".","\\.")}(?:${i.replaceAll(",","|").replaceAll(".","\\.")})`),N=c(/\\./,w),_e=c(/[$.*+?^(){}[\]\|]/,e=>`\\${e}`),Se=c(/./,w),Ce=c(/^(?:!!)*!(.*)$/,(e,n)=>`(?!^${te(n)}$).*?`),ke=c(/^(!!)+/,""),Ee=b([Ce,ke]),Ne=c(/\/(\*\*\/)+/,"(?:/.+/|/)"),Ze=c(/^(\*\*\/)+/,"(?:^|.*/)"),Ue=c(/\/(\*\*)$/,"(?:/.*|$)"),Ie=c(/\*\*/,".*"),H=b([Ne,Ze,Ue,Ie]),Le=c(/\*\/(?!\*\*\/)/,"[^/]*/"),De=c(/\*/,"[^/]*"),K=b([Le,De]),Q=c("?","[^/]"),Re=c("[",w),We=c("]",w),Fe=c(/[!^]/,"^/"),Je=c(/[a-z]-[a-z]|[0-9]-[0-9]/i,w),qe=c(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Ge=c(/[^\]]/,w),Te=b([N,qe,Je,Ge]),X=S([Re,we(Fe),_(Te),We]),Ve=c("{","(?:"),Be=c("}",")"),He=c(/(\d+)\.\.(\d+)/,(e,n,o)=>Ae(+n,+o,Math.min(n.length,o.length)).join("|")),Ke=c(/([a-z]+)\.\.([a-z]+)/,(e,n,o)=>V(n,o).join("|")),Qe=c(/([A-Z]+)\.\.([A-Z]+)/,(e,n,o)=>V(n.toLowerCase(),o.toLowerCase()).join("|").toUpperCase()),Xe=b([He,Ke,Qe]),Y=S([Ve,Xe,Be]),Ye=c("{","(?:"),et=c("}",")"),tt=c(",","|"),nt=c(/[$.*+?^(){[\]\|]/,e=>`\\${e}`),rt=c(/[^}]/,w),ot=q(()=>ee),at=b([H,K,Q,X,Y,ot,N,nt,tt,rt]),ee=S([Ye,_(at),et]),it=_(b([Me,ze,Pe,Ee,H,K,Q,X,Y,ee,N,_e,Se])),st=it,lt=B(st),te=lt,ut=c(/\\./,w),ct=c(/./,w),pt=c(/\*\*\*+/,"*"),ft=c(/([^/{[(!])\*\*/,(e,n)=>`${n}*`),dt=c(/(^|.)\*\*(?=[^*/)\]}])/,(e,n)=>`${n}*`),ht=_(b([ut,pt,ft,dt,ct])),gt=ht,mt=B(gt),xt=mt,Z=u((e,n)=>{const o=Array.isArray(e)?e:[e];if(!o.length)return!1;const i=o.map(Z.compile),s=o.every(d=>/(\/(?:\*\*)?|\[\/\])$/.test(d)),p=n.replace(/[\\\/]+/g,"/").replace(/\/$/,s?"/":"");return i.some(d=>d.test(p))},"$");Z.compile=e=>new RegExp(`^${te(xt(e))}$`,"s");var $t=Z;return g(v)})();return t.default||t},"_lazyMatch"),U;const Ut=u((t,r)=>(U||(U=ae(),ae=null),U(t,r)),"default");var It=Object.defineProperty,x=L((t,r)=>It(t,"name",{value:r,configurable:!0}),"r");const Lt=/^[/\\]{2}/,Dt=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,le=/^[A-Z]:$/i,ie=/^\/([A-Z]:)?$/i,Rt=/.(\.[^./]+)$/,Wt=/^[/\\]|^[a-z]:[/\\]/i,Ft=x(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),ue=x((t,r)=>{let a="",l=0,f=-1,h=0,m=null;for(let g=0;g<=t.length;++g){if(g<t.length)m=t[g];else{if(m==="/")break;m="/"}if(m==="/"){if(!(f===g-1||h===1))if(h===2){if(a.length<2||l!==2||!a.endsWith(".")||a.at(-2)!=="."){if(a.length>2){const v=a.lastIndexOf("/");v===-1?(a="",l=0):(a=a.slice(0,v),l=a.length-1-a.lastIndexOf("/")),f=g,h=0;continue}else if(a.length>0){a="",l=0,f=g,h=0;continue}}r&&(a+=a.length>0?"/..":"..",l=2)}else a.length>0?a+=`/${t.slice(f+1,g)}`:a=t.slice(f+1,g),l=g-f-1;f=g,h=0}else m==="."&&h!==-1?++h:h=-1}return a},"normalizeString"),z=x(t=>Dt.test(t),"isAbsolute"),ce=x(function(t){if(t.length===0)return".";t=O(t);const r=Lt.exec(t),a=z(t),l=t.at(-1)==="/";return t=ue(t,!a),t.length===0?a?"/":l?"./":".":(l&&(t+="/"),le.test(t)&&(t+="/"),r?a?`//${t}`:`//./${t}`:a&&!z(t)?`/${t}`:t)},"normalize"),Jt=x((...t)=>{let r="";for(const a of t)if(a)if(r.length>0){const l=r[r.length-1]==="/",f=a[0]==="/";l&&f?r+=a.slice(1):r+=l||f?a:`/${a}`}else r+=a;return ce(r)},"join"),I=x(function(...t){t=t.map(l=>O(l));let r="",a=!1;for(let l=t.length-1;l>=-1&&!a;l--){const f=l>=0?t[l]:Ft();!f||f.length===0||(r=`${f}/${r}`,a=z(f))}return r=ue(r,!a),a&&!z(r)?`/${r}`:r.length>0?r:"."},"resolve");x(function(t){return O(t)},"toNamespacedPath");const qt=x(function(t){return Rt.exec(O(t))?.[1]??""},"extname");x(function(t,r){const a=I(t).replace(ie,"$1").split("/"),l=I(r).replace(ie,"$1").split("/");if(l[0][1]===":"&&a[0][1]===":"&&a[0]!==l[0])return l.join("/");const f=[...a];for(const h of f){if(l[0]!==h)break;a.shift(),l.shift()}return[...a.map(()=>".."),...l].join("/")},"relative");const pe=x(t=>{const r=O(t).replace(/\/$/,"").split("/").slice(0,-1);return r.length===1&&le.test(r[0])&&(r[0]+="/"),r.join("/")||(z(t)?"/":".")},"dirname");x(function(t){const r=[t.root,t.dir,t.base??t.name+t.ext].filter(Boolean);return O(t.root?I(...r):r.join("/"))},"format");const Gt=x((t,r)=>{const a=O(t).split("/").pop();return r&&a.endsWith(r)?a.slice(0,-r.length):a},"basename");x(function(t){const r=Wt.exec(t)?.[0]?.replace(/\\/g,"/")??"",a=Gt(t),l=qt(a);return{base:a,dir:pe(t),ext:l,name:a.slice(0,a.length-l.length),root:r}},"parse");x((t,r)=>Ut(r,ce(t)),"matchesGlob");var Tt=Object.defineProperty,D=M((t,r)=>Tt(t,"name",{value:r,configurable:!0}),"r");const Vt="last-update-check.json",fe=D(t=>{const r=At(t);if(r===void 0)throw new Error("Could not find cache directory");return Jt(r,Vt)},"getConfigFile"),Bt=D(t=>{const r=fe(t);try{if(!se(r))return;const{lastUpdateCheck:a}=JSON.parse(bt(r,"utf8"));return a}catch{return}},"getLastUpdate"),Ht=D(t=>{const r=fe(t),a=pe(r);se(a)||wt(a,{recursive:!0}),jt(r,JSON.stringify({lastUpdateCheck:Date.now()}))},"saveLastUpdate");var Kt=Object.defineProperty,Qt=M((t,r)=>Kt(t,"name",{value:r,configurable:!0}),"g");const Xt=Qt(async(t,r,a)=>{const l=a.replace("__NAME__",t);return await new Promise((f,h)=>{Ot(l,m=>{let g="";m.on("data",v=>g+=v),m.on("end",()=>{try{const v=JSON.parse(g)[r];v||h(new Error("Error getting version")),f(v)}catch{h(new Error("Could not parse version response"))}})}).on("error",m=>h(m))})},"getDistributionVersion");var Yt=Object.defineProperty,en=M((t,r)=>Yt(t,"name",{value:r,configurable:!0}),"i");const an=en(async({alwaysRun:t,debug:r,distTag:a="latest",pkg:l,registryUrl:f="https://registry.npmjs.org/-/package/__NAME__/dist-tags",updateCheckInterval:h=1e3*60*60*24})=>{const m=Bt(l.name);if(t||!m||m<Date.now()-h){const g=await Xt(l.name,a,f);if(Ht(l.name),Pt(g,l.version))return g;r&&console.error(`Latest version (${g}) not newer than current version (${l.version})`)}else r&&console.error(`Too recent to check for a new update. simpleUpdateNotifier() interval set to ${h}ms but only ${Date.now()-m}ms since last check.`);return null},"hasNewVersion");export{an as default};
1
+ import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
2
+ import { findCacheDirSync } from '@visulima/find-cache-dir';
3
+ import { get } from 'node:https';
4
+
5
+ var __defProp$4 = Object.defineProperty;
6
+ var __name$4 = (target, value) => __defProp$4(target, "name", { value, configurable: true });
7
+ const semverGt = /* @__PURE__ */ __name$4((version1, version2) => {
8
+ const v1Components = version1.split(".").map(Number);
9
+ const v2Components = version2.split(".").map(Number);
10
+ for (const [index, v1Component] of v1Components.entries()) {
11
+ if (v1Component > v2Components[index]) {
12
+ return true;
13
+ }
14
+ if (v1Component < v2Components[index]) {
15
+ return false;
16
+ }
17
+ }
18
+ return false;
19
+ }, "semverGt");
20
+
21
+ var __defProp$3 = Object.defineProperty;
22
+ var __name$3 = (target, value) => __defProp$3(target, "name", { value, configurable: true });
23
+ var $t = Object.defineProperty;
24
+ var Z = /* @__PURE__ */ __name$3((r, i) => $t(r, "name", { value: i, configurable: true }), "Z");
25
+ var bt = Object.defineProperty;
26
+ var vt = Z((r, i) => bt(r, "name", { value: i, configurable: true }), "t");
27
+ const yt = /^[A-Z]:\//i;
28
+ const w = vt((r = "") => r && r.replaceAll("\\", "/").replace(yt, (i) => i.toUpperCase()), "normalizeWindowsPath");
29
+ var At = Object.defineProperty;
30
+ var s = Z((r, i) => At(r, "name", { value: i, configurable: true }), "u$1");
31
+ let ie = s(() => {
32
+ var r = (() => {
33
+ var i = Object.defineProperty, a = Object.getOwnPropertyDescriptor, p = Object.getOwnPropertyNames, h = Object.prototype.hasOwnProperty, x = s((e, t) => {
34
+ for (var n in t) i(e, n, { get: t[n], enumerable: true });
35
+ }, "q"), A = s((e, t, n, o) => {
36
+ if (t && typeof t == "object" || typeof t == "function") for (let l of p(t)) !h.call(e, l) && l !== n && i(e, l, { get: s(() => t[l], "get"), enumerable: !(o = a(t, l)) || o.enumerable });
37
+ return e;
38
+ }, "H"), g = s((e) => A(i({}, "__esModule", { value: true }), e), "J"), M = {};
39
+ x(M, { zeptomatch: s(() => xt, "zeptomatch") });
40
+ var G = s((e) => Array.isArray(e), "A"), O = s((e) => typeof e == "function", "d"), pe = s((e) => e.length === 0, "Q"), fe = s((e) => typeof e == "number", "W"), he = s((e) => typeof e == "object" && e !== null, "K"), de = s((e) => e instanceof RegExp, "X"), L = s((e) => typeof e == "string", "b"), j = s((e) => e === undefined, "h"), ge = s((e) => {
41
+ const t = /* @__PURE__ */ new Map();
42
+ return (n) => {
43
+ const o = t.get(n);
44
+ if (o) return o;
45
+ const l = e(n);
46
+ return t.set(n, l), l;
47
+ };
48
+ }, "Y"), xe = s((e, t, n = {}) => {
49
+ const o = { cache: {}, input: e, index: 0, indexMax: 0, options: n, output: [] };
50
+ if (y(t)(o) && o.index === e.length) return o.output;
51
+ throw new Error(`Failed to parse at index ${o.indexMax}`);
52
+ }, "rr"), u = s((e, t) => G(e) ? me(e, t) : L(e) ? be(e, t) : $e(e, t), "i"), me = s((e, t) => {
53
+ const n = {};
54
+ for (const o of e) {
55
+ if (o.length !== 1) throw new Error(`Invalid character: "${o}"`);
56
+ const l = o.charCodeAt(0);
57
+ n[l] = true;
58
+ }
59
+ return (o) => {
60
+ const l = o.index, c = o.input;
61
+ for (; o.index < c.length && c.charCodeAt(o.index) in n; ) o.index += 1;
62
+ const f = o.index;
63
+ if (f > l) {
64
+ if (!j(t) && !o.options.silent) {
65
+ const m = o.input.slice(l, f), $ = O(t) ? t(m, c, String(l)) : t;
66
+ j($) || o.output.push($);
67
+ }
68
+ o.indexMax = Math.max(o.indexMax, o.index);
69
+ }
70
+ return true;
71
+ };
72
+ }, "er"), $e = s((e, t) => {
73
+ const n = e.source, o = e.flags.replace(/y|$/, "y"), l = new RegExp(n, o);
74
+ return S((c) => {
75
+ l.lastIndex = c.index;
76
+ const f = l.exec(c.input);
77
+ if (f) {
78
+ if (!j(t) && !c.options.silent) {
79
+ const m = O(t) ? t(...f, c.input, String(c.index)) : t;
80
+ j(m) || c.output.push(m);
81
+ }
82
+ return c.index += f[0].length, c.indexMax = Math.max(c.indexMax, c.index), true;
83
+ } else return false;
84
+ });
85
+ }, "nr"), be = s((e, t) => (n) => {
86
+ if (n.input.startsWith(e, n.index)) {
87
+ if (!j(t) && !n.options.silent) {
88
+ const o = O(t) ? t(e, n.input, String(n.index)) : t;
89
+ j(o) || n.output.push(o);
90
+ }
91
+ return n.index += e.length, n.indexMax = Math.max(n.indexMax, n.index), true;
92
+ } else return false;
93
+ }, "tr"), T = s((e, t, n, o) => {
94
+ const l = y(e);
95
+ return S(E(U((c) => {
96
+ let f = 0;
97
+ for (; f < n; ) {
98
+ const m = c.index;
99
+ if (!l(c) || (f += 1, c.index === m)) break;
100
+ }
101
+ return f >= t;
102
+ }), o));
103
+ }, "C"), ve = s((e, t) => T(e, 0, 1, t), "ar"), _ = s((e, t) => T(e, 0, 1 / 0, t), "f"), P = s((e, t) => {
104
+ const n = e.map(y);
105
+ return S(E(U((o) => {
106
+ for (let l = 0, c = n.length; l < c; l++) if (!n[l](o)) return false;
107
+ return true;
108
+ }), t));
109
+ }, "x"), b = s((e, t) => {
110
+ const n = e.map(y);
111
+ return S(E((o) => {
112
+ for (let l = 0, c = n.length; l < c; l++) if (n[l](o)) return true;
113
+ return false;
114
+ }, t));
115
+ }, "l"), U = s((e, t = false) => {
116
+ const n = y(e);
117
+ return (o) => {
118
+ const l = o.index, c = o.output.length, f = n(o);
119
+ return (!f || t) && (o.index = l, o.output.length !== c && (o.output.length = c)), f;
120
+ };
121
+ }, "M"), E = s((e, t) => {
122
+ const n = y(e);
123
+ return t ? (o) => {
124
+ if (o.options.silent) return n(o);
125
+ const l = o.output.length;
126
+ if (n(o)) {
127
+ const c = o.output.splice(l, 1 / 0), f = t(c);
128
+ return j(f) || o.output.push(f), true;
129
+ } else return false;
130
+ } : n;
131
+ }, "_"), S = /* @__PURE__ */ (() => {
132
+ let e = 0;
133
+ return (t) => {
134
+ const n = y(t), o = e += 1;
135
+ return (l) => {
136
+ var c;
137
+ if (l.options.memoization === false) return n(l);
138
+ const f = l.index, m = (c = l.cache)[o] || (c[o] = /* @__PURE__ */ new Map()), $ = m.get(f);
139
+ if ($ === false) return false;
140
+ if (fe($)) return l.index = $, true;
141
+ if ($) return l.index = $.index, $.output?.length && l.output.push(...$.output), true;
142
+ {
143
+ const ne = l.output.length;
144
+ if (n(l)) {
145
+ const re = l.index, oe = l.output.length;
146
+ if (oe > ne) {
147
+ const mt = l.output.slice(ne, oe);
148
+ m.set(f, { index: re, output: mt });
149
+ } else m.set(f, re);
150
+ return true;
151
+ } else return m.set(f, false), false;
152
+ }
153
+ };
154
+ };
155
+ })(), B = s((e) => {
156
+ let t;
157
+ return (n) => (t || (t = y(e())), t(n));
158
+ }, "E"), y = ge((e) => {
159
+ if (O(e)) return pe(e) ? B(e) : e;
160
+ if (L(e) || de(e)) return u(e);
161
+ if (G(e)) return P(e);
162
+ if (he(e)) return b(Object.values(e));
163
+ throw new Error("Invalid rule");
164
+ }), D = "abcdefghijklmnopqrstuvwxyz", ye = s((e) => {
165
+ let t = "";
166
+ for (; e > 0; ) {
167
+ const n = (e - 1) % 26;
168
+ t = D[n] + t, e = Math.floor((e - 1) / 26);
169
+ }
170
+ return t;
171
+ }, "ir"), F = s((e) => {
172
+ let t = 0;
173
+ for (let n = 0, o = e.length; n < o; n++) t = t * 26 + D.indexOf(e[n]) + 1;
174
+ return t;
175
+ }, "z"), I = s((e, t) => {
176
+ if (t < e) return I(t, e);
177
+ const n = [];
178
+ for (; e <= t; ) n.push(e++);
179
+ return n;
180
+ }, "S"), Ae = s((e, t, n) => I(e, t).map((o) => String(o).padStart(n, "0")), "or"), H = s((e, t) => I(F(e), F(t)).map(ye), "O"), v = s((e) => e, "p"), J = s((e) => je((t) => xe(t, e, { memoization: false }).join("")), "R"), je = s((e) => {
181
+ const t = {};
182
+ return (n) => t[n] ?? (t[n] = e(n));
183
+ }, "ur"), we = u(/^\*\*\/\*$/, ".*"), ze = u(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (e, t, n) => `.*${t ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), Me = u(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (e, t, n, o) => `.*${t ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${o.replaceAll(",", "|").replaceAll(".", "\\.")})`), W = u(/\\./, v), Oe = u(/[$.*+?^(){}[\]\|]/, (e) => `\\${e}`), _e = u(/./, v), Pe = u(/^(?:!!)*!(.*)$/, (e, t) => `(?!^${te(t)}$).*?`), Se = u(/^(!!)+/, ""), Ze = b([Pe, Se]), Ce = u(/\/(\*\*\/)+/, "(?:/.+/|/)"), Ee = u(/^(\*\*\/)+/, "(?:^|.*/)"), Ie = u(/\/(\*\*)$/, "(?:/.*|$)"), We = u(/\*\*/, ".*"), K = b([Ce, Ee, Ie, We]), ke = u(/\*\/(?!\*\*\/)/, "[^/]*/"), Re = u(/\*/, "[^/]*"), Q = b([ke, Re]), X = u("?", "[^/]"), Ne = u("[", v), qe = u("]", v), Ge = u(/[!^]/, "^/"), Le = u(/[a-z]-[a-z]|[0-9]-[0-9]/i, v), Te = u(/[$.*+?^(){}[\|]/, (e) => `\\${e}`), Ue = u(/[^\]]/, v), Be = b([W, Te, Le, Ue]), Y = P([Ne, ve(Ge), _(Be), qe]), De = u("{", "(?:"), Fe = u("}", ")"), He = u(/(\d+)\.\.(\d+)/, (e, t, n) => Ae(+t, +n, Math.min(t.length, n.length)).join("|")), Je = u(/([a-z]+)\.\.([a-z]+)/, (e, t, n) => H(t, n).join("|")), Ke = u(/([A-Z]+)\.\.([A-Z]+)/, (e, t, n) => H(t.toLowerCase(), n.toLowerCase()).join("|").toUpperCase()), Qe = b([He, Je, Ke]), V = P([De, Qe, Fe]), Xe = u("{", "(?:"), Ye = u("}", ")"), Ve = u(",", "|"), et = u(/[$.*+?^(){[\]\|]/, (e) => `\\${e}`), tt = u(/[^}]/, v), nt = B(() => ee), rt = b([K, Q, X, Y, V, nt, W, et, Ve, tt]), ee = P([Xe, _(rt), Ye]), ot = _(b([we, ze, Me, Ze, K, Q, X, Y, V, ee, W, Oe, _e])), it = ot, at = J(it), te = at, lt = u(/\\./, v), st = u(/./, v), ut = u(/\*\*\*+/, "*"), ct = u(/([^/{[(!])\*\*/, (e, t) => `${t}*`), pt = u(/(^|.)\*\*(?=[^*/)\]}])/, (e, t) => `${t}*`), ft = _(b([lt, ut, ct, pt, st])), ht = ft, dt = J(ht), gt = dt, k = s((e, t) => {
184
+ const n = Array.isArray(e) ? e : [e];
185
+ if (!n.length) return false;
186
+ const o = n.map(k.compile), l = n.every((f) => /(\/(?:\*\*)?|\[\/\])$/.test(f)), c = t.replace(/[\\\/]+/g, "/").replace(/\/$/, l ? "/" : "");
187
+ return o.some((f) => f.test(c));
188
+ }, "$");
189
+ k.compile = (e) => new RegExp(`^${te(gt(e))}$`, "s");
190
+ var xt = k;
191
+ return g(M);
192
+ })();
193
+ return r.default || r;
194
+ }, "_lazyMatch");
195
+ let R;
196
+ const jt = s((r, i) => (R || (R = ie(), ie = null), R(r, i)), "default");
197
+ var wt = Object.defineProperty;
198
+ var d = Z((r, i) => wt(r, "name", { value: i, configurable: true }), "r");
199
+ const zt = /^[/\\]{2}/;
200
+ const Mt = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i;
201
+ const le = /^[A-Z]:$/i;
202
+ const ae = /^\/([A-Z]:)?$/i;
203
+ const Ot = /.(\.[^./]+)$/;
204
+ const _t = /^[/\\]|^[a-z]:[/\\]/i;
205
+ const Pt = d(() => typeof process.cwd == "function" ? process.cwd().replaceAll("\\", "/") : "/", "cwd");
206
+ const N = d((r, i) => {
207
+ let a = "", p = 0, h = -1, x = 0, A = null;
208
+ for (let g = 0; g <= r.length; ++g) {
209
+ if (g < r.length) A = r[g];
210
+ else {
211
+ if (A === "/") break;
212
+ A = "/";
213
+ }
214
+ if (A === "/") {
215
+ if (!(h === g - 1 || x === 1)) if (x === 2) {
216
+ if (a.length < 2 || p !== 2 || !a.endsWith(".") || a.at(-2) !== ".") {
217
+ if (a.length > 2) {
218
+ const M = a.lastIndexOf("/");
219
+ M === -1 ? (a = "", p = 0) : (a = a.slice(0, M), p = a.length - 1 - a.lastIndexOf("/")), h = g, x = 0;
220
+ continue;
221
+ } else if (a.length > 0) {
222
+ a = "", p = 0, h = g, x = 0;
223
+ continue;
224
+ }
225
+ }
226
+ i && (a += a.length > 0 ? "/.." : "..", p = 2);
227
+ } else a.length > 0 ? a += `/${r.slice(h + 1, g)}` : a = r.slice(h + 1, g), p = g - h - 1;
228
+ h = g, x = 0;
229
+ } else A === "." && x !== -1 ? ++x : x = -1;
230
+ }
231
+ return a;
232
+ }, "normalizeString");
233
+ const z = d((r) => Mt.test(r), "isAbsolute");
234
+ const q = d(function(r) {
235
+ if (r.length === 0) return ".";
236
+ r = w(r);
237
+ const i = zt.exec(r), a = z(r), p = r.at(-1) === "/";
238
+ return r = N(r, !a), r.length === 0 ? a ? "/" : p ? "./" : "." : (p && (r += "/"), le.test(r) && (r += "/"), i ? a ? `//${r}` : `//./${r}` : a && !z(r) ? `/${r}` : r);
239
+ }, "normalize");
240
+ const Ct = d((...r) => {
241
+ let i = "";
242
+ for (const a of r) if (a) if (i.length > 0) {
243
+ const p = i[i.length - 1] === "/", h = a[0] === "/";
244
+ p && h ? i += a.slice(1) : i += p || h ? a : `/${a}`;
245
+ } else i += a;
246
+ return q(i);
247
+ }, "join");
248
+ const C = d(function(...r) {
249
+ r = r.map((p) => w(p));
250
+ let i = "", a = false;
251
+ for (let p = r.length - 1; p >= -1 && !a; p--) {
252
+ const h = p >= 0 ? r[p] : Pt();
253
+ !h || h.length === 0 || (i = `${h}/${i}`, a = z(h));
254
+ }
255
+ return i = N(i, !a), a && !z(i) ? `/${i}` : i.length > 0 ? i : ".";
256
+ }, "resolve");
257
+ d(function(r) {
258
+ return w(r);
259
+ }, "toNamespacedPath");
260
+ const se = d(function(r) {
261
+ return Ot.exec(w(r))?.[1] ?? "";
262
+ }, "extname");
263
+ d(function(r, i) {
264
+ const a = C(r).replace(ae, "$1").split("/"), p = C(i).replace(ae, "$1").split("/");
265
+ if (p[0][1] === ":" && a[0][1] === ":" && a[0] !== p[0]) return p.join("/");
266
+ const h = [...a];
267
+ for (const x of h) {
268
+ if (p[0] !== x) break;
269
+ a.shift(), p.shift();
270
+ }
271
+ return [...a.map(() => ".."), ...p].join("/");
272
+ }, "relative");
273
+ const ue = d((r) => {
274
+ const i = w(r).replace(/\/$/, "").split("/").slice(0, -1);
275
+ return i.length === 1 && le.test(i[0]) && (i[0] += "/"), i.join("/") || (z(r) ? "/" : ".");
276
+ }, "dirname");
277
+ d(function(r) {
278
+ const i = [r.root, r.dir, r.base ?? r.name + r.ext].filter(Boolean);
279
+ return w(r.root ? C(...i) : i.join("/"));
280
+ }, "format");
281
+ const ce = d((r, i) => {
282
+ const a = w(r).split("/").pop();
283
+ return i && a.endsWith(i) ? a.slice(0, -i.length) : a;
284
+ }, "basename");
285
+ d(function(r) {
286
+ const i = _t.exec(r)?.[0]?.replace(/\\/g, "/") ?? "", a = ce(r), p = se(a);
287
+ return { base: a, dir: ue(r), ext: p, name: a.slice(0, a.length - p.length), root: i };
288
+ }, "parse");
289
+ d((r, i) => jt(i, q(r)), "matchesGlob");
290
+
291
+ var __defProp$2 = Object.defineProperty;
292
+ var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
293
+ const FILE_NAME = "last-update-check.json";
294
+ const getConfigFile = /* @__PURE__ */ __name$2((packageName) => {
295
+ const cacheDirectory = findCacheDirSync(packageName);
296
+ if (cacheDirectory === undefined) {
297
+ throw new Error("Could not find cache directory");
298
+ }
299
+ return Ct(cacheDirectory, FILE_NAME);
300
+ }, "getConfigFile");
301
+ const getLastUpdate = /* @__PURE__ */ __name$2((packageName) => {
302
+ const configFile = getConfigFile(packageName);
303
+ try {
304
+ if (!existsSync(configFile)) {
305
+ return undefined;
306
+ }
307
+ const { lastUpdateCheck } = JSON.parse(readFileSync(configFile, "utf8"));
308
+ return lastUpdateCheck;
309
+ } catch {
310
+ return undefined;
311
+ }
312
+ }, "getLastUpdate");
313
+ const saveLastUpdate = /* @__PURE__ */ __name$2((packageName) => {
314
+ const configFile = getConfigFile(packageName);
315
+ const configDirectory = ue(configFile);
316
+ if (!existsSync(configDirectory)) {
317
+ mkdirSync(configDirectory, { recursive: true });
318
+ }
319
+ writeFileSync(configFile, JSON.stringify({ lastUpdateCheck: Date.now() }));
320
+ }, "saveLastUpdate");
321
+
322
+ var __defProp$1 = Object.defineProperty;
323
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
324
+ const getDistributionVersion = /* @__PURE__ */ __name$1(async (packageName, distributionTag, registryUrl) => {
325
+ const url = registryUrl.replace("__NAME__", packageName);
326
+ return await new Promise((resolve, reject) => {
327
+ get(url, (message) => {
328
+ let body = "";
329
+ message.on("data", (chunk) => body += chunk);
330
+ message.on("end", () => {
331
+ try {
332
+ const json = JSON.parse(body);
333
+ const version = json[distributionTag];
334
+ if (!version) {
335
+ reject(new Error("Error getting version"));
336
+ }
337
+ resolve(version);
338
+ } catch {
339
+ reject(new Error("Could not parse version response"));
340
+ }
341
+ });
342
+ }).on("error", (error) => reject(error));
343
+ });
344
+ }, "getDistributionVersion");
345
+
346
+ var __defProp = Object.defineProperty;
347
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
348
+ const hasNewVersion = /* @__PURE__ */ __name(async ({
349
+ alwaysRun,
350
+ debug,
351
+ distTag: distributionTag = "latest",
352
+ pkg,
353
+ registryUrl = "https://registry.npmjs.org/-/package/__NAME__/dist-tags",
354
+ updateCheckInterval = 1e3 * 60 * 60 * 24
355
+ }) => {
356
+ const lastUpdateCheck = getLastUpdate(pkg.name);
357
+ if (alwaysRun || !lastUpdateCheck || lastUpdateCheck < Date.now() - updateCheckInterval) {
358
+ const latestVersion = await getDistributionVersion(pkg.name, distributionTag, registryUrl);
359
+ saveLastUpdate(pkg.name);
360
+ if (semverGt(latestVersion, pkg.version)) {
361
+ return latestVersion;
362
+ }
363
+ if (debug) {
364
+ console.error(`Latest version (${latestVersion}) not newer than current version (${pkg.version})`);
365
+ }
366
+ } else if (debug) {
367
+ console.error(
368
+ `Too recent to check for a new update. simpleUpdateNotifier() interval set to ${updateCheckInterval}ms but only ${Date.now() - lastUpdateCheck}ms since last check.`
369
+ );
370
+ }
371
+ return null;
372
+ }, "hasNewVersion");
373
+
374
+ export { hasNewVersion as default };