@easbot/utils 0.3.10 → 0.3.12
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/dist/chunks/chunk-6GZFOJRQ.mjs +2 -0
- package/dist/chunks/{chunk-3U5YF6EI.cjs → chunk-GJWUV3QH.cjs} +5 -5
- package/dist/chunks/chunk-HJFBORDG.cjs +2 -0
- package/dist/chunks/{chunk-AUS6KQNI.cjs → chunk-PGUMSM7F.cjs} +1 -1
- package/dist/chunks/{chunk-DELWLFU5.mjs → chunk-QCS3QD2D.mjs} +1 -1
- package/dist/chunks/{chunk-WW6DVU53.mjs → chunk-YP6ECIPQ.mjs} +2 -2
- package/dist/chunks/filesystem-CGAFQWRQ.cjs +1 -0
- package/dist/chunks/filesystem-O6RBT4K4.mjs +1 -0
- package/dist/chunks/registry-GBOWZBTS.mjs +1 -0
- package/dist/chunks/registry-GFAO7SFK.cjs +1 -0
- package/dist/chunks/shell-4YPSYLVZ.cjs +1 -0
- package/dist/chunks/shell-V3XGWWGO.mjs +1 -0
- package/dist/index.cjs +23 -60
- package/dist/index.d.cts +265 -207
- package/dist/index.d.ts +265 -207
- package/dist/index.mjs +23 -60
- package/package.json +4 -3
- package/dist/chunks/chunk-6BCTOX3Z.mjs +0 -2
- package/dist/chunks/chunk-EN7LFV4R.cjs +0 -2
- package/dist/chunks/filesystem-26SI2VQU.cjs +0 -1
- package/dist/chunks/filesystem-GHRTFLEY.mjs +0 -1
- package/dist/chunks/registry-5BYC5NYM.mjs +0 -1
- package/dist/chunks/registry-Z3XETZ6O.cjs +0 -1
- package/dist/chunks/shell-52EI6MQK.cjs +0 -1
- package/dist/chunks/shell-JJRFPZC7.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,66 +1,29 @@
|
|
|
1
|
-
export{a as Lock}from'./chunks/chunk-EWRFKUXM.mjs';import {b,D,a,G,c as c$1}from'./chunks/chunk-
|
|
2
|
-
Full ${
|
|
3
|
-
Use Read tool with offset/limit parameters to view specific sections.]`:`[Content truncated. Full ${
|
|
4
|
-
Use Read tool with offset/limit parameters to view specific sections.]`}async function
|
|
1
|
+
export{a as Lock}from'./chunks/chunk-EWRFKUXM.mjs';import {b,D,a,G,c as c$1}from'./chunks/chunk-YP6ECIPQ.mjs';export{H as $,j as HTTPException,d as Hono,c as Lazy,D as PKG,A as PkgShell,G as Shell,g as compress,e as cors,s as createNodeWebSocket,B as createPkgShell,p as createRESTServer,n as createRPCServer,m as createServer,r as createStreamingServer,q as createWebSocketServer,y as detectPlatform,w as escapeCommandArg,x as escapeCommandArgSafe,z as joinCommandArgs,a as lazy,b as lazyAsync,f as logger,u as needsShellExecution,t as parseCommand,v as parseCommandWithOptions,E as readableStreamToText,h as secureHeaders,C as shell,o as startServer,i as timeout,k as validator,F as whichSync,l as zValidator}from'./chunks/chunk-YP6ECIPQ.mjs';import {d,b as b$2,a as a$1}from'./chunks/chunk-6GZFOJRQ.mjs';export{d as Filesystem,b as Glob,c as MIME_TYPES,a as Wildcard}from'./chunks/chunk-6GZFOJRQ.mjs';import {m,b as b$1}from'./chunks/chunk-QCS3QD2D.mjs';export{m as Log,o as PackageRegistry,n as Semver,l as addMinutesInTimezone,a as formatLocalISO,b as formatLocalISOCompact,f as formatLogTime,g as formatLogTimeMs,h as getTimezoneOffset,i as getTimezoneParts,j as isValidTimezone,k as normalizeTimezone,c as now,d as nowLocalISO,e as parseLocalISO}from'./chunks/chunk-QCS3QD2D.mjs';import {f,c,d as d$1}from'./chunks/chunk-MHARKEDN.mjs';import ie,{readFile}from'fs/promises';import ue,{z}from'zod';import {randomBytes}from'crypto';import {config}from'dotenv';import Pe,{dirname,join}from'path';import {existsSync,readdirSync,statSync}from'fs';import {xdgConfig}from'xdg-basedir';import {fileURLToPath}from'url';import de from'gray-matter';import {ProxyAgent,getGlobalDispatcher,setGlobalDispatcher}from'undici';import {AsyncLocalStorage}from'async_hooks';f();f();function gt(t,e){for(let r=t.length-1;r>=0;r-=1){let n=t[r];if(n!==void 0&&e(n,r,t))return n}}f();var he;(r=>{function t(n,s,l){let y=0,o=n.length-1;for(;y<=o;){let u=Math.floor((y+o)/2),b=n[u];if(b===void 0)break;let w=l(b);if(w===s)return {found:true,index:u};w<s?y=u+1:o=u-1;}return {found:false,index:y}}r.search=t;function e(n,s,l){let y=l(s),o=0,u=n.length;for(;o<u;){let b=Math.floor((o+u)/2),w=n[b];if(w===void 0)break;l(w)<y?o=b+1:u=b;}return n.splice(o,0,s),n}r.insert=e;})(he||(he={}));f();var xe;(l=>{function t(y){let o=new TextEncoder().encode(y),u=Array.from(o,b=>String.fromCharCode(b)).join("");return btoa(u).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}l.base64Encode=t;function e(y){let o=atob(y.replace(/-/g,"+").replace(/_/g,"/")),u=Uint8Array.from(o,b=>b.charCodeAt(0));return new TextDecoder().decode(u)}l.base64Decode=e;async function r(y,o="SHA-256"){let b=new TextEncoder().encode(y),w=await crypto.subtle.digest(o,b);return Array.from(new Uint8Array(w)).map(m=>m.toString(16).padStart(2,"0")).join("")}l.hash=r;function n(y){if(!y)return;let o=2166136261;for(let u=0;u<y.length;u++)o^=y.charCodeAt(u),o=Math.imul(o,16777619);return (o>>>0).toString(36)}l.checksum=n;function s(y,o=5e5){if(!y)return;if(y.length<=o)return n(y);let u=4096,w=[0,Math.floor(y.length*.25),Math.floor(y.length*.5),Math.floor(y.length*.75),y.length-u].map(S=>{let R=Math.max(0,Math.min(y.length-u,S-Math.floor(u/2)));return n(y.slice(R,R+u))??""}).join(":");return `${y.length}:${w}`}l.sampledChecksum=s;})(xe||(xe={}));f();f();var Z;(S=>{let t={event:"evt",session:"ses",message:"msg",permission:"per",question:"que",user:"usr",part:"prt",pty:"pty",tool:"tool",workspace:"wrk",command:"cmd",task:"task",heartbeat:"hb",agent:"ag",subagent:"sub",hook:"hok",compaction:"cmp",context:"ctx",experience:"exp",pattern:"pat",knowledge:"knw",evolution:"evo",result:"res"};function e(R){return ue.string().startsWith(t[R])}S.schema=e;let r=26,n=0,s=0;function l(R,m){return o(R,false,m)}S.ascending=l;function y(R,m){return o(R,true,m)}S.descending=y;function o(R,m,A){if(!A)return b(R,m);if(!A.startsWith(t[R]))throw new Error(`ID ${A} does not start with ${t[R]}`);return A}function u(R){let m="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",A="",I=randomBytes(R);for(let i=0;i<R;i++){let h=I[i];h!==void 0&&(A+=m[h%62]);}return A}function b(R,m,A){let I=A??Date.now();I!==n&&(n=I,s=0),s++;let i=BigInt(I)*BigInt(4096)+BigInt(s);i=m?~i:i;let h=Buffer.alloc(6);for(let _=0;_<6;_++)h[_]=Number(i>>BigInt(40-8*_)&BigInt(255));return t[R]+"_"+h.toString("hex")+u(r-12)}S.create=b;function w(R){let m=R.split("_")[0];if(!m)return 0;let A=R.slice(m.length+1,m.length+13),I=BigInt("0x"+A);return Number(I/BigInt(4096))}S.timestamp=w;})(Z||(Z={}));var ye;(b=>{b.DEFAULT_MAX_CHARS=4e3,b.DIRECTION="head",b.DIR=d.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),b.GLOB=d.join(b.DIR,"*");let s=10080*60*1e3;function l(w,S,R){return R?`[Content truncated. Source: ${R}
|
|
2
|
+
Full ${S} saved to: ${w}
|
|
3
|
+
Use Read tool with offset/limit parameters to view specific sections.]`:`[Content truncated. Full ${S} saved to: ${w}
|
|
4
|
+
Use Read tool with offset/limit parameters to view specific sections.]`}async function y(w,S={}){let R=S.maxChars??4e3,m=S.direction??b.DIRECTION,A=S.label??"content",I=S.sourcePath,i=d.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),h=S.dir??i;if(w.length<=R)return {content:w,truncated:false};let _=Z.ascending("context"),C=d.join(h,_);await ie.mkdir(h,{recursive:true}).catch(()=>{}),await ie.writeFile(C,w,"utf-8");let U=w.length-R,j;m==="head"?j=w.slice(0,R):j=w.slice(-R);let $=l(C,A,I),a=`${U} characters truncated`;return {content:m==="head"?`${j}
|
|
5
5
|
|
|
6
|
-
...${
|
|
6
|
+
...${a}...
|
|
7
7
|
|
|
8
|
-
${
|
|
8
|
+
${$}`:`...${a}...
|
|
9
9
|
|
|
10
|
-
${
|
|
10
|
+
${$}
|
|
11
11
|
|
|
12
|
-
${
|
|
13
|
-
`):e;for(let
|
|
12
|
+
${j}`,truncated:true,outputPath:C,originalLength:w.length,removedLength:U,label:A}}b.truncate=y;function o(w){return w.truncated?l(w.outputPath,w.label):""}b.formatHint=o;async function u(){let w=Z.timestamp(Z.create("context",false,Date.now()-s)),R=(await ie.readdir(b.DIR).catch(()=>[])).filter(m=>m.startsWith("context_"));for(let m of R)Z.timestamp(m)>=w||await ie.unlink(d.join(b.DIR,m)).catch(()=>{});}b.cleanup=u;})(ye||(ye={}));f();var be;(o=>{let t="New session - ",e="Child session - ";o.parentTitlePrefix=t,o.childTitlePrefix=e;function s(u=false){return (u?e:t)+b$1(new Date)}o.createDefault=s;function l(u){return new RegExp(`^(${t}|${e})\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[+-]\\d{2}:\\d{2}$`).test(u)}o.isDefault=l;function y(u){let b=u.match(/^(.+) \(fork #(\d+)\)$/);if(b){let w=b[1]??"",S=parseInt(b[2]??"0",10);return `${w} (fork #${S+1})`}return `${u} (fork #1)`}o.getForked=y;})(be||(be={}));f();var ne=class ne extends Error{static create(e,r){var l;let n=ue.object({name:ue.literal(e),data:r}).meta({ref:e}),s=(l=class extends ne{constructor(o,u){super(e,u);c(this,"data",o);c(this,"name",e);this.name=e;}static isInstance(o){return o!==null&&typeof o=="object"&&"name"in o&&o.name===e}schema(){return n}toObject(){return {name:e,data:this.data}}},c(l,"Schema",n),l);return Object.defineProperty(s,"name",{value:e}),s}};c(ne,"Unknown",ne.create("UnknownError",ue.object({message:ue.string()})));var oe=ne;f();var we;(e=>{function t(r){return new Te(r)}e.create=t;})(we||(we={}));var Te=class{constructor(e){c(this,"rules",[]);c(this,"ignorecase");c(this,"debug");this.ignorecase=e?.ignorecase??false,this.debug=e?.debug??false;}add(e){let r=typeof e=="string"?e.split(`
|
|
13
|
+
`):e;for(let n=0;n<r.length;n++){let s=r[n];this.parseRule(s,n+1);}return this}parseRule(e,r){let n=e,s=e;if(n.length===0||n.startsWith("#"))return;let l=n.startsWith("!");if(l&&(n=n.slice(1)),n=n.trim(),n.length===0||(n.startsWith("\\#")&&(n=n.slice(1)),n.startsWith("#")))return;let y=n.startsWith("/");y&&(n=n.slice(1));let o=n.endsWith("/");o&&(n=n.slice(0,-1)),n.length!==0&&this.rules.push({pattern:n,negative:l,isDirectory:o,anchored:y,original:s,lineNumber:r});}ignores(e,r){let n=this.normalizePath(e),s=r??e.endsWith("/"),l=this.checkIgnore(n,s);return this.debug&&console.log(`Ignore.ignores("${e}", isDirectory=${s}) => ${l}`),l}checkIgnore(e,r){let n=false;for(let s of this.rules)s.isDirectory&&!r||this.matchPath(s,e)&&(s.negative?n=false:n=true);return n}matchPath(e,r){let n=this.ignorecase?r.toLowerCase():r,l=this.ignorecase?e.pattern.toLowerCase():e.pattern;if(e.anchored)return a$1.match(n,l);if(l.includes("/"))return a$1.match(n,l);let y=n.split("/");for(let o of y)if(a$1.match(o,l))return true;return false}filter(e){return e.filter(r=>!this.ignores(r))}createFilter(){return e=>!this.ignores(e)}normalizePath(e){let r=e.replace(/\\/g,"/");if(r==="/")return "";for(;r.startsWith("./");)r=r.slice(2);return r.endsWith("/")&&r.length>1&&(r=r.slice(0,-1)),r}};f();function Ce(t,e){let r=n=>{let s;try{s=t.parse(n);}catch(l){throw console.trace("schema validation failure stack trace:"),l instanceof z.ZodError&&console.error("schema validation issues:",JSON.stringify(l.issues,null,2)),l}return e(s)};return r.force=n=>e(n),r.schema=t,r}var yt=Ce,Ee;(e=>e.fn=Ce)(Ee||(Ee={}));f();function Tt(t={}){let e=t.isDevelopment??false,r=e?".env.dev":".env",n=t.globalConfigPath??(xdgConfig?Pe.join(xdgConfig,"easbot"):void 0),s=t.projectRoot??process.cwd(),l=s?Pe.join(s,".easbot"):void 0,y=[{root:n,label:"global"},{root:s,label:"project"},{root:l,label:"workspace"}];for(let{root:o}of y){if(!o)continue;let u=Pe.join(o,r);if(!existsSync(u))continue;let b=config({path:u,override:true,debug:e,encoding:"utf-8",quiet:!e});if(e&&b.parsed){let S=["XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_CACHE_HOME","XDG_STATE_HOME","XDG_RUNTIME_DIR","EASBOT_CONFIG_PATH","EASBOT_DATA_PATH","EASBOT_CACHE_PATH","EASBOT_STATE_PATH","EASBOT_LOG_PATH","EASBOT_BIN_PATH"].filter(R=>R in b.parsed);S.length>0&&console.warn(`[loadEnv] ${u} contains keys that have no effect: ${S.join(", ")}.
|
|
14
14
|
Reason: xdg-basedir caches XDG_* on import, so this .env file loads too late.
|
|
15
|
-
How to override: export them in the shell before loadEnv() runs, or set process.env directly.`);}}}f();async function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
`);}function _n(t){let e=t.env.listStack,n=e[e.length-1];if(!n)return;n.index+=1;let r=" ".repeat(Math.max(0,e.length-1)),o=n.type==="ordered"?`${n.index}. `:"\u2022 ";t.text+=`${r}${o}`;}function Cn(t,e){if(!e)return;let n=Q(t),r=n.text.length;n.text+=e,n.styles.push({start:r,end:r+e.length,style:"code"});}function An(t,e){let n=e??"",r=Q(t),o=r.text.length;r.text+=n,r.styles.push({start:o,end:o+n.length,style:"code_block"});}function Ln(t){let e=Q(t),n=e.linkStack.pop();if(!n?.href)return;let r=n.href.trim();if(!r)return;let o=n.labelStart,i=e.text.length;if(i<=o){e.links.push({start:o,end:i,href:r});return}e.links.push({start:o,end:i,href:r});}function Dn(){return {headers:[],rows:[],currentRow:[],currentCell:null,inHeader:false}}function $n(t){return It(t),{text:t.text,styles:t.styles,links:t.links}}function Re(t){let e=t.text,n=0,r=e.length;for(;n<r&&/\s/.test(e[n]??"");)n+=1;for(;r>n&&/\s/.test(e[r-1]??"");)r-=1;if(n===0&&r===e.length)return t;let o=e.slice(n,r),i=o.length,a=[];for(let l of t.styles){let f=Math.max(0,l.start-n),c=Math.min(i,l.end-n);c>f&&a.push({start:f,end:c,style:l.style});}let s=[];for(let l of t.links){let f=Math.max(0,l.start-n),c=Math.min(i,l.end-n);c>f&&s.push({start:f,end:c,href:l.href});}return {text:o,styles:a,links:s}}function Ze(t,e){if(!e.text)return;let n=t.text.length;t.text+=e.text;for(let r of e.styles)t.styles.push({start:n+r.start,end:n+r.end,style:r.style});for(let r of e.links)t.links.push({start:n+r.start,end:n+r.end,href:r.href});}function Nn(t,e){e.text&&(t.text+=e.text);}function Rt(t,e){let{header:n,value:r,columnIndex:o,includeColumnFallback:i}=e;r?.text&&(t.text+="\u2022 ",n?.text?(Ze(t,n),t.text+=": "):i&&(t.text+=`Column ${o}: `),Ze(t,r),t.text+=`
|
|
23
|
-
`);}function zn(t){if(!t.table)return;let e=t.table.headers.map(Re),n=t.table.rows.map(o=>o.map(Re));if(e.length===0&&n.length===0)return;if(e.length>1&&n.length>0)for(let o of n){if(o.length===0)continue;let i=o[0];if(i?.text){let a=t.text.length;Ze(t,i);let s=t.text.length;s>a&&t.styles.push({start:a,end:s,style:"bold"}),t.text+=`
|
|
24
|
-
`;}for(let a=1;a<o.length;a++)Rt(t,{header:e[a],value:o[a],columnIndex:a,includeColumnFallback:true});t.text+=`
|
|
25
|
-
`;}else for(let o of n){for(let i=0;i<o.length;i++)Rt(t,{header:e[i],value:o[i],columnIndex:i,includeColumnFallback:false});t.text+=`
|
|
26
|
-
`;}}function Bn(t){if(!t.table)return;let e=t.table.headers.map(Re),n=t.table.rows.map(c=>c.map(Re)),r=Math.max(e.length,...n.map(c=>c.length));if(r===0)return;let o=Array.from({length:r},()=>0),i=c=>{for(let u=0;u<r;u+=1){let h=c[u]?.text.length??0;(o[u]??0)<h&&(o[u]=h);}};i(e);for(let c of n)i(c);let a=t.text.length,s=c=>{t.text+="|";for(let u=0;u<r;u+=1){t.text+=" ";let d=c[u];d&&Nn(t,d);let h=d?.text.length??0,v=(o[u]??0)-h;v>0&&(t.text+=" ".repeat(v)),t.text+=" |";}t.text+=`
|
|
27
|
-
`;},l=()=>{t.text+="|";for(let c=0;c<r;c+=1){let u=o[c]??0,d=Math.max(3,u);t.text+=` ${"-".repeat(d)} |`;}t.text+=`
|
|
28
|
-
`;};s(e),l();for(let c of n)s(c);let f=t.text.length;f>a&&t.styles.push({start:a,end:f,style:"code_block"});}function Qe(t,e){for(let n of t)switch(n.type){case "inline":n.children&&Qe(n.children,e);break;case "text":Me(e,n.content??"");break;case "em_open":ne(e,"italic");break;case "em_close":re(e,"italic");break;case "strong_open":ne(e,"bold");break;case "strong_close":re(e,"bold");break;case "s_open":ne(e,"strikethrough");break;case "s_close":re(e,"strikethrough");break;case "code_inline":Cn(e,n.content??"");break;case "spoiler_open":e.enableSpoilers&&ne(e,"spoiler");break;case "spoiler_close":e.enableSpoilers&&re(e,"spoiler");break;case "link_open":{let r=Tt(n,"href")??"",o=Q(e);o.linkStack.push({href:r,labelStart:o.text.length});break}case "link_close":Ln(e);break;case "image":Me(e,n.content??"");break;case "softbreak":case "hardbreak":Me(e,`
|
|
29
|
-
`);break;case "paragraph_close":Mt(e);break;case "heading_open":e.headingStyle==="bold"&&ne(e,"bold");break;case "heading_close":e.headingStyle==="bold"&&re(e,"bold"),Mt(e);break;case "blockquote_open":e.blockquotePrefix&&(e.text+=e.blockquotePrefix),ne(e,"blockquote");break;case "blockquote_close":re(e,"blockquote");break;case "bullet_list_open":e.env.listStack.length>0&&(e.text+=`
|
|
30
|
-
`),e.env.listStack.push({type:"bullet",index:0});break;case "bullet_list_close":e.env.listStack.pop(),e.env.listStack.length===0&&(e.text+=`
|
|
31
|
-
`);break;case "ordered_list_open":{e.env.listStack.length>0&&(e.text+=`
|
|
32
|
-
`);let r=Number(Tt(n,"start")??"1");e.env.listStack.push({type:"ordered",index:r-1});break}case "ordered_list_close":e.env.listStack.pop(),e.env.listStack.length===0&&(e.text+=`
|
|
33
|
-
`);break;case "list_item_open":_n(e);break;case "list_item_close":e.text.endsWith(`
|
|
34
|
-
`)||(e.text+=`
|
|
35
|
-
`);break;case "code_block":case "fence":An(e,n.content??"");break;case "html_block":case "html_inline":Me(e,n.content??"");break;case "table_open":e.tableMode!=="off"&&(e.table=Dn(),e.hasTables=true);break;case "table_close":e.table&&(e.tableMode==="bullets"?zn(e):e.tableMode==="code"&&Bn(e)),e.table=null;break;case "thead_open":e.table&&(e.table.inHeader=true);break;case "thead_close":e.table&&(e.table.inHeader=false);break;case "tbody_open":case "tbody_close":break;case "tr_open":e.table&&(e.table.currentRow=[]);break;case "tr_close":e.table&&(e.table.inHeader?e.table.headers=e.table.currentRow:e.table.rows.push(e.table.currentRow),e.table.currentRow=[]);break;case "th_open":case "td_open":e.table&&(e.table.currentCell=En());break;case "th_close":case "td_close":e.table?.currentCell&&(e.table.currentRow.push($n(e.table.currentCell)),e.table.currentCell=null);break;case "hr":e.text+=`\u2500\u2500\u2500
|
|
36
|
-
|
|
37
|
-
`;break;default:n.children&&Qe(n.children,e);break}}function It(t){for(let e=t.openStyles.length-1;e>=0;e-=1){let n=t.openStyles[e];if(!n)continue;let r=t.text.length;r>n.start&&t.styles.push({start:n.start,end:r,style:n.style});}t.openStyles=[];}function jn(t,e){let n=[];for(let r of t){let o=Math.max(0,Math.min(r.start,e)),i=Math.max(o,Math.min(r.end,e));i>o&&n.push({start:o,end:i,style:r.style});}return n}function Wn(t,e){let n=[];for(let r of t){let o=Math.max(0,Math.min(r.start,e)),i=Math.max(o,Math.min(r.end,e));i>o&&n.push({start:o,end:i,href:r.href});}return n}function Pt(t){let e=[...t].toSorted((r,o)=>r.start!==o.start?r.start-o.start:r.end!==o.end?r.end-o.end:r.style.localeCompare(o.style)),n=[];for(let r of e){let o=n[n.length-1];if(o&&o.style===r.style&&(r.start<o.end||r.start===o.end&&r.style!=="blockquote")){o.end=Math.max(o.end,r.end);continue}n.push({...r});}return n}function vt(t,e,n){let r=Math.max(t.start,e),o=Math.min(t.end,n);return o<=r?null:{start:r,end:o}}function Hn(t,e,n){if(t.length===0)return [];let r=[];for(let o of t){let i=vt(o,e,n);i&&r.push({start:i.start-e,end:i.end-e,style:o.style});}return Pt(r)}function Un(t,e,n){if(t.length===0)return [];let r=[];for(let o of t){let i=vt(o,e,n);i&&r.push({start:i.start-e,end:i.end-e,href:o.href});}return r}function oe(t,e){try{let n=typeof t=="string"?t:"",r=Se.parse(e??{});return de(n,r).ir}catch(n){return console.error("Markdown parse error:",n),{text:"",styles:[],links:[]}}}function de(t,e){try{let n=typeof t=="string"?t:"",r=Se.parse(e),o={listStack:[]},a=vn(r).parse(n||"",o);r.enableSpoilers&&On(a);let s=r.tableMode??"off",l={text:"",styles:[],openStyles:[],links:[],linkStack:[],env:o,headingStyle:r.headingStyle??"none",blockquotePrefix:r.blockquotePrefix??"",enableSpoilers:r.enableSpoilers??!1,tableMode:s,table:null,hasTables:!1};Qe(a,l),It(l);let c=l.text.trimEnd().length,u=0;for(let k of l.styles)k.style==="code_block"&&k.end>u&&(u=k.end);let d=Math.max(c,u);return {ir:{text:d===l.text.length?l.text:l.text.slice(0,d),styles:Pt(jn(l.styles,d)),links:Wn(l.links,d)},hasTables:l.hasTables}}catch(n){return console.error("Markdown parse error:",n),{ir:{text:"",styles:[],links:[]},hasTables:false}}}function Ot(t,e){try{let n=ue.parse(t),r=typeof e=="number"&&e>0?e:0;if(!n.text)return [];if(r<=0||n.text.length<=r)return [n];let o=te(n.text,r),i=[],a=0;return o.forEach((s,l)=>{if(!s)return;if(l>0)for(;a<n.text.length&&/\s/.test(n.text[a]??"");)a+=1;let f=a,c=Math.min(n.text.length,f+s.length);i.push({text:s,styles:Hn(n.styles,f,c),links:Un(n.links,f,c)}),a=c;}),i}catch(n){return console.error("Chunk IR error:",n),[]}}f();var qn={bold:{open:"**",close:"**"},italic:{open:"*",close:"*"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function pe(t,e){try{let n=ue.parse(t),r=Xe.parse(e??{});if(!n.text)return "";let o=r.styleMarkers??qn,i=r.escapeText??(u=>u),a=r.buildLink,s=[];for(let u=0;u<n.styles.length;u++){let d=n.styles[u];d&&(s.push({position:d.start,type:"open",style:d.style,spanIndex:u}),s.push({position:d.end,type:"close",style:d.style,spanIndex:u}));}for(let u=0;u<n.links.length;u++){let d=n.links[u];d&&(s.push({position:d.start,type:"link_open",spanIndex:u,href:d.href}),s.push({position:d.end,type:"link_close",spanIndex:u,href:d.href}));}s.sort((u,d)=>{if(u.position!==d.position)return u.position-d.position;let h=(R,F)=>R==="link_open"?0:R==="open"?1:R==="close"?2:R==="link_close"?3:4,k=u.type==="close"||u.type==="link_close",v=d.type==="close"||d.type==="link_close",p=h(u.type,k),g=h(d.type,v);return p!==g?p-g:u.type==="open"&&d.type==="open"?u.spanIndex-d.spanIndex:u.type==="close"&&d.type==="close"?d.spanIndex-u.spanIndex:u.spanIndex-d.spanIndex});let l="",f=0,c=[];for(let u of s){if(u.position>f){let d=n.text.slice(f,u.position);l+=i?i(d):d;}if(u.type==="open"||u.type==="close"){let d=o[u.style];if(d)if(u.type==="open")l+=d.open,c.push(u);else {l+=d.close,u.style==="code_block"&&u.position<n.text.length&&(l+=`
|
|
38
|
-
`);let h=c.findIndex(k=>k.spanIndex===u.spanIndex&&k.type==="open");h!==-1&&c.splice(h,1);}}else if(u.type==="link_open")l+="[",c.push(u);else if(u.type==="link_close"){l+="]("+u.href+")";let d=c.findIndex(h=>h.spanIndex===u.spanIndex&&h.type==="link_open");d!==-1&&c.splice(d,1);}f=u.position;}if(f<n.text.length){let u=n.text.slice(f);l+=i?i(u):u;}return l}catch(n){return console.error("Markdown render error:",n),""}}function se(t,e){return pe(t,e)}f();function Gn(t){let e=t.replace(/\r\n/g,`
|
|
39
|
-
`).replace(/\r/g,`
|
|
40
|
-
`);if(!e.startsWith("---"))return {frontmatter:"",content:t};let n=e.indexOf(`
|
|
41
|
-
---`,3);if(n===-1)return {frontmatter:"",content:t};let r=e.slice(0,n+4),o=e.slice(n+4).trimStart();return {frontmatter:r,content:o}}function Ie(t,e){try{let n=typeof t=="string"?t:"",r=Ve.parse(e??{});if(!n)return "";let{frontmatter:o,content:i}=Gn(n),a=oe(i,{linkify:!0,enableSpoilers:!1,autolink:!0,headingStyle:"none",blockquotePrefix:"",tableMode:"off"}),s=se(a);return s=s.replace(/\n{3,}/g,`
|
|
42
|
-
|
|
43
|
-
`),s=s.trimEnd()+`
|
|
44
|
-
`,r.preserveFrontmatter&&o&&(s=o+`
|
|
45
|
-
`+s),s}catch(n){return console.error("Markdown format error:",n),t}}f();function Yn(t){return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}function Xn(t){if(t!=null){if(typeof t=="string")return {value:t.trim(),kind:"scalar"};if(typeof t=="number"||typeof t=="boolean")return {value:String(t),kind:"scalar"};if(typeof t=="object")try{return {value:JSON.stringify(t),kind:"structured"}}catch{return}}}function Vn(t){try{let e=Ft.parse(t,{schema:"core"});if(!e||typeof e!="object"||Array.isArray(e))return null;let n={};for(let[r,o]of Object.entries(e)){let i=r.trim();if(!i)continue;let a=Xn(o);a&&(n[i]=a);}return n}catch{return null}}function Jn(t,e){let n=[],r=e+1;for(;r<t.length;){let i=t[r];if(!i){r+=1;continue}if(i.length>0&&!i.startsWith(" ")&&!i.startsWith(" "))break;n.push(i),r+=1;}return {value:n.join(`
|
|
46
|
-
`).trim(),linesConsumed:r-e}}function Kn(t){let e={},n=t.split(`
|
|
47
|
-
`),r=0;for(;r<n.length;){let o=n[r];if(!o){r+=1;continue}let i=o.match(/^([\w-]+):\s*(.*)$/);if(!i?.[1]||!i[2]){r+=1;continue}let a=i[1],s=i[2].trim();if(!a){r+=1;continue}if(!s&&r+1<n.length){let f=n[r+1];if(f&&(f.startsWith(" ")||f.startsWith(" "))){let{value:c,linesConsumed:u}=Jn(n,r);c&&(e[a]={value:c,kind:"multiline",rawInline:s}),r+=u;continue}}let l=Yn(s);l&&(e[a]={value:l,kind:"inline",rawInline:s}),r+=1;}return e}function Zn(t){let e={};for(let[n,r]of Object.entries(t))e[n]=r.value;return e}function Qn(t){return /^[|>][+-]?(\d+)?[+-]?$/.test(t)}function er(t){let{lineEntry:e,yamlValue:n}=t;return n.kind!=="structured"||e.kind!=="inline"||Qn(e.rawInline)?false:e.value.includes(":")}function tr(t){let e=t.replace(/\r\n/g,`
|
|
48
|
-
`).replace(/\r/g,`
|
|
49
|
-
`);if(!e.startsWith("---"))return;let n=e.indexOf(`
|
|
50
|
-
---`,3);if(n!==-1)return e.slice(4,n)}function me(t){try{if(typeof t!="string")return {};let e=tr(t);if(!e)return {};let n=Kn(e),r=Vn(e);if(r===null)return Zn(n);let o={};for(let[i,a]of Object.entries(r)){o[i]=a.value;let s=n[i];s&&er({lineEntry:s,yamlValue:a})&&(o[i]=s.value);}for(let[i,a]of Object.entries(n))i in o||(o[i]=a.value);return o}catch(e){return console.warn("Failed to parse frontmatter:",e),{}}}function Pe(t){try{let e=Je.parse(t);if(Object.keys(e).length===0)return "";let n={};for(let[o,i]of Object.entries(e))try{let a=JSON.parse(i);n[o]=a;}catch{n[o]=i;}return `---
|
|
51
|
-
${Ft.stringify(n,{lineWidth:0,defaultStringType:"QUOTE_DOUBLE"}).trim()}
|
|
52
|
-
---`}catch(e){return console.warn("Failed to serialize frontmatter:",e),""}}function ve(t){try{if(typeof t!="string")return {frontmatter:{},content:""};let e=t.replace(/\r\n/g,`
|
|
53
|
-
`).replace(/\r/g,`
|
|
54
|
-
`);if(!e.startsWith("---"))return {frontmatter:{},content:t};let n=e.indexOf(`
|
|
55
|
-
---`,3);if(n===-1)return {frontmatter:{},content:t};let r=e.slice(4,n),o=e.slice(n+4).trimStart();return {frontmatter:me(t),content:o}}catch(e){return console.warn("Failed to extract frontmatter:",e),{frontmatter:{},content:t}}}f();f();function Oe(t){try{let e=z.string().parse(t),n=[],r,o=0;for(;o<=e.length;){let i=e.indexOf(`
|
|
56
|
-
`,o),a=i===-1?e.length:i,s=e.slice(o,a),l=s.match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(l){let f=l[1],c=l[2];if(!f||!c){o=a+1;continue}let u=c[0];if(!u){o=a+1;continue}let d=c.length;if(!r)r={start:o,markerChar:u,markerLen:d,openLine:s,marker:c,indent:f};else if(r.markerChar===u&&d>=r.markerLen){let h=a;n.push({start:r.start,end:h,openLine:r.openLine,marker:r.marker,indent:r.indent}),r=void 0;}}if(i===-1)break;o=i+1;}return r&&n.push({start:r.start,end:e.length,openLine:r.openLine,marker:r.marker,indent:r.indent}),n}catch(e){return console.warn("Invalid input for parseFenceSpans:",e),[]}}function et(t,e){let n=0,r=t.length-1;for(;n<=r;){let o=Math.floor((n+r)/2),i=t[o];if(!i)break;if(e<=i.start){r=o-1;continue}if(e>=i.end){n=o+1;continue}return i}}function Et(t,e){return !et(t,e)}function Fe(){return {open:false,ticks:0}}function Ee(t,e){try{let n=z.string().parse(t),r=e?Te.parse(e):Fe(),o=Oe(n),i={open:r.open,ticks:r.ticks},{spans:a,state:s}=or(n,o,i);return {inlineState:s,isInside:l=>ir(l,o)||ar(l,a)}}catch(n){return console.warn("Invalid input for buildCodeSpanIndex:",n),{inlineState:Fe(),isInside:()=>false}}}function or(t,e,n){let r=[],o=n.open,i=n.ticks,a=o?0:-1,s=0;for(;s<t.length;){let l=sr(e,s);if(l){s=l.end;continue}if(t[s]!=="`"){s+=1;continue}let f=s,c=0;for(;s<t.length&&t[s]==="`";)c+=1,s+=1;if(!o){o=true,i=c,a=f;continue}c===i&&(r.push([a,s]),o=false,i=0,a=-1);}return o&&r.push([a,t.length]),{spans:r,state:{open:o,ticks:i}}}function sr(t,e){return t.find(n=>e>=n.start&&e<n.end)}function ir(t,e){return e.some(n=>t>=n.start&&t<n.end)}function ar(t,e){return e.some(([n,r])=>t>=n&&t<r)}f();var cr={bold:{open:"**",close:"**"},italic:{open:"_",close:"_"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function _e(t,e){try{let n=z.string().parse(t),r=fe.parse(e);if(!n||r==="off")return n;let{ir:o,hasTables:i}=de(n,{linkify:!1,enableSpoilers:!1,autolink:!1,headingStyle:"none",blockquotePrefix:"",tableMode:r});return i?pe(o,{styleMarkers:cr,escapeText:a=>a,buildLink:(a,s)=>{let l=a.href.trim();return !l||!s.slice(a.start,a.end)?null:{start:a.start,end:a.end,open:"[",close:`](${l})`}}}):n}catch(n){return console.warn("Invalid input for convertMarkdownTables:",n),typeof t=="string"?t:""}}var tt;(f=>{function t(c,u){try{return oe(c,u)}catch(d){return console.warn("Markdown.parse error:",d),{text:"",styles:[],links:[]}}}f.parse=t;function e(c,u){try{return se(c,u)}catch(d){return console.warn("Markdown.render error:",d),""}}f.render=e;function n(c,u){try{return Ie(c,u)}catch(d){return console.warn("Markdown.format error:",d),typeof c=="string"?c:""}}f.format=n;function r(c){try{return me(c)}catch(u){return console.warn("Markdown.parseFrontmatter error:",u),{}}}f.parseFrontmatter=r;function o(c){try{return Pe(c)}catch(u){return console.warn("Markdown.serializeFrontmatter error:",u),""}}f.serializeFrontmatter=o;function i(c){try{return ve(c)}catch(u){return console.warn("Markdown.extractFrontmatter error:",u),{frontmatter:{},content:typeof c=="string"?c:""}}}f.extractFrontmatter=i;function a(c,u,d){try{return te(c,u,d)}catch(h){return console.warn("Markdown.chunk error:",h),typeof c=="string"&&c.length>0?[c]:[]}}f.chunk=a;function s(c,u){try{return Ee(c,u)}catch(d){return console.warn("Markdown.buildCodeIndex error:",d),{inlineState:{open:false,ticks:0},isInside:()=>false}}}f.buildCodeIndex=s;function l(c,u){try{return _e(c,u)}catch(d){return console.warn("Markdown.convertTables error:",d),typeof c=="string"?c:""}}f.convertTables=l;})(tt||(tt={}));f();function _t(t){if(!t)return "";let n=t.replace(/[/\\]+$/,"").split(/[/\\]/);return n[n.length-1]??""}function ur(t){if(!t)return "";let n=t.replace(/[/\\]+$/,"").split(/[/\\]/);return n.slice(0,n.length-1).join("/")+"/"}function fr(t){if(!t)return "";let e=t.split(".");return e[e.length-1]}function dr(t,e=20){let n=_t(t);if(n.length<=e)return n;let r=n.lastIndexOf("."),o=r<=0?"":n.slice(r),i=e-o.length-1;return i<=0?n.slice(0,e-1)+"\u2026":n.slice(0,i)+"\u2026"+o}function pr(t,e=20){if(t.length<=e)return t;let n=e-1,r=Math.ceil(n/2),o=Math.floor(n/2);return t.slice(0,r)+"\u2026"+t.slice(-o)}f();var mr=["load failed","network connection was lost","network request failed","failed to fetch","econnreset","econnrefused","etimedout","socket hang up"];function hr(t){if(!t)return false;let e=String(t instanceof Error?t.message:t).toLowerCase();return mr.some(n=>e.includes(n))}async function nt(t,e={}){let{attempts:n=3,delay:r=500,factor:o=2,maxDelay:i=1e4,retryIf:a=hr}=e,s;for(let l=0;l<n;l++)try{return await t()}catch(f){if(s=f,l===n-1||!a(f))throw f;let c=Math.min(r*o**l,i);await new Promise(u=>setTimeout(u,c));}throw s}f();var rt;(T=>{let t=m.create({service:"fetch"}),e=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"],n=false,r=null;function o(){return e.some(x=>{let y=process.env[x];return typeof y=="string"&&y.trim().length>0})}T.hasProxyConfigured=o;function i(){let x=process.env.http_proxy||process.env.HTTP_PROXY;return process.env.https_proxy||process.env.HTTPS_PROXY||x}T.getProxyUrl=i;function a(x={}){let y=x.httpProxy||x.httpsProxy||i();if(!y){t.warn("[Fetch] No proxy configured, HTTP_PROXY/HTTPS_PROXY environment variables not set");return}let I=new ProxyAgent({uri:y,connectTimeout:x.connectTimeout||1e4,keepAliveTimeout:x.keepAliveTimeout||3e4});r=getGlobalDispatcher(),setGlobalDispatcher(I),n=true,t.info(`[Fetch] Global proxy enabled: ${y}`);}T.enableProxy=a;function s(){!n||!r||(setGlobalDispatcher(r),n=false,r=null,t.info("[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u7981\u7528"));}T.disableProxy=s;function l(){return n}T.isProxyEnabled=l;async function f(x,y){let I=y?.timeout||3e4,D=y?.responseType||"json",{timeout:C,responseType:U,...N}=y||{},M=null,O=null;try{N.signal||(M=new AbortController,O=setTimeout(()=>M.abort(),I));let P=await fetch(x,{...N,signal:N.signal||M.signal});O&&clearTimeout(O);let $;switch(D){case "arrayBuffer":$=await P.arrayBuffer();break;case "blob":$=await P.blob();break;case "buffer":{let X=await P.arrayBuffer();$=Buffer.from(X);break}case "text":$=await P.text();break;default:{let X=await P.text();try{$=JSON.parse(X);}catch{$=X;}break}}return {ok:P.ok,status:P.status,statusText:P.statusText,headers:P.headers,data:$,url:P.url}}catch(P){throw O&&clearTimeout(O),P}}async function c(x,y){let I=y?.retries??0,D=y?.retryDelay??1e3,{retries:C,retryDelay:U,responseType:N,...M}=y||{};return nt(()=>f(x,{...M,responseType:y?.responseType}),{attempts:I+1,delay:D,maxDelay:D*2**(I+1)})}async function u(x,y){return c(x,{method:"GET",...y})}T.get=u;async function d$1(x,y,I){return c(x,{method:"POST",headers:{"Content-Type":"application/json",...I?.headers},body:y?JSON.stringify(y):void 0,...I})}T.post=d$1;async function h(x,y,I){return c(x,{method:"PUT",headers:{"Content-Type":"application/json",...I?.headers},body:y?JSON.stringify(y):void 0,...I})}T.put=h;async function k(x,y,I){return c(x,{method:"DELETE",headers:{"Content-Type":"application/json",...I?.headers},body:y?JSON.stringify(y):void 0,...I})}T.del=k;async function v(x,y,I){return c(x,{method:"PATCH",headers:{"Content-Type":"application/json",...I?.headers},body:y?JSON.stringify(y):void 0,...I})}T.patch=v;async function p(x,y){return c(x,y)}T.request=p;function g(x={}){return o()?(a(x),true):false}T.autoProxy=g;let R=5*1024*1024;function F(x){return new TextEncoder().encode(x)}function z(x){return d.mimeType(x)}function L(x){return x.startsWith("file://")}async function E(x){let y=fileURLToPath(x);return await D.file(y).bytes()}async function A(x,y,I){let D=`----FetchFormBoundary${Date.now()}`,C=[],N=y.some(_=>_.filename||_.value instanceof Uint8Array||Buffer.isBuffer(_.value))&&!I?.timeout?3e5:I?.timeout;for(let _ of y){let q=_.maxSize??R,G=_.filename,ee=`Content-Disposition: form-data; name="${_.name}"${G?`; filename="${G}"`:""}`;G&&(ee+=`\r
|
|
57
|
-
Content-Type: ${z(G)}`),ee+=`\r
|
|
15
|
+
How to override: export them in the shell before loadEnv() runs, or set process.env directly.`);}}}f();async function Et(t,e){if(process.env.EASBOT_CLIENT==="acp")try{let l=process.platform==="win32"?"cmd":void 0,y=G.spawn(l,`git ${t.join(" ")}`,{stdin:void 0,stdout:"pipe",stderr:"pipe",cwd:e.cwd,env:e.env?{...process.env,...e.env}:process.env}),[o,u,b]=await Promise.all([y.exited,new Response(y.stdout).arrayBuffer(),new Response(y.stderr).arrayBuffer()]),w=Buffer.from(u),S=Buffer.from(b);return {exitCode:o,text:()=>w.toString(),stdout:w,stderr:S}}catch(l){let y=Buffer.from(l instanceof Error?l.message:String(l));return {exitCode:1,text:()=>"",stdout:Buffer.alloc(0),stderr:y}}let r=e.env?{...process.env,...e.env}:void 0,n=G.$`git ${t.join(" ")}`.quiet().nothrow().cwd(e.cwd);r&&(n=n.env(r));let s=await n;return {exitCode:s.exitCode,text:()=>s.text(),stdout:s.stdout,stderr:s.stderr}}f();function He(t){return t?dirname(fileURLToPath(t)):typeof d$1<"u"?d$1:process.cwd()}function je(t,e,r=3){function n(s,l){if(l>r||!existsSync(s))return null;try{let y=readdirSync(s);for(let o of y){let u=join(s,o);try{let b=statSync(u);if(b.isFile()&&u.endsWith(e))return u;if(b.isDirectory()&&l<r){let w=n(u,l+1);if(w)return w}}catch{}}}catch{}return null}return n(t,0)}function ze(t,e){let r=join(t,e);if(existsSync(r))return r;let n=e.split("/").pop()||e,s=t;for(let l=0;l<5;l++){let y=join(s,"assets","txt");if(existsSync(y)){let b=je(y,n,5);if(b)return b}let o=join(s,"dist","assets","txt");if(existsSync(o)){let b=je(o,n,5);if(b)return b}let u=join(s,"..");if(u===s)break;s=u;}return r}function kt(t,e){return c$1.lazy(()=>{try{let r=He(e),n=ze(r,t);return D.file(n).textSync()}catch(r){throw console.error(`Failed to load text file: ${t}`,r),r}})}function Ot(t,e){return c$1.lazy(async()=>{try{let r=He(e),n=ze(r,t);return await D.file(n).text()}catch(r){throw console.error(`Failed to load text file: ${t}`,r),r}})}f();function vt(t){return t()}f();function _t(t){if(!t||typeof t!="string")return {provider:"",model:""};let e=t.indexOf("/");return e===-1?{provider:"",model:t}:{provider:t.substring(0,e),model:t.substring(e+1)}}f();var Se;($=>{$.FILE_REGEX=/(?<![\w`])#(\S+)/g,$.SHELL_REGEX=/!`([^`]+)`/g;function r(a){return Array.from(a.matchAll($.FILE_REGEX))}$.files=r;function n(a){return Array.from(a.matchAll($.SHELL_REGEX))}$.shell=n;function s(a){if(!a||typeof a!="string")return typeof a=="string"?a:"";let x=a.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!x)return a;let f=x[0],c=(x[1]??"").split(`
|
|
16
|
+
`),p=[];for(let P of c){if(P.trim().startsWith("#")||P.trim()===""){p.push(P);continue}if(P.match(/^\s+/)){p.push(P);continue}let D=P.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*:\s*(.*)$/);if(!D){p.push(P);continue}let N=D[1],E=D?.[2]?.trim();if(E===""||E===">"||E==="|"||E?.startsWith('"')||E?.startsWith("'")){p.push(P);continue}if(E?.includes(":")){p.push(`${N}: |-`),p.push(` ${E}`);continue}p.push(P);}let T=p.join(`
|
|
17
|
+
`);return a.replace(f,`---
|
|
18
|
+
${T}
|
|
19
|
+
---`)}$.fallbackSanitization=s;function l(a){if(typeof a!="string")return null;if(!a)return {data:{},content:""};try{let x=de(a);return {data:x.data??{},content:x.content??""}}catch{try{let x=de(s(a));return {data:x.data??{},content:x.content??""}}catch{return null}}}async function y(a){let x=await readFile(a,"utf-8"),f=l(x);if(!f){let d=`${a}: Failed to parse YAML frontmatter`;throw new $.FrontmatterError({path:a,message:d},{cause:new Error(d)})}return f}$.parse=y;function o(a){if(!a||typeof a!="string")return {frontmatter:{},content:typeof a=="string"?a:""};let x=l(a);return x?{frontmatter:x.data,content:x.content}:{frontmatter:{},content:a}}$.extractFrontmatter=o;function u(a,x){let f=a??"";return !x||Object.keys(x).length===0?de.stringify(f,void 0):de.stringify(f,x)}$.format=u,$.FrontmatterError=oe.create("ConfigFrontmatterError",z.object({path:z.string(),message:z.string()}));function w(a,x){return S(a,x)}$.replaceVariables=w;function S(a,x){return R(a,x)}$.renderTemplate=S;function R(a,x){let f=a;return f=m(f,x),f=i(f,x),f=C(f,x),f=_(f,x),f=f.replace(/\{\{([^}]*)\}\}/g,(d,c)=>{let p=c.trim();if(!p)return "";let T=pe(p,x);return T!==void 0?String(j(T)):""}),f}function m(a,x){let f=a.replace(/\{\{#if\s+\((eq|ne|gt|lt|gte|lte)\s+([^)]+)\)\}\}([\s\S]*?)\{\{(?:else)\}\}([\s\S]*?)\{\{\/if\}\}/g,(d,c,p,T,P)=>{if(!c||!p||!T||!P)return d;let{a:D,b:N}=A(p,x);return D===void 0||N===void 0?d:I(c,D,N)?T:P});return f=f.replace(/\{\{#if\s+\((eq|ne|gt|lt|gte|lte)\s+([^)]+)\)\}\}([\s\S]*?)\{\{\/if\}\}/g,(d,c,p,T)=>{if(!c||!p||!T)return d;let{a:P,b:D}=A(p,x);return P===void 0||D===void 0?d:I(c,P,D)?T:""}),f}function A(a,x){let f=/"([^"]*)"|(\w+(?:\.\w+|\[\d+\])*)/g,d=[],c;for(;(c=f.exec(a))!==null;)c[1]!==void 0?d.push(c[1]):c[2]!==void 0&&d.push(c[2]);if(d.length<2)return {a:void 0,b:void 0};let p=pe(d[0],x),T=pe(d[1],x);return {a:p,b:T}}function I(a,x,f){switch(a){case "eq":return x===f;case "ne":return x!==f;case "gt":return Number(x)>Number(f);case "lt":return Number(x)<Number(f);case "gte":return Number(x)>=Number(f);case "lte":return Number(x)<=Number(f);default:return false}}function i(a,x){let f=a.replace(/\{\{#unless\s+(\w+)\}\}([\s\S]*?)\{\{(?:else)\}\}([\s\S]*?)\{\{\/unless\}\}/g,(d,c,p,T)=>{if(!c||!p||!T)return d;let P=x[c];return h(P)?p:T});return f=f.replace(/\{\{#unless\s+(\w+)\}\}([\s\S]*?)\{\{\/unless\}\}/g,(d,c,p)=>{if(!c||!p)return d;let T=x[c];return h(T)?p:""}),f}function h(a){return a==null||a===false||a===""}function _(a,x){let f=a.replace(/\{\{#if\s+(\w+)\}\}([\s\S]*?)\{\{(?:else)\}\}([\s\S]*?)\{\{\/if\}\}/g,(d,c,p,T)=>{if(!c||!p||!T)return d;let P=c in x?x[c]:void 0;return h(P)?T:p});return f=f.replace(/\{\{#if\s+(\w+)\}\}([\s\S]*?)\{\{\/if\}\}/g,(d,c,p)=>{if(!c||!p)return d;let T=c in x?x[c]:void 0;return h(T)?"":p}),f}function C(a,x){let f=a.match(/\{\{#each\s+([\w.]+)\}\}/);if(!f?.[1])return a;let d=f[1],c=pe(d,x),p=f[0],T=f.index,P=a.slice(T+p.length),D;if(Array.isArray(c))D=c.map((B,z)=>({key:String(z),value:B}));else if(c!==null&&typeof c=="object")D=Object.entries(c).map(([B,z])=>({key:B,value:z}));else return U(a,T,p,P);let N=1,E=-1,F=/\{\{#each\s+[\w.]+\}\}|\{\{\/each\}\}/g,k;for(F.lastIndex=0;(k=F.exec(P))!==null;)if(k[0].startsWith("{{#each"))N++;else if(N--,N===0){E=k.index;break}if(E===-1)return a;let H=P.slice(0,E),V=a.slice(T,T+p.length+E+"{{/each}}".length);if(D.length===0)return a.replace(V,"");let M=D.map(({key:B,value:z},J)=>{let L={...x};return typeof z=="object"&&z!==null?(Object.assign(L,z),L.this=z,L["@value"]=z,L["@index"]=J,L["@key"]=B):(L.this=z,L["@value"]=z,L["@index"]=J,L["@key"]=B),R(H,L)});return a.replace(V,M.join(""))}function U(a,x,f,d,c){let p=/\{\{#each\s+[\w.]+\}\}|\{\{\/each\}\}/g,T=1,P=-1,D;for(p.lastIndex=0;(D=p.exec(d))!==null;)if(D[0].startsWith("{{#each"))T++;else if(T--,T===0){P=D.index;break}if(P===-1)return a;let E=a.slice(x,x+f.length+P+"{{/each}}".length);return a.replace(E,"")}function j(a){return a instanceof Date?b$1(a):Array.isArray(a)?a.map(j).join(", "):a!==null&&typeof a=="object"?JSON.stringify(a,null,2):String(a)}$.formatVariableValue=j;})(Se||(Se={}));function pe(t,e){let r=/(@\w+)|(\w+)|\[(\d+)\]/g,n=e,s;for(;(s=r.exec(t))!==null;){if(n==null)return;if(s[1]!==void 0){let l=s[1];n=e[l];}else if(s[2]!==void 0){let l=s[2];if(typeof n=="object"&&n!==null)n=n[l];else return}else if(s[3]!==void 0){let l=Number(s[3]);if(Array.isArray(n)&&l>=0&&l<n.length)n=n[l];else return}}return n}f();function Ue(t){if(!t)return "";let r=t.replace(/[/\\]+$/,"").split(/[/\\]/);return r[r.length-1]??""}function Dt(t){if(!t)return "";let r=t.replace(/[/\\]+$/,"").split(/[/\\]/);return r.slice(0,r.length-1).join("/")+"/"}function It(t){if(!t)return "";let e=t.split(".");return e[e.length-1]}function Nt(t,e=20){let r=Ue(t);if(r.length<=e)return r;let n=r.lastIndexOf("."),s=n<=0?"":r.slice(n),l=e-s.length-1;return l<=0?r.slice(0,e-1)+"\u2026":r.slice(0,l)+"\u2026"+s}function Ft(t,e=20){if(t.length<=e)return t;let r=e-1,n=Math.ceil(r/2),s=Math.floor(r/2);return t.slice(0,n)+"\u2026"+t.slice(-s)}f();var Lt=["load failed","network connection was lost","network request failed","failed to fetch","econnreset","econnrefused","etimedout","socket hang up"];function Ct(t){if(!t)return false;let e=String(t instanceof Error?t.message:t).toLowerCase();return Lt.some(r=>e.includes(r))}async function Ae(t,e={}){let{attempts:r=3,delay:n=500,factor:s=2,maxDelay:l=1e4,retryIf:y=Ct}=e,o;for(let u=0;u<r;u++)try{return await t()}catch(b){if(o=b,u===r-1||!y(b))throw b;let w=Math.min(n*s**u,l);await new Promise(S=>setTimeout(S,w));}throw o}f();var ke;(f=>{let t=m.create({service:"fetch"}),e=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"],r=false,n=null;function s(){return e.some(d=>{let c=process.env[d];return typeof c=="string"&&c.trim().length>0})}f.hasProxyConfigured=s;function l(){let d=process.env.http_proxy||process.env.HTTP_PROXY;return process.env.https_proxy||process.env.HTTPS_PROXY||d}f.getProxyUrl=l;function y(d={}){let c=d.httpProxy||d.httpsProxy||l();if(!c){t.warn("[Fetch] No proxy configured, HTTP_PROXY/HTTPS_PROXY environment variables not set");return}let p=new ProxyAgent({uri:c,connectTimeout:d.connectTimeout||1e4,keepAliveTimeout:d.keepAliveTimeout||3e4});n=getGlobalDispatcher(),setGlobalDispatcher(p),r=true,t.info(`[Fetch] Global proxy enabled: ${c}`);}f.enableProxy=y;function o(){!r||!n||(setGlobalDispatcher(n),r=false,n=null,t.info("[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u7981\u7528"));}f.disableProxy=o;function u(){return r}f.isProxyEnabled=u;async function b(d,c){let p=c?.timeout||3e4,T=c?.responseType||"json",{timeout:P,responseType:D,...N}=c||{},E=null,F=null;try{N.signal||(E=new AbortController,F=setTimeout(()=>E.abort(),p));let k=await fetch(d,{...N,signal:N.signal||E.signal});F&&clearTimeout(F);let H;switch(T){case "arrayBuffer":H=await k.arrayBuffer();break;case "blob":H=await k.blob();break;case "buffer":{let W=await k.arrayBuffer();H=Buffer.from(W);break}case "text":H=await k.text();break;default:{let W=await k.text();try{H=JSON.parse(W);}catch{H=W;}break}}return {ok:k.ok,status:k.status,statusText:k.statusText,headers:k.headers,data:H,url:k.url}}catch(k){throw F&&clearTimeout(F),k}}async function w(d,c){let p=c?.retries??0,T=c?.retryDelay??1e3,{retries:P,retryDelay:D,responseType:N,...E}=c||{};return Ae(()=>b(d,{...E,responseType:c?.responseType}),{attempts:p+1,delay:T,maxDelay:T*2**(p+1)})}async function S(d,c){return w(d,{method:"GET",...c})}f.get=S;async function R(d,c,p){return w(d,{method:"POST",headers:{"Content-Type":"application/json",...p?.headers},body:c?JSON.stringify(c):void 0,...p})}f.post=R;async function m$1(d,c,p){return w(d,{method:"PUT",headers:{"Content-Type":"application/json",...p?.headers},body:c?JSON.stringify(c):void 0,...p})}f.put=m$1;async function A(d,c,p){return w(d,{method:"DELETE",headers:{"Content-Type":"application/json",...p?.headers},body:c?JSON.stringify(c):void 0,...p})}f.del=A;async function I(d,c,p){return w(d,{method:"PATCH",headers:{"Content-Type":"application/json",...p?.headers},body:c?JSON.stringify(c):void 0,...p})}f.patch=I;async function i(d,c){return w(d,c)}f.request=i;function h(d={}){return s()?(y(d),true):false}f.autoProxy=h;let _=5*1024*1024;function C(d){return new TextEncoder().encode(d)}function U(d$1){return d.mimeType(d$1)}function j(d){return d.startsWith("file://")}async function $(d){let c=fileURLToPath(d);return await D.file(c).bytes()}async function a(d,c,p){let T=`----FetchFormBoundary${Date.now()}`,P=[],N=c.some(M=>M.filename||M.value instanceof Uint8Array||Buffer.isBuffer(M.value))&&!p?.timeout?3e5:p?.timeout;for(let M of c){let B=M.maxSize??_,z=M.filename,J=`Content-Disposition: form-data; name="${M.name}"${z?`; filename="${z}"`:""}`;z&&(J+=`\r
|
|
20
|
+
Content-Type: ${U(z)}`),J+=`\r
|
|
58
21
|
\r
|
|
59
|
-
`,
|
|
60
|
-
--${
|
|
61
|
-
--${
|
|
62
|
-
`),
|
|
63
|
-
`));for(let
|
|
64
|
-
`)));
|
|
65
|
-
`)
|
|
66
|
-
`)}
|
|
22
|
+
`,P.push(C(J));let L=M.value;if(typeof L=="string")if(j(L)){let ge=await $(L);if(z||(z=L.split("/").pop()||"file"),ge.byteLength>B)throw new Error(`File size ${ge.byteLength} exceeds limit ${B} bytes: ${z}`);P.push(ge);}else P.push(C(L));else if(Buffer.isBuffer(L)){if(L.byteLength>B)throw new Error(`Buffer size ${L.byteLength} exceeds limit ${B} bytes: ${M.name}`);P.push(new Uint8Array(L.buffer,L.byteOffset,L.byteLength));}else if(L instanceof Uint8Array){if(L.byteLength>B)throw new Error(`File size ${L.byteLength} exceeds limit ${B} bytes: ${M.name}`);P.push(L);}}let E=C(`\r
|
|
23
|
+
--${T}--`),F=C(`\r
|
|
24
|
+
--${T}\r
|
|
25
|
+
`),k=[];k.push(C(`--${T}\r
|
|
26
|
+
`));for(let M=0;M<P.length;M++)k.push(P[M]),M%2===1&&M<P.length-1&&(k.push(F),k.push(C(`--${T}\r
|
|
27
|
+
`)));k.push(E);let H=k.reduce((M,B)=>M+B.length,0),W=new Uint8Array(H),V=0;for(let M of k)W.set(M,V),V+=M.length;return w(d,{method:"POST",headers:{"Content-Type":`multipart/form-data; boundary=${T}`,...p?.headers},body:W,timeout:N,...p})}f.postForm=a;function x(d,c,p){let T=new AbortController,P=T.signal;return (async()=>{try{let N={Accept:"text/event-stream",...p?.headers||{}},E=await fetch(d,{...p,headers:N,signal:P});if(!E.ok)throw new Error(`SSE connection failed: ${E.status}`);let F=E.body?.getReader();if(!F)throw new Error("SSE stream not available");let k=new TextDecoder("utf-8"),H="";for(;!P.aborted;){let{done:W,value:V}=await F.read();if(W)break;let M=k.decode(V,{stream:!0});H+=M;let B=H.split(`
|
|
28
|
+
`);H=B.pop()??"";for(let z of B)if(z.startsWith("data: ")){let J=z.slice(6);if(J==="[DONE]"){c.onComplete?.();return}c.onMessage?.(J);}}c.onComplete?.();}catch(N){N.name!=="AbortError"&&c.onError?.(N);}})(),()=>{T.abort();}}f.sse=x;})(ke||(ke={}));f();var Oe;(n=>{let t=["brave","calm","clever","cosmic","crisp","curious","eager","gentle","glowing","happy","hidden","jolly","kind","lucky","mighty","misty","neon","nimble","playful","proud","quick","quiet","shiny","silent","stellar","sunny","swift","tidy","witty"],e=["cabin","cactus","canyon","circuit","comet","eagle","engine","falcon","forest","garden","harbor","island","knight","lagoon","meadow","moon","mountain","nebula","orchid","otter","panda","pixel","planet","river","rocket","sailor","squid","star","tiger","wizard","wolf"];function r(){return [t[Math.floor(Math.random()*t.length)],e[Math.floor(Math.random()*e.length)]].join("-")}n.create=r;})(Oe||(Oe={}));f();function Ge(t){let e=new AbortController,r=setTimeout(e.abort.bind(e),t);return {controller:e,signal:e.signal,clearTimeout:()=>globalThis.clearTimeout(r)}}function zt(t,...e){let r=Ge(t);return {signal:AbortSignal.any([r.signal,...e]),clearTimeout:r.clearTimeout}}f();var ve;(e=>{async function t(r,n){if(process.platform==="win32"){let s=Pe.resolve(r),l=Pe.resolve(n),y=`Expand-Archive -Path '${s}' -DestinationPath '${l}' -Force`,o=await G.run("powershell",`-NoProfile -NonInteractive -Command "$global:ProgressPreference = 'SilentlyContinue'; ${y}"`);if(o.code!==0)throw new Error(`PowerShell exited with code ${o.code}: ${o.stderr}`)}else {let s=`unzip -o -q ${r} -d ${n}`,l=await G.run(void 0,s);if(l.code!==0)throw new Error(`unzip exited with code ${l.code}: ${l.stderr}`)}}e.extractZip=t;})(ve||(ve={}));f();var _e;(n=>{function t(s){return s?/^#[0-9a-fA-F]{6}$/.test(s):false}n.isValidHex=t;function e(s){let l=parseInt(s.slice(1,3),16),y=parseInt(s.slice(3,5),16),o=parseInt(s.slice(5,7),16);return {r:l,g:y,b:o}}n.hexToRgb=e;function r(s){if(!t(s))return;let{r:l,g:y,b:o}=e(s);return `\x1B[38;2;${l};${y};${o}m\x1B[1m`}n.hexToAnsiBold=r;})(_e||(_e={}));f();var $e;(r=>{class t extends Error{constructor(l){super(`No context found for ${l}`);c(this,"name",l);}}r.NotFound=t;function e(n){let s=new AsyncLocalStorage;return {use(){let l=s.getStore();if(!l)throw new t(n);return l},provide(l,y){return s.run(l,y)}}}r.create=e;})($e||($e={}));f();function Bt(t){return {[Symbol.dispose](){t();},[Symbol.asyncDispose](){return Promise.resolve(t())}}}f();var De;(e=>{async function t(){return new Promise(r=>{let n=()=>{process._getActiveHandles().length===0&&process._getActiveRequests().length===0?r():setImmediate(n);};n();})}e.wait=t;})(De||(De={}));f();function Gt(t){if(t<=0)return "";if(t<60)return `${t}s`;if(t<3600){let r=Math.floor(t/60),n=t%60;return n>0?`${r}m ${n}s`:`${r}m`}if(t<86400){let r=Math.floor(t/3600),n=Math.floor(t%3600/60);return n>0?`${r}h ${n}m`:`${r}h`}if(t<604800){let r=Math.floor(t/86400);return r===1?"~1 day":`~${r} days`}let e=Math.floor(t/604800);return e===1?"~1 week":`~${e} weeks`}f();var Ie;(I=>{let t=m.create({service:"grep"});async function e(){return r()}I.filepath=e;let r=b(async()=>{let i=await D.which("rg");if(!i)return null;try{if(!(await ie.stat(i)).isFile())return null}catch{return null}try{let h=await D.run([i,"--version"],{timeout:5e3});if(h.code!==0||!h.stdout.startsWith("ripgrep "))return t.warn("rg failed self-test, falling back to pure JS",{filepath:i,code:h.code,stderr:h.stderr.slice(0,200)}),null}catch(h){return t.warn("rg spawn failed during self-test, falling back to pure JS",{filepath:i,error:h.message.slice(0,200)}),null}return i});async function n(){return await e()!==null}I.isUsingRipgrep=n;async function*s(i){i.signal?.throwIfAborted();let h=await e();h?yield*l(h,i):(t.debug("ripgrep not available, using pure JS fallback for files()",{cwd:i.cwd}),yield*y(i));}I.files=s;async function*l(i,h){h.signal?.throwIfAborted();let _=["--files","--glob=!.git/*"];h.follow&&_.push("--follow");let C=h.hidden!==false;if(h.maxDepth!==void 0&&_.push(`--max-depth=${h.maxDepth}`),h.glob)for(let $ of h.glob)_.push(`--glob=${$}`);try{if(!(await ie.stat(h.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${h.cwd}'`),{code:"ENOTDIR",errno:-20,path:h.cwd})}catch($){throw $.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${h.cwd}'`),{code:"ENOENT",errno:-2,path:h.cwd}):$}let U=await D.run([i,..._],{cwd:h.cwd});if(U.code!==0&&U.code!==1)return;let j=U.stdout.split(/\r?\n/);for(let $ of j){h.signal?.throwIfAborted();let a=$.trim();if(!a)continue;let x=d.toUnixPath(a);!C&&x.split("/").some(f=>f.startsWith("."))||(yield x);}}async function*y(i){i.signal?.throwIfAborted();try{if(!(await ie.stat(i.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${i.cwd}'`),{code:"ENOTDIR",errno:-20,path:i.cwd})}catch(f){throw f.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${i.cwd}'`),{code:"ENOENT",errno:-2,path:i.cwd}):f}let h=[],_=[];if(i.glob)for(let f of i.glob)f.startsWith("!")?_.push(f.slice(1)):h.push(f);let C=h.length>0?h:["**/*"],U=i.hidden!==false,j=new Set,$=b$2.DEFAULT_MAX_DEPTH,a;i.maxDepth===void 0?a=$:i.maxDepth<0?a=1:a=i.maxDepth+1;let x=Math.min(Math.max(a,1),$);for(let f of C){i.signal?.throwIfAborted();let d=await b$2.scan(f,{cwd:i.cwd,absolute:false,include:"file",dot:U,symlink:i.follow??false,maxDepth:x,ignore:_});for(let c of d)!U&&c.split("/").some(p=>p.startsWith("."))||j.add(c);}for(let f of Array.from(j).sort())i.signal?.throwIfAborted(),yield f;i.signal?.throwIfAborted();}async function o(i){t.debug("tree",{cwd:i.cwd}),i.signal?.throwIfAborted();let h=i.hidden!==false,_=i.glob??[],C=_.filter(E=>!E.startsWith("!")),U=_.filter(E=>E.startsWith("!")).map(E=>E.slice(1)),j=C.length>0?C:["**/*"],$=new Set,a=[];for(let E of j){i.signal?.throwIfAborted();let F=await b$2.scan(E,{cwd:i.cwd,absolute:false,include:"file",dot:h,symlink:false,maxDepth:b$2.DEFAULT_MAX_DEPTH});for(let k of F)$.has(k)||($.add(k),a.push(k));}let x=a.filter(E=>{for(let F of U)if(b$2.match(F,E))return false;return true});function f(E,F){let k=E.children.get(F);if(k)return k;let H={name:F,children:new Map};return E.children.set(F,H),H}let d={children:new Map};for(let E of x){let F=E.split("/");if(F.length<2)continue;let k=d;for(let H of F.slice(0,-1))k=f(k,H);}let c=Array.from(d.children.values()).sort((E,F)=>E.name.localeCompare(F.name)),p=i.limit??Number.POSITIVE_INFINITY,T=[],P=c.map(E=>({node:E,path:E.name})),D=0,N=0;for(;P.length>0;){let E=P.shift();if(!E)break;if(D++,N<p){T.push(E.path),N++;for(let F of Array.from(E.node.children.values()).sort((k,H)=>k.name.localeCompare(H.name))){if(N>=p)break;P.push({node:F,path:`${E.path}/${F.name}`});}}}return D>N&&T.push(`[${N}/${D} shown, ${D-N} truncated]`),T.join(`
|
|
29
|
+
`)}I.tree=o;async function u(i){let h=await e();return h?b$1(h,i):(t.debug("ripgrep not available, using pure JS fallback for search()",{cwd:i.cwd,pattern:i.pattern}),w(i))}I.search=u;async function b$1(i,h){let _=["--json","--glob=!.git/*"];if(h.follow&&_.push("--follow"),h.glob)for(let a of h.glob)_.push(`--glob=${a}`);h.limit&&_.push(`--max-count=${h.limit}`),_.push("--"),_.push(h.pattern);let C=await D.run([i,..._],{cwd:h.cwd});if(C.code!==0)return [];let U=h.hidden!==false,j=C.stdout.split(/\r?\n/).filter(Boolean),$=[];for(let a of j)try{let x=JSON.parse(a);if(x?.type!=="match")continue;let f=x.data;if(!f?.path?.text||!f?.lines?.text)continue;let d$1=d.toUnixPath(f.path.text);if(!U&&d$1.split("/").some(c=>c.startsWith(".")))continue;if($.push({path:d$1,lines:f.lines.text,line_number:f.line_number,absolute_offset:f.absolute_offset??0}),h.limit&&$.length>=h.limit)break}catch{}return $}async function w(i){let h;try{h=new RegExp(i.pattern);}catch{return []}try{if(!(await ie.stat(i.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${i.cwd}'`),{code:"ENOTDIR",errno:-20,path:i.cwd})}catch(f){throw f.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${i.cwd}'`),{code:"ENOENT",errno:-2,path:i.cwd}):f}let _=[],C=[];if(i.glob)for(let f of i.glob)f.startsWith("!")?C.push(f.slice(1)):_.push(f);let U=i.hidden!==false,j=[],$=_.length>0?_:["**/*"],a=new Set,x=[];for(let f of $){i.signal?.throwIfAborted();let d=await b$2.scan(f,{cwd:i.cwd,absolute:false,include:"file",dot:U,symlink:i.follow??false,maxDepth:void 0,ignore:C});for(let c of d)a.has(c)||(a.add(c),x.push(c));}for(let f of x){if(i.signal?.throwIfAborted(),i.limit&&j.length>=i.limit)break;let d$1=d.join(i.cwd,f),c;try{c=await ie.readFile(d$1,"utf-8");}catch{continue}let p=c.split(/\r?\n/),T=0;for(let P=0;P<p.length;P++){let D=p[P]??"";if(h.test(D)&&(j.push({path:f,lines:D,line_number:P+1,absolute_offset:T}),i.limit&&j.length>=i.limit))break;T+=Buffer.byteLength(D,"utf-8")+1;}}return j}function S(i,h){return a$1.match(i,h)}I.match=S;let R=a(async()=>await e());async function m$1(){return await R()}I.filepathCached=m$1,I._ready=a(async()=>{let i=await e();return t.debug("Grep initialized",{ripgrep:i?"available":"fallback (pure JS)"}),i});})(Ie||(Ie={}));f();var Ne;(y=>{function t(o,u){if(o===u)return true;if(typeof o!="object"||typeof u!="object"||o===null||u===null)return false;let b=Object.keys(o),w=Object.keys(u);if(b.length!==w.length)return false;for(let S of b)if(!w.includes(S)||!t(o[S],u[S]))return false;return true}function e(o){return {...o,super:o.super??false}}function r(o,u){return o?t(e(o),e(u)):false}y.match=r;function n(o,u=false){return {name:o.name,ctrl:o.ctrl,meta:o.meta,shift:o.shift,super:o.super??false,leader:u}}y.fromParsedKey=n;function s(o){if(!o)return "";let u=[];o.ctrl&&u.push("ctrl"),o.meta&&u.push("alt"),o.super&&u.push("super"),o.shift&&u.push("shift"),o.name&&(o.name==="delete"?u.push("del"):u.push(o.name));let b=u.join("+");return o.leader&&(b=b?`<leader> ${b}`:"<leader>"),b}y.keyToString=s;function l(o){return o==="none"?[]:o.split(",").map(u=>{let w=u.replace(/<leader>/g,"leader+").toLowerCase().split("+"),S={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let R of w)switch(R){case "ctrl":S.ctrl=true;break;case "alt":case "meta":case "option":S.meta=true;break;case "super":S.super=true;break;case "shift":S.shift=true;break;case "leader":S.leader=true;break;case "esc":S.name="escape";break;default:S.name=R;break}return S})}y.parse=l;})(Ne||(Ne={}));f();var ee;(R=>{R.SUPPORTED_LANGS=["zh-CN","en-US"],R.DEFAULT_LANG="zh-CN";function r(m,A="EASBOT_LANG"){let I=[m,process.env[A]?.trim()];for(let i of I)if(i&&R.SUPPORTED_LANGS.includes(i))return i;return R.DEFAULT_LANG}R.resolveLocaleLang=r;function n(m){return m.replace(/\b\w/g,A=>A.toUpperCase())}R.titlecase=n;function s(m){return new Date(m).toLocaleTimeString(void 0,{timeStyle:"short"})}R.time=s;function l(m){let A=new Date(m),I=s(m),i=A.toLocaleDateString();return `${I} \xB7 ${i}`}R.datetime=l;function y(m){let A=new Date(m),I=new Date;return A.getFullYear()===I.getFullYear()&&A.getMonth()===I.getMonth()&&A.getDate()===I.getDate()?s(m):l(m)}R.todayTimeOrDateTime=y;function o(m){return m>=1e6?(m/1e6).toFixed(1)+"M":m>=1e3?(m/1e3).toFixed(1)+"K":m.toString()}R.number=o;function u(m){if(m<1e3)return `${m}ms`;if(m<6e4)return `${(m/1e3).toFixed(1)}s`;if(m<36e5){let i=Math.floor(m/6e4),h=Math.floor(m%6e4/1e3);return `${i}m ${h}s`}if(m<864e5){let i=Math.floor(m/36e5),h=Math.floor(m%36e5/6e4);return `${i}h ${h}m`}let A=Math.floor(m/36e5);return `${Math.floor(m%36e5/864e5)}d ${A}h`}R.duration=u;function b(m,A){return m.length<=A?m:m.slice(0,A-1)+"\u2026"}R.truncate=b;function w(m,A=35){if(m.length<=A)return m;let I="\u2026",i=Math.ceil((A-I.length)/2),h=Math.floor((A-I.length)/2);return m.slice(0,i)+I+m.slice(-h)}R.truncateMiddle=w;function S(m,A,I){return (m===1?A:I).replace("{}",m.toString())}R.pluralize=S;})(ee||(ee={}));var qt=ee.resolveLocaleLang,Wt=ee.SUPPORTED_LANGS,Xt=ee.DEFAULT_LANG;f();var Jt=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"];function Yt(){return Jt.some(t=>process.env[t])}function Zt(){return process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy}function Vt(){let t=process.env.HTTP_PROXY||process.env.http_proxy,e=process.env.HTTPS_PROXY||process.env.https_proxy;return {http:t,https:e,enabled:!!(t||e)}}f();var Fe=class{constructor(){c(this,"queue",[]);c(this,"resolvers",[]);}push(e){let r=this.resolvers.shift();r?r(e):this.queue.push(e);}async next(){return this.queue.length>0?this.queue.shift():new Promise(e=>this.resolvers.push(e))}async*[Symbol.asyncIterator](){for(;;)yield await this.next();}};async function Kt(t,e,r){let n=[...e];await Promise.all(Array.from({length:t},async()=>{for(;;){let s=n.pop();if(s===void 0)return;await r(s);}}));}f();function Qt(){let t,e=new Promise(r=>t=r);return {trigger(){return t()},wait(){return e}}}f();function er(t,e){let r;return Promise.race([t.then(n=>(clearTimeout(r),n)),new Promise((n,s)=>{r=setTimeout(()=>{s(new Error(`Operation timed out after ${e}ms`));},e);})])}f();var Le;(y=>{let r=/[\u4e00-\u9fff\u3400-\u4dbf]/g;function n(o){if(!o)return 0;let u=String(o),b=(u.match(r)||[]).length,w=u.length-b,S=Math.round(b/1.5),R=Math.round(w/4);return Math.max(0,S+R)}y.estimate=n;function s(o){if(o==null)return 0;try{let u=typeof o=="string"?o:JSON.stringify(o);return n(u)}catch{return 0}}y.estimateObject=s;function l(o){if(o.total!==void 0&&o.total>0)return o.total;let u=o.input??0,b=o.output??0,w=o.cache?.read??0,S=o.cache?.write??0;return u+b+w+S}y.total=l;})(Le||(Le={}));f();function rr(t){let e={},r=t.shape??t.required().shape;for(let[n,s]of Object.entries(r))e[n]=s.nullable().optional();return ue.object(e)}export{ve as Archive,Fe as AsyncQueue,he as Binary,_e as Color,$e as Context,Xt as DEFAULT_LANG,xe as Encode,De as EventLoop,ke as Fetch,Ee as Fn,Ie as Grep,Z as Identifier,we as Ignore,Ne as Keybind,ee as Locale,Se as Markdown,oe as NamedError,Wt as SUPPORTED_LANGS,be as SessionTitle,Oe as Slug,Le as Token,ye as TruncateContent,Ge as abortAfter,zt as abortAfterAny,Bt as defer,gt as findLast,yt as fn,Gt as formatDuration,Dt as getDirectory,It as getFileExtension,Ue as getFilename,Nt as getFilenameTruncated,Vt as getProxyConfig,Zt as getProxyUrl,Et as git,vt as iife,Tt as loadEnv,kt as loadTextFile,Ot as loadTextFileAsync,_t as parseModelId,Yt as proxied,qt as resolveLocaleLang,Ae as retry,Qt as signal,Ft as truncateMiddle,rr as updateSchema,er as withTimeout,Kt as work};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easbot/utils",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"description": "Shared utilities library for EASBOT ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -46,7 +46,9 @@
|
|
|
46
46
|
"@hono/standard-validator": "^0.2.2",
|
|
47
47
|
"@hono/zod-validator": "^0.7.6",
|
|
48
48
|
"dotenv": "^17.4.2",
|
|
49
|
+
"picocolors": "1.1.1",
|
|
49
50
|
"glob": "^13.0.6",
|
|
51
|
+
"gray-matter": "^4.0.3",
|
|
50
52
|
"hono": "^4.12.18",
|
|
51
53
|
"hono-openapi": "^1.3.0",
|
|
52
54
|
"markdown-it": "^14.1.1",
|
|
@@ -55,10 +57,9 @@
|
|
|
55
57
|
"xdg-basedir": "^5.1.0",
|
|
56
58
|
"yaml": "^2.9.0",
|
|
57
59
|
"zod": "^4.4.3",
|
|
58
|
-
"@easbot/types": "0.3.
|
|
60
|
+
"@easbot/types": "0.3.12"
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
|
61
|
-
"@biomejs/biome": "^2.4.14",
|
|
62
63
|
"@types/markdown-it": "^14.1.2",
|
|
63
64
|
"@types/node": "^25.6.2",
|
|
64
65
|
"@types/ws": "^8.18.1",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {f}from'./chunk-MHARKEDN.mjs';import ut,{mkdir,readFile,writeFile,chmod}from'fs/promises';import {existsSync,statSync,createWriteStream,realpathSync}from'fs';import {extname,basename,resolve,relative,sep}from'path';import {Readable}from'stream';import {pipeline}from'stream/promises';import {glob,globSync}from'glob';import L from'os';f();f();f();function V(e,n){let r=new Set,i=0;for(;i<e.length;){let a=e[i];if(e[i+1]==="-"&&i+2<e.length){let l=e[i+2],m=a.charCodeAt(0),h=l.charCodeAt(0);if(m>h)return null;for(let x=m;x<=h;x++)r.add(String.fromCharCode(x));i+=3;}else r.add(a),i++;}return {kind:"class",chars:r,negate:n}}function _(e){let n=[],r="",i=0;for(;i<e.length;){let a=e[i];if(a==="\\"&&i+1<e.length){r+=e[i+1],i+=2;continue}if(a==="["){let c=e.indexOf("]",i+1);if(c!==-1){let l=e.slice(i+1,c),m=false,h=0;(l.startsWith("!")||l.startsWith("^"))&&(m=true,h=1);let x=V(l.slice(h),m);if(x){r&&(n.push({kind:"literal",text:r}),r=""),n.push(x),i=c+1;continue}}}r+=a,i++;}return r&&n.push({kind:"literal",text:r}),n}function tt(e){let n=et(e);if(n===-1)return null;let r=nt(e,n);if(r===-1)return null;let i=e.slice(n+1,r),a=it(i);if(!a)return null;let c=e.slice(0,n),l=e.slice(r+1),m=[];for(let h of a)m.push(c+h+l);return m}function et(e){for(let n=0;n<e.length;n++){if(e[n]==="\\"&&n+1<e.length){n++;continue}if(e[n]==="{")return n}return -1}function nt(e,n){let r=1;for(let i=n+1;i<e.length;i++){if(e[i]==="\\"&&i+1<e.length){i++;continue}if(e[i]==="{")r++;else if(e[i]==="}"&&(r--,r===0))return i}return -1}function it(e){let n=[],r="",i=0;for(let a=0;a<e.length;a++){let c=e[a];if(c==="\\"&&a+1<e.length){r+=e[a+1],a++;continue}if(c==="{")i++,r+=c;else if(c==="}"){if(i--,r+=c,i<0)return null}else c===","&&i===0?(n.push(r),r=""):r+=c;}return i!==0?null:(n.push(r),n)}function rt(e){let n=tt(e);return n?[{kind:"brace",alternatives:n.map(i=>G(i))}]:G(e)}function G(e,n=false){let r=[],i="",a=0,c=n?e.length-2:e.length;for(;a<c;){let l=e[a];if(l==="\\"&&a+1<c){i+=e[a+1],a+=2;continue}if(l==="*"&&e[a+1]==="*"&&(a+2>=c||e[a+2]==="/")&&(a===0||e[a-1]==="/")){i&&(r.push(..._(i)),i=""),r.push({kind:"starstar"}),a+=2,e[a]==="/"&&a++;continue}if(l==="*"){i&&(r.push(..._(i)),i=""),r.push({kind:"star"}),a++;continue}if(l==="?"){i&&(r.push(..._(i)),i=""),r.push({kind:"question"}),a++;continue}i+=l,a++;}return i&&r.push(..._(i)),r}function ot(e){let n=0;for(;n<e.length;){let r=e[n];if(r==="\\"&&n+1<e.length){n+=2;continue}if(r===" ")return e[n+1]==="*"&&n+2===e.length;n++;}return false}function z(e,n,r=0,i=0){for(;r<e.length;){let a=e[r];if(a.kind==="literal"){if(!n.startsWith(a.text,i))return false;i+=a.text.length;}else if(a.kind==="star"){let c=r+1;for(;c<e.length&&e[c].kind==="star";)c++;if(c>=e.length){for(let l=i;l<n.length;l++)if(n[l]==="/")return false;return true}for(let l=i;l<=n.length;l++){if(z(e,n,c,l))return true;if(n[l]==="/")break}return false}else if(a.kind==="starstar"){let c=r+1;for(;c<e.length&&e[c].kind==="starstar";)c++;if(c>=e.length)return true;for(let l=i;l<=n.length;l++)if(z(e,n,c,l))return true;return false}else if(a.kind==="question"){if(i>=n.length||n[i]==="/")return false;i++;}else if(a.kind==="class"){let c=n[i];if(c===void 0||a.chars.has(c)===a.negate)return false;i++;}else if(a.kind==="brace"){for(let c of a.alternatives)if(z(c,n,0,i))return true;return false}r++;}return i===n.length}function H(e){return e.sort((n,r)=>{let i=n[0].length-r[0].length;return i!==0?i:n[0].localeCompare(r[0])})}var A=new Map,st=1024;function Z(e){let n=A.get(e);if(n)return n;let r=rt(e);if(A.size>=st){let i=A.keys().next().value;i!==void 0&&A.delete(i);}return A.set(e,r),r}var T;(a=>{function e(c,l){if(!l)return c==="";try{if(n(c,l))return !0;if(ot(l)){let m=l.slice(0,-2);if(n(c,m))return !0}return !1}catch{return false}}a.match=e;function n(c,l){if(!c)return ct(l);let m=Z(l);return z(m,c)}function r(c,l){let m=H(Object.entries(l)),h;for(let[x,w]of m)e(c,x)&&(h=w);return h}a.all=r;function i(c,l){let m=H(Object.entries(l)),h;for(let[x,w]of m){let u=x.split(/\s+/);u.length!==0&&e(c.head,u[0])&&(u.length===1||at(c.tail,u.slice(1)))&&(h=w);}return h}a.allStructured=i;})(T||(T={}));function at(e,n){if(n.length===0)return true;if(e.length<n.length)return false;for(let r=0;r<n.length;r++)if(!T.match(e[r],n[r]))return false;return true}function ct(e){let n=Z(e);return z(n,"")}var W;(w=>{w.DEFAULT_MAX_DEPTH=20;function n(u){let g;return u.maxDepth===void 0?g=20:u.maxDepth<1?g=1:u.maxDepth>20?g=20:g=u.maxDepth,{...u,follow:u.symlink??false,nodir:u.include!=="all",maxDepth:g}}async function r(u,g={}){let b=await glob(u,n(g));return a(b)}w.scan=r;function i(u,g={}){let b=globSync(u,n(g));return a(b)}w.scanSync=i;function a(u){let g=false;for(let b of u)if(b.indexOf("\\")!==-1){g=true;break}return g?u.map(b=>D.toUnixPath(b)):u}function c(u,g){return T.match(g,u)}w.match=c;async function l(u){try{let g=await ut.readFile(u,"utf-8");return m(g)}catch{return []}}w.parseGitignore=l;function m(u){let g=[],b=u.split(/\r?\n/);for(let C of b){let j=C.trim();if(!j||j.startsWith("#")||j.startsWith("!"))continue;let d=j;d.endsWith("/")&&(d=`${d}**`),!d.includes("*")&&!d.includes("?")&&!d.includes("[")&&(d=`**/${d}/**`),g.push(d);}return g}w.parseGitignoreContent=m;function h(u,g){let b=u.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"");for(let C of g)if(T.match(b,C)||T.match(b,`${C}/**`))return true;return false}w.isIgnored=h,w.DEFAULT_IGNORE_PATTERNS=["**/node_modules/**","**/dist/**","**/build/**","**/out/**","**/target/**","**/.cache/**","**/.vite/**","**/.turbo/**","**/.next/**","**/.nuxt/**","**/coverage/**","**/.nyc_output/**","**/logs/**","**/*.log","**/.DS_Store","**/Thumbs.db","**/tmp/**","**/temp/**","**/.git/**","**/*.min.js","**/*.min.ts","**/*.db","**/data/**"];})(W||(W={}));var yt=sep,M=yt==="\\";var Y={".html":"text/html",".htm":"text/html",".css":"text/css",".csv":"text/csv",".txt":"text/plain",".md":"text/markdown",".xml":"application/xml",".yaml":"application/yaml",".yml":"application/yaml",".toml":"application/toml",".ini":"text/plain",".cfg":"text/plain",".conf":"text/plain",".log":"text/plain",".sh":"text/x-sh",".bash":"text/x-bash",".zsh":"text/x-zsh",".fish":"text/x-fish",".ps1":"text/x-powershell",".bat":"text/x-batch",".cmd":"text/x-batch",".dockerfile":"text/x-dockerfile",".makefile":"text/x-makefile",".properties":"text/plain",".js":"application/javascript",".mjs":"application/javascript",".cjs":"application/javascript",".jsx":"text/javascript",".ts":"application/typescript",".tsx":"text/typescript",".mts":"application/typescript",".json":"application/json",".jsonc":"application/json",".json5":"application/json",".webmanifest":"application/manifest+json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".webp":"image/webp",".avif":"image/avif",".heic":"image/heic",".heif":"image/heif",".bmp":"image/bmp",".tiff":"image/tiff",".tif":"image/tiff",".mp4":"video/mp4",".webm":"video/webm",".ogg":"video/ogg",".avi":"video/x-msvideo",".mkv":"video/x-matroska",".mov":"video/quicktime",".mp3":"audio/mpeg",".wav":"audio/wav",".flac":"audio/flac",".aac":"audio/aac",".opus":"audio/opus",".m4a":"audio/mp4",".pdf":"application/pdf",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".rtf":"application/rtf",".epub":"application/epub+zip",".zip":"application/zip",".tar":"application/x-tar",".gz":"application/gzip",".tgz":"application/gzip",".bz2":"application/x-bzip2",".xz":"application/x-xz",".7z":"application/x-7z-compressed",".rar":"application/vnd.rar",".wasm":"application/wasm",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject",".db":"application/x-sqlite3",".sqlite":"application/vnd.sqlite3",".proto":"application/protobuf"},wt=Object.fromEntries(Object.entries(Y).map(([e,n])=>[n,e])),D;(zt=>{async function e(t,o){await mkdir(t,{recursive:o?.recursive??true});}zt.mkdir=e;async function n(t){return existsSync(t)}zt.exists=n;async function r(t){try{return statSync(t).isDirectory()}catch{return false}}zt.isDir=r;function i(t){return statSync(t,{throwIfNoEntry:false})??void 0}zt.stat=i;async function a(t){let o=i(t)?.size??0;return typeof o=="bigint"?Number(o):o}zt.size=a;async function c(t){return readFile(t,"utf-8")}zt.readText=c;async function l(t){return JSON.parse(await readFile(t,"utf-8"))}zt.readJson=l;async function m(t){return readFile(t)}zt.readBytes=m;async function h(t){let o=await readFile(t);return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}zt.readArrayBuffer=h;function x(t){return typeof t=="object"&&t!==null&&"code"in t&&t.code==="ENOENT"}async function w(t,o,s){try{s?await writeFile(t,o,{mode:s}):await writeFile(t,o);}catch(f){if(x(f)){await mkdir(d(t),{recursive:true}),s?await writeFile(t,o,{mode:s}):await writeFile(t,o);return}throw f}}zt.write=w;async function u(t,o,s){return w(t,JSON.stringify(o,null,2),s)}zt.writeJson=u;async function g(t,o,s){let f=d(t);existsSync(f)||await mkdir(f,{recursive:true});let p=o instanceof ReadableStream?Readable.fromWeb(o):o,S=createWriteStream(t);await pipeline(p,S),s&&await chmod(t,s);}zt.writeStream=g;function b(t){let o=extname(t).toLowerCase();return Y[o]||"application/octet-stream"}zt.mimeType=b;function C(t){return wt[t]}zt.mimeTypeToExt=C;function j(t){return t?!!(t.startsWith("text/")||t==="application/json"||t==="application/json5"||t==="application/jsonc"||t==="application/xml"||t==="application/javascript"||t==="application/typescript"||t==="application/x-javascript"||t==="application/yaml"||t==="application/x-yaml"||t==="application/toml"||t==="application/x-sh"||t==="application/x-bash"||t==="application/x-zsh"||t==="application/x-powershell"||t==="application/x-batch"||t==="application/x-dockerfile"||t==="application/x-makefile"):false}zt.isTextMime=j;function d(t){if(!t||t.length===0)return ".";let o=v(t);if(o=o.replace(/\/+$/,""),!o||o===""||o==="/")return "/";let s=o.lastIndexOf("/");return s===-1?".":s===0?"/":o.slice(0,s)}zt.dirname=d;function vt(t,o){if(!t||t.length===0)return "";let s=v(t);if(s=s.replace(/\/+$/,""),!s||s===""||s==="/")return "";let f=s.lastIndexOf("/"),p=f===-1?s:s.slice(f+1);return p?(o&&p.endsWith(o)&&(p=p.slice(0,-o.length)),p):""}zt.basename=vt;function kt(t){if(!t)return "";let o=v(t);if(!o)return "";let s=basename(o);if(!s||s===".")return "";let f=s.lastIndexOf(".");return f===-1||f===0?"":s.slice(f)}zt.extname=kt;function v(t){return t?t.replace(/\\/g,"/"):""}zt.toUnixPath=v;function y(t){if(!t||t.length===0)return L.homedir();if(M&&(t=F(t)),t.startsWith("~/")||t==="~"?t=O(L.homedir(),t.slice(1)):N(t)||(t=resolve(t)),t=v(t),M)try{t=realpathSync.native(t),t=v(t);}catch{}return t}zt.normalize=y;function Tt(t){return !t||t.length===0?L.homedir():(M&&(t=F(t)),t.startsWith("~/")||t==="~"?t=O(L.homedir(),t.slice(1)):N(t)||(t=resolve(t)),v(t))}zt.resolve=Tt;function N(t){return !!(t.startsWith("/")||/^[a-zA-Z]:[/\\]/.test(t)||/^[a-zA-Z]:$/.test(t))}zt.isAbsolute=N;function O(t,...o){let s=v(t);for(let f of o){let p=v(f);N(p)?s=p:(s.endsWith("/")||(s+="/"),s+=p);}return s.replace(/\\/g,"/")}zt.join=O;function F(t){return process.platform!=="win32"?t:t.replace(/^\/([a-zA-Z]):(?:[\\/]|$)/,(o,s)=>`${s.toUpperCase()}:/`).replace(/^\/([a-zA-Z])(?:\/|$)/,(o,s)=>`${s.toUpperCase()}:/`).replace(/^\/cygdrive\/([a-zA-Z])(?:\/|$)/,(o,s)=>`${s.toUpperCase()}:/`).replace(/^\/mnt\/([a-zA-Z])(?:\/|$)/,(o,s)=>`${s.toUpperCase()}:/`)}zt.windowsPath=F;function Pt(t,o){let s=y(t),f=y(o),p=relative(s,f),S=relative(f,s);return !p?.startsWith("..")||!S?.startsWith("..")}zt.overlaps=Pt;function Et(t,o){let s=y(t),f=y(o);return !relative(s,f).startsWith("..")}zt.contains=Et;async function Ct(t,o,s){let f=y(o),p=s?y(s):void 0,S=[];for(;;){let k=O(f,t);if(await n(k)&&S.push(k),p&&f===p)break;let P=d(f);if(P===f)break;f=P;}return S}zt.findUp=Ct;async function*jt(t){let{targets:o,start:s,stop:f}=t,p=y(s),S=f?y(f):void 0;for(;;){for(let P of o){let q=O(p,P);await n(q)&&(yield q);}if(S&&p===S)break;let k=d(p);if(k===p)break;p=k;}}zt.up=jt;async function At(t,o,s){let f=y(o),p=s?y(s):void 0,S=[];for(;;){try{let P=await W.scan(t,{cwd:f,absolute:!0,include:"file",dot:!0});S.push(...P);}catch{}if(p&&f===p)break;let k=d(f);if(k===f)break;f=k;}return S}zt.globUp=At;})(D||(D={}));
|
|
2
|
-
export{T as a,W as b,Y as c,D as d};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkXBAP2B6J_cjs=require('./chunk-XBAP2B6J.cjs'),ft=require('fs/promises'),fs=require('fs'),path=require('path'),stream=require('stream'),promises=require('stream/promises'),glob=require('glob'),L=require('os');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ft__default=/*#__PURE__*/_interopDefault(ft);var L__default=/*#__PURE__*/_interopDefault(L);chunkXBAP2B6J_cjs.e();chunkXBAP2B6J_cjs.e();chunkXBAP2B6J_cjs.e();function Y(e,n){let r=new Set,i=0;for(;i<e.length;){let a=e[i];if(e[i+1]==="-"&&i+2<e.length){let l=e[i+2],m=a.charCodeAt(0),h=l.charCodeAt(0);if(m>h)return null;for(let x=m;x<=h;x++)r.add(String.fromCharCode(x));i+=3;}else r.add(a),i++;}return {kind:"class",chars:r,negate:n}}function _(e){let n=[],r="",i=0;for(;i<e.length;){let a=e[i];if(a==="\\"&&i+1<e.length){r+=e[i+1],i+=2;continue}if(a==="["){let c=e.indexOf("]",i+1);if(c!==-1){let l=e.slice(i+1,c),m=false,h=0;(l.startsWith("!")||l.startsWith("^"))&&(m=true,h=1);let x=Y(l.slice(h),m);if(x){r&&(n.push({kind:"literal",text:r}),r=""),n.push(x),i=c+1;continue}}}r+=a,i++;}return r&&n.push({kind:"literal",text:r}),n}function V(e){let n=tt(e);if(n===-1)return null;let r=et(e,n);if(r===-1)return null;let i=e.slice(n+1,r),a=nt(i);if(!a)return null;let c=e.slice(0,n),l=e.slice(r+1),m=[];for(let h of a)m.push(c+h+l);return m}function tt(e){for(let n=0;n<e.length;n++){if(e[n]==="\\"&&n+1<e.length){n++;continue}if(e[n]==="{")return n}return -1}function et(e,n){let r=1;for(let i=n+1;i<e.length;i++){if(e[i]==="\\"&&i+1<e.length){i++;continue}if(e[i]==="{")r++;else if(e[i]==="}"&&(r--,r===0))return i}return -1}function nt(e){let n=[],r="",i=0;for(let a=0;a<e.length;a++){let c=e[a];if(c==="\\"&&a+1<e.length){r+=e[a+1],a++;continue}if(c==="{")i++,r+=c;else if(c==="}"){if(i--,r+=c,i<0)return null}else c===","&&i===0?(n.push(r),r=""):r+=c;}return i!==0?null:(n.push(r),n)}function it(e){let n=V(e);return n?[{kind:"brace",alternatives:n.map(i=>G(i))}]:G(e)}function G(e,n=false){let r=[],i="",a=0,c=n?e.length-2:e.length;for(;a<c;){let l=e[a];if(l==="\\"&&a+1<c){i+=e[a+1],a+=2;continue}if(l==="*"&&e[a+1]==="*"&&(a+2>=c||e[a+2]==="/")&&(a===0||e[a-1]==="/")){i&&(r.push(..._(i)),i=""),r.push({kind:"starstar"}),a+=2,e[a]==="/"&&a++;continue}if(l==="*"){i&&(r.push(..._(i)),i=""),r.push({kind:"star"}),a++;continue}if(l==="?"){i&&(r.push(..._(i)),i=""),r.push({kind:"question"}),a++;continue}i+=l,a++;}return i&&r.push(..._(i)),r}function rt(e){let n=0;for(;n<e.length;){let r=e[n];if(r==="\\"&&n+1<e.length){n+=2;continue}if(r===" ")return e[n+1]==="*"&&n+2===e.length;n++;}return false}function z(e,n,r=0,i=0){for(;r<e.length;){let a=e[r];if(a.kind==="literal"){if(!n.startsWith(a.text,i))return false;i+=a.text.length;}else if(a.kind==="star"){let c=r+1;for(;c<e.length&&e[c].kind==="star";)c++;if(c>=e.length){for(let l=i;l<n.length;l++)if(n[l]==="/")return false;return true}for(let l=i;l<=n.length;l++){if(z(e,n,c,l))return true;if(n[l]==="/")break}return false}else if(a.kind==="starstar"){let c=r+1;for(;c<e.length&&e[c].kind==="starstar";)c++;if(c>=e.length)return true;for(let l=i;l<=n.length;l++)if(z(e,n,c,l))return true;return false}else if(a.kind==="question"){if(i>=n.length||n[i]==="/")return false;i++;}else if(a.kind==="class"){let c=n[i];if(c===void 0||a.chars.has(c)===a.negate)return false;i++;}else if(a.kind==="brace"){for(let c of a.alternatives)if(z(c,n,0,i))return true;return false}r++;}return i===n.length}function H(e){return e.sort((n,r)=>{let i=n[0].length-r[0].length;return i!==0?i:n[0].localeCompare(r[0])})}var A=new Map,ot=1024;function X(e){let n=A.get(e);if(n)return n;let r=it(e);if(A.size>=ot){let i=A.keys().next().value;i!==void 0&&A.delete(i);}return A.set(e,r),r}exports.a=void 0;(a=>{function e(c,l){if(!l)return c==="";try{if(n(c,l))return !0;if(rt(l)){let m=l.slice(0,-2);if(n(c,m))return !0}return !1}catch{return false}}a.match=e;function n(c,l){if(!c)return at(l);let m=X(l);return z(m,c)}function r(c,l){let m=H(Object.entries(l)),h;for(let[x,w]of m)e(c,x)&&(h=w);return h}a.all=r;function i(c,l){let m=H(Object.entries(l)),h;for(let[x,w]of m){let u=x.split(/\s+/);u.length!==0&&e(c.head,u[0])&&(u.length===1||st(c.tail,u.slice(1)))&&(h=w);}return h}a.allStructured=i;})(exports.a||(exports.a={}));function st(e,n){if(n.length===0)return true;if(e.length<n.length)return false;for(let r=0;r<n.length;r++)if(!exports.a.match(e[r],n[r]))return false;return true}function at(e){let n=X(e);return z(n,"")}exports.b=void 0;(w=>{w.DEFAULT_MAX_DEPTH=20;function n(u){let g;return u.maxDepth===void 0?g=20:u.maxDepth<1?g=1:u.maxDepth>20?g=20:g=u.maxDepth,{...u,follow:u.symlink??false,nodir:u.include!=="all",maxDepth:g}}async function r(u,g={}){let b=await glob.glob(u,n(g));return a(b)}w.scan=r;function i(u,g={}){let b=glob.globSync(u,n(g));return a(b)}w.scanSync=i;function a(u){let g=false;for(let b of u)if(b.indexOf("\\")!==-1){g=true;break}return g?u.map(b=>exports.d.toUnixPath(b)):u}function c(u,g){return exports.a.match(g,u)}w.match=c;async function l(u){try{let g=await ft__default.default.readFile(u,"utf-8");return m(g)}catch{return []}}w.parseGitignore=l;function m(u){let g=[],b=u.split(/\r?\n/);for(let C of b){let j=C.trim();if(!j||j.startsWith("#")||j.startsWith("!"))continue;let d=j;d.endsWith("/")&&(d=`${d}**`),!d.includes("*")&&!d.includes("?")&&!d.includes("[")&&(d=`**/${d}/**`),g.push(d);}return g}w.parseGitignoreContent=m;function h(u,g){let b=u.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/$/,"");for(let C of g)if(exports.a.match(b,C)||exports.a.match(b,`${C}/**`))return true;return false}w.isIgnored=h,w.DEFAULT_IGNORE_PATTERNS=["**/node_modules/**","**/dist/**","**/build/**","**/out/**","**/target/**","**/.cache/**","**/.vite/**","**/.turbo/**","**/.next/**","**/.nuxt/**","**/coverage/**","**/.nyc_output/**","**/logs/**","**/*.log","**/.DS_Store","**/Thumbs.db","**/tmp/**","**/temp/**","**/.git/**","**/*.min.js","**/*.min.ts","**/*.db","**/data/**"];})(exports.b||(exports.b={}));var St=path.sep,M=St==="\\";var Q={".html":"text/html",".htm":"text/html",".css":"text/css",".csv":"text/csv",".txt":"text/plain",".md":"text/markdown",".xml":"application/xml",".yaml":"application/yaml",".yml":"application/yaml",".toml":"application/toml",".ini":"text/plain",".cfg":"text/plain",".conf":"text/plain",".log":"text/plain",".sh":"text/x-sh",".bash":"text/x-bash",".zsh":"text/x-zsh",".fish":"text/x-fish",".ps1":"text/x-powershell",".bat":"text/x-batch",".cmd":"text/x-batch",".dockerfile":"text/x-dockerfile",".makefile":"text/x-makefile",".properties":"text/plain",".js":"application/javascript",".mjs":"application/javascript",".cjs":"application/javascript",".jsx":"text/javascript",".ts":"application/typescript",".tsx":"text/typescript",".mts":"application/typescript",".json":"application/json",".jsonc":"application/json",".json5":"application/json",".webmanifest":"application/manifest+json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".webp":"image/webp",".avif":"image/avif",".heic":"image/heic",".heif":"image/heif",".bmp":"image/bmp",".tiff":"image/tiff",".tif":"image/tiff",".mp4":"video/mp4",".webm":"video/webm",".ogg":"video/ogg",".avi":"video/x-msvideo",".mkv":"video/x-matroska",".mov":"video/quicktime",".mp3":"audio/mpeg",".wav":"audio/wav",".flac":"audio/flac",".aac":"audio/aac",".opus":"audio/opus",".m4a":"audio/mp4",".pdf":"application/pdf",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".rtf":"application/rtf",".epub":"application/epub+zip",".zip":"application/zip",".tar":"application/x-tar",".gz":"application/gzip",".tgz":"application/gzip",".bz2":"application/x-bzip2",".xz":"application/x-xz",".7z":"application/x-7z-compressed",".rar":"application/vnd.rar",".wasm":"application/wasm",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject",".db":"application/x-sqlite3",".sqlite":"application/vnd.sqlite3",".proto":"application/protobuf"},yt=Object.fromEntries(Object.entries(Q).map(([e,n])=>[n,e]));exports.d=void 0;(At=>{async function e(t,o){await ft.mkdir(t,{recursive:o?.recursive??true});}At.mkdir=e;async function n(t){return fs.existsSync(t)}At.exists=n;async function r(t){try{return fs.statSync(t).isDirectory()}catch{return false}}At.isDir=r;function i(t){return fs.statSync(t,{throwIfNoEntry:false})??void 0}At.stat=i;async function a(t){let o=i(t)?.size??0;return typeof o=="bigint"?Number(o):o}At.size=a;async function c(t){return ft.readFile(t,"utf-8")}At.readText=c;async function l(t){return JSON.parse(await ft.readFile(t,"utf-8"))}At.readJson=l;async function m(t){return ft.readFile(t)}At.readBytes=m;async function h(t){let o=await ft.readFile(t);return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}At.readArrayBuffer=h;function x(t){return typeof t=="object"&&t!==null&&"code"in t&&t.code==="ENOENT"}async function w(t,o,s){try{s?await ft.writeFile(t,o,{mode:s}):await ft.writeFile(t,o);}catch(f){if(x(f)){await ft.mkdir(d(t),{recursive:true}),s?await ft.writeFile(t,o,{mode:s}):await ft.writeFile(t,o);return}throw f}}At.write=w;async function u(t,o,s){return w(t,JSON.stringify(o,null,2),s)}At.writeJson=u;async function g(t,o,s){let f=d(t);fs.existsSync(f)||await ft.mkdir(f,{recursive:true});let p=o instanceof ReadableStream?stream.Readable.fromWeb(o):o,S=fs.createWriteStream(t);await promises.pipeline(p,S),s&&await ft.chmod(t,s);}At.writeStream=g;function b(t){let o=path.extname(t).toLowerCase();return Q[o]||"application/octet-stream"}At.mimeType=b;function C(t){return yt[t]}At.mimeTypeToExt=C;function j(t){return t?!!(t.startsWith("text/")||t==="application/json"||t==="application/json5"||t==="application/jsonc"||t==="application/xml"||t==="application/javascript"||t==="application/typescript"||t==="application/x-javascript"||t==="application/yaml"||t==="application/x-yaml"||t==="application/toml"||t==="application/x-sh"||t==="application/x-bash"||t==="application/x-zsh"||t==="application/x-powershell"||t==="application/x-batch"||t==="application/x-dockerfile"||t==="application/x-makefile"):false}At.isTextMime=j;function d(t){if(!t||t.length===0)return ".";let o=v(t);if(o=o.replace(/\/+$/,""),!o||o===""||o==="/")return "/";let s=o.lastIndexOf("/");return s===-1?".":s===0?"/":o.slice(0,s)}At.dirname=d;function wt(t,o){if(!t||t.length===0)return "";let s=v(t);if(s=s.replace(/\/+$/,""),!s||s===""||s==="/")return "";let f=s.lastIndexOf("/"),p=f===-1?s:s.slice(f+1);return p?(o&&p.endsWith(o)&&(p=p.slice(0,-o.length)),p):""}At.basename=wt;function vt(t){if(!t)return "";let o=v(t);if(!o)return "";let s=path.basename(o);if(!s||s===".")return "";let f=s.lastIndexOf(".");return f===-1||f===0?"":s.slice(f)}At.extname=vt;function v(t){return t?t.replace(/\\/g,"/"):""}At.toUnixPath=v;function y(t){if(!t||t.length===0)return L__default.default.homedir();if(M&&(t=F(t)),t.startsWith("~/")||t==="~"?t=O(L__default.default.homedir(),t.slice(1)):N(t)||(t=path.resolve(t)),t=v(t),M)try{t=fs.realpathSync.native(t),t=v(t);}catch{}return t}At.normalize=y;function kt(t){return !t||t.length===0?L__default.default.homedir():(M&&(t=F(t)),t.startsWith("~/")||t==="~"?t=O(L__default.default.homedir(),t.slice(1)):N(t)||(t=path.resolve(t)),v(t))}At.resolve=kt;function N(t){return !!(t.startsWith("/")||/^[a-zA-Z]:[/\\]/.test(t)||/^[a-zA-Z]:$/.test(t))}At.isAbsolute=N;function O(t,...o){let s=v(t);for(let f of o){let p=v(f);N(p)?s=p:(s.endsWith("/")||(s+="/"),s+=p);}return s.replace(/\\/g,"/")}At.join=O;function F(t){return process.platform!=="win32"?t:t.replace(/^\/([a-zA-Z]):(?:[\\/]|$)/,(o,s)=>`${s.toUpperCase()}:/`).replace(/^\/([a-zA-Z])(?:\/|$)/,(o,s)=>`${s.toUpperCase()}:/`).replace(/^\/cygdrive\/([a-zA-Z])(?:\/|$)/,(o,s)=>`${s.toUpperCase()}:/`).replace(/^\/mnt\/([a-zA-Z])(?:\/|$)/,(o,s)=>`${s.toUpperCase()}:/`)}At.windowsPath=F;function Tt(t,o){let s=y(t),f=y(o),p=path.relative(s,f),S=path.relative(f,s);return !p?.startsWith("..")||!S?.startsWith("..")}At.overlaps=Tt;function Pt(t,o){let s=y(t),f=y(o);return !path.relative(s,f).startsWith("..")}At.contains=Pt;async function Et(t,o,s){let f=y(o),p=s?y(s):void 0,S=[];for(;;){let k=O(f,t);if(await n(k)&&S.push(k),p&&f===p)break;let P=d(f);if(P===f)break;f=P;}return S}At.findUp=Et;async function*Ct(t){let{targets:o,start:s,stop:f}=t,p=y(s),S=f?y(f):void 0;for(;;){for(let P of o){let q=O(p,P);await n(q)&&(yield q);}if(S&&p===S)break;let k=d(p);if(k===p)break;p=k;}}At.up=Ct;async function jt(t,o,s){let f=y(o),p=s?y(s):void 0,S=[];for(;;){try{let P=await exports.b.scan(t,{cwd:f,absolute:!0,include:"file",dot:!0});S.push(...P);}catch{}if(p&&f===p)break;let k=d(f);if(k===f)break;f=k;}return S}At.globUp=jt;})(exports.d||(exports.d={}));
|
|
2
|
-
exports.c=Q;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkEN7LFV4R_cjs=require('./chunk-EN7LFV4R.cjs');require('./chunk-XBAP2B6J.cjs');Object.defineProperty(exports,"Filesystem",{enumerable:true,get:function(){return chunkEN7LFV4R_cjs.d}});Object.defineProperty(exports,"MIME_TYPES",{enumerable:true,get:function(){return chunkEN7LFV4R_cjs.c}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{d as Filesystem,c as MIME_TYPES}from'./chunk-6BCTOX3Z.mjs';import'./chunk-MHARKEDN.mjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{o as PackageRegistry}from'./chunk-DELWLFU5.mjs';import'./chunk-MHARKEDN.mjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkAUS6KQNI_cjs=require('./chunk-AUS6KQNI.cjs');require('./chunk-XBAP2B6J.cjs');Object.defineProperty(exports,"PackageRegistry",{enumerable:true,get:function(){return chunkAUS6KQNI_cjs.o}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunk3U5YF6EI_cjs=require('./chunk-3U5YF6EI.cjs');require('./chunk-EN7LFV4R.cjs'),require('./chunk-AUS6KQNI.cjs'),require('./chunk-XBAP2B6J.cjs');Object.defineProperty(exports,"$",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.H}});Object.defineProperty(exports,"Shell",{enumerable:true,get:function(){return chunk3U5YF6EI_cjs.G}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{H as $,G as Shell}from'./chunk-WW6DVU53.mjs';import'./chunk-6BCTOX3Z.mjs';import'./chunk-DELWLFU5.mjs';import'./chunk-MHARKEDN.mjs';
|