"use strict";exports.id=2035,exports.ids=[2035],exports.modules={32035:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{installFromBuiltin:()=>l});var e=c(73024),f=c(76760),g=c.n(f),h=c(20050),i=c(8118),j=c(99861),k=a([j]);j=(k.then?(await k)():k)[0];let n=/^builtin:([a-z][a-z0-9-]*)@([0-9]+\.[0-9]+\.[0-9]+(?:[-+][\w.]+)?)$/,o=["manifest.json","ui.tsx","card.tsx","README.md","icon.png"];async function l(a){let b,c=n.exec(a.builtin);if(!c)throw Error(`Invalid builtin spec: ${a.builtin}`);let d=c[1],f=c[2],k=g().join(process.cwd(),"packages","utilities",d),l=await e.promises.stat(k).catch(()=>null);if(!l||!l.isDirectory())throw Error(`Builtin utility "${d}" not found at ${k}. Did the repo include packages/utilities/?`);let p=g().join(k,"manifest.json"),q=await e.promises.readFile(p,"utf8");try{b=JSON.parse(q)}catch(a){throw Error(`manifest.json in ${k} is not valid JSON: ${a instanceof Error?a.message:String(a)}`)}let r=h.pL.parse(b);if(r.id!==d)throw Error(`manifest.id (${r.id}) doesn't match directory name (${d})`);r.version!==f&&console.warn(`[builtin-installer] version mismatch: spec=${f} manifest=${r.version} — using manifest version`);let s={};for(let a of(s["manifest.json"]=q,o)){if("manifest.json"===a)continue;let b=g().join(k,a),c=await e.promises.readFile(b,"utf8").catch(()=>null);null!=c&&(s[a]=c)}let t=g().join(k,"actions");for(let a of(await m(t,t,"actions",s),await e.promises.readdir(k,{withFileTypes:!0}).catch(()=>[]))){if(!a.isFile()||void 0!==s[a.name]||!/\.(tsx?|mjs|js|css|md)$/i.test(a.name))continue;let b=g().join(k,a.name);try{if((await e.promises.stat(b)).size>524288)continue}catch{continue}let c=await e.promises.readFile(b,"utf8").catch(()=>null);null!=c&&(s[a.name]=c)}for(let a of r.serverActions??[]){if(void 0!==s[a.entry])continue;let b=g().join(k,a.entry),c=await e.promises.readFile(b,"utf8").catch(()=>null);if(null==c)throw Error(`serverAction entry "${a.entry}" missing in ${k}`);s[a.entry]=c}let u=`builtin:${r.id}@${r.version}`,v=await (0,i.gd)({scope:a.scope,...a.rootId?{rootId:a.rootId}:{},manifest:r,files:s,source:{type:"builtin",origin:u,fetchedAt:new Date().toISOString(),installedBy:"builtin-installer"}});return await (0,j.buildUtility)(v),{scope:v.scope,id:v.manifest.id,origin:u}}async function m(a,b,c,d){let f;try{f=await e.promises.readdir(b,{withFileTypes:!0})}catch{return}for(let h of f){let f=g().join(b,h.name),i=c?`${c}/${g().relative(a,f).split(g().sep).join("/")}`:g().relative(a,f).split(g().sep).join("/");if(h.isDirectory()){await m(a,f,c,d);continue}if(!h.isFile())continue;try{if((await e.promises.stat(f)).size>524288)continue}catch{continue}let j=await e.promises.readFile(f,"utf8").catch(()=>null);null!=j&&void 0===d[i]&&(d[i]=j)}}d()}catch(a){d(a)}})}};