@easbot/utils 0.2.42 → 0.2.44

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/index.cjs CHANGED
@@ -1,19 +1,19 @@
1
- 'use strict';var chunkJL3GR4P7_cjs=require('./chunks/chunk-JL3GR4P7.cjs'),chunkPYCQUF3V_cjs=require('./chunks/chunk-PYCQUF3V.cjs'),chunkWWPI6PC4_cjs=require('./chunks/chunk-WWPI6PC4.cjs'),chunkAHO55TRS_cjs=require('./chunks/chunk-AHO55TRS.cjs'),chunkYC4AEMOP_cjs=require('./chunks/chunk-YC4AEMOP.cjs'),chunkVRQQ33YH_cjs=require('./chunks/chunk-VRQQ33YH.cjs'),oe=require('fs/promises'),Be=require('zod'),crypto$1=require('crypto'),fe=require('path'),Le=require('fs'),child_process=require('child_process'),module$1=require('module'),hono=require('hono'),nodeServer=require('@hono/node-server'),nodeWs=require('@hono/node-ws'),streaming=require('hono/streaming'),cors=require('hono/cors'),logger=require('hono/logger'),compress=require('hono/compress'),secureHeaders=require('hono/secure-headers'),timeout=require('hono/timeout'),httpException=require('hono/http-exception'),validator=require('hono/validator'),zodValidator=require('@hono/zod-validator'),minimatch=require('minimatch'),promises=require('timers/promises'),dotenv=require('dotenv'),url=require('url'),Zr=require('markdown-it'),jn=require('yaml'),undici=require('undici'),async_hooks=require('async_hooks');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var oe__default=/*#__PURE__*/_interopDefault(oe);var Be__default=/*#__PURE__*/_interopDefault(Be);var fe__default=/*#__PURE__*/_interopDefault(fe);var Le__default=/*#__PURE__*/_interopDefault(Le);var Zr__default=/*#__PURE__*/_interopDefault(Zr);var jn__default=/*#__PURE__*/_interopDefault(jn);chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Jn(e,t){for(let n=e.length-1;n>=0;n-=1){let r=e[n];if(r!==void 0&&t(r,n,e))return r}}chunkVRQQ33YH_cjs.j();exports.Binary=void 0;(n=>{function e(r,o,s){let a=0,i=r.length-1;for(;a<=i;){let c=Math.floor((a+i)/2),p=r[c];if(p===void 0)break;let l=s(p);if(l===o)return {found:true,index:c};l<o?a=c+1:i=c-1;}return {found:false,index:a}}n.search=e;function t(r,o,s){let a=s(o),i=0,c=r.length;for(;i<c;){let p=Math.floor((i+c)/2),l=r[p];if(l===void 0)break;s(l)<a?i=p+1:c=p;}return r.splice(i,0,o),r}n.insert=t;})(exports.Binary||(exports.Binary={}));chunkVRQQ33YH_cjs.j();exports.Encode=void 0;(s=>{function e(a){let i=new TextEncoder().encode(a),c=Array.from(i,p=>String.fromCharCode(p)).join("");return btoa(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s.base64Encode=e;function t(a){let i=atob(a.replace(/-/g,"+").replace(/_/g,"/")),c=Uint8Array.from(i,p=>p.charCodeAt(0));return new TextDecoder().decode(c)}s.base64Decode=t;async function n(a,i="SHA-256"){let p=new TextEncoder().encode(a),l=await crypto.subtle.digest(i,p);return Array.from(new Uint8Array(l)).map(v=>v.toString(16).padStart(2,"0")).join("")}s.hash=n;function r(a){if(!a)return;let i=2166136261;for(let c=0;c<a.length;c++)i^=a.charCodeAt(c),i=Math.imul(i,16777619);return (i>>>0).toString(36)}s.checksum=r;function o(a,i=5e5){if(!a)return;if(a.length<=i)return r(a);let c=4096,l=[0,Math.floor(a.length*.25),Math.floor(a.length*.5),Math.floor(a.length*.75),a.length-c].map(f=>{let h=Math.max(0,Math.min(a.length-c,f-Math.floor(c/2)));return r(a.slice(h,h+c))??""}).join(":");return `${a.length}:${l}`}s.sampledChecksum=o;})(exports.Encode||(exports.Encode={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();exports.Identifier=void 0;(f=>{let e={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"};function t(h){return Be__default.default.string().startsWith(e[h])}f.schema=t;let n=26,r=0,o=0;function s(h,v){return i(h,false,v)}f.ascending=s;function a(h,v){return i(h,true,v)}f.descending=a;function i(h,v,E){if(!E)return p(h,v);if(!E.startsWith(e[h]))throw new Error(`ID ${E} does not start with ${e[h]}`);return E}function c(h){let v="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",E="",N=crypto$1.randomBytes(h);for(let W=0;W<h;W++){let H=N[W];H!==void 0&&(E+=v[H%62]);}return E}function p(h,v,E){let N=E??Date.now();N!==r&&(r=N,o=0),o++;let W=BigInt(N)*BigInt(4096)+BigInt(o);W=v?~W:W;let H=Buffer.alloc(6);for(let U=0;U<6;U++)H[U]=Number(W>>BigInt(40-8*U)&BigInt(255));return e[h]+"_"+H.toString("hex")+c(n-12)}f.create=p;function l(h){let v=h.split("_")[0];if(!v)return 0;let E=h.slice(v.length+1,v.length+13),N=BigInt("0x"+E);return Number(N/BigInt(4096))}f.timestamp=l;})(exports.Identifier||(exports.Identifier={}));exports.TruncateContent=void 0;(s=>{s.DEFAULT_MAX_CHARS=4e3,s.DIRECTION="head";function n(a,i,c){return c?`[Content truncated. Source: ${c}
2
- Full ${i} saved to: ${a}
3
- Use Read tool with offset/limit parameters to view specific sections.]`:`[Content truncated. Full ${i} saved to: ${a}
4
- Use Read tool with offset/limit parameters to view specific sections.]`}async function r(a,i={}){let c=i.maxChars??4e3,p=i.direction??s.DIRECTION,l=i.label??"content",f=i.sourcePath,h=chunkJL3GR4P7_cjs.c.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),v=i.dir??h;if(a.length<=c)return {content:a,truncated:false};let E=exports.Identifier.ascending("context"),N=chunkJL3GR4P7_cjs.c.join(v,E);await oe__default.default.mkdir(v,{recursive:true}).catch(()=>{}),await oe__default.default.writeFile(N,a,"utf-8");let W=a.length-c,H;p==="head"?H=a.slice(0,c):H=a.slice(-c);let U=n(N,l,f),G=`${W} characters truncated`;return {content:p==="head"?`${H}
1
+ 'use strict';var chunkJL3GR4P7_cjs=require('./chunks/chunk-JL3GR4P7.cjs'),chunkPYCQUF3V_cjs=require('./chunks/chunk-PYCQUF3V.cjs'),chunkWWPI6PC4_cjs=require('./chunks/chunk-WWPI6PC4.cjs'),chunkAHO55TRS_cjs=require('./chunks/chunk-AHO55TRS.cjs'),chunkYC4AEMOP_cjs=require('./chunks/chunk-YC4AEMOP.cjs'),chunkVRQQ33YH_cjs=require('./chunks/chunk-VRQQ33YH.cjs'),oe=require('fs/promises'),Ne=require('zod'),crypto$1=require('crypto'),he=require('path'),De=require('fs'),child_process=require('child_process'),module$1=require('module'),hono=require('hono'),nodeServer=require('@hono/node-server'),nodeWs=require('@hono/node-ws'),streaming=require('hono/streaming'),cors=require('hono/cors'),logger=require('hono/logger'),compress=require('hono/compress'),secureHeaders=require('hono/secure-headers'),timeout=require('hono/timeout'),httpException=require('hono/http-exception'),validator=require('hono/validator'),zodValidator=require('@hono/zod-validator'),minimatch=require('minimatch'),promises=require('timers/promises'),dotenv=require('dotenv'),url=require('url'),Zr=require('markdown-it'),jn=require('yaml'),undici=require('undici'),async_hooks=require('async_hooks');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var oe__default=/*#__PURE__*/_interopDefault(oe);var Ne__default=/*#__PURE__*/_interopDefault(Ne);var he__default=/*#__PURE__*/_interopDefault(he);var De__default=/*#__PURE__*/_interopDefault(De);var Zr__default=/*#__PURE__*/_interopDefault(Zr);var jn__default=/*#__PURE__*/_interopDefault(jn);chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Jn(e,t){for(let n=e.length-1;n>=0;n-=1){let r=e[n];if(r!==void 0&&t(r,n,e))return r}}chunkVRQQ33YH_cjs.j();exports.Binary=void 0;(n=>{function e(r,o,s){let a=0,i=r.length-1;for(;a<=i;){let c=Math.floor((a+i)/2),p=r[c];if(p===void 0)break;let l=s(p);if(l===o)return {found:true,index:c};l<o?a=c+1:i=c-1;}return {found:false,index:a}}n.search=e;function t(r,o,s){let a=s(o),i=0,c=r.length;for(;i<c;){let p=Math.floor((i+c)/2),l=r[p];if(l===void 0)break;s(l)<a?i=p+1:c=p;}return r.splice(i,0,o),r}n.insert=t;})(exports.Binary||(exports.Binary={}));chunkVRQQ33YH_cjs.j();exports.Encode=void 0;(s=>{function e(a){let i=new TextEncoder().encode(a),c=Array.from(i,p=>String.fromCharCode(p)).join("");return btoa(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s.base64Encode=e;function t(a){let i=atob(a.replace(/-/g,"+").replace(/_/g,"/")),c=Uint8Array.from(i,p=>p.charCodeAt(0));return new TextDecoder().decode(c)}s.base64Decode=t;async function n(a,i="SHA-256"){let p=new TextEncoder().encode(a),l=await crypto.subtle.digest(i,p);return Array.from(new Uint8Array(l)).map(k=>k.toString(16).padStart(2,"0")).join("")}s.hash=n;function r(a){if(!a)return;let i=2166136261;for(let c=0;c<a.length;c++)i^=a.charCodeAt(c),i=Math.imul(i,16777619);return (i>>>0).toString(36)}s.checksum=r;function o(a,i=5e5){if(!a)return;if(a.length<=i)return r(a);let c=4096,l=[0,Math.floor(a.length*.25),Math.floor(a.length*.5),Math.floor(a.length*.75),a.length-c].map(u=>{let g=Math.max(0,Math.min(a.length-c,u-Math.floor(c/2)));return r(a.slice(g,g+c))??""}).join(":");return `${a.length}:${l}`}s.sampledChecksum=o;})(exports.Encode||(exports.Encode={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();exports.Identifier=void 0;(u=>{let e={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"};function t(g){return Ne__default.default.string().startsWith(e[g])}u.schema=t;let n=26,r=0,o=0;function s(g,k){return i(g,false,k)}u.ascending=s;function a(g,k){return i(g,true,k)}u.descending=a;function i(g,k,E){if(!E)return p(g,k);if(!E.startsWith(e[g]))throw new Error(`ID ${E} does not start with ${e[g]}`);return E}function c(g){let k="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",E="",H=crypto$1.randomBytes(g);for(let U=0;U<g;U++){let q=H[U];q!==void 0&&(E+=k[q%62]);}return E}function p(g,k,E){let H=E??Date.now();H!==r&&(r=H,o=0),o++;let U=BigInt(H)*BigInt(4096)+BigInt(o);U=k?~U:U;let q=Buffer.alloc(6);for(let Y=0;Y<6;Y++)q[Y]=Number(U>>BigInt(40-8*Y)&BigInt(255));return e[g]+"_"+q.toString("hex")+c(n-12)}u.create=p;function l(g){let k=g.split("_")[0];if(!k)return 0;let E=g.slice(k.length+1,k.length+13),H=BigInt("0x"+E);return Number(H/BigInt(4096))}u.timestamp=l;})(exports.Identifier||(exports.Identifier={}));exports.TruncateContent=void 0;(p=>{p.DEFAULT_MAX_CHARS=4e3,p.DIRECTION="head",p.DIR=chunkJL3GR4P7_cjs.c.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),p.GLOB=chunkJL3GR4P7_cjs.c.join(p.DIR,"*");let o=10080*60*1e3;function s(l,u,g){return g?`[Content truncated. Source: ${g}
2
+ Full ${u} saved to: ${l}
3
+ Use Read tool with offset/limit parameters to view specific sections.]`:`[Content truncated. Full ${u} saved to: ${l}
4
+ Use Read tool with offset/limit parameters to view specific sections.]`}async function a(l,u={}){let g=u.maxChars??4e3,k=u.direction??p.DIRECTION,E=u.label??"content",H=u.sourcePath,U=chunkJL3GR4P7_cjs.c.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),q=u.dir??U;if(l.length<=g)return {content:l,truncated:false};let Y=exports.Identifier.ascending("context"),G=chunkJL3GR4P7_cjs.c.join(q,Y);await oe__default.default.mkdir(q,{recursive:true}).catch(()=>{}),await oe__default.default.writeFile(G,l,"utf-8");let de=l.length-g,se;k==="head"?se=l.slice(0,g):se=l.slice(-g);let fe=s(G,E,H),ke=`${de} characters truncated`;return {content:k==="head"?`${se}
5
5
 
6
- ...${G}...
6
+ ...${ke}...
7
7
 
8
- ${U}`:`...${G}...
8
+ ${fe}`:`...${ke}...
9
9
 
10
- ${U}
10
+ ${fe}
11
11
 
12
- ${H}`,truncated:true,outputPath:N,originalLength:a.length,removedLength:W,label:l}}s.truncate=r;function o(a){return a.truncated?n(a.outputPath,a.label):""}s.formatHint=o;})(exports.TruncateContent||(exports.TruncateContent={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function rt(e,t=true){let n=typeof e=="number"?new Date(e):e,r=n.getTimezoneOffset(),o=Math.floor(Math.abs(r)/60),s=Math.abs(r)%60,i=`${r<=0?"+":"-"}${String(o).padStart(2,"0")}:${String(s).padStart(2,"0")}`,c=n.getFullYear(),p=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0"),f=String(n.getHours()).padStart(2,"0"),h=String(n.getMinutes()).padStart(2,"0"),v=String(n.getSeconds()).padStart(2,"0"),E=`${c}-${p}-${l}T${f}:${h}:${v}`;if(t){let N=String(n.getMilliseconds()).padStart(3,"0");E+=`.${N}`;}return E+=i,E}function ot(e){return rt(e,false)}function Yt(){return Date.now()}function Xn(e=true){return rt(Yt(),e)}function Qn(e){return e.includes("+")||e.includes("-")?new Date(e):new Date(e)}function er(e){let t=typeof e=="number"?new Date(e):e,n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return `${n}-${r}-${o}T${s}:${a}:${i}`}function tr(e=new Date){let t=e.getTimezoneOffset(),n=Math.floor(Math.abs(t)/60),r=Math.abs(t)%60;return `${t<=0?"+":"-"}${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`}exports.SessionTitle=void 0;(i=>{let e="New session - ",t="Child session - ";i.parentTitlePrefix=e,i.childTitlePrefix=t;function o(c=false){return (c?t:e)+ot(new Date)}i.createDefault=o;function s(c){return new RegExp(`^(${e}|${t})\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[+-]\\d{2}:\\d{2}$`).test(c)}i.isDefault=s;function a(c){let p=c.match(/^(.+) \(fork #(\d+)\)$/);if(p){let l=p[1]??"",f=parseInt(p[2]??"0",10);return `${l} (fork #${f+1})`}return `${c} (fork #1)`}i.getForked=a;})(exports.SessionTitle||(exports.SessionTitle={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Vt(e){let t,n=false,r=()=>(n||(t=e(),n=true),t);return r.reset=()=>{n=false,t=void 0;},r}var Fe=Vt;function Gt(e){let t,n=()=>(t||(t=e()),t);return n.reset=()=>{t=void 0;},n}var nr=Gt;exports.Lazy=void 0;(n=>(n.lazy=Vt,n.lazyAsync=Gt))(exports.Lazy||(exports.Lazy={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();var ne=chunkWWPI6PC4_cjs.a.create({service:"server"});function se(e={}){let t=e.port??3e3,n=e.hostname??"0.0.0.0",r=new hono.Hono({strict:true,getPath:a=>{try{return new URL(a.url).pathname}catch{return a.url}}});if(e.onError?r.onError(e.onError):r.onError((a,i)=>(ne.error("Server error",{error:a.message,stack:a.stack}),a instanceof httpException.HTTPException?a.getResponse():i.json({error:"Internal Server Error",message:a.message},500))),e.onNotFound?r.notFound(e.onNotFound):r.notFound(a=>a.json({error:"Not Found",path:a.req.path},404)),!e.websockets&&e.cors&&r.use(cors.cors(typeof e.cors=="boolean"?{origin:"*"}:e.cors)),r.use(logger.logger((a,...i)=>ne.info(a,i))),!e.websockets&&e.secureHeaders&&r.use(secureHeaders.secureHeaders()),!e.websockets&&e.compression&&r.use(compress.compress({encoding:"gzip"})),!e.websockets&&e.timeout&&r.use(timeout.timeout(e.timeout)),e.middlewares)for(let a of e.middlewares)a.path?r.use(a.path,a.handler):r.use(a.handler);if(e.routes)for(let a of e.routes){let i=a.middlewares||[],c=a.method.toUpperCase();a.validation?r.on(c,a.path,zodValidator.zValidator("json",a.validation),...i,a.handler):r.on(c,a.path,...i,a.handler);}e.rpc&&r.post("/rpc/:method",async a=>{let i=a.req.param("method"),c=e.rpc?.[i];if(!c)return a.json({error:"RPC method not found"},404);try{let p=await a.req.json(),l=await c(p,a);return a.json({result:l})}catch(p){return ne.error("RPC error",{method:i,error:p.message}),a.json({error:"RPC execution failed",message:p.message},500)}}),e.fetch&&r.all("*",async a=>await e.fetch(a.req.raw));let o=null,s={url:new URL(`http://${n}:${t}`),port:t,hostname:n,hono:r,async stop(a=false){return o?new Promise((i,c)=>{a&&o.closeAllConnections?.(),o.close(p=>{p?(ne.error("Error closing server",{error:p.message}),c(p)):(o=null,ne.info(`Server on port ${t} stopped`),i());}),setTimeout(()=>{ne.warn(`Server shutdown timeout on port ${t}`),o=null,i();},5e3);}):Promise.resolve()},get raw(){return o||void 0}};return ne.debug("createServer: calling serve()",{port:t,hostname:n}),o=nodeServer.serve({fetch:r.fetch,port:t,hostname:n}),ne.debug("createServer: serve() returned, server created"),ne.info(`Server running on http://${n}:${t}`),s}function it(e){return se({rpc:e,port:3e3})}function ir(e,t=3e3,n="0.0.0.0"){return se({fetch:e,port:t,hostname:n})}function at(e,t={}){return se({...t,routes:e})}function ct(e,t={}){return se({...t,websockets:e})}function lt(e,t={}){let n=Object.entries(e).map(([r,o])=>({method:"get",path:`/stream/${r}`,handler:s=>streaming.streamSSE(s,async a=>{for await(let i of o(s))await a.writeSSE(i);})}));return se({...t,routes:n,streaming:true})}chunkVRQQ33YH_cjs.j();var ie=chunkWWPI6PC4_cjs.a.create({service:"build-api"});async function cn(){try{return {available:!0,version:(await import('./chunks/main-RIJAJS2R.cjs')).version||"unknown"}}catch(e){return ie.warn("esbuild not available",{error:e.message}),{available:false}}}async function Ae(){let e=await cn();if(!e.available)throw new Error("esbuild is required but not installed. Please install it using: pnpm add -D esbuild");e.version&&e.version<"0.17.0"&&ie.warn(`esbuild version ${e.version} may have limited features. Consider upgrading to 0.17+`);}function ur(e){if(e!==void 0)return typeof e=="boolean"?{target:void 0}:typeof e=="string"?{target:e}:e}function ln(e){let t=ur(e.compile);t&&ie.warn("compile option is no longer supported (Bun runtime removed). The option will be ignored.");let n={entryPoints:e.entrypoints,outdir:e.outdir,bundle:e.bundle??true,conditions:e.conditions,external:e.external,format:e.format??"esm",platform:e.platform??(e.target==="browser"?"browser":"node"),minify:e.minify??false,treeShaking:true,splitting:e.splitting,sourcemap:dr(e.sourcemap),sourcesContent:true,define:e.define,inject:e.inject,legalComments:"eof",loader:e.loader,entryNames:e.entryNames,chunkNames:e.chunkNames,assetNames:e.assetNames,publicPath:e.publicPath,tsconfig:e.tsconfig,charset:"utf8",color:true,logLevel:"info",logLimit:50,plugins:e.plugins??[],metafile:true,write:e.write??true};return t?.outfile&&!e.outdir&&(n.outfile=t.outfile,delete n.outdir),e.target&&(n.target=fr(e.target)),e.minify===true&&(n.minifyWhitespace=true,n.minifyIdentifiers=true,n.minifySyntax=true),pr(n)}function dr(e){return !e||e==="none"?false:e}function fr(e){let t={browser:"es2020",node:"node16",bun:"esnext"};return e?t[e]||e:"esnext"}function pr(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function $e(e){if(e!==void 0)return e.replace(/\\/g,"/")}function rn(e,t,n){let r=[];if(e.outputFiles)for(let s of e.outputFiles)r.push({path:$e(s.path)||s.path,size:s.contents?.length||0});if(e.metafile?.outputs)for(let[s,a]of Object.entries(e.metafile.outputs)){let i=a;r.some(c=>c.path===s||c.path===$e(s))||r.push({path:$e(s)||s,size:i.bytes||0});}let o=[];if(e.errors?.length>0)for(let s of e.errors)o.push({level:"error",message:s.text||String(s),path:s.location?.file,position:s.location?{line:s.location.line,column:s.location.column}:void 0});if(e.warnings?.length>0)for(let s of e.warnings)o.push({level:"warning",message:s.text||String(s),path:s.location?.file,position:s.location?{line:s.location.line,column:s.location.column}:void 0});return {outputs:r,success:e.errors?.length===0,logs:o,metafile:e.metafile}}async function dt(e){ie.info("Build started",{entrypoints:e.entrypoints,target:e.target,format:e.format,compile:typeof e.compile}),await Ae();let t=await import('./chunks/main-RIJAJS2R.cjs'),n=Date.now();try{let r=ln(e);ie.debug("esbuild options",r);let o=await t.build(r),s=Date.now();return ie.info("Build completed",{duration:s-n,outputs:(o?.outputFiles?.length??0)>0||Object.keys(o.metafile?.outputs||{}).length>0}),rn(o,n,s)}catch(r){let o=Date.now(),s=r.message;return ie.error("Build failed",{error:s,duration:o-n}),r&&typeof r=="object"&&"errors"in r?rn(r):{outputs:[],success:false,logs:[{level:"error",message:s}],metafile:void 0}}}var xr={build:dt},un=xr;chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function re(e){let t=[],n="",r=0;for(;r<e.length&&(e[r]===" "||e[r]===" ");)r++;for(;r<e.length;){let o=e[r];if(o===" "||o===" "){for(n.length>0&&(t.push(n),n="");r<e.length&&(e[r]===" "||e[r]===" ");)r++;continue}if(o==='"'){for(r++;r<e.length;){let s=e[r];if(s==="\\"&&r+1<e.length){let a=e[r+1];if(a==='"'||a==="\\"||a==="$"||a==="`"){n+=a,r+=2;continue}}if(s==='"'){r++;break}n+=s,r++;}continue}if(o==="'"){for(r++;r<e.length;){let s=e[r];if(s==="'"){r++;break}n+=s,r++;}continue}n+=o,r++;}return n.length>0&&t.push(n),t}function dn(e){return /[|&;<>()$`!#]/.test(e)}function fn(e){let t=re(e);if(t.length===0)return {command:"",args:[]};let n={command:t[0],args:t.slice(1)};if(n.args.length>0){let r=n.args[n.args.length-1];try{let o=JSON.parse(r);typeof o=="object"&&o!==null&&!Array.isArray(o)&&(n.options=o,n.args=n.args.slice(0,-1));}catch{}}return n}function ft(e,t=process.platform==="win32"?"windows":"unix"){return t==="windows"?e.includes(" ")||e.includes("&")||e.includes("|")||e.includes("<>")||e.includes("^")||e.includes('"')||e.includes("%")?`"${e.replace(/%/g,"%%").replace(/"/g,'^"')}"`:e:e.includes(" ")||e.includes("'")||e.includes('"')||e.includes("$")||e.includes("`")||e.includes("\\")||e.includes("!")||e.includes("#")||e.includes("&")||e.includes("*")||e.includes("?")||e.includes("|")||e.includes("<")||e.includes(">")||e.includes("(")||e.includes(")")||e.includes(";")?`'${e.replace(/'/g,"'\\''")}'`:e}var wr=new Set(["&&","||","|",";","&",">","<",">>","<<","2>","2>>","1>","1>>","2>&1","2>&2","1>&1","1>&2",">&","<&",">&1","<&1",">&2","<&2"]);function pn(e,t=process.platform==="win32"?"windows":"unix"){return wr.has(e)?e:ft(e,t)}function mn(){return process.platform==="win32"?"windows":"unix"}function ue(e,t,n=process.platform==="win32"?"windows":"unix"){let r=t.map(o=>pn(o,n));return [e,...r].join(" ")}function gn(e){if(e==null)return "";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>gn(t)).join(" ");if(e&&typeof e=="object"){if("raw"in e)return String(e.raw);if("toString"in e&&typeof e.toString=="function")return e.toString();if(e instanceof ReadableStream)throw new Error("ReadableStream expressions are not yet supported")}return String(e)}function Sr(e,t,n){return {stdout:e,stderr:t,exitCode:n,text(r="utf-8"){return e.toString(r)},json(){let r=e.toString("utf-8");return JSON.parse(r)},arrayBuffer(){let r=e.buffer;if(r instanceof ArrayBuffer)return r.slice(e.byteOffset,e.byteOffset+e.byteLength);let o=new ArrayBuffer(e.byteLength),s=new Uint8Array(o),a=new Uint8Array(r,e.byteOffset,e.byteLength);return s.set(a),o},bytes(){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},blob(){let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return new Blob([r])}}}function de(e,t={}){let n=re(e);if(n.length===0)throw new Error("Empty shell command");let r=async()=>{let s=await exports.PKG.run(n,{cwd:t.cwd,env:t.env}),a=Sr(Buffer.from(s.stdout,"utf-8"),Buffer.from(s.stderr,"utf-8"),s.code);if(s.code!==0&&!t.nothrow)throw Object.assign(new Error(`Command failed with exit code ${s.code}: ${e}
13
- ${s.stderr}`),{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode});return a},o=r();return Object.defineProperty(o,"stdin",{get(){throw new Error("stdin is not yet supported in EasbotShell. Use PKG.spawn for interactive commands.")},enumerable:true}),o.cwd=function(s){return de(e,{...t,cwd:s})},o.env=function(s){return de(e,{...t,env:s})},o.quiet=function(){return de(e,{...t,quiet:true})},o.lines=async function*(){let i=(await r()).text().split(/\r?\n/);for(let c of i)c.trim()&&(yield c);},o.text=async function(s="utf-8"){return (await r()).text(s)},o.json=async function(){return (await r()).json()},o.arrayBuffer=async function(){return (await r()).arrayBuffer()},o.blob=async function(){return (await r()).blob()},o.nothrow=function(){return de(e,{...t,nothrow:true})},o.throws=function(s){return de(e,{...t,nothrow:!s})},o}var we=class{constructor(t={}){chunkVRQQ33YH_cjs.c(this,"options");this.options=t;}call(t,...n){let r="";for(let o=0;o<t.length;o++)r+=t[o],o<n.length&&n[o]!==void 0&&(r+=gn(n[o]));return de(r,this.options)}braces(t){let n=t.match(/^(.*?)\{([^}]+)\}(.*)$/);if(!n)return [t];let[,r="",o="",s=""]=n,a=o.split(",").map(c=>c.trim()),i=[];for(let c of a){let p=`${r}${c}${s}`;p.includes("{")?i.push(...this.braces(p)):i.push(p);}return i}escape(t){return process.platform==="win32"?t.replace(/([&|<>^"%])/g,"^$1"):t.replace(/(["\s'$`\\!*?#&;()<>|])/g,"\\$1")}env(t){return ae({...this.options,env:t})}cwd(t){return ae({...this.options,cwd:t})}nothrow(){return ae({...this.options,nothrow:true})}throws(t){return ae({...this.options,nothrow:!t})}};function ae(e={}){let t=new we(e);return new Proxy(t,{apply(n,r,o){return t.call(o[0],...o.slice(1))}})}var hn=ae();function bn(e){return e.replace(/\\/g,"/")}function yn(e){return crypto$1.createHash("md5").update(e).digest("hex").slice(0,8)}var X=new Map;exports.PKG=void 0;(_=>{let e=chunkWWPI6PC4_cjs.a.create({service:"pkg"});async function t(S){let m=S?[S]:["npm","pnpm","bun"];for(let d of m){let u=await _.which(d);if(u)return {name:d,path:u}}}_.packageManager=t;async function n(S,m){if(!S)return process.execPath;let d=m?.PATH||process.env.PATH||process.env.Path||"",u=process.env.EASBOT_BIN_PATH,y=u?d+fe__default.default.delimiter+u:d,x=yn(y),g=`${S}:${x}`;if(X.has(g))return X.get(g);let R=process.platform==="win32"?"where":"which";try{let{spawn:T}=await import('child_process');return new Promise(k=>{let I=T(R,[S],{env:{...process.env,PATH:y},stdio:["pipe","pipe","ignore"],windowsHide:!0}),z="",L="";I.stdout?.on("data",D=>{z+=D.toString();}),I.stderr?.on("data",D=>{L+=D.toString();}),I.on("close",D=>{if(D===0&&z.trim()){let F=z.trim().split(`
14
- `),$=F.length>0?F[0]?.trim():null;if($){X.set(g,$),k($);return}}X.set(g,null),k(null);}),setTimeout(()=>{I.kill(),X.set(g,null),k(null);},5e3);})}catch{return X.set(g,null),null}}_.which=n;function r(S,m){if(!S)return process.execPath;let d=m?.PATH||process.env.PATH||process.env.Path||"",u=process.env.EASBOT_BIN_PATH,y=u?d+fe__default.default.delimiter+u:d,x=yn(y),g=`${S}:${x}`;if(X.has(g))return X.get(g);let R=process.platform==="win32"?"where":"which";try{let T=child_process.execSync(`${R} ${S}`,{encoding:"utf-8",stdio:["pipe","pipe","ignore"],env:{...process.env,PATH:y},timeout:5e3,windowsHide:!0});if(T.trim()){let k=T.trim().split(`
15
- `),I=k.length>0?k[0]?.trim():null;if(I)return X.set(g,I),I}}catch{}return X.set(g,null),null}_.whichSync=r;function o(){X.clear();}_.clearWhichCache=o;let s=module$1.createRequire(chunkVRQQ33YH_cjs.i);async function a(S,m,d){try{let u=[];if(d?.extraPaths)for(let y of d.extraPaths){let x=fe__default.default.join(y,"node_modules");u.push(x);}return m&&u.push(m),u.length>0?s.resolve(S,{paths:u}):s.resolve(S)}catch(u){throw new Error(`Cannot resolve module "${S}"${m?` from "${m}"`:""}: ${u instanceof Error?u.message:String(u)}`)}}_.resolve=a;function i(S){return {get name(){return fe__default.default.basename(S)},async exists(){try{return await oe__default.default.access(S),!0}catch{return false}},async getSize(){try{return (await oe__default.default.stat(S)).size}catch{return}},async text(){return await oe__default.default.readFile(S,"utf-8")},textSync(){return Le__default.default.readFileSync(S,"utf-8")},jsonSync(){let m=Le__default.default.readFileSync(S,"utf-8");return JSON.parse(m)},async bytes(){e.debug("[PKG.file.bytes] reading file:",{filePath:S});let m=await oe__default.default.readFile(S);return e.debug("[PKG.file.bytes] read succeeded, size:",{size:m.length}),new Uint8Array(m.buffer,m.byteOffset,m.byteLength)},async arrayBuffer(){let m=await oe__default.default.readFile(S);return m.buffer.slice(m.byteOffset,m.byteOffset+m.byteLength)},get type(){let m=fe__default.default.extname(S).toLowerCase();return {".txt":"text/plain",".html":"text/html",".htm":"text/html",".css":"text/css",".js":"application/javascript",".json":"application/json",".xml":"application/xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".pdf":"application/pdf",".zip":"application/zip",".wav":"audio/wav",".mp3":"audio/mpeg",".mp4":"video/mp4",".webm":"video/webm"}[m]||"application/octet-stream"},async write(m){let d;if(m instanceof Response){let u=await m.arrayBuffer();d=new Uint8Array(u);}else d=m;await oe__default.default.writeFile(S,d);},async json(){let m=await oe__default.default.readFile(S,"utf-8");return JSON.parse(m)},async stat(){return await oe__default.default.stat(S)}}}_.file=i;async function c(S,m,d){let u;if(m instanceof Response){let y=await m.arrayBuffer();u=new Uint8Array(y);}else u=m;await oe__default.default.writeFile(S,u,d?{mode:d.mode}:void 0);}_.write=c;function p(S,m,d){Le__default.default.writeFileSync(S,m,d?{mode:d.mode}:void 0);}_.writeSync=p;function l(S,m="utf-8"){return Le__default.default.readFileSync(S,m)}_.readSync=l;function f(S,m){let d,u;if(typeof S=="object"&&"cmd"in S){let T=S;d=T.cmd,u={cwd:T.cwd,env:T.env,stdout:T.stdout,stderr:T.stderr,stdin:T.stdin,signal:T.signal,windowsHide:T.windowsHide,shell:T.shell};}else d=Array.isArray(S)?S:[S],u=m||{};if(!d||d.length===0||!d[0])throw new Error("Spawn command cannot be empty");let y=[u.stdin==="inherit"?"inherit":u.stdin==="null"?"ignore":"pipe",u.stdout==="inherit"?"inherit":u.stdout==="null"?"ignore":"pipe",u.stderr==="inherit"?"inherit":u.stderr==="null"?"ignore":"pipe"],x={cwd:u.cwd,env:u.env?{...process.env,...u.env}:process.env,stdio:y,timeout:u.timeout};u.shell!==void 0&&(x.shell=u.shell),process.platform==="win32"&&(x.windowsHide=u.windowsHide??true);let g=child_process.spawn(d[0],d.slice(1),x),w;if(u.signal){w=()=>{g.kill();},u.signal.addEventListener("abort",w,{once:true});let T=()=>{w&&(u.signal?.removeEventListener("abort",w),w=void 0);};g.on("close",T),g.on("error",T);}let R=new Promise((T,k)=>{let I=false,z=()=>{I||(I=true,g.removeAllListeners());};if(g.on("close",L=>{z(),T(L??0);}),g.on("error",L=>{z(),k(L);}),u.timeout!==false){let L=u.timeout||3e5;setTimeout(()=>{if(!I){e.debug(`Process timeout after ${L}ms, killing process`,{cmd:d.join(" ")}),z();try{g.kill("SIGKILL");}catch{}k(new Error(`Process timeout after ${L}ms: ${d.join(" ")}`));}},L);}});return {stdout:g.stdout,stderr:g.stderr,stdin:g.stdin,pid:g.pid,exited:R,exitCode:g.exitCode,kill:T=>g.kill(T)}}_.spawn=f;async function h(S,m){let d=m?.stdin??"null",u=m?.stdout??"pipe",y=m?.stderr??"pipe",x=f(S,{cwd:m?.cwd,env:m?.env,stdin:d,stdout:u,stderr:y,windowsHide:m?.windowsHide,shell:m?.shell}),g=[],w=[];u==="pipe"&&x.stdout?.on("data",T=>{g.push(T);}),y==="pipe"&&x.stderr?.on("data",T=>{w.push(T);});let R=m?.timeout&&m.timeout>0?setTimeout(()=>{try{x.kill("SIGKILL");}catch{}x.stdout?.destroy(),x.stderr?.destroy(),x.stdin?.end();},m.timeout):void 0;try{let T=await x.exited;return clearTimeout(R),u==="pipe"&&x.stdout?.destroy(),y==="pipe"&&x.stderr?.destroy(),d==="pipe"&&x.stdin?.end(),{code:T,stdout:Buffer.concat(g).toString("utf-8"),stderr:Buffer.concat(w).toString("utf-8")}}catch(T){return clearTimeout(R),u==="pipe"&&x.stdout?.destroy(),y==="pipe"&&x.stderr?.destroy(),d==="pipe"&&x.stdin?.end(),{code:-1,stdout:Buffer.concat(g).toString("utf-8"),stderr:Buffer.concat(w).toString("utf-8")||(T instanceof Error?T.message:String(T))}}}_.run=h;async function v(S,m={},d={}){let u=f(S,{cwd:m.cwd,env:m.env,stdout:"pipe",stderr:"pipe",stdin:"null"}),y="",x="";u.stdout?.on("data",w=>{let R=w.toString("utf-8");y+=R,d.onStdout?.(R);}),u.stderr?.on("data",w=>{let R=w.toString("utf-8");x+=R,d.onStderr?.(R);});let g=m.timeout&&m.timeout>0?setTimeout(()=>{try{u.kill("SIGKILL");}catch{}u.stdout?.destroy(),u.stderr?.destroy();},m.timeout):void 0;try{let w=await u.exited;return clearTimeout(g),d.onExit?.(w),{code:w,stdout:y,stderr:x}}catch(w){clearTimeout(g);let R=w instanceof Error?w.message:String(w);return {code:-1,stdout:y,stderr:x||R}}}_.runWithStream=v;async function E(S){if(typeof S.pipeThrough=="function")try{let y=new TextDecoderStream("utf-8"),g=S.pipeThrough(y).getReader(),w="";try{for(;;){let{done:R,value:T}=await g.read();if(R)break;w+=T;}return w}finally{g.releaseLock();}}catch{}let m=S.getReader(),d=new TextDecoder("utf-8"),u=[];try{for(;;){let{done:y,value:x}=await m.read();if(y)break;u.push(d.decode(x,{stream:!0}));}return u.push(d.decode()),u.join("")}finally{m.releaseLock();}}_.readableStreamToText=E;async function N(S){let m=[];return new Promise((d,u)=>{S.on("data",y=>{typeof y=="string"?m.push(Buffer.from(y)):m.push(y);}),S.on("end",()=>{try{let x=Buffer.concat(m).toString("utf-8");d(x);}catch(y){u(y);}}),S.on("error",y=>{u(y);});})}_.nodeReadableStreamToText=N;function W(S,m=0){let R=new TextEncoder().encode(S),T=R.length,k,I=0;if(T>=16){let F=T-16,$=m+2654435761+2246822519|0,Q=m+2246822519|0,J=m+0|0,Z=m-2654435761|0;for(;I<=F;)$=z($,D(R,I)),I+=4,Q=z(Q,D(R,I)),I+=4,J=z(J,D(R,I)),I+=4,Z=z(Z,D(R,I)),I+=4;k=L($,1)+L(Q,7)+L(J,12)+L(Z,18)|0;}else k=m+374761393|0;for(k=k+T|0;I+4<=T;)k=k+D(R,I)*3266489917|0,k=L(k,17)*668265263|0,I+=4;for(;I<T;)k=k+R[I]*374761393|0,k=L(k,11)*2654435761|0,I++;return k^=k>>>15,k=k*2246822519|0,k^=k>>>13,k=k*3266489917|0,k^=k>>>16,k>>>0;function z(F,$){return F=F+$*2246822519|0,F=L(F,13),F=F*2654435761|0,F}function L(F,$){return F<<$|F>>>32-$|0}function D(F,$){return (F[$]|F[$+1]<<8|F[$+2]<<16|F[$+3]<<24)>>>0}}_.xxHash32=W;function H(S){let m=0;for(let d of S){let u=d.codePointAt(0)||d.charCodeAt(0);u<127?m+=1:u>=4352&&u<=4447||u>=9001&&u<=9002||u>=11904&&u<=42191&&u!==12351||u>=44032&&u<=55203||u>=63744&&u<=64255||u>=65040&&u<=65049||u>=65072&&u<=65135||u>=65280&&u<=65376||u>=65504&&u<=65510?m+=2:m+=1;}return m}_.stringWidth=H;class U{constructor(m){chunkVRQQ33YH_cjs.c(this,"pattern");this.pattern=m;}async*scan(m){let d=chunkAHO55TRS_cjs.b.stream(this.pattern,{cwd:m?.cwd,absolute:m?.absolute,follow:m?.followSymlinks,dot:m?.dot,nodir:m?.onlyFiles});for await(let u of d)yield bn(u);}*scanSync(m){let d=chunkAHO55TRS_cjs.a(this.pattern,{cwd:m?.cwd,absolute:m?.absolute,follow:m?.followSymlinks,dot:m?.dot,nodir:m?.onlyFiles});for(let u of d)yield bn(u);}match(m){return minimatch.minimatch(m,this.pattern)}}_.Glob=U,_.stdin=process.stdin,_.stdout=process.stdout,_.stderr=process.stderr,_.sleep=S=>new Promise(m=>setTimeout(m,S)),_.color=(S,m)=>({black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",brightBlack:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",blink:"\x1B[5m",inverse:"\x1B[7m",hidden:"\x1B[8m",strikethrough:"\x1B[9m",reset:"\x1B[0m"})[S.toLowerCase()]||null,_.hash={xxHash32:_.xxHash32},_.build=un.build,_.server=se,_.nodeWebSocket=nodeWs.createNodeWebSocket,_.restServer=at,_.rpcServer=it,_.streamingServer=lt,_.webSocketServer=ct;})(exports.PKG||(exports.PKG={}));var Mr=exports.PKG.readableStreamToText;exports.PKG.nodeReadableStreamToText;exports.PKG.which;var Er=exports.PKG.whichSync;exports.PKG.spawn;exports.PKG.run;var wn=200,Sn={bash:{login:true,posix:true},dash:{login:true,posix:true},fish:{deny:true,login:true},ksh:{login:true,posix:true},nu:{deny:true},powershell:{ps:true},pwsh:{ps:true},sh:{login:true,posix:true},zsh:{login:true,posix:true}};exports.Shell=void 0;(m=>{let e=chunkWWPI6PC4_cjs.a.create({service:"shell"});async function t(d,u){let y=d.pid;if(!(!y||u?.exited?.())){if(process.platform==="win32"){await new Promise(x=>{let g=child_process.spawn("taskkill",["/pid",String(y),"/f","/t"],{stdio:"ignore",windowsHide:true});g.once("exit",()=>x()),g.once("error",()=>x());});return}try{process.kill(-y,"SIGTERM"),await promises.setTimeout(wn),u?.exited?.()||process.kill(-y,"SIGKILL");}catch{d.kill("SIGTERM"),await promises.setTimeout(wn),u?.exited?.()||d.kill("SIGKILL");}}}m.killTree=t;function n(d){if(process.platform!=="win32"||!d.includes("/")&&!d.includes("\\")&&!d.includes(":"))return d;let u=chunkJL3GR4P7_cjs.c.normalize(d);return E(u)==="bash"&&h()||u}function r(d){return Sn[E(d)]}function o(d){return r(d)?.deny!==true}function s(d){return chunkJL3GR4P7_cjs.c.isAbsolute(d)}function a(d){let u=n(d);if(s(u))return chunkJL3GR4P7_cjs.c.stat(u)?.isFile()?u:void 0;let y=exports.PKG.whichSync(u);return y?chunkJL3GR4P7_cjs.c.normalize(y):void 0}function i(){return Array.from(new Set([exports.PKG.whichSync("pwsh"),exports.PKG.whichSync("powershell"),h(),process.env.COMSPEC||"cmd.exe"].filter(d=>!!d).map(n)))}async function c(){let d=await chunkJL3GR4P7_cjs.c.readText("/etc/shells").catch(()=>"");return d?Array.from(new Set(d.split(`
16
- `).filter(u=>u.trim()&&!u.startsWith("#")))):["/bin/bash","/bin/zsh","/bin/sh"]}function p(d,u){if(d&&(!u?.acceptable||o(d))){let y=a(d);if(y)return y}return process.platform==="win32"?i()[0]:v()}m.defaultPreferred=Fe(()=>p(process.env.SHELL)),m.defaultAcceptable=Fe(()=>p(process.env.SHELL,{acceptable:true}));function h(){if(process.platform!=="win32")return;if(process.env.EASBOT_GIT_BASH_PATH)return chunkJL3GR4P7_cjs.c.normalize(process.env.EASBOT_GIT_BASH_PATH);let d=exports.PKG.whichSync("git");if(!d)return;let u=chunkJL3GR4P7_cjs.c.normalize(fe__default.default.join(d,"..","..","bin","bash.exe"));if((chunkJL3GR4P7_cjs.c.stat(u)?.size??0)>0)return u}m.gitbash=h;function v(){if(process.platform==="win32"){let u=h();return u||"/bin/sh"}if(process.platform==="darwin")return "/bin/zsh";let d=exports.PKG.whichSync("bash");return d?chunkJL3GR4P7_cjs.c.normalize(d):"/bin/sh"}function E(d){return fe__default.default.posix.basename(chunkJL3GR4P7_cjs.c.toUnixPath(d)).toLowerCase()}m.name=E;function N(d){return r(d)?.login===true}m.login=N;function W(d){return r(d)?.posix===true}m.posix=W;function H(d){return r(d)?.ps===true}m.ps=H;function U(d){let u=n(d),y=E(u);return {path:u,name:y,acceptable:o(y)}}function G(d,u,y){let x=E(d),g=re(u),w=ue(g[0]??u,g.slice(1));return x==="nu"||x==="fish"?["-c",w]:x==="zsh"?["-l","-c",`
12
+ ${se}`,truncated:true,outputPath:G,originalLength:l.length,removedLength:de,label:E}}p.truncate=a;function i(l){return l.truncated?s(l.outputPath,l.label):""}p.formatHint=i;async function c(){let l=exports.Identifier.timestamp(exports.Identifier.create("context",false,Date.now()-o)),g=(await oe__default.default.readdir(p.DIR).catch(()=>[])).filter(k=>k.startsWith("context_"));for(let k of g)exports.Identifier.timestamp(k)>=l||await oe__default.default.unlink(chunkJL3GR4P7_cjs.c.join(p.DIR,k)).catch(()=>{});}p.cleanup=c;})(exports.TruncateContent||(exports.TruncateContent={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function st(e,t=true){let n=typeof e=="number"?new Date(e):e,r=n.getTimezoneOffset(),o=Math.floor(Math.abs(r)/60),s=Math.abs(r)%60,i=`${r<=0?"+":"-"}${String(o).padStart(2,"0")}:${String(s).padStart(2,"0")}`,c=n.getFullYear(),p=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0"),u=String(n.getHours()).padStart(2,"0"),g=String(n.getMinutes()).padStart(2,"0"),k=String(n.getSeconds()).padStart(2,"0"),E=`${c}-${p}-${l}T${u}:${g}:${k}`;if(t){let H=String(n.getMilliseconds()).padStart(3,"0");E+=`.${H}`;}return E+=i,E}function it(e){return st(e,false)}function Yt(){return Date.now()}function Xn(e=true){return st(Yt(),e)}function Qn(e){return e.includes("+")||e.includes("-")?new Date(e):new Date(e)}function er(e){let t=typeof e=="number"?new Date(e):e,n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return `${n}-${r}-${o}T${s}:${a}:${i}`}function tr(e=new Date){let t=e.getTimezoneOffset(),n=Math.floor(Math.abs(t)/60),r=Math.abs(t)%60;return `${t<=0?"+":"-"}${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`}exports.SessionTitle=void 0;(i=>{let e="New session - ",t="Child session - ";i.parentTitlePrefix=e,i.childTitlePrefix=t;function o(c=false){return (c?t:e)+it(new Date)}i.createDefault=o;function s(c){return new RegExp(`^(${e}|${t})\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[+-]\\d{2}:\\d{2}$`).test(c)}i.isDefault=s;function a(c){let p=c.match(/^(.+) \(fork #(\d+)\)$/);if(p){let l=p[1]??"",u=parseInt(p[2]??"0",10);return `${l} (fork #${u+1})`}return `${c} (fork #1)`}i.getForked=a;})(exports.SessionTitle||(exports.SessionTitle={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Vt(e){let t,n=false,r=()=>(n||(t=e(),n=true),t);return r.reset=()=>{n=false,t=void 0;},r}var Be=Vt;function Gt(e){let t,n=()=>(t||(t=e()),t);return n.reset=()=>{t=void 0;},n}var nr=Gt;exports.Lazy=void 0;(n=>(n.lazy=Vt,n.lazyAsync=Gt))(exports.Lazy||(exports.Lazy={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();var ne=chunkWWPI6PC4_cjs.a.create({service:"server"});function ae(e={}){let t=e.port??3e3,n=e.hostname??"0.0.0.0",r=new hono.Hono({strict:true,getPath:a=>{try{return new URL(a.url).pathname}catch{return a.url}}});if(e.onError?r.onError(e.onError):r.onError((a,i)=>(ne.error("Server error",{error:a.message,stack:a.stack}),a instanceof httpException.HTTPException?a.getResponse():i.json({error:"Internal Server Error",message:a.message},500))),e.onNotFound?r.notFound(e.onNotFound):r.notFound(a=>a.json({error:"Not Found",path:a.req.path},404)),!e.websockets&&e.cors&&r.use(cors.cors(typeof e.cors=="boolean"?{origin:"*"}:e.cors)),r.use(logger.logger((a,...i)=>ne.info(a,i))),!e.websockets&&e.secureHeaders&&r.use(secureHeaders.secureHeaders()),!e.websockets&&e.compression&&r.use(compress.compress({encoding:"gzip"})),!e.websockets&&e.timeout&&r.use(timeout.timeout(e.timeout)),e.middlewares)for(let a of e.middlewares)a.path?r.use(a.path,a.handler):r.use(a.handler);if(e.routes)for(let a of e.routes){let i=a.middlewares||[],c=a.method.toUpperCase();a.validation?r.on(c,a.path,zodValidator.zValidator("json",a.validation),...i,a.handler):r.on(c,a.path,...i,a.handler);}e.rpc&&r.post("/rpc/:method",async a=>{let i=a.req.param("method"),c=e.rpc?.[i];if(!c)return a.json({error:"RPC method not found"},404);try{let p=await a.req.json(),l=await c(p,a);return a.json({result:l})}catch(p){return ne.error("RPC error",{method:i,error:p.message}),a.json({error:"RPC execution failed",message:p.message},500)}}),e.fetch&&r.all("*",async a=>await e.fetch(a.req.raw));let o=null,s={url:new URL(`http://${n}:${t}`),port:t,hostname:n,hono:r,async stop(a=false){return o?new Promise((i,c)=>{a&&o.closeAllConnections?.(),o.close(p=>{p?(ne.error("Error closing server",{error:p.message}),c(p)):(o=null,ne.info(`Server on port ${t} stopped`),i());}),setTimeout(()=>{ne.warn(`Server shutdown timeout on port ${t}`),o=null,i();},5e3);}):Promise.resolve()},get raw(){return o||void 0}};return ne.debug("createServer: calling serve()",{port:t,hostname:n}),o=nodeServer.serve({fetch:r.fetch,port:t,hostname:n}),ne.debug("createServer: serve() returned, server created"),ne.info(`Server running on http://${n}:${t}`),s}function ct(e){return ae({rpc:e,port:3e3})}function ir(e,t=3e3,n="0.0.0.0"){return ae({fetch:e,port:t,hostname:n})}function lt(e,t={}){return ae({...t,routes:e})}function ut(e,t={}){return ae({...t,websockets:e})}function dt(e,t={}){let n=Object.entries(e).map(([r,o])=>({method:"get",path:`/stream/${r}`,handler:s=>streaming.streamSSE(s,async a=>{for await(let i of o(s))await a.writeSSE(i);})}));return ae({...t,routes:n,streaming:true})}chunkVRQQ33YH_cjs.j();var ce=chunkWWPI6PC4_cjs.a.create({service:"build-api"});async function cn(){try{return {available:!0,version:(await import('./chunks/main-RIJAJS2R.cjs')).version||"unknown"}}catch(e){return ce.warn("esbuild not available",{error:e.message}),{available:false}}}async function je(){let e=await cn();if(!e.available)throw new Error("esbuild is required but not installed. Please install it using: pnpm add -D esbuild");e.version&&e.version<"0.17.0"&&ce.warn(`esbuild version ${e.version} may have limited features. Consider upgrading to 0.17+`);}function ur(e){if(e!==void 0)return typeof e=="boolean"?{target:void 0}:typeof e=="string"?{target:e}:e}function ln(e){let t=ur(e.compile);t&&ce.warn("compile option is no longer supported (Bun runtime removed). The option will be ignored.");let n={entryPoints:e.entrypoints,outdir:e.outdir,bundle:e.bundle??true,conditions:e.conditions,external:e.external,format:e.format??"esm",platform:e.platform??(e.target==="browser"?"browser":"node"),minify:e.minify??false,treeShaking:true,splitting:e.splitting,sourcemap:dr(e.sourcemap),sourcesContent:true,define:e.define,inject:e.inject,legalComments:"eof",loader:e.loader,entryNames:e.entryNames,chunkNames:e.chunkNames,assetNames:e.assetNames,publicPath:e.publicPath,tsconfig:e.tsconfig,charset:"utf8",color:true,logLevel:"info",logLimit:50,plugins:e.plugins??[],metafile:true,write:e.write??true};return t?.outfile&&!e.outdir&&(n.outfile=t.outfile,delete n.outdir),e.target&&(n.target=fr(e.target)),e.minify===true&&(n.minifyWhitespace=true,n.minifyIdentifiers=true,n.minifySyntax=true),pr(n)}function dr(e){return !e||e==="none"?false:e}function fr(e){let t={browser:"es2020",node:"node16",bun:"esnext"};return e?t[e]||e:"esnext"}function pr(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function _e(e){if(e!==void 0)return e.replace(/\\/g,"/")}function rn(e,t,n){let r=[];if(e.outputFiles)for(let s of e.outputFiles)r.push({path:_e(s.path)||s.path,size:s.contents?.length||0});if(e.metafile?.outputs)for(let[s,a]of Object.entries(e.metafile.outputs)){let i=a;r.some(c=>c.path===s||c.path===_e(s))||r.push({path:_e(s)||s,size:i.bytes||0});}let o=[];if(e.errors?.length>0)for(let s of e.errors)o.push({level:"error",message:s.text||String(s),path:s.location?.file,position:s.location?{line:s.location.line,column:s.location.column}:void 0});if(e.warnings?.length>0)for(let s of e.warnings)o.push({level:"warning",message:s.text||String(s),path:s.location?.file,position:s.location?{line:s.location.line,column:s.location.column}:void 0});return {outputs:r,success:e.errors?.length===0,logs:o,metafile:e.metafile}}async function pt(e){ce.info("Build started",{entrypoints:e.entrypoints,target:e.target,format:e.format,compile:typeof e.compile}),await je();let t=await import('./chunks/main-RIJAJS2R.cjs'),n=Date.now();try{let r=ln(e);ce.debug("esbuild options",r);let o=await t.build(r),s=Date.now();return ce.info("Build completed",{duration:s-n,outputs:(o?.outputFiles?.length??0)>0||Object.keys(o.metafile?.outputs||{}).length>0}),rn(o,n,s)}catch(r){let o=Date.now(),s=r.message;return ce.error("Build failed",{error:s,duration:o-n}),r&&typeof r=="object"&&"errors"in r?rn(r):{outputs:[],success:false,logs:[{level:"error",message:s}],metafile:void 0}}}var xr={build:pt},un=xr;chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function re(e){let t=[],n="",r=0;for(;r<e.length&&(e[r]===" "||e[r]===" ");)r++;for(;r<e.length;){let o=e[r];if(o===" "||o===" "){for(n.length>0&&(t.push(n),n="");r<e.length&&(e[r]===" "||e[r]===" ");)r++;continue}if(o==='"'){for(r++;r<e.length;){let s=e[r];if(s==="\\"&&r+1<e.length){let a=e[r+1];if(a==='"'||a==="\\"||a==="$"||a==="`"){n+=a,r+=2;continue}}if(s==='"'){r++;break}n+=s,r++;}continue}if(o==="'"){for(r++;r<e.length;){let s=e[r];if(s==="'"){r++;break}n+=s,r++;}continue}n+=o,r++;}return n.length>0&&t.push(n),t}function dn(e){return /[|&;<>()$`!#]/.test(e)}function fn(e){let t=re(e);if(t.length===0)return {command:"",args:[]};let n={command:t[0],args:t.slice(1)};if(n.args.length>0){let r=n.args[n.args.length-1];try{let o=JSON.parse(r);typeof o=="object"&&o!==null&&!Array.isArray(o)&&(n.options=o,n.args=n.args.slice(0,-1));}catch{}}return n}function mt(e,t=process.platform==="win32"?"windows":"unix"){return t==="windows"?e.includes(" ")||e.includes("&")||e.includes("|")||e.includes("<>")||e.includes("^")||e.includes('"')||e.includes("%")?`"${e.replace(/%/g,"%%").replace(/"/g,'^"')}"`:e:e.includes(" ")||e.includes("'")||e.includes('"')||e.includes("$")||e.includes("`")||e.includes("\\")||e.includes("!")||e.includes("#")||e.includes("&")||e.includes("*")||e.includes("?")||e.includes("|")||e.includes("<")||e.includes(">")||e.includes("(")||e.includes(")")||e.includes(";")?`'${e.replace(/'/g,"'\\''")}'`:e}var wr=new Set(["&&","||","|",";","&",">","<",">>","<<","2>","2>>","1>","1>>","2>&1","2>&2","1>&1","1>&2",">&","<&",">&1","<&1",">&2","<&2"]);function pn(e,t=process.platform==="win32"?"windows":"unix"){return wr.has(e)?e:mt(e,t)}function mn(){return process.platform==="win32"?"windows":"unix"}function me(e,t,n=process.platform==="win32"?"windows":"unix"){let r=t.map(o=>pn(o,n));return [e,...r].join(" ")}function gn(e){if(e==null)return "";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>gn(t)).join(" ");if(e&&typeof e=="object"){if("raw"in e)return String(e.raw);if("toString"in e&&typeof e.toString=="function")return e.toString();if(e instanceof ReadableStream)throw new Error("ReadableStream expressions are not yet supported")}return String(e)}function Sr(e,t,n){return {stdout:e,stderr:t,exitCode:n,text(r="utf-8"){return e.toString(r)},json(){let r=e.toString("utf-8");return JSON.parse(r)},arrayBuffer(){let r=e.buffer;if(r instanceof ArrayBuffer)return r.slice(e.byteOffset,e.byteOffset+e.byteLength);let o=new ArrayBuffer(e.byteLength),s=new Uint8Array(o),a=new Uint8Array(r,e.byteOffset,e.byteLength);return s.set(a),o},bytes(){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},blob(){let r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return new Blob([r])}}}function ge(e,t={}){let n=re(e);if(n.length===0)throw new Error("Empty shell command");let r=async()=>{let s=await exports.PKG.run(n,{cwd:t.cwd,env:t.env}),a=Sr(Buffer.from(s.stdout,"utf-8"),Buffer.from(s.stderr,"utf-8"),s.code);if(s.code!==0&&!t.nothrow)throw Object.assign(new Error(`Command failed with exit code ${s.code}: ${e}
13
+ ${s.stderr}`),{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode});return a},o=r();return Object.defineProperty(o,"stdin",{get(){throw new Error("stdin is not yet supported in EasbotShell. Use PKG.spawn for interactive commands.")},enumerable:true}),o.cwd=function(s){return ge(e,{...t,cwd:s})},o.env=function(s){return ge(e,{...t,env:s})},o.quiet=function(){return ge(e,{...t,quiet:true})},o.lines=async function*(){let i=(await r()).text().split(/\r?\n/);for(let c of i)c.trim()&&(yield c);},o.text=async function(s="utf-8"){return (await r()).text(s)},o.json=async function(){return (await r()).json()},o.arrayBuffer=async function(){return (await r()).arrayBuffer()},o.blob=async function(){return (await r()).blob()},o.nothrow=function(){return ge(e,{...t,nothrow:true})},o.throws=function(s){return ge(e,{...t,nothrow:!s})},o}var Re=class{constructor(t={}){chunkVRQQ33YH_cjs.c(this,"options");this.options=t;}call(t,...n){let r="";for(let o=0;o<t.length;o++)r+=t[o],o<n.length&&n[o]!==void 0&&(r+=gn(n[o]));return ge(r,this.options)}braces(t){let n=t.match(/^(.*?)\{([^}]+)\}(.*)$/);if(!n)return [t];let[,r="",o="",s=""]=n,a=o.split(",").map(c=>c.trim()),i=[];for(let c of a){let p=`${r}${c}${s}`;p.includes("{")?i.push(...this.braces(p)):i.push(p);}return i}escape(t){return process.platform==="win32"?t.replace(/([&|<>^"%])/g,"^$1"):t.replace(/(["\s'$`\\!*?#&;()<>|])/g,"\\$1")}env(t){return le({...this.options,env:t})}cwd(t){return le({...this.options,cwd:t})}nothrow(){return le({...this.options,nothrow:true})}throws(t){return le({...this.options,nothrow:!t})}};function le(e={}){let t=new Re(e);return new Proxy(t,{apply(n,r,o){return t.call(o[0],...o.slice(1))}})}var hn=le();function bn(e){return e.replace(/\\/g,"/")}function yn(e){return crypto$1.createHash("md5").update(e).digest("hex").slice(0,8)}var X=new Map;exports.PKG=void 0;(_=>{let e=chunkWWPI6PC4_cjs.a.create({service:"pkg"});async function t(S){let m=S?[S]:["npm","pnpm","bun"];for(let f of m){let d=await _.which(f);if(d)return {name:f,path:d}}}_.packageManager=t;async function n(S,m){if(!S)return process.execPath;let f=m?.PATH||process.env.PATH||process.env.Path||"",d=process.env.EASBOT_BIN_PATH,y=d?f+he__default.default.delimiter+d:f,x=yn(y),h=`${S}:${x}`;if(X.has(h))return X.get(h);let R=process.platform==="win32"?"where":"which";try{let{spawn:v}=await import('child_process');return new Promise(T=>{let O=v(R,[S],{env:{...process.env,PATH:y},stdio:["pipe","pipe","ignore"],windowsHide:!0}),N="",L="";O.stdout?.on("data",D=>{N+=D.toString();}),O.stderr?.on("data",D=>{L+=D.toString();}),O.on("close",D=>{if(D===0&&N.trim()){let F=N.trim().split(`
14
+ `),A=F.length>0?F[0]?.trim():null;if(A){X.set(h,A),T(A);return}}X.set(h,null),T(null);}),setTimeout(()=>{O.kill(),X.set(h,null),T(null);},5e3);})}catch{return X.set(h,null),null}}_.which=n;function r(S,m){if(!S)return process.execPath;let f=m?.PATH||process.env.PATH||process.env.Path||"",d=process.env.EASBOT_BIN_PATH,y=d?f+he__default.default.delimiter+d:f,x=yn(y),h=`${S}:${x}`;if(X.has(h))return X.get(h);let R=process.platform==="win32"?"where":"which";try{let v=child_process.execSync(`${R} ${S}`,{encoding:"utf-8",stdio:["pipe","pipe","ignore"],env:{...process.env,PATH:y},timeout:5e3,windowsHide:!0});if(v.trim()){let T=v.trim().split(`
15
+ `),O=T.length>0?T[0]?.trim():null;if(O)return X.set(h,O),O}}catch{}return X.set(h,null),null}_.whichSync=r;function o(){X.clear();}_.clearWhichCache=o;let s=module$1.createRequire(chunkVRQQ33YH_cjs.i);async function a(S,m,f){try{let d=[];if(f?.extraPaths)for(let y of f.extraPaths){let x=he__default.default.join(y,"node_modules");d.push(x);}return m&&d.push(m),d.length>0?s.resolve(S,{paths:d}):s.resolve(S)}catch(d){throw new Error(`Cannot resolve module "${S}"${m?` from "${m}"`:""}: ${d instanceof Error?d.message:String(d)}`)}}_.resolve=a;function i(S){return {get name(){return he__default.default.basename(S)},async exists(){try{return await oe__default.default.access(S),!0}catch{return false}},async getSize(){try{return (await oe__default.default.stat(S)).size}catch{return}},async text(){return await oe__default.default.readFile(S,"utf-8")},textSync(){return De__default.default.readFileSync(S,"utf-8")},jsonSync(){let m=De__default.default.readFileSync(S,"utf-8");return JSON.parse(m)},async bytes(){e.debug("[PKG.file.bytes] reading file:",{filePath:S});let m=await oe__default.default.readFile(S);return e.debug("[PKG.file.bytes] read succeeded, size:",{size:m.length}),new Uint8Array(m.buffer,m.byteOffset,m.byteLength)},async arrayBuffer(){let m=await oe__default.default.readFile(S);return m.buffer.slice(m.byteOffset,m.byteOffset+m.byteLength)},get type(){let m=he__default.default.extname(S).toLowerCase();return {".txt":"text/plain",".html":"text/html",".htm":"text/html",".css":"text/css",".js":"application/javascript",".json":"application/json",".xml":"application/xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".pdf":"application/pdf",".zip":"application/zip",".wav":"audio/wav",".mp3":"audio/mpeg",".mp4":"video/mp4",".webm":"video/webm"}[m]||"application/octet-stream"},async write(m){let f;if(m instanceof Response){let d=await m.arrayBuffer();f=new Uint8Array(d);}else f=m;await oe__default.default.writeFile(S,f);},async json(){let m=await oe__default.default.readFile(S,"utf-8");return JSON.parse(m)},async stat(){return await oe__default.default.stat(S)}}}_.file=i;async function c(S,m,f){let d;if(m instanceof Response){let y=await m.arrayBuffer();d=new Uint8Array(y);}else d=m;await oe__default.default.writeFile(S,d,f?{mode:f.mode}:void 0);}_.write=c;function p(S,m,f){De__default.default.writeFileSync(S,m,f?{mode:f.mode}:void 0);}_.writeSync=p;function l(S,m="utf-8"){return De__default.default.readFileSync(S,m)}_.readSync=l;function u(S,m){let f,d;if(typeof S=="object"&&"cmd"in S){let v=S;f=v.cmd,d={cwd:v.cwd,env:v.env,stdout:v.stdout,stderr:v.stderr,stdin:v.stdin,signal:v.signal,windowsHide:v.windowsHide,shell:v.shell};}else f=Array.isArray(S)?S:[S],d=m||{};if(!f||f.length===0||!f[0])throw new Error("Spawn command cannot be empty");let y=[d.stdin==="inherit"?"inherit":d.stdin==="null"?"ignore":"pipe",d.stdout==="inherit"?"inherit":d.stdout==="null"?"ignore":"pipe",d.stderr==="inherit"?"inherit":d.stderr==="null"?"ignore":"pipe"],x={cwd:d.cwd,env:d.env?{...process.env,...d.env}:process.env,stdio:y,timeout:d.timeout};d.shell!==void 0&&(x.shell=d.shell),process.platform==="win32"&&(x.windowsHide=d.windowsHide??true);let h=child_process.spawn(f[0],f.slice(1),x),w;if(d.signal){w=()=>{h.kill();},d.signal.addEventListener("abort",w,{once:true});let v=()=>{w&&(d.signal?.removeEventListener("abort",w),w=void 0);};h.on("close",v),h.on("error",v);}let R=new Promise((v,T)=>{let O=false,N=()=>{O||(O=true,h.removeAllListeners());};if(h.on("close",L=>{N(),v(L??0);}),h.on("error",L=>{N(),T(L);}),d.timeout!==false){let L=d.timeout||3e5;setTimeout(()=>{if(!O){e.debug(`Process timeout after ${L}ms, killing process`,{cmd:f.join(" ")}),N();try{h.kill("SIGKILL");}catch{}T(new Error(`Process timeout after ${L}ms: ${f.join(" ")}`));}},L);}});return {stdout:h.stdout,stderr:h.stderr,stdin:h.stdin,pid:h.pid,exited:R,exitCode:h.exitCode,kill:v=>h.kill(v)}}_.spawn=u;async function g(S,m){let f=m?.stdin??"null",d=m?.stdout??"pipe",y=m?.stderr??"pipe",x=u(S,{cwd:m?.cwd,env:m?.env,stdin:f,stdout:d,stderr:y,windowsHide:m?.windowsHide,shell:m?.shell}),h=[],w=[];d==="pipe"&&x.stdout?.on("data",v=>{h.push(v);}),y==="pipe"&&x.stderr?.on("data",v=>{w.push(v);});let R=m?.timeout&&m.timeout>0?setTimeout(()=>{try{x.kill("SIGKILL");}catch{}x.stdout?.destroy(),x.stderr?.destroy(),x.stdin?.end();},m.timeout):void 0;try{let v=await x.exited;return clearTimeout(R),d==="pipe"&&x.stdout?.destroy(),y==="pipe"&&x.stderr?.destroy(),f==="pipe"&&x.stdin?.end(),{code:v,stdout:Buffer.concat(h).toString("utf-8"),stderr:Buffer.concat(w).toString("utf-8")}}catch(v){return clearTimeout(R),d==="pipe"&&x.stdout?.destroy(),y==="pipe"&&x.stderr?.destroy(),f==="pipe"&&x.stdin?.end(),{code:-1,stdout:Buffer.concat(h).toString("utf-8"),stderr:Buffer.concat(w).toString("utf-8")||(v instanceof Error?v.message:String(v))}}}_.run=g;async function k(S,m={},f={}){let d=u(S,{cwd:m.cwd,env:m.env,stdout:"pipe",stderr:"pipe",stdin:"null"}),y="",x="";d.stdout?.on("data",w=>{let R=w.toString("utf-8");y+=R,f.onStdout?.(R);}),d.stderr?.on("data",w=>{let R=w.toString("utf-8");x+=R,f.onStderr?.(R);});let h=m.timeout&&m.timeout>0?setTimeout(()=>{try{d.kill("SIGKILL");}catch{}d.stdout?.destroy(),d.stderr?.destroy();},m.timeout):void 0;try{let w=await d.exited;return clearTimeout(h),f.onExit?.(w),{code:w,stdout:y,stderr:x}}catch(w){clearTimeout(h);let R=w instanceof Error?w.message:String(w);return {code:-1,stdout:y,stderr:x||R}}}_.runWithStream=k;async function E(S){if(typeof S.pipeThrough=="function")try{let y=new TextDecoderStream("utf-8"),h=S.pipeThrough(y).getReader(),w="";try{for(;;){let{done:R,value:v}=await h.read();if(R)break;w+=v;}return w}finally{h.releaseLock();}}catch{}let m=S.getReader(),f=new TextDecoder("utf-8"),d=[];try{for(;;){let{done:y,value:x}=await m.read();if(y)break;d.push(f.decode(x,{stream:!0}));}return d.push(f.decode()),d.join("")}finally{m.releaseLock();}}_.readableStreamToText=E;async function H(S){let m=[];return new Promise((f,d)=>{S.on("data",y=>{typeof y=="string"?m.push(Buffer.from(y)):m.push(y);}),S.on("end",()=>{try{let x=Buffer.concat(m).toString("utf-8");f(x);}catch(y){d(y);}}),S.on("error",y=>{d(y);});})}_.nodeReadableStreamToText=H;function U(S,m=0){let R=new TextEncoder().encode(S),v=R.length,T,O=0;if(v>=16){let F=v-16,A=m+2654435761+2246822519|0,Q=m+2246822519|0,J=m+0|0,Z=m-2654435761|0;for(;O<=F;)A=N(A,D(R,O)),O+=4,Q=N(Q,D(R,O)),O+=4,J=N(J,D(R,O)),O+=4,Z=N(Z,D(R,O)),O+=4;T=L(A,1)+L(Q,7)+L(J,12)+L(Z,18)|0;}else T=m+374761393|0;for(T=T+v|0;O+4<=v;)T=T+D(R,O)*3266489917|0,T=L(T,17)*668265263|0,O+=4;for(;O<v;)T=T+R[O]*374761393|0,T=L(T,11)*2654435761|0,O++;return T^=T>>>15,T=T*2246822519|0,T^=T>>>13,T=T*3266489917|0,T^=T>>>16,T>>>0;function N(F,A){return F=F+A*2246822519|0,F=L(F,13),F=F*2654435761|0,F}function L(F,A){return F<<A|F>>>32-A|0}function D(F,A){return (F[A]|F[A+1]<<8|F[A+2]<<16|F[A+3]<<24)>>>0}}_.xxHash32=U;function q(S){let m=0;for(let f of S){let d=f.codePointAt(0)||f.charCodeAt(0);d<127?m+=1:d>=4352&&d<=4447||d>=9001&&d<=9002||d>=11904&&d<=42191&&d!==12351||d>=44032&&d<=55203||d>=63744&&d<=64255||d>=65040&&d<=65049||d>=65072&&d<=65135||d>=65280&&d<=65376||d>=65504&&d<=65510?m+=2:m+=1;}return m}_.stringWidth=q;class Y{constructor(m){chunkVRQQ33YH_cjs.c(this,"pattern");this.pattern=m;}async*scan(m){let f=chunkAHO55TRS_cjs.b.stream(this.pattern,{cwd:m?.cwd,absolute:m?.absolute,follow:m?.followSymlinks,dot:m?.dot,nodir:m?.onlyFiles});for await(let d of f)yield bn(d);}*scanSync(m){let f=chunkAHO55TRS_cjs.a(this.pattern,{cwd:m?.cwd,absolute:m?.absolute,follow:m?.followSymlinks,dot:m?.dot,nodir:m?.onlyFiles});for(let d of f)yield bn(d);}match(m){return minimatch.minimatch(m,this.pattern)}}_.Glob=Y,_.stdin=process.stdin,_.stdout=process.stdout,_.stderr=process.stderr,_.sleep=S=>new Promise(m=>setTimeout(m,S)),_.color=(S,m)=>({black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",brightBlack:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",blink:"\x1B[5m",inverse:"\x1B[7m",hidden:"\x1B[8m",strikethrough:"\x1B[9m",reset:"\x1B[0m"})[S.toLowerCase()]||null,_.hash={xxHash32:_.xxHash32},_.build=un.build,_.server=ae,_.nodeWebSocket=nodeWs.createNodeWebSocket,_.restServer=lt,_.rpcServer=ct,_.streamingServer=dt,_.webSocketServer=ut;})(exports.PKG||(exports.PKG={}));var Mr=exports.PKG.readableStreamToText;exports.PKG.nodeReadableStreamToText;exports.PKG.which;var Er=exports.PKG.whichSync;exports.PKG.spawn;exports.PKG.run;var wn=200,Sn={bash:{login:true,posix:true},dash:{login:true,posix:true},fish:{deny:true,login:true},ksh:{login:true,posix:true},nu:{deny:true},powershell:{ps:true},pwsh:{ps:true},sh:{login:true,posix:true},zsh:{login:true,posix:true}};exports.Shell=void 0;(m=>{let e=chunkWWPI6PC4_cjs.a.create({service:"shell"});async function t(f,d){let y=f.pid;if(!(!y||d?.exited?.())){if(process.platform==="win32"){await new Promise(x=>{let h=child_process.spawn("taskkill",["/pid",String(y),"/f","/t"],{stdio:"ignore",windowsHide:true});h.once("exit",()=>x()),h.once("error",()=>x());});return}try{process.kill(-y,"SIGTERM"),await promises.setTimeout(wn),d?.exited?.()||process.kill(-y,"SIGKILL");}catch{f.kill("SIGTERM"),await promises.setTimeout(wn),d?.exited?.()||f.kill("SIGKILL");}}}m.killTree=t;function n(f){if(process.platform!=="win32"||!f.includes("/")&&!f.includes("\\")&&!f.includes(":"))return f;let d=chunkJL3GR4P7_cjs.c.normalize(f);return E(d)==="bash"&&g()||d}function r(f){return Sn[E(f)]}function o(f){return r(f)?.deny!==true}function s(f){return chunkJL3GR4P7_cjs.c.isAbsolute(f)}function a(f){let d=n(f);if(s(d))return chunkJL3GR4P7_cjs.c.stat(d)?.isFile()?d:void 0;let y=exports.PKG.whichSync(d);return y?chunkJL3GR4P7_cjs.c.normalize(y):void 0}function i(){return Array.from(new Set([exports.PKG.whichSync("pwsh"),exports.PKG.whichSync("powershell"),g(),process.env.COMSPEC||"cmd.exe"].filter(f=>!!f).map(n)))}async function c(){let f=await chunkJL3GR4P7_cjs.c.readText("/etc/shells").catch(()=>"");return f?Array.from(new Set(f.split(`
16
+ `).filter(d=>d.trim()&&!d.startsWith("#")))):["/bin/bash","/bin/zsh","/bin/sh"]}function p(f,d){if(f&&(!d?.acceptable||o(f))){let y=a(f);if(y)return y}return process.platform==="win32"?i()[0]:k()}m.defaultPreferred=Be(()=>p(process.env.SHELL)),m.defaultAcceptable=Be(()=>p(process.env.SHELL,{acceptable:true}));function g(){if(process.platform!=="win32")return;if(process.env.EASBOT_GIT_BASH_PATH)return chunkJL3GR4P7_cjs.c.normalize(process.env.EASBOT_GIT_BASH_PATH);let f=exports.PKG.whichSync("git");if(!f)return;let d=chunkJL3GR4P7_cjs.c.normalize(he__default.default.join(f,"..","..","bin","bash.exe"));if((chunkJL3GR4P7_cjs.c.stat(d)?.size??0)>0)return d}m.gitbash=g;function k(){if(process.platform==="win32"){let d=g();return d||"/bin/sh"}if(process.platform==="darwin")return "/bin/zsh";let f=exports.PKG.whichSync("bash");return f?chunkJL3GR4P7_cjs.c.normalize(f):"/bin/sh"}function E(f){return he__default.default.posix.basename(chunkJL3GR4P7_cjs.c.toUnixPath(f)).toLowerCase()}m.name=E;function H(f){return r(f)?.login===true}m.login=H;function U(f){return r(f)?.posix===true}m.posix=U;function q(f){return r(f)?.ps===true}m.ps=q;function Y(f){let d=n(f),y=E(d);return {path:d,name:y,acceptable:o(y)}}function G(f,d,y){let x=E(f),h=re(d),w=me(h[0]??d,h.slice(1));return x==="nu"||x==="fish"?["-c",w]:x==="zsh"?["-l","-c",`
17
17
  [[ -f ~/.zshenv ]] && source ~/.zshenv >/dev/null 2>&1 || true
18
18
  [[ -f "\${ZDOTDIR:-$HOME}/.zshrc" ]] && source "\${ZDOTDIR:-$HOME}/.zshrc" >/dev/null 2>&1 || true
19
19
  cd -- "$1"
@@ -23,60 +23,60 @@ ${s.stderr}`),{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode});return a},o
23
23
  [[ -f ~/.bashrc ]] && source ~/.bashrc >/dev/null 2>&1 || true
24
24
  cd -- "$1"
25
25
  ${w}
26
- `,"easbot",y]:/^cmd(\.exe)?$/i.test(x)?["/c",`chcp 65001 >nul 2>&1 && ${w}`]:H(x)?["-NoProfile","-Command",`[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; ${w}`]:["-c",w]}m.args=G;function Ce(d){return d?p(d):(0, m.defaultPreferred)()}m.preferred=Ce;function Je(d){return d?p(d,{acceptable:true}):(0, m.defaultAcceptable)()}m.acceptable=Je;function Ke(){m.defaultPreferred.reset(),m.defaultAcceptable.reset();}m.reset=Ke;async function Dt(){return (process.platform==="win32"?i():await c()).filter(u=>a(u)).map(U)}m.list=Dt;function Ie(d){return Sn[E(d)]}m.metaInfo=Ie;function zt(d){return /[|&;<>()$`!#]/.test(d)}m.needsShell=zt;function O(){return process.platform==="win32"?i():["/bin/bash","/bin/zsh","/bin/sh"]}m.platformShells=O;function C(d){return d?!!a(d):false}m.isValid=C;async function A(d){let u=a(d);if(!u)return;let y=E(u);if(!/^cmd(\.exe)?$/i.test(y))try{let x;H(y)?x=["-NoProfile","-Command","$PSVersionTable.PSVersion.ToString()"]:x=["--version"],e.debug(`\u83B7\u53D6 Shell \u7248\u672C: ${u}`,{shell:u,args:x});let g=await exports.PKG.run([u,...x]);if(g.code===0){let w=g.stdout.trim().split(`
27
- `)[0];return e.debug(`Shell \u7248\u672C\u83B7\u53D6\u6210\u529F: ${w}`),w}e.debug(`Shell \u7248\u672C\u83B7\u53D6\u5931\u8D25\uFF0C\u9000\u51FA\u7801: ${g.code}`,{stderr:g.stderr});}catch(x){e.debug(`Shell \u7248\u672C\u83B7\u53D6\u5F02\u5E38: ${x}`);}}m.version=A;class q extends Error{constructor(y,x,g,w){super(y);chunkVRQQ33YH_cjs.c(this,"message",y);chunkVRQQ33YH_cjs.c(this,"pkg",x);chunkVRQQ33YH_cjs.c(this,"version",g);chunkVRQQ33YH_cjs.c(this,"originalError",w);this.name="InstallFailedError";}}m.InstallFailedError=q;async function V(d,u="latest",y){let{Lock:x}=await import('./chunks/lock-LMCPTUNU.cjs'),{Filesystem:g}=await import('./chunks/filesystem-ALW6PJKX.cjs'),{PackageRegistry:w}=await import('./chunks/registry-LIPZA2EC.cjs');y=y??process.env.EASBOT_CACHE_PATH??fe__default.default.join(".easbot","cache");let R=await x.write("pkg-install");try{let T=fe__default.default.posix.join(y,"node_modules",d),k=fe__default.default.posix.join(y,"package.json"),z=(await g.readJson(k).catch(async()=>{let K={dependencies:{}};return await g.writeJson(k,K),K})).dependencies??{},L=await g.exists(T),D=z[d],F=!1;if(!L||!D)F=!0;else {if(u!=="latest"&&D===u)return T;if(u==="latest"){if(!await w.isOutdated(d,D,y))return T;e.info("Cached version is outdated, proceeding with install",{pkg:d,cachedVersion:D}),F=!0;}}if(!F)return T;let $=m.acceptable(process.platform==="win32"?"cmd":void 0)??v(),Q=`${d}@${u}`;e.info("installing package",{pkg:d,version:u,cache:y,shell:$});let J=await exports.PKG.packageManager();if(!J)throw new q("No package manager found (npm, pnpm, bun)",d,u,"No package manager available");let Z=J.name,Ze=Z==="pnpm"?"add":"install",Xe=`${J.name} ${Ze} --save-exact ${Q}`;e.info(`Using ${Z} to install package`,{pkg:d,version:u,shell:$,pmPath:J.path});try{let K=await m.run($,Xe,{cwd:y,timeout:6e5,windowsHide:!0});if(K.code!==0)throw new Error(`Package manager exited with code ${K.code}: ${K.stderr}`);e.info(`Successfully installed ${d}@${u} with ${Z}`);}catch(K){let Ht=K instanceof Error?K:new Error(String(K));if(!await g.exists(T))throw new q(`Failed to install ${d}@${u}`,d,u,Ht.message);e.warn("Package install failed but module exists, continuing",{error:Ht.message});}let Qe=u;u==="latest"&&(Qe=(await g.readJson(fe__default.default.join(T,"package.json")).catch(()=>({})))?.version??"unknown");let Oe=await g.readJson(k);return Oe.dependencies=Oe.dependencies??{},Oe.dependencies[d]=Qe,await g.writeJson(k,Oe),e.info("Package installation completed",{pkg:d,version:Qe,path:T}),T}finally{R[Symbol.dispose]();}}m.install=V;async function ye(d,u,y){let x=d?m.acceptable(d)??v():m.acceptable()??v(),g=y?.cwd??process.cwd(),w=m.args(x,u,g);e.debug(`run shell process: ${x} ${w.join(" ")}`,{command:u,cwd:g});let{windowsHide:R,env:T,...k}=y??{},I={...process.env,LANG:"en_US.UTF-8",LC_ALL:"en_US.UTF-8",LC_CTYPE:"en_US.UTF-8",...T};process.platform==="win32"&&(I.CHCP="65001");let{stdin:z,stdout:L,stderr:D,timeout:F,signal:$,...Q}=k??{},J={...Q,cwd:g,env:I,windowsHide:process.platform==="win32"?R??true:void 0,shell:Q.shell,timeout:F},Z=E(x),Ze=/^cmd(\.exe)?$/i.test(Z),Xe=process.platform==="win32"&&Ze?"cmd":x;return exports.PKG.run([Xe,...w],J)}m.run=ye;function _(d,u,y){let x=d?m.acceptable(d)??v():m.acceptable()??v(),g=y?.cwd??process.cwd(),w=m.args(x,u,g);e.debug(`Spawn shell process: ${x} ${w.join(" ")}`,{command:u,cwd:g});let{stdin:R,stdout:T,stderr:k,timeout:I,signal:z,windowsHide:L,env:D,...F}=y??{},$={...process.env,LANG:"en_US.UTF-8",LC_ALL:"en_US.UTF-8",LC_CTYPE:"en_US.UTF-8",...D};process.platform==="win32"&&($.CHCP="65001");let Q=E(x),J=/^cmd(\.exe)?$/i.test(Q),Z={...F,cwd:g,env:$,windowsHide:process.platform==="win32"?L??true:void 0,shell:F.shell,timeout:I};return exports.PKG.spawn([J?"cmd":x,...w],Z)}m.spawn=_;function S(d,...u){let y=d.reduce((g,w,R)=>g+w+(u[R]??""),""),x=(g={})=>({quiet:()=>x({...g,quiet:true}),nothrow:()=>x({...g,nothrow:true}),cwd:w=>x({...g,cwd:w}),env:w=>x({...g,env:w}),stdin:w=>x({...g,stdin:w}),stdout:w=>x({...g,stdout:w}),stderr:w=>x({...g,stderr:w}),text:async()=>{let w=re(y.trim());if(w.length===0)throw new Error("Empty command");let R=w[0]??"",T=E(R),k=/^cmd(\.exe)?$/i.test(T),I=process.platform==="win32"&&k?"cmd":Ie(R)?R:void 0,z=ue(R,w.slice(1)),L=await m.run(I,z,{cwd:g.cwd,env:g.env,stdin:g.stdin,stdout:g.stdout,stderr:g.stderr,timeout:g.timeout,windowsHide:process.platform==="win32"?g.windowsHide??true:void 0,shell:g.shell});if(L.code!==0&&!g.nothrow)throw new Error(`Command failed with exit code ${L.code}: ${y}
28
- ${L.stderr}`);return L.stdout},lines:async()=>(await x(g).text()).split(`
29
- `).filter(R=>R.trim()),then:(w,R)=>{let T=re(y.trim()),k=T[0]??"",I=E(k),z=/^cmd(\.exe)?$/i.test(I),L=process.platform==="win32"&&z?"cmd":Ie(k)?k:void 0,D=ue(k,T.slice(1));return m.run(L,D,{cwd:g.cwd,env:g.env,stdin:g.stdin,stdout:g.stdout,stderr:g.stderr,timeout:g.timeout,windowsHide:process.platform==="win32"?g.windowsHide??true:void 0,shell:g.shell}).then(F=>{if(F.code!==0&&!g.nothrow){let $=new Error(`Command failed with exit code ${F.code}: ${y}
30
- ${F.stderr}`);if(R){R($);return}throw $}return w({exitCode:F.code,stdout:new TextEncoder().encode(F.stdout),stderr:new TextEncoder().encode(F.stderr),text:()=>F.stdout,lines:()=>F.stdout.split(`
31
- `).filter($=>$.trim())})},R)}});return x()}m.$=S;})(exports.Shell||(exports.Shell={}));var Ir=exports.Shell.$;chunkVRQQ33YH_cjs.j();var ke=class ke extends Error{static create(t,n){var s;let r=Be__default.default.object({name:Be__default.default.literal(t),data:n}).meta({ref:t}),o=(s=class extends ke{constructor(i,c){super(t,c);chunkVRQQ33YH_cjs.c(this,"data",i);chunkVRQQ33YH_cjs.c(this,"name",t);this.name=t;}static isInstance(i){return typeof i=="object"&&"name"in i&&i.name===t}schema(){return r}toObject(){return {name:t,data:this.data}}},chunkVRQQ33YH_cjs.c(s,"Schema",r),s);return Object.defineProperty(o,"name",{value:t}),o}};chunkVRQQ33YH_cjs.c(ke,"Unknown",ke.create("UnknownError",Be__default.default.object({message:Be__default.default.string()})));var pt=ke;chunkVRQQ33YH_cjs.j();exports.Ignore=void 0;(t=>{function e(n){return new gt(n)}t.create=e;})(exports.Ignore||(exports.Ignore={}));var gt=class{constructor(t){chunkVRQQ33YH_cjs.c(this,"rules",[]);chunkVRQQ33YH_cjs.c(this,"ignorecase");chunkVRQQ33YH_cjs.c(this,"debug");this.ignorecase=t?.ignorecase??false,this.debug=t?.debug??false;}add(t){let n=typeof t=="string"?t.split(`
32
- `):t;for(let r=0;r<n.length;r++){let o=n[r];this.parseRule(o,r+1);}return this}parseRule(t,n){let r=t;if(r.length===0||r.startsWith("#"))return;let s=r.startsWith("!");if(s&&(r=r.slice(1)),r=r.trimEnd(),r.length===0)return;if(r.startsWith("\\#")){r=r.slice(1);return}if(r.startsWith("#"))return;let i=r.endsWith("/");if(i&&(r=r.slice(0,-1)),r.length===0)return;let c=this.patternToRegex(r);c&&this.rules.push({pattern:r,regex:c,negative:s,isDirectory:i,original:t,lineNumber:n});}ignores(t,n){let r=this.normalizePath(t),o=n??t.endsWith("/"),s=this.checkIgnore(r,o);return this.debug&&console.log(`Ignore.ignores("${t}", isDirectory=${o}) => ${s}`),s}checkIgnore(t,n){let r=false;for(let o of this.rules)o.isDirectory&&!n||o.regex.test(t)&&(o.negative?r=false:r=true);return r}filter(t){return t.filter(n=>!this.ignores(n))}createFilter(){return t=>!this.ignores(t)}patternToRegex(t){let n=[],r=0,o=t.length;for(;r<o;){let p=t[r];if(p==="\\")if(r+1<o){let l=t[r+1];n.push(this.escapeRegexChar(l)),r+=2;continue}else {n.push("\\\\"),r++;continue}if(p==="*")if(r+1<o&&t[r+1]==="*")if(r+2<o&&t[r+2]==="/")if(r===0||t[r-1]==="/")if(r+3>=o){n.push(".*"),r+=3;continue}else {n.push(".*"),r+=3;continue}else {n.push(".*"),r+=3;continue}else if(r===0||t[r-1]==="/")if(r+2>=o){n.push(".*"),r+=2;continue}else {n.push("(?:/.*)*"),r+=2;continue}else {n.push(".*"),r+=2;continue}else {n.push("[^/]*"),r++;continue}if(p==="?"){n.push("[^/]"),r++;continue}if(p==="["){let l=this.findMatchingBracket(t,r);if(l!==-1){let f=t.slice(r,l+1);(f.startsWith("[!")||f.startsWith("[^"))&&(f="[^"+f.slice(2)),this.ignorecase&&(f=f.toLowerCase()),n.push(f),r=l+1;continue}}if(p==="/"){n.push("/"),r++;continue}if(".+$^{}|()".includes(p)){n.push("\\"+p),r++;continue}if(this.ignorecase&&p>="A"&&p<="Z"){n.push("["+p.toLowerCase()+p+"]"),r++;continue}n.push(p),r++;}let s=n.join(""),a=s.startsWith("/"),i=s.endsWith("/")&&!s.endsWith("\\/");a||(s="(?:.*/)?"+s),i&&(s=s.slice(0,-1)),!i&&!s.endsWith("(?:/.*)*")&&(s="(?:"+s+")(?:/.*)?");let c=this.ignorecase?"i":"";try{return new RegExp("^"+s+"$",c)}catch(p){return this.debug&&console.error(`Failed to create regex for pattern "${t}":`,p),null}}escapeRegexChar(t){return "\\[]{}().+^$|".includes(t)?"\\"+t:t}findMatchingBracket(t,n){let r=n+1,o=t.length;for((r>=o||t[r]==="!"||t[r]==="^")&&r++;r<o;){let s=t[r];if(s==="\\"&&r+1<o){r+=2;continue}if(s==="]")return r;if(r+2<o&&t[r+1]==="-"&&t[r+2]!=="]"){r+=3;continue}r++;}return -1}normalizePath(t){let n=t.replace(/\\/g,"/");if(n==="/")return "";for(;n.startsWith("./");)n=n.slice(2);return n}};chunkVRQQ33YH_cjs.j();function kn(e,t){let n=r=>{let o;try{o=e.parse(r);}catch(s){throw console.trace("schema validation failure stack trace:"),s instanceof Be.z.ZodError&&console.error("schema validation issues:",JSON.stringify(s.issues,null,2)),s}return t(o)};return n.force=r=>t(r),n.schema=e,n}var Fr=kn;exports.Fn=void 0;(t=>t.fn=kn)(exports.Fn||(exports.Fn={}));chunkVRQQ33YH_cjs.j();function Br(){let n=fe__default.default.join(process.cwd(),".env");Le.existsSync(n)&&dotenv.config({path:n,override:true,debug:false,encoding:"utf-8",quiet:true});}chunkVRQQ33YH_cjs.j();async function _r(e,t){if(process.env.EASBOT_CLIENT==="acp")try{let s=process.platform==="win32"?"cmd":void 0,a=exports.Shell.spawn(s,`git ${e.join(" ")}`,{stdin:void 0,stdout:"pipe",stderr:"pipe",cwd:t.cwd,env:t.env?{...process.env,...t.env}:process.env}),[i,c,p]=await Promise.all([a.exited,new Response(a.stdout).arrayBuffer(),new Response(a.stderr).arrayBuffer()]),l=Buffer.from(c),f=Buffer.from(p);return {exitCode:i,text:()=>l.toString(),stdout:l,stderr:f}}catch(s){let a=Buffer.from(s instanceof Error?s.message:String(s));return {exitCode:1,text:()=>"",stdout:Buffer.alloc(0),stderr:a}}let n=t.env?{...process.env,...t.env}:void 0,r=exports.Shell.$`git ${e.join(" ")}`.quiet().nothrow().cwd(t.cwd);n&&(r=r.env(n));let o=await r;return {exitCode:o.exitCode,text:()=>o.text(),stdout:o.stdout,stderr:o.stderr}}chunkVRQQ33YH_cjs.j();function vn(e){return e?fe.dirname(url.fileURLToPath(e)):typeof __dirname<"u"?__dirname:process.cwd()}function Tn(e,t,n=3){function r(o,s){if(s>n||!Le.existsSync(o))return null;try{let a=Le.readdirSync(o);for(let i of a){let c=fe.join(o,i);try{let p=Le.statSync(c);if(p.isFile()&&c.endsWith(t))return c;if(p.isDirectory()&&s<n){let l=r(c,s+1);if(l)return l}}catch{}}}catch{}return null}return r(e,0)}function Rn(e,t){let n=fe.join(e,t);if(Le.existsSync(n))return n;let r=t.split("/").pop()||t,o=e;for(let s=0;s<5;s++){let a=fe.join(o,"assets","txt");if(Le.existsSync(a)){let p=Tn(a,r,5);if(p)return p}let i=fe.join(o,"dist","assets","txt");if(Le.existsSync(i)){let p=Tn(i,r,5);if(p)return p}let c=fe.join(o,"..");if(c===o)break;o=c;}return n}function Hr(e,t){return exports.Lazy.lazy(()=>{try{let n=vn(t),r=Rn(n,e);return exports.PKG.file(r).textSync()}catch(n){throw console.error(`Failed to load text file: ${e}`,n),n}})}function Wr(e,t){return exports.Lazy.lazy(async()=>{try{let n=vn(t),r=Rn(n,e);return await exports.PKG.file(r).text()}catch(n){throw console.error(`Failed to load text file: ${e}`,n),n}})}chunkVRQQ33YH_cjs.j();function Ur(e){return e()}chunkVRQQ33YH_cjs.j();function qr(e){if(!e||typeof e!="string")return {provider:"",model:""};let t=e.indexOf("/");return t===-1?{provider:"",model:e}:{provider:e.substring(0,t),model:e.substring(t+1)}}chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function bt(e,t,n,r=()=>true){let o=-1,s=-1,a=0;for(let i=t;i<n;i++){if(!r(i))continue;let c=e[i];if(c){if(c==="("){a+=1;continue}if(c===")"&&a>0){a-=1;continue}a===0&&(c===`
33
- `?o=i:/\s/.test(c)&&(s=i));}}return {lastNewline:o,lastWhitespace:s}}function Yr(e,t){if(!e)return [];if(t<=0)return [e];if(e.length<=t)return [e]}function pe(e,t,n){try{let r=Be.z.string().parse(e),o=Be.z.number().int().parse(t),s=Yr(r,o);if(s)return s;let a=yt(r,o,i=>{let{lastNewline:c,lastWhitespace:p}=bt(i,0,i.length);return c>0?c:p});return n?.minLength&&n.minLength>0&&(a=Mn(a,n.minLength)),a}catch(r){return console.warn("Invalid input for chunkText:",r),typeof e=="string"&&e.length>0?[e]:[]}}function Mn(e,t){if(e.length<=1||t<=0)return e;let n=[],r=e[0]??"";for(let o=1;o<e.length;o++){let s=e[o]??"";r.length<t?r=r+`
26
+ `,"easbot",y]:/^cmd(\.exe)?$/i.test(x)?["/c",`chcp 65001 >nul 2>&1 && ${w}`]:q(x)?["-NoProfile","-Command",`[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; ${w}`]:["-c",w]}m.args=G;function de(f){return f?p(f):(0, m.defaultPreferred)()}m.preferred=de;function se(f){return f?p(f,{acceptable:true}):(0, m.defaultAcceptable)()}m.acceptable=se;function fe(){m.defaultPreferred.reset(),m.defaultAcceptable.reset();}m.reset=fe;async function ke(){return (process.platform==="win32"?i():await c()).filter(d=>a(d)).map(Y)}m.list=ke;function Te(f){return Sn[E(f)]}m.metaInfo=Te;function Ht(f){return /[|&;<>()$`!#]/.test(f)}m.needsShell=Ht;function I(){return process.platform==="win32"?i():["/bin/bash","/bin/zsh","/bin/sh"]}m.platformShells=I;function C(f){return f?!!a(f):false}m.isValid=C;async function $(f){let d=a(f);if(!d)return;let y=E(d);if(!/^cmd(\.exe)?$/i.test(y))try{let x;q(y)?x=["-NoProfile","-Command","$PSVersionTable.PSVersion.ToString()"]:x=["--version"],e.debug(`\u83B7\u53D6 Shell \u7248\u672C: ${d}`,{shell:d,args:x});let h=await exports.PKG.run([d,...x]);if(h.code===0){let w=h.stdout.trim().split(`
27
+ `)[0];return e.debug(`Shell \u7248\u672C\u83B7\u53D6\u6210\u529F: ${w}`),w}e.debug(`Shell \u7248\u672C\u83B7\u53D6\u5931\u8D25\uFF0C\u9000\u51FA\u7801: ${h.code}`,{stderr:h.stderr});}catch(x){e.debug(`Shell \u7248\u672C\u83B7\u53D6\u5F02\u5E38: ${x}`);}}m.version=$;class W extends Error{constructor(y,x,h,w){super(y);chunkVRQQ33YH_cjs.c(this,"message",y);chunkVRQQ33YH_cjs.c(this,"pkg",x);chunkVRQQ33YH_cjs.c(this,"version",h);chunkVRQQ33YH_cjs.c(this,"originalError",w);this.name="InstallFailedError";}}m.InstallFailedError=W;async function V(f,d="latest",y){let{Lock:x}=await import('./chunks/lock-LMCPTUNU.cjs'),{Filesystem:h}=await import('./chunks/filesystem-ALW6PJKX.cjs'),{PackageRegistry:w}=await import('./chunks/registry-LIPZA2EC.cjs');y=y??process.env.EASBOT_CACHE_PATH??he__default.default.join(".easbot","cache");let R=await x.write("pkg-install");try{let v=he__default.default.posix.join(y,"node_modules",f),T=he__default.default.posix.join(y,"package.json"),N=(await h.readJson(T).catch(async()=>{let K={dependencies:{}};return await h.writeJson(T,K),K})).dependencies??{},L=await h.exists(v),D=N[f],F=!1;if(!L||!D)F=!0;else {if(d!=="latest"&&D===d)return v;if(d==="latest"){if(!await w.isOutdated(f,D,y))return v;e.info("Cached version is outdated, proceeding with install",{pkg:f,cachedVersion:D}),F=!0;}}if(!F)return v;let A=m.acceptable(process.platform==="win32"?"cmd":void 0)??k(),Q=`${f}@${d}`;e.info("installing package",{pkg:f,version:d,cache:y,shell:A});let J=await exports.PKG.packageManager();if(!J)throw new W("No package manager found (npm, pnpm, bun)",f,d,"No package manager available");let Z=J.name,Qe=Z==="pnpm"?"add":"install",et=`${J.name} ${Qe} --save-exact ${Q}`;e.info(`Using ${Z} to install package`,{pkg:f,version:d,shell:A,pmPath:J.path});try{let K=await m.run(A,et,{cwd:y,timeout:6e5,windowsHide:!0});if(K.code!==0)throw new Error(`Package manager exited with code ${K.code}: ${K.stderr}`);e.info(`Successfully installed ${f}@${d} with ${Z}`);}catch(K){let Wt=K instanceof Error?K:new Error(String(K));if(!await h.exists(v))throw new W(`Failed to install ${f}@${d}`,f,d,Wt.message);e.warn("Package install failed but module exists, continuing",{error:Wt.message});}let tt=d;d==="latest"&&(tt=(await h.readJson(he__default.default.join(v,"package.json")).catch(()=>({})))?.version??"unknown");let $e=await h.readJson(T);return $e.dependencies=$e.dependencies??{},$e.dependencies[f]=tt,await h.writeJson(T,$e),e.info("Package installation completed",{pkg:f,version:tt,path:v}),v}finally{R[Symbol.dispose]();}}m.install=V;async function ve(f,d,y){let x=f?m.acceptable(f)??k():m.acceptable()??k(),h=y?.cwd??process.cwd(),w=m.args(x,d,h);e.debug(`run shell process: ${x} ${w.join(" ")}`,{command:d,cwd:h});let{windowsHide:R,env:v,...T}=y??{},O={...process.env,LANG:"en_US.UTF-8",LC_ALL:"en_US.UTF-8",LC_CTYPE:"en_US.UTF-8",...v};process.platform==="win32"&&(O.CHCP="65001");let{stdin:N,stdout:L,stderr:D,timeout:F,signal:A,...Q}=T??{},J={...Q,cwd:h,env:O,windowsHide:process.platform==="win32"?R??true:void 0,shell:Q.shell,timeout:F},Z=E(x),Qe=/^cmd(\.exe)?$/i.test(Z),et=process.platform==="win32"&&Qe?"cmd":x;return exports.PKG.run([et,...w],J)}m.run=ve;function _(f,d,y){let x=f?m.acceptable(f)??k():m.acceptable()??k(),h=y?.cwd??process.cwd(),w=m.args(x,d,h);e.debug(`Spawn shell process: ${x} ${w.join(" ")}`,{command:d,cwd:h});let{stdin:R,stdout:v,stderr:T,timeout:O,signal:N,windowsHide:L,env:D,...F}=y??{},A={...process.env,LANG:"en_US.UTF-8",LC_ALL:"en_US.UTF-8",LC_CTYPE:"en_US.UTF-8",...D};process.platform==="win32"&&(A.CHCP="65001");let Q=E(x),J=/^cmd(\.exe)?$/i.test(Q),Z={...F,cwd:h,env:A,windowsHide:process.platform==="win32"?L??true:void 0,shell:F.shell,timeout:O};return exports.PKG.spawn([J?"cmd":x,...w],Z)}m.spawn=_;function S(f,...d){let y=f.reduce((h,w,R)=>h+w+(d[R]??""),""),x=(h={})=>({quiet:()=>x({...h,quiet:true}),nothrow:()=>x({...h,nothrow:true}),cwd:w=>x({...h,cwd:w}),env:w=>x({...h,env:w}),stdin:w=>x({...h,stdin:w}),stdout:w=>x({...h,stdout:w}),stderr:w=>x({...h,stderr:w}),text:async()=>{let w=re(y.trim());if(w.length===0)throw new Error("Empty command");let R=w[0]??"",v=E(R),T=/^cmd(\.exe)?$/i.test(v),O=process.platform==="win32"&&T?"cmd":Te(R)?R:void 0,N=me(R,w.slice(1)),L=await m.run(O,N,{cwd:h.cwd,env:h.env,stdin:h.stdin,stdout:h.stdout,stderr:h.stderr,timeout:h.timeout,windowsHide:process.platform==="win32"?h.windowsHide??true:void 0,shell:h.shell});if(L.code!==0&&!h.nothrow)throw new Error(`Command failed with exit code ${L.code}: ${y}
28
+ ${L.stderr}`);return L.stdout},lines:async()=>(await x(h).text()).split(`
29
+ `).filter(R=>R.trim()),then:(w,R)=>{let v=re(y.trim()),T=v[0]??"",O=E(T),N=/^cmd(\.exe)?$/i.test(O),L=process.platform==="win32"&&N?"cmd":Te(T)?T:void 0,D=me(T,v.slice(1));return m.run(L,D,{cwd:h.cwd,env:h.env,stdin:h.stdin,stdout:h.stdout,stderr:h.stderr,timeout:h.timeout,windowsHide:process.platform==="win32"?h.windowsHide??true:void 0,shell:h.shell}).then(F=>{if(F.code!==0&&!h.nothrow){let A=new Error(`Command failed with exit code ${F.code}: ${y}
30
+ ${F.stderr}`);if(R){R(A);return}throw A}return w({exitCode:F.code,stdout:new TextEncoder().encode(F.stdout),stderr:new TextEncoder().encode(F.stderr),text:()=>F.stdout,lines:()=>F.stdout.split(`
31
+ `).filter(A=>A.trim())})},R)}});return x()}m.$=S;})(exports.Shell||(exports.Shell={}));var Or=exports.Shell.$;chunkVRQQ33YH_cjs.j();var Me=class Me extends Error{static create(t,n){var s;let r=Ne__default.default.object({name:Ne__default.default.literal(t),data:n}).meta({ref:t}),o=(s=class extends Me{constructor(i,c){super(t,c);chunkVRQQ33YH_cjs.c(this,"data",i);chunkVRQQ33YH_cjs.c(this,"name",t);this.name=t;}static isInstance(i){return typeof i=="object"&&"name"in i&&i.name===t}schema(){return r}toObject(){return {name:t,data:this.data}}},chunkVRQQ33YH_cjs.c(s,"Schema",r),s);return Object.defineProperty(o,"name",{value:t}),o}};chunkVRQQ33YH_cjs.c(Me,"Unknown",Me.create("UnknownError",Ne__default.default.object({message:Ne__default.default.string()})));var gt=Me;chunkVRQQ33YH_cjs.j();exports.Ignore=void 0;(t=>{function e(n){return new bt(n)}t.create=e;})(exports.Ignore||(exports.Ignore={}));var bt=class{constructor(t){chunkVRQQ33YH_cjs.c(this,"rules",[]);chunkVRQQ33YH_cjs.c(this,"ignorecase");chunkVRQQ33YH_cjs.c(this,"debug");this.ignorecase=t?.ignorecase??false,this.debug=t?.debug??false;}add(t){let n=typeof t=="string"?t.split(`
32
+ `):t;for(let r=0;r<n.length;r++){let o=n[r];this.parseRule(o,r+1);}return this}parseRule(t,n){let r=t;if(r.length===0||r.startsWith("#"))return;let s=r.startsWith("!");if(s&&(r=r.slice(1)),r=r.trimEnd(),r.length===0)return;if(r.startsWith("\\#")){r=r.slice(1);return}if(r.startsWith("#"))return;let i=r.endsWith("/");if(i&&(r=r.slice(0,-1)),r.length===0)return;let c=this.patternToRegex(r);c&&this.rules.push({pattern:r,regex:c,negative:s,isDirectory:i,original:t,lineNumber:n});}ignores(t,n){let r=this.normalizePath(t),o=n??t.endsWith("/"),s=this.checkIgnore(r,o);return this.debug&&console.log(`Ignore.ignores("${t}", isDirectory=${o}) => ${s}`),s}checkIgnore(t,n){let r=false;for(let o of this.rules)o.isDirectory&&!n||o.regex.test(t)&&(o.negative?r=false:r=true);return r}filter(t){return t.filter(n=>!this.ignores(n))}createFilter(){return t=>!this.ignores(t)}patternToRegex(t){let n=[],r=0,o=t.length;for(;r<o;){let p=t[r];if(p==="\\")if(r+1<o){let l=t[r+1];n.push(this.escapeRegexChar(l)),r+=2;continue}else {n.push("\\\\"),r++;continue}if(p==="*")if(r+1<o&&t[r+1]==="*")if(r+2<o&&t[r+2]==="/")if(r===0||t[r-1]==="/")if(r+3>=o){n.push(".*"),r+=3;continue}else {n.push(".*"),r+=3;continue}else {n.push(".*"),r+=3;continue}else if(r===0||t[r-1]==="/")if(r+2>=o){n.push(".*"),r+=2;continue}else {n.push("(?:/.*)*"),r+=2;continue}else {n.push(".*"),r+=2;continue}else {n.push("[^/]*"),r++;continue}if(p==="?"){n.push("[^/]"),r++;continue}if(p==="["){let l=this.findMatchingBracket(t,r);if(l!==-1){let u=t.slice(r,l+1);(u.startsWith("[!")||u.startsWith("[^"))&&(u="[^"+u.slice(2)),this.ignorecase&&(u=u.toLowerCase()),n.push(u),r=l+1;continue}}if(p==="/"){n.push("/"),r++;continue}if(".+$^{}|()".includes(p)){n.push("\\"+p),r++;continue}if(this.ignorecase&&p>="A"&&p<="Z"){n.push("["+p.toLowerCase()+p+"]"),r++;continue}n.push(p),r++;}let s=n.join(""),a=s.startsWith("/"),i=s.endsWith("/")&&!s.endsWith("\\/");a||(s="(?:.*/)?"+s),i&&(s=s.slice(0,-1)),!i&&!s.endsWith("(?:/.*)*")&&(s="(?:"+s+")(?:/.*)?");let c=this.ignorecase?"i":"";try{return new RegExp("^"+s+"$",c)}catch(p){return this.debug&&console.error(`Failed to create regex for pattern "${t}":`,p),null}}escapeRegexChar(t){return "\\[]{}().+^$|".includes(t)?"\\"+t:t}findMatchingBracket(t,n){let r=n+1,o=t.length;for((r>=o||t[r]==="!"||t[r]==="^")&&r++;r<o;){let s=t[r];if(s==="\\"&&r+1<o){r+=2;continue}if(s==="]")return r;if(r+2<o&&t[r+1]==="-"&&t[r+2]!=="]"){r+=3;continue}r++;}return -1}normalizePath(t){let n=t.replace(/\\/g,"/");if(n==="/")return "";for(;n.startsWith("./");)n=n.slice(2);return n}};chunkVRQQ33YH_cjs.j();function kn(e,t){let n=r=>{let o;try{o=e.parse(r);}catch(s){throw console.trace("schema validation failure stack trace:"),s instanceof Ne.z.ZodError&&console.error("schema validation issues:",JSON.stringify(s.issues,null,2)),s}return t(o)};return n.force=r=>t(r),n.schema=e,n}var Fr=kn;exports.Fn=void 0;(t=>t.fn=kn)(exports.Fn||(exports.Fn={}));chunkVRQQ33YH_cjs.j();function Br(){let n=he__default.default.join(process.cwd(),".env");De.existsSync(n)&&dotenv.config({path:n,override:true,debug:false,encoding:"utf-8",quiet:true});}chunkVRQQ33YH_cjs.j();async function _r(e,t){if(process.env.EASBOT_CLIENT==="acp")try{let s=process.platform==="win32"?"cmd":void 0,a=exports.Shell.spawn(s,`git ${e.join(" ")}`,{stdin:void 0,stdout:"pipe",stderr:"pipe",cwd:t.cwd,env:t.env?{...process.env,...t.env}:process.env}),[i,c,p]=await Promise.all([a.exited,new Response(a.stdout).arrayBuffer(),new Response(a.stderr).arrayBuffer()]),l=Buffer.from(c),u=Buffer.from(p);return {exitCode:i,text:()=>l.toString(),stdout:l,stderr:u}}catch(s){let a=Buffer.from(s instanceof Error?s.message:String(s));return {exitCode:1,text:()=>"",stdout:Buffer.alloc(0),stderr:a}}let n=t.env?{...process.env,...t.env}:void 0,r=exports.Shell.$`git ${e.join(" ")}`.quiet().nothrow().cwd(t.cwd);n&&(r=r.env(n));let o=await r;return {exitCode:o.exitCode,text:()=>o.text(),stdout:o.stdout,stderr:o.stderr}}chunkVRQQ33YH_cjs.j();function vn(e){return e?he.dirname(url.fileURLToPath(e)):typeof __dirname<"u"?__dirname:process.cwd()}function Tn(e,t,n=3){function r(o,s){if(s>n||!De.existsSync(o))return null;try{let a=De.readdirSync(o);for(let i of a){let c=he.join(o,i);try{let p=De.statSync(c);if(p.isFile()&&c.endsWith(t))return c;if(p.isDirectory()&&s<n){let l=r(c,s+1);if(l)return l}}catch{}}}catch{}return null}return r(e,0)}function Rn(e,t){let n=he.join(e,t);if(De.existsSync(n))return n;let r=t.split("/").pop()||t,o=e;for(let s=0;s<5;s++){let a=he.join(o,"assets","txt");if(De.existsSync(a)){let p=Tn(a,r,5);if(p)return p}let i=he.join(o,"dist","assets","txt");if(De.existsSync(i)){let p=Tn(i,r,5);if(p)return p}let c=he.join(o,"..");if(c===o)break;o=c;}return n}function Hr(e,t){return exports.Lazy.lazy(()=>{try{let n=vn(t),r=Rn(n,e);return exports.PKG.file(r).textSync()}catch(n){throw console.error(`Failed to load text file: ${e}`,n),n}})}function Wr(e,t){return exports.Lazy.lazy(async()=>{try{let n=vn(t),r=Rn(n,e);return await exports.PKG.file(r).text()}catch(n){throw console.error(`Failed to load text file: ${e}`,n),n}})}chunkVRQQ33YH_cjs.j();function Ur(e){return e()}chunkVRQQ33YH_cjs.j();function qr(e){if(!e||typeof e!="string")return {provider:"",model:""};let t=e.indexOf("/");return t===-1?{provider:"",model:e}:{provider:e.substring(0,t),model:e.substring(t+1)}}chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function xt(e,t,n,r=()=>true){let o=-1,s=-1,a=0;for(let i=t;i<n;i++){if(!r(i))continue;let c=e[i];if(c){if(c==="("){a+=1;continue}if(c===")"&&a>0){a-=1;continue}a===0&&(c===`
33
+ `?o=i:/\s/.test(c)&&(s=i));}}return {lastNewline:o,lastWhitespace:s}}function Yr(e,t){if(!e)return [];if(t<=0)return [e];if(e.length<=t)return [e]}function be(e,t,n){try{let r=Ne.z.string().parse(e),o=Ne.z.number().int().parse(t),s=Yr(r,o);if(s)return s;let a=wt(r,o,i=>{let{lastNewline:c,lastWhitespace:p}=xt(i,0,i.length);return c>0?c:p});return n?.minLength&&n.minLength>0&&(a=Mn(a,n.minLength)),a}catch(r){return console.warn("Invalid input for chunkText:",r),typeof e=="string"&&e.length>0?[e]:[]}}function Mn(e,t){if(e.length<=1||t<=0)return e;let n=[],r=e[0]??"";for(let o=1;o<e.length;o++){let s=e[o]??"";r.length<t?r=r+`
34
34
 
35
35
  `+s:(n.push(r),r=s);}if(r.length>0)if(r.length<t&&n.length>0){let o=n.pop();n.push(o+`
36
36
 
37
- `+r);}else n.push(r);return n}function yt(e,t,n){if(!e)return [];if(t<=0||e.length<=t)return [e];let r=[],o=e;for(;o.length>t;){let s=o.slice(0,t),a=n(s),i=Number.isFinite(a)&&a>0&&a<=t?a:t,p=o.slice(0,i).trimEnd();p.length>0&&r.push(p);let l=i<o.length&&o[i]!==void 0&&/\s/.test(o[i]),f=Math.min(o.length,i+(l?1:0));o=o.slice(f).trimStart();}return o.length>0&&r.push(o),r}chunkVRQQ33YH_cjs.j();var xt=Be.z.enum(["bold","italic","strikethrough","code","code_block","spoiler","blockquote"]),En=Be.z.object({start:Be.z.number().int().min(0),end:Be.z.number().int().min(0),style:xt}).strict().refine(e=>e.end>=e.start,{message:"end must be greater than or equal to start"}),Cn=Be.z.object({start:Be.z.number().int().min(0),end:Be.z.number().int().min(0),href:Be.z.string().min(1)}).strict().refine(e=>e.end>=e.start,{message:"end must be greater than or equal to start"}),ve=Be.z.object({text:Be.z.string(),styles:Be.z.array(En),links:Be.z.array(Cn)}).strict(),Re=Be.z.enum(["off","bullets","code"]),je=Be.z.object({linkify:Be.z.boolean().default(true),enableSpoilers:Be.z.boolean().default(false),headingStyle:Be.z.enum(["none","bold"]).default("none"),blockquotePrefix:Be.z.string().default(""),autolink:Be.z.boolean().default(true),tableMode:Re.default("off")}).partial().default({}),In=Be.z.object({open:Be.z.string(),close:Be.z.string()}).strict(),wt=Be.z.object({styleMarkers:Be.z.record(xt,In).optional(),escapeText:Be.z.any().optional(),buildLink:Be.z.any().optional()}).strict();Be.z.object({start:Be.z.number().int().min(0),end:Be.z.number().int().min(0),open:Be.z.string(),close:Be.z.string()}).strict();var St=Be.z.object({indentSize:Be.z.number().int().min(1).default(2),listMarker:Be.z.enum(["\u2022","-","*"]).default("\u2022"),codeBlockMarker:Be.z.enum(["```","~~~"]).default("```"),preserveFrontmatter:Be.z.boolean().default(true)}).strict(),kt=Be.z.record(Be.z.string(),Be.z.string()),Ne=Be.z.object({open:Be.z.boolean(),ticks:Be.z.number().int().min(0)}).strict();Be.z.object({inlineState:Ne,isInside:Be.z.any()}).strict();Be.z.object({start:Be.z.number().int().min(0),end:Be.z.number().int().min(0),openLine:Be.z.string(),marker:Be.z.string(),indent:Be.z.string()}).strict();Be.z.object({tables:Re.optional()}).strict();function Xr(e){let t=new Zr__default.default({html:false,linkify:e.linkify??true,breaks:false,typographer:false});return t.enable("strikethrough"),e.tableMode&&e.tableMode!=="off"?t.enable("table"):t.disable("table"),e.autolink===false&&t.disable("autolink"),t}function On(e,t){if(e.attrGet)return e.attrGet(t);if(e.attrs){for(let[n,r]of e.attrs)if(n===t)return r}return null}function Tt(e,t){return {...e,type:"text",content:t,children:void 0}}function Qr(e){for(let t of e)t.children&&t.children.length>0&&(t.children=eo(t.children));}function eo(e){let t=0;for(let a of e){if(a.type!=="text")continue;let i=a.content??"",c=0;for(;c<i.length;){let p=i.indexOf("||",c);if(p===-1)break;t+=1,c=p+2;}}if(t<2)return e;let n=t-t%2,r=[],o={spoilerOpen:false},s=0;for(let a of e){if(a.type!=="text"){r.push(a);continue}let i=a.content??"";if(!i.includes("||")){r.push(a);continue}let c=0;for(;c<i.length;){let p=i.indexOf("||",c);if(p===-1){c<i.length&&r.push(Tt(a,i.slice(c)));break}if(s>=n){r.push(Tt(a,i.slice(c)));break}p>c&&r.push(Tt(a,i.slice(c,p))),s+=1,o.spoilerOpen=!o.spoilerOpen,r.push({type:o.spoilerOpen?"spoiler_open":"spoiler_close"}),c=p+2;}}return r}function to(){return {text:"",styles:[],openStyles:[],links:[],linkStack:[]}}function ce(e){return e.table?.currentCell??e}function De(e,t){if(!t)return;let n=ce(e);n.text+=t;}function me(e,t){let n=ce(e);n.openStyles.push({style:t,start:n.text.length});}function ge(e,t){let n=ce(e);for(let r=n.openStyles.length-1;r>=0;r-=1){let o=n.openStyles[r];if(o?.style===t){let s=o.start;n.openStyles.splice(r,1);let a=n.text.length;a>s&&n.styles.push({start:s,end:a,style:t});return}}}function Fn(e){e.env.listStack.length>0||e.table||(e.text+=`
37
+ `+r);}else n.push(r);return n}function wt(e,t,n){if(!e)return [];if(t<=0||e.length<=t)return [e];let r=[],o=e;for(;o.length>t;){let s=o.slice(0,t),a=n(s),i=Number.isFinite(a)&&a>0&&a<=t?a:t,p=o.slice(0,i).trimEnd();p.length>0&&r.push(p);let l=i<o.length&&o[i]!==void 0&&/\s/.test(o[i]),u=Math.min(o.length,i+(l?1:0));o=o.slice(u).trimStart();}return o.length>0&&r.push(o),r}chunkVRQQ33YH_cjs.j();var St=Ne.z.enum(["bold","italic","strikethrough","code","code_block","spoiler","blockquote"]),En=Ne.z.object({start:Ne.z.number().int().min(0),end:Ne.z.number().int().min(0),style:St}).strict().refine(e=>e.end>=e.start,{message:"end must be greater than or equal to start"}),Cn=Ne.z.object({start:Ne.z.number().int().min(0),end:Ne.z.number().int().min(0),href:Ne.z.string().min(1)}).strict().refine(e=>e.end>=e.start,{message:"end must be greater than or equal to start"}),Ce=Ne.z.object({text:Ne.z.string(),styles:Ne.z.array(En),links:Ne.z.array(Cn)}).strict(),Oe=Ne.z.enum(["off","bullets","code"]),He=Ne.z.object({linkify:Ne.z.boolean().default(true),enableSpoilers:Ne.z.boolean().default(false),headingStyle:Ne.z.enum(["none","bold"]).default("none"),blockquotePrefix:Ne.z.string().default(""),autolink:Ne.z.boolean().default(true),tableMode:Oe.default("off")}).partial().default({}),On=Ne.z.object({open:Ne.z.string(),close:Ne.z.string()}).strict(),kt=Ne.z.object({styleMarkers:Ne.z.record(St,On).optional(),escapeText:Ne.z.any().optional(),buildLink:Ne.z.any().optional()}).strict();Ne.z.object({start:Ne.z.number().int().min(0),end:Ne.z.number().int().min(0),open:Ne.z.string(),close:Ne.z.string()}).strict();var Tt=Ne.z.object({indentSize:Ne.z.number().int().min(1).default(2),listMarker:Ne.z.enum(["\u2022","-","*"]).default("\u2022"),codeBlockMarker:Ne.z.enum(["```","~~~"]).default("```"),preserveFrontmatter:Ne.z.boolean().default(true)}).strict(),vt=Ne.z.record(Ne.z.string(),Ne.z.string()),We=Ne.z.object({open:Ne.z.boolean(),ticks:Ne.z.number().int().min(0)}).strict();Ne.z.object({inlineState:We,isInside:Ne.z.any()}).strict();Ne.z.object({start:Ne.z.number().int().min(0),end:Ne.z.number().int().min(0),openLine:Ne.z.string(),marker:Ne.z.string(),indent:Ne.z.string()}).strict();Ne.z.object({tables:Oe.optional()}).strict();function Xr(e){let t=new Zr__default.default({html:false,linkify:e.linkify??true,breaks:false,typographer:false});return t.enable("strikethrough"),e.tableMode&&e.tableMode!=="off"?t.enable("table"):t.disable("table"),e.autolink===false&&t.disable("autolink"),t}function In(e,t){if(e.attrGet)return e.attrGet(t);if(e.attrs){for(let[n,r]of e.attrs)if(n===t)return r}return null}function Rt(e,t){return {...e,type:"text",content:t,children:void 0}}function Qr(e){for(let t of e)t.children&&t.children.length>0&&(t.children=eo(t.children));}function eo(e){let t=0;for(let a of e){if(a.type!=="text")continue;let i=a.content??"",c=0;for(;c<i.length;){let p=i.indexOf("||",c);if(p===-1)break;t+=1,c=p+2;}}if(t<2)return e;let n=t-t%2,r=[],o={spoilerOpen:false},s=0;for(let a of e){if(a.type!=="text"){r.push(a);continue}let i=a.content??"";if(!i.includes("||")){r.push(a);continue}let c=0;for(;c<i.length;){let p=i.indexOf("||",c);if(p===-1){c<i.length&&r.push(Rt(a,i.slice(c)));break}if(s>=n){r.push(Rt(a,i.slice(c)));break}p>c&&r.push(Rt(a,i.slice(c,p))),s+=1,o.spoilerOpen=!o.spoilerOpen,r.push({type:o.spoilerOpen?"spoiler_open":"spoiler_close"}),c=p+2;}}return r}function to(){return {text:"",styles:[],openStyles:[],links:[],linkStack:[]}}function ue(e){return e.table?.currentCell??e}function Ue(e,t){if(!t)return;let n=ue(e);n.text+=t;}function ye(e,t){let n=ue(e);n.openStyles.push({style:t,start:n.text.length});}function xe(e,t){let n=ue(e);for(let r=n.openStyles.length-1;r>=0;r-=1){let o=n.openStyles[r];if(o?.style===t){let s=o.start;n.openStyles.splice(r,1);let a=n.text.length;a>s&&n.styles.push({start:s,end:a,style:t});return}}}function Fn(e){e.env.listStack.length>0||e.table||(e.text+=`
38
38
 
39
- `);}function no(e){let t=e.env.listStack,n=t[t.length-1];if(!n)return;n.index+=1;let r=" ".repeat(Math.max(0,t.length-1)),o=n.type==="ordered"?`${n.index}. `:"\u2022 ";e.text+=`${r}${o}`;}function ro(e,t){if(!t)return;let n=ce(e),r=n.text.length;n.text+=t,n.styles.push({start:r,end:r+t.length,style:"code"});}function oo(e,t){let n=t??"",r=ce(e),o=r.text.length;r.text+=n,r.styles.push({start:o,end:o+n.length,style:"code_block"});}function so(e){let t=ce(e),n=t.linkStack.pop();if(!n?.href)return;let r=n.href.trim();if(!r)return;let o=n.labelStart,s=t.text.length;if(s<=o){t.links.push({start:o,end:s,href:r});return}t.links.push({start:o,end:s,href:r});}function io(){return {headers:[],rows:[],currentRow:[],currentCell:null,inHeader:false}}function ao(e){return An(e),{text:e.text,styles:e.styles,links:e.links}}function ze(e){let t=e.text,n=0,r=t.length;for(;n<r&&/\s/.test(t[n]??"");)n+=1;for(;r>n&&/\s/.test(t[r-1]??"");)r-=1;if(n===0&&r===t.length)return e;let o=t.slice(n,r),s=o.length,a=[];for(let c of e.styles){let p=Math.max(0,c.start-n),l=Math.min(s,c.end-n);l>p&&a.push({start:p,end:l,style:c.style});}let i=[];for(let c of e.links){let p=Math.max(0,c.start-n),l=Math.min(s,c.end-n);l>p&&i.push({start:p,end:l,href:c.href});}return {text:o,styles:a,links:i}}function vt(e,t){if(!t.text)return;let n=e.text.length;e.text+=t.text;for(let r of t.styles)e.styles.push({start:n+r.start,end:n+r.end,style:r.style});for(let r of t.links)e.links.push({start:n+r.start,end:n+r.end,href:r.href});}function co(e,t){t.text&&(e.text+=t.text);}function $n(e,t){let{header:n,value:r,columnIndex:o,includeColumnFallback:s}=t;r?.text&&(e.text+="\u2022 ",n?.text?(vt(e,n),e.text+=": "):s&&(e.text+=`Column ${o}: `),vt(e,r),e.text+=`
40
- `);}function lo(e){if(!e.table)return;let t=e.table.headers.map(ze),n=e.table.rows.map(o=>o.map(ze));if(t.length===0&&n.length===0)return;if(t.length>1&&n.length>0)for(let o of n){if(o.length===0)continue;let s=o[0];if(s?.text){let a=e.text.length;vt(e,s);let i=e.text.length;i>a&&e.styles.push({start:a,end:i,style:"bold"}),e.text+=`
41
- `;}for(let a=1;a<o.length;a++)$n(e,{header:t[a],value:o[a],columnIndex:a,includeColumnFallback:true});e.text+=`
42
- `;}else for(let o of n){for(let s=0;s<o.length;s++)$n(e,{header:t[s],value:o[s],columnIndex:s,includeColumnFallback:false});e.text+=`
43
- `;}}function uo(e){if(!e.table)return;let t=e.table.headers.map(ze),n=e.table.rows.map(l=>l.map(ze)),r=Math.max(t.length,...n.map(l=>l.length));if(r===0)return;let o=Array.from({length:r},()=>0),s=l=>{for(let f=0;f<r;f+=1){let v=l[f]?.text.length??0;(o[f]??0)<v&&(o[f]=v);}};s(t);for(let l of n)s(l);let a=e.text.length,i=l=>{e.text+="|";for(let f=0;f<r;f+=1){e.text+=" ";let h=l[f];h&&co(e,h);let v=h?.text.length??0,N=(o[f]??0)-v;N>0&&(e.text+=" ".repeat(N)),e.text+=" |";}e.text+=`
44
- `;},c=()=>{e.text+="|";for(let l=0;l<r;l+=1){let f=o[l]??0,h=Math.max(3,f);e.text+=` ${"-".repeat(h)} |`;}e.text+=`
45
- `;};i(t),c();for(let l of n)i(l);let p=e.text.length;p>a&&e.styles.push({start:a,end:p,style:"code_block"});}function Rt(e,t){for(let n of e)switch(n.type){case "inline":n.children&&Rt(n.children,t);break;case "text":De(t,n.content??"");break;case "em_open":me(t,"italic");break;case "em_close":ge(t,"italic");break;case "strong_open":me(t,"bold");break;case "strong_close":ge(t,"bold");break;case "s_open":me(t,"strikethrough");break;case "s_close":ge(t,"strikethrough");break;case "code_inline":ro(t,n.content??"");break;case "spoiler_open":t.enableSpoilers&&me(t,"spoiler");break;case "spoiler_close":t.enableSpoilers&&ge(t,"spoiler");break;case "link_open":{let r=On(n,"href")??"",o=ce(t);o.linkStack.push({href:r,labelStart:o.text.length});break}case "link_close":so(t);break;case "image":De(t,n.content??"");break;case "softbreak":case "hardbreak":De(t,`
46
- `);break;case "paragraph_close":Fn(t);break;case "heading_open":t.headingStyle==="bold"&&me(t,"bold");break;case "heading_close":t.headingStyle==="bold"&&ge(t,"bold"),Fn(t);break;case "blockquote_open":t.blockquotePrefix&&(t.text+=t.blockquotePrefix),me(t,"blockquote");break;case "blockquote_close":ge(t,"blockquote");break;case "bullet_list_open":t.env.listStack.length>0&&(t.text+=`
39
+ `);}function no(e){let t=e.env.listStack,n=t[t.length-1];if(!n)return;n.index+=1;let r=" ".repeat(Math.max(0,t.length-1)),o=n.type==="ordered"?`${n.index}. `:"\u2022 ";e.text+=`${r}${o}`;}function ro(e,t){if(!t)return;let n=ue(e),r=n.text.length;n.text+=t,n.styles.push({start:r,end:r+t.length,style:"code"});}function oo(e,t){let n=t??"",r=ue(e),o=r.text.length;r.text+=n,r.styles.push({start:o,end:o+n.length,style:"code_block"});}function so(e){let t=ue(e),n=t.linkStack.pop();if(!n?.href)return;let r=n.href.trim();if(!r)return;let o=n.labelStart,s=t.text.length;if(s<=o){t.links.push({start:o,end:s,href:r});return}t.links.push({start:o,end:s,href:r});}function io(){return {headers:[],rows:[],currentRow:[],currentCell:null,inHeader:false}}function ao(e){return $n(e),{text:e.text,styles:e.styles,links:e.links}}function qe(e){let t=e.text,n=0,r=t.length;for(;n<r&&/\s/.test(t[n]??"");)n+=1;for(;r>n&&/\s/.test(t[r-1]??"");)r-=1;if(n===0&&r===t.length)return e;let o=t.slice(n,r),s=o.length,a=[];for(let c of e.styles){let p=Math.max(0,c.start-n),l=Math.min(s,c.end-n);l>p&&a.push({start:p,end:l,style:c.style});}let i=[];for(let c of e.links){let p=Math.max(0,c.start-n),l=Math.min(s,c.end-n);l>p&&i.push({start:p,end:l,href:c.href});}return {text:o,styles:a,links:i}}function Pt(e,t){if(!t.text)return;let n=e.text.length;e.text+=t.text;for(let r of t.styles)e.styles.push({start:n+r.start,end:n+r.end,style:r.style});for(let r of t.links)e.links.push({start:n+r.start,end:n+r.end,href:r.href});}function co(e,t){t.text&&(e.text+=t.text);}function An(e,t){let{header:n,value:r,columnIndex:o,includeColumnFallback:s}=t;r?.text&&(e.text+="\u2022 ",n?.text?(Pt(e,n),e.text+=": "):s&&(e.text+=`Column ${o}: `),Pt(e,r),e.text+=`
40
+ `);}function lo(e){if(!e.table)return;let t=e.table.headers.map(qe),n=e.table.rows.map(o=>o.map(qe));if(t.length===0&&n.length===0)return;if(t.length>1&&n.length>0)for(let o of n){if(o.length===0)continue;let s=o[0];if(s?.text){let a=e.text.length;Pt(e,s);let i=e.text.length;i>a&&e.styles.push({start:a,end:i,style:"bold"}),e.text+=`
41
+ `;}for(let a=1;a<o.length;a++)An(e,{header:t[a],value:o[a],columnIndex:a,includeColumnFallback:true});e.text+=`
42
+ `;}else for(let o of n){for(let s=0;s<o.length;s++)An(e,{header:t[s],value:o[s],columnIndex:s,includeColumnFallback:false});e.text+=`
43
+ `;}}function uo(e){if(!e.table)return;let t=e.table.headers.map(qe),n=e.table.rows.map(l=>l.map(qe)),r=Math.max(t.length,...n.map(l=>l.length));if(r===0)return;let o=Array.from({length:r},()=>0),s=l=>{for(let u=0;u<r;u+=1){let k=l[u]?.text.length??0;(o[u]??0)<k&&(o[u]=k);}};s(t);for(let l of n)s(l);let a=e.text.length,i=l=>{e.text+="|";for(let u=0;u<r;u+=1){e.text+=" ";let g=l[u];g&&co(e,g);let k=g?.text.length??0,H=(o[u]??0)-k;H>0&&(e.text+=" ".repeat(H)),e.text+=" |";}e.text+=`
44
+ `;},c=()=>{e.text+="|";for(let l=0;l<r;l+=1){let u=o[l]??0,g=Math.max(3,u);e.text+=` ${"-".repeat(g)} |`;}e.text+=`
45
+ `;};i(t),c();for(let l of n)i(l);let p=e.text.length;p>a&&e.styles.push({start:a,end:p,style:"code_block"});}function Mt(e,t){for(let n of e)switch(n.type){case "inline":n.children&&Mt(n.children,t);break;case "text":Ue(t,n.content??"");break;case "em_open":ye(t,"italic");break;case "em_close":xe(t,"italic");break;case "strong_open":ye(t,"bold");break;case "strong_close":xe(t,"bold");break;case "s_open":ye(t,"strikethrough");break;case "s_close":xe(t,"strikethrough");break;case "code_inline":ro(t,n.content??"");break;case "spoiler_open":t.enableSpoilers&&ye(t,"spoiler");break;case "spoiler_close":t.enableSpoilers&&xe(t,"spoiler");break;case "link_open":{let r=In(n,"href")??"",o=ue(t);o.linkStack.push({href:r,labelStart:o.text.length});break}case "link_close":so(t);break;case "image":Ue(t,n.content??"");break;case "softbreak":case "hardbreak":Ue(t,`
46
+ `);break;case "paragraph_close":Fn(t);break;case "heading_open":t.headingStyle==="bold"&&ye(t,"bold");break;case "heading_close":t.headingStyle==="bold"&&xe(t,"bold"),Fn(t);break;case "blockquote_open":t.blockquotePrefix&&(t.text+=t.blockquotePrefix),ye(t,"blockquote");break;case "blockquote_close":xe(t,"blockquote");break;case "bullet_list_open":t.env.listStack.length>0&&(t.text+=`
47
47
  `),t.env.listStack.push({type:"bullet",index:0});break;case "bullet_list_close":t.env.listStack.pop(),t.env.listStack.length===0&&(t.text+=`
48
48
  `);break;case "ordered_list_open":{t.env.listStack.length>0&&(t.text+=`
49
- `);let r=Number(On(n,"start")??"1");t.env.listStack.push({type:"ordered",index:r-1});break}case "ordered_list_close":t.env.listStack.pop(),t.env.listStack.length===0&&(t.text+=`
49
+ `);let r=Number(In(n,"start")??"1");t.env.listStack.push({type:"ordered",index:r-1});break}case "ordered_list_close":t.env.listStack.pop(),t.env.listStack.length===0&&(t.text+=`
50
50
  `);break;case "list_item_open":no(t);break;case "list_item_close":t.text.endsWith(`
51
51
  `)||(t.text+=`
52
- `);break;case "code_block":case "fence":oo(t,n.content??"");break;case "html_block":case "html_inline":De(t,n.content??"");break;case "table_open":t.tableMode!=="off"&&(t.table=io(),t.hasTables=true);break;case "table_close":t.table&&(t.tableMode==="bullets"?lo(t):t.tableMode==="code"&&uo(t)),t.table=null;break;case "thead_open":t.table&&(t.table.inHeader=true);break;case "thead_close":t.table&&(t.table.inHeader=false);break;case "tbody_open":case "tbody_close":break;case "tr_open":t.table&&(t.table.currentRow=[]);break;case "tr_close":t.table&&(t.table.inHeader?t.table.headers=t.table.currentRow:t.table.rows.push(t.table.currentRow),t.table.currentRow=[]);break;case "th_open":case "td_open":t.table&&(t.table.currentCell=to());break;case "th_close":case "td_close":t.table?.currentCell&&(t.table.currentRow.push(ao(t.table.currentCell)),t.table.currentCell=null);break;case "hr":t.text+=`\u2500\u2500\u2500
52
+ `);break;case "code_block":case "fence":oo(t,n.content??"");break;case "html_block":case "html_inline":Ue(t,n.content??"");break;case "table_open":t.tableMode!=="off"&&(t.table=io(),t.hasTables=true);break;case "table_close":t.table&&(t.tableMode==="bullets"?lo(t):t.tableMode==="code"&&uo(t)),t.table=null;break;case "thead_open":t.table&&(t.table.inHeader=true);break;case "thead_close":t.table&&(t.table.inHeader=false);break;case "tbody_open":case "tbody_close":break;case "tr_open":t.table&&(t.table.currentRow=[]);break;case "tr_close":t.table&&(t.table.inHeader?t.table.headers=t.table.currentRow:t.table.rows.push(t.table.currentRow),t.table.currentRow=[]);break;case "th_open":case "td_open":t.table&&(t.table.currentCell=to());break;case "th_close":case "td_close":t.table?.currentCell&&(t.table.currentRow.push(ao(t.table.currentCell)),t.table.currentCell=null);break;case "hr":t.text+=`\u2500\u2500\u2500
53
53
 
54
- `;break;default:n.children&&Rt(n.children,t);break}}function An(e){for(let t=e.openStyles.length-1;t>=0;t-=1){let n=e.openStyles[t];if(!n)continue;let r=e.text.length;r>n.start&&e.styles.push({start:n.start,end:r,style:n.style});}e.openStyles=[];}function fo(e,t){let n=[];for(let r of e){let o=Math.max(0,Math.min(r.start,t)),s=Math.max(o,Math.min(r.end,t));s>o&&n.push({start:o,end:s,style:r.style});}return n}function po(e,t){let n=[];for(let r of e){let o=Math.max(0,Math.min(r.start,t)),s=Math.max(o,Math.min(r.end,t));s>o&&n.push({start:o,end:s,href:r.href});}return n}function Ln(e){let t=[...e].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 t){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 Bn(e,t,n){let r=Math.max(e.start,t),o=Math.min(e.end,n);return o<=r?null:{start:r,end:o}}function mo(e,t,n){if(e.length===0)return [];let r=[];for(let o of e){let s=Bn(o,t,n);s&&r.push({start:s.start-t,end:s.end-t,style:o.style});}return Ln(r)}function go(e,t,n){if(e.length===0)return [];let r=[];for(let o of e){let s=Bn(o,t,n);s&&r.push({start:s.start-t,end:s.end-t,href:o.href});}return r}function he(e,t){try{let n=typeof e=="string"?e:"",r=je.parse(t??{});return Pe(n,r).ir}catch(n){return console.error("Markdown parse error:",n),{text:"",styles:[],links:[]}}}function Pe(e,t){try{let n=typeof e=="string"?e:"",r=je.parse(t),o={listStack:[]},a=Xr(r).parse(n||"",o);r.enableSpoilers&&Qr(a);let i=r.tableMode??"off",c={text:"",styles:[],openStyles:[],links:[],linkStack:[],env:o,headingStyle:r.headingStyle??"none",blockquotePrefix:r.blockquotePrefix??"",enableSpoilers:r.enableSpoilers??!1,tableMode:i,table:null,hasTables:!1};Rt(a,c),An(c);let l=c.text.trimEnd().length,f=0;for(let E of c.styles)E.style==="code_block"&&E.end>f&&(f=E.end);let h=Math.max(l,f);return {ir:{text:h===c.text.length?c.text:c.text.slice(0,h),styles:Ln(fo(c.styles,h)),links:po(c.links,h)},hasTables:c.hasTables}}catch(n){return console.error("Markdown parse error:",n),{ir:{text:"",styles:[],links:[]},hasTables:false}}}function _n(e,t){try{let n=ve.parse(e),r=typeof t=="number"&&t>0?t:0;if(!n.text)return [];if(r<=0||n.text.length<=r)return [n];let o=pe(n.text,r),s=[],a=0;return o.forEach((i,c)=>{if(!i)return;if(c>0)for(;a<n.text.length&&/\s/.test(n.text[a]??"");)a+=1;let p=a,l=Math.min(n.text.length,p+i.length);s.push({text:i,styles:mo(n.styles,p,l),links:go(n.links,p,l)}),a=l;}),s}catch(n){return console.error("Chunk IR error:",n),[]}}chunkVRQQ33YH_cjs.j();var ho={bold:{open:"**",close:"**"},italic:{open:"*",close:"*"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Me(e,t){try{let n=ve.parse(e),r=wt.parse(t??{});if(!n.text)return "";let o=r.styleMarkers??ho,s=r.escapeText??(f=>f),a=r.buildLink,i=[];for(let f=0;f<n.styles.length;f++){let h=n.styles[f];h&&(i.push({position:h.start,type:"open",style:h.style,spanIndex:f}),i.push({position:h.end,type:"close",style:h.style,spanIndex:f}));}for(let f=0;f<n.links.length;f++){let h=n.links[f];h&&(i.push({position:h.start,type:"link_open",spanIndex:f,href:h.href}),i.push({position:h.end,type:"link_close",spanIndex:f,href:h.href}));}i.sort((f,h)=>{if(f.position!==h.position)return f.position-h.position;let v=(U,G)=>U==="link_open"?0:U==="open"?1:U==="close"?2:U==="link_close"?3:4,E=f.type==="close"||f.type==="link_close",N=h.type==="close"||h.type==="link_close",W=v(f.type,E),H=v(h.type,N);return W!==H?W-H:f.type==="open"&&h.type==="open"?f.spanIndex-h.spanIndex:f.type==="close"&&h.type==="close"?h.spanIndex-f.spanIndex:f.spanIndex-h.spanIndex});let c="",p=0,l=[];for(let f of i){if(f.position>p){let h=n.text.slice(p,f.position);c+=s?s(h):h;}if(f.type==="open"||f.type==="close"){let h=o[f.style];if(h)if(f.type==="open")c+=h.open,l.push(f);else {c+=h.close,f.style==="code_block"&&f.position<n.text.length&&(c+=`
55
- `);let v=l.findIndex(E=>E.spanIndex===f.spanIndex&&E.type==="open");v!==-1&&l.splice(v,1);}}else if(f.type==="link_open")c+="[",l.push(f);else if(f.type==="link_close"){c+="]("+f.href+")";let h=l.findIndex(v=>v.spanIndex===f.spanIndex&&v.type==="link_open");h!==-1&&l.splice(h,1);}p=f.position;}if(p<n.text.length){let f=n.text.slice(p);c+=s?s(f):f;}return c}catch(n){return console.error("Markdown render error:",n),""}}function be(e,t){return Me(e,t)}chunkVRQQ33YH_cjs.j();function bo(e){let t=e.replace(/\r\n/g,`
54
+ `;break;default:n.children&&Mt(n.children,t);break}}function $n(e){for(let t=e.openStyles.length-1;t>=0;t-=1){let n=e.openStyles[t];if(!n)continue;let r=e.text.length;r>n.start&&e.styles.push({start:n.start,end:r,style:n.style});}e.openStyles=[];}function fo(e,t){let n=[];for(let r of e){let o=Math.max(0,Math.min(r.start,t)),s=Math.max(o,Math.min(r.end,t));s>o&&n.push({start:o,end:s,style:r.style});}return n}function po(e,t){let n=[];for(let r of e){let o=Math.max(0,Math.min(r.start,t)),s=Math.max(o,Math.min(r.end,t));s>o&&n.push({start:o,end:s,href:r.href});}return n}function Ln(e){let t=[...e].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 t){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 Bn(e,t,n){let r=Math.max(e.start,t),o=Math.min(e.end,n);return o<=r?null:{start:r,end:o}}function mo(e,t,n){if(e.length===0)return [];let r=[];for(let o of e){let s=Bn(o,t,n);s&&r.push({start:s.start-t,end:s.end-t,style:o.style});}return Ln(r)}function go(e,t,n){if(e.length===0)return [];let r=[];for(let o of e){let s=Bn(o,t,n);s&&r.push({start:s.start-t,end:s.end-t,href:o.href});}return r}function we(e,t){try{let n=typeof e=="string"?e:"",r=He.parse(t??{});return Ie(n,r).ir}catch(n){return console.error("Markdown parse error:",n),{text:"",styles:[],links:[]}}}function Ie(e,t){try{let n=typeof e=="string"?e:"",r=He.parse(t),o={listStack:[]},a=Xr(r).parse(n||"",o);r.enableSpoilers&&Qr(a);let i=r.tableMode??"off",c={text:"",styles:[],openStyles:[],links:[],linkStack:[],env:o,headingStyle:r.headingStyle??"none",blockquotePrefix:r.blockquotePrefix??"",enableSpoilers:r.enableSpoilers??!1,tableMode:i,table:null,hasTables:!1};Mt(a,c),$n(c);let l=c.text.trimEnd().length,u=0;for(let E of c.styles)E.style==="code_block"&&E.end>u&&(u=E.end);let g=Math.max(l,u);return {ir:{text:g===c.text.length?c.text:c.text.slice(0,g),styles:Ln(fo(c.styles,g)),links:po(c.links,g)},hasTables:c.hasTables}}catch(n){return console.error("Markdown parse error:",n),{ir:{text:"",styles:[],links:[]},hasTables:false}}}function _n(e,t){try{let n=Ce.parse(e),r=typeof t=="number"&&t>0?t:0;if(!n.text)return [];if(r<=0||n.text.length<=r)return [n];let o=be(n.text,r),s=[],a=0;return o.forEach((i,c)=>{if(!i)return;if(c>0)for(;a<n.text.length&&/\s/.test(n.text[a]??"");)a+=1;let p=a,l=Math.min(n.text.length,p+i.length);s.push({text:i,styles:mo(n.styles,p,l),links:go(n.links,p,l)}),a=l;}),s}catch(n){return console.error("Chunk IR error:",n),[]}}chunkVRQQ33YH_cjs.j();var ho={bold:{open:"**",close:"**"},italic:{open:"*",close:"*"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Fe(e,t){try{let n=Ce.parse(e),r=kt.parse(t??{});if(!n.text)return "";let o=r.styleMarkers??ho,s=r.escapeText??(u=>u),a=r.buildLink,i=[];for(let u=0;u<n.styles.length;u++){let g=n.styles[u];g&&(i.push({position:g.start,type:"open",style:g.style,spanIndex:u}),i.push({position:g.end,type:"close",style:g.style,spanIndex:u}));}for(let u=0;u<n.links.length;u++){let g=n.links[u];g&&(i.push({position:g.start,type:"link_open",spanIndex:u,href:g.href}),i.push({position:g.end,type:"link_close",spanIndex:u,href:g.href}));}i.sort((u,g)=>{if(u.position!==g.position)return u.position-g.position;let k=(Y,G)=>Y==="link_open"?0:Y==="open"?1:Y==="close"?2:Y==="link_close"?3:4,E=u.type==="close"||u.type==="link_close",H=g.type==="close"||g.type==="link_close",U=k(u.type,E),q=k(g.type,H);return U!==q?U-q:u.type==="open"&&g.type==="open"?u.spanIndex-g.spanIndex:u.type==="close"&&g.type==="close"?g.spanIndex-u.spanIndex:u.spanIndex-g.spanIndex});let c="",p=0,l=[];for(let u of i){if(u.position>p){let g=n.text.slice(p,u.position);c+=s?s(g):g;}if(u.type==="open"||u.type==="close"){let g=o[u.style];if(g)if(u.type==="open")c+=g.open,l.push(u);else {c+=g.close,u.style==="code_block"&&u.position<n.text.length&&(c+=`
55
+ `);let k=l.findIndex(E=>E.spanIndex===u.spanIndex&&E.type==="open");k!==-1&&l.splice(k,1);}}else if(u.type==="link_open")c+="[",l.push(u);else if(u.type==="link_close"){c+="]("+u.href+")";let g=l.findIndex(k=>k.spanIndex===u.spanIndex&&k.type==="link_open");g!==-1&&l.splice(g,1);}p=u.position;}if(p<n.text.length){let u=n.text.slice(p);c+=s?s(u):u;}return c}catch(n){return console.error("Markdown render error:",n),""}}function Se(e,t){return Fe(e,t)}chunkVRQQ33YH_cjs.j();function bo(e){let t=e.replace(/\r\n/g,`
56
56
  `).replace(/\r/g,`
57
57
  `);if(!t.startsWith("---"))return {frontmatter:"",content:e};let n=t.indexOf(`
58
- ---`,3);if(n===-1)return {frontmatter:"",content:e};let r=t.slice(0,n+4),o=t.slice(n+4).trimStart();return {frontmatter:r,content:o}}function He(e,t){try{let n=typeof e=="string"?e:"",r=St.parse(t??{});if(!n)return "";let{frontmatter:o,content:s}=bo(n),a=he(s,{linkify:!0,enableSpoilers:!1,autolink:!0,headingStyle:"none",blockquotePrefix:"",tableMode:"off"}),i=be(a);return i=i.replace(/\n{3,}/g,`
58
+ ---`,3);if(n===-1)return {frontmatter:"",content:e};let r=t.slice(0,n+4),o=t.slice(n+4).trimStart();return {frontmatter:r,content:o}}function Ye(e,t){try{let n=typeof e=="string"?e:"",r=Tt.parse(t??{});if(!n)return "";let{frontmatter:o,content:s}=bo(n),a=we(s,{linkify:!0,enableSpoilers:!1,autolink:!0,headingStyle:"none",blockquotePrefix:"",tableMode:"off"}),i=Se(a);return i=i.replace(/\n{3,}/g,`
59
59
 
60
60
  `),i=i.trimEnd()+`
61
61
  `,r.preserveFrontmatter&&o&&(i=o+`
62
62
  `+i),i}catch(n){return console.error("Markdown format error:",n),e}}chunkVRQQ33YH_cjs.j();function yo(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function xo(e){if(e!=null){if(typeof e=="string")return {value:e.trim(),kind:"scalar"};if(typeof e=="number"||typeof e=="boolean")return {value:String(e),kind:"scalar"};if(typeof e=="object")try{return {value:JSON.stringify(e),kind:"structured"}}catch{return}}}function wo(e){try{let t=jn__default.default.parse(e,{schema:"core"});if(!t||typeof t!="object"||Array.isArray(t))return null;let n={};for(let[r,o]of Object.entries(t)){let s=r.trim();if(!s)continue;let a=xo(o);a&&(n[s]=a);}return n}catch{return null}}function So(e,t){let n=[],r=t+1;for(;r<e.length;){let s=e[r];if(!s){r+=1;continue}if(s.length>0&&!s.startsWith(" ")&&!s.startsWith(" "))break;n.push(s),r+=1;}return {value:n.join(`
63
63
  `).trim(),linesConsumed:r-t}}function ko(e){let t={},n=e.split(`
64
- `),r=0;for(;r<n.length;){let o=n[r];if(!o){r+=1;continue}let s=o.match(/^([\w-]+):\s*(.*)$/);if(!s?.[1]||!s[2]){r+=1;continue}let a=s[1],i=s[2].trim();if(!a){r+=1;continue}if(!i&&r+1<n.length){let p=n[r+1];if(p&&(p.startsWith(" ")||p.startsWith(" "))){let{value:l,linesConsumed:f}=So(n,r);l&&(t[a]={value:l,kind:"multiline",rawInline:i}),r+=f;continue}}let c=yo(i);c&&(t[a]={value:c,kind:"inline",rawInline:i}),r+=1;}return t}function To(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r.value;return t}function vo(e){return /^[|>][+-]?(\d+)?[+-]?$/.test(e)}function Ro(e){let{lineEntry:t,yamlValue:n}=e;return n.kind!=="structured"||t.kind!=="inline"||vo(t.rawInline)?false:t.value.includes(":")}function Po(e){let t=e.replace(/\r\n/g,`
64
+ `),r=0;for(;r<n.length;){let o=n[r];if(!o){r+=1;continue}let s=o.match(/^([\w-]+):\s*(.*)$/);if(!s?.[1]||!s[2]){r+=1;continue}let a=s[1],i=s[2].trim();if(!a){r+=1;continue}if(!i&&r+1<n.length){let p=n[r+1];if(p&&(p.startsWith(" ")||p.startsWith(" "))){let{value:l,linesConsumed:u}=So(n,r);l&&(t[a]={value:l,kind:"multiline",rawInline:i}),r+=u;continue}}let c=yo(i);c&&(t[a]={value:c,kind:"inline",rawInline:i}),r+=1;}return t}function To(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r.value;return t}function vo(e){return /^[|>][+-]?(\d+)?[+-]?$/.test(e)}function Ro(e){let{lineEntry:t,yamlValue:n}=e;return n.kind!=="structured"||t.kind!=="inline"||vo(t.rawInline)?false:t.value.includes(":")}function Po(e){let t=e.replace(/\r\n/g,`
65
65
  `).replace(/\r/g,`
66
66
  `);if(!t.startsWith("---"))return;let n=t.indexOf(`
67
- ---`,3);if(n!==-1)return t.slice(4,n)}function Ee(e){try{if(typeof e!="string")return {};let t=Po(e);if(!t)return {};let n=ko(t),r=wo(t);if(r===null)return To(n);let o={};for(let[s,a]of Object.entries(r)){o[s]=a.value;let i=n[s];i&&Ro({lineEntry:i,yamlValue:a})&&(o[s]=i.value);}for(let[s,a]of Object.entries(n))s in o||(o[s]=a.value);return o}catch(t){return console.warn("Failed to parse frontmatter:",t),{}}}function We(e){try{let t=kt.parse(e);if(Object.keys(t).length===0)return "";let n={};for(let[o,s]of Object.entries(t))try{let a=JSON.parse(s);n[o]=a;}catch{n[o]=s;}return `---
67
+ ---`,3);if(n!==-1)return t.slice(4,n)}function Ae(e){try{if(typeof e!="string")return {};let t=Po(e);if(!t)return {};let n=ko(t),r=wo(t);if(r===null)return To(n);let o={};for(let[s,a]of Object.entries(r)){o[s]=a.value;let i=n[s];i&&Ro({lineEntry:i,yamlValue:a})&&(o[s]=i.value);}for(let[s,a]of Object.entries(n))s in o||(o[s]=a.value);return o}catch(t){return console.warn("Failed to parse frontmatter:",t),{}}}function Ve(e){try{let t=vt.parse(e);if(Object.keys(t).length===0)return "";let n={};for(let[o,s]of Object.entries(t))try{let a=JSON.parse(s);n[o]=a;}catch{n[o]=s;}return `---
68
68
  ${jn__default.default.stringify(n,{lineWidth:0,defaultStringType:"QUOTE_DOUBLE"}).trim()}
69
- ---`}catch(t){return console.warn("Failed to serialize frontmatter:",t),""}}function Ue(e){try{if(typeof e!="string")return {frontmatter:{},content:""};let t=e.replace(/\r\n/g,`
69
+ ---`}catch(t){return console.warn("Failed to serialize frontmatter:",t),""}}function Ge(e){try{if(typeof e!="string")return {frontmatter:{},content:""};let t=e.replace(/\r\n/g,`
70
70
  `).replace(/\r/g,`
71
71
  `);if(!t.startsWith("---"))return {frontmatter:{},content:e};let n=t.indexOf(`
72
- ---`,3);if(n===-1)return {frontmatter:{},content:e};let r=t.slice(4,n),o=t.slice(n+4).trimStart();return {frontmatter:Ee(e),content:o}}catch(t){return console.warn("Failed to extract frontmatter:",t),{frontmatter:{},content:e}}}chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function qe(e){try{let t=Be.z.string().parse(e),n=[],r,o=0;for(;o<=t.length;){let s=t.indexOf(`
73
- `,o),a=s===-1?t.length:s,i=t.slice(o,a),c=i.match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(c){let p=c[1],l=c[2];if(!p||!l){o=a+1;continue}let f=l[0];if(!f){o=a+1;continue}let h=l.length;if(!r)r={start:o,markerChar:f,markerLen:h,openLine:i,marker:l,indent:p};else if(r.markerChar===f&&h>=r.markerLen){let v=a;n.push({start:r.start,end:v,openLine:r.openLine,marker:r.marker,indent:r.indent}),r=void 0;}}if(s===-1)break;o=s+1;}return r&&n.push({start:r.start,end:t.length,openLine:r.openLine,marker:r.marker,indent:r.indent}),n}catch(t){return console.warn("Invalid input for parseFenceSpans:",t),[]}}function Pt(e,t){let n=0,r=e.length-1;for(;n<=r;){let o=Math.floor((n+r)/2),s=e[o];if(!s)break;if(t<=s.start){r=o-1;continue}if(t>=s.end){n=o+1;continue}return s}}function Nn(e,t){return !Pt(e,t)}function Ye(){return {open:false,ticks:0}}function Ve(e,t){try{let n=Be.z.string().parse(e),r=t?Ne.parse(t):Ye(),o=qe(n),s={open:r.open,ticks:r.ticks},{spans:a,state:i}=Co(n,o,s);return {inlineState:i,isInside:c=>Oo(c,o)||Fo(c,a)}}catch(n){return console.warn("Invalid input for buildCodeSpanIndex:",n),{inlineState:Ye(),isInside:()=>false}}}function Co(e,t,n){let r=[],o=n.open,s=n.ticks,a=o?0:-1,i=0;for(;i<e.length;){let c=Io(t,i);if(c){i=c.end;continue}if(e[i]!=="`"){i+=1;continue}let p=i,l=0;for(;i<e.length&&e[i]==="`";)l+=1,i+=1;if(!o){o=true,s=l,a=p;continue}l===s&&(r.push([a,i]),o=false,s=0,a=-1);}return o&&r.push([a,e.length]),{spans:r,state:{open:o,ticks:s}}}function Io(e,t){return e.find(n=>t>=n.start&&t<n.end)}function Oo(e,t){return t.some(n=>e>=n.start&&e<n.end)}function Fo(e,t){return t.some(([n,r])=>e>=n&&e<r)}chunkVRQQ33YH_cjs.j();var Ao={bold:{open:"**",close:"**"},italic:{open:"_",close:"_"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Ge(e,t){try{let n=Be.z.string().parse(e),r=Re.parse(t);if(!n||r==="off")return n;let{ir:o,hasTables:s}=Pe(n,{linkify:!1,enableSpoilers:!1,autolink:!1,headingStyle:"none",blockquotePrefix:"",tableMode:r});return s?Me(o,{styleMarkers:Ao,escapeText:a=>a,buildLink:(a,i)=>{let c=a.href.trim();return !c||!i.slice(a.start,a.end)?null:{start:a.start,end:a.end,open:"[",close:`](${c})`}}}):n}catch(n){return console.warn("Invalid input for convertMarkdownTables:",n),typeof e=="string"?e:""}}exports.Markdown=void 0;(p=>{function e(l,f){try{return he(l,f)}catch(h){return console.warn("Markdown.parse error:",h),{text:"",styles:[],links:[]}}}p.parse=e;function t(l,f){try{return be(l,f)}catch(h){return console.warn("Markdown.render error:",h),""}}p.render=t;function n(l,f){try{return He(l,f)}catch(h){return console.warn("Markdown.format error:",h),typeof l=="string"?l:""}}p.format=n;function r(l){try{return Ee(l)}catch(f){return console.warn("Markdown.parseFrontmatter error:",f),{}}}p.parseFrontmatter=r;function o(l){try{return We(l)}catch(f){return console.warn("Markdown.serializeFrontmatter error:",f),""}}p.serializeFrontmatter=o;function s(l){try{return Ue(l)}catch(f){return console.warn("Markdown.extractFrontmatter error:",f),{frontmatter:{},content:typeof l=="string"?l:""}}}p.extractFrontmatter=s;function a(l,f,h){try{return pe(l,f,h)}catch(v){return console.warn("Markdown.chunk error:",v),typeof l=="string"&&l.length>0?[l]:[]}}p.chunk=a;function i(l,f){try{return Ve(l,f)}catch(h){return console.warn("Markdown.buildCodeIndex error:",h),{inlineState:{open:false,ticks:0},isInside:()=>false}}}p.buildCodeIndex=i;function c(l,f){try{return Ge(l,f)}catch(h){return console.warn("Markdown.convertTables error:",h),typeof l=="string"?l:""}}p.convertTables=c;})(exports.Markdown||(exports.Markdown={}));chunkVRQQ33YH_cjs.j();function Dn(e){if(!e)return "";let n=e.replace(/[/\\]+$/,"").split(/[/\\]/);return n[n.length-1]??""}function Lo(e){if(!e)return "";let n=e.replace(/[/\\]+$/,"").split(/[/\\]/);return n.slice(0,n.length-1).join("/")+"/"}function Bo(e){if(!e)return "";let t=e.split(".");return t[t.length-1]}function _o(e,t=20){let n=Dn(e);if(n.length<=t)return n;let r=n.lastIndexOf("."),o=r<=0?"":n.slice(r),s=t-o.length-1;return s<=0?n.slice(0,t-1)+"\u2026":n.slice(0,s)+"\u2026"+o}function jo(e,t=20){if(e.length<=t)return e;let n=t-1,r=Math.ceil(n/2),o=Math.floor(n/2);return e.slice(0,r)+"\u2026"+e.slice(-o)}chunkVRQQ33YH_cjs.j();var No=["load failed","network connection was lost","network request failed","failed to fetch","econnreset","econnrefused","etimedout","socket hang up"];function Do(e){if(!e)return false;let t=String(e instanceof Error?e.message:e).toLowerCase();return No.some(n=>t.includes(n))}async function Et(e,t={}){let{attempts:n=3,delay:r=500,factor:o=2,maxDelay:s=1e4,retryIf:a=Do}=t,i;for(let c=0;c<n;c++)try{return await e()}catch(p){if(i=p,c===n-1||!a(p))throw p;let l=Math.min(r*o**c,s);await new Promise(f=>setTimeout(f,l));}throw i}chunkVRQQ33YH_cjs.j();exports.Fetch=void 0;(zt=>{let e=chunkWWPI6PC4_cjs.a.create({service:"fetch"}),t=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"],n=false,r=null;function o(){return t.some(O=>{let C=process.env[O];return typeof C=="string"&&C.trim().length>0})}zt.hasProxyConfigured=o;function s(){let O=process.env.http_proxy||process.env.HTTP_PROXY;return process.env.https_proxy||process.env.HTTPS_PROXY||O}zt.getProxyUrl=s;function a(O={}){let C=O.httpProxy||O.httpsProxy||s();if(!C){e.warn("[Fetch] No proxy configured, HTTP_PROXY/HTTPS_PROXY environment variables not set");return}let A=new undici.ProxyAgent({uri:C,connectTimeout:O.connectTimeout||1e4,keepAliveTimeout:O.keepAliveTimeout||3e4});r=undici.getGlobalDispatcher(),undici.setGlobalDispatcher(A),n=true,e.info(`[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u542F\u7528: ${C}`);}zt.enableProxy=a;function i(){!n||!r||(undici.setGlobalDispatcher(r),n=false,r=null,e.info("[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u7981\u7528"));}zt.disableProxy=i;function c(){return n}zt.isProxyEnabled=c;async function p(O,C){let A=C?.timeout||3e4,q=C?.responseType||"json",{timeout:V,responseType:ye,..._}=C||{},S=null,m=null;try{_.signal||(S=new AbortController,m=setTimeout(()=>S.abort(),A));let d=await fetch(O,{..._,signal:_.signal||S.signal});m&&clearTimeout(m);let u;switch(q){case "arrayBuffer":u=await d.arrayBuffer();break;case "blob":u=await d.blob();break;case "buffer":{let y=await d.arrayBuffer();u=Buffer.from(y);break}case "text":u=await d.text();break;default:{let y=await d.text();try{u=JSON.parse(y);}catch{u=y;}break}}return {ok:d.ok,status:d.status,statusText:d.statusText,headers:d.headers,data:u,url:d.url}}catch(d){throw m&&clearTimeout(m),d}}async function l(O,C){let A=C?.retries??0,q=C?.retryDelay??1e3,{retries:V,retryDelay:ye,responseType:_,...S}=C||{};return Et(()=>p(O,{...S,responseType:C?.responseType}),{attempts:A+1,delay:q,maxDelay:q*2**(A+1)})}async function f(O,C){return l(O,{method:"GET",...C})}zt.get=f;async function h(O,C,A){return l(O,{method:"POST",headers:{"Content-Type":"application/json",...A?.headers},body:C?JSON.stringify(C):void 0,...A})}zt.post=h;async function v(O,C,A){return l(O,{method:"PUT",headers:{"Content-Type":"application/json",...A?.headers},body:C?JSON.stringify(C):void 0,...A})}zt.put=v;async function E(O,C,A){return l(O,{method:"DELETE",headers:{"Content-Type":"application/json",...A?.headers},body:C?JSON.stringify(C):void 0,...A})}zt.del=E;async function N(O,C,A){return l(O,{method:"PATCH",headers:{"Content-Type":"application/json",...A?.headers},body:C?JSON.stringify(C):void 0,...A})}zt.patch=N;async function W(O,C){return l(O,C)}zt.request=W;function H(O={}){return o()?(a(O),true):false}zt.autoProxy=H;let U=5*1024*1024;function G(O){return new TextEncoder().encode(O)}function Ce(O){return chunkJL3GR4P7_cjs.c.mimeType(O)}function Je(O){return O.startsWith("file://")}async function Ke(O){let C=url.fileURLToPath(O);return await exports.PKG.file(C).bytes()}async function Dt(O,C,A){let q=`----FetchFormBoundary${Date.now()}`,V=[],_=C.some(g=>g.filename||g.value instanceof Uint8Array||Buffer.isBuffer(g.value))&&!A?.timeout?3e5:A?.timeout;for(let g of C){let w=g.maxSize??U,R=g.filename,T=`Content-Disposition: form-data; name="${g.name}"${R?`; filename="${R}"`:""}`;R&&(T+=`\r
74
- Content-Type: ${Ce(R)}`),T+=`\r
72
+ ---`,3);if(n===-1)return {frontmatter:{},content:e};let r=t.slice(4,n),o=t.slice(n+4).trimStart();return {frontmatter:Ae(e),content:o}}catch(t){return console.warn("Failed to extract frontmatter:",t),{frontmatter:{},content:e}}}chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Je(e){try{let t=Ne.z.string().parse(e),n=[],r,o=0;for(;o<=t.length;){let s=t.indexOf(`
73
+ `,o),a=s===-1?t.length:s,i=t.slice(o,a),c=i.match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(c){let p=c[1],l=c[2];if(!p||!l){o=a+1;continue}let u=l[0];if(!u){o=a+1;continue}let g=l.length;if(!r)r={start:o,markerChar:u,markerLen:g,openLine:i,marker:l,indent:p};else if(r.markerChar===u&&g>=r.markerLen){let k=a;n.push({start:r.start,end:k,openLine:r.openLine,marker:r.marker,indent:r.indent}),r=void 0;}}if(s===-1)break;o=s+1;}return r&&n.push({start:r.start,end:t.length,openLine:r.openLine,marker:r.marker,indent:r.indent}),n}catch(t){return console.warn("Invalid input for parseFenceSpans:",t),[]}}function Et(e,t){let n=0,r=e.length-1;for(;n<=r;){let o=Math.floor((n+r)/2),s=e[o];if(!s)break;if(t<=s.start){r=o-1;continue}if(t>=s.end){n=o+1;continue}return s}}function Dn(e,t){return !Et(e,t)}function Ke(){return {open:false,ticks:0}}function Ze(e,t){try{let n=Ne.z.string().parse(e),r=t?We.parse(t):Ke(),o=Je(n),s={open:r.open,ticks:r.ticks},{spans:a,state:i}=Co(n,o,s);return {inlineState:i,isInside:c=>Io(c,o)||Fo(c,a)}}catch(n){return console.warn("Invalid input for buildCodeSpanIndex:",n),{inlineState:Ke(),isInside:()=>false}}}function Co(e,t,n){let r=[],o=n.open,s=n.ticks,a=o?0:-1,i=0;for(;i<e.length;){let c=Oo(t,i);if(c){i=c.end;continue}if(e[i]!=="`"){i+=1;continue}let p=i,l=0;for(;i<e.length&&e[i]==="`";)l+=1,i+=1;if(!o){o=true,s=l,a=p;continue}l===s&&(r.push([a,i]),o=false,s=0,a=-1);}return o&&r.push([a,e.length]),{spans:r,state:{open:o,ticks:s}}}function Oo(e,t){return e.find(n=>t>=n.start&&t<n.end)}function Io(e,t){return t.some(n=>e>=n.start&&e<n.end)}function Fo(e,t){return t.some(([n,r])=>e>=n&&e<r)}chunkVRQQ33YH_cjs.j();var $o={bold:{open:"**",close:"**"},italic:{open:"_",close:"_"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Xe(e,t){try{let n=Ne.z.string().parse(e),r=Oe.parse(t);if(!n||r==="off")return n;let{ir:o,hasTables:s}=Ie(n,{linkify:!1,enableSpoilers:!1,autolink:!1,headingStyle:"none",blockquotePrefix:"",tableMode:r});return s?Fe(o,{styleMarkers:$o,escapeText:a=>a,buildLink:(a,i)=>{let c=a.href.trim();return !c||!i.slice(a.start,a.end)?null:{start:a.start,end:a.end,open:"[",close:`](${c})`}}}):n}catch(n){return console.warn("Invalid input for convertMarkdownTables:",n),typeof e=="string"?e:""}}exports.Markdown=void 0;(p=>{function e(l,u){try{return we(l,u)}catch(g){return console.warn("Markdown.parse error:",g),{text:"",styles:[],links:[]}}}p.parse=e;function t(l,u){try{return Se(l,u)}catch(g){return console.warn("Markdown.render error:",g),""}}p.render=t;function n(l,u){try{return Ye(l,u)}catch(g){return console.warn("Markdown.format error:",g),typeof l=="string"?l:""}}p.format=n;function r(l){try{return Ae(l)}catch(u){return console.warn("Markdown.parseFrontmatter error:",u),{}}}p.parseFrontmatter=r;function o(l){try{return Ve(l)}catch(u){return console.warn("Markdown.serializeFrontmatter error:",u),""}}p.serializeFrontmatter=o;function s(l){try{return Ge(l)}catch(u){return console.warn("Markdown.extractFrontmatter error:",u),{frontmatter:{},content:typeof l=="string"?l:""}}}p.extractFrontmatter=s;function a(l,u,g){try{return be(l,u,g)}catch(k){return console.warn("Markdown.chunk error:",k),typeof l=="string"&&l.length>0?[l]:[]}}p.chunk=a;function i(l,u){try{return Ze(l,u)}catch(g){return console.warn("Markdown.buildCodeIndex error:",g),{inlineState:{open:false,ticks:0},isInside:()=>false}}}p.buildCodeIndex=i;function c(l,u){try{return Xe(l,u)}catch(g){return console.warn("Markdown.convertTables error:",g),typeof l=="string"?l:""}}p.convertTables=c;})(exports.Markdown||(exports.Markdown={}));chunkVRQQ33YH_cjs.j();function Nn(e){if(!e)return "";let n=e.replace(/[/\\]+$/,"").split(/[/\\]/);return n[n.length-1]??""}function Lo(e){if(!e)return "";let n=e.replace(/[/\\]+$/,"").split(/[/\\]/);return n.slice(0,n.length-1).join("/")+"/"}function Bo(e){if(!e)return "";let t=e.split(".");return t[t.length-1]}function _o(e,t=20){let n=Nn(e);if(n.length<=t)return n;let r=n.lastIndexOf("."),o=r<=0?"":n.slice(r),s=t-o.length-1;return s<=0?n.slice(0,t-1)+"\u2026":n.slice(0,s)+"\u2026"+o}function jo(e,t=20){if(e.length<=t)return e;let n=t-1,r=Math.ceil(n/2),o=Math.floor(n/2);return e.slice(0,r)+"\u2026"+e.slice(-o)}chunkVRQQ33YH_cjs.j();var Do=["load failed","network connection was lost","network request failed","failed to fetch","econnreset","econnrefused","etimedout","socket hang up"];function No(e){if(!e)return false;let t=String(e instanceof Error?e.message:e).toLowerCase();return Do.some(n=>t.includes(n))}async function Ot(e,t={}){let{attempts:n=3,delay:r=500,factor:o=2,maxDelay:s=1e4,retryIf:a=No}=t,i;for(let c=0;c<n;c++)try{return await e()}catch(p){if(i=p,c===n-1||!a(p))throw p;let l=Math.min(r*o**c,s);await new Promise(u=>setTimeout(u,l));}throw i}chunkVRQQ33YH_cjs.j();exports.Fetch=void 0;(Ht=>{let e=chunkWWPI6PC4_cjs.a.create({service:"fetch"}),t=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"],n=false,r=null;function o(){return t.some(I=>{let C=process.env[I];return typeof C=="string"&&C.trim().length>0})}Ht.hasProxyConfigured=o;function s(){let I=process.env.http_proxy||process.env.HTTP_PROXY;return process.env.https_proxy||process.env.HTTPS_PROXY||I}Ht.getProxyUrl=s;function a(I={}){let C=I.httpProxy||I.httpsProxy||s();if(!C){e.warn("[Fetch] No proxy configured, HTTP_PROXY/HTTPS_PROXY environment variables not set");return}let $=new undici.ProxyAgent({uri:C,connectTimeout:I.connectTimeout||1e4,keepAliveTimeout:I.keepAliveTimeout||3e4});r=undici.getGlobalDispatcher(),undici.setGlobalDispatcher($),n=true,e.info(`[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u542F\u7528: ${C}`);}Ht.enableProxy=a;function i(){!n||!r||(undici.setGlobalDispatcher(r),n=false,r=null,e.info("[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u7981\u7528"));}Ht.disableProxy=i;function c(){return n}Ht.isProxyEnabled=c;async function p(I,C){let $=C?.timeout||3e4,W=C?.responseType||"json",{timeout:V,responseType:ve,..._}=C||{},S=null,m=null;try{_.signal||(S=new AbortController,m=setTimeout(()=>S.abort(),$));let f=await fetch(I,{..._,signal:_.signal||S.signal});m&&clearTimeout(m);let d;switch(W){case "arrayBuffer":d=await f.arrayBuffer();break;case "blob":d=await f.blob();break;case "buffer":{let y=await f.arrayBuffer();d=Buffer.from(y);break}case "text":d=await f.text();break;default:{let y=await f.text();try{d=JSON.parse(y);}catch{d=y;}break}}return {ok:f.ok,status:f.status,statusText:f.statusText,headers:f.headers,data:d,url:f.url}}catch(f){throw m&&clearTimeout(m),f}}async function l(I,C){let $=C?.retries??0,W=C?.retryDelay??1e3,{retries:V,retryDelay:ve,responseType:_,...S}=C||{};return Ot(()=>p(I,{...S,responseType:C?.responseType}),{attempts:$+1,delay:W,maxDelay:W*2**($+1)})}async function u(I,C){return l(I,{method:"GET",...C})}Ht.get=u;async function g(I,C,$){return l(I,{method:"POST",headers:{"Content-Type":"application/json",...$?.headers},body:C?JSON.stringify(C):void 0,...$})}Ht.post=g;async function k(I,C,$){return l(I,{method:"PUT",headers:{"Content-Type":"application/json",...$?.headers},body:C?JSON.stringify(C):void 0,...$})}Ht.put=k;async function E(I,C,$){return l(I,{method:"DELETE",headers:{"Content-Type":"application/json",...$?.headers},body:C?JSON.stringify(C):void 0,...$})}Ht.del=E;async function H(I,C,$){return l(I,{method:"PATCH",headers:{"Content-Type":"application/json",...$?.headers},body:C?JSON.stringify(C):void 0,...$})}Ht.patch=H;async function U(I,C){return l(I,C)}Ht.request=U;function q(I={}){return o()?(a(I),true):false}Ht.autoProxy=q;let Y=5*1024*1024;function G(I){return new TextEncoder().encode(I)}function de(I){return chunkJL3GR4P7_cjs.c.mimeType(I)}function se(I){return I.startsWith("file://")}async function fe(I){let C=url.fileURLToPath(I);return await exports.PKG.file(C).bytes()}async function ke(I,C,$){let W=`----FetchFormBoundary${Date.now()}`,V=[],_=C.some(h=>h.filename||h.value instanceof Uint8Array||Buffer.isBuffer(h.value))&&!$?.timeout?3e5:$?.timeout;for(let h of C){let w=h.maxSize??Y,R=h.filename,v=`Content-Disposition: form-data; name="${h.name}"${R?`; filename="${R}"`:""}`;R&&(v+=`\r
74
+ Content-Type: ${de(R)}`),v+=`\r
75
75
  \r
76
- `,V.push(G(T));let k=g.value;if(typeof k=="string")if(Je(k)){let I=await Ke(k);if(R||(R=k.split("/").pop()||"file"),I.byteLength>w)throw new Error(`File size ${I.byteLength} exceeds limit ${w} bytes: ${R}`);V.push(I);}else V.push(G(k));else if(Buffer.isBuffer(k)){if(k.byteLength>w)throw new Error(`Buffer size ${k.byteLength} exceeds limit ${w} bytes: ${g.name}`);V.push(new Uint8Array(k.buffer,k.byteOffset,k.byteLength));}else if(k instanceof Uint8Array){if(k.byteLength>w)throw new Error(`File size ${k.byteLength} exceeds limit ${w} bytes: ${g.name}`);V.push(k);}}let S=G(`\r
77
- --${q}--`),m=G(`\r
78
- --${q}\r
79
- `),d=[];d.push(G(`--${q}\r
80
- `));for(let g=0;g<V.length;g++)d.push(V[g]),g%2===1&&g<V.length-1&&(d.push(m),d.push(G(`--${q}\r
81
- `)));d.push(S);let u=d.reduce((g,w)=>g+w.length,0),y=new Uint8Array(u),x=0;for(let g of d)y.set(g,x),x+=g.length;return l(O,{method:"POST",headers:{"Content-Type":`multipart/form-data; boundary=${q}`,...A?.headers},body:y,timeout:_,...A})}zt.postForm=Dt;function Ie(O,C,A){let q=new AbortController,V=q.signal;return (async()=>{try{let _={Accept:"text/event-stream",...A?.headers||{}},S=await fetch(O,{...A,headers:_,signal:V});if(!S.ok)throw new Error(`SSE connection failed: ${S.status}`);let m=S.body?.getReader();if(!m)throw new Error("SSE stream not available");let d=new TextDecoder("utf-8"),u="";for(;!V.aborted;){let{done:y,value:x}=await m.read();if(y)break;let g=d.decode(x,{stream:!0});u+=g;let w=u.split(`
82
- `);u=w.pop()??"";for(let R of w)if(R.startsWith("data: ")){let T=R.slice(6);if(T==="[DONE]"){C.onComplete?.();return}C.onMessage?.(T);}}C.onComplete?.();}catch(_){_.name!=="AbortError"&&C.onError?.(_);}})(),()=>{q.abort();}}zt.sse=Ie;})(exports.Fetch||(exports.Fetch={}));chunkVRQQ33YH_cjs.j();exports.Slug=void 0;(r=>{let e=["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"],t=["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 n(){return [e[Math.floor(Math.random()*e.length)],t[Math.floor(Math.random()*t.length)]].join("-")}r.create=n;})(exports.Slug||(exports.Slug={}));chunkVRQQ33YH_cjs.j();function Hn(e){let t=new AbortController,n=setTimeout(t.abort.bind(t),e);return {controller:t,signal:t.signal,clearTimeout:()=>globalThis.clearTimeout(n)}}function Uo(e,...t){let n=Hn(e);return {signal:AbortSignal.any([n.signal,...t]),clearTimeout:n.clearTimeout}}chunkVRQQ33YH_cjs.j();exports.Archive=void 0;(t=>{async function e(n,r){if(process.platform==="win32"){let o=fe__default.default.resolve(n),s=fe__default.default.resolve(r),a=`Expand-Archive -Path '${o}' -DestinationPath '${s}' -Force`,i=await exports.Shell.run("powershell",`-NoProfile -NonInteractive -Command "$global:ProgressPreference = 'SilentlyContinue'; ${a}"`);if(i.code!==0)throw new Error(`PowerShell exited with code ${i.code}: ${i.stderr}`)}else {let o=`unzip -o -q ${n} -d ${r}`,s=await exports.Shell.run(void 0,o);if(s.code!==0)throw new Error(`unzip exited with code ${s.code}: ${s.stderr}`)}}t.extractZip=e;})(exports.Archive||(exports.Archive={}));chunkVRQQ33YH_cjs.j();exports.Color=void 0;(r=>{function e(o){return o?/^#[0-9a-fA-F]{6}$/.test(o):false}r.isValidHex=e;function t(o){let s=parseInt(o.slice(1,3),16),a=parseInt(o.slice(3,5),16),i=parseInt(o.slice(5,7),16);return {r:s,g:a,b:i}}r.hexToRgb=t;function n(o){if(!e(o))return;let{r:s,g:a,b:i}=t(o);return `\x1B[38;2;${s};${a};${i}m\x1B[1m`}r.hexToAnsiBold=n;})(exports.Color||(exports.Color={}));chunkVRQQ33YH_cjs.j();exports.Context=void 0;(n=>{class e extends Error{constructor(s){super(`No context found for ${s}`);chunkVRQQ33YH_cjs.c(this,"name",s);}}n.NotFound=e;function t(r){let o=new async_hooks.AsyncLocalStorage;return {use(){let s=o.getStore();if(!s)throw new e(r);return s},provide(s,a){return o.run(s,a)}}}n.create=t;})(exports.Context||(exports.Context={}));chunkVRQQ33YH_cjs.j();function Yo(e){return {[Symbol.dispose](){e();},[Symbol.asyncDispose](){return Promise.resolve(e())}}}chunkVRQQ33YH_cjs.j();exports.EventLoop=void 0;(t=>{async function e(){return new Promise(n=>{let r=()=>{process._getActiveHandles().length===0&&process._getActiveRequests().length===0?n():setImmediate(r);};r();})}t.wait=e;})(exports.EventLoop||(exports.EventLoop={}));chunkVRQQ33YH_cjs.j();function Vo(e){if(e<=0)return "";if(e<60)return `${e}s`;if(e<3600){let n=Math.floor(e/60),r=e%60;return r>0?`${n}m ${r}s`:`${n}m`}if(e<86400){let n=Math.floor(e/3600),r=Math.floor(e%3600/60);return r>0?`${n}h ${r}m`:`${n}h`}if(e<604800){let n=Math.floor(e/86400);return n===1?"~1 day":`~${n} days`}let t=Math.floor(e/604800);return t===1?"~1 week":`~${t} weeks`}chunkVRQQ33YH_cjs.j();exports.Keybind=void 0;(a=>{function e(i,c){if(i===c)return true;if(typeof i!="object"||typeof c!="object"||i===null||c===null)return false;let p=Object.keys(i),l=Object.keys(c);if(p.length!==l.length)return false;for(let f of p)if(!l.includes(f)||!e(i[f],c[f]))return false;return true}function t(i){return {...i,super:i.super??false}}function n(i,c){return i?e(t(i),t(c)):false}a.match=n;function r(i,c=false){return {name:i.name,ctrl:i.ctrl,meta:i.meta,shift:i.shift,super:i.super??false,leader:c}}a.fromParsedKey=r;function o(i){if(!i)return "";let c=[];i.ctrl&&c.push("ctrl"),i.meta&&c.push("alt"),i.super&&c.push("super"),i.shift&&c.push("shift"),i.name&&(i.name==="delete"?c.push("del"):c.push(i.name));let p=c.join("+");return i.leader&&(p=p?`<leader> ${p}`:"<leader>"),p}a.keyToString=o;function s(i){return i==="none"?[]:i.split(",").map(c=>{let l=c.replace(/<leader>/g,"leader+").toLowerCase().split("+"),f={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let h of l)switch(h){case "ctrl":f.ctrl=true;break;case "alt":case "meta":case "option":f.meta=true;break;case "super":f.super=true;break;case "shift":f.shift=true;break;case "leader":f.leader=true;break;case "esc":f.name="escape";break;default:f.name=h;break}return f})}a.parse=s;})(exports.Keybind||(exports.Keybind={}));chunkVRQQ33YH_cjs.j();exports.Locale=void 0;(p=>{function e(l){return l.replace(/\b\w/g,f=>f.toUpperCase())}p.titlecase=e;function t(l){return new Date(l).toLocaleTimeString(void 0,{timeStyle:"short"})}p.time=t;function n(l){let f=new Date(l),h=t(l),v=f.toLocaleDateString();return `${h} \xB7 ${v}`}p.datetime=n;function r(l){let f=new Date(l),h=new Date;return f.getFullYear()===h.getFullYear()&&f.getMonth()===h.getMonth()&&f.getDate()===h.getDate()?t(l):n(l)}p.todayTimeOrDateTime=r;function o(l){return l>=1e6?(l/1e6).toFixed(1)+"M":l>=1e3?(l/1e3).toFixed(1)+"K":l.toString()}p.number=o;function s(l){if(l<1e3)return `${l}ms`;if(l<6e4)return `${(l/1e3).toFixed(1)}s`;if(l<36e5){let v=Math.floor(l/6e4),E=Math.floor(l%6e4/1e3);return `${v}m ${E}s`}if(l<864e5){let v=Math.floor(l/36e5),E=Math.floor(l%36e5/6e4);return `${v}h ${E}m`}let f=Math.floor(l/36e5);return `${Math.floor(l%36e5/864e5)}d ${f}h`}p.duration=s;function a(l,f){return l.length<=f?l:l.slice(0,f-1)+"\u2026"}p.truncate=a;function i(l,f=35){if(l.length<=f)return l;let h="\u2026",v=Math.ceil((f-h.length)/2),E=Math.floor((f-h.length)/2);return l.slice(0,v)+h+l.slice(-E)}p.truncateMiddle=i;function c(l,f,h){return (l===1?f:h).replace("{}",l.toString())}p.pluralize=c;})(exports.Locale||(exports.Locale={}));chunkVRQQ33YH_cjs.j();var Go=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"];function Jo(){return Go.some(e=>process.env[e])}function Ko(){return process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy}function Zo(){let e=process.env.HTTP_PROXY||process.env.http_proxy,t=process.env.HTTPS_PROXY||process.env.https_proxy;return {http:e,https:t,enabled:!!(e||t)}}chunkVRQQ33YH_cjs.j();var _t=class{constructor(){chunkVRQQ33YH_cjs.c(this,"queue",[]);chunkVRQQ33YH_cjs.c(this,"resolvers",[]);}push(t){let n=this.resolvers.shift();n?n(t):this.queue.push(t);}async next(){return this.queue.length>0?this.queue.shift():new Promise(t=>this.resolvers.push(t))}async*[Symbol.asyncIterator](){for(;;)yield await this.next();}};async function Xo(e,t,n){let r=[...t];await Promise.all(Array.from({length:e},async()=>{for(;;){let o=r.pop();if(o===void 0)return;await n(o);}}));}chunkVRQQ33YH_cjs.j();function Qo(){let e,t=new Promise(n=>e=n);return {trigger(){return e()},wait(){return t}}}chunkVRQQ33YH_cjs.j();function es(e,t){let n;return Promise.race([e.then(r=>(clearTimeout(n),r)),new Promise((r,o)=>{n=setTimeout(()=>{o(new Error(`Operation timed out after ${t}ms`));},t);})])}chunkVRQQ33YH_cjs.j();exports.Token=void 0;(a=>{let n=/[\u4e00-\u9fff\u3400-\u4dbf]/g;function r(i){if(!i)return 0;let c=String(i),p=(c.match(n)||[]).length,l=c.length-p,f=Math.round(p/1.5),h=Math.round(l/4);return Math.max(0,f+h)}a.estimate=r;function o(i){if(i==null)return 0;try{let c=typeof i=="string"?i:JSON.stringify(i);return r(c)}catch{return 0}}a.estimateObject=o;function s(i){if(i.total!==void 0&&i.total>0)return i.total;let c=i.input??0,p=i.output??0,l=i.cache?.read??0,f=i.cache?.write??0;return c+p+l+f}a.total=s;})(exports.Token||(exports.Token={}));chunkVRQQ33YH_cjs.j();function ns(e){let t={};for(let[n,r]of Object.entries(e.required().shape))t[n]=r.nullable();return Be__default.default.object(t)}chunkVRQQ33YH_cjs.j();exports.Wildcard=void 0;(s=>{function e(a,i){let c=i.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return c.endsWith(" .*")&&(c=c.slice(0,-3)+"( .*)?"),new RegExp("^"+c+"$","s").test(a)}s.match=e;function t(a){return a.sort((i,c)=>{let p=i[0].length-c[0].length;return p!==0?p:i[0].localeCompare(c[0])})}function n(a,i){let c=Object.entries(i),p=t(c),l;for(let[f,h]of p)e(a,f)&&(l=h);return l}s.all=n;function r(a,i){let c=Object.entries(i),p=t(c),l;for(let[f,h]of p){let v=f.split(/\s+/);e(a.head,v[0])&&(v.length===1||o(a.tail,v.slice(1)))&&(l=h);}return l}s.allStructured=r;function o(a,i){if(i.length===0)return true;if(a.length<i.length)return false;for(let c=0;c<i.length;c++)if(!e(a[c],i[c]))return false;return true}})(exports.Wildcard||(exports.Wildcard={}));async function hl(e){let{Log:t}=await import('./chunks/log-OJU7I2TN.cjs'),n=false;await t.init({logDir:e.logDir??process.env.EASBOT_LOG_PATH??process.cwd(),print:e.print??false,dev:e.dev??n,level:e.level??("INFO")});}Object.defineProperty(exports,"Filesystem",{enumerable:true,get:function(){return chunkJL3GR4P7_cjs.c}});Object.defineProperty(exports,"Glob",{enumerable:true,get:function(){return chunkJL3GR4P7_cjs.a}});Object.defineProperty(exports,"MIME_TYPES",{enumerable:true,get:function(){return chunkJL3GR4P7_cjs.b}});Object.defineProperty(exports,"PackageRegistry",{enumerable:true,get:function(){return chunkPYCQUF3V_cjs.b}});Object.defineProperty(exports,"Semver",{enumerable:true,get:function(){return chunkPYCQUF3V_cjs.a}});Object.defineProperty(exports,"Lock",{enumerable:true,get:function(){return chunkYC4AEMOP_cjs.a}});Object.defineProperty(exports,"Hono",{enumerable:true,get:function(){return hono.Hono}});Object.defineProperty(exports,"createNodeWebSocket",{enumerable:true,get:function(){return nodeWs.createNodeWebSocket}});Object.defineProperty(exports,"cors",{enumerable:true,get:function(){return cors.cors}});Object.defineProperty(exports,"logger",{enumerable:true,get:function(){return logger.logger}});Object.defineProperty(exports,"compress",{enumerable:true,get:function(){return compress.compress}});Object.defineProperty(exports,"secureHeaders",{enumerable:true,get:function(){return secureHeaders.secureHeaders}});Object.defineProperty(exports,"timeout",{enumerable:true,get:function(){return timeout.timeout}});Object.defineProperty(exports,"HTTPException",{enumerable:true,get:function(){return httpException.HTTPException}});Object.defineProperty(exports,"validator",{enumerable:true,get:function(){return validator.validator}});Object.defineProperty(exports,"zValidator",{enumerable:true,get:function(){return zodValidator.zValidator}});exports.$=Ir;exports.AsyncQueue=_t;exports.NamedError=pt;exports.PkgShell=we;exports.abortAfter=Hn;exports.abortAfterAny=Uo;exports.buildCodeSpanIndex=Ve;exports.chunkMarkdownIR=_n;exports.chunkText=pe;exports.chunkTextByBreakResolver=yt;exports.convertMarkdownTables=Ge;exports.createInlineCodeState=Ye;exports.createPkgShell=ae;exports.createRESTServer=at;exports.createRPCServer=it;exports.createServer=se;exports.createStreamingServer=lt;exports.createWebSocketServer=ct;exports.defer=Yo;exports.detectPlatform=mn;exports.escapeCommandArg=ft;exports.escapeCommandArgSafe=pn;exports.extractFrontmatter=Ue;exports.findFenceSpanAt=Pt;exports.findLast=Jn;exports.fn=Fr;exports.formatDuration=Vo;exports.formatLocalISO=rt;exports.formatLocalISOCompact=ot;exports.formatLogTime=er;exports.formatMarkdown=He;exports.getDirectory=Lo;exports.getFileExtension=Bo;exports.getFilename=Dn;exports.getFilenameTruncated=_o;exports.getProxyConfig=Zo;exports.getProxyUrl=Ko;exports.getTimezoneOffset=tr;exports.git=_r;exports.iife=Ur;exports.initLog=hl;exports.isSafeFenceBreak=Nn;exports.joinCommandArgs=ue;exports.lazy=Fe;exports.lazyAsync=nr;exports.loadEnv=Br;exports.loadTextFile=Hr;exports.loadTextFileAsync=Wr;exports.markdownToIR=he;exports.markdownToIRWithMeta=Pe;exports.needsShellExecution=dn;exports.now=Yt;exports.nowLocalISO=Xn;exports.parseCommand=re;exports.parseCommandWithOptions=fn;exports.parseFenceSpans=qe;exports.parseFrontmatterBlock=Ee;exports.parseLocalISO=Qn;exports.parseModelId=qr;exports.proxied=Jo;exports.readableStreamToText=Mr;exports.renderMarkdown=be;exports.renderMarkdownWithMarkers=Me;exports.retry=Et;exports.scanParenAwareBreakpoints=bt;exports.serializeFrontmatter=We;exports.shell=hn;exports.signal=Qo;exports.startServer=ir;exports.truncateMiddle=jo;exports.updateSchema=ns;exports.whichSync=Er;exports.withTimeout=es;exports.work=Xo;
76
+ `,V.push(G(v));let T=h.value;if(typeof T=="string")if(se(T)){let O=await fe(T);if(R||(R=T.split("/").pop()||"file"),O.byteLength>w)throw new Error(`File size ${O.byteLength} exceeds limit ${w} bytes: ${R}`);V.push(O);}else V.push(G(T));else if(Buffer.isBuffer(T)){if(T.byteLength>w)throw new Error(`Buffer size ${T.byteLength} exceeds limit ${w} bytes: ${h.name}`);V.push(new Uint8Array(T.buffer,T.byteOffset,T.byteLength));}else if(T instanceof Uint8Array){if(T.byteLength>w)throw new Error(`File size ${T.byteLength} exceeds limit ${w} bytes: ${h.name}`);V.push(T);}}let S=G(`\r
77
+ --${W}--`),m=G(`\r
78
+ --${W}\r
79
+ `),f=[];f.push(G(`--${W}\r
80
+ `));for(let h=0;h<V.length;h++)f.push(V[h]),h%2===1&&h<V.length-1&&(f.push(m),f.push(G(`--${W}\r
81
+ `)));f.push(S);let d=f.reduce((h,w)=>h+w.length,0),y=new Uint8Array(d),x=0;for(let h of f)y.set(h,x),x+=h.length;return l(I,{method:"POST",headers:{"Content-Type":`multipart/form-data; boundary=${W}`,...$?.headers},body:y,timeout:_,...$})}Ht.postForm=ke;function Te(I,C,$){let W=new AbortController,V=W.signal;return (async()=>{try{let _={Accept:"text/event-stream",...$?.headers||{}},S=await fetch(I,{...$,headers:_,signal:V});if(!S.ok)throw new Error(`SSE connection failed: ${S.status}`);let m=S.body?.getReader();if(!m)throw new Error("SSE stream not available");let f=new TextDecoder("utf-8"),d="";for(;!V.aborted;){let{done:y,value:x}=await m.read();if(y)break;let h=f.decode(x,{stream:!0});d+=h;let w=d.split(`
82
+ `);d=w.pop()??"";for(let R of w)if(R.startsWith("data: ")){let v=R.slice(6);if(v==="[DONE]"){C.onComplete?.();return}C.onMessage?.(v);}}C.onComplete?.();}catch(_){_.name!=="AbortError"&&C.onError?.(_);}})(),()=>{W.abort();}}Ht.sse=Te;})(exports.Fetch||(exports.Fetch={}));chunkVRQQ33YH_cjs.j();exports.Slug=void 0;(r=>{let e=["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"],t=["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 n(){return [e[Math.floor(Math.random()*e.length)],t[Math.floor(Math.random()*t.length)]].join("-")}r.create=n;})(exports.Slug||(exports.Slug={}));chunkVRQQ33YH_cjs.j();function Hn(e){let t=new AbortController,n=setTimeout(t.abort.bind(t),e);return {controller:t,signal:t.signal,clearTimeout:()=>globalThis.clearTimeout(n)}}function Uo(e,...t){let n=Hn(e);return {signal:AbortSignal.any([n.signal,...t]),clearTimeout:n.clearTimeout}}chunkVRQQ33YH_cjs.j();exports.Archive=void 0;(t=>{async function e(n,r){if(process.platform==="win32"){let o=he__default.default.resolve(n),s=he__default.default.resolve(r),a=`Expand-Archive -Path '${o}' -DestinationPath '${s}' -Force`,i=await exports.Shell.run("powershell",`-NoProfile -NonInteractive -Command "$global:ProgressPreference = 'SilentlyContinue'; ${a}"`);if(i.code!==0)throw new Error(`PowerShell exited with code ${i.code}: ${i.stderr}`)}else {let o=`unzip -o -q ${n} -d ${r}`,s=await exports.Shell.run(void 0,o);if(s.code!==0)throw new Error(`unzip exited with code ${s.code}: ${s.stderr}`)}}t.extractZip=e;})(exports.Archive||(exports.Archive={}));chunkVRQQ33YH_cjs.j();exports.Color=void 0;(r=>{function e(o){return o?/^#[0-9a-fA-F]{6}$/.test(o):false}r.isValidHex=e;function t(o){let s=parseInt(o.slice(1,3),16),a=parseInt(o.slice(3,5),16),i=parseInt(o.slice(5,7),16);return {r:s,g:a,b:i}}r.hexToRgb=t;function n(o){if(!e(o))return;let{r:s,g:a,b:i}=t(o);return `\x1B[38;2;${s};${a};${i}m\x1B[1m`}r.hexToAnsiBold=n;})(exports.Color||(exports.Color={}));chunkVRQQ33YH_cjs.j();exports.Context=void 0;(n=>{class e extends Error{constructor(s){super(`No context found for ${s}`);chunkVRQQ33YH_cjs.c(this,"name",s);}}n.NotFound=e;function t(r){let o=new async_hooks.AsyncLocalStorage;return {use(){let s=o.getStore();if(!s)throw new e(r);return s},provide(s,a){return o.run(s,a)}}}n.create=t;})(exports.Context||(exports.Context={}));chunkVRQQ33YH_cjs.j();function Yo(e){return {[Symbol.dispose](){e();},[Symbol.asyncDispose](){return Promise.resolve(e())}}}chunkVRQQ33YH_cjs.j();exports.EventLoop=void 0;(t=>{async function e(){return new Promise(n=>{let r=()=>{process._getActiveHandles().length===0&&process._getActiveRequests().length===0?n():setImmediate(r);};r();})}t.wait=e;})(exports.EventLoop||(exports.EventLoop={}));chunkVRQQ33YH_cjs.j();function Vo(e){if(e<=0)return "";if(e<60)return `${e}s`;if(e<3600){let n=Math.floor(e/60),r=e%60;return r>0?`${n}m ${r}s`:`${n}m`}if(e<86400){let n=Math.floor(e/3600),r=Math.floor(e%3600/60);return r>0?`${n}h ${r}m`:`${n}h`}if(e<604800){let n=Math.floor(e/86400);return n===1?"~1 day":`~${n} days`}let t=Math.floor(e/604800);return t===1?"~1 week":`~${t} weeks`}chunkVRQQ33YH_cjs.j();exports.Keybind=void 0;(a=>{function e(i,c){if(i===c)return true;if(typeof i!="object"||typeof c!="object"||i===null||c===null)return false;let p=Object.keys(i),l=Object.keys(c);if(p.length!==l.length)return false;for(let u of p)if(!l.includes(u)||!e(i[u],c[u]))return false;return true}function t(i){return {...i,super:i.super??false}}function n(i,c){return i?e(t(i),t(c)):false}a.match=n;function r(i,c=false){return {name:i.name,ctrl:i.ctrl,meta:i.meta,shift:i.shift,super:i.super??false,leader:c}}a.fromParsedKey=r;function o(i){if(!i)return "";let c=[];i.ctrl&&c.push("ctrl"),i.meta&&c.push("alt"),i.super&&c.push("super"),i.shift&&c.push("shift"),i.name&&(i.name==="delete"?c.push("del"):c.push(i.name));let p=c.join("+");return i.leader&&(p=p?`<leader> ${p}`:"<leader>"),p}a.keyToString=o;function s(i){return i==="none"?[]:i.split(",").map(c=>{let l=c.replace(/<leader>/g,"leader+").toLowerCase().split("+"),u={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let g of l)switch(g){case "ctrl":u.ctrl=true;break;case "alt":case "meta":case "option":u.meta=true;break;case "super":u.super=true;break;case "shift":u.shift=true;break;case "leader":u.leader=true;break;case "esc":u.name="escape";break;default:u.name=g;break}return u})}a.parse=s;})(exports.Keybind||(exports.Keybind={}));chunkVRQQ33YH_cjs.j();exports.Locale=void 0;(p=>{function e(l){return l.replace(/\b\w/g,u=>u.toUpperCase())}p.titlecase=e;function t(l){return new Date(l).toLocaleTimeString(void 0,{timeStyle:"short"})}p.time=t;function n(l){let u=new Date(l),g=t(l),k=u.toLocaleDateString();return `${g} \xB7 ${k}`}p.datetime=n;function r(l){let u=new Date(l),g=new Date;return u.getFullYear()===g.getFullYear()&&u.getMonth()===g.getMonth()&&u.getDate()===g.getDate()?t(l):n(l)}p.todayTimeOrDateTime=r;function o(l){return l>=1e6?(l/1e6).toFixed(1)+"M":l>=1e3?(l/1e3).toFixed(1)+"K":l.toString()}p.number=o;function s(l){if(l<1e3)return `${l}ms`;if(l<6e4)return `${(l/1e3).toFixed(1)}s`;if(l<36e5){let k=Math.floor(l/6e4),E=Math.floor(l%6e4/1e3);return `${k}m ${E}s`}if(l<864e5){let k=Math.floor(l/36e5),E=Math.floor(l%36e5/6e4);return `${k}h ${E}m`}let u=Math.floor(l/36e5);return `${Math.floor(l%36e5/864e5)}d ${u}h`}p.duration=s;function a(l,u){return l.length<=u?l:l.slice(0,u-1)+"\u2026"}p.truncate=a;function i(l,u=35){if(l.length<=u)return l;let g="\u2026",k=Math.ceil((u-g.length)/2),E=Math.floor((u-g.length)/2);return l.slice(0,k)+g+l.slice(-E)}p.truncateMiddle=i;function c(l,u,g){return (l===1?u:g).replace("{}",l.toString())}p.pluralize=c;})(exports.Locale||(exports.Locale={}));chunkVRQQ33YH_cjs.j();var Go=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"];function Jo(){return Go.some(e=>process.env[e])}function Ko(){return process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy}function Zo(){let e=process.env.HTTP_PROXY||process.env.http_proxy,t=process.env.HTTPS_PROXY||process.env.https_proxy;return {http:e,https:t,enabled:!!(e||t)}}chunkVRQQ33YH_cjs.j();var Dt=class{constructor(){chunkVRQQ33YH_cjs.c(this,"queue",[]);chunkVRQQ33YH_cjs.c(this,"resolvers",[]);}push(t){let n=this.resolvers.shift();n?n(t):this.queue.push(t);}async next(){return this.queue.length>0?this.queue.shift():new Promise(t=>this.resolvers.push(t))}async*[Symbol.asyncIterator](){for(;;)yield await this.next();}};async function Xo(e,t,n){let r=[...t];await Promise.all(Array.from({length:e},async()=>{for(;;){let o=r.pop();if(o===void 0)return;await n(o);}}));}chunkVRQQ33YH_cjs.j();function Qo(){let e,t=new Promise(n=>e=n);return {trigger(){return e()},wait(){return t}}}chunkVRQQ33YH_cjs.j();function es(e,t){let n;return Promise.race([e.then(r=>(clearTimeout(n),r)),new Promise((r,o)=>{n=setTimeout(()=>{o(new Error(`Operation timed out after ${t}ms`));},t);})])}chunkVRQQ33YH_cjs.j();exports.Token=void 0;(a=>{let n=/[\u4e00-\u9fff\u3400-\u4dbf]/g;function r(i){if(!i)return 0;let c=String(i),p=(c.match(n)||[]).length,l=c.length-p,u=Math.round(p/1.5),g=Math.round(l/4);return Math.max(0,u+g)}a.estimate=r;function o(i){if(i==null)return 0;try{let c=typeof i=="string"?i:JSON.stringify(i);return r(c)}catch{return 0}}a.estimateObject=o;function s(i){if(i.total!==void 0&&i.total>0)return i.total;let c=i.input??0,p=i.output??0,l=i.cache?.read??0,u=i.cache?.write??0;return c+p+l+u}a.total=s;})(exports.Token||(exports.Token={}));chunkVRQQ33YH_cjs.j();function ns(e){let t={};for(let[n,r]of Object.entries(e.required().shape))t[n]=r.nullable();return Ne__default.default.object(t)}chunkVRQQ33YH_cjs.j();exports.Wildcard=void 0;(s=>{function e(a,i){let c=i.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return c.endsWith(" .*")&&(c=c.slice(0,-3)+"( .*)?"),new RegExp("^"+c+"$","s").test(a)}s.match=e;function t(a){return a.sort((i,c)=>{let p=i[0].length-c[0].length;return p!==0?p:i[0].localeCompare(c[0])})}function n(a,i){let c=Object.entries(i),p=t(c),l;for(let[u,g]of p)e(a,u)&&(l=g);return l}s.all=n;function r(a,i){let c=Object.entries(i),p=t(c),l;for(let[u,g]of p){let k=u.split(/\s+/);e(a.head,k[0])&&(k.length===1||o(a.tail,k.slice(1)))&&(l=g);}return l}s.allStructured=r;function o(a,i){if(i.length===0)return true;if(a.length<i.length)return false;for(let c=0;c<i.length;c++)if(!e(a[c],i[c]))return false;return true}})(exports.Wildcard||(exports.Wildcard={}));async function hl(e){let{Log:t}=await import('./chunks/log-OJU7I2TN.cjs'),n=false;await t.init({logDir:e.logDir??process.env.EASBOT_LOG_PATH??process.cwd(),print:e.print??false,dev:e.dev??n,level:e.level??("INFO")});}Object.defineProperty(exports,"Filesystem",{enumerable:true,get:function(){return chunkJL3GR4P7_cjs.c}});Object.defineProperty(exports,"Glob",{enumerable:true,get:function(){return chunkJL3GR4P7_cjs.a}});Object.defineProperty(exports,"MIME_TYPES",{enumerable:true,get:function(){return chunkJL3GR4P7_cjs.b}});Object.defineProperty(exports,"PackageRegistry",{enumerable:true,get:function(){return chunkPYCQUF3V_cjs.b}});Object.defineProperty(exports,"Semver",{enumerable:true,get:function(){return chunkPYCQUF3V_cjs.a}});Object.defineProperty(exports,"Lock",{enumerable:true,get:function(){return chunkYC4AEMOP_cjs.a}});Object.defineProperty(exports,"Hono",{enumerable:true,get:function(){return hono.Hono}});Object.defineProperty(exports,"createNodeWebSocket",{enumerable:true,get:function(){return nodeWs.createNodeWebSocket}});Object.defineProperty(exports,"cors",{enumerable:true,get:function(){return cors.cors}});Object.defineProperty(exports,"logger",{enumerable:true,get:function(){return logger.logger}});Object.defineProperty(exports,"compress",{enumerable:true,get:function(){return compress.compress}});Object.defineProperty(exports,"secureHeaders",{enumerable:true,get:function(){return secureHeaders.secureHeaders}});Object.defineProperty(exports,"timeout",{enumerable:true,get:function(){return timeout.timeout}});Object.defineProperty(exports,"HTTPException",{enumerable:true,get:function(){return httpException.HTTPException}});Object.defineProperty(exports,"validator",{enumerable:true,get:function(){return validator.validator}});Object.defineProperty(exports,"zValidator",{enumerable:true,get:function(){return zodValidator.zValidator}});exports.$=Or;exports.AsyncQueue=Dt;exports.NamedError=gt;exports.PkgShell=Re;exports.abortAfter=Hn;exports.abortAfterAny=Uo;exports.buildCodeSpanIndex=Ze;exports.chunkMarkdownIR=_n;exports.chunkText=be;exports.chunkTextByBreakResolver=wt;exports.convertMarkdownTables=Xe;exports.createInlineCodeState=Ke;exports.createPkgShell=le;exports.createRESTServer=lt;exports.createRPCServer=ct;exports.createServer=ae;exports.createStreamingServer=dt;exports.createWebSocketServer=ut;exports.defer=Yo;exports.detectPlatform=mn;exports.escapeCommandArg=mt;exports.escapeCommandArgSafe=pn;exports.extractFrontmatter=Ge;exports.findFenceSpanAt=Et;exports.findLast=Jn;exports.fn=Fr;exports.formatDuration=Vo;exports.formatLocalISO=st;exports.formatLocalISOCompact=it;exports.formatLogTime=er;exports.formatMarkdown=Ye;exports.getDirectory=Lo;exports.getFileExtension=Bo;exports.getFilename=Nn;exports.getFilenameTruncated=_o;exports.getProxyConfig=Zo;exports.getProxyUrl=Ko;exports.getTimezoneOffset=tr;exports.git=_r;exports.iife=Ur;exports.initLog=hl;exports.isSafeFenceBreak=Dn;exports.joinCommandArgs=me;exports.lazy=Be;exports.lazyAsync=nr;exports.loadEnv=Br;exports.loadTextFile=Hr;exports.loadTextFileAsync=Wr;exports.markdownToIR=we;exports.markdownToIRWithMeta=Ie;exports.needsShellExecution=dn;exports.now=Yt;exports.nowLocalISO=Xn;exports.parseCommand=re;exports.parseCommandWithOptions=fn;exports.parseFenceSpans=Je;exports.parseFrontmatterBlock=Ae;exports.parseLocalISO=Qn;exports.parseModelId=qr;exports.proxied=Jo;exports.readableStreamToText=Mr;exports.renderMarkdown=Se;exports.renderMarkdownWithMarkers=Fe;exports.retry=Ot;exports.scanParenAwareBreakpoints=xt;exports.serializeFrontmatter=Ve;exports.shell=hn;exports.signal=Qo;exports.startServer=ir;exports.truncateMiddle=jo;exports.updateSchema=ns;exports.whichSync=Er;exports.withTimeout=es;exports.work=Xo;