@easbot/utils 0.2.41 → 0.2.43

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,82 +1,82 @@
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'),_e=require('zod'),crypto$1=require('crypto'),me=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'),Kr=require('markdown-it'),_n=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 _e__default=/*#__PURE__*/_interopDefault(_e);var me__default=/*#__PURE__*/_interopDefault(me);var Le__default=/*#__PURE__*/_interopDefault(Le);var Kr__default=/*#__PURE__*/_interopDefault(Kr);var _n__default=/*#__PURE__*/_interopDefault(_n);chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Gn(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(d=>{let g=Math.max(0,Math.min(a.length-c,d-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;(d=>{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",subagent:"sub",hook:"hok",compaction:"cmp",context:"ctx"};function t(g){return _e__default.default.string().startsWith(e[g])}d.schema=t;let n=26,r=0,o=0;function s(g,k){return i(g,false,k)}d.ascending=s;function a(g,k){return i(g,true,k)}d.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="",D=crypto$1.randomBytes(g);for(let U=0;U<g;U++){let W=D[U];W!==void 0&&(E+=k[W%62]);}return E}function p(g,k,E){let D=E??Date.now();D!==r&&(r=D,o=0),o++;let U=BigInt(D)*BigInt(4096)+BigInt(o);U=k?~U:U;let W=Buffer.alloc(6);for(let N=0;N<6;N++)W[N]=Number(U>>BigInt(40-8*N)&BigInt(255));return e[g]+"_"+W.toString("hex")+c(n-12)}d.create=p;function l(g){let k=g.split("_")[0];if(!k)return 0;let E=g.slice(k.length+1,k.length+13),D=BigInt("0x"+E);return Number(D/BigInt(4096))}d.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",d=i.sourcePath,g=chunkJL3GR4P7_cjs.c.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),k=i.dir??g;if(a.length<=c)return {content:a,truncated:false};let E=exports.Identifier.ascending("context"),D=chunkJL3GR4P7_cjs.c.join(k,E);await oe__default.default.mkdir(k,{recursive:true}).catch(()=>{}),await oe__default.default.writeFile(D,a,"utf-8");let U=a.length-c,W;p==="head"?W=a.slice(0,c):W=a.slice(-c);let N=n(D,l,d),ie=`${U} characters truncated`;return {content:p==="head"?`${W}
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
- ...${ie}...
6
+ ...${ke}...
7
7
 
8
- ${N}`:`...${ie}...
8
+ ${fe}`:`...${ke}...
9
9
 
10
- ${N}
10
+ ${fe}
11
11
 
12
- ${W}`,truncated:true,outputPath:D,originalLength:a.length,removedLength:U,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"),d=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${d}:${g}:${k}`;if(t){let D=String(n.getMilliseconds()).padStart(3,"0");E+=`.${D}`;}return E+=i,E}function ot(e){return rt(e,false)}function qt(){return Date.now()}function Zn(e=true){return rt(qt(),e)}function Xn(e){return e.includes("+")||e.includes("-")?new Date(e):new Date(e)}function Qn(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 er(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]??"",d=parseInt(p[2]??"0",10);return `${l} (fork #${d+1})`}return `${c} (fork #1)`}i.getForked=a;})(exports.SessionTitle||(exports.SessionTitle={}));chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Yt(e){let t,n=false,r=()=>(n||(t=e(),n=true),t);return r.reset=()=>{n=false,t=void 0;},r}var Ae=Yt;function Vt(e){let t,n=()=>(t||(t=e()),t);return n.reset=()=>{t=void 0;},n}var tr=Vt;exports.Lazy=void 0;(n=>(n.lazy=Yt,n.lazyAsync=Vt))(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 sr(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 ae=chunkWWPI6PC4_cjs.a.create({service:"build-api"});async function an(){try{return {available:!0,version:(await import('./chunks/main-RIJAJS2R.cjs')).version||"unknown"}}catch(e){return ae.warn("esbuild not available",{error:e.message}),{available:false}}}async function Be(){let e=await an();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"&&ae.warn(`esbuild version ${e.version} may have limited features. Consider upgrading to 0.17+`);}function lr(e){if(e!==void 0)return typeof e=="boolean"?{target:void 0}:typeof e=="string"?{target:e}:e}function cn(e){let t=lr(e.compile);t&&ae.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:ur(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=dr(e.target)),e.minify===true&&(n.minifyWhitespace=true,n.minifyIdentifiers=true,n.minifySyntax=true),fr(n)}function ur(e){return !e||e==="none"?false:e}function dr(e){let t={browser:"es2020",node:"node16",bun:"esnext"};return e?t[e]||e:"esnext"}function fr(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 nn(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){ae.info("Build started",{entrypoints:e.entrypoints,target:e.target,format:e.format,compile:typeof e.compile}),await Be();let t=await import('./chunks/main-RIJAJS2R.cjs'),n=Date.now();try{let r=cn(e);ae.debug("esbuild options",r);let o=await t.build(r),s=Date.now();return ae.info("Build completed",{duration:s-n,outputs:(o?.outputFiles?.length??0)>0||Object.keys(o.metafile?.outputs||{}).length>0}),nn(o,n,s)}catch(r){let o=Date.now(),s=r.message;return ae.error("Build failed",{error:s,duration:o-n}),r&&typeof r=="object"&&"errors"in r?nn(r):{outputs:[],success:false,logs:[{level:"error",message:s}],metafile:void 0}}}var yr={build:dt},ln=yr;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 un(e){return /[|&;<>()$`!#]/.test(e)}function dn(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 xr=new Set(["&&","||","|",";","&",">","<",">>","<<","2>","2>>","1>","1>>","2>&1","2>&2","1>&1","1>&2",">&","<&",">&1","<&1",">&2","<&2"]);function fn(e,t=process.platform==="win32"?"windows":"unix"){return xr.has(e)?e:ft(e,t)}function pn(){return process.platform==="win32"?"windows":"unix"}function fe(e,t,n=process.platform==="win32"?"windows":"unix"){let r=t.map(o=>fn(o,n));return [e,...r].join(" ")}function mn(e){if(e==null)return "";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>mn(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 wr(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 pe(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=wr(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 pe(e,{...t,cwd:s})},o.env=function(s){return pe(e,{...t,env:s})},o.quiet=function(){return pe(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 pe(e,{...t,nothrow:true})},o.throws=function(s){return pe(e,{...t,nothrow:!s})},o}var Se=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+=mn(n[o]));return pe(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 ce({...this.options,env:t})}cwd(t){return ce({...this.options,cwd:t})}nothrow(){return ce({...this.options,nothrow:true})}throws(t){return ce({...this.options,nothrow:!t})}};function ce(e={}){let t=new Se(e);return new Proxy(t,{apply(n,r,o){return t.call(o[0],...o.slice(1))}})}var gn=ce();function hn(e){return e.replace(/\\/g,"/")}function bn(e){return crypto$1.createHash("md5").update(e).digest("hex").slice(0,8)}var X=new Map;exports.PKG=void 0;(A=>{let e=chunkWWPI6PC4_cjs.a.create({service:"pkg"});async function t(w){let m=w?[w]:["npm","pnpm","bun"];for(let f of m){let u=await A.which(f);if(u)return {name:f,path:u}}}A.packageManager=t;async function n(w,m){if(!w)return process.execPath;let f=m?.PATH||process.env.PATH||process.env.Path||"",u=process.env.EASBOT_BIN_PATH,y=u?f+me__default.default.delimiter+u:f,x=bn(y),h=`${w}:${x}`;if(X.has(h))return X.get(h);let P=process.platform==="win32"?"where":"which";try{let{spawn:T}=await import('child_process');return new Promise(M=>{let I=T(P,[w],{env:{...process.env,PATH:y},stdio:["pipe","pipe","ignore"],windowsHide:!0}),H="",B="";I.stdout?.on("data",z=>{H+=z.toString();}),I.stderr?.on("data",z=>{B+=z.toString();}),I.on("close",z=>{if(z===0&&H.trim()){let F=H.trim().split(`
14
- `),$=F.length>0?F[0]?.trim():null;if($){X.set(h,$),M($);return}}X.set(h,null),M(null);}),setTimeout(()=>{I.kill(),X.set(h,null),M(null);},5e3);})}catch{return X.set(h,null),null}}A.which=n;function r(w,m){if(!w)return process.execPath;let f=m?.PATH||process.env.PATH||process.env.Path||"",u=process.env.EASBOT_BIN_PATH,y=u?f+me__default.default.delimiter+u:f,x=bn(y),h=`${w}:${x}`;if(X.has(h))return X.get(h);let P=process.platform==="win32"?"where":"which";try{let T=child_process.execSync(`${P} ${w}`,{encoding:"utf-8",stdio:["pipe","pipe","ignore"],env:{...process.env,PATH:y},timeout:5e3,windowsHide:!0});if(T.trim()){let M=T.trim().split(`
15
- `),I=M.length>0?M[0]?.trim():null;if(I)return X.set(h,I),I}}catch{}return X.set(h,null),null}A.whichSync=r;function o(){X.clear();}A.clearWhichCache=o;let s=module$1.createRequire(chunkVRQQ33YH_cjs.i);async function a(w,m,f){try{let u=[];if(f?.extraPaths)for(let y of f.extraPaths){let x=me__default.default.join(y,"node_modules");u.push(x);}return m&&u.push(m),u.length>0?s.resolve(w,{paths:u}):s.resolve(w)}catch(u){throw new Error(`Cannot resolve module "${w}"${m?` from "${m}"`:""}: ${u instanceof Error?u.message:String(u)}`)}}A.resolve=a;function i(w){return {get name(){return me__default.default.basename(w)},async exists(){try{return await oe__default.default.access(w),!0}catch{return false}},async getSize(){try{return (await oe__default.default.stat(w)).size}catch{return}},async text(){return await oe__default.default.readFile(w,"utf-8")},textSync(){return Le__default.default.readFileSync(w,"utf-8")},jsonSync(){let m=Le__default.default.readFileSync(w,"utf-8");return JSON.parse(m)},async bytes(){e.debug("[PKG.file.bytes] reading file:",{filePath:w});let m=await oe__default.default.readFile(w);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(w);return m.buffer.slice(m.byteOffset,m.byteOffset+m.byteLength)},get type(){let m=me__default.default.extname(w).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 u=await m.arrayBuffer();f=new Uint8Array(u);}else f=m;await oe__default.default.writeFile(w,f);},async json(){let m=await oe__default.default.readFile(w,"utf-8");return JSON.parse(m)},async stat(){return await oe__default.default.stat(w)}}}A.file=i;async function c(w,m,f){let u;if(m instanceof Response){let y=await m.arrayBuffer();u=new Uint8Array(y);}else u=m;await oe__default.default.writeFile(w,u,f?{mode:f.mode}:void 0);}A.write=c;function p(w,m,f){Le__default.default.writeFileSync(w,m,f?{mode:f.mode}:void 0);}A.writeSync=p;function l(w,m="utf-8"){return Le__default.default.readFileSync(w,m)}A.readSync=l;function d(w,m){let f,u;if(typeof w=="object"&&"cmd"in w){let T=w;f=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 f=Array.isArray(w)?w:[w],u=m||{};if(!f||f.length===0||!f[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 h=child_process.spawn(f[0],f.slice(1),x),S;if(u.signal){S=()=>{h.kill();},u.signal.addEventListener("abort",S,{once:true});let T=()=>{S&&(u.signal?.removeEventListener("abort",S),S=void 0);};h.on("close",T),h.on("error",T);}let P=new Promise((T,M)=>{let I=false,H=()=>{I||(I=true,h.removeAllListeners());};if(h.on("close",B=>{H(),T(B??0);}),h.on("error",B=>{H(),M(B);}),u.timeout!==false){let B=u.timeout||3e5;setTimeout(()=>{if(!I){e.debug(`Process timeout after ${B}ms, killing process`,{cmd:f.join(" ")}),H();try{h.kill("SIGKILL");}catch{}M(new Error(`Process timeout after ${B}ms: ${f.join(" ")}`));}},B);}});return {stdout:h.stdout,stderr:h.stderr,stdin:h.stdin,pid:h.pid,exited:P,exitCode:h.exitCode,kill:T=>h.kill(T)}}A.spawn=d;async function g(w,m){let f=m?.stdin??"null",u=m?.stdout??"pipe",y=m?.stderr??"pipe",x=d(w,{cwd:m?.cwd,env:m?.env,stdin:f,stdout:u,stderr:y,windowsHide:m?.windowsHide,shell:m?.shell}),h=[],S=[];u==="pipe"&&x.stdout?.on("data",T=>{h.push(T);}),y==="pipe"&&x.stderr?.on("data",T=>{S.push(T);});let P=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(P),u==="pipe"&&x.stdout?.destroy(),y==="pipe"&&x.stderr?.destroy(),f==="pipe"&&x.stdin?.end(),{code:T,stdout:Buffer.concat(h).toString("utf-8"),stderr:Buffer.concat(S).toString("utf-8")}}catch(T){return clearTimeout(P),u==="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(S).toString("utf-8")||(T instanceof Error?T.message:String(T))}}}A.run=g;async function k(w,m={},f={}){let u=d(w,{cwd:m.cwd,env:m.env,stdout:"pipe",stderr:"pipe",stdin:"null"}),y="",x="";u.stdout?.on("data",S=>{let P=S.toString("utf-8");y+=P,f.onStdout?.(P);}),u.stderr?.on("data",S=>{let P=S.toString("utf-8");x+=P,f.onStderr?.(P);});let h=m.timeout&&m.timeout>0?setTimeout(()=>{try{u.kill("SIGKILL");}catch{}u.stdout?.destroy(),u.stderr?.destroy();},m.timeout):void 0;try{let S=await u.exited;return clearTimeout(h),f.onExit?.(S),{code:S,stdout:y,stderr:x}}catch(S){clearTimeout(h);let P=S instanceof Error?S.message:String(S);return {code:-1,stdout:y,stderr:x||P}}}A.runWithStream=k;async function E(w){if(typeof w.pipeThrough=="function")try{let y=new TextDecoderStream("utf-8"),h=w.pipeThrough(y).getReader(),S="";try{for(;;){let{done:P,value:T}=await h.read();if(P)break;S+=T;}return S}finally{h.releaseLock();}}catch{}let m=w.getReader(),f=new TextDecoder("utf-8"),u=[];try{for(;;){let{done:y,value:x}=await m.read();if(y)break;u.push(f.decode(x,{stream:!0}));}return u.push(f.decode()),u.join("")}finally{m.releaseLock();}}A.readableStreamToText=E;async function D(w){let m=[];return new Promise((f,u)=>{w.on("data",y=>{typeof y=="string"?m.push(Buffer.from(y)):m.push(y);}),w.on("end",()=>{try{let x=Buffer.concat(m).toString("utf-8");f(x);}catch(y){u(y);}}),w.on("error",y=>{u(y);});})}A.nodeReadableStreamToText=D;function U(w,m=0){let P=new TextEncoder().encode(w),T=P.length,M,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;)$=H($,z(P,I)),I+=4,Q=H(Q,z(P,I)),I+=4,J=H(J,z(P,I)),I+=4,Z=H(Z,z(P,I)),I+=4;M=B($,1)+B(Q,7)+B(J,12)+B(Z,18)|0;}else M=m+374761393|0;for(M=M+T|0;I+4<=T;)M=M+z(P,I)*3266489917|0,M=B(M,17)*668265263|0,I+=4;for(;I<T;)M=M+P[I]*374761393|0,M=B(M,11)*2654435761|0,I++;return M^=M>>>15,M=M*2246822519|0,M^=M>>>13,M=M*3266489917|0,M^=M>>>16,M>>>0;function H(F,$){return F=F+$*2246822519|0,F=B(F,13),F=F*2654435761|0,F}function B(F,$){return F<<$|F>>>32-$|0}function z(F,$){return (F[$]|F[$+1]<<8|F[$+2]<<16|F[$+3]<<24)>>>0}}A.xxHash32=U;function W(w){let m=0;for(let f of w){let u=f.codePointAt(0)||f.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}A.stringWidth=W;class N{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 u of f)yield hn(u);}*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 u of f)yield hn(u);}match(m){return minimatch.minimatch(m,this.pattern)}}A.Glob=N,A.stdin=process.stdin,A.stdout=process.stdout,A.stderr=process.stderr,A.sleep=w=>new Promise(m=>setTimeout(m,w)),A.color=(w,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"})[w.toLowerCase()]||null,A.hash={xxHash32:A.xxHash32},A.build=ln.build,A.server=se,A.nodeWebSocket=nodeWs.createNodeWebSocket,A.restServer=at,A.rpcServer=it,A.streamingServer=lt,A.webSocketServer=ct;})(exports.PKG||(exports.PKG={}));var Pr=exports.PKG.readableStreamToText;exports.PKG.nodeReadableStreamToText;exports.PKG.which;var Mr=exports.PKG.whichSync;exports.PKG.spawn;exports.PKG.run;var xn=200,wn={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,u){let y=f.pid;if(!(!y||u?.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(xn),u?.exited?.()||process.kill(-y,"SIGKILL");}catch{f.kill("SIGTERM"),await promises.setTimeout(xn),u?.exited?.()||f.kill("SIGKILL");}}}m.killTree=t;function n(f){if(process.platform!=="win32"||!f.includes("/")&&!f.includes("\\")&&!f.includes(":"))return f;let u=chunkJL3GR4P7_cjs.c.normalize(f);return E(u)==="bash"&&g()||u}function r(f){return wn[E(f)]}function o(f){return r(f)?.deny!==true}function s(f){return chunkJL3GR4P7_cjs.c.isAbsolute(f)}function a(f){let u=n(f);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"),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(u=>u.trim()&&!u.startsWith("#")))):["/bin/bash","/bin/zsh","/bin/sh"]}function p(f,u){if(f&&(!u?.acceptable||o(f))){let y=a(f);if(y)return y}return process.platform==="win32"?i()[0]:k()}m.defaultPreferred=Ae(()=>p(process.env.SHELL)),m.defaultAcceptable=Ae(()=>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 u=chunkJL3GR4P7_cjs.c.normalize(me__default.default.join(f,"..","..","bin","bash.exe"));if((chunkJL3GR4P7_cjs.c.stat(u)?.size??0)>0)return u}m.gitbash=g;function k(){if(process.platform==="win32"){let u=g();return u||"/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 me__default.default.posix.basename(chunkJL3GR4P7_cjs.c.toUnixPath(f)).toLowerCase()}m.name=E;function D(f){return r(f)?.login===true}m.login=D;function U(f){return r(f)?.posix===true}m.posix=U;function W(f){return r(f)?.ps===true}m.ps=W;function N(f){let u=n(f),y=E(u);return {path:u,name:y,acceptable:o(y)}}function ie(f,u,y){let x=E(f),h=re(u),S=fe(h[0]??u,h.slice(1));return x==="nu"||x==="fish"?["-c",S]: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"
20
- ${S}
20
+ ${w}
21
21
  `,"easbot",y]:x==="bash"?["-l","-c",`${process.platform==="win32"?`cmd /c chcp 65001 >nul 2>&1 || true
22
22
  `:""}shopt -s expand_aliases
23
23
  [[ -f ~/.bashrc ]] && source ~/.bashrc >/dev/null 2>&1 || true
24
24
  cd -- "$1"
25
- ${S}
26
- `,"easbot",y]:/^cmd(\.exe)?$/i.test(x)?["/c",`chcp 65001 >nul 2>&1 && ${S}`]:W(x)?["-NoProfile","-Command",`[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; ${S}`]:["-c",S]}m.args=ie;function Oe(f){return f?p(f):(0, m.defaultPreferred)()}m.preferred=Oe;function Ke(f){return f?p(f,{acceptable:true}):(0, m.defaultAcceptable)()}m.acceptable=Ke;function Nt(){m.defaultPreferred.reset(),m.defaultAcceptable.reset();}m.reset=Nt;async function Dt(){return (process.platform==="win32"?i():await c()).filter(u=>a(u)).map(N)}m.list=Dt;function Ie(f){return wn[E(f)]}m.metaInfo=Ie;function O(f){return /[|&;<>()$`!#]/.test(f)}m.needsShell=O;function C(){return process.platform==="win32"?i():["/bin/bash","/bin/zsh","/bin/sh"]}m.platformShells=C;function _(f){return f?!!a(f):false}m.isValid=_;async function V(f){let u=a(f);if(!u)return;let y=E(u);if(!/^cmd(\.exe)?$/i.test(y))try{let x;W(y)?x=["-NoProfile","-Command","$PSVersionTable.PSVersion.ToString()"]:x=["--version"],e.debug(`\u83B7\u53D6 Shell \u7248\u672C: ${u}`,{shell:u,args:x});let h=await exports.PKG.run([u,...x]);if(h.code===0){let S=h.stdout.trim().split(`
27
- `)[0];return e.debug(`Shell \u7248\u672C\u83B7\u53D6\u6210\u529F: ${S}`),S}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=V;class q extends Error{constructor(y,x,h,S){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",S);this.name="InstallFailedError";}}m.InstallFailedError=q;async function ue(f,u="latest",y){let{Lock:x}=await import('./chunks/lock-LMCPTUNU.cjs'),{Filesystem:h}=await import('./chunks/filesystem-ALW6PJKX.cjs'),{PackageRegistry:S}=await import('./chunks/registry-LIPZA2EC.cjs');y=y??process.env.EASBOT_CACHE_PATH??me__default.default.join(".easbot","cache");let P=await x.write("pkg-install");try{let T=me__default.default.posix.join(y,"node_modules",f),M=me__default.default.posix.join(y,"package.json"),H=(await h.readJson(M).catch(async()=>{let K={dependencies:{}};return await h.writeJson(M,K),K})).dependencies??{},B=await h.exists(T),z=H[f],F=!1;if(!B||!z)F=!0;else {if(u!=="latest"&&z===u)return T;if(u==="latest"){if(!await S.isOutdated(f,z,y))return T;e.info("Cached version is outdated, proceeding with install",{pkg:f,cachedVersion:z}),F=!0;}}if(!F)return T;let $=m.acceptable(process.platform==="win32"?"cmd":void 0)??k(),Q=`${f}@${u}`;e.info("installing package",{pkg:f,version:u,cache:y,shell:$});let J=await exports.PKG.packageManager();if(!J)throw new q("No package manager found (npm, pnpm, bun)",f,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:f,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 ${f}@${u} with ${Z}`);}catch(K){let zt=K instanceof Error?K:new Error(String(K));if(!await h.exists(T))throw new q(`Failed to install ${f}@${u}`,f,u,zt.message);e.warn("Package install failed but module exists, continuing",{error:zt.message});}let Qe=u;u==="latest"&&(Qe=(await h.readJson(me__default.default.join(T,"package.json")).catch(()=>({})))?.version??"unknown");let Fe=await h.readJson(M);return Fe.dependencies=Fe.dependencies??{},Fe.dependencies[f]=Qe,await h.writeJson(M,Fe),e.info("Package installation completed",{pkg:f,version:Qe,path:T}),T}finally{P[Symbol.dispose]();}}m.install=ue;async function G(f,u,y){let x=f?m.acceptable(f)??k():m.acceptable()??k(),h=y?.cwd??process.cwd(),S=m.args(x,u,h);e.debug(`run shell process: ${x} ${S.join(" ")}`,{command:u,cwd:h});let{windowsHide:P,env:T,...M}=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:H,stdout:B,stderr:z,timeout:F,signal:$,...Q}=M??{},J={...Q,cwd:h,env:I,windowsHide:process.platform==="win32"?P??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,...S],J)}m.run=G;function A(f,u,y){let x=f?m.acceptable(f)??k():m.acceptable()??k(),h=y?.cwd??process.cwd(),S=m.args(x,u,h);e.debug(`Spawn shell process: ${x} ${S.join(" ")}`,{command:u,cwd:h});let{stdin:P,stdout:T,stderr:M,timeout:I,signal:H,windowsHide:B,env:z,...F}=y??{},$={...process.env,LANG:"en_US.UTF-8",LC_ALL:"en_US.UTF-8",LC_CTYPE:"en_US.UTF-8",...z};process.platform==="win32"&&($.CHCP="65001");let Q=E(x),J=/^cmd(\.exe)?$/i.test(Q),Z={...F,cwd:h,env:$,windowsHide:process.platform==="win32"?B??true:void 0,shell:F.shell,timeout:I};return exports.PKG.spawn([J?"cmd":x,...S],Z)}m.spawn=A;function w(f,...u){let y=f.reduce((h,S,P)=>h+S+(u[P]??""),""),x=(h={})=>({quiet:()=>x({...h,quiet:true}),nothrow:()=>x({...h,nothrow:true}),cwd:S=>x({...h,cwd:S}),env:S=>x({...h,env:S}),stdin:S=>x({...h,stdin:S}),stdout:S=>x({...h,stdout:S}),stderr:S=>x({...h,stderr:S}),text:async()=>{let S=re(y.trim());if(S.length===0)throw new Error("Empty command");let P=S[0]??"",T=E(P),M=/^cmd(\.exe)?$/i.test(T),I=process.platform==="win32"&&M?"cmd":Ie(P)?P:void 0,H=fe(P,S.slice(1)),B=await m.run(I,H,{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(B.code!==0&&!h.nothrow)throw new Error(`Command failed with exit code ${B.code}: ${y}
28
- ${B.stderr}`);return B.stdout},lines:async()=>(await x(h).text()).split(`
29
- `).filter(P=>P.trim()),then:(S,P)=>{let T=re(y.trim()),M=T[0]??"",I=E(M),H=/^cmd(\.exe)?$/i.test(I),B=process.platform==="win32"&&H?"cmd":Ie(M)?M:void 0,z=fe(M,T.slice(1));return m.run(B,z,{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 $=new Error(`Command failed with exit code ${F.code}: ${y}
30
- ${F.stderr}`);if(P){P($);return}throw $}return S({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())})},P)}});return x()}m.$=w;})(exports.Shell||(exports.Shell={}));var Cr=exports.Shell.$;chunkVRQQ33YH_cjs.j();var Te=class Te extends Error{static create(t,n){var s;let r=_e__default.default.object({name:_e__default.default.literal(t),data:n}).meta({ref:t}),o=(s=class extends Te{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(Te,"Unknown",Te.create("UnknownError",_e__default.default.object({message:_e__default.default.string()})));var pt=Te;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 d=t.slice(r,l+1);(d.startsWith("[!")||d.startsWith("[^"))&&(d="[^"+d.slice(2)),this.ignorecase&&(d=d.toLowerCase()),n.push(d),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 Sn(e,t){let n=r=>{let o;try{o=e.parse(r);}catch(s){throw console.trace("schema validation failure stack trace:"),s instanceof _e.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 Ir=Sn;exports.Fn=void 0;(t=>t.fn=Sn)(exports.Fn||(exports.Fn={}));chunkVRQQ33YH_cjs.j();function Br(){let n=me__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 Lr(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),d=Buffer.from(p);return {exitCode:i,text:()=>l.toString(),stdout:l,stderr:d}}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 Tn(e){return e?me.dirname(url.fileURLToPath(e)):typeof __dirname<"u"?__dirname:process.cwd()}function kn(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=me.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 vn(e,t){let n=me.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=me.join(o,"assets","txt");if(Le.existsSync(a)){let p=kn(a,r,5);if(p)return p}let i=me.join(o,"dist","assets","txt");if(Le.existsSync(i)){let p=kn(i,r,5);if(p)return p}let c=me.join(o,"..");if(c===o)break;o=c;}return n}function zr(e,t){return exports.Lazy.lazy(()=>{try{let n=Tn(t),r=vn(n,e);return exports.PKG.file(r).textSync()}catch(n){throw console.error(`Failed to load text file: ${e}`,n),n}})}function Hr(e,t){return exports.Lazy.lazy(async()=>{try{let n=Tn(t),r=vn(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 Wr(e){return e()}chunkVRQQ33YH_cjs.j();function Ur(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 qr(e,t){if(!e)return [];if(t<=0)return [e];if(e.length<=t)return [e]}function ge(e,t,n){try{let r=_e.z.string().parse(e),o=_e.z.number().int().parse(t),s=qr(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=Pn(a,n.minLength)),a}catch(r){return console.warn("Invalid input for chunkText:",r),typeof e=="string"&&e.length>0?[e]:[]}}function Pn(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+`
25
+ ${w}
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]),d=Math.min(o.length,i+(l?1:0));o=o.slice(d).trimStart();}return o.length>0&&r.push(o),r}chunkVRQQ33YH_cjs.j();var xt=_e.z.enum(["bold","italic","strikethrough","code","code_block","spoiler","blockquote"]),Mn=_e.z.object({start:_e.z.number().int().min(0),end:_e.z.number().int().min(0),style:xt}).strict().refine(e=>e.end>=e.start,{message:"end must be greater than or equal to start"}),En=_e.z.object({start:_e.z.number().int().min(0),end:_e.z.number().int().min(0),href:_e.z.string().min(1)}).strict().refine(e=>e.end>=e.start,{message:"end must be greater than or equal to start"}),Re=_e.z.object({text:_e.z.string(),styles:_e.z.array(Mn),links:_e.z.array(En)}).strict(),Pe=_e.z.enum(["off","bullets","code"]),Ne=_e.z.object({linkify:_e.z.boolean().default(true),enableSpoilers:_e.z.boolean().default(false),headingStyle:_e.z.enum(["none","bold"]).default("none"),blockquotePrefix:_e.z.string().default(""),autolink:_e.z.boolean().default(true),tableMode:Pe.default("off")}).partial().default({}),Cn=_e.z.object({open:_e.z.string(),close:_e.z.string()}).strict(),wt=_e.z.object({styleMarkers:_e.z.record(xt,Cn).optional(),escapeText:_e.z.any().optional(),buildLink:_e.z.any().optional()}).strict();_e.z.object({start:_e.z.number().int().min(0),end:_e.z.number().int().min(0),open:_e.z.string(),close:_e.z.string()}).strict();var St=_e.z.object({indentSize:_e.z.number().int().min(1).default(2),listMarker:_e.z.enum(["\u2022","-","*"]).default("\u2022"),codeBlockMarker:_e.z.enum(["```","~~~"]).default("```"),preserveFrontmatter:_e.z.boolean().default(true)}).strict(),kt=_e.z.record(_e.z.string(),_e.z.string()),De=_e.z.object({open:_e.z.boolean(),ticks:_e.z.number().int().min(0)}).strict();_e.z.object({inlineState:De,isInside:_e.z.any()}).strict();_e.z.object({start:_e.z.number().int().min(0),end:_e.z.number().int().min(0),openLine:_e.z.string(),marker:_e.z.string(),indent:_e.z.string()}).strict();_e.z.object({tables:Pe.optional()}).strict();function Zr(e){let t=new Kr__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 Xr(e){for(let t of e)t.children&&t.children.length>0&&(t.children=Qr(t.children));}function Qr(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 eo(){return {text:"",styles:[],openStyles:[],links:[],linkStack:[]}}function le(e){return e.table?.currentCell??e}function ze(e,t){if(!t)return;let n=le(e);n.text+=t;}function he(e,t){let n=le(e);n.openStyles.push({style:t,start:n.text.length});}function be(e,t){let n=le(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 In(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 to(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 no(e,t){if(!t)return;let n=le(e),r=n.text.length;n.text+=t,n.styles.push({start:r,end:r+t.length,style:"code"});}function ro(e,t){let n=t??"",r=le(e),o=r.text.length;r.text+=n,r.styles.push({start:o,end:o+n.length,style:"code_block"});}function oo(e){let t=le(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 so(){return {headers:[],rows:[],currentRow:[],currentCell:null,inHeader:false}}function io(e){return An(e),{text:e.text,styles:e.styles,links:e.links}}function He(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 ao(e,t){t.text&&(e.text+=t.text);}function Fn(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 co(e){if(!e.table)return;let t=e.table.headers.map(He),n=e.table.rows.map(o=>o.map(He));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++)Fn(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++)Fn(e,{header:t[s],value:o[s],columnIndex:s,includeColumnFallback:false});e.text+=`
43
- `;}}function lo(e){if(!e.table)return;let t=e.table.headers.map(He),n=e.table.rows.map(l=>l.map(He)),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 d=0;d<r;d+=1){let k=l[d]?.text.length??0;(o[d]??0)<k&&(o[d]=k);}};s(t);for(let l of n)s(l);let a=e.text.length,i=l=>{e.text+="|";for(let d=0;d<r;d+=1){e.text+=" ";let g=l[d];g&&ao(e,g);let k=g?.text.length??0,D=(o[d]??0)-k;D>0&&(e.text+=" ".repeat(D)),e.text+=" |";}e.text+=`
44
- `;},c=()=>{e.text+="|";for(let l=0;l<r;l+=1){let d=o[l]??0,g=Math.max(3,d);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 Rt(e,t){for(let n of e)switch(n.type){case "inline":n.children&&Rt(n.children,t);break;case "text":ze(t,n.content??"");break;case "em_open":he(t,"italic");break;case "em_close":be(t,"italic");break;case "strong_open":he(t,"bold");break;case "strong_close":be(t,"bold");break;case "s_open":he(t,"strikethrough");break;case "s_close":be(t,"strikethrough");break;case "code_inline":no(t,n.content??"");break;case "spoiler_open":t.enableSpoilers&&he(t,"spoiler");break;case "spoiler_close":t.enableSpoilers&&be(t,"spoiler");break;case "link_open":{let r=On(n,"href")??"",o=le(t);o.linkStack.push({href:r,labelStart:o.text.length});break}case "link_close":oo(t);break;case "image":ze(t,n.content??"");break;case "softbreak":case "hardbreak":ze(t,`
46
- `);break;case "paragraph_close":In(t);break;case "heading_open":t.headingStyle==="bold"&&he(t,"bold");break;case "heading_close":t.headingStyle==="bold"&&be(t,"bold"),In(t);break;case "blockquote_open":t.blockquotePrefix&&(t.text+=t.blockquotePrefix),he(t,"blockquote");break;case "blockquote_close":be(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+=`
50
- `);break;case "list_item_open":to(t);break;case "list_item_close":t.text.endsWith(`
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
+ `);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":ro(t,n.content??"");break;case "html_block":case "html_inline":ze(t,n.content??"");break;case "table_open":t.tableMode!=="off"&&(t.table=so(),t.hasTables=true);break;case "table_close":t.table&&(t.tableMode==="bullets"?co(t):t.tableMode==="code"&&lo(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=eo());break;case "th_close":case "td_close":t.table?.currentCell&&(t.table.currentRow.push(io(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 uo(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 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,href:r.href});}return n}function $n(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 po(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 $n(r)}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,href:o.href});}return r}function ye(e,t){try{let n=typeof e=="string"?e:"",r=Ne.parse(t??{});return Me(n,r).ir}catch(n){return console.error("Markdown parse error:",n),{text:"",styles:[],links:[]}}}function Me(e,t){try{let n=typeof e=="string"?e:"",r=Ne.parse(t),o={listStack:[]},a=Zr(r).parse(n||"",o);r.enableSpoilers&&Xr(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,d=0;for(let E of c.styles)E.style==="code_block"&&E.end>d&&(d=E.end);let g=Math.max(l,d);return {ir:{text:g===c.text.length?c.text:c.text.slice(0,g),styles:$n(uo(c.styles,g)),links:fo(c.links,g)},hasTables:c.hasTables}}catch(n){return console.error("Markdown parse error:",n),{ir:{text:"",styles:[],links:[]},hasTables:false}}}function Ln(e,t){try{let n=Re.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=ge(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:po(n.styles,p,l),links:mo(n.links,p,l)}),a=l;}),s}catch(n){return console.error("Chunk IR error:",n),[]}}chunkVRQQ33YH_cjs.j();var go={bold:{open:"**",close:"**"},italic:{open:"*",close:"*"},strikethrough:{open:"~~",close:"~~"},code:{open:"`",close:"`"},code_block:{open:"```\n",close:"```"},spoiler:{open:"||",close:"||"},blockquote:{open:"> ",close:""}};function Ee(e,t){try{let n=Re.parse(e),r=wt.parse(t??{});if(!n.text)return "";let o=r.styleMarkers??go,s=r.escapeText??(d=>d),a=r.buildLink,i=[];for(let d=0;d<n.styles.length;d++){let g=n.styles[d];g&&(i.push({position:g.start,type:"open",style:g.style,spanIndex:d}),i.push({position:g.end,type:"close",style:g.style,spanIndex:d}));}for(let d=0;d<n.links.length;d++){let g=n.links[d];g&&(i.push({position:g.start,type:"link_open",spanIndex:d,href:g.href}),i.push({position:g.end,type:"link_close",spanIndex:d,href:g.href}));}i.sort((d,g)=>{if(d.position!==g.position)return d.position-g.position;let k=(N,ie)=>N==="link_open"?0:N==="open"?1:N==="close"?2:N==="link_close"?3:4,E=d.type==="close"||d.type==="link_close",D=g.type==="close"||g.type==="link_close",U=k(d.type,E),W=k(g.type,D);return U!==W?U-W:d.type==="open"&&g.type==="open"?d.spanIndex-g.spanIndex:d.type==="close"&&g.type==="close"?g.spanIndex-d.spanIndex:d.spanIndex-g.spanIndex});let c="",p=0,l=[];for(let d of i){if(d.position>p){let g=n.text.slice(p,d.position);c+=s?s(g):g;}if(d.type==="open"||d.type==="close"){let g=o[d.style];if(g)if(d.type==="open")c+=g.open,l.push(d);else {c+=g.close,d.style==="code_block"&&d.position<n.text.length&&(c+=`
55
- `);let k=l.findIndex(E=>E.spanIndex===d.spanIndex&&E.type==="open");k!==-1&&l.splice(k,1);}}else if(d.type==="link_open")c+="[",l.push(d);else if(d.type==="link_close"){c+="]("+d.href+")";let g=l.findIndex(k=>k.spanIndex===d.spanIndex&&k.type==="link_open");g!==-1&&l.splice(g,1);}p=d.position;}if(p<n.text.length){let d=n.text.slice(p);c+=s?s(d):d;}return c}catch(n){return console.error("Markdown render error:",n),""}}function xe(e,t){return Ee(e,t)}chunkVRQQ33YH_cjs.j();function ho(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 We(e,t){try{let n=typeof e=="string"?e:"",r=St.parse(t??{});if(!n)return "";let{frontmatter:o,content:s}=ho(n),a=ye(s,{linkify:!0,enableSpoilers:!1,autolink:!0,headingStyle:"none",blockquotePrefix:"",tableMode:"off"}),i=xe(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
- `+i),i}catch(n){return console.error("Markdown format error:",n),e}}chunkVRQQ33YH_cjs.j();function bo(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function yo(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 xo(e){try{let t=_n__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=yo(o);a&&(n[s]=a);}return n}catch{return null}}function wo(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
- `).trim(),linesConsumed:r-t}}function So(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:d}=wo(n,r);l&&(t[a]={value:l,kind:"multiline",rawInline:i}),r+=d;continue}}let c=bo(i);c&&(t[a]={value:c,kind:"inline",rawInline:i}),r+=1;}return t}function ko(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r.value;return t}function To(e){return /^[|>][+-]?(\d+)?[+-]?$/.test(e)}function vo(e){let{lineEntry:t,yamlValue:n}=e;return n.kind!=="structured"||t.kind!=="inline"||To(t.rawInline)?false:t.value.includes(":")}function Ro(e){let t=e.replace(/\r\n/g,`
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
+ `).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: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 Ce(e){try{if(typeof e!="string")return {};let t=Ro(e);if(!t)return {};let n=So(t),r=xo(t);if(r===null)return ko(n);let o={};for(let[s,a]of Object.entries(r)){o[s]=a.value;let i=n[s];i&&vo({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 Ue(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 `---
68
- ${_n__default.default.stringify(n,{lineWidth:0,defaultStringType:"QUOTE_DOUBLE"}).trim()}
69
- ---`}catch(t){return console.warn("Failed to serialize frontmatter:",t),""}}function qe(e){try{if(typeof e!="string")return {frontmatter:{},content:""};let t=e.replace(/\r\n/g,`
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
+ ${jn__default.default.stringify(n,{lineWidth:0,defaultStringType:"QUOTE_DOUBLE"}).trim()}
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:Ce(e),content:o}}catch(t){return console.warn("Failed to extract frontmatter:",t),{frontmatter:{},content:e}}}chunkVRQQ33YH_cjs.j();chunkVRQQ33YH_cjs.j();function Ye(e){try{let t=_e.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 d=l[0];if(!d){o=a+1;continue}let g=l.length;if(!r)r={start:o,markerChar:d,markerLen:g,openLine:i,marker:l,indent:p};else if(r.markerChar===d&&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 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 jn(e,t){return !Pt(e,t)}function Ve(){return {open:false,ticks:0}}function Ge(e,t){try{let n=_e.z.string().parse(e),r=t?De.parse(t):Ve(),o=Ye(n),s={open:r.open,ticks:r.ticks},{spans:a,state:i}=Eo(n,o,s);return {inlineState:i,isInside:c=>Oo(c,o)||Io(c,a)}}catch(n){return console.warn("Invalid input for buildCodeSpanIndex:",n),{inlineState:Ve(),isInside:()=>false}}}function Eo(e,t,n){let r=[],o=n.open,s=n.ticks,a=o?0:-1,i=0;for(;i<e.length;){let c=Co(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 Co(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 Io(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 Je(e,t){try{let n=_e.z.string().parse(e),r=Pe.parse(t);if(!n||r==="off")return n;let{ir:o,hasTables:s}=Me(n,{linkify:!1,enableSpoilers:!1,autolink:!1,headingStyle:"none",blockquotePrefix:"",tableMode:r});return s?Ee(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,d){try{return ye(l,d)}catch(g){return console.warn("Markdown.parse error:",g),{text:"",styles:[],links:[]}}}p.parse=e;function t(l,d){try{return xe(l,d)}catch(g){return console.warn("Markdown.render error:",g),""}}p.render=t;function n(l,d){try{return We(l,d)}catch(g){return console.warn("Markdown.format error:",g),typeof l=="string"?l:""}}p.format=n;function r(l){try{return Ce(l)}catch(d){return console.warn("Markdown.parseFrontmatter error:",d),{}}}p.parseFrontmatter=r;function o(l){try{return Ue(l)}catch(d){return console.warn("Markdown.serializeFrontmatter error:",d),""}}p.serializeFrontmatter=o;function s(l){try{return qe(l)}catch(d){return console.warn("Markdown.extractFrontmatter error:",d),{frontmatter:{},content:typeof l=="string"?l:""}}}p.extractFrontmatter=s;function a(l,d,g){try{return ge(l,d,g)}catch(k){return console.warn("Markdown.chunk error:",k),typeof l=="string"&&l.length>0?[l]:[]}}p.chunk=a;function i(l,d){try{return Ge(l,d)}catch(g){return console.warn("Markdown.buildCodeIndex error:",g),{inlineState:{open:false,ticks:0},isInside:()=>false}}}p.buildCodeIndex=i;function c(l,d){try{return Je(l,d)}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 $o(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 Lo(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 _o(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 jo=["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 jo.some(n=>t.includes(n))}async function Do(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(d=>setTimeout(d,l));}throw i}chunkVRQQ33YH_cjs.j();exports.Fetch=void 0;(Ie=>{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})}Ie.hasProxyConfigured=o;function s(){let O=process.env.http_proxy||process.env.HTTP_PROXY;return process.env.https_proxy||process.env.HTTPS_PROXY||O}Ie.getProxyUrl=s;function a(O={}){let C=O.httpProxy||O.httpsProxy||s();if(!C){e.warn("[Fetch] \u672A\u914D\u7F6E\u4EE3\u7406\uFF0C\u73AF\u5883\u53D8\u91CF HTTP_PROXY/HTTPS_PROXY \u672A\u8BBE\u7F6E");return}let _=new undici.ProxyAgent({uri:C,connectTimeout:O.connectTimeout||1e4,keepAliveTimeout:O.keepAliveTimeout||3e4});r=undici.getGlobalDispatcher(),undici.setGlobalDispatcher(_),n=true,console.log(`[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u542F\u7528: ${C}`);}Ie.enableProxy=a;function i(){!n||!r||(undici.setGlobalDispatcher(r),n=false,r=null,console.log("[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u7981\u7528"));}Ie.disableProxy=i;function c(){return n}Ie.isProxyEnabled=c;async function p(O,C){let _=C?.timeout||3e4,V=C?.responseType||"json",{timeout:q,responseType:ue,...G}=C||{},A=null,w=null;try{G.signal||(A=new AbortController,w=setTimeout(()=>A.abort(),_));let m=await fetch(O,{...G,signal:G.signal||A.signal});w&&clearTimeout(w);let f;switch(V){case "arrayBuffer":f=await m.arrayBuffer();break;case "blob":f=await m.blob();break;case "buffer":{let u=await m.arrayBuffer();f=Buffer.from(u);break}case "text":f=await m.text();break;default:{let u=await m.text();try{f=JSON.parse(u);}catch{f=u;}break}}return {ok:m.ok,status:m.status,statusText:m.statusText,headers:m.headers,data:f,url:m.url}}catch(m){throw w&&clearTimeout(w),m}}async function l(O,C){let _=C?.retries||0,V=C?.retryDelay||1e3,{retries:q,retryDelay:ue,responseType:G,...A}=C||{},w;for(let m=0;m<=_;m++)try{return await p(O,{...A,responseType:C?.responseType})}catch(f){if(w=f,m<_){let u=V*2**m;await new Promise(y=>setTimeout(y,u));}}throw w}async function d(O,C){return l(O,{method:"GET",...C})}Ie.get=d;async function g(O,C,_){return l(O,{method:"POST",headers:{"Content-Type":"application/json",..._?.headers},body:C?JSON.stringify(C):void 0,..._})}Ie.post=g;async function k(O,C,_){return l(O,{method:"PUT",headers:{"Content-Type":"application/json",..._?.headers},body:C?JSON.stringify(C):void 0,..._})}Ie.put=k;async function E(O,C,_){return l(O,{method:"DELETE",headers:{"Content-Type":"application/json",..._?.headers},body:C?JSON.stringify(C):void 0,..._})}Ie.del=E;async function D(O,C,_){return l(O,{method:"PATCH",headers:{"Content-Type":"application/json",..._?.headers},body:C?JSON.stringify(C):void 0,..._})}Ie.patch=D;async function U(O,C){return l(O,C)}Ie.request=U;function W(O={}){return o()?(a(O),true):false}Ie.autoProxy=W;function N(O){return new TextEncoder().encode(O)}function ie(O){return chunkJL3GR4P7_cjs.c.mimeType(O)}function Oe(O){return O.startsWith("file://")}async function Ke(O){let C=url.fileURLToPath(O);return await exports.PKG.file(C).bytes()}async function Nt(O,C,_){let V=`----FetchFormBoundary${Date.now()}`,q=[];for(let u of C){let y=u.filename,x=`Content-Disposition: form-data; name="${u.name}"${y?`; filename="${y}"`:""}`;y&&(x+=`\r
74
- Content-Type: ${ie(y)}`),x+=`\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
- `,q.push(N(x));let h=u.value;if(typeof h=="string")if(Oe(h)){let S=await Ke(h);y||(y=h.split("/").pop()||"file"),q.push(S);}else q.push(N(h));else Buffer.isBuffer(h)?q.push(new Uint8Array(h.buffer,h.byteOffset,h.byteLength)):h instanceof Uint8Array&&q.push(h);}let ue=N(`\r
77
- --${V}--`),G=N(`\r
78
- --${V}\r
79
- `),A=[];A.push(N(`--${V}\r
80
- `));for(let u=0;u<q.length;u++)A.push(q[u]),u%2===1&&u<q.length-1&&(A.push(G),A.push(N(`--${V}\r
81
- `)));A.push(ue);let w=A.reduce((u,y)=>u+y.length,0),m=new Uint8Array(w),f=0;for(let u of A)m.set(u,f),f+=u.length;return l(O,{method:"POST",headers:{"Content-Type":`multipart/form-data; boundary=${V}`,..._?.headers},body:m,..._})}Ie.postForm=Nt;function Dt(O,C,_){let V=new AbortController,q=V.signal;return (async()=>{try{let G={Accept:"text/event-stream",..._?.headers||{}},A=await fetch(O,{..._,headers:G,signal:q});if(!A.ok)throw new Error(`SSE connection failed: ${A.status}`);let w=A.body?.getReader();if(!w)throw new Error("SSE stream not available");let m=new TextDecoder("utf-8"),f="";for(;!q.aborted;){let{done:u,value:y}=await w.read();if(u)break;let x=m.decode(y,{stream:!0});f+=x;let h=f.split(`
82
- `);f=h.pop()??"";for(let S of h)if(S.startsWith("data: ")){let P=S.slice(6);if(P==="[DONE]"){C.onComplete?.();return}C.onMessage?.(P);}}C.onComplete?.();}catch(G){G.name!=="AbortError"&&C.onError?.(G);}})(),()=>{V.abort();}}Ie.sse=Dt;})(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 zn(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=zn(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=me__default.default.resolve(n),s=me__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 d of p)if(!l.includes(d)||!e(i[d],c[d]))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("+"),d={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let g of l)switch(g){case "ctrl":d.ctrl=true;break;case "alt":case "meta":case "option":d.meta=true;break;case "super":d.super=true;break;case "shift":d.shift=true;break;case "leader":d.leader=true;break;case "esc":d.name="escape";break;default:d.name=g;break}return d})}a.parse=s;})(exports.Keybind||(exports.Keybind={}));chunkVRQQ33YH_cjs.j();exports.Locale=void 0;(p=>{function e(l){return l.replace(/\b\w/g,d=>d.toUpperCase())}p.titlecase=e;function t(l){return new Date(l).toLocaleTimeString(void 0,{timeStyle:"short"})}p.time=t;function n(l){let d=new Date(l),g=t(l),k=d.toLocaleDateString();return `${g} \xB7 ${k}`}p.datetime=n;function r(l){let d=new Date(l),g=new Date;return d.getFullYear()===g.getFullYear()&&d.getMonth()===g.getMonth()&&d.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 d=Math.floor(l/36e5);return `${Math.floor(l%36e5/864e5)}d ${d}h`}p.duration=s;function a(l,d){return l.length<=d?l:l.slice(0,d-1)+"\u2026"}p.truncate=a;function i(l,d=35){if(l.length<=d)return l;let g="\u2026",k=Math.ceil((d-g.length)/2),E=Math.floor((d-g.length)/2);return l.slice(0,k)+g+l.slice(-E)}p.truncateMiddle=i;function c(l,d,g){return (l===1?d: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 Lt=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,d=Math.round(p/1.5),g=Math.round(l/4);return Math.max(0,d+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,d=i.cache?.write??0;return c+p+l+d}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 _e__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[d,g]of p)e(a,d)&&(l=g);return l}s.all=n;function r(a,i){let c=Object.entries(i),p=t(c),l;for(let[d,g]of p){let k=d.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 gl(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.$=Cr;exports.AsyncQueue=Lt;exports.NamedError=pt;exports.PkgShell=Se;exports.abortAfter=zn;exports.abortAfterAny=Uo;exports.buildCodeSpanIndex=Ge;exports.chunkMarkdownIR=Ln;exports.chunkText=ge;exports.chunkTextByBreakResolver=yt;exports.convertMarkdownTables=Je;exports.createInlineCodeState=Ve;exports.createPkgShell=ce;exports.createRESTServer=at;exports.createRPCServer=it;exports.createServer=se;exports.createStreamingServer=lt;exports.createWebSocketServer=ct;exports.defer=Yo;exports.detectPlatform=pn;exports.escapeCommandArg=ft;exports.escapeCommandArgSafe=fn;exports.extractFrontmatter=qe;exports.findFenceSpanAt=Pt;exports.findLast=Gn;exports.fn=Ir;exports.formatDuration=Vo;exports.formatLocalISO=rt;exports.formatLocalISOCompact=ot;exports.formatLogTime=Qn;exports.formatMarkdown=We;exports.getDirectory=$o;exports.getFileExtension=Bo;exports.getFilename=Nn;exports.getFilenameTruncated=Lo;exports.getProxyConfig=Zo;exports.getProxyUrl=Ko;exports.getTimezoneOffset=er;exports.git=Lr;exports.iife=Wr;exports.initLog=gl;exports.isSafeFenceBreak=jn;exports.joinCommandArgs=fe;exports.lazy=Ae;exports.lazyAsync=tr;exports.loadEnv=Br;exports.loadTextFile=zr;exports.loadTextFileAsync=Hr;exports.markdownToIR=ye;exports.markdownToIRWithMeta=Me;exports.needsShellExecution=un;exports.now=qt;exports.nowLocalISO=Zn;exports.parseCommand=re;exports.parseCommandWithOptions=dn;exports.parseFenceSpans=Ye;exports.parseFrontmatterBlock=Ce;exports.parseLocalISO=Xn;exports.parseModelId=Ur;exports.proxied=Jo;exports.readableStreamToText=Pr;exports.renderMarkdown=xe;exports.renderMarkdownWithMarkers=Ee;exports.retry=Do;exports.scanParenAwareBreakpoints=bt;exports.serializeFrontmatter=Ue;exports.shell=gn;exports.signal=Qo;exports.startServer=sr;exports.truncateMiddle=_o;exports.updateSchema=ns;exports.whichSync=Mr;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;