@visulima/error 5.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## @visulima/error [5.0.1](https://github.com/visulima/visulima/compare/@visulima/error@5.0.0...@visulima/error@5.0.1) (2025-10-20)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **deps:** update patch updates ([#452](https://github.com/visulima/visulima/issues/452)) ([4da5cbd](https://github.com/visulima/visulima/commit/4da5cbd411ccd961be7fd6f454aaec841e220b5e))
|
|
6
|
+
|
|
7
|
+
### Miscellaneous Chores
|
|
8
|
+
|
|
9
|
+
* **deps:** update package versions and dependencies ([88d8d32](https://github.com/visulima/visulima/commit/88d8d32c4629a7a06c8770369191da2cc81087cc))
|
|
10
|
+
* update package dependencies across multiple packages ([17e3f23](https://github.com/visulima/visulima/commit/17e3f2377c8a3f98e2eed2192c5adaf6e32558b5))
|
|
11
|
+
|
|
1
12
|
## @visulima/error [5.0.0](https://github.com/visulima/visulima/compare/@visulima/error@4.6.2...@visulima/error@5.0.0) (2025-10-15)
|
|
2
13
|
|
|
3
14
|
### ⚠ BREAKING CHANGES
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Tt=Object.defineProperty;var F=(n,o)=>Tt(n,"name",{value:o,configurable:!0});import{createRequire as Bt}from"node:module";import Wt from"../solution/ai/ai-prompt.js";import J from"./aiSolutionResponse-RD0AK1jh.js";const $e=Bt(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Y=F(n=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[o,i]=Z.versions.node.split(".").map(Number);if(o>22||o===22&&i>=3||o===20&&i>=16)return Z.getBuiltinModule(n)}return $e(n)},"__cjs_getBuiltinModule"),{createHash:Dt}=Y("node:crypto"),{existsSync:be,readFileSync:Et,mkdirSync:Ft,writeFileSync:Nt}=Y("node:fs"),{tmpdir:qt}=Y("node:os"),{generateText:Rt}=$e("ai");var Jt=Object.defineProperty,Lt=F((n,o)=>Jt(n,"name",{value:o,configurable:!0}),"ce"),Gt=Object.defineProperty,Q=Lt((n,o)=>Gt(n,"name",{value:o,configurable:!0}),"C"),Kt=Object.defineProperty,c=Q((n,o)=>Kt(n,"name",{value:o,configurable:!0}),"u$1");let ge=c(()=>{var n=(()=>{var o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,m=c((e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},"J"),b=c((e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of u(t))!d.call(e,s)&&s!==r&&o(e,s,{get:c(()=>t[s],"get"),enumerable:!(a=i(t,s))||a.enumerable});return e},"T"),g=c(e=>b(o({},"__esModule",{value:!0}),e),"W"),k={};m(k,{zeptomatch:c(()=>Ct,"zeptomatch")});var j=c(e=>Array.isArray(e),"k"),x=c(e=>typeof e=="function","x"),O=c(e=>e.length===0,"K"),S=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return r=>(r.length===0||r.length===1)&&t.test(e.call(r))})(),Oe=c(e=>typeof e=="number","Y"),Me=c(e=>typeof e=="object"&&e!==null,"rr"),_e=c(e=>e instanceof RegExp,"er"),ze=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),ke=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),V=c(e=>typeof e=="string","M"),M=c(e=>e===void 0,"f"),Ce=c(e=>{const t=new Map;return r=>{const a=t.get(r);if(a!==void 0)return a;const s=e(r);return t.set(r,s),s}},"ar"),Pe=c((e,t,r={})=>{const a={cache:{},input:e,index:0,indexBacktrackMax:0,options:r,output:[]},s=_(t)(a),f=Math.max(a.index,a.indexBacktrackMax);if(s&&a.index===e.length)return a.output;throw new Error(`Failed to parse at index ${f}`)},"or"),l=c((e,t)=>j(e)?Se(e,t):V(e)?X(e,t):Ie(e,t),"o"),Se=c((e,t)=>{const r={};for(const a of e){if(a.length!==1)throw new Error(`Invalid character: "${a}"`);const s=a.charCodeAt(0);r[s]=!0}return a=>{const s=a.input;let f=a.index,p=f;for(;p<s.length&&s.charCodeAt(p)in r;)p+=1;if(p>f){if(!M(t)&&!a.options.silent){const h=s.slice(f,p),$=x(t)?t(h,s,`${f}`):t;M($)||a.output.push($)}a.index=p}return!0}},"ir"),Ie=c((e,t)=>{if(ke(e))return X(e.source,t);{const r=e.source,a=e.flags.replace(/y|$/,"y"),s=new RegExp(r,a);return ze(e)&&x(t)&&!S(t)?Ze(s,t):Te(s,t)}},"ur"),Ze=c((e,t)=>r=>{const a=r.index,s=r.input;e.lastIndex=a;const f=e.exec(s);if(f){const p=e.lastIndex;if(!r.options.silent){const h=t(...f,s,`${a}`);M(h)||r.output.push(h)}return r.index=p,!0}else return!1},"sr"),Te=c((e,t)=>r=>{const a=r.index,s=r.input;if(e.lastIndex=a,e.test(s)){const f=e.lastIndex;if(!M(t)&&!r.options.silent){const p=x(t)?t(s.slice(a,f),s,`${a}`):t;M(p)||r.output.push(p)}return r.index=f,!0}else return!1},"cr"),X=c((e,t)=>r=>{const a=r.index,s=r.input;if(s.startsWith(e,a)){if(!M(t)&&!r.options.silent){const f=x(t)?t(e,s,`${a}`):t;M(f)||r.output.push(f)}return r.index+=e.length,!0}else return!1},"R"),ee=c((e,t,r,a)=>{const s=_(e),f=t>1;return q(N(te(p=>{let h=0;for(;h<r;){const $=p.index;if(!s(p)||(h+=1,p.index===$))break}return h>=t},f),a))},"O"),Be=c((e,t)=>ee(e,0,1,t),"lr"),B=c((e,t)=>ee(e,0,1/0,t),"m"),D=c((e,t)=>{const r=e.map(_);return q(N(te(a=>{for(let s=0,f=r.length;s<f;s++)if(!r[s](a))return!1;return!0}),t))},"S"),w=c((e,t)=>{const r=e.map(_);return q(N(a=>{for(let s=0,f=r.length;s<f;s++)if(r[s](a))return!0;return!1},t))},"p"),te=c((e,t=!0,r=!1)=>{const a=_(e);return t?s=>{const f=s.index,p=s.output.length,h=a(s);return!h&&!r&&(s.indexBacktrackMax=Math.max(s.indexBacktrackMax,s.index)),(!h||r)&&(s.index=f,s.output.length!==p&&(s.output.length=p)),h}:a},"P"),N=c((e,t)=>{const r=_(e);return t?a=>{if(a.options.silent)return r(a);const s=a.output.length;if(r(a)){const f=a.output.splice(s,1/0),p=t(f);return M(p)||a.output.push(p),!0}else return!1}:r},"C"),q=(()=>{let e=0;return t=>{const r=_(t),a=e+=1;return s=>{var f;if(s.options.memoization===!1)return r(s);const p=s.index,h=(f=s.cache)[a]||(f[a]={indexMax:-1,queue:[]}),$=h.queue;if(p<=h.indexMax){const I=h.store||(h.store=new Map);if($.length){for(let P=0,St=$.length;P<St;P+=2){const It=$[P*2],Zt=$[P*2+1];I.set(It,Zt)}$.length=0}const v=I.get(p);if(v===!1)return!1;if(Oe(v))return s.index=v,!0;if(v)return s.index=v.index,v.output?.length&&s.output.push(...v.output),!0}const he=s.output.length,Pt=r(s);if(h.indexMax=Math.max(h.indexMax,p),Pt){const I=s.index,v=s.output.length;if(v>he){const P=s.output.slice(he,v);$.push(p,{index:I,output:P})}else $.push(p,I);return!0}else return $.push(p,!1),!1}}})(),ne=c(e=>{let t;return r=>(t||(t=_(e())),t(r))},"A"),_=Ce(e=>{if(x(e))return O(e)?ne(e):e;if(V(e)||_e(e))return l(e);if(j(e))return D(e);if(Me(e))return w(Object.values(e));throw new Error("Invalid rule")}),A=c(e=>e,"v"),re=c(e=>t=>Pe(t,e,{memoization:!1}).join(""),"z"),De=c(e=>{const t={};return r=>t[r]??(t[r]=e(r))},"pr"),oe="abcdefghijklmnopqrstuvwxyz",Ee=c(e=>{let t="";for(;e>0;){const r=(e-1)%26;t=oe[r]+t,e=Math.floor((e-1)/26)}return t},"vr"),ie=c(e=>{let t=0;for(let r=0,a=e.length;r<a;r++)t=t*26+oe.indexOf(e[r])+1;return t},"N"),R=c((e,t)=>{if(t<e)return R(t,e);const r=[];for(;e<=t;)r.push(e++);return r},"$"),Fe=c((e,t,r)=>R(e,t).map(a=>String(a).padStart(r,"0")),"fr"),se=c((e,t)=>R(ie(e),ie(t)).map(Ee),"j"),W=l(/\\./,A),Ne=l(/[$.*+?^(){}[\]\|]/,e=>`\\${e}`),qe=l(/[\\/]/,"[\\\\/]"),Re=l(/./,A),We=l(/^(?:!!)*!(.*)$/,(e,t)=>`(?!^${de(t)}$).*?`),Je=l(/^(!!)+/,""),Le=w([We,Je]),Ge=l(/\/(\*\*\/)+/,"(?:[\\\\/].+[\\\\/]|[\\\\/])"),Ke=l(/^(\*\*\/)+/,"(?:^|.*[\\\\/])"),Ue=l(/\/(\*\*)$/,"(?:[\\\\/].*|$)"),He=l(/\*\*/,".*"),ae=w([Ge,Ke,Ue,He]),Ye=l(/\*\/(?!\*\*\/|\*$)/,"[^\\\\/]*[\\\\/]"),Qe=l(/\*/,"[^\\\\/]*"),ue=w([Ye,Qe]),ce=l("?","[^\\\\/]"),Ve=l("[",A),Xe=l("]",A),et=l(/[!^]/,"^\\\\/"),tt=l(/[a-z]-[a-z]|[0-9]-[0-9]/i,A),nt=l(/[$.*+?^(){}[\|]/,e=>`\\${e}`),rt=l(/[^\]]/,A),ot=w([W,nt,tt,rt]),le=D([Ve,Be(et),B(ot),Xe]),it=l("{","(?:"),st=l("}",")"),at=l(/(\d+)\.\.(\d+)/,(e,t,r)=>Fe(+t,+r,Math.min(t.length,r.length)).join("|")),ut=l(/([a-z]+)\.\.([a-z]+)/,(e,t,r)=>se(t,r).join("|")),ct=l(/([A-Z]+)\.\.([A-Z]+)/,(e,t,r)=>se(t.toLowerCase(),r.toLowerCase()).join("|").toUpperCase()),lt=w([at,ut,ct]),fe=D([it,lt,st]),ft=l("{","(?:"),pt=l("}",")"),dt=l(",","|"),ht=l(/[$.*+?^(){[\]\|]/,e=>`\\${e}`),gt=l(/[^}]/,A),mt=ne(()=>pe),xt=w([ae,ue,ce,le,fe,mt,W,ht,dt,gt]),pe=D([ft,B(xt),pt]),yt=B(w([Le,ae,ue,ce,le,fe,pe,W,Ne,qe,Re])),$t=yt,bt=re($t),de=bt,vt=l(/\\./,A),jt=l(/./,A),wt=l(/\*\*\*+/,"*"),At=l(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),Ot=l(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),Mt=B(w([vt,wt,At,Ot,jt])),_t=Mt,zt=re(_t),kt=zt,E=c((e,t)=>Array.isArray(e)?e.map(E.compile).some(r=>r.test(t)):E.compile(e).test(t),"_");E.compile=De(e=>new RegExp(`^${de(kt(e))}[\\\\/]?$`,"s"));var Ct=E;return g(k)})();return n.default||n},"_lazyMatch"),L;const Ut=c((n,o)=>(L||(L=ge(),ge=null),L(n,o)),"default");var Ht=Object.defineProperty,Yt=Q((n,o)=>Ht(n,"name",{value:o,configurable:!0}),"t");const Qt=/^[A-Z]:\//i,C=Yt((n="")=>n&&n.replaceAll("\\","/").replace(Qt,o=>o.toUpperCase()),"normalizeWindowsPath");var Vt=Object.defineProperty,y=Q((n,o)=>Vt(n,"name",{value:o,configurable:!0}),"r");const Xt=/^[/\\]{2}/,en=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ve=/^[A-Z]:$/i,me=/^\/([A-Z]:)?$/i,tn=/.(\.[^./]+)$/,nn=/^[/\\]|^[a-z]:[/\\]/i,rn=y(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),je=y((n,o)=>{let i="",u=0,d=-1,m=0,b;for(let g=0;g<=n.length;++g){if(g<n.length)b=n[g];else{if(b==="/")break;b="/"}if(b==="/"){if(!(d===g-1||m===1))if(m===2){if(i.length<2||u!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const k=i.lastIndexOf("/");k===-1?(i="",u=0):(i=i.slice(0,k),u=i.length-1-i.lastIndexOf("/")),d=g,m=0;continue}else if(i.length>0){i="",u=0,d=g,m=0;continue}}o&&(i+=i.length>0?"/..":"..",u=2)}else i.length>0?i+=`/${n.slice(d+1,g)}`:i=n.slice(d+1,g),u=g-d-1;d=g,m=0}else b==="."&&m!==-1?++m:m=-1}return i},"normalizeString"),T=y(n=>en.test(n),"isAbsolute"),we=y(function(n){if(n.length===0)return".";n=C(n);const o=Xt.exec(n),i=T(n),u=n.at(-1)==="/";return n=je(n,!i),n.length===0?i?"/":u?"./":".":(u&&(n+="/"),ve.test(n)&&(n+="/"),o?i?`//${n}`:`//./${n}`:i&&!T(n)?`/${n}`:n)},"normalize"),Ae=y((...n)=>{let o="";for(const i of n)if(i)if(o.length>0){const u=o[o.length-1]==="/",d=i[0]==="/";u&&d?o+=i.slice(1):o+=u||d?i:`/${i}`}else o+=i;return we(o)},"join"),H=y(function(...n){n=n.map(u=>C(u));let o="",i=!1;for(let u=n.length-1;u>=-1&&!i;u--){const d=u>=0?n[u]:rn();!d||d.length===0||(o=`${d}/${o}`,i=T(d))}return o=je(o,!i),i&&!T(o)?`/${o}`:o.length>0?o:"."},"resolve");y(function(n){return C(n)},"toNamespacedPath");const on=y(function(n){return tn.exec(C(n))?.[1]??""},"extname");y(function(n,o){const i=H(n).replace(me,"$1").split("/"),u=H(o).replace(me,"$1").split("/");if(u[0][1]===":"&&i[0][1]===":"&&i[0]!==u[0])return u.join("/");const d=[...i];for(const m of d){if(u[0]!==m)break;i.shift(),u.shift()}return[...i.map(()=>".."),...u].join("/")},"relative");const sn=y(n=>{const o=C(n).replace(/\/$/,"").split("/").slice(0,-1);return o.length===1&&ve.test(o[0])&&(o[0]+="/"),o.join("/")||(T(n)?"/":".")},"dirname");y(function(n){const o=[n.root,n.dir,n.base??n.name+n.ext].filter(Boolean);return C(n.root?H(...o):o.join("/"))},"format");const an=y((n,o)=>{const i=C(n).split("/").pop();return o&&i.endsWith(o)?i.slice(0,-o.length):i},"basename");y(function(n){const o=nn.exec(n)?.[0]?.replaceAll("\\","/")??"",i=an(n),u=on(i);return{base:i,dir:sn(n),ext:u,name:i.slice(0,i.length-u.length),root:o}},"parse");y((n,o)=>Ut(o,we(n)),"matchesGlob");var un=Object.defineProperty,z=F((n,o)=>un(n,"name",{value:o,configurable:!0}),"i");const G="## Ai Generated Solution",xe="Creation of a AI solution failed.",K=z((n,o,i)=>{const u={error:{message:n.message,name:n.name,stack:n.stack},file:{file:o.file,language:o.language,line:o.line,snippet:o.snippet},temperature:i};return Dt("sha256").update(JSON.stringify(u)).digest("hex")},"generateCacheKey"),cn=z(n=>n||Ae(qt(),"visulima-error-cache"),"getCacheDirectory"),ln=z(n=>{be(n)||Ft(n,{recursive:!0})},"ensureCacheDirectory"),U=z((n,o)=>Ae(n,`${o}.json`),"getCacheFilePath"),fn=z((n,o)=>{try{if(!be(n))return;const i=Et(n,"utf8"),u=JSON.parse(i);return Date.now()-u.timestamp>o?void 0:u.solution}catch{return}},"readFromCache"),ye=z((n,o,i)=>{try{const u={solution:o,timestamp:Date.now(),ttl:i};Nt(n,JSON.stringify(u,null,2),"utf8")}catch{}},"writeToCache"),mn=z((n,o)=>({handle:z(async(i,u)=>{const d=o?.cache,m=o?.temperature??0,b=d?.ttl??1440*60*1e3,g=cn(d?.directory);if(d?.enabled!==!1){const j=K(i,u,m),x=U(g,j),O=fn(x,b);if(O)return O;ln(g)}const k=Wt({applicationType:void 0,error:i,file:u});try{const j=(await Rt({model:n,prompt:k,temperature:m})).text;let x;if(j?x={body:J(j),header:G}:x={body:J(xe),header:G},d?.enabled!==!1){const O=K(i,u,m),S=U(g,O);ye(S,x,b)}return x}catch(j){console.error(j);const x={body:J(xe),header:G};if(d?.enabled!==!1){const O=K(i,u,m),S=U(g,O);ye(S,x,b)}return x}},"handle"),name:"AI SDK",priority:99}),"aiFinder");export{mn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"../../packem_shared/aiFinder-
|
|
1
|
+
import{default as e}from"../../packem_shared/aiFinder-McmYwPGR.js";import{default as t}from"./ai-prompt.js";import{default as i}from"../../packem_shared/aiSolutionResponse-RD0AK1jh.js";export{e as aiFinder,t as aiPrompt,i as aiSolutionResponse};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/error",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Error with more than just a message, stacktrace parsing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"LICENSE.md"
|
|
101
101
|
],
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"ai": "^5.0.
|
|
103
|
+
"ai": "^5.0.68"
|
|
104
104
|
},
|
|
105
105
|
"peerDependenciesMeta": {
|
|
106
106
|
"ai": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Zt=Object.defineProperty;var N=(n,o)=>Zt(n,"name",{value:o,configurable:!0});import{createRequire as Tt}from"node:module";import qt from"../solution/ai/ai-prompt.js";import J from"./aiSolutionResponse-RD0AK1jh.js";const $e=Tt(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Y=N(n=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[o,i]=Z.versions.node.split(".").map(Number);if(o>22||o===22&&i>=3||o===20&&i>=16)return Z.getBuiltinModule(n)}return $e(n)},"__cjs_getBuiltinModule"),{createHash:Bt}=Y("node:crypto"),{existsSync:be,readFileSync:Dt,mkdirSync:Et,writeFileSync:Nt}=Y("node:fs"),{tmpdir:Rt}=Y("node:os"),{generateText:Ft}=$e("ai");var Wt=Object.defineProperty,Q=N((n,o)=>Wt(n,"name",{value:o,configurable:!0}),"I"),Jt=Object.defineProperty,u=Q((n,o)=>Jt(n,"name",{value:o,configurable:!0}),"__name$2");let ge=u(()=>{var n=(()=>{var o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,m=u((e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},"J"),b=u((e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of l(t))!d.call(e,s)&&s!==r&&o(e,s,{get:u(()=>t[s],"get"),enumerable:!(a=i(t,s))||a.enumerable});return e},"T"),g=u(e=>b(o({},"__esModule",{value:!0}),e),"W"),k={};m(k,{zeptomatch:u(()=>kt,"zeptomatch")});var j=u(e=>Array.isArray(e),"k"),x=u(e=>typeof e=="function","x"),A=u(e=>e.length===0,"K"),S=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return r=>(r.length===0||r.length===1)&&t.test(e.call(r))})(),Ae=u(e=>typeof e=="number","Y"),Me=u(e=>typeof e=="object"&&e!==null,"rr"),Oe=u(e=>e instanceof RegExp,"er"),ze=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),ke=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),V=u(e=>typeof e=="string","M"),M=u(e=>e===void 0,"f"),Ce=u(e=>{const t=new Map;return r=>{const a=t.get(r);if(a!==void 0)return a;const s=e(r);return t.set(r,s),s}},"ar"),Pe=u((e,t,r={})=>{const a={cache:{},input:e,index:0,indexBacktrackMax:0,options:r,output:[]},s=O(t)(a),f=Math.max(a.index,a.indexBacktrackMax);if(s&&a.index===e.length)return a.output;throw new Error(`Failed to parse at index ${f}`)},"or"),c=u((e,t)=>j(e)?Se(e,t):V(e)?X(e,t):Ie(e,t),"o"),Se=u((e,t)=>{const r={};for(const a of e){if(a.length!==1)throw new Error(`Invalid character: "${a}"`);const s=a.charCodeAt(0);r[s]=!0}return a=>{const s=a.input;let f=a.index,p=f;for(;p<s.length&&s.charCodeAt(p)in r;)p+=1;if(p>f){if(!M(t)&&!a.options.silent){const h=s.slice(f,p),$=x(t)?t(h,s,`${f}`):t;M($)||a.output.push($)}a.index=p}return!0}},"ir"),Ie=u((e,t)=>{if(ke(e))return X(e.source,t);{const r=e.source,a=e.flags.replace(/y|$/,"y"),s=new RegExp(r,a);return ze(e)&&x(t)&&!S(t)?Ze(s,t):Te(s,t)}},"ur"),Ze=u((e,t)=>r=>{const a=r.index,s=r.input;e.lastIndex=a;const f=e.exec(s);if(f){const p=e.lastIndex;if(!r.options.silent){const h=t(...f,s,`${a}`);M(h)||r.output.push(h)}return r.index=p,!0}else return!1},"sr"),Te=u((e,t)=>r=>{const a=r.index,s=r.input;if(e.lastIndex=a,e.test(s)){const f=e.lastIndex;if(!M(t)&&!r.options.silent){const p=x(t)?t(s.slice(a,f),s,`${a}`):t;M(p)||r.output.push(p)}return r.index=f,!0}else return!1},"cr"),X=u((e,t)=>r=>{const a=r.index,s=r.input;if(s.startsWith(e,a)){if(!M(t)&&!r.options.silent){const f=x(t)?t(e,s,`${a}`):t;M(f)||r.output.push(f)}return r.index+=e.length,!0}else return!1},"R"),ee=u((e,t,r,a)=>{const s=O(e),f=t>1;return F(R(te(p=>{let h=0;for(;h<r;){const $=p.index;if(!s(p)||(h+=1,p.index===$))break}return h>=t},f),a))},"O"),Be=u((e,t)=>ee(e,0,1,t),"lr"),B=u((e,t)=>ee(e,0,1/0,t),"m"),D=u((e,t)=>{const r=e.map(O);return F(R(te(a=>{for(let s=0,f=r.length;s<f;s++)if(!r[s](a))return!1;return!0}),t))},"_"),w=u((e,t)=>{const r=e.map(O);return F(R(a=>{for(let s=0,f=r.length;s<f;s++)if(r[s](a))return!0;return!1},t))},"p"),te=u((e,t=!0,r=!1)=>{const a=O(e);return t?s=>{const f=s.index,p=s.output.length,h=a(s);return!h&&!r&&(s.indexBacktrackMax=Math.max(s.indexBacktrackMax,s.index)),(!h||r)&&(s.index=f,s.output.length!==p&&(s.output.length=p)),h}:a},"P"),R=u((e,t)=>{const r=O(e);return t?a=>{if(a.options.silent)return r(a);const s=a.output.length;if(r(a)){const f=a.output.splice(s,1/0),p=t(f);return M(p)||a.output.push(p),!0}else return!1}:r},"C"),F=(()=>{let e=0;return t=>{const r=O(t),a=e+=1;return s=>{var f;if(s.options.memoization===!1)return r(s);const p=s.index,h=(f=s.cache)[a]||(f[a]={indexMax:-1,queue:[]}),$=h.queue;if(p<=h.indexMax){const I=h.store||(h.store=new Map);if($.length){for(let P=0,Pt=$.length;P<Pt;P+=2){const St=$[P*2],It=$[P*2+1];I.set(St,It)}$.length=0}const v=I.get(p);if(v===!1)return!1;if(Ae(v))return s.index=v,!0;if(v)return s.index=v.index,v.output?.length&&s.output.push(...v.output),!0}const he=s.output.length,Ct=r(s);if(h.indexMax=Math.max(h.indexMax,p),Ct){const I=s.index,v=s.output.length;if(v>he){const P=s.output.slice(he,v);$.push(p,{index:I,output:P})}else $.push(p,I);return!0}else return $.push(p,!1),!1}}})(),ne=u(e=>{let t;return r=>(t||(t=O(e())),t(r))},"A"),O=Ce(e=>{if(x(e))return A(e)?ne(e):e;if(V(e)||Oe(e))return c(e);if(j(e))return D(e);if(Me(e))return w(Object.values(e));throw new Error("Invalid rule")}),_=u(e=>e,"v"),re=u(e=>t=>Pe(t,e,{memoization:!1}).join(""),"z"),De=u(e=>{const t={};return r=>t[r]??(t[r]=e(r))},"pr"),oe="abcdefghijklmnopqrstuvwxyz",Ee=u(e=>{let t="";for(;e>0;){const r=(e-1)%26;t=oe[r]+t,e=Math.floor((e-1)/26)}return t},"vr"),ie=u(e=>{let t=0;for(let r=0,a=e.length;r<a;r++)t=t*26+oe.indexOf(e[r])+1;return t},"N"),q=u((e,t)=>{if(t<e)return q(t,e);const r=[];for(;e<=t;)r.push(e++);return r},"$"),Ne=u((e,t,r)=>q(e,t).map(a=>String(a).padStart(r,"0")),"fr"),se=u((e,t)=>q(ie(e),ie(t)).map(Ee),"j"),W=c(/\\./,_),Re=c(/[$.*+?^(){}[\]\|]/,e=>`\\${e}`),Fe=c(/./,_),qe=c(/^(?:!!)*!(.*)$/,(e,t)=>`(?!^${de(t)}$).*?`),We=c(/^(!!)+/,""),Je=w([qe,We]),Le=c(/\/(\*\*\/)+/,"(?:[\\\\/].+[\\\\/]|[\\\\/])"),Ke=c(/^(\*\*\/)+/,"(?:^|.*[\\\\/])"),Ue=c(/\/(\*\*)$/,"(?:[\\\\/].*|$)"),Ge=c(/\*\*/,".*"),ae=w([Le,Ke,Ue,Ge]),He=c(/\*\/(?!\*\*\/|\*$)/,"[^\\\\/]*[\\\\/]"),Ye=c(/\*/,"[^\\\\/]*"),le=w([He,Ye]),ue=c("?","[^\\\\/]"),Qe=c("[",_),Ve=c("]",_),Xe=c(/[!^]/,"^\\\\/"),et=c(/[a-z]-[a-z]|[0-9]-[0-9]/i,_),tt=c(/[$.*+?^(){}[\|]/,e=>`\\${e}`),nt=c(/[^\]]/,_),rt=w([W,tt,et,nt]),ce=D([Qe,Be(Xe),B(rt),Ve]),ot=c("{","(?:"),it=c("}",")"),st=c(/(\d+)\.\.(\d+)/,(e,t,r)=>Ne(+t,+r,Math.min(t.length,r.length)).join("|")),at=c(/([a-z]+)\.\.([a-z]+)/,(e,t,r)=>se(t,r).join("|")),lt=c(/([A-Z]+)\.\.([A-Z]+)/,(e,t,r)=>se(t.toLowerCase(),r.toLowerCase()).join("|").toUpperCase()),ut=w([st,at,lt]),fe=D([ot,ut,it]),ct=c("{","(?:"),ft=c("}",")"),pt=c(",","|"),dt=c(/[$.*+?^(){[\]\|]/,e=>`\\${e}`),ht=c(/[^}]/,_),gt=ne(()=>pe),mt=w([ae,le,ue,ce,fe,gt,W,dt,pt,ht]),pe=D([ct,B(mt),ft]),xt=B(w([Je,ae,le,ue,ce,fe,pe,W,Re,Fe])),yt=xt,$t=re(yt),de=$t,bt=c(/\\./,_),vt=c(/./,_),jt=c(/\*\*\*+/,"*"),wt=c(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),_t=c(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),At=B(w([bt,jt,wt,_t,vt])),Mt=At,Ot=re(Mt),zt=Ot,E=u((e,t)=>Array.isArray(e)?e.map(E.compile).some(r=>r.test(t)):E.compile(e).test(t),"S");E.compile=De(e=>new RegExp(`^${de(zt(e))}[\\\\/]?$`,"s"));var kt=E;return g(k)})();return n.default||n},"_lazyMatch"),L;const Lt=u((n,o)=>(L||(L=ge(),ge=null),L(n,o)),"default");var Kt=Object.defineProperty,Ut=Q((n,o)=>Kt(n,"name",{value:o,configurable:!0}),"__name$1");const Gt=/^[A-Z]:\//i,C=Ut((n="")=>n&&n.replaceAll("\\","/").replace(Gt,o=>o.toUpperCase()),"normalizeWindowsPath");var Ht=Object.defineProperty,y=Q((n,o)=>Ht(n,"name",{value:o,configurable:!0}),"__name");const Yt=/^[/\\]{2}/,Qt=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ve=/^[A-Z]:$/i,me=/^\/([A-Z]:)?$/i,Vt=/.(\.[^./]+)$/,Xt=/^[/\\]|^[a-z]:[/\\]/i,en=y(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),je=y((n,o)=>{let i="",l=0,d=-1,m=0,b=null;for(let g=0;g<=n.length;++g){if(g<n.length)b=n[g];else{if(b==="/")break;b="/"}if(b==="/"){if(!(d===g-1||m===1))if(m===2){if(i.length<2||l!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const k=i.lastIndexOf("/");k===-1?(i="",l=0):(i=i.slice(0,k),l=i.length-1-i.lastIndexOf("/")),d=g,m=0;continue}else if(i.length>0){i="",l=0,d=g,m=0;continue}}o&&(i+=i.length>0?"/..":"..",l=2)}else i.length>0?i+=`/${n.slice(d+1,g)}`:i=n.slice(d+1,g),l=g-d-1;d=g,m=0}else b==="."&&m!==-1?++m:m=-1}return i},"normalizeString"),T=y(n=>Qt.test(n),"isAbsolute"),we=y(function(n){if(n.length===0)return".";n=C(n);const o=Yt.exec(n),i=T(n),l=n.at(-1)==="/";return n=je(n,!i),n.length===0?i?"/":l?"./":".":(l&&(n+="/"),ve.test(n)&&(n+="/"),o?i?`//${n}`:`//./${n}`:i&&!T(n)?`/${n}`:n)},"normalize"),_e=y((...n)=>{let o="";for(const i of n)if(i)if(o.length>0){const l=o[o.length-1]==="/",d=i[0]==="/";l&&d?o+=i.slice(1):o+=l||d?i:`/${i}`}else o+=i;return we(o)},"join"),H=y(function(...n){n=n.map(l=>C(l));let o="",i=!1;for(let l=n.length-1;l>=-1&&!i;l--){const d=l>=0?n[l]:en();!d||d.length===0||(o=`${d}/${o}`,i=T(d))}return o=je(o,!i),i&&!T(o)?`/${o}`:o.length>0?o:"."},"resolve");y(function(n){return C(n)},"toNamespacedPath");const tn=y(function(n){return Vt.exec(C(n))?.[1]??""},"extname");y(function(n,o){const i=H(n).replace(me,"$1").split("/"),l=H(o).replace(me,"$1").split("/");if(l[0][1]===":"&&i[0][1]===":"&&i[0]!==l[0])return l.join("/");const d=[...i];for(const m of d){if(l[0]!==m)break;i.shift(),l.shift()}return[...i.map(()=>".."),...l].join("/")},"relative");const nn=y(n=>{const o=C(n).replace(/\/$/,"").split("/").slice(0,-1);return o.length===1&&ve.test(o[0])&&(o[0]+="/"),o.join("/")||(T(n)?"/":".")},"dirname");y(function(n){const o=[n.root,n.dir,n.base??n.name+n.ext].filter(Boolean);return C(n.root?H(...o):o.join("/"))},"format");const rn=y((n,o)=>{const i=C(n).split("/").pop();return o&&i.endsWith(o)?i.slice(0,-o.length):i},"basename");y(function(n){const o=Xt.exec(n)?.[0]?.replace(/\\/g,"/")??"",i=rn(n),l=tn(i);return{base:i,dir:nn(n),ext:l,name:i.slice(0,i.length-l.length),root:o}},"parse");y((n,o)=>Lt(o,we(n)),"matchesGlob");var on=Object.defineProperty,z=N((n,o)=>on(n,"name",{value:o,configurable:!0}),"i");const K="## Ai Generated Solution",xe="Creation of a AI solution failed.",U=z((n,o,i)=>{const l={error:{message:n.message,name:n.name,stack:n.stack},file:{file:o.file,language:o.language,line:o.line,snippet:o.snippet},temperature:i};return Bt("sha256").update(JSON.stringify(l)).digest("hex")},"generateCacheKey"),sn=z(n=>n||_e(Rt(),"visulima-error-cache"),"getCacheDirectory"),an=z(n=>{be(n)||Et(n,{recursive:!0})},"ensureCacheDirectory"),G=z((n,o)=>_e(n,`${o}.json`),"getCacheFilePath"),ln=z((n,o)=>{try{if(!be(n))return;const i=Dt(n,"utf8"),l=JSON.parse(i);return Date.now()-l.timestamp>o?void 0:l.solution}catch{return}},"readFromCache"),ye=z((n,o,i)=>{try{const l={solution:o,timestamp:Date.now(),ttl:i};Nt(n,JSON.stringify(l,null,2),"utf8")}catch{}},"writeToCache"),dn=z((n,o)=>({handle:z(async(i,l)=>{const d=o?.cache,m=o?.temperature??0,b=d?.ttl??1440*60*1e3,g=sn(d?.directory);if(d?.enabled!==!1){const j=U(i,l,m),x=G(g,j),A=ln(x,b);if(A)return A;an(g)}const k=qt({applicationType:void 0,error:i,file:l});try{const j=(await Ft({model:n,prompt:k,temperature:m})).text;let x;if(j?x={body:J(j),header:K}:x={body:J(xe),header:K},d?.enabled!==!1){const A=U(i,l,m),S=G(g,A);ye(S,x,b)}return x}catch(j){console.error(j);const x={body:J(xe),header:K};if(d?.enabled!==!1){const A=U(i,l,m),S=G(g,A);ye(S,x,b)}return x}},"handle"),name:"AI SDK",priority:99}),"aiFinder");export{dn as default};
|