blecsd 0.1.1 → 0.3.0
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/LICENSE +4 -2
- package/README.md +209 -66
- package/dist/3d/index.d.ts +2 -2
- package/dist/3d/index.js +1 -1
- package/dist/audio/index.d.ts +2 -2
- package/dist/{border-D_Jb4ZJV.d.ts → border-Jb7TrMob.d.ts} +20 -10
- package/dist/chunk-2IEMMRUO.js +1 -0
- package/dist/chunk-3AV52GY5.js +1 -0
- package/dist/chunk-3LHLSY3Y.js +1 -0
- package/dist/chunk-3O4TQHGK.js +4 -0
- package/dist/chunk-3UJWZ5ZN.js +1 -0
- package/dist/chunk-5N3O25O7.js +1 -0
- package/dist/chunk-6M2J5QUA.js +1 -0
- package/dist/chunk-7IQEUVGF.js +1 -0
- package/dist/chunk-A6M6TFBL.js +1 -0
- package/dist/chunk-CUEUJAHK.js +3 -0
- package/dist/chunk-D42Q2KKR.js +1 -0
- package/dist/chunk-DYEXOFUU.js +2 -0
- package/dist/chunk-DYU72XLL.js +1 -0
- package/dist/chunk-E4CJRSND.js +1 -0
- package/dist/chunk-EAY7B5GL.js +1 -0
- package/dist/chunk-FCMTWFSE.js +1 -0
- package/dist/chunk-FL56THSI.js +25 -0
- package/dist/{chunk-2UBBZFE4.js → chunk-G437VE43.js} +1 -1
- package/dist/chunk-GGXNWT36.js +8 -0
- package/dist/chunk-HLFORKXS.js +1 -0
- package/dist/chunk-J7MBKEBY.js +1 -0
- package/dist/{chunk-TYMY2TBR.js → chunk-JHCKPCUH.js} +3 -3
- package/dist/chunk-K3SX2LY5.js +1 -0
- package/dist/chunk-LDAFEXN5.js +1 -0
- package/dist/chunk-MKMFUXLB.js +33 -0
- package/dist/chunk-MQWPHPUM.js +1 -0
- package/dist/chunk-MTI376CU.js +5 -0
- package/dist/chunk-MTV2RJZD.js +1 -0
- package/dist/chunk-NPDPBAW6.js +4 -0
- package/dist/chunk-OB66FB4F.js +1 -0
- package/dist/chunk-OR3BZY7C.js +1 -0
- package/dist/{chunk-VNZ6CWJA.js → chunk-R7AICVRN.js} +2 -2
- package/dist/{chunk-3B7MIVW6.js → chunk-RZ7FGVI6.js} +1 -1
- package/dist/chunk-UMGTXSQB.js +11 -0
- package/dist/chunk-X3Q3T2SS.js +4 -0
- package/dist/{chunk-JKVHO4LH.js → chunk-XZJRWFOS.js} +1 -1
- package/dist/chunk-ZAHG7Y3X.js +1 -0
- package/dist/cli/init.d.ts +1 -1
- package/dist/componentStorage-CJTh-TPO.d.ts +246 -0
- package/dist/components/index.d.ts +1942 -514
- package/dist/components/index.js +1 -1
- package/dist/core/index.d.ts +857 -259
- package/dist/core/index.js +1 -1
- package/dist/debug/index.d.ts +491 -98
- package/dist/debug/index.js +1 -1
- package/dist/dirtyTracking-C4v8MmM9.d.ts +235 -0
- package/dist/errors/index.d.ts +12 -12
- package/dist/errors/index.js +1 -1
- package/dist/{events-BbbxkgvX.d.ts → events-9ForpTfM.d.ts} +75 -2
- package/dist/game/index.d.ts +7 -7
- package/dist/game/index.js +1 -1
- package/dist/{gameLoop-BIPW7-OY.d.ts → gameLoop-C-Ez_i54.d.ts} +2 -2
- package/dist/{index-zSGJ2eUk.d.ts → index-DBS5Uefn.d.ts} +2 -2
- package/dist/index.d.ts +283 -20
- package/dist/index.js +3 -1
- package/dist/input/index.d.ts +1 -1
- package/dist/input/index.js +1 -1
- package/dist/{inputActions-CefRUBuT.d.ts → inputActions-CRsUtTHM.d.ts} +10 -721
- package/dist/packedStore-BgvnEdE7.d.ts +191 -0
- package/dist/{renderable-jTMOA-GK.d.ts → renderable-CwqGwrEV.d.ts} +9 -9
- package/dist/{scheduler-DcfoFuum.d.ts → scheduler-CMcYew9Z.d.ts} +65 -3
- package/dist/systems/index.d.ts +356 -55
- package/dist/systems/index.js +1 -1
- package/dist/terminal/index.d.ts +2233 -2299
- package/dist/terminal/index.js +1 -1
- package/dist/{tilemap-D1HJvKy3.d.ts → tilemap-BirMJdbu.d.ts} +92 -3
- package/dist/{types-BcsvoKzf.d.ts → types-CPB4CpbH.d.ts} +2 -2
- package/dist/utils/index.d.ts +27 -180
- package/dist/utils/index.js +1 -1
- package/dist/{virtualScrollback-DvZTRU8a.d.ts → virtualScrollback-D9uLFe8l.d.ts} +4 -4
- package/dist/{virtualViewport-Dx2iJliO.d.ts → virtualViewport-Bpv6jlKt.d.ts} +283 -761
- package/dist/widgets/bigText.d.ts +1 -1
- package/dist/widgets/bigText.js +1 -1
- package/dist/widgets/index.d.ts +10519 -5463
- package/dist/widgets/index.js +1 -1
- package/package.json +102 -6
- package/dist/chunk-35I22JJO.js +0 -1
- package/dist/chunk-3EGGGI5J.js +0 -3
- package/dist/chunk-4X4N4HNQ.js +0 -2
- package/dist/chunk-AQ7LW75B.js +0 -1
- package/dist/chunk-AXZQAH4X.js +0 -1
- package/dist/chunk-BCADUCOZ.js +0 -1
- package/dist/chunk-EJ5WVDDZ.js +0 -6
- package/dist/chunk-FT7BMYSN.js +0 -1
- package/dist/chunk-FYEBZAWN.js +0 -1
- package/dist/chunk-GYHI26UE.js +0 -1
- package/dist/chunk-H2YAOJDW.js +0 -1
- package/dist/chunk-K2B2OXQ5.js +0 -5
- package/dist/chunk-K37L3G4Z.js +0 -4
- package/dist/chunk-KD55INV7.js +0 -1
- package/dist/chunk-KFAK4A3G.js +0 -1
- package/dist/chunk-LCN2ZITE.js +0 -1
- package/dist/chunk-OUXUPF3V.js +0 -33
- package/dist/chunk-P6CJO3BC.js +0 -1
- package/dist/chunk-PI5UOHOH.js +0 -1
- package/dist/chunk-PSXXMBVJ.js +0 -1
- package/dist/chunk-TRK4422V.js +0 -12
- package/dist/chunk-W5OU7Z6J.js +0 -1
- package/dist/chunk-WNG4A3K7.js +0 -4
- package/dist/chunk-XRJNAHNG.js +0 -19
- package/dist/chunk-XZA63ZPO.js +0 -1
- package/dist/chunk-YAMOSPWB.js +0 -4
- package/dist/chunk-YD6ULIUR.js +0 -1
- package/dist/{keyParser-Bwm8-l7v.d.ts → keyParser-BnHbg2iD.d.ts} +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import {i}from'./chunk-CIK4AMUA.js';import {ha,A,Q as Q$1,I}from'./chunk-XZJRWFOS.js';import {c as c$2,a as a$1,b as b$2}from'./chunk-OMMJ7B5P.js';import {a,k as k$1}from'./chunk-3LHLSY3Y.js';import {c as c$1,i as i$3,j}from'./chunk-OR3BZY7C.js';import {u,k,o}from'./chunk-DYU72XLL.js';import {d,e}from'./chunk-FCMTWFSE.js';import {E as E$1,v,c,X as X$1,F,w,d as d$2,m,n as n$1,_}from'./chunk-ZAHG7Y3X.js';import {f,b as b$1,e as e$2}from'./chunk-SHUC6JWA.js';import {b,i as i$2,f as f$1,d as d$3}from'./chunk-G7GIWWLE.js';import {n,g,k as k$2,i as i$1,d as d$1,e as e$1,f as f$2}from'./chunk-PXXGH3BV.js';import {z as z$1}from'zod';u();n();var z=false,N=new Map,H=null,ie=0,Oe=100;function se(n){z=n,n||N.clear();}function ae(){return z}function We(n,e){if(!z)return;let t=N.get(n);t?(t.totalTime+=e,t.callCount++):N.set(n,{name:n,totalTime:e,callCount:1});}function Ie(n,e){return(o=>{if(!z)return e(o);let r=performance.now(),s=e(o),p=performance.now()-r;return We(n,p),s})}function X(){let n={};for(let[e,t]of N)n[e]=t.callCount>0?t.totalTime/t.callCount:0;return n}function Ae(){N.clear();}function Be(){H=null,ie=0;}function J(n,e,t){let o=performance.now();if(H&&o-ie<Oe)return H;let r=t?.getStats()??{fps:0,frameTime:0,frameCount:0,runningTime:0},s=null;typeof process<"u"&&process.memoryUsage&&(s=process.memoryUsage().heapUsed/(1024*1024));let p=X();return H={fps:r.fps,frameTime:r.frameTime,frameCount:r.frameCount,runningTime:r.runningTime,entityCount:e,memoryUsageMB:s,systemTimings:p},ie=o,H}n();f();n();z$1.object({x:z$1.number().finite().optional(),y:z$1.number().finite().optional(),width:z$1.number().positive().optional(),toggleKey:z$1.string().optional(),showFPS:z$1.boolean().optional(),showEntityCount:z$1.boolean().optional(),showMemory:z$1.boolean().optional(),showSystemTimings:z$1.boolean().optional(),maxSystemsShown:z$1.number().int().positive().optional(),bgColor:z$1.number().int().nonnegative().optional(),fgColor:z$1.number().int().nonnegative().optional(),visibleOnStart:z$1.boolean().optional()});var _e={x:0,y:0,width:35,toggleKey:"F12",showFPS:true,showEntityCount:true,showMemory:true,showSystemTimings:true,maxSystemsShown:5,bgColor:33023,fgColor:4294967295,visibleOnStart:false};function me(n,e$2={}){let t={..._e,...e$2},o=t.visibleOnStart,r=null;t.showSystemTimings&&!ae()&&se(true);function s(){let m$1=d$1(n);return F(n,m$1,t.x,t.y,9999),w(n,m$1,t.width,10),d$2(n,m$1,{fg:t.fgColor,bg:t.bgColor}),m(n,m$1),e(n,m$1,"Loading..."),b$2(m$1,"name","__debug_overlay__"),m$1}function p(m,y){return `\u2502 FPS: \x1B[${m>=55?"32":m>=30?"33":"31"}m${m.toString().padStart(3)}\x1B[0m (${y.toFixed(1)}ms)`}function f(m){let y=X(),v=Object.entries(y).filter(([,i])=>i>0).sort(([,i],[,a])=>a-i).slice(0,m);if(v.length===0)return [];let L=["\u251C\u2500 Systems \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"];for(let[i,a]of v){let l=a.toFixed(2).padStart(6),c=i.length>20?`${i.slice(0,17)}...`:i;L.push(`\u2502 ${c.padEnd(20)} ${l}ms`);}return L}function S(m){let y=["\u250C\u2500 Debug \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"];return t.showFPS&&y.push(p(m.fps,m.frameTime)),t.showEntityCount&&y.push(`\u2502 Entities: ${m.entityCount}`),t.showMemory&&m.memoryUsageMB!==null&&y.push(`\u2502 Memory: ${m.memoryUsageMB.toFixed(1)}MB`),t.showSystemTimings&&y.push(...f(t.maxSystemsShown)),y.push(`\u2502 Frame: ${m.frameCount}`),y.push(`\u2502 Time: ${m.runningTime.toFixed(1)}s`),y.push("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"),y.join(`
|
|
2
|
+
`)}let b={get visible(){return o},get entity(){return r},get config(){return t},show(){o=true,r||(r=s()),m(n,r);},hide(){o=false,r&&n$1(n,r);},toggle(){o?b.hide():b.show();},update(m,y){if(!o||!r)return;let L=g(m).length,i=J(m,L,y),a=S(i);e(m,r,a);let l=a.split(`
|
|
3
|
+
`).length;w(m,r,t.width,l);},destroy(){r&&(e$1(n,r),r=null),o=false;}};return o&&(r=s()),b}function Ue(n=20){let e=[];return {get entries(){return e},get maxEntries(){return n},log(t,o){for(e.push({type:t,detail:o,timestamp:Date.now()});e.length>n;)e.shift();},clear(){e.length=0;},getRecentEntries(t=5){return e.slice(-t)}}}function je(){let n=new Map,e=new Map;return {start(t){n.set(t,performance.now());},end(t){let o=n.get(t);if(o===void 0)return 0;let r=performance.now()-o;n.delete(t);let s=e.get(t);return s?(s.total+=r,s.min=Math.min(s.min,r),s.max=Math.max(s.max,r),s.count++):e.set(t,{total:r,min:r,max:r,count:1}),r},getAverage(t){let o=e.get(t);return !o||o.count===0?0:o.total/o.count},getAll(){let t={};for(let[o,r]of e)t[o]={avg:r.count>0?r.total/r.count:0,min:r.min,max:r.max,count:r.count};return t},reset(){n.clear(),e.clear();}}}function Ge(n=60){let e=[],t=0;return {addSample(o){for(e.push(o),t+=o;e.length>n;){let r=e.shift();r!==void 0&&(t-=r);}},getSamples(){return e},getCurrentFPS(){if(e.length===0)return 0;let o=e[e.length-1]??0;return o>0?1e3/o:0},getAverageFPS(){if(e.length===0)return 0;let o=t/e.length;return o>0?1e3/o:0},getMinMaxFPS(){if(e.length===0)return {min:0,max:0};let o=Number.MAX_VALUE,r=0;for(let s of e)o=Math.min(o,s),r=Math.max(r,s);return {min:r>0?1e3/r:0,max:o>0?1e3/o:0}},reset(){e.length=0,t=0;}}}var Re=z$1.object({enabled:z$1.boolean().optional().default(false),toggleKey:z$1.string().optional().default("F12"),showOverlay:z$1.boolean().optional().default(true),showLogs:z$1.boolean().optional().default(true),maxLogEntries:z$1.number().int().positive().optional().default(100),position:z$1.object({x:z$1.number(),y:z$1.number()}).optional(),dimensions:z$1.object({width:z$1.number().positive(),height:z$1.number().positive()}).optional(),theme:z$1.object({bg:z$1.union([z$1.string(),z$1.number()]).optional(),fg:z$1.union([z$1.string(),z$1.number()]).optional(),infoBg:z$1.union([z$1.string(),z$1.number()]).optional(),warnBg:z$1.union([z$1.string(),z$1.number()]).optional(),errorBg:z$1.union([z$1.string(),z$1.number()]).optional()}).optional()}),Q={enabled:false,toggleKey:"F12",showOverlay:true,showLogs:true,maxLogEntries:100,position:{x:0,y:0},dimensions:{width:80,height:20},theme:{bg:221,fg:4294967295,infoBg:65535,warnBg:4294902015,errorBg:4278190335}};function He(n,e$3={}){let t={...Q,...e$3,position:e$3.position??Q.position,dimensions:e$3.dimensions??Q.dimensions,theme:{...Q.theme,...e$3.theme??{}}};if(Re.parse(e$3),!t.enabled)return Ne(t);let o=[],r=false,s=null,p=null,f=null;t.showOverlay&&(f=me(n,{x:t.position.x,y:t.position.y,width:Math.floor(t.dimensions.width/2),toggleKey:t.toggleKey,visibleOnStart:false}));function S(){let u=d$1(n),x=t.showOverlay?t.position.x+Math.floor(t.dimensions.width/2)+1:t.position.x;return F(n,u,x,t.position.y,9999),w(n,u,Math.floor(t.dimensions.width/2),t.dimensions.height),d$2(n,u,{fg:e$2(t.theme.fg),bg:e$2(t.theme.bg)}),n$1(n,u),b$2(u,"name","__debug_console__"),u}function b(){let u=d$1(n);return F(n,u,0,0,0),w(n,u,Math.floor(t.dimensions.width/2),t.dimensions.height),d$2(n,u,{fg:e$2(t.theme.fg),bg:0}),e(n,u,`Debug Console
|
|
4
|
+
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),b$2(u,"name","__debug_log_panel__"),u}function m$1(){if(!p||!f$2(n,p))return;let u=t.dimensions.height-2,x=o.slice(-u),M=["Debug Console","\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"];for(let w of x){let K=new Date(w.timestamp).toLocaleTimeString(),V=y(w.level);M.push(`${K} ${V} ${w.message}`);}e(n,p,M.join(`
|
|
5
|
+
`));}function y(u){switch(u){case "debug":return "[D]";case "info":return "[I]";case "warn":return "[W]";case "error":return "[E]"}}function v(){r||(r=true,f&&f.show(),t.showLogs&&((!s||!f$2(n,s))&&(s=S(),p=b(),d$3(n,s,p)),s&&f$2(n,s)&&m(n,s),m$1()));}function L(){r&&(r=false,f&&f.hide(),s&&f$2(n,s)&&n$1(n,s));}function i(){r?L():v();}function a(u,x="info"){let M={timestamp:Date.now(),level:x,message:u};for(o.push(M);o.length>t.maxLogEntries;)o.shift();switch(x){case "debug":console.debug(`[DEBUG] ${u}`);break;case "info":console.info(`[INFO] ${u}`);break;case "warn":console.warn(`[WARN] ${u}`);break;case "error":console.error(`[ERROR] ${u}`);break}r&&t.showLogs&&m$1();}function l(u,x){r&&(f&&f.update(u,x),t.showLogs&&p&&f$2(u,p)&&m$1());}function c(){o.length=0,r&&t.showLogs&&m$1();}function d(){f&&f.destroy(),p&&f$2(n,p)&&e$1(n,p),s&&f$2(n,s)&&e$1(n,s),o.length=0;}return {get enabled(){return t.enabled},get visible(){return r},get logs(){return o},get config(){return t},show:v,hide:L,toggle:i,log:a,update:l,clearLogs:c,destroy:d}}function Ne(n){return {enabled:false,visible:false,logs:[],config:n,show:()=>{},hide:()=>{},toggle:()=>{},log:()=>{},update:()=>{},clearLogs:()=>{},destroy:()=>{}}}function Ke(n,e,t="info"){switch(t){case "debug":console.debug(`[DEBUG] ${e}`);break;case "info":console.info(`[INFO] ${e}`);break;case "warn":console.warn(`[WARN] ${e}`);break;case "error":console.error(`[ERROR] ${e}`);break}}n();function Ve(n,e){let t=Y(n,e);return le(t)}function qe(n){let e=ue(n);return pe(e)}function ze(n){return g(n)}function Xe(n,e){return k$2(n,[e])}function Je(n,e){return e.length===0?[]:k$2(n,e)}function Qe(n,e){return g(n).includes(e)}function Ye(n,e){return Y(n,e).components.map(o=>o.name)}function Ze(n,e,t,o){if(!i$1(n,e,t))return;let s=t[o];if(ArrayBuffer.isView(s)||Array.isArray(s))return s[e]}n();z$1.object({snapshotInterval:z$1.number().nonnegative(),maxSnapshots:z$1.number().int().positive(),entityLeakThreshold:z$1.number().nonnegative(),heapLeakThreshold:z$1.number().nonnegative(),trackedComponents:z$1.array(z$1.object({component:z$1.unknown(),name:z$1.string()})).readonly()});var en={snapshotInterval:5e3,maxSnapshots:100,entityLeakThreshold:10,heapLeakThreshold:1024*1024,trackedComponents:[]};function nn(n){let e={...en,...n},t=[],o=null;function r(i){let a=g(i),l={};for(let{component:u,name:x}of e.trackedComponents){let M=0;for(let w of a)i$1(i,w,u)&&M++;l[x]=M;}let c=process.memoryUsage(),d={timestamp:Date.now(),entityCount:a.length,componentCounts:l,heapUsed:c.heapUsed,heapTotal:c.heapTotal,rss:c.rss,external:c.external};for(t.push(d);t.length>e.maxSnapshots;)t.shift();return d}function s(i,a){let l={},c=new Set([...Object.keys(i.componentCounts),...Object.keys(a.componentCounts)]);for(let d of c)l[d]=(a.componentCounts[d]??0)-(i.componentCounts[d]??0);return l}function p(i,a,l,c){let d=i/a;return d<=e.entityLeakThreshold?null:{type:"entity",message:`Entity count growing at ${d.toFixed(1)}/sec (${l.entityCount} -> ${c.entityCount})`,growthRate:d}}function f(i,a){let l=i/a;return l<=e.heapLeakThreshold?null:{type:"heap",message:`Heap growing at ${(l/1024).toFixed(1)}KB/sec`,growthRate:l}}function S(i,a){let l=[];for(let[c,d]of Object.entries(i)){let u=d/a;u>e.entityLeakThreshold&&l.push({type:"component",message:`${c} component growing at ${u.toFixed(1)}/sec`,growthRate:u});}return l}function b(i,a){let l=a.timestamp-i.timestamp,c=l/1e3,d=a.entityCount-i.entityCount,u=a.heapUsed-i.heapUsed,x=a.rss-i.rss,M=s(i,a),w=[];if(c>0){let K=p(d,c,i,a);K&&w.push(K);let V=f(u,c);V&&w.push(V);let Pe=S(M,c);w.push(...Pe);}return {elapsed:l,entityCountDelta:d,componentDeltas:M,heapUsedDelta:u,rssDelta:x,possibleLeaks:w}}function m(i){return Math.abs(i)<1024?`${i}B`:Math.abs(i)<1024*1024?`${(i/1024).toFixed(1)}KB`:`${(i/(1024*1024)).toFixed(1)}MB`}function y(i,a){i.push("Memory Profile Report"),i.push("\u2550".repeat(40)),i.push(`Entities: ${a.entityCount}`),i.push(`Heap Used: ${m(a.heapUsed)}`),i.push(`Heap Total: ${m(a.heapTotal)}`),i.push(`RSS: ${m(a.rss)}`),i.push(`External: ${m(a.external)}`);}function v(i,a){if(Object.keys(a.componentCounts).length!==0){i.push(""),i.push("Component Counts:");for(let[l,c]of Object.entries(a.componentCounts))i.push(` ${l}: ${c}`);}}function L(i,a){if(t.length<2)return;let l=t[0];if(!l)return;let c=b(l,a);if(i.push(""),i.push(`Trends (over ${(c.elapsed/1e3).toFixed(0)}s):`),i.push(` Entity delta: ${c.entityCountDelta>0?"+":""}${c.entityCountDelta}`),i.push(` Heap delta: ${c.heapUsedDelta>0?"+":""}${m(c.heapUsedDelta)}`),c.possibleLeaks.length>0){i.push(""),i.push("WARNINGS:");for(let d of c.possibleLeaks)i.push(` [${d.type}] ${d.message}`);}}return {snapshot(i){return r(i)},diff(i,a){return b(i,a)},getSnapshots(){return t},getLatestSnapshot(){return t.length>0?t[t.length-1]??null:null},getReport(i){let a=r(i),l=[];return y(l,a),v(l,a),L(l,a),l.join(`
|
|
6
|
+
`)},startAutoSnapshot(i){o===null&&(e.snapshotInterval<=0||(r(i),o=setInterval(()=>{r(i);},e.snapshotInterval)));},stopAutoSnapshot(){o!==null&&(clearInterval(o),o=null);},reset(){t.length=0,o!==null&&(clearInterval(o),o=null);}}}var ce=[{component:E$1,name:"Position"},{component:v,name:"Dimensions"},{component:c,name:"Renderable"},{component:d,name:"Content"},{component:k,name:"Border"},{component:a,name:"Padding"},{component:b,name:"Hierarchy"},{component:c$1,name:"Interactive"},{component:X$1,name:"Focusable"},{component:k$1,name:"Scrollable"},{component:ha,name:"Velocity"},{component:A,name:"Animation"},{component:Q$1,name:"Collider"},{component:i,name:"Shadow"}];function tn(n,e,t,o){if(!i$1(n,e,t))return null;let r={},s=t;for(let[p,f]of Object.entries(s))if(ArrayBuffer.isView(f)||Array.isArray(f)){let S=f;r[p]=S[e];}return {name:o,data:r}}function Y(n,e){let t=[];for(let{component:p,name:f}of ce){let S=tn(n,e,p,f);S&&t.push(S);}let o=i$1(n,e,b)?i$2(n,e):null,r=i$1(n,e,b)?f$1(n,e):[],s=c$2(e,"name")?a$1(e,"name")??null:null;return {entity:e,name:s,components:t,parent:o===0?null:o,children:r}}function le(n){let e=[],t=n.name?` (${n.name})`:"";e.push(`Entity ${n.entity}${t}`),n.parent!==null&&e.push(`\u251C\u2500 Parent: ${n.parent}`),n.children.length>0&&e.push(`\u251C\u2500 Children: [${n.children.join(", ")}]`);let o=n.components.length;return n.components.forEach((r,s)=>{let f=s===o-1?"\u2514\u2500":"\u251C\u2500",S=Object.entries(r.data).map(([b,m])=>{if(typeof m=="number"){if(b==="fg"||b==="bg"){let{r:y,g:v,b:L,a:i}=b$1(m>>>0),a=l=>l.toString(16).padStart(2,"0");return `${b}=#${a(y)}${a(v)}${a(L)}${a(Math.round(i*255))}`}if(!Number.isInteger(m))return `${b}=${m.toFixed(2)}`}return `${b}=${m}`}).join(", ");e.push(`${f} ${r.name}: ${S}`);}),e.join(`
|
|
7
|
+
`)}function ue(n){let e=g(n),t={},o=[];for(let{name:r}of ce)t[r]=0;for(let r of e){for(let{component:s,name:p}of ce)if(i$1(n,r,s)){let f=t[p]??0;t[p]=f+1;}i$1(n,r,b)&&i$2(n,r)===0&&o.push(r);}return {entityCount:e.length,componentCounts:t,hierarchyRoots:o}}function pe(n){let e=[];e.push("World Statistics"),e.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),e.push(`Entities: ${n.entityCount}`),e.push(""),e.push("Components:");let t=Object.entries(n.componentCounts).filter(([,o])=>o>0).sort(([,o],[,r])=>r-o);for(let[o,r]of t){let s=(r/n.entityCount*100).toFixed(0);e.push(` ${o}: ${r} (${s}%)`);}return n.hierarchyRoots.length>0&&(e.push(""),e.push(`Hierarchy Roots: [${n.hierarchyRoots.join(", ")}]`)),e.join(`
|
|
8
|
+
`)}function Qn(n,e){let o=g(n).length;return J(n,o,e)}var E={enabled:false,showHitboxes:true,showPadding:false,showMargins:false,color:4278255360};function Yn(n,e){E.enabled=n,e&&(E.showHitboxes=e.showHitboxes??E.showHitboxes,E.showPadding=e.showPadding??E.showPadding,E.showMargins=e.showMargins??E.showMargins,E.color=e.color??E.color);}function Zn(){return E.enabled}function et(){return {...E}}function nt(n){return E.enabled?g(n).filter(t=>i$1(n,t,E$1)&&i$1(n,t,v)):[]}function on(n,e){let t=[];return i$1(n,e,X$1)&&_(n,e)&&t.push("focused"),i$1(n,e,c$1)&&(i$3(n,e)&&t.push("hovered"),j(n,e)&&t.push("pressed")),I(n,e)&&t.push("animated"),o(n,e)&&t.push("bordered"),t}function tt(n,e){let t=[],o=c$2(e,"name")?a$1(e,"name"):null;if(t.push(`Entity ${e}${o?` (${o})`:""}`),i$1(n,e,E$1)){let s=Math.round(E$1.x[e]??0),p=Math.round(E$1.y[e]??0);t.push(`@ ${s},${p}`);}i$1(n,e,v)&&t.push(`[${v.width[e]}x${v.height[e]}]`);let r=on(n,e);return r.length>0&&t.push(r.join(" ")),t.join(" ")}function ot(n,e){let t=Y(n,e),o=le(t);console.log(`[DEBUG] ${o}`);}function rt(n){let e=ue(n),t=pe(e);console.log(`[DEBUG] ${t}`);}export{ue as A,pe as B,Qn as C,Yn as D,Zn as E,et as F,nt as G,tt as H,ot as I,rt as J,se as a,ae as b,We as c,Ie as d,X as e,Ae as f,Be as g,me as h,Ue as i,je as j,Ge as k,Re as l,He as m,Ke as n,Ve as o,qe as p,ze as q,Xe as r,Je as s,Qe as t,Ye as u,Ze as v,nn as w,ce as x,Y as y,le as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$1,f as f$1,j as j$1,b}from'./chunk-K3SX2LY5.js';import {J,E as E$1}from'./chunk-ZAHG7Y3X.js';import {n,i,h as h$1,j}from'./chunk-PXXGH3BV.js';n();var F=1e4,a={behaviorType:new Uint8Array(F),state:new Uint8Array(F),targetEntity:new Uint32Array(F),waitTimer:new Float32Array(F),patrolIndex:new Uint16Array(F),patrolCount:new Uint16Array(F),speed:new Float32Array(F),detectionRange:new Float32Array(F),fleeRange:new Float32Array(F)},M={Idle:0,Patrol:1,Chase:2,Flee:3,Custom:4},h={Inactive:0,Active:1,Waiting:2,Completed:3},Y=new Map,S=new Map;function oe(t){a.behaviorType[t]=M.Idle,a.state[t]=h.Inactive,a.targetEntity[t]=0,a.waitTimer[t]=0,a.patrolIndex[t]=0,a.patrolCount[t]=0,a.speed[t]=1,a.detectionRange[t]=10,a.fleeRange[t]=15;}function ge(t,e,n={}){return i(t,e,a)||(h$1(t,e,a),oe(e)),a.behaviorType[e]=n.type??M.Idle,a.speed[e]=n.speed??1,a.targetEntity[e]=n.targetEntity??0,a.detectionRange[e]=n.detectionRange??10,a.fleeRange[e]=n.fleeRange??15,a.state[e]=h.Active,e}function xe(t,e){if(i(t,e,a))return {type:a.behaviorType[e],state:a.state[e],targetEntity:a.targetEntity[e],waitTimer:a.waitTimer[e],patrolIndex:a.patrolIndex[e],patrolCount:a.patrolCount[e],speed:a.speed[e],detectionRange:a.detectionRange[e],fleeRange:a.fleeRange[e]}}function Te(t,e){return i(t,e,a)}function ve(t,e){return i(t,e,a)&&j(t,e,a),Y.delete(e),S.delete(e),e}function Ee(t,e){i(t,e,a)&&(a.behaviorType[e]=M.Idle,a.state[e]=h.Active,a.targetEntity[e]=0);}function we(t,e,n,o={}){i(t,e,a)&&n.length!==0&&(a.behaviorType[e]=M.Patrol,a.state[e]=h.Active,a.patrolIndex[e]=0,a.patrolCount[e]=n.length,a.waitTimer[e]=0,Y.set(e,{points:[...n],loop:o.loop??true,waitTime:o.waitTime??0}));}function Ce(t,e,n){i(t,e,a)&&(a.behaviorType[e]=M.Chase,a.state[e]=h.Active,a.targetEntity[e]=n);}function We(t,e,n){i(t,e,a)&&(a.behaviorType[e]=M.Flee,a.state[e]=h.Active,a.targetEntity[e]=n);}function Ae(t,e,n){i(t,e,a)&&(a.behaviorType[e]=M.Custom,a.state[e]=h.Active,S.set(e,n));}function Ie(t,e){if(i(t,e,a))return a.behaviorType[e]}function Pe(t,e){if(i(t,e,a))return a.state[e]}function Fe(t,e){return i(t,e,a)?a.targetEntity[e]:0}function Be(t,e,n){i(t,e,a)&&(a.targetEntity[e]=n);}function Me(t,e,n){i(t,e,a)&&(a.speed[e]=n);}function Ye(t,e,n){i(t,e,a)&&(a.detectionRange[e]=n);}function De(t,e){return i(t,e,a)?a.state[e]===h.Active:false}function Re(t,e){return i(t,e,a)?a.state[e]===h.Waiting:false}function Xe(t,e){return i(t,e,a)?a.state[e]===h.Completed:false}function Ue(t,e){if(i(t,e,a))return Y.get(e)}function Se(t,e){if(!i(t,e,a))return;let n=Y.get(e);if(!n)return;let o=a.patrolIndex[e];return n.points[o]}function Ze(t,e,n,o,u){if(!i(t,e,a))return;let l=Y.get(e);if(!l||l.points.length===0)return;if(a.state[e]===h.Waiting){let w=a.waitTimer[e]-u;if(w>0){a.waitTimer[e]=w;return}a.waitTimer[e]=0,a.state[e]=h.Active;}let c=a.patrolIndex[e],s=l.points[c];if(!s)return;let b=s.x-n,y=s.y-o,p=Math.sqrt(b*b+y*y),x=a.speed[e],B=x*u*.5;return p<=B?ie(e,l):{dx:b/p*x,dy:y/p*x}}function ie(t,e){let n=a.patrolIndex[t]+1;if(n>=e.points.length)if(e.loop)a.patrolIndex[t]=0;else {a.state[t]=h.Completed;return}else a.patrolIndex[t]=n;if(e.waitTime>0){a.state[t]=h.Waiting,a.waitTimer[t]=e.waitTime;return}return {dx:0,dy:0}}function ke(t,e,n,o,u,l){if(!i(t,e,a))return;let c=u-n,s=l-o,b=Math.sqrt(c*c+s*s);if(b===0)return {dx:0,dy:0};let y=a.detectionRange[e];if(y>0&&b>y)return;let p=a.speed[e];return {dx:c/b*p,dy:s/b*p}}function Oe(t,e,n,o,u,l){if(!i(t,e,a))return;let c=n-u,s=o-l,b=Math.sqrt(c*c+s*s),y=a.fleeRange[e];if(y>0&&b>=y)return;if(b===0)return {dx:1,dy:0};let p=a.speed[e];return {dx:c/b*p,dy:s/b*p}}function Le(t,e,n){if(!i(t,e,a))return;let o=S.get(e);o&&o(t,e,n);}function Ve(t,e,n){if(!i(t,e,a)||a.state[e]!==h.Waiting)return;let o=a.waitTimer[e]-n;o<=0?(a.waitTimer[e]=0,a.state[e]=h.Active):a.waitTimer[e]=o;}function He(){Y.clear(),S.clear();}n();var E=1e4,Z=0,r={x:new Float32Array(E),y:new Float32Array(E),width:new Uint16Array(E),height:new Uint16Array(E),followTarget:new Uint32Array(E),smoothing:new Float32Array(E),deadZoneX:new Float32Array(E),deadZoneY:new Float32Array(E),bounded:new Uint8Array(E),minX:new Float32Array(E),maxX:new Float32Array(E),minY:new Float32Array(E),maxY:new Float32Array(E)},ue=80,le=24;function X(t){r.x[t]=0,r.y[t]=0,r.width[t]=ue,r.height[t]=le,r.followTarget[t]=Z,r.smoothing[t]=0,r.deadZoneX[t]=0,r.deadZoneY[t]=0,r.bounded[t]=0,r.minX[t]=0,r.maxX[t]=0,r.minY[t]=0,r.maxY[t]=0;}function ze(t,e,n={}){return i(t,e,r)||(h$1(t,e,r),X(e)),n.x!==void 0&&(r.x[e]=n.x),n.y!==void 0&&(r.y[e]=n.y),n.width!==void 0&&(r.width[e]=n.width),n.height!==void 0&&(r.height[e]=n.height),n.followTarget!==void 0&&(r.followTarget[e]=n.followTarget),n.smoothing!==void 0&&(r.smoothing[e]=Math.max(0,Math.min(1,n.smoothing))),n.deadZoneX!==void 0&&(r.deadZoneX[e]=n.deadZoneX),n.deadZoneY!==void 0&&(r.deadZoneY[e]=n.deadZoneY),e}function Ge(t,e){if(i(t,e,r))return {x:r.x[e],y:r.y[e],width:r.width[e],height:r.height[e],followTarget:r.followTarget[e],smoothing:r.smoothing[e],deadZoneX:r.deadZoneX[e],deadZoneY:r.deadZoneY[e],bounded:r.bounded[e]===1,minX:r.minX[e],maxX:r.maxX[e],minY:r.minY[e],maxY:r.maxY[e]}}function je(t,e){return i(t,e,r)}function Je(t,e){return i(t,e,r)&&j(t,e,r),e}function Ke(t,e,n,o){return i(t,e,r)||(h$1(t,e,r),X(e)),r.followTarget[e]=n,o!==void 0&&(r.smoothing[e]=Math.max(0,Math.min(1,o))),e}function Qe(t,e){return i(t,e,r)?r.followTarget[e]:Z}function $e(t,e){return i(t,e,r)?r.followTarget[e]!==Z:false}function et(t,e,n,o){return i(t,e,r)||(h$1(t,e,r),X(e)),r.deadZoneX[e]=n,r.deadZoneY[e]=o,e}function tt(t,e,n){return i(t,e,r)||(h$1(t,e,r),X(e)),r.bounded[e]=1,r.minX[e]=n.minX,r.maxX[e]=n.maxX,r.minY[e]=n.minY,r.maxY[e]=n.maxY,e}function nt(t,e){return i(t,e,r)&&(r.bounded[e]=0),e}function rt(t,e){return i(t,e,r)?r.bounded[e]===1:false}function at(t,e,n,o){return i(t,e,r)||(h$1(t,e,r),X(e)),r.x[e]=n,r.y[e]=o,r.bounded[e]===1&&k(e),e}function ot(t,e){if(i(t,e,r))return {x:r.x[e],y:r.y[e]}}function it(t,e,n,o){return i(t,e,r)&&(r.x[e]=r.x[e]+n,r.y[e]=r.y[e]+o,r.bounded[e]===1&&k(e)),e}function k(t){let e=r.width[t],n=r.height[t],o=r.minX[t],u=r.maxX[t],l=r.minY[t],c=r.maxY[t],s=u-e,b=c-n;r.x[t]=Math.max(o,Math.min(s,r.x[t])),r.y[t]=Math.max(l,Math.min(b,r.y[t]));}function ut(t,e,n,o){if(!i(t,e,r))return;let u=r.x[e],l=r.y[e];return {x:n-u,y:o-l}}function lt(t,e,n,o){if(!i(t,e,r))return;let u=r.x[e],l=r.y[e];return {x:n+u,y:o+l}}function mt(t,e,n,o){if(!i(t,e,r))return false;let u=r.x[e],l=r.y[e],c=r.width[e],s=r.height[e];return n>=u&&n<u+c&&o>=l&&o<l+s}function st(t,e,n,o,u,l){if(!i(t,e,r))return false;let c=r.x[e],s=r.y[e],b=r.width[e],y=r.height[e];return n<c+b&&n+u>c&&o<s+y&&o+l>s}function ft(t,e,n){if(!i(t,e,r))return;let o=r.followTarget[e];if(o===Z||!J(t,o))return;let u=E$1.x[o],l=E$1.y[o],c=r.width[e],s=r.height[e],b=r.smoothing[e],y=r.deadZoneX[e],p=r.deadZoneY[e],x=u-c/2,B=l-s/2,w=r.x[e],I=r.y[e],H=w,j=I,re=w+c/2,ae=I+s/2,J$1=u-re,K=l-ae;if(Math.abs(J$1)>y){let _=J$1>0?x+y:x-y;H=ee(w,_,b,n);}if(Math.abs(K)>p){let _=K>0?B+p:B-p;j=ee(I,_,b,n);}r.x[e]=H,r.y[e]=j,r.bounded[e]===1&&k(e);}function ee(t,e,n,o){if(n<=0)return e;let u=1-n**(o*10);return t+(e-t)*u}function ct(t,e,n,o){if(!i(t,e,r))return e;let u=r.width[e],l=r.height[e];return r.x[e]=n-u/2,r.y[e]=o-l/2,r.bounded[e]===1&&k(e),e}n();var g=1e4,f={lifetime:new Float32Array(g),age:new Float32Array(g),fadeOut:new Uint8Array(g),char:new Uint32Array(g),startFg:new Uint32Array(g),endFg:new Uint32Array(g),emitter:new Uint32Array(g)},m={rate:new Float32Array(g),burstCount:new Uint16Array(g),lifetime:new Float32Array(g),spread:new Float32Array(g),speed:new Float32Array(g),gravity:new Float32Array(g),angle:new Float32Array(g),active:new Uint8Array(g),accumulator:new Float32Array(g)},L=new Map,C=a$1(256),A=new Map;function me(t){f.lifetime[t]=0,f.age[t]=0,f.fadeOut[t]=0,f.char[t]=0,f.startFg[t]=0,f.endFg[t]=0,f.emitter[t]=0;}function pt(t,e,n){return i(t,e,f)||(h$1(t,e,f),me(e)),f.lifetime[e]=n.lifetime,f.age[e]=0,f.fadeOut[e]=n.fadeOut?1:0,f.char[e]=n.char,f.startFg[e]=n.startFg,f.endFg[e]=n.endFg??n.startFg,f.emitter[e]=n.emitter??0,e}function ht(t,e){if(i(t,e,f))return {lifetime:f.lifetime[e],age:f.age[e],fadeOut:f.fadeOut[e]===1,char:f.char[e],startFg:f.startFg[e],endFg:f.endFg[e],emitter:f.emitter[e]}}function gt(t,e){return i(t,e,f)}function xt(t,e){if(i(t,e,f)){let n=A.get(e);n&&(f$1(C,n),A.delete(e)),j(t,e,f);}return e}function Tt(t,e){return i(t,e,f)?f.age[e]>=f.lifetime[e]:true}function se(t,e){if(!i(t,e,f))return 1;let n=f.lifetime[e];return n<=0?1:Math.min(1,f.age[e]/n)}function O(t,e,n){return Math.round(t+(e-t)*n)}function fe(t,e,n){let o=Math.max(0,Math.min(1,n)),u=t>>16&255,l=t>>8&255,c=t&255,s=t>>24&255,b=e>>16&255,y=e>>8&255,p=e&255,x=e>>24&255,B=O(u,b,o),w=O(l,y,o),I=O(c,p,o);return ((O(s,x,o)&255)<<24|(B&255)<<16|(w&255)<<8|I&255)>>>0}function vt(t,e){if(!i(t,e,f))return 0;let n=se(t,e);return fe(f.startFg[e],f.endFg[e],n)}function ce(t){m.rate[t]=0,m.burstCount[t]=0,m.lifetime[t]=1,m.spread[t]=Math.PI*2,m.speed[t]=3,m.gravity[t]=0,m.angle[t]=0,m.active[t]=1,m.accumulator[t]=0;}function Et(t,e,n){return i(t,e,m)||(h$1(t,e,m),ce(e)),m.lifetime[e]=n.lifetime,n.rate!==void 0&&(m.rate[e]=n.rate),n.burstCount!==void 0&&(m.burstCount[e]=n.burstCount),n.spread!==void 0&&(m.spread[e]=n.spread),n.speed!==void 0&&(m.speed[e]=n.speed),n.gravity!==void 0&&(m.gravity[e]=n.gravity),n.angle!==void 0&&(m.angle[e]=n.angle),n.active!==void 0&&(m.active[e]=n.active?1:0),e}function wt(t,e){if(i(t,e,m))return {rate:m.rate[e],burstCount:m.burstCount[e],lifetime:m.lifetime[e],spread:m.spread[e],speed:m.speed[e],gravity:m.gravity[e],angle:m.angle[e],active:m.active[e]===1}}function Ct(t,e){return i(t,e,m)}function Wt(t,e){if(i(t,e,m)){j(t,e,m),L.delete(e);let n=j$1(C),o=[];for(let u=0;u<C.size;u++){let l=n[u];if(l&&l.emitterId===e){let c=A.get(l.particleId);c&&o.push({handle:c,particleId:l.particleId});}}for(let u of o)f$1(C,u.handle),A.delete(u.particleId);}return e}function At(t,e){L.set(t,e);}function It(t){return L.get(t)}function Pt(t){let e=new Set,n=j$1(C);for(let o=0;o<C.size;o++){let u=n[o];u&&u.emitterId===t&&e.add(u.particleId);}return e}function Ft(t,e){let n=A.get(e);n&&(f$1(C,n),A.delete(e));let o=b(C,{particleId:e,emitterId:t});A.set(e,o);}function Bt(t,e){let n=A.get(e);n&&(f$1(C,n),A.delete(e));}function Mt(t,e){i(t,e,m)&&(m.active[e]=1);}function Yt(t,e){i(t,e,m)&&(m.active[e]=0);}function Dt(t,e){return i(t,e,m)?m.active[e]===1:false}function Rt(t,e,n){i(t,e,m)&&(m.rate[e]=n);}function Xt(t,e,n){i(t,e,m)&&(m.speed[e]=n);}function Ut(t,e,n){i(t,e,m)&&(m.gravity[e]=n);}function St(){return C}function Zt(){L.clear(),C=a$1(256),A.clear();}n();var D=1e4,V=0,te=1,W={tilesets:new Map,nameToId:new Map};function Lt(){W.tilesets.clear(),W.nameToId.clear(),te=1;}function Vt(t){let e=te++,n={id:e,name:t.name,tiles:t.tiles};return W.tilesets.set(e,n),W.nameToId.set(t.name,e),e}function Ht(t){return W.tilesets.get(t)}function _t(t){let e=W.nameToId.get(t);if(e!==void 0)return W.tilesets.get(e)}function qt(t){let e=W.tilesets.get(t);return e?(W.nameToId.delete(e.name),W.tilesets.delete(t),true):false}var ne=1,T={data:new Map};function Nt(){T.data.clear(),ne=1;}function be(t,e,n=1){let o=ne++,u=[];for(let l=0;l<n;l++)u.push({tiles:new Uint16Array(t*e),visible:true});return T.data.set(o,{width:t,height:e,layers:u}),o}function zt(t){return T.data.get(t)}function Gt(t){return T.data.delete(t)}function jt(t,e,n,o,u){let l=T.data.get(t);if(!l)return false;let c=l.layers[e];return !c||n<0||n>=l.width||o<0||o>=l.height?false:(c.tiles[o*l.width+n]=u,true)}function Jt(t,e,n,o){let u=T.data.get(t);if(!u)return V;let l=u.layers[e];return !l||n<0||n>=u.width||o<0||o>=u.height?V:l.tiles[o*u.width+n]}function Kt(t,e,n){let o=T.data.get(t);if(!o)return false;let u=o.layers[e];return u?(u.tiles.fill(n),true):false}function Qt(t,e,n,o,u,l,c){let s=T.data.get(t);if(!s)return false;let b=s.layers[e];if(!b)return false;let y=Math.max(0,n),p=Math.max(0,o),x=Math.min(s.width,n+u),B=Math.min(s.height,o+l);for(let w=p;w<B;w++)for(let I=y;I<x;I++)b.tiles[w*s.width+I]=c;return true}function $t(t){let e=T.data.get(t);return e?e.layers.length:0}function en(t){let e=T.data.get(t);if(!e)return -1;let n={tiles:new Uint16Array(e.width*e.height),visible:true};return e.layers.push(n),e.layers.length-1}function tn(t,e,n){let o=T.data.get(t);if(!o)return false;let u=o.layers[e];return u?(u.visible=n,true):false}function nn(t,e){let n=T.data.get(t);if(!n)return false;let o=n.layers[e];return o?o.visible:false}var d={width:new Uint16Array(D),height:new Uint16Array(D),tileWidth:new Uint8Array(D),tileHeight:new Uint8Array(D),dataId:new Uint32Array(D),tilesetId:new Uint32Array(D)};function de(t){d.width[t]=0,d.height[t]=0,d.tileWidth[t]=1,d.tileHeight[t]=1,d.dataId[t]=0,d.tilesetId[t]=0;}function rn(t,e,n){if(i(t,e,d)||(h$1(t,e,d),de(e)),d.width[e]=n.width,d.height[e]=n.height,d.tileWidth[e]=n.tileWidth??1,d.tileHeight[e]=n.tileHeight??1,d.tilesetId[e]=n.tilesetId,n.dataId!==void 0)d.dataId[e]=n.dataId;else {let o=be(n.width,n.height,n.layerCount??1);d.dataId[e]=o;}return e}function an(t,e){if(i(t,e,d))return {width:d.width[e],height:d.height[e],tileWidth:d.tileWidth[e],tileHeight:d.tileHeight[e],dataId:d.dataId[e],tilesetId:d.tilesetId[e]}}function on(t,e){return i(t,e,d)}function un(t,e,n=false){if(!i(t,e,d))return e;if(!n){let o=d.dataId[e];o>0&&T.data.delete(o);}return j(t,e,d),e}function ln(t,e){return i(t,e,d)?d.dataId[e]:0}var G={char:" ",fg:0,bg:0};function ye(t){let e=[];for(let n=0;n<t;n++)e.push({...G});return e}function pe(t,e,n,o){if(n<0||n>=t.width||o<0||o>=t.height)return G;let u=G;for(let l of t.layers){if(!l.visible)continue;let c=l.tiles[o*t.width+n];if(c===V)continue;let s=e.tiles[c];s&&(u={char:s.char,fg:s.fg,bg:s.bg});}return u}function mn(t,e,n,o,u,l){let c=T.data.get(t),s=W.tilesets.get(e),b=[];if(!c||!s){for(let y=0;y<l;y++)b.push(ye(u));return b}for(let y=0;y<l;y++){let p=[];for(let x=0;x<u;x++)p.push(pe(c,s,n+x,o+y));b.push(p);}return b}export{m as $,Le as A,W as Aa,Ve as B,Lt as Ba,He as C,Vt as Ca,r as D,Ht as Da,ue as E,_t as Ea,le as F,qt as Fa,ze as G,T as Ga,Ge as H,Nt as Ha,je as I,be as Ia,Je as J,zt as Ja,Ke as K,Gt as Ka,Qe as L,jt as La,$e as M,Jt as Ma,et as N,Kt as Na,tt as O,Qt as Oa,nt as P,$t as Pa,rt as Q,en as Qa,at as R,tn as Ra,ot as S,nn as Sa,it as T,d as Ta,ut as U,rn as Ua,lt as V,an as Va,mt as W,on as Wa,st as X,un as Xa,ft as Y,ln as Ya,ct as Z,mn as Za,f as _,a,pt as aa,M as b,ht as ba,h as c,gt as ca,ge as d,xt as da,xe as e,Tt as ea,Te as f,se as fa,ve as g,fe as ga,Ee as h,vt as ha,we as i,Et as ia,Ce as j,wt as ja,We as k,Ct as ka,Ae as l,Wt as la,Ie as m,At as ma,Pe as n,It as na,Fe as o,Pt as oa,Be as p,Ft as pa,Me as q,Bt as qa,Ye as r,Mt as ra,De as s,Yt as sa,Re as t,Dt as ta,Xe as u,Rt as ua,Ue as v,Xt as va,Se as w,Ut as wa,Ze as x,St as xa,ke as y,Zt as ya,Oe as z,V as za};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {f as f$1,c as c$1,e}from'./chunk-4LWWONFK.js';import {k as k$1,m as m$1,p,s,i as i$2,c as c$3,n as n$2,r as r$1}from'./chunk-FGHEFXLK.js';import {a as a$1,e as e$2,r,t,o as o$1}from'./chunk-C5PCEQ6G.js';import {l,s as s$1,b as b$1}from'./chunk-MTV2RJZD.js';import {c as c$4,a as a$2}from'./chunk-3AV52GY5.js';import {v as v$2,c,o,m as m$2,p as p$3,k as k$2}from'./chunk-OR3BZY7C.js';import {u,p as p$1,n as n$1,k as k$3}from'./chunk-DYU72XLL.js';import {E as E$1,v as v$1,X,e as e$1,p as p$2,i as i$1,c as c$2,ea,ka,ja,h,$,aa}from'./chunk-ZAHG7Y3X.js';import {n,i,k}from'./chunk-PXXGH3BV.js';n();var a={eventQueue:[],capturedEntity:null,lastMouseX:0,lastMouseY:0,lastHoveredEntity:null,eventBus:l()};function Ee(){a.eventQueue=[],a.capturedEntity=null,a.lastMouseX=0,a.lastMouseY=0,a.lastHoveredEntity=null;}function he(t){a.eventQueue.push({type:"key",event:t,timestamp:Date.now()});}function be(t){a.eventQueue.push({type:"mouse",event:t,timestamp:Date.now()});}function ge(){return a.eventQueue}function ve(){a.eventQueue=[];}function xe(){return a.eventBus}function Be(t){a.capturedEntity=t;}function St(){a.capturedEntity=null;}function Se(){return a.capturedEntity!==null}function Ie(){return a.capturedEntity}function It(t,e,n,r){if(!i(t,e,E$1)||!i(t,e,v$1))return false;let o=E$1.x[e]??0,u=E$1.y[e]??0,i$1=v$1.width[e]??0,s=v$1.height[e]??0;return i$1<=0||s<=0?false:n>=o&&n<o+i$1&&r>=u&&r<u+s}function Ct(t,e,n){let r=[],o=k(t,[E$1,v$1]);for(let u of o){if(!It(t,u,e,n))continue;let i=E$1.x[u]??0,s=E$1.y[u]??0,c=E$1.z[u]??0;r.push({entity:u,localX:e-i,localY:n-s,zIndex:c});}return r.sort((u,i)=>i.zIndex-u.zIndex),r}function Rt(t,e,n){let r=Ct(t,e,n);for(let o of r)if(v$2(t,o.entity))return o.entity;return null}function Dt(t){switch(t){case "left":return c$3.LEFT;case "middle":return c$3.MIDDLE;case "right":return c$3.RIGHT;case "wheelUp":return c$3.WHEEL_UP;case "wheelDown":return c$3.WHEEL_DOWN;default:return c$3.NONE}}function Ot(t,e){let n=ea();if(e.name==="tab"){let r=Array.from(k(t,[X]));e.shift?ka(t,r):ja(t,r);return}if(n!==null){let r=e.raw.length>0?e.raw[0]??0:0;i$2(t,n,{lastKeyCode:r,lastKeyTime:Date.now(),ctrl:e.ctrl,meta:e.meta,shift:e.shift}),a.eventBus.emit("keypress",{key:e.name,ctrl:e.ctrl,meta:e.meta,shift:e.shift});}}function Nt(t,e,n,r,o$1){e!==n&&(e!==null&&v$2(t,e)&&(o(t,e,false),a.eventBus.emit("mouseleave",{x:r,y:o$1})),n!==null&&v$2(t,n)&&m$2(t,n)&&(o(t,n,true),a.eventBus.emit("mouseenter",{x:r,y:o$1})),a.lastHoveredEntity=n);}function Mt(t,e,n,r,o){p(t,e)&&(n$2(t,e,{x:n,y:r,button:o,pressed:true}),r$1(t,e,n,r,o)),v$2(t,e)&&p$3(t,e,true),a.eventBus.emit("mousedown",{x:n,y:r,button:o}),$(t,e)&&aa(t,e);}function Tt(t,e,n,r,o){p(t,e)&&n$2(t,e,{x:n,y:r,button:o,pressed:false}),v$2(t,e)&&p$3(t,e,false),a.eventBus.emit("mouseup",{x:n,y:r,button:o}),k$2(t,e)&&a.eventBus.emit("click",{x:n,y:r,button:o}),a.capturedEntity!==null&&St();}function Wt(t,e){let n=e.x,r=e.y,o=Dt(e.button);a.lastMouseX=n,a.lastMouseY=r;let u=a.capturedEntity;if(u===null&&(u=Rt(t,n,r)),Nt(t,a.lastHoveredEntity,u,n,r),a.eventBus.emit("mousemove",{x:n,y:r}),u!==null)switch(e.action){case "press":Mt(t,u,n,r,o);break;case "release":Tt(t,u,n,r,o);break;case "move":p(t,u)&&n$2(t,u,{x:n,y:r});break;case "wheel":{let i=o===c$3.WHEEL_UP?"up":"down";a.eventBus.emit("scroll",{direction:i,amount:1});break}}}var Et=t=>{let e=a.eventQueue;a.eventQueue=[];for(let n of e)n.type==="key"?Ot(t,n.event):n.type==="mouse"&&Wt(t,n.event);return t};function Ce(){return Et}function Re(t,e=0){t.registerInputSystem(Et,e);}function De(t,e){k$1(t,e)&&m$1(t,e),p(t,e)&&s(t,e);}function Oe(t){let e=new Set;for(let n of k(t,[c]))e.add(n);for(let n of k(t,[X]))e.add(n);return Array.from(e)}var m="\x1B[",f={RESET:0,BOLD:1,DIM:2,ITALIC:3,UNDERLINE:4,BLINK:5,INVERSE:7,HIDDEN:8,STRIKETHROUGH:9,FG_256:38,BG_256:48};function ht(){return {lastX:-1,lastY:-1,lastFg:-1,lastBg:-1,lastAttrs:-1,alternateScreen:false}}function b(...t){return `${m}${t.join(";")}m`}function kt(t,e){return `${m}${e+1};${t+1}H`}function At(t){return `${m}${t+1}G`}function Lt(t){return t===1?`${m}C`:`${m}${t}C`}function bt(t){return {a:t>>>24&255,r:t>>>16&255,g:t>>>8&255,b:t&255}}function Ht(t){let{r:e,g:n,b:r,a:o}=bt(t);return o===0?b(39):b(f.FG_256,2,e,n,r)}function Kt(t){let{r:e,g:n,b:r,a:o}=bt(t);return o===0?b(49):b(f.BG_256,2,e,n,r)}function wt(t){let e=[];return t===a$1.NONE||(t&a$1.BOLD&&e.push(f.BOLD),t&a$1.DIM&&e.push(f.DIM),t&a$1.ITALIC&&e.push(f.ITALIC),t&a$1.UNDERLINE&&e.push(f.UNDERLINE),t&a$1.BLINK&&e.push(f.BLINK),t&a$1.INVERSE&&e.push(f.INVERSE),t&a$1.HIDDEN&&e.push(f.HIDDEN),t&a$1.STRIKETHROUGH&&e.push(f.STRIKETHROUGH),e.length===0)?"":b(...e)}function Pt(t,e,n){if(t.lastX===e&&t.lastY===n)return "";if(t.lastY===n){let r=e-t.lastX;return r===1?"":r>0&&r<=4?Lt(r):At(e)}return kt(e,n)}function Qt(t,e){let n="";return t.lastAttrs!==-1&&t.lastAttrs!==a$1.NONE&&e.attrs===a$1.NONE&&(n+=b(f.RESET),t.lastFg=-1,t.lastBg=-1,t.lastAttrs=-1),e.attrs!==t.lastAttrs&&e.attrs!==a$1.NONE?(t.lastAttrs!==-1&&t.lastAttrs!==a$1.NONE&&(n+=b(f.RESET),t.lastFg=-1,t.lastBg=-1),n+=wt(e.attrs),t.lastAttrs=e.attrs):e.attrs===a$1.NONE&&t.lastAttrs===-1&&(t.lastAttrs=a$1.NONE),e.fg!==t.lastFg&&(n+=Ht(e.fg),t.lastFg=e.fg),e.bg!==t.lastBg&&(n+=Kt(e.bg),t.lastBg=e.bg),n}function Ft(t,e){let{x:n,y:r,cell:o}=e,u="";return u+=Pt(t,n,r),u+=Qt(t,o),u+=o.char,t.lastX=n+1,t.lastY=r,u}function Vt(t,e,n=false){if(e.length===0)return "";let r="",o;if(n)o=e;else {let u=Array.from(e);u.sort((i,s)=>i.y!==s.y?i.y-s.y:i.x-s.x),o=u;}for(let u of o)r+=Ft(t,u);return r}var L=null,v=null,d=null;function We(t){v=t;}function ke(){return v}function Ae(){v=null;}function Le(t){d=t;}function He(){return d}function Ke(){d=null;}function S(){return L||(L=ht()),L}function we(){L=ht();}var $t=t=>{if(!v||!d)return t;let e$1=S(),n=d.fullRedraw,r=f$1(d);if(r.length===0)return c$1(d),e(d),t;let o=Vt(e$1,r,n);return o.length>0&&v.write(o),c$1(d),e(d),t};function Pe(){return $t}function x(t){v&&v.write(t);}function Qe(){x(`${m}?25l`);}function Ut(){x(`${m}?25h`);}function Fe(){x(`${m}?1049h`);let t=S();t.alternateScreen=true;}function Xt(){x(`${m}?1049l`);let t=S();t.alternateScreen=false;}function Ve(){x(`${m}2J`);}function Yt(){x(`${m}H`);let t=S();t.lastX=0,t.lastY=0;}function zt(){x(b(f.RESET));let t=S();t.lastFg=-1,t.lastBg=-1,t.lastAttrs=-1;}function $e(){S().alternateScreen&&Xt(),zt(),Ut(),Yt();}u();n();function _t(t,e){if(!i(t,e,c$2))return a$1.NONE;let n=a$1.NONE;return c$2.bold[e]===1&&(n|=a$1.BOLD),c$2.underline[e]===1&&(n|=a$1.UNDERLINE),c$2.blink[e]===1&&(n|=a$1.BLINK),c$2.inverse[e]===1&&(n|=a$1.INVERSE),n}function xt(t,e){if(c$4(t,e))return {x:a$2.x[e],y:a$2.y[e],width:a$2.width[e],height:a$2.height[e]}}function Gt(t,e){return p$1(t,e)?{top:k$3.top[e]===1?1:0,right:k$3.right[e]===1?1:0,bottom:k$3.bottom[e]===1?1:0,left:k$3.left[e]===1?1:0}:{top:0,right:0,bottom:0,left:0}}function qt(t,e){return {x:t.x+e.left,y:t.y+e.top,width:Math.max(0,t.width-e.left-e.right),height:Math.max(0,t.height-e.top-e.bottom)}}function jt(t,e,n){let{world:r$1,buffer:o}=t,u=e$1(r$1,e);if(!u||u.transparent)return;let i=_t(r$1,e),s=e$2(" ",u.fg,u.bg,i);r(o,n.x,n.y,n.width,n.height,s);}function H(t,e,n,r,o,u){let i=String.fromCodePoint(r);o$1(t,e,n,e$2(i,o,u));}function gt(t,e,n,r,o,u,i){let s=String.fromCodePoint(o),c=e$2(s,u,i);for(let p=0;p<r;p++)o$1(t,e+p,n,c);}function vt(t,e,n,r,o,u,i){let s=String.fromCodePoint(o),c=e$2(s,u,i);for(let p=0;p<r;p++)o$1(t,e,n+p,c);}function Jt(t,e,n,r,o,u){if(!e)return;let{x:i,y:s,width:c,height:p}=n;r.top&&r.left&&H(t,i,s,e.charTopLeft,o,u),r.top&&r.right&&H(t,i+c-1,s,e.charTopRight,o,u),r.bottom&&r.left&&H(t,i,s+p-1,e.charBottomLeft,o,u),r.bottom&&r.right&&H(t,i+c-1,s+p-1,e.charBottomRight,o,u);}function Zt(t,e,n,r,o,u){let i=r.left?1:0,s=n.width-i-(r.right?1:0);s<=0||(r.top&>(t,n.x+i,n.y,s,e,o,u),r.bottom&>(t,n.x+i,n.y+n.height-1,s,e,o,u));}function te(t,e,n,r,o,u){let i=r.top?1:0,s=n.height-i-(r.bottom?1:0);s<=0||(r.left&&vt(t,n.x,n.y+i,s,e,o,u),r.right&&vt(t,n.x+n.width-1,n.y+i,s,e,o,u));}function ee(t,e,n){let{world:r,buffer:o}=t;if(!p$1(r,e))return;let u=n$1(r,e);if(!u||u.type===0||n.width<1||n.height<1)return;let{fg:i,bg:s}=u,c={left:u.left,top:u.top,right:u.right,bottom:u.bottom};Jt(o,u,n,c,i,s),Zt(o,u.charHorizontal,n,c,i,s),te(o,u.charVertical,n,c,i,s);}function tn(t,e,n){}function en(t,e,n){}function ne(t,e){let{world:n}=t,r=xt(n,e);if(!r||r.width<=0||r.height<=0)return;jt(t,e,r),ee(t,e,r);let o=Gt(n,e);qt(r,o);b$1(t.dirtyTracker,n,e),h(n,e);}var E=null;function nn(t){E=t;}function rn(){return E}function re(t){return E?t.x+t.width<=E.x||t.x>=E.x+E.width||t.y+t.height<=E.y||t.y>=E.y+E.height:false}function oe(t,e){return t.x>=e.x&&t.y>=e.y&&t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height}function ue(t,e){if(e.length===0)return false;for(let n of e)if(oe(t,n))return true;return false}function ie(t,e){t.push({x:e.x,y:e.y,width:e.width,height:e.height});}function se(t,e,n){let{world:r}=t,o=xt(r,e);return !o||o.width<=0||o.height<=0?(h(r,e),false):re(o)?(h(r,e),false):w&&ue(o,n)?(h(r,e),false):(ne(t,e),w&&ie(n,o),true)}var W=null,K=null,w=false;function on(t,e){W=t,K=e;}function un(){return W}function sn(){W=null,K=null;}function an(t){w=t;}function ln(){return w}var ae=t=>{if(!W||!K)return t;let e={world:t,buffer:K,dirtyTracker:W},r=s$1(t).queryRenderables(t),o=[];for(let i of r)p$2(t,i)&&i$1(t,i)&&o.push({eid:i,z:E$1.z[i]});o.sort((i,s)=>i.z-s.z);let u=[];for(let{eid:i}of o)se(e,i,u);return t};function fn(){return ae}function cn(t$1,e,n,r,o,u,i=a$1.NONE){return t(t$1,e,n,r,o,u,i)}function mn(t,e,n,r$1,o,u){r(t,e,n,r$1,o,u);}function pn(t){let n=s$1(t).queryRenderables(t);for(let r of n)c$2.dirty[r]=1;}export{cn as $,Ke as A,S as B,we as C,$t as D,Pe as E,x as F,Qe as G,Ut as H,Fe as I,Xt as J,Ve as K,Yt as L,zt as M,$e as N,jt as O,ee as P,tn as Q,en as R,nn as S,rn as T,on as U,un as V,sn as W,an as X,ln as Y,ae as Z,fn as _,a,mn as aa,Ee as b,pn as ba,he as c,be as d,ge as e,ve as f,xe as g,Be as h,St as i,Se as j,Ie as k,It as l,Ct as m,Rt as n,Et as o,Ce as p,Re as q,De as r,Oe as s,ht as t,Vt as u,We as v,ke as w,Ae as x,Le as y,He as z};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var R=1e3,T=100,E=209715200;var _=.5;function O(e={}){return {config:{chunkSize:e.chunkSize??1e3,maxCachedChunks:e.maxCachedChunks??100,enableCompression:e.enableCompression??true,maxLines:e.maxLines??0,maxMemory:e.maxMemory??209715200},chunks:new Map,lruOrder:[],totalLines:0,memoryBytes:0,nextChunkId:0}}function z(e){e.chunks.clear(),e.lruOrder.length=0,e.totalLines=0,e.memoryBytes=0,e.nextChunkId=0;}function S(e){let n=e.text.length*2;return e.ansi&&(n+=e.ansi.length*2),e.meta&&(n+=JSON.stringify(e.meta).length*2),n+50}function L(e){if(e.compressed&&e.compressedData)return e.compressedData.length*2+100;let n=0;for(let o of e.lines)n+=S(o);return n+100}function x(e){return JSON.stringify(e.lines).replace(/(.)\1{3,}/g,(o,r)=>`${r}\0${o.length}\0`)}function
|
|
2
|
-
`);M(e,o);}function Y(e,n=0,o){let r=o??e.totalLines;return
|
|
3
|
-
`)}function N(e,n){if(e.totalLines<=n)return;let o=e.totalLines-n,r=0,t=[];for(let[s,c]of e.chunks){if(r>=o)break;t.push(s),r+=c.lineCount,e.memoryBytes-=c.memorySize;}for(let s of t){e.chunks.delete(s);let c=e.lruOrder.indexOf(s);c!==-1&&e.lruOrder.splice(c,1);}e.totalLines-=r;for(let s of e.chunks.values())s.startLine-=r;}function X(e,n=10){if(!e.config.enableCompression)return;let o=e.lruOrder.slice(0,-n);for(let r of o){let t=e.chunks.get(r);t&&!t.compressed&&y(e,t);}}function J(e){for(let n of e.chunks.values())n.compressed&&m(e,n);}export{R as a,T as b,E as c,_ as d,O as e,z as f,b as g,M as h,A as i,
|
|
1
|
+
var R=1e3,T=100,E=209715200;var _=.5;function O(e={}){return {config:{chunkSize:e.chunkSize??1e3,maxCachedChunks:e.maxCachedChunks??100,enableCompression:e.enableCompression??true,maxLines:e.maxLines??0,maxMemory:e.maxMemory??209715200},chunks:new Map,lruOrder:[],totalLines:0,memoryBytes:0,nextChunkId:0}}function z(e){e.chunks.clear(),e.lruOrder.length=0,e.totalLines=0,e.memoryBytes=0,e.nextChunkId=0;}function S(e){let n=e.text.length*2;return e.ansi&&(n+=e.ansi.length*2),e.meta&&(n+=JSON.stringify(e.meta).length*2),n+50}function L(e){if(e.compressed&&e.compressedData)return e.compressedData.length*2+100;let n=0;for(let o of e.lines)n+=S(o);return n+100}function x(e){return JSON.stringify(e.lines).replace(/(.)\1{3,}/g,(o,r)=>`${r}\0${o.length}\0`)}function f(e){let n=e.replace(/(.)\x00(\d+)\x00/g,(o,r,t)=>r.repeat(parseInt(t,10)));return JSON.parse(n)}function k(e,n){let o=e.lruOrder.indexOf(n);o!==-1&&e.lruOrder.splice(o,1),e.lruOrder.push(n);let r=e.chunks.get(n);r&&(r.lastAccess=Date.now());}function p(e){let{maxCachedChunks:n,maxMemory:o,enableCompression:r}=e.config;if(r){let t=e.lruOrder.slice(0,-n);for(let s of t){let c=e.chunks.get(s);c&&!c.compressed&&y(e,c);}}for(;e.memoryBytes>o&&e.lruOrder.length>1;){let t=e.lruOrder[0];if(t===void 0)break;let s=e.chunks.get(t);s&&(e.memoryBytes-=s.memorySize,e.chunks.delete(t),e.lruOrder.shift());}}function y(e,n){if(n.compressed)return;let o=n.memorySize;n.compressedData=x(n),n.compressed=true,n.lines.length=0,n.memorySize=n.compressedData.length*2+100,e.memoryBytes+=n.memorySize-o;}function m(e,n){if(!n.compressed||!n.compressedData)return;let o=n.memorySize,r=f(n.compressedData);n.lines.push(...r),n.compressed=false,n.compressedData=void 0,n.memorySize=L(n),e.memoryBytes+=n.memorySize-o;}function g(e){let n,o=-1;for(let t of e.chunks.values())t.startLine>o&&(o=t.startLine,n=t);if(n&&n.lineCount<e.config.chunkSize)return n.compressed&&m(e,n),n;let r={id:e.nextChunkId++,lines:[],startLine:e.totalLines,lineCount:0,compressed:false,memorySize:100,lastAccess:Date.now()};return e.chunks.set(r.id,r),e.lruOrder.push(r.id),e.memoryBytes+=r.memorySize,r}function B(e,n){for(let o of e.chunks.values())if(n>=o.startLine&&n<o.startLine+o.lineCount)return o}function b(e,n,o,r){let t={text:n,ansi:o,timestamp:Date.now(),meta:r},s=g(e);s.lines.push(t),s.lineCount++;let c=S(t);s.memorySize+=c,e.memoryBytes+=c,e.totalLines++,k(e,s.id),p(e);}function M(e,n){for(let o of n)b(e,o);}function A(e,n){if(n<0||n>=e.totalLines)return;let o=B(e,n);if(!o)return;o.compressed&&m(e,o),k(e,o.id),p(e);let r=n-o.startLine;return o.lines[r]}function a(e,n,o){let r=performance.now(),t=Math.max(0,n),s=Math.min(e.totalLines,o);if(t>=s)return {lines:[],startLine:t,endLine:t,complete:true,loadTimeMs:performance.now()-r};let c=[],u=[];for(let i of e.chunks.values()){let l=i.startLine+i.lineCount;i.startLine>=s||l<=t||u.push(i);}u.sort((i,l)=>i.startLine-l.startLine);for(let i of u){i.compressed&&m(e,i),k(e,i.id);let l=Math.max(0,t-i.startLine),C=Math.min(i.lineCount,s-i.startLine);for(let d=l;d<C;d++){let h=i.lines[d];h&&c.push(h);}}return p(e),{lines:c,startLine:t,endLine:s,complete:c.length===s-t,loadTimeMs:performance.now()-r}}function v(e,n,o){return a(e,n,n+o)}function D(e,n,o=100){let r=Math.max(0,n-o),t=Math.min(e.totalLines,n+o);return a(e,r,t)}function w(e,n,o,r){let t=Math.max(0,Math.min(e.totalLines-r,n+o));return a(e,t,t+r)}function H(e,n){return a(e,0,n)}function P(e,n){let o=Math.max(0,e.totalLines-n);return a(e,o,e.totalLines)}function I(e){let n=0,o=0;for(let r of e.chunks.values())r.compressed?n++:o++;return {totalLines:e.totalLines,totalChunks:e.chunks.size,cachedChunks:o,compressedChunks:n,memoryBytes:e.memoryBytes,memoryMB:Math.round(e.memoryBytes/(1024*1024)*100)/100}}function U(e){return e.memoryBytes}function F(e,n){let o=n.split(`
|
|
2
|
+
`);M(e,o);}function Y(e,n=0,o){let r=o??e.totalLines;return a(e,n,r).lines.map(s=>s.text).join(`
|
|
3
|
+
`)}function N(e,n){if(e.totalLines<=n)return;let o=e.totalLines-n,r=0,t=[];for(let[s,c]of e.chunks){if(r>=o)break;t.push(s),r+=c.lineCount,e.memoryBytes-=c.memorySize;}for(let s of t){e.chunks.delete(s);let c=e.lruOrder.indexOf(s);c!==-1&&e.lruOrder.splice(c,1);}e.totalLines-=r;for(let s of e.chunks.values())s.startLine-=r;}function X(e,n=10){if(!e.config.enableCompression)return;let o=e.lruOrder.slice(0,-n);for(let r of o){let t=e.chunks.get(r);t&&!t.compressed&&y(e,t);}}function J(e){for(let n of e.chunks.values())n.compressed&&m(e,n);}export{R as a,T as b,E as c,_ as d,O as e,z as f,b as g,M as h,A as i,a as j,v as k,D as l,w as m,H as n,P as o,I as p,U as q,F as r,Y as s,N as t,X as u,J as v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function I(e,n,a){let t=e[n];return t!==void 0?t:a}function l(e=64){let n=Math.max(1,e);return {data:[],dataIndex:new Int32Array(n).fill(-1),id:new Int32Array(n).fill(-1),generations:new Uint32Array(n),size:0,capacity:n}}function x(e,n){let a=Math.max(n,e.capacity*2),t=new Int32Array(a);t.set(e.dataIndex),t.fill(-1,e.capacity);let c=new Int32Array(a);c.set(e.id),c.fill(-1,e.capacity);let i=new Uint32Array(a);i.set(e.generations),e.dataIndex=t,e.id=c,e.generations=i,e.capacity=a;}function T(e,n){let{data:a,dataIndex:t,id:c,generations:i}=e,d=I(c,e.size,-1);if(e.size<e.capacity&&d!==-1){let u=d,f=e.size;return a[f]=n,t[u]=f,c[f]=u,e.size++,{index:u,gen:I(i,u,0)}}e.size>=e.capacity&&x(e,e.size+1);let r=e.size,o=e.size;return a.push(n),e.dataIndex[r]=o,e.id[o]=r,e.size++,e.capacity=Math.max(e.capacity,e.size),{index:r,gen:I(i,r,0)}}function s(e,n){if(n.index<0||n.index>=e.capacity)return false;let a=e.generations[n.index];if(a===void 0||n.gen!==a)return false;let t=e.dataIndex[n.index];return t===void 0||t<0||t>=e.size?false:e.id[t]===n.index}function y(e,n){if(!s(e,n))return;let a=e.dataIndex[n.index];if(a!==void 0)return e.data[a]}function P(e,n,a){if(!s(e,n))return false;let t=e.dataIndex[n.index];return t===void 0?false:(e.data[t]=a,true)}function p(e,n){if(!s(e,n))return false;let{data:a,dataIndex:t,id:c,generations:i}=e,d=t[n.index];if(d===void 0)return false;let r=e.size-1;if(d!==r){let u=c[r],f=a[r];if(u===void 0||f===void 0)return false;a[d]=f,c[d]=u,t[u]=d,c[r]=n.index;}t[n.index]=-1;let o=i[n.index];return o!==void 0&&(i[n.index]=o+1),e.size--,true}function A(e){e.data.length=0,e.dataIndex.fill(-1),e.id.fill(-1),e.size=0;}function S(e,n){let{data:a,id:t,generations:c}=e;for(let i=0;i<e.size;i++){let d=t[i],r=a[i];d===void 0||r===void 0||n(r,{index:d,gen:I(c,d,0)});}}function g(e,n){let{data:a,id:t,generations:c}=e,i=[];for(let d=0;d<e.size;d++){let r=t[d],o=a[d];r===void 0||o===void 0||i.push(n(o,{index:r,gen:I(c,r,0)}));}return i}function k(e){return e.data}function D(e){return e.size}function N(e){return e.capacity}export{l as a,T as b,s as c,y as d,P as e,p as f,A as g,S as h,g as i,k as j,D as k,N as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {ja,J,N,p as p$1,q,V as V$1,b,k as k$1,d as d$1,f as f$1}from'./chunk-A6M6TFBL.js';import {f,e}from'./chunk-FCMTWFSE.js';import {g as g$1,$ as $$1,ja as ja$1,ka,ia}from'./chunk-ZAHG7Y3X.js';import {m as m$1,n}from'./chunk-Z4EZERNE.js';import {h as h$1}from'./chunk-G7GIWWLE.js';import {z}from'zod';var zt=1e4,ut=1,ft=2;function Yt(e=zt){return {isForm:new Uint8Array(e),flags:new Uint8Array(e)}}var d=Yt(),p=new Map,O=new Map,S=new Map,h=new Map;function Pe(){d.isForm.fill(0),d.flags.fill(0),p.clear(),O.clear(),S.clear(),h.clear();}function Ie(e,t,n={}){d.isForm[t]=1;let r=0;n.keys!==false&&(r|=ut),n.submitOnEnter!==false&&(r|=ft),d.flags[t]=r,p.set(t,new Map),O.set(t,new Map),g$1(e,t);}function dt(e,t){return d.isForm[t]===1}function $t(e){return (d.flags[e]&ut)!==0}function Xt(e){return (d.flags[e]&ft)!==0}function jt(e,t,n,r,o){if(!dt(e,t))return;let i=p.get(t),c=O.get(t);i&&c&&(i.set(n,r),o!==void 0?c.set(n,o):c.set(n,gt(e,n)));}function Me(e,t,n){let r=p.get(t),o=O.get(t);r&&r.delete(n),o&&o.delete(n);}function pt(e,t){let n=p.get(t);return n?Array.from(n.keys()):[]}function Be(e,t){return p.get(e)?.get(t)}function gt(e,t){return ja(e,t)?f(e,t)??"":J(e,t)?N(e,t):p$1(e,t)?q(e,t)==="pressed":f(e,t)??null}function qt(e$1,t,n){if(ja(e$1,t)){e(e$1,t,String(n??""));return}if(J(e$1,t)){V$1(e$1,t,!!n);return}n!==null&&e(e$1,t,String(n));}function Jt(e,t){let n={},r=p.get(t);if(!r)return n;for(let[o,i]of r)n[i]=gt(e,o);return n}function Oe(e,t){let n=O.get(t);if(!n)return;for(let[o,i]of n)qt(e,o,i);let r=h.get(t);if(r)for(let o of r)o();g$1(e,t);}function Qt(e,t){let n=Jt(e,t),r=S.get(t);if(r)for(let o of r)o(n);return n}function De(e,t){let n=S.get(e)??[];return n.push(t),S.set(e,n),()=>{let r=S.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function Te(e,t){let n=h.get(e)??[];return n.push(t),h.set(e,n),()=>{let r=h.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function we(e){S.delete(e),h.delete(e);}function Zt(e,t){let r=pt(e,t).filter(o=>$$1(e,o));return ja$1(e,r)}function te(e,t){let r=pt(e,t).filter(o=>$$1(e,o));return ka(e,r)}function Ve(e,t){let r=h$1(e,t).filter(o=>$$1(e,o));return ia(e,r)}function Le(e,t,n,r){return !dt(e,t)||!$t(t)?false:n==="tab"?(r?te(e,t):Zt(e,t),true):(n==="return"||n==="enter")&&Xt(t)?(Qt(e,t),true):false}function Ue(e,t,n="field_"){let r=h$1(e,t);for(let o of r)if(ja(e,o)||J(e,o)){let i=`${n}${o}`;jt(e,t,o,i);}}var ee=1e4,D={Horizontal:0,Vertical:1};function ne(e=ee){return {isProgressBar:new Uint8Array(e),value:new Float32Array(e),min:new Float32Array(e),max:new Float32Array(e),orientation:new Uint8Array(e),showPercentage:new Uint8Array(e)}}var a=ne(),yt="\u2588",mt="\u2591",xt="\u2588",bt="\u2591",T=new Map,E=new Map,F=new Map;function Ne(){a.isProgressBar.fill(0),a.value.fill(0),a.min.fill(0),a.max.fill(0),a.orientation.fill(0),a.showPercentage.fill(0),T.clear(),E.clear(),F.clear();}function Ge(e,t,n={}){a.isProgressBar[t]=1,a.min[t]=n.min??0,a.max[t]=n.max??100,a.value[t]=n.value??0,a.orientation[t]=n.orientation??D.Horizontal,a.showPercentage[t]=n.showPercentage?1:0,re(e,t,{}),g$1(e,t);}function Ke(e,t){return a.isProgressBar[t]===1}function ze(e,t){return a.value[t]}function Ye(e,t){return a.min[t]}function $e(e,t){return a.max[t]}function St(e,t){let n=a.min[t],r=a.max[t],o=a.value[t];return r===n?0:(o-n)/(r-n)*100}function Xe(e,t){return a.orientation[t]}function je(e,t){return a.showPercentage[t]===1}function w(e,t,n){let r=a.min[t],o=a.max[t],i=a.value[t],c=Math.max(r,Math.min(o,n));if(a.value[t]=c,g$1(e,t),c!==i){let f=St(e,t);ie(e,t,c,f),c===o&&i<o&&oe(e,t);}}function qe(e,t,n=1){let r=a.value[t];w(e,t,r+n);}function Je(e,t,n=1){let r=a.value[t];w(e,t,r-n);}function Qe(e,t){let n=a.min[t];w(e,t,n);}function Ze(e,t){let n=a.max[t];w(e,t,n);}function tn(e,t){let n=a.max[t];return a.value[t]>=n}function re(e,t,n){let r=T.get(t),o=a.orientation[t],i=o===D.Vertical?xt:yt,c=o===D.Vertical?bt:mt;T.set(t,{fillChar:n.fillChar??r?.fillChar??i,emptyChar:n.emptyChar??r?.emptyChar??c,fillFg:n.fillFg??r?.fillFg??16711935,fillBg:n.fillBg??r?.fillBg??255,emptyFg:n.emptyFg??r?.emptyFg??1717987071,emptyBg:n.emptyBg??r?.emptyBg??255});}function Z(e,t){let n=T.get(t);if(n)return n;let r=a.orientation[t],o=r===D.Vertical?xt:yt,i=r===D.Vertical?bt:mt;return {fillChar:o,emptyChar:i,fillFg:16711935,fillBg:255,emptyFg:1717987071,emptyBg:255}}function en(e,t){T.delete(t);}function nn(e,t){return Z(e,t).fillChar}function rn(e,t){return Z(e,t).emptyChar}function on(e,t,n){let r=St(e,t)/100,o=Z(e,t),i=Math.round(n*r),c=n-i;return o.fillChar.repeat(i)+o.emptyChar.repeat(c)}function ln(e,t,n){let r=E.get(t)??[];return r.push(n),E.set(t,r),()=>{let o=E.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function an(e,t,n){let r=F.get(t)??[];return r.push(n),F.set(t,r),()=>{let o=F.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function oe(e,t){let n=E.get(t);if(n)for(let r of n)r();}function ie(e,t,n,r){let o=F.get(t);if(o)for(let i of o)i(n,r);}function sn(e,t){E.delete(t),F.delete(t);}function cn(e,t,n){a.orientation[t]=n,g$1(e,t);}function un(e,t,n){a.showPercentage[t]=n?1:0,g$1(e,t);}function fn(e,t,n,r){a.min[t]=n,a.max[t]=r;let o=a.value[t];(o<n||o>r)&&w(e,t,Math.max(n,Math.min(r,o))),g$1(e,t);}var Et="\u25BC",Ft="\u25B2",Ct="\u25CF",vt=" ",Y=1e4,s={isSelect:new Uint8Array(Y),selectedIndex:new Int32Array(Y).fill(-1),highlightedIndex:new Int32Array(Y).fill(0),optionCount:new Uint32Array(Y)},g=new Map,V=new Map,C=new Map,v=new Map,W=new Map,le={initial:"closed",states:{closed:{on:{open:"open",toggle:"open",disable:"disabled"}},open:{on:{close:"closed",select:"closed",toggle:"closed",disable:"disabled"}},disabled:{on:{enable:"closed"}}}};function yn(e,t,n=[],r=-1){s.isSelect[t]=1,s.selectedIndex[t]=r,s.highlightedIndex[t]=r>=0?r:0,s.optionCount[t]=n.length,g.set(t,[...n]),b(e,t,le);}function Wt(e,t){return s.isSelect[t]===1&&k$1(e,t)}function $(e,t){return d$1(e,t)??"closed"}function At(e,t,n){return $(e,t)===n}function ae(e,t){return At(e,t,"open")}function se(e,t){return At(e,t,"disabled")}function ht(e,t){let n=t.get(e);if(n)for(let r of n)r();}function ce(e,t,n){t!=="open"&&n==="open"?ht(e,v):t==="open"&&n!=="open"&&ht(e,W);}function A(e,t,n){if(!Wt(e,t))return false;let r=$(e,t),o=f$1(e,t,n);if(o){let i=$(e,t);g$1(e,t),ce(t,r,i);}return o}function mn(e,t){return A(e,t,"open")}function xn(e,t){return A(e,t,"close")}function bn(e,t){return A(e,t,"toggle")}function Sn(e,t){return A(e,t,"disable")}function hn(e,t){return A(e,t,"enable")}function En(e,t){return g.get(t)??[]}function Fn(e,t,n){g.set(t,[...n]),s.optionCount[t]=n.length,(s.selectedIndex[t]??-1)>=n.length&&(s.selectedIndex[t]=n.length>0?0:-1),s.highlightedIndex[t]=0,g$1(e,t);}function Cn(e,t){return s.optionCount[t]??0}function ue(e,t,n){return g.get(t)?.[n]}function vn(e,t){return s.selectedIndex[t]??-1}function _t(e,t){let n=s.selectedIndex[t]??-1;if(!(n<0))return ue(e,t,n)}function Wn(e,t){return _t(e,t)?.value}function An(e,t){return _t(e,t)?.label}function kt(e,t,n){let r=g.get(t);if(!r||n<0||n>=r.length||(s.selectedIndex[t]??-1)===n)return false;s.selectedIndex[t]=n,s.highlightedIndex[t]=n,g$1(e,t);let i=r[n],c=C.get(t);if(c&&i)for(let f of c)f(i.value,i.label,n);return A(e,t,"select"),true}function _n(e,t,n){let r=g.get(t);if(!r)return false;let o=r.findIndex(i=>i.value===n);return o<0?false:kt(e,t,o)}function kn(e,t){s.selectedIndex[t]=-1,g$1(e,t);}function fe(e,t){return s.highlightedIndex[t]??0}function Pt(e,t,n){let r=s.optionCount[t]??0;if(r===0)return;let o=Math.max(0,Math.min(n,r-1));s.highlightedIndex[t]=o,g$1(e,t);}function Pn(e,t,n=true){let r=s.optionCount[t]??0;if(r===0)return;let o=(s.highlightedIndex[t]??0)+1;o>=r&&(o=n?0:r-1),Pt(e,t,o);}function In(e,t,n=true){let r=s.optionCount[t]??0;if(r===0)return;let o=(s.highlightedIndex[t]??0)-1;o<0&&(o=n?r-1:0),Pt(e,t,o);}function Mn(e,t){let n=s.highlightedIndex[t]??0;return kt(e,t,n)}function Bn(e,t,n){let r=V.get(t);V.set(t,{closedIndicator:n.closedIndicator??r?.closedIndicator??Et,openIndicator:n.openIndicator??r?.openIndicator??Ft,selectedMark:n.selectedMark??r?.selectedMark??Ct,separator:n.separator??r?.separator??vt});}function de(e,t){return V.get(t)??{closedIndicator:Et,openIndicator:Ft,selectedMark:Ct,separator:vt}}function On(e,t){V.delete(t);}function Dn(e,t){let n=de(e,t);return $(e,t)==="open"?n.openIndicator:n.closedIndicator}function Tn(e,t,n){let r=C.get(t)??[];return r.push(n),C.set(t,r),()=>{let o=C.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function wn(e,t,n){let r=v.get(t)??[];return r.push(n),v.set(t,r),()=>{let o=v.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Vn(e,t,n){let r=W.get(t)??[];return r.push(n),W.set(t,r),()=>{let o=W.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Ln(e,t){C.delete(t),v.delete(t),W.delete(t);}function Un(e,t,n){if(!Wt(e,t)||se(e,t))return null;let r=ae(e,t);switch(n){case "return":case "enter":case "space":return r?{type:"select",index:fe(e,t)}:{type:"open"};case "escape":return r?{type:"close"}:null;case "up":return r?{type:"highlightPrev"}:{type:"open"};case "down":return r?{type:"highlightNext"}:{type:"open"};case "home":return r?{type:"highlightFirst"}:null;case "end":return r?{type:"highlightLast"}:null;default:return null}}function Rn(){s.isSelect.fill(0),s.selectedIndex.fill(-1),s.highlightedIndex.fill(0),s.optionCount.fill(0),g.clear(),V.clear(),C.clear(),v.clear(),W.clear();}var m={Horizontal:0,Vertical:1},Mt="\u2500",Bt="\u2502",Ot="\u25CF",Dt="\u2501",Tt="\u2503",wt=1717987071,Vt=255,Lt=4294967295,Ut=6750207,Rt=16711935,Ht=255,y=1e4,l={isSlider:new Uint8Array(y),value:new Float32Array(y),min:new Float32Array(y),max:new Float32Array(y).fill(100),step:new Float32Array(y).fill(1),orientation:new Uint8Array(y),showValue:new Uint8Array(y)},L=new Map,_=new Map,k=new Map,P=new Map,ge={initial:"idle",states:{idle:{on:{focus:"focused",disable:"disabled"}},focused:{on:{blur:"idle",dragStart:"dragging",disable:"disabled"}},dragging:{on:{dragEnd:"focused",blur:"idle",disable:"disabled"}},disabled:{on:{enable:"idle"}}}};function Yn(e,t,n=0,r=100,o=0,i=1){l.isSlider[t]=1,l.min[t]=n,l.max[t]=r,l.value[t]=tt(o,n,r),l.step[t]=i,l.orientation[t]=m.Horizontal,l.showValue[t]=0,b(e,t,ge);}function tt(e,t,n){return Math.max(t,Math.min(n,e))}function Nt(e,t,n){return t<=0?e:n+Math.round((e-n)/t)*t}function Gt(e,t){return l.isSlider[t]===1&&k$1(e,t)}function X(e,t){return d$1(e,t)??"idle"}function Kt(e,t,n){return X(e,t)===n}function $n(e,t){let n=X(e,t);return n==="focused"||n==="dragging"}function Xn(e,t){return Kt(e,t,"dragging")}function ye(e,t){return Kt(e,t,"disabled")}function It(e,t){let n=t.get(e);if(n)for(let r of n)r();}function me(e,t,n){t!=="dragging"&&n==="dragging"?It(e,k):t==="dragging"&&n!=="dragging"&&It(e,P);}function I(e,t,n){if(!Gt(e,t))return false;let r=X(e,t),o=f$1(e,t,n);if(o){let i=X(e,t);g$1(e,t),me(t,r,i);}return o}function jn(e,t){return I(e,t,"focus")}function qn(e,t){return I(e,t,"blur")}function Jn(e,t){return I(e,t,"dragStart")}function Qn(e,t){return I(e,t,"dragEnd")}function Zn(e,t){return I(e,t,"disable")}function tr(e,t){return I(e,t,"enable")}function xe(e,t){return l.value[t]??0}function x(e,t,n){let r=l.min[t]??0,o=l.max[t]??100,i=l.step[t]??1,c=tt(Nt(n,i,r),r,o),f=l.value[t]??0;if(c!==f){l.value[t]=c,g$1(e,t);let M=_.get(t);if(M)for(let b of M)b(c);}}function er(e,t){return l.min[t]??0}function nr(e,t){return l.max[t]??100}function rr(e,t){return l.step[t]??1}function or(e,t,n,r){m$1.parse({min:n,max:r}),l.min[t]=n,l.max[t]=r;let o=l.value[t]??0,i=tt(o,n,r);i!==o&&x(e,t,i),g$1(e,t);}function ir(e,t,n$1){n.parse(n$1),l.step[t]=n$1;let r=l.value[t]??0,o=l.min[t]??0,i=Nt(r,n$1,o);i!==r&&x(e,t,i),g$1(e,t);}function be(e,t){let n=l.min[t]??0,r=l.max[t]??100,o=l.value[t]??0;return r===n?0:(o-n)/(r-n)}function lr(e,t,n){z.number().finite().parse(n);let r=l.min[t]??0,o=l.max[t]??100,i=Math.max(0,Math.min(1,n)),c=r+i*(o-r);x(e,t,c);}function ar(e,t,n=1){let r=l.step[t]??1,o=l.value[t]??0;x(e,t,o+r*n);}function sr(e,t,n=1){let r=l.step[t]??1,o=l.value[t]??0;x(e,t,o-r*n);}function cr(e,t){x(e,t,l.min[t]??0);}function ur(e,t){x(e,t,l.max[t]??100);}function j(e,t){return l.orientation[t]}function fr(e,t,n){l.orientation[t]=n,g$1(e,t);}function Se(e,t){return j(e,t)===m.Horizontal}function dr(e,t){return j(e,t)===m.Vertical}function he(e,t){return l.showValue[t]===1}function pr(e,t,n){l.showValue[t]=n?1:0,g$1(e,t);}function gr(e,t,n){let r=L.get(t),o=j(e,t),i=o===m.Vertical?Bt:Mt,c=o===m.Vertical?Tt:Dt;L.set(t,{trackChar:n.trackChar??r?.trackChar??i,thumbChar:n.thumbChar??r?.thumbChar??Ot,fillChar:n.fillChar??r?.fillChar??c,trackFg:n.trackFg??r?.trackFg??wt,trackBg:n.trackBg??r?.trackBg??Vt,thumbFg:n.thumbFg??r?.thumbFg??Lt,thumbBg:n.thumbBg??r?.thumbBg??Ut,fillFg:n.fillFg??r?.fillFg??Rt,fillBg:n.fillBg??r?.fillBg??Ht});}function Ee(e,t){let n=j(e,t),r=n===m.Vertical?Bt:Mt,o=n===m.Vertical?Tt:Dt;return L.get(t)??{trackChar:r,thumbChar:Ot,fillChar:o,trackFg:wt,trackBg:Vt,thumbFg:Lt,thumbBg:Ut,fillFg:Rt,fillBg:Ht}}function yr(e,t){L.delete(t);}function mr(e,t,n){let r=_.get(t)??[];return r.push(n),_.set(t,r),()=>{let o=_.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function xr(e,t,n){let r=k.get(t)??[];return r.push(n),k.set(t,r),()=>{let o=k.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function br(e,t,n){let r=P.get(t)??[];return r.push(n),P.set(t,r),()=>{let o=P.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Sr(e,t){_.delete(t),k.delete(t),P.delete(t);}function hr(e,t,n){if(!Gt(e,t)||ye(e,t))return null;let r=Se(e,t);switch(n){case "right":return r?{type:"increment",multiplier:1}:null;case "left":return r?{type:"decrement",multiplier:1}:null;case "up":return r?null:{type:"increment",multiplier:1};case "down":return r?null:{type:"decrement",multiplier:1};case "pageup":return {type:"increment",multiplier:10};case "pagedown":return {type:"decrement",multiplier:10};case "home":return {type:"toMin"};case "end":return {type:"toMax"};default:return null}}function Er(e,t,n){if(n<=0)return "";let r=be(e,t),o=Ee(e,t),i=he(e,t),c="",f=n;i&&(c=` ${xe(e,t)}`,f=Math.max(1,n-c.length));let M=Math.round(r*(f-1)),b="";for(let B=0;B<f;B++)B===M?b+=o.thumbChar:B<M?b+=o.fillChar:b+=o.trackChar;return b+c}function Fr(){l.isSlider.fill(0),l.value.fill(0),l.min.fill(0),l.max.fill(100),l.step.fill(1),l.orientation.fill(0),l.showValue.fill(0),L.clear(),_.clear(),k.clear(),P.clear();}export{cn as $,Vt as $a,mt as A,Wn as Aa,ir as Ab,xt as B,An as Ba,be as Bb,bt as C,kt as Ca,lr as Cb,Ne as D,_n as Da,ar as Db,Ge as E,kn as Ea,sr as Eb,Ke as F,fe as Fa,cr as Fb,ze as G,Pt as Ga,ur as Gb,Ye as H,Pn as Ha,j as Hb,$e as I,In as Ia,fr as Ib,St as J,Mn as Ja,Se as Jb,Xe as K,Bn as Ka,dr as Kb,je as L,de as La,he as Lb,w as M,On as Ma,pr as Mb,qe as N,Dn as Na,gr as Nb,Je as O,Tn as Oa,Ee as Ob,Qe as P,wn as Pa,yr as Pb,Ze as Q,Vn as Qa,mr as Qb,tn as R,Ln as Ra,xr as Rb,re as S,Un as Sa,br as Sb,Z as T,Rn as Ta,Sr as Tb,en as U,m as Ua,hr as Ub,nn as V,Mt as Va,Er as Vb,rn as W,Bt as Wa,Fr as Wb,on as X,Ot as Xa,ln as Y,Dt as Ya,an as Z,Tt as Za,sn as _,wt as _a,d as a,un as aa,Lt as ab,Pe as b,fn as ba,Ut as bb,Ie as c,Et as ca,Rt as cb,dt as d,Ft as da,Ht as db,$t as e,Ct as ea,l as eb,Xt as f,vt as fa,ge as fb,jt as g,s as ga,Yn as gb,Me as h,le as ha,Gt as hb,pt as i,yn as ia,X as ib,Be as j,Wt as ja,Kt as jb,gt as k,$ as ka,$n as kb,qt as l,At as la,Xn as lb,Jt as m,ae as ma,ye as mb,Oe as n,se as na,I as nb,Qt as o,A as oa,jn as ob,De as p,mn as pa,qn as pb,Te as q,xn as qa,Jn as qb,we as r,bn as ra,Qn as rb,Zt as s,Sn as sa,Zn as sb,te as t,hn as ta,tr as tb,Ve as u,En as ua,xe as ub,Le as v,Fn as va,x as vb,Ue as w,Cn as wa,er as wb,D as x,ue as xa,nr as xb,a as y,vn as ya,rr as yb,yt as z,_t as za,or as zb};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {u,b as b$1,c as c$1,d,e}from'./chunk-DYU72XLL.js';import {f}from'./chunk-SHUC6JWA.js';import {c}from'./chunk-5PELJRUQ.js';import {z as z$1}from'zod';import*as On from'fs';import*as L from'path';u();function _(e){return {topLeft:String.fromCodePoint(e.topLeft),topRight:String.fromCodePoint(e.topRight),bottomLeft:String.fromCodePoint(e.bottomLeft),bottomRight:String.fromCodePoint(e.bottomRight),horizontal:String.fromCodePoint(e.horizontal),vertical:String.fromCodePoint(e.vertical)}}var Lr=_(b$1),kr=_(c$1),Tr=_(d),Rr=_(e),Ar={topLeft:"+",topRight:"+",bottomLeft:"+",bottomRight:"+",horizontal:"-",vertical:"|"},wr={topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u254C",vertical:"\u254E"};function Er(e,t,n=4294967295,r=0){let o=[];for(let i=0;i<t;i++){let a=[];for(let l=0;l<e;l++)a.push({char:" ",fg:n,bg:r});o.push(a);}return {width:e,height:t,cells:o,setCell(i,a,l,s,u){if(i<0||i>=e||a<0||a>=t)return;let d=o[a]?.[i];d&&(d.char=l,s!==void 0&&(d.fg=s),u!==void 0&&(d.bg=u));}}}function Wr(e,t,n,r,o,i,a,l,s,u){e.setCell(t,n,l.topLeft,s,u),i>1&&e.setCell(r,n,l.topRight,s,u),a>1&&e.setCell(t,o,l.bottomLeft,s,u),i>1&&a>1&&e.setCell(r,o,l.bottomRight,s,u);}function Mr(e,t,n,r,o,i,a,l,s,u){for(let d=t+1;d<r;d++)e.setCell(d,n,l.horizontal,s,u),a>1&&e.setCell(d,o,l.horizontal,s,u);for(let d=n+1;d<o;d++)e.setCell(t,d,l.vertical,s,u),i>1&&e.setCell(r,d,l.vertical,s,u);}function Ir(e,t,n,r,o,i,a={}){let{fg:l,bg:s,fill:u=false,fillChar:d=" "}=a;if(r<1||o<1)return;let f=t+r-1,c=n+o-1;Wr(e,t,n,f,c,r,o,i,l,s),Mr(e,t,n,f,c,r,o,i,l,s),u&&r>2&&o>2&&kt(e,t+1,n+1,r-2,o-2,d,l,s);}function Dr(e,t,n,r,o="\u2500",i,a){for(let l=0;l<r;l++)e.setCell(t+l,n,o,i,a);}function vr(e,t,n,r,o="\u2502",i,a){for(let l=0;l<r;l++)e.setCell(t,n+l,o,i,a);}function kt(e,t,n,r,o,i=" ",a,l){for(let s=0;s<o;s++)for(let u=0;u<r;u++)e.setCell(t+u,n+s,i,a,l);}function Br(e,t,n,r,o,i){for(let a=0;a<r.length;a++){let l=r[a];l!==void 0&&e.setCell(t+a,n,l,o,i);}}function Pr(e){let t=[];for(let n=0;n<e.height;n++){let r="";for(let o=0;o<e.width;o++)r+=e.cells[n]?.[o]?.char??" ";t.push(r);}return t.join(`
|
|
2
|
+
`)}var _r={maxDelayMs:16,maxBatchSize:100,immediateCursor:true};function Fr(e,t){return {config:{..._r,...t},pending:[],flushCallback:e,flushTimer:null,totalProcessed:0,totalFlushes:0}}function Or(e,t){if(e.pending.push(t),e.pending.length>=e.config.maxBatchSize){X(e);return}e.flushTimer||(e.flushTimer=setTimeout(()=>{X(e);},e.config.maxDelayMs));}function X(e){if(e.flushTimer&&(clearTimeout(e.flushTimer),e.flushTimer=null),e.pending.length===0)return;let t=[...e.pending];e.pending=[];let n=Vr(t),r=t.length>1?(t[t.length-1]?.timestamp??0)-(t[0]?.timestamp??0):0,o={dirtyRegion:n,changeCount:t.length,timeSpanMs:r,changes:t};return e.totalProcessed+=t.length,e.totalFlushes++,e.flushCallback&&e.flushCallback(o),o}function Nr(e){return {config:e.config,pendingCount:e.pending.length,flushScheduled:e.flushTimer!==null,totalProcessed:e.totalProcessed,totalFlushes:e.totalFlushes,avgChangesPerFlush:e.totalFlushes>0?e.totalProcessed/e.totalFlushes:0}}function Hr(e,t,n){return {startLine:e,startColumn:t,endLine:e,endColumn:t,text:n,timestamp:Date.now()}}function Gr(e,t,n,r){return {startLine:e,startColumn:t,endLine:n,endColumn:r,text:"",timestamp:Date.now()}}function zr(e,t,n,r,o){return {startLine:e,startColumn:t,endLine:n,endColumn:r,text:o,timestamp:Date.now()}}function Ur(e){let t=X(e);return e.flushCallback=null,t}function Vr(e){if(e.length===0)return {startLine:0,endLine:0,lineCountChanged:false,lineDelta:0};let t=Number.POSITIVE_INFINITY,n=0,r=0;for(let o of e){t=Math.min(t,o.startLine),n=Math.max(n,o.endLine);let i=0;for(let l=0;l<o.text.length;l++)o.text[l]===`
|
|
3
|
+
`&&i++;let a=o.endLine-o.startLine;r+=i-a,n=Math.max(n,o.startLine+i);}return {startLine:t===Number.POSITIVE_INFINITY?0:t,endLine:n,lineCountChanged:r!==0,lineDelta:r}}f();var J={scrollPadding:5,horizontalPadding:5,lineWrap:true,tabWidth:4};function jr(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
4
|
+
`&&t.push(n+1);return {offsets:t,lineCount:t.length}}function $r(e){let t=[0],n=0;for(let r=0;r<e.length-1;r++)n+=e[r]??0,t.push(n);return {offsets:t,lineCount:e.length}}function Zr(e,t){let n=e.offsets,r=0,o=n.length-1;for(;r<=o;){let i=r+o>>>1;(n[i]??0)<=t?r=i+1:o=i-1;}return Math.max(0,r-1)}function Kr(e,t){return t<0||t>=e.lineCount?-1:e.offsets[t]??-1}function Y(e=0,t=0){return {line:Math.max(0,e),column:Math.max(0,t)}}function qr(e=0,t=24,n=0,r=80){return {topLine:Math.max(0,e),height:Math.max(1,t),leftColumn:Math.max(0,n),width:Math.max(1,r)}}function Xr(e){return {...J,...e}}function M(e,t,n,r){let o={...J,...r},{topLine:i,leftColumn:a}=t,l=false,s=e.line-t.height+1+o.scrollPadding,u=e.line-o.scrollPadding;i>u&&(i=Math.max(0,u),l=true),i<s&&(i=Math.min(Math.max(0,n-t.height),Math.max(0,s)),l=true);let d=e.column-t.width+1+o.horizontalPadding,f=e.column-o.horizontalPadding;return a>f&&(a=Math.max(0,f),l=true),a<d&&(a=Math.max(0,d),l=true),l?{viewport:{...t,topLine:i,leftColumn:a},scrolled:true}:{viewport:t,scrolled:false}}function Ae(e,t,n){let r=Math.max(0,Math.min(e.line,t-1)),o=r<t?n(r):0,i=Math.max(0,Math.min(e.column,o));return {line:r,column:i}}function Tt(e,t,n,r,o){let i=Y(e.line-t,e.column),a=Ae(i,r,()=>e.column),{viewport:l,scrolled:s}=M(a,n,r,o);return {cursor:a,viewport:l,scrolled:s}}function Rt(e,t,n,r,o){let i=Y(e.line+t,e.column),a=Ae(i,r,()=>e.column),{viewport:l,scrolled:s}=M(a,n,r,o);return {cursor:a,viewport:l,scrolled:s}}function we(e,t,n,r){let o=Math.max(0,Math.min(e,n-1)),i=Y(o,0),{viewport:a,scrolled:l}=M(i,t,n,r);return {cursor:i,viewport:a,scrolled:l}}function Jr(e,t,n,r){return Tt(e,t.height-1,t,n,r)}function Yr(e,t,n,r){return Rt(e,t.height-1,t,n,r)}function Qr(e,t,n){return we(0,e,t,n)}function eo(e,t,n){return we(t-1,e,t,n)}function to(e,t,n,r,o,i){let a={...J,...i},{line:l,column:s}=e;s-=t,s<0&&a.lineWrap&&l>0?(l--,s=o(l)):s=Math.max(0,s);let u={line:l,column:s},{viewport:d,scrolled:f}=M(u,n,r,i);return {cursor:u,viewport:d,scrolled:f}}function no(e,t,n,r,o,i){let a={...J,...i},{line:l,column:s}=e,u=o(l);s+=t,s>u&&a.lineWrap&&l<r-1?(l++,s=0):s=Math.min(s,u);let d={line:l,column:s},{viewport:f,scrolled:c}=M(d,n,r,i);return {cursor:d,viewport:f,scrolled:c}}var ro=3,oo=10;function At(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r|0;}return t}function io(e,t){let n=e.length,r=t.length,o=n+r,i=ko(e,t);if(i)return i;let a=To(e,t,o);return ao(a.trace,e,t,a.offset)}function ao(e,t,n,r){let o=[],i=t.length,a=n.length;for(let l=e.length-1;l>=0;l--){let s=e[l]??[],u=i-a,d=wo(u,l,s,r),f=s[d+r]??0,c=f-d,m=Eo(o,t,i,a,f,c);i=m.x,a=m.y;let h=Wo(o,t,n,l,i,a,f);i=h.x,a=h.y;}return o}function lo(e,t){let n=e.length,r=t.length,o=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let i=1;i<=n;i++){let a=o[i];if(a)for(let l=1;l<=r;l++)e[i-1]===t[l-1]?a[l]=(o[i-1]?.[l-1]??0)+1:a[l]=Math.max(o[i-1]?.[l]??0,a[l-1]??0);}return o}function so(e,t,n){let r=[],o=t.length,i=n.length,a=[];for(;o>0||i>0;){let l=Po(e,t,n,o,i);a.unshift(l.op),o=l.nextI,i=l.nextJ;}for(let l of a)r.push({type:l.type,content:l.line,oldLineNo:l.oldNo,newLineNo:l.newNo});return r}function uo(e,t){let n=e.length,r=t.length;if(n>100||r>100)return io(e,t);let o=lo(e,t);return so(o,e,t)}function fo(e,t,n){if(e.length===0)return [];let r=[],o=[],i=0,a=1,l=1,s=0,u=0;function d(){if(o.length===0)return;let f=o.filter(m=>m.type==="remove"||m.type==="context").length,c=o.filter(m=>m.type==="add"||m.type==="context").length;r.push({id:i++,oldStart:a,oldCount:f,newStart:l,newCount:c,lines:o,collapsed:false,contextBefore:u,contextAfter:s}),a+=f,l+=c,o=[],u=0;}for(let f of e)if(f.type==="context")if(s++,s>t*2+n){let c=o.slice(-t);o=o.slice(0,-t),o.length>0&&(s=t,d()),o=[...c,f],u=c.length+1,s=1;}else o.push(f);else s=0,o.push(f);return d(),r}function Wt(e,t,n={}){let r=performance.now(),o=n.contextLines??3,i=n.collapseThreshold??10,{oldLines:a,newLines:l}=Mo(e,t),s=uo(a,l),u=fo(s,o,i);n.initiallyCollapsed&&Io(u);let d=Do(s);return {chunks:u,additions:d.additions,deletions:d.deletions,contextLines:d.contextLines,computeTimeMs:performance.now()-r}}function co(){return {oldHash:0,newHash:0,result:null,expandedChunks:new Set}}function mo(e){e.oldHash=0,e.newHash=0,e.result=null,e.expandedChunks.clear();}function ho(e,t,n,r={}){let o=At(t),i=At(n);if(e.oldHash===o&&e.newHash===i&&e.result)return e.result;let a=Wt(t,n,r);e.oldHash=o,e.newHash=i,e.result=a;for(let l of a.chunks)e.expandedChunks.has(l.id)&&(l.collapsed=false);return a}function Mt(e,t,n){let r=t.chunks.find(o=>o.id===n);r&&(r.collapsed=false,e.expandedChunks.add(n));}function It(e,t,n){let r=t.chunks.find(o=>o.id===n);r&&(r.collapsed=true,e.expandedChunks.delete(n));}function go(e,t,n){let r=t.chunks.find(o=>o.id===n);return r?r.collapsed?(Mt(e,t,n),false):(It(e,t,n),true):false}function po(e,t){for(let n of t.chunks)n.collapsed=false,e.expandedChunks.add(n.id);}function bo(e,t){for(let n of t.chunks)n.lines.some(o=>o.type==="add"||o.type==="remove")||(n.collapsed=true,e.expandedChunks.delete(n.id));}function xo(e,t,n){let r=[];for(let l of e.chunks)if(l.collapsed)r.push({line:{type:"header",content:`... ${l.lines.length} lines hidden ...`},chunkId:l.id,collapsed:true});else for(let s of l.lines)r.push({line:s,chunkId:l.id,collapsed:false});let o=Math.max(0,t),i=Math.min(r.length,t+n),a=r.slice(o,i);return {lines:a.map(l=>l.line),startIndex:o,totalLines:r.length,chunkInfo:a.map(l=>({chunkId:l.chunkId,collapsed:l.collapsed}))}}function yo(e){let t=0;for(let n of e.chunks)n.collapsed?t+=1:t+=n.lines.length;return t}function Co(e,t,n){let r=vo(e),o=Math.max(0,t),i=Math.min(r.length,t+n);return r.slice(o,i)}function So(e,t="a",n="b"){let r=[];r.push(`--- ${t}`),r.push(`+++ ${n}`);for(let o of e.chunks){r.push(`@@ -${o.oldStart},${o.oldCount} +${o.newStart},${o.newCount} @@`);for(let i of o.lines){let a=i.type==="add"?"+":i.type==="remove"?"-":" ";r.push(a+i.content);}}return r.join(`
|
|
5
|
+
`)}function Lo(e){let t=performance.now(),n=e.split(`
|
|
6
|
+
`),r=[],o=null,i=[],a=0,l=0,s=0,u=0,d=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;for(let f of n){if(f.startsWith("---")||f.startsWith("+++"))continue;let c=d.exec(f);if(c){let h=Bo(c,a);a+=1;let g=Et(r,o,i);o=h,i=g;continue}if(!o)continue;let m=_o(f);m&&(i.push(m.line),l+=m.additions,s+=m.deletions,u+=m.contextLines);}return Et(r,o,i),{chunks:r,additions:l,deletions:s,contextLines:u,computeTimeMs:performance.now()-t}}function ko(e,t){let n=e.length,r=t.length;return n===0&&r===0?[]:n===0?t.map((o,i)=>({type:"add",content:o,newLineNo:i+1})):r===0?e.map((o,i)=>({type:"remove",content:o,oldLineNo:i+1})):null}function To(e,t,n){let r=e.length,o=t.length,i=2*n+1,a=new Array(i).fill(0),l=n,s=[];e:for(let u=0;u<=n;u++){s.push(a.slice());for(let d=-u;d<=u;d+=2){let f=Ro(a,d,u,l),c=Ao(e,t,f,d);if(a[d+l]=c.x,c.x>=r&&c.y>=o)break e}}return {trace:s,offset:l}}function Ro(e,t,n,r){return t===-n||t!==n&&(e[t-1+r]??0)<(e[t+1+r]??0)?e[t+1+r]??0:(e[t-1+r]??0)+1}function Ao(e,t,n,r){let o=n,i=o-r;for(;o<e.length&&i<t.length&&e[o]===t[i];)o++,i++;return {x:o,y:i}}function wo(e,t,n,r){return e===-t||e!==t&&(n[e-1+r]??0)<(n[e+1+r]??0)?e+1:e-1}function Eo(e,t,n,r,o,i){let a=n,l=r;for(;a>o&&l>i;)a--,l--,e.unshift({type:"context",content:t[a]??"",oldLineNo:a+1,newLineNo:l+1});return {x:a,y:l}}function Wo(e,t,n,r,o,i,a){if(r<=0)return {x:o,y:i};if(o===a){let s=i-1;return e.unshift({type:"add",content:n[s]??"",newLineNo:s+1}),{x:o,y:s}}let l=o-1;return e.unshift({type:"remove",content:t[l]??"",oldLineNo:l+1}),{x:l,y:i}}function Mo(e,t){return {oldLines:e===""?[]:e.split(`
|
|
7
|
+
`),newLines:t===""?[]:t.split(`
|
|
8
|
+
`)}}function Io(e){for(let t of e)t.lines.some(r=>r.type==="add"||r.type==="remove")||(t.collapsed=true);}function Do(e){let t=0,n=0,r=0;for(let o of e)o.type==="add"?t++:o.type==="remove"?n++:o.type==="context"&&r++;return {additions:t,deletions:n,contextLines:r}}function vo(e){let t=[];for(let n of e.chunks){if(n.collapsed){t.push({left:void 0,right:void 0});continue}let r=[],o=[];for(let i of n.lines){if(i.type==="context"){wt(t,r,o),t.push({left:Q(i,"context","left"),right:Q(i,"context","right")});continue}if(i.type==="remove"){r.push(i);continue}i.type==="add"&&o.push(i);}wt(t,r,o);}return t}function wt(e,t,n){for(;t.length>0||n.length>0;){let r=t.shift(),o=n.shift();e.push({left:r?Q(r,"remove","left"):void 0,right:o?Q(o,"add","right"):void 0});}}function Q(e,t,n){return {lineNo:(n==="left"?e.oldLineNo:e.newLineNo)??0,content:e.content,type:t}}function Bo(e,t){return {id:t,oldStart:parseInt(e[1]??"0",10),oldCount:parseInt(e[2]??"1",10),newStart:parseInt(e[3]??"0",10),newCount:parseInt(e[4]??"1",10),lines:[],collapsed:false,contextBefore:0,contextAfter:0}}function Po(e,t,n,r,o){let i=r>0?t[r-1]:void 0,a=o>0?n[o-1]:void 0;return i!==void 0&&a!==void 0&&i===a?{op:{type:"context",line:i,oldNo:r,newNo:o},nextI:r-1,nextJ:o-1}:a!==void 0&&(r===0||(e[r]?.[o-1]??0)>=(e[r-1]?.[o]??0))?{op:{type:"add",line:a,newNo:o},nextI:r,nextJ:o-1}:{op:{type:"remove",line:i??"",oldNo:r},nextI:r-1,nextJ:o}}function Et(e,t,n){return !t||n.length===0?n:(e.push({...t,lines:n}),[])}function _o(e){return e.startsWith("+")?{line:{type:"add",content:e.slice(1)},additions:1,deletions:0,contextLines:0}:e.startsWith("-")?{line:{type:"remove",content:e.slice(1)},additions:0,deletions:1,contextLines:0}:e.startsWith(" ")?{line:{type:"context",content:e.slice(1)},additions:0,deletions:0,contextLines:1}:null}function Fo(e){return {additions:e.additions,deletions:e.deletions,totalChanges:e.additions+e.deletions,chunks:e.chunks.length,collapsedChunks:e.chunks.filter(t=>t.collapsed).length}}var Nt={};c(Nt,{CP1252_HIGH_BYTES:()=>Ie,CP437_CONTROL_CHARS:()=>F,CP437_HIGH_BYTES:()=>Ee,CP850_HIGH_BYTES:()=>We,CP866_HIGH_BYTES:()=>Me,CodePageSchema:()=>C,ConversionOptionsSchema:()=>Oo,UnmappableModeSchema:()=>Bt,bufferToString:()=>zo,byteToChar:()=>ve,charToByte:()=>Go,getCodePageMap:()=>$o,getSupportedCodePages:()=>jo,isCodePageSupported:()=>Vo,stringToBuffer:()=>Uo});var Ee=["\xC7","\xFC","\xE9","\xE2","\xE4","\xE0","\xE5","\xE7","\xEA","\xEB","\xE8","\xEF","\xEE","\xEC","\xC4","\xC5","\xC9","\xE6","\xC6","\xF4","\xF6","\xF2","\xFB","\xF9","\xFF","\xD6","\xDC","\xA2","\xA3","\xA5","\u20A7","\u0192","\xE1","\xED","\xF3","\xFA","\xF1","\xD1","\xAA","\xBA","\xBF","\u2310","\xAC","\xBD","\xBC","\xA1","\xAB","\xBB","\u2591","\u2592","\u2593","\u2502","\u2524","\u2561","\u2562","\u2556","\u2555","\u2563","\u2551","\u2557","\u255D","\u255C","\u255B","\u2510","\u2514","\u2534","\u252C","\u251C","\u2500","\u253C","\u255E","\u255F","\u255A","\u2554","\u2569","\u2566","\u2560","\u2550","\u256C","\u2567","\u2568","\u2564","\u2565","\u2559","\u2558","\u2552","\u2553","\u256B","\u256A","\u2518","\u250C","\u2588","\u2584","\u258C","\u2590","\u2580","\u03B1","\xDF","\u0393","\u03C0","\u03A3","\u03C3","\xB5","\u03C4","\u03A6","\u0398","\u03A9","\u03B4","\u221E","\u03C6","\u03B5","\u2229","\u2261","\xB1","\u2265","\u2264","\u2320","\u2321","\xF7","\u2248","\xB0","\u2219","\xB7","\u221A","\u207F","\xB2","\u25A0","\xA0"],F=["\0","\u263A","\u263B","\u2665","\u2666","\u2663","\u2660","\u2022","\u25D8","\u25CB","\u25D9","\u2642","\u2640","\u266A","\u266B","\u263C","\u25BA","\u25C4","\u2195","\u203C","\xB6","\xA7","\u25AC","\u21A8","\u2191","\u2193","\u2192","\u2190","\u221F","\u2194","\u25B2","\u25BC"],We=["\xC7","\xFC","\xE9","\xE2","\xE4","\xE0","\xE5","\xE7","\xEA","\xEB","\xE8","\xEF","\xEE","\xEC","\xC4","\xC5","\xC9","\xE6","\xC6","\xF4","\xF6","\xF2","\xFB","\xF9","\xFF","\xD6","\xDC","\xF8","\xA3","\xD8","\xD7","\u0192","\xE1","\xED","\xF3","\xFA","\xF1","\xD1","\xAA","\xBA","\xBF","\xAE","\xAC","\xBD","\xBC","\xA1","\xAB","\xBB","\u2591","\u2592","\u2593","\u2502","\u2524","\xC1","\xC2","\xC0","\xA9","\u2563","\u2551","\u2557","\u255D","\xA2","\xA5","\u2510","\u2514","\u2534","\u252C","\u251C","\u2500","\u253C","\xE3","\xC3","\u255A","\u2554","\u2569","\u2566","\u2560","\u2550","\u256C","\xA4","\xF0","\xD0","\xCA","\xCB","\xC8","\u0131","\xCD","\xCE","\xCF","\u2518","\u250C","\u2588","\u2584","\xA6","\xCC","\u2580","\xD3","\xDF","\xD4","\xD2","\xF5","\xD5","\xB5","\xFE","\xDE","\xDA","\xDB","\xD9","\xFD","\xDD","\xAF","\xB4","\xAD","\xB1","\u2017","\xBE","\xB6","\xA7","\xF7","\xB8","\xB0","\xA8","\xB7","\xB9","\xB3","\xB2","\u25A0","\xA0"],Me=["\u0410","\u0411","\u0412","\u0413","\u0414","\u0415","\u0416","\u0417","\u0418","\u0419","\u041A","\u041B","\u041C","\u041D","\u041E","\u041F","\u0420","\u0421","\u0422","\u0423","\u0424","\u0425","\u0426","\u0427","\u0428","\u0429","\u042A","\u042B","\u042C","\u042D","\u042E","\u042F","\u0430","\u0431","\u0432","\u0433","\u0434","\u0435","\u0436","\u0437","\u0438","\u0439","\u043A","\u043B","\u043C","\u043D","\u043E","\u043F","\u2591","\u2592","\u2593","\u2502","\u2524","\u2561","\u2562","\u2556","\u2555","\u2563","\u2551","\u2557","\u255D","\u255C","\u255B","\u2510","\u2514","\u2534","\u252C","\u251C","\u2500","\u253C","\u255E","\u255F","\u255A","\u2554","\u2569","\u2566","\u2560","\u2550","\u256C","\u2567","\u2568","\u2564","\u2565","\u2559","\u2558","\u2552","\u2553","\u256B","\u256A","\u2518","\u250C","\u2588","\u2584","\u258C","\u2590","\u2580","\u0440","\u0441","\u0442","\u0443","\u0444","\u0445","\u0446","\u0447","\u0448","\u0449","\u044A","\u044B","\u044C","\u044D","\u044E","\u044F","\u0401","\u0451","\u0404","\u0454","\u0407","\u0457","\u040E","\u045E","\xB0","\u2219","\xB7","\u221A","\u2116","\xA4","\u25A0","\xA0"],Ie=["\u20AC","\x81","\u201A","\u0192","\u201E","\u2026","\u2020","\u2021","\u02C6","\u2030","\u0160","\u2039","\u0152","\x8D","\u017D","\x8F","\x90","\u2018","\u2019","\u201C","\u201D","\u2022","\u2013","\u2014","\u02DC","\u2122","\u0161","\u203A","\u0153","\x9D","\u017E","\u0178","\xA0","\xA1","\xA2","\xA3","\xA4","\xA5","\xA6","\xA7","\xA8","\xA9","\xAA","\xAB","\xAC","\xAD","\xAE","\xAF","\xB0","\xB1","\xB2","\xB3","\xB4","\xB5","\xB6","\xB7","\xB8","\xB9","\xBA","\xBB","\xBC","\xBD","\xBE","\xBF","\xC0","\xC1","\xC2","\xC3","\xC4","\xC5","\xC6","\xC7","\xC8","\xC9","\xCA","\xCB","\xCC","\xCD","\xCE","\xCF","\xD0","\xD1","\xD2","\xD3","\xD4","\xD5","\xD6","\xD7","\xD8","\xD9","\xDA","\xDB","\xDC","\xDD","\xDE","\xDF","\xE0","\xE1","\xE2","\xE3","\xE4","\xE5","\xE6","\xE7","\xE8","\xE9","\xEA","\xEB","\xEC","\xED","\xEE","\xEF","\xF0","\xF1","\xF2","\xF3","\xF4","\xF5","\xF6","\xF7","\xF8","\xF9","\xFA","\xFB","\xFC","\xFD","\xFE","\xFF"],De={cp437:Ee,cp850:We,cp866:Me,cp1252:Ie},Dt={cp437:F,cp850:void 0,cp866:void 0,cp1252:void 0};var C=z$1.enum(["cp437","cp850","cp866","cp1252"]),Bt=z$1.enum(["replace","skip","error"]),Oo=z$1.object({codepage:C,unmappable:Bt.default("replace"),replacement:z$1.string().default("\uFFFD"),interpretControlChars:z$1.boolean().default(false)}).strict(),Pt=128,_t=32,No=128,Ft=255;function Ho(e,t){let n=new Map;for(let r=0;r<e.length;r++){let o=e[r];o&&n.set(o,Pt+r);}if(t)for(let r=0;r<t.length;r++){let o=t[r];o&&o!=="\0"&&n.set(o,r);}for(let r=0;r<_t;r++)n.set(String.fromCharCode(r),r);for(let r=32;r<=126;r++)n.set(String.fromCharCode(r),r);return n.set("\x7F",127),n}var vt=new Map;function Ot(e){let t=vt.get(e);if(t)return t;let n=De[e],r=Dt[e];if(!n)throw new Error(`Unknown codepage: ${e}`);let o=Ho(n,r);return vt.set(e,o),o}function ve(e,t,n){let r=C.parse(t);if(e<0||e>Ft)throw new RangeError(`Byte value must be 0-255, got: ${e}`);let o=e|0;if(o<_t){if(n?.interpretControlChars&&r==="cp437"){let s=F[o];if(s)return s}return String.fromCharCode(o)}if(o<No)return String.fromCharCode(o);let i=De[r];if(!i)throw new Error(`Unknown codepage: ${r}`);let a=o-Pt,l=i[a];return l||(n?.replacement??"\uFFFD")}function Go(e,t){let n=C.parse(t),r=Ot(n),i=[...e][0];if(i)return r.get(i)}function zo(e,t,n){let r=C.parse(t),o={replacement:"\uFFFD",interpretControlChars:false,...n},i=[];for(let a=0;a<e.length;a++){let l=e[a];if(l===void 0)continue;let s=ve(l,r,o);i.push(s);}return i.join("")}function Uo(e,t,n){let r=C.parse(t),o={unmappable:"replace",replacement:"?",...n},i=Ot(r),a=[],l=[...e];for(let s=0;s<l.length;s++){let u=l[s];if(!u)continue;let d=i.get(u);if(d!==void 0){a.push(d);continue}switch(o.unmappable){case "error":throw new Error(`Character '${u}' (U+${u.codePointAt(0)?.toString(16).toUpperCase().padStart(4,"0")}) cannot be encoded in ${r}`);case "skip":break;default:{let f=o.replacement??"?",c=i.get(f);c!==void 0?a.push(c):a.push(63);break}}}return Buffer.from(a)}function Vo(e){return C.safeParse(e).success}function jo(){return ["cp437","cp850","cp866","cp1252"]}function $o(e,t){let n=C.parse(e),r=[];for(let o=0;o<=Ft;o++)r.push(ve(o,n,t));return r}var Ht=55296,Gt=56319,zt=56320,Ut=57343;function Be(e){return e>=55296&&e<=56319}function Pe(e){return e>=56320&&e<=57343}function N(e){return e>=55296&&e<=57343}function Vt(e,t){if(t<0||t>=e.length)return false;let n=e.charCodeAt(t);return N(n)}function jt(e,t){if(!Be(e))throw new Error(`Invalid high surrogate: 0x${e.toString(16)}`);if(!Pe(t))throw new Error(`Invalid low surrogate: 0x${t.toString(16)}`);return (e-55296)*1024+(t-56320)+65536}function $t(e){if(e<=65535)throw new Error(`Code point 0x${e.toString(16)} doesn't need surrogate encoding`);if(e>1114111)throw new Error(`Invalid code point: 0x${e.toString(16)} (exceeds U+10FFFF)`);let t=e-65536,n=(t>>10)+55296,r=(t&1023)+56320;return [n,r]}function Zt(e,t){if(t<0||t>=e.length)return -1;let n=e.codePointAt(t);return n===void 0?-1:n}function Kt(...e){return String.fromCodePoint(...e)}function*_e(e){for(let t of e){let n=t.codePointAt(0);n!==void 0&&(yield n);}}function qt(e){return [..._e(e)]}function*Xt(e){for(let t of e)yield t;}function Jt(e){let t=0;for(let n of e)t++;return t}function Yt(e){return !(e<0||e>1114111||e>=55296&&e<=57343)}function Qt(e){return e>=0&&e<=65535}function ee(e){return e>=65536&&e<=1114111}function en(e,t){if(t<0)return "";let n=0;for(let r of e){if(n===t)return r;n++;}return ""}function tn(e,t,n){let r=t<0?0:t,o="",i=0;for(let a of e){if(n!==void 0&&i>=n)break;i>=r&&(o+=a),i++;}return o}var te=[[768,879],[6832,6911],[7616,7679],[8400,8447],[65056,65071],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1552,1562],[1611,1631],[1648,1648],[1750,1756],[1759,1764],[1767,1768],[1770,1773],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2260,2273],[2275,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2901,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6159,6159],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[65024,65039],[917760,917999]],ne=new Set((function*(){for(let[e,t]of te)for(let n=e;n<=t;n++)yield n;})());function Zo(e,t){let n=0,r=t.length-1;for(;n<=r;){let o=Math.floor((n+r)/2),i=t[o];if(!i)break;let[a,l]=i;if(e<a)r=o-1;else if(e>l)n=o+1;else return true}return false}function H(e){return e<768?false:ne.has(e)}function nn(e){return e<768?false:Zo(e,te)}function rn(){return ne.size}var Fe=[[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12352,12447],[12448,12543],[12544,12591],[12592,12687],[12688,12703],[12704,12735],[12736,12783],[12784,12799],[12800,13055],[13056,13311],[13312,19903],[19968,40959],[40960,42127],[42128,42191],[44032,55203],[63744,64255],[65040,65055],[65072,65103],[65104,65135],[65280,65376],[65504,65510],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[194560,195103],[196608,201551],[201552,205743]],on=[[65281,65374],[65504,65510]],Oe=[[0,31],[127,159],[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1552,1562],[1611,1631],[1648,1648],[1750,1756],[1759,1764],[1767,1768],[1770,1773],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2260,2273],[2275,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[6832,6845],[6846,6846],[6847,6848],[7616,7679],[8203,8207],[8288,8292],[8294,8303],[8400,8447],[65024,65039],[65056,65071],[65279,65279],[917760,917999]],Ne=[[161,161],[164,164],[167,168],[170,170],[173,174],[176,180],[182,186],[188,191],[198,198],[208,208],[215,216],[222,225],[230,230],[232,234],[236,237],[240,240],[242,243],[247,250],[252,252],[254,254],[913,929],[931,937],[945,961],[963,969],[1025,1025],[1040,1103],[1105,1105],[9472,9599],[9600,9631],[9632,9727],[9728,9983],[9984,10175]],He=[[127744,128511],[128512,128591],[128640,128767],[129280,129535],[129536,129647],[129648,129791]];function re(e,t){let n=0,r=t.length-1;for(;n<=r;){let o=Math.floor((n+r)/2),i=t[o];if(!i)break;let[a,l]=i;if(e<a)r=o-1;else if(e>l)n=o+1;else return true}return false}function I(e){return e<4352?false:!!(re(e,Fe)||re(e,He))}function S(e){return re(e,Oe)}function Ge(e){return re(e,Ne)}function p(e,t=false){return S(e)?0:I(e)||t&&Ge(e)?2:1}var an=typeof Intl<"u"&&"Segmenter"in Intl,ze=null;function ln(){return an?(ze||(ze=new Intl.Segmenter(void 0,{granularity:"grapheme"})),ze):null}function*R(e){if(e.length===0)return;let t=ln();if(t)for(let n of t.segment(e))yield n.segment;else for(let n of e)yield n;}function Ue(e){return [...R(e)]}function sn(e){if(e.length===0)return 0;let t=ln();if(t){let r=0;for(let o of t.segment(e))r++;return r}let n=0;for(let r of e)n++;return n}function un(e,t){if(t<0)return;let n=0;for(let r of R(e)){if(n===t)return r;n++;}}function dn(e,t,n){let r=t<0?0:t,o="",i=0;for(let a of R(e)){if(n!==void 0&&i>=n)break;i>=r&&(o+=a),i++;}return o}function ae(e){if(e.length===0)return 0;let t=e.codePointAt(0);return t===void 0?0:Ko(e)?2:p(t)}function Ko(e){if(e.length===0)return false;let t=e.codePointAt(0);return t===void 0?false:!!(t>=127462&&t<=127487||t>=127744&&t<=129535||t>=129536&&t<=129791||t>=9728&&t<=9983||t>=9984&&t<=10175||e.includes("\uFE0F")||e.includes("\u200D"))}function oe(e){let t=0;for(let n of R(e))t+=ae(n);return t}function ie(e,t){let n=0,r="";for(let o of R(e)){let i=ae(o);if(n+i>t)return {text:r,width:n,truncated:true};n+=i,r+=o;}return {text:r,width:n,truncated:false}}function fn(e,t,n="\u2026"){if(oe(e)<=t)return e;let o=oe(n);if(o>=t)return ie(n,t).text;let i=t-o;return ie(e,i).text+n}function cn(){return an}function mn(e){return Ue(e).reverse().join("")}var qo={replacement:"?",dropWide:true,dropCombining:true,dropAstral:true,dropZeroWidth:true,dropControl:false};function hn(e){return e>=0&&e<=31?e!==9&&e!==10&&e!==13:e===127||e>=128&&e<=159}function Xo(e){return e===9||e===10||e===13}function Jo(e,t,n){return n&&S(t)?Xo(t)?e:"":null}function Yo(e,t,n,r,o){return ee(t)?n||r&&I(t)?o:e:null}function Qo(e,t,n){if(N(t))return n.replacement;if(H(t))return n.dropCombining?"":e;if(hn(t))return n.dropControl?"":e;let r=Jo(e,t,n.dropZeroWidth);if(r!==null)return r;let o=Yo(e,t,n.dropAstral,n.dropWide,n.replacement);return o!==null?o:n.dropWide&&I(t)?n.replacement:e}function gn(e,t){let n={...qo,...t},r="";for(let o of e){let i=o.codePointAt(0);if(i===void 0){r+=n.replacement;continue}r+=Qo(o,i,n);}return r}function pn(e,t="?"){let n="";for(let r of e){let o=r.codePointAt(0);if(o===void 0){n+=t;continue}o>=32&&o<=126||o===9||o===10||o===13?n+=r:n+=t;}return n}function bn(e){let t="";for(let n of e){let r=n.codePointAt(0);r!==void 0&&!S(r)&&(t+=n);}return t}function xn(e){let t="";for(let n of e){let r=n.codePointAt(0);r!==void 0&&!H(r)&&(t+=n);}return t}function yn(e){let t="";for(let n of e){let r=n.codePointAt(0);r!==void 0&&!hn(r)&&(t+=n);}return t}function Cn(e){return e.normalize("NFC")}function Sn(e){return e.normalize("NFD")}function Ln(e){return e.normalize("NFKC")}function kn(e){return e.normalize("NFKD")}function Tn(e,t=false){return p(e,t)}function G(e,t=false){if(e.length===0)return 0;let n=e.codePointAt(0);return n===void 0?0:p(n,t)}function Rn(e,t,n=false){if(t<0)return -1;let r=0;for(let o of e){if(r===t){let i=o.codePointAt(0);return i===void 0?0:p(i,n)}r++;}return -1}var se=8,ue=9;function b(e,t){let n=t?.tabWidth??se,r=t?.ambiguousAsWide??false,o=0;for(let i of e){let a=i.codePointAt(0);if(a!==void 0){if(a===ue){let l=o%n;o+=n-l;continue}o+=p(a,r);}}return o}function An(e,t){return b(e,t)}function Ve(e,t,n){let r=n?.ambiguousAsWide??false,o=n?.tabWidth??se,i=0,a="";for(let l of e){let s=l.codePointAt(0);if(s===void 0)continue;let u;if(s===ue){let d=i%o;u=o-d;}else u=p(s,r);if(i+u>t)return {text:a,width:i,truncated:true};i+=u,a+=l;}return {text:a,width:i,truncated:false}}function le(e,t,n){return Ve(e,t,n).text}function wn(e,t,n="\u2026",r){if(b(e,r)<=t)return e;let i=b(n,r);if(i>=t)return le(n,t,r);let a=t-i;return le(e,a,r)+n}function En(e,t,n=" ",r){let o=b(e,r);if(o>=t)return e;let i=G(n,r?.ambiguousAsWide);if(i===0)return e;let a=t-o,l=Math.floor(a/i);return e+n.repeat(l)}function Wn(e,t,n=" ",r){let o=b(e,r);if(o>=t)return e;let i=G(n,r?.ambiguousAsWide);if(i===0)return e;let a=t-o,l=Math.floor(a/i);return n.repeat(l)+e}function Mn(e,t,n=" ",r){let o=b(e,r);if(o>=t)return e;let i=G(n,r?.ambiguousAsWide);if(i===0)return e;let a=t-o,l=Math.floor(a/2),s=a-l,u=Math.floor(l/i),d=Math.floor(s/i);return n.repeat(u)+e+n.repeat(d)}function In(e,t,n){let r=n?.ambiguousAsWide??false,o=n?.tabWidth??se;if(t<0)return -1;let i=0,a=0;for(let l of e){let s=l.codePointAt(0);if(s===void 0){a++;continue}let u;if(s===ue){let d=i%o;u=o-d;}else u=p(s,r);if(t>=i&&t<i+u||u===0&&t===i)return a;i+=u,a++;}return -1}function Dn(e,t,n){let r=n?.ambiguousAsWide??false,o=n?.tabWidth??se;if(t<0)return -1;let i=0,a=0;for(let l of e){if(a===t)return i;let s=l.codePointAt(0);if(s===void 0){a++;continue}let u;if(s===ue){let d=i%o;u=o-d;}else u=p(s,r);i+=u,a++;}return -1}function vn(e){for(let t of e){let n=t.codePointAt(0);if(n!==void 0&&p(n)===2)return true}return false}function Bn(e){for(let t of e){let n=t.codePointAt(0);if(n!==void 0&&S(n))return true}return false}var Pn=z$1.object({codePoint:z$1.number().int().nonnegative(),width:z$1.number().int().min(0).max(2)}),_n=z$1.object({terminal:z$1.string().min(1),overrides:z$1.array(Pn)});function ei(){return [{label:"Family emoji (ZWJ sequence)",input:"\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}",expectedWidth:2,category:"emoji-zwj",notes:"Most terminals render as single 2-wide glyph, some render 8-wide"},{label:"Couple with heart (ZWJ)",input:"\u{1F469}\u200D\u2764\uFE0F\u200D\u{1F468}",expectedWidth:2,category:"emoji-zwj",notes:"ZWJ joins three characters into one grapheme"},{label:"Person with white hair (ZWJ)",input:"\u{1F9D1}\u200D\u{1F9B3}",expectedWidth:2,category:"emoji-zwj"},{label:"Pirate flag (ZWJ)",input:"\u{1F3F4}\u200D\u2620\uFE0F",expectedWidth:2,category:"emoji-zwj"},{label:"ZWJ character alone",input:"\u200D",expectedWidth:0,category:"emoji-zwj"},{label:"US flag (regional indicators)",input:"\u{1F1FA}\u{1F1F8}",expectedWidth:2,category:"regional-indicators",notes:"Two regional indicators form a flag"},{label:"Japan flag",input:"\u{1F1EF}\u{1F1F5}",expectedWidth:2,category:"regional-indicators"},{label:"Single regional indicator",input:"\u{1F1FA}",expectedWidth:2,category:"regional-indicators",notes:"Unpaired regional indicators vary by terminal"},{label:"Text presentation (VS15)",input:"\u2764\uFE0E",expectedWidth:1,category:"variation-selectors",notes:"VS15 forces text presentation (narrow)"},{label:"Emoji presentation (VS16)",input:"\u2764\uFE0F",expectedWidth:2,category:"variation-selectors",notes:"VS16 forces emoji presentation (wide)"},{label:"Number sign with VS16",input:"#\uFE0F\u20E3",expectedWidth:2,category:"variation-selectors",notes:"Keycap sequence"},{label:"Variation selector alone",input:"\uFE0F",expectedWidth:0,category:"variation-selectors"},{label:"CJK ideograph (U+4E2D)",input:"\u4E2D",expectedWidth:2,category:"cjk"},{label:'CJK string "\u4E2D\u6587\u6D4B\u8BD5"',input:"\u4E2D\u6587\u6D4B\u8BD5",expectedWidth:8,category:"cjk"},{label:"Hangul syllable (\uAC00)",input:"\uAC00",expectedWidth:2,category:"cjk"},{label:"Katakana (\u30AB\u30BF\u30AB\u30CA)",input:"\u30AB\u30BF\u30AB\u30CA",expectedWidth:8,category:"cjk"},{label:"CJK compatibility ideograph",input:"\uF900",expectedWidth:2,category:"cjk"},{label:"Latin a + combining acute",input:"a\u0301",expectedWidth:1,category:"combining"},{label:"Multiple combining marks (Zalgo-style)",input:"a\u0300\u0301\u0302\u0303",expectedWidth:1,category:"combining",notes:"All combining marks are zero-width"},{label:"Devanagari with combining",input:"\u0915\u094D\u0937",expectedWidth:2,category:"combining",notes:"Consonant cluster"},{label:"Korean jamo with combining",input:"\u1100\u1161",expectedWidth:2,category:"combining",notes:"Lead + vowel jamo"},{label:"Single tab",input:" ",expectedWidth:8,category:"tabs",notes:"Default tab width is 8"},{label:"Tab after 3 chars",input:"abc ",expectedWidth:8,category:"tabs",notes:"Tab extends to next 8-column boundary"},{label:"Null character",input:"\0",expectedWidth:0,category:"control"},{label:"Bell character",input:"\x07",expectedWidth:0,category:"control"},{label:"Backspace",input:"\b",expectedWidth:0,category:"control"},{label:"Soft hyphen",input:"\xAD",expectedWidth:1,category:"control",notes:"Soft hyphen is technically a format character but width=1 in most terminals"},{label:"Fullwidth A",input:"\uFF21",expectedWidth:2,category:"fullwidth"},{label:"Fullwidth digits",input:"\uFF10\uFF11\uFF12",expectedWidth:6,category:"fullwidth"},{label:"Fullwidth exclamation mark",input:"\uFF01",expectedWidth:2,category:"fullwidth"},{label:"Halfwidth katakana",input:"\uFF66",expectedWidth:1,category:"halfwidth"},{label:"Halfwidth Hangul",input:"\uFFA0",expectedWidth:1,category:"halfwidth"},{label:"Greek alpha",input:"\u03B1",expectedWidth:1,category:"ambiguous",notes:"Ambiguous width - 1 in Western locale, 2 in CJK locale"},{label:"Box drawing (light horizontal)",input:"\u2500",expectedWidth:1,category:"ambiguous"},{label:"Bullet (\u2022)",input:"\u2022",expectedWidth:1,category:"ambiguous"},{label:"Musical symbol (U+1D11E)",input:"\u{1D11E}",expectedWidth:1,category:"surrogate-pairs"},{label:"Emoji face (U+1F600)",input:"\u{1F600}",expectedWidth:2,category:"surrogate-pairs"},{label:"Skin tone modifier (U+1F3FD)",input:"\u{1F44B}\u{1F3FD}",expectedWidth:2,category:"surrogate-pairs",notes:"Waving hand + medium skin tone"},{label:"ASCII + CJK mixed",input:"Hello\u4E16\u754C",expectedWidth:9,category:"mixed"},{label:"Emoji + text mixed",input:"\u{1F389} Party!",expectedWidth:9,category:"mixed"},{label:"Empty string",input:"",expectedWidth:0,category:"mixed"},{label:"Newline only",input:`
|
|
9
|
+
`,expectedWidth:0,category:"mixed"}]}function ti(){return [{label:"Family ZWJ emoji",input:"\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}",expectedWidth:2,terminalWidths:{"xterm-256color":8,kitty:2,alacritty:2,wezterm:2,"gnome-terminal":2,iterm2:2,"windows-terminal":2},severity:"major"},{label:"Flag sequence (regional indicators)",input:"\u{1F1FA}\u{1F1F8}",expectedWidth:2,terminalWidths:{"xterm-256color":4,kitty:2,alacritty:2,wezterm:2,iterm2:2},severity:"major"},{label:"Unpaired regional indicator",input:"\u{1F1FA}",expectedWidth:2,terminalWidths:{"xterm-256color":2,kitty:1,alacritty:2},severity:"minor"},{label:"Skin tone emoji",input:"\u{1F44B}\u{1F3FD}",expectedWidth:2,terminalWidths:{"xterm-256color":4,kitty:2,alacritty:2,iterm2:2},severity:"major"},{label:"VS16 heart emoji",input:"\u2764\uFE0F",expectedWidth:2,terminalWidths:{"xterm-256color":1,kitty:2,alacritty:2,iterm2:2},severity:"minor"},{label:"Keycap sequence #\uFE0F\u20E3",input:"#\uFE0F\u20E3",expectedWidth:2,terminalWidths:{"xterm-256color":2,kitty:2,alacritty:1},severity:"minor"},{label:"Devanagari conjunct",input:"\u0915\u094D\u0937",expectedWidth:2,terminalWidths:{"xterm-256color":1,kitty:2,alacritty:1},severity:"minor"},{label:"Zalgo text (heavy combining)",input:"a\u0300\u0301\u0302\u0303\u0304\u0305\u0306\u0307",expectedWidth:1,terminalWidths:{"xterm-256color":1,kitty:1,alacritty:1},severity:"critical"}]}var v=new Map;function ni(e){let t=_n.parse(e);for(let n of t.overrides)v.set(n.codePoint,n.width);}function ri(){v.clear();}function oi(){return v.size}function ii(e){return v.get(e)??null}function ai(e,t){if(v.size===0)return b(e,t);let n=t?.tabWidth??8,r=0,o=0;for(let i=0;i<e.length;i++){let a=e.codePointAt(i);if(a===void 0)continue;if(a===10){o=0;continue}if(a===9){let s=n-o%n;r+=s,o+=s;continue}let l=v.get(a);if(l!==void 0)r+=l,o+=l;else {let s=p(a);r+=s,o+=s;}a>65535&&i++;}return r}function li(e,t){let n=[],r=0;for(let o of e){let i=b(o.input,t);i===o.expectedWidth?r++:n.push({testCase:o,actualWidth:i});}return {total:e.length,passed:r,failed:n.length,failures:n}}function si(e,t){return e.filter(n=>n.category===t)}function ui(e){let t=new Set;for(let n of e)t.add(n.category);return [...t]}function di(e){let t=[];if(t.push(`Width Test Results: ${e.passed}/${e.total} passed`),t.push(""),e.failures.length===0)return t.push("All tests passed!"),t.join(`
|
|
10
|
+
`);t.push(`Failures (${e.failed}):`);for(let n of e.failures)t.push(` [${n.testCase.category}] ${n.testCase.label}`),t.push(` Expected: ${n.testCase.expectedWidth}, Got: ${n.actualWidth}`),t.push(` Input: ${JSON.stringify(n.testCase.input)}`),n.testCase.notes&&t.push(` Note: ${n.testCase.notes}`);return t.join(`
|
|
11
|
+
`)}var fi=1e3,Fn=100;function de(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return t>>>0}function ci(e){return {width:e,entries:new Map,dirty:new Set,totalLines:0,lineOffsets:[],fullInvalidate:true}}function mi(e){e.entries.clear(),e.dirty.clear(),e.totalLines=0,e.lineOffsets.length=0,e.fullInvalidate=true;}function hi(e,t){if(e.width!==t){e.width=t,e.fullInvalidate=true;for(let[n]of e.entries)e.dirty.add(n);}}function gi(e,t,n,r){if(t<=0)return {lines:[""],breakPoints:[0]};if(e.length===0)return {lines:[""],breakPoints:[0]};let o=pi();for(let i=0;i<=e.length;i++)Li(o,e,i,t,n,r);return {lines:o.lines,breakPoints:o.breakPoints}}function pi(){return {lines:[],breakPoints:[0],lineStart:0,lineWidth:0,wordWidth:0,lastBreakable:-1,lastBreakableWidth:0}}function bi(e,t,n,r){let o=t.slice(e.lineStart,n);(o.length>0||e.lines.length===0)&&(e.lines.push(o),r||e.breakPoints.push(n+1)),xi(e,n+1);}function xi(e,t){e.lineStart=t,e.lineWidth=0,e.wordWidth=0,e.lastBreakable=-1,e.lastBreakableWidth=0;}function yi(e,t,n){e.lastBreakable=t,e.lastBreakableWidth=e.lineWidth,e.wordWidth=0,e.lineWidth+=n;}function Ci(e,t){e.wordWidth+=t,e.lineWidth+=t;}function Si(e,t,n,r,o,i){if(e.lastBreakable>=e.lineStart&&!i){let a=t.slice(e.lineStart,e.lastBreakable);e.lines.push(a),e.breakPoints.push(e.lastBreakable+1),e.lineStart=e.lastBreakable+1,e.lineWidth=e.lineWidth-e.lastBreakableWidth-1,e.lastBreakable=-1;return}if(i||e.wordWidth>o){let a=t.slice(e.lineStart,n);e.lines.push(a),e.breakPoints.push(n),e.lineStart=n,e.lineWidth=r,e.wordWidth=r,e.lastBreakable=-1;}}function Li(e,t,n,r,o,i){let a=n<t.length?t[n]:void 0,l=n===t.length;if(a===`
|
|
12
|
+
`||l){bi(e,t,n,l);return}let u=i?b(a??""):1;a===" "||a===" "?yi(e,n,u):Ci(e,u),e.lineWidth>r&&Si(e,t,n,u,r,o);}function je(e,t,n,r){let{lines:o,breakPoints:i}=gi(e,t,n,r);return {text:e,hash:de(e),width:t,lines:o,breakPoints:i}}function ki(e,t,n){let r=n?.width??e.width,o=n?.breakWord??false,i=n?.unicodeWidth??true,a=t.split(`
|
|
13
|
+
`),l=[];e.lineOffsets.length=0;let s=0;for(let u=0;u<a.length;u++){let d=a[u];if(d===void 0)continue;e.lineOffsets.push(s);let f=e.entries.get(u),c=de(d);if(f&&f.hash===c&&f.width===r&&!e.dirty.has(u)&&!e.fullInvalidate){l.push(...f.lines),s+=f.lines.length;continue}let m=je(d,r,o,i);e.entries.set(u,m),e.dirty.delete(u),l.push(...m.lines),s+=m.lines.length;}e.totalLines=s,e.fullInvalidate=false;for(let[u]of e.entries)u>=a.length&&e.entries.delete(u);return l}function Ti(e,t,n,r,o){let i=performance.now(),a=o?.width??e.width,l=o?.breakWord??false,s=o?.unicodeWidth??true,u=t.split(`
|
|
14
|
+
`),d=[],f=Ri(e,n),c=f.currentLine,m=f.targetParagraph,h=0,g=u.length;for(let x=m;x<g&&c<r;x++){let xt=u[x];if(xt===void 0)continue;let xr=Ai(e,x,xt,a,l,s);c=wi(d,xr.lines,c,n,r),h=x+1;}let W=performance.now()-i;return {lines:d,hasMore:h<g,nextParagraph:h,timeMs:W}}function Ri(e,t){let n=0,r=0;if(e.lineOffsets.length===0||e.fullInvalidate)return {targetParagraph:n,currentLine:r};for(let o=0;o<e.lineOffsets.length;o++){let i=e.lineOffsets[o];if(i!==void 0&&i<=t)n=o,r=i;else break}return {targetParagraph:n,currentLine:r}}function Ai(e,t,n,r,o,i){let a=e.entries.get(t),l=de(n);if(a&&a.hash===l&&a.width===r&&!e.dirty.has(t)&&!e.fullInvalidate)return a;let s=je(n,r,o,i);return e.entries.set(t,s),e.dirty.delete(t),s}function wi(e,t,n,r,o){let i=n;for(let a=0;a<t.length;a++){if(i>=r&&i<o){let l=t[a];l!==void 0&&e.push(l);}i++;}return i}function Ei(e,t,n,r=Fn,o){let i=performance.now(),a=o?.width??e.width,l=o?.breakWord??false,s=o?.unicodeWidth??true,u=t.split(`
|
|
15
|
+
`),d=[],f=Math.min(n+r,u.length);for(let m=n;m<f;m++){let h=u[m];if(h===void 0)continue;let g=e.entries.get(m),W=de(h),x;g&&g.hash===W&&g.width===a&&!e.dirty.has(m)&&!e.fullInvalidate?x=g:(x=je(h,a,l,s),e.entries.set(m,x),e.dirty.delete(m)),d.push(...x.lines);}let c=performance.now()-i;return {lines:d,hasMore:f<u.length,nextParagraph:f,timeMs:c}}function Wi(e,t,n){for(let r=t;r<n;r++)e.dirty.add(r);}function Mi(e,t){e.dirty.add(t);}function Ii(e){e.fullInvalidate=true;}function Di(e,t){if(t<0||t>=e.totalLines)return;let n=0,r=e.lineOffsets.length-1,o=0;for(;n<=r;){let u=Math.floor((n+r)/2),d=e.lineOffsets[u];if(d===void 0)break;d<=t?(o=u,n=u+1):r=u-1;}let i=e.lineOffsets[o]??0,a=t-i,s=e.entries.get(o)?.breakPoints[a]??0;return {paragraph:o,lineInParagraph:a,charOffset:s}}function vi(e,t,n=0){if(t<0||t>=e.lineOffsets.length)return -1;let r=e.lineOffsets[t];return r===void 0?-1:r+n}function Bi(e){return {cachedParagraphs:e.entries.size,dirtyParagraphs:e.dirty.size,totalLines:e.totalLines,width:e.width,fullInvalidate:e.fullInvalidate}}var Pi={minFoldableLines:2,labelTemplate:"... {count} lines",maxDepth:10};function _i(e,t){return {config:{...Pi,...t},regions:new Map,totalDocumentLines:e,nextId:0}}function Fi(e,t,n,r){let o=n-t;if(o<e.config.minFoldableLines||t<0||n>=e.totalDocumentLines||t>=n)return;let i=`fold-${e.nextId++}`,a=Yi(e,t,n);if(a>=e.config.maxDepth)return;let l=r??e.config.labelTemplate.replace("{count}",String(o)),s={id:i,startLine:t,endLine:n,folded:false,label:l,depth:a};return e.regions.set(i,s),i}function Oi(e,t){return e.regions.delete(t)}function Ni(e,t){let n=e.regions.get(t);return !n||n.folded?false:(e.regions.set(t,{...n,folded:true}),true)}function Hi(e,t){let n=e.regions.get(t);return !n||!n.folded?false:(e.regions.set(t,{...n,folded:false}),true)}function Gi(e,t){let n=e.regions.get(t);if(!n)return;let r=!n.folded;return e.regions.set(t,{...n,folded:r}),r}function zi(e){let t=0;for(let[n,r]of e.regions)r.folded||(e.regions.set(n,{...r,folded:true}),t++);return t}function Ui(e){let t=0;for(let[n,r]of e.regions)r.folded&&(e.regions.set(n,{...r,folded:false}),t++);return t}function Vi(e,t){let n=0;for(let[r,o]of e.regions)o.depth>=t&&!o.folded&&(e.regions.set(r,{...o,folded:true}),n++);return n}function ji(e,t){let n;for(let r of e.regions.values())t>=r.startLine&&t<=r.endLine&&(!n||r.depth>n.depth)&&(n=r);return n}function $i(e){return Array.from(e.regions.values()).sort((t,n)=>t.startLine-n.startLine)}function Zi(e,t,n){let r=ce(e),o=[],i=0,a=0;for(;i<t&&a<e.totalDocumentLines;){let l=fe(r,a);l?(i++,a=l.endLine+1):(i++,a++);}for(;o.length<n&&a<e.totalDocumentLines;){let l=fe(r,a);l?(o.push({originalLine:l.startLine,isFoldPlaceholder:true,foldId:l.id,foldLabel:l.label,hiddenLines:l.endLine-l.startLine}),a=l.endLine+1):(o.push({originalLine:a,isFoldPlaceholder:false,foldId:void 0,foldLabel:void 0,hiddenLines:0}),a++);}return o}function Ki(e,t){let n=ce(e),r=0,o=0;for(;r<t&&o<e.totalDocumentLines;){let i=fe(n,o);i?(r++,o=i.endLine+1):(r++,o++);}return o}function qi(e,t){let n=ce(e),r=0,o=0;for(;o<t&&o<e.totalDocumentLines;){let i=fe(n,o);if(i){if(r++,t>i.startLine&&t<=i.endLine)return -1;o=i.endLine+1;}else r++,o++;}return r}function Xi(e){let t=0,n=0,r=0,o=ce(e);for(let i of o)t++,n+=i.endLine-i.startLine;for(let i of e.regions.values())i.depth>r&&(r=i.depth),i.folded&&(t=Math.max(t,t));return {totalRegions:e.regions.size,foldedRegions:t,hiddenLines:n,visibleLines:e.totalDocumentLines-n,maxDepth:r}}function Ji(e,t){e.totalDocumentLines=t;for(let[n,r]of e.regions)(r.startLine>=t||r.endLine>=t)&&e.regions.delete(n);}function Yi(e,t,n){let r=0;for(let o of e.regions.values())o.startLine<=t&&o.endLine>=n&&(r=Math.max(r,o.depth+1));return r}function ce(e){let t=[];for(let r of e.regions.values())r.folded&&t.push({id:r.id,startLine:r.startLine,endLine:r.endLine,label:r.label});t.sort((r,o)=>r.startLine-o.startLine);let n=[];for(let r of t){let o=n[n.length-1];if(o&&r.startLine<=o.endLine){r.endLine>o.endLine&&(n[n.length-1]={...o,endLine:r.endLine});continue}n.push(r);}return n}function fe(e,t){let n=0,r=e.length-1;for(;n<=r;){let o=n+r>>>1,i=e[o];if(!i)break;if(t<i.startLine)r=o-1;else if(t>i.endLine)n=o+1;else return i}}function Nn(e,t){let n={...e};for(let r in t)if(Object.hasOwn(t,r)){let o=t[r],i=n[r];o!==null&&typeof o=="object"&&!Array.isArray(o)&&i!==null&&typeof i=="object"&&!Array.isArray(i)?n[r]=Nn(i,o):n[r]=o;}return n}function Qi(e,t){return {...e,...t}}function ea(e){return [...e].sort((t,n)=>{let r=t.name.startsWith("."),o=n.name.startsWith(".");return r&&!o?1:!r&&o?-1:t.name.toLowerCase().localeCompare(n.name.toLowerCase())})}function ta(e){return [...e].sort((t,n)=>t.index-n.index)}function na(e){return [...e].sort((t,n)=>n.priority-t.priority)}function ra(e,t,n=false){return [...e].sort((r,o)=>{let i=t(r),a=t(o),l;return typeof i=="string"&&typeof a=="string"?l=i.localeCompare(a):l=i-a,n?-l:l})}var Hn=new Set(["node_modules",".git",".svn",".hg","dist","build","coverage",".cache",".next","__pycache__"]);function oa(e,t,n){let r=n?.maxDepth??10,o=new Set([...Hn,...n?.excludeDirs??[]]);function i(a,l){if(l>r)return null;let s=Gn(a);if(!s)return null;let u=aa(s,a,t);return u||la(s,a,l,r,o,i)}return i(L.resolve(e),0)}function ia(e,t,n){let r=n?.maxDepth??10,o=new Set([...Hn,...n?.excludeDirs??[]]),i=n?.maxResults??Number.POSITIVE_INFINITY,a=[];function l(s,u){if(u>r||a.length>=i)return;let d=Gn(s);d&&(sa(d,s,t,a,i),ua(d,s,u,r,o,a,i,l));}return l(L.resolve(e),0),a}function Gn(e){try{return On.readdirSync(e,{withFileTypes:!0})}catch{return null}}function aa(e,t,n){for(let r of e)if(r.name===n&&r.isFile())return L.join(t,r.name);return null}function la(e,t,n,r,o,i){for(let a of e){if(!a.isDirectory()||o.has(a.name))continue;let l=i(L.join(t,a.name),n+1);if(l)return l}return null}function sa(e,t,n,r,o){for(let i of e){if(r.length>=o)return;i.name===n&&i.isFile()&&r.push(L.join(t,i.name));}}function ua(e,t,n,r,o,i,a,l){for(let s of e){if(i.length>=a)return;!s.isDirectory()||o.has(s.name)||l(L.join(t,s.name),n+1);}}function da(e){return [...new Set(e)]}function fa(e,t){let n=new Set,r=[];for(let o of e){let i=t(o);n.has(i)||(n.add(i),r.push(o));}return r}function ca(e,t){let n=new Map;for(let r of e){let o=t(r),i=n.get(o);i?i.push(r):n.set(o,[r]);}return n}function ma(e,t){let n=[],r=[];for(let o of e)t(o)?n.push(o):r.push(o);return [n,r]}var ha={chunkSize:1e3,maxCachedChunks:50,readAheadLines:500,readBehindLines:200,maxMemoryBytes:104857600};function ga(e,t){return {config:{...ha,...t},source:e,chunks:new Map,accessOrder:[],hits:0,misses:0}}function pa(e,t,n){let r={start:Math.max(0,t),end:Math.min(n,e.source.totalLines)},o=[],i=e.config.chunkSize,a=Math.floor(r.start/i),l=Math.floor(Math.max(0,r.end-1)/i);for(let s=a;s<=l;s++){let u=Un(e,s);if(!u)continue;let d=s*i,f=Math.max(0,r.start-d),c=Math.min(u.lines.length,r.end-d);for(let m=f;m<c;m++){let h=u.lines[m];h!==void 0&&o.push(h);}}return o}function ba(e,t,n){let{readAheadLines:r,readBehindLines:o,chunkSize:i}=e.config,a=Math.max(0,t-o),l=Math.min(e.source.totalLines,n+r),s=Math.floor(a/i),u=Math.floor(Math.max(0,l-1)/i);for(let d=s;d<=u;d++)Un(e,d);}function zn(e,t){let n=t??e.config.maxCachedChunks,r=0;for(;e.chunks.size>n&&e.accessOrder.length>0;){let o=e.accessOrder.shift();if(o===void 0)break;e.chunks.has(o)&&(e.chunks.delete(o),r++);}return r}function xa(e){e.chunks.clear(),e.accessOrder=[],e.hits=0,e.misses=0;}function ya(e){let t=0;for(let r of e.chunks.values())t+=r.byteSize;let n=e.hits+e.misses;return {config:e.config,totalLines:e.source.totalLines,loadedChunks:e.chunks.size,memoryUsage:t,hitRate:n>0?e.hits/n:0}}function Ca(e,t,n){let r=e.config.chunkSize,o=Math.floor(t/r),i=Math.floor(Math.max(0,n-1)/r);for(let a=o;a<=i;a++)if(!e.chunks.has(a))return false;return true}function Sa(e){return {totalLines:e.length,isExactCount:true,loadRange:(t,n)=>e.slice(t,n)}}function Un(e,t){let n=e.chunks.get(t);if(n)return e.hits++,La(e,t),{...n,lastAccessedAt:Date.now()};e.misses++;let r=e.config.chunkSize,o=t*r,i=Math.min(o+r,e.source.totalLines);if(o>=e.source.totalLines)return;e.chunks.size>=e.config.maxCachedChunks&&zn(e,e.config.maxCachedChunks-1);let a=e.source.loadRange(o,i),l=0;for(let u of a)l+=u.length*2;let s={index:t,startLine:o,endLine:i,lines:a,byteSize:l,lastAccessedAt:Date.now()};return e.chunks.set(t,s),e.accessOrder.push(t),s}function La(e,t){let n=e.accessOrder.indexOf(t);n>=0&&e.accessOrder.splice(n,1),e.accessOrder.push(t);}var $e={mode:"absolute",minWidth:3,rightPadding:1,padChar:" ",separator:"\u2502",highlightCurrent:true};function me(e,t){if(e<=0)return t;let n=Math.floor(Math.log10(e))+1;return Math.max(n,t)}function Vn(e,t){let n={...$e,...t};return e+n.rightPadding+1}function ka(e){return {...$e,...e}}function jn(e,t,n,r){let o=e===t;if(r==="absolute")return String(e).padStart(n," ");if(r==="relative"){if(o)return String(e).padStart(n," ");let a=Math.abs(e-t);return String(a).padStart(n," ")}if(o)return String(e).padStart(n," ");let i=Math.abs(e-t);return String(i).padStart(n," ")}function Ta(e,t,n,r,o){let i={...$e,...o},a=me(e,i.minWidth),l=Vn(a,i),s=[],u=Math.min(t+n,e);for(let d=t;d<u;d++){let f=d+1,c=f===r,h=jn(f,r,a,i.mode)+i.padChar.repeat(i.rightPadding)+i.separator;s.push({text:h,isCurrent:c,lineNumber:f,width:l});}return {lines:s,gutterWidth:l,digitWidth:a,totalLines:e}}function Ra(e,t,n=3){return me(e,n)!==me(t,n)}function Aa(e,t,n,r="\x1B[0m"){return e.lines.map(o=>`${o.isCurrent?t:n}${o.text}${r}`)}var wa=100,he={inString:null,inComment:false,templateDepth:0,commentDepth:0},z={name:"javascript",extensions:[".js",".jsx",".ts",".tsx",".mjs",".cjs"],keywords:new Set(["async","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","finally","for","from","function","if","implements","import","in","instanceof","interface","let","new","of","package","private","protected","public","return","static","super","switch","this","throw","try","type","typeof","var","void","while","with","yield","as","is","keyof","readonly","declare","namespace","abstract","satisfies"]),builtins:new Set(["Array","Boolean","Date","Error","Function","JSON","Math","Number","Object","Promise","RegExp","String","Symbol","Map","Set","WeakMap","WeakSet","console","window","document","globalThis","process","require","module","exports","Buffer","setTimeout","setInterval","clearTimeout","clearInterval","fetch","Response","Request","Headers","URL","URLSearchParams","FormData","Blob","File","FileReader","Intl","Proxy","Reflect","BigInt"]),types:new Set(["any","boolean","number","string","void","never","unknown","null","undefined","object","symbol","bigint"]),constants:new Set(["true","false","null","undefined","NaN","Infinity"]),operators:/[+\-*/%=<>!&|^~?:]+/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",stringDelimiters:["'",'"'],templateLiteralStart:"`",templateLiteralEnd:"`",numberPattern:/\b(?:0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|(?:\d[\d_]*)?\.?\d[\d_]*(?:[eE][+-]?\d[\d_]*)?n?)\b/,identifierPattern:/[a-zA-Z_$][a-zA-Z0-9_$]*/,nestedComments:false},U={name:"python",extensions:[".py",".pyw",".pyi"],keywords:new Set(["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","match","case"]),builtins:new Set(["abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__"]),types:new Set(["int","float","str","bool","list","dict","set","tuple","bytes","None"]),constants:new Set(["True","False","None","Ellipsis","NotImplemented","__debug__"]),operators:/[+\-*/%=<>!@&|^~:]+/,lineComment:"#",blockCommentStart:null,blockCommentEnd:null,stringDelimiters:["'",'"',"'''",'"""'],templateLiteralStart:null,templateLiteralEnd:null,numberPattern:/\b(?:0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|(?:\d[\d_]*)?\.?\d[\d_]*(?:[eE][+-]?\d[\d_]*)?[jJ]?)\b/,identifierPattern:/[a-zA-Z_][a-zA-Z0-9_]*/,nestedComments:false},ge={name:"rust",extensions:[".rs"],keywords:new Set(["as","async","await","break","const","continue","crate","dyn","else","enum","extern","false","fn","for","if","impl","in","let","loop","match","mod","move","mut","pub","ref","return","self","Self","static","struct","super","trait","true","type","union","unsafe","use","where","while","macro_rules"]),builtins:new Set(["Option","Some","None","Result","Ok","Err","Box","Vec","String","HashMap","HashSet","Rc","Arc","RefCell","Cell","Mutex","RwLock","println","eprintln","print","eprint","format","panic","assert","assert_eq","assert_ne","debug_assert","todo","unimplemented","unreachable","cfg","derive"]),types:new Set(["bool","char","str","u8","u16","u32","u64","u128","usize","i8","i16","i32","i64","i128","isize","f32","f64","()"]),constants:new Set(["true","false"]),operators:/[+\-*/%=<>!&|^~?:@]+/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",stringDelimiters:['"'],templateLiteralStart:null,templateLiteralEnd:null,numberPattern:/\b(?:0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|(?:\d[\d_]*)?\.?\d[\d_]*(?:[eE][+-]?\d[\d_]*)?(?:_?(?:u8|u16|u32|u64|u128|usize|i8|i16|i32|i64|i128|isize|f32|f64))?)\b/,identifierPattern:/[a-zA-Z_][a-zA-Z0-9_]*/,nestedComments:true},Ze={name:"go",extensions:[".go"],keywords:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"]),builtins:new Set(["append","cap","close","complex","copy","delete","imag","len","make","new","panic","print","println","real","recover"]),types:new Set(["bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),constants:new Set(["true","false","nil","iota"]),operators:/[+\-*/%=<>!&|^~:]+/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",stringDelimiters:['"',"'","`"],templateLiteralStart:null,templateLiteralEnd:null,numberPattern:/\b(?:0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|(?:\d[\d_]*)?\.?\d[\d_]*(?:[eE][+-]?\d[\d_]*)?i?)\b/,identifierPattern:/[a-zA-Z_][a-zA-Z0-9_]*/,nestedComments:false},pe={name:"shell",extensions:[".sh",".bash",".zsh",".fish"],keywords:new Set(["if","then","else","elif","fi","case","esac","for","while","until","do","done","in","function","select","time","coproc","return","exit","break","continue","local","declare","typeset","readonly","export","unset","shift","source","alias","unalias"]),builtins:new Set(["echo","printf","read","cd","pwd","pushd","popd","dirs","set","shopt","test","eval","exec","trap","wait","kill","jobs","fg","bg","suspend","disown","builtin","command","type","hash","help","let","true","false","getopts","bind","complete","compgen","compopt","caller","enable","mapfile","readarray","ulimit","umask"]),types:new Set([]),constants:new Set(["true","false"]),operators:/[+\-*/%=<>!&|^~?:;]+/,lineComment:"#",blockCommentStart:null,blockCommentEnd:null,stringDelimiters:['"',"'"],templateLiteralStart:null,templateLiteralEnd:null,numberPattern:/\b\d+\b/,identifierPattern:/[a-zA-Z_][a-zA-Z0-9_]*/,nestedComments:false},Ke={name:"json",extensions:[".json",".jsonc",".json5"],keywords:new Set([]),builtins:new Set([]),types:new Set([]),constants:new Set(["true","false","null"]),operators:/[:]/,lineComment:null,blockCommentStart:null,blockCommentEnd:null,stringDelimiters:['"'],templateLiteralStart:null,templateLiteralEnd:null,numberPattern:/\b-?(?:\d+)?\.?\d+(?:[eE][+-]?\d+)?\b/,identifierPattern:/[a-zA-Z_][a-zA-Z0-9_]*/,nestedComments:false},j={name:"plaintext",extensions:[".txt",".text"],keywords:new Set([]),builtins:new Set([]),types:new Set([]),constants:new Set([]),operators:/(?!)/,lineComment:null,blockCommentStart:null,blockCommentEnd:null,stringDelimiters:[],templateLiteralStart:null,templateLiteralEnd:null,numberPattern:/(?!)/,identifierPattern:/(?!)/,nestedComments:false},qe=[z,U,ge,Ze,pe,Ke,j];function Xe(e){return {grammar:e,entries:new Map,dirty:new Set,lineCount:0,fullInvalidate:true}}function Ea(e){e.entries.clear(),e.dirty.clear(),e.lineCount=0,e.fullInvalidate=true;}function Je(e,t){if(e.grammar.name!==t.name){e.grammar=t,e.fullInvalidate=true;for(let n=0;n<e.lineCount;n++)e.dirty.add(n);}}function Wa(e){return {cachedLines:e.entries.size,dirtyLines:e.dirty.size,grammar:e.grammar.name,lineCount:e.lineCount,fullInvalidate:e.fullInvalidate}}function Ma(e,t,n){for(let r=t;r<n;r++)e.dirty.add(r);}function Ia(e,t){e.dirty.add(t);}function Da(e){e.fullInvalidate=true;for(let t=0;t<e.lineCount;t++)e.dirty.add(t);}function V(e,t){return e.inString===t.inString&&e.inComment===t.inComment&&e.templateDepth===t.templateDepth&&e.commentDepth===t.commentDepth}function B(e,t,n){let o=Pa(e,t,n,[]),i=_a(e),a=va(i);for(;o.pos<t.length;)Ba(o,a)||o.pos++;return {text:t,tokens:o.tokens,startState:n,endState:o.state}}function va(e){return [Fa,Oa,Na,Ha,Ga,za,Ua,t=>Va(t,e),Ka,qa,Xa,Ja]}function Ba(e,t){for(let n of t)if(n(e))return true;return false}function Pa(e,t,n,r){return {grammar:e,line:t,tokens:r,pos:0,state:{...n},addToken:(o,i,a)=>{a>i&&r.push({type:o,start:i,end:a,text:t.slice(i,a)});},startsWithAt:(o,i)=>t.slice(i,i+o.length)===o}}function _a(e){return [...e.stringDelimiters].sort((t,n)=>n.length-t.length)}function Fa(e){if(e.state.inString===null)return false;let t=e.state.inString,n=e.pos;for(;e.pos<e.line.length;){let r=e.line[e.pos];if(r==="\\"&&e.pos+1<e.line.length)e.pos+=2;else if(t.length===3&&e.startsWithAt(t,e.pos)||t.length===1&&r===t){e.pos+=t.length,e.state={...e.state,inString:null};break}else e.pos++;}return e.addToken("string",n,e.pos),true}function Oa(e){if(!e.state.inComment||!e.grammar.blockCommentEnd)return false;let t=e.pos;for(;e.pos<e.line.length;)if(e.grammar.nestedComments&&e.grammar.blockCommentStart&&e.startsWithAt(e.grammar.blockCommentStart,e.pos))e.state={...e.state,commentDepth:e.state.commentDepth+1},e.pos+=e.grammar.blockCommentStart.length;else if(e.startsWithAt(e.grammar.blockCommentEnd,e.pos))if(e.grammar.nestedComments&&e.state.commentDepth>0)e.state={...e.state,commentDepth:e.state.commentDepth-1},e.pos+=e.grammar.blockCommentEnd.length;else {e.pos+=e.grammar.blockCommentEnd.length,e.state={...e.state,inComment:false,commentDepth:0};break}else e.pos++;return e.addToken("comment",t,e.pos),true}function Na(e){if(e.state.templateDepth<=0||!e.grammar.templateLiteralEnd)return false;let t=e.pos;for(;e.pos<e.line.length;)if(e.line[e.pos]==="\\"&&e.pos+1<e.line.length)e.pos+=2;else if(e.startsWithAt("${",e.pos)){e.addToken("string",t,e.pos),e.pos+=2,e.addToken("punctuation",e.pos-2,e.pos);break}else if(e.startsWithAt(e.grammar.templateLiteralEnd,e.pos)){e.pos+=e.grammar.templateLiteralEnd.length,e.state={...e.state,templateDepth:e.state.templateDepth-1};break}else e.pos++;return e.pos>t&&e.addToken("string",t,e.pos),true}function Ha(e){if(!/\s/.test(e.line[e.pos]||""))return false;let t=e.pos;for(;e.pos<e.line.length&&/\s/.test(e.line[e.pos]||"");)e.pos++;return e.addToken("text",t,e.pos),true}function Ga(e){return !e.grammar.lineComment||!e.startsWithAt(e.grammar.lineComment,e.pos)?false:(e.addToken("comment",e.pos,e.line.length),e.pos=e.line.length,true)}function za(e){if(!e.grammar.blockCommentStart||!e.startsWithAt(e.grammar.blockCommentStart,e.pos))return false;let t=e.pos;return ja(e)||(e.state={...e.state,inComment:true}),e.addToken("comment",t,e.pos),true}function Ua(e){if(!e.grammar.templateLiteralStart||!e.startsWithAt(e.grammar.templateLiteralStart,e.pos))return false;let t=e.pos;for(e.pos+=e.grammar.templateLiteralStart.length;e.pos<e.line.length&&e.grammar.templateLiteralEnd;)if(e.line[e.pos]==="\\"&&e.pos+1<e.line.length)e.pos+=2;else if(e.startsWithAt("${",e.pos)){e.addToken("string",t,e.pos),e.pos+=2,e.addToken("punctuation",e.pos-2,e.pos),e.state={...e.state,templateDepth:e.state.templateDepth+1};break}else if(e.startsWithAt(e.grammar.templateLiteralEnd,e.pos)){e.pos+=e.grammar.templateLiteralEnd.length,e.addToken("string",t,e.pos);break}else e.pos++;return e.pos>=e.line.length&&e.pos>t+1&&(e.state={...e.state,templateDepth:e.state.templateDepth+1},e.addToken("string",t,e.pos)),true}function Va(e,t){let n=$a(e,t);if(!n)return false;let r=e.pos;return e.pos+=n.length,Za(e,n),e.pos>=e.line.length&&n.length===3&&(e.state={...e.state,inString:n}),e.addToken("string",r,e.pos),true}function ja(e){if(!e.grammar.blockCommentStart||!e.grammar.blockCommentEnd)return false;for(e.pos+=e.grammar.blockCommentStart.length;e.pos<e.line.length;){if(e.grammar.nestedComments&&e.startsWithAt(e.grammar.blockCommentStart,e.pos)){e.state={...e.state,commentDepth:e.state.commentDepth+1},e.pos+=e.grammar.blockCommentStart.length;continue}if(e.startsWithAt(e.grammar.blockCommentEnd,e.pos)){if(e.grammar.nestedComments&&e.state.commentDepth>0){e.state={...e.state,commentDepth:e.state.commentDepth-1},e.pos+=e.grammar.blockCommentEnd.length;continue}return e.pos+=e.grammar.blockCommentEnd.length,true}e.pos++;}return false}function $a(e,t){for(let n of t)if(e.startsWithAt(n,e.pos))return n;return null}function Za(e,t){for(;e.pos<e.line.length;){if(e.line[e.pos]==="\\"&&e.pos+1<e.line.length){e.pos+=2;continue}if(t.length===3&&e.startsWithAt(t,e.pos)||t.length===1&&e.line[e.pos]===t){e.pos+=t.length;break}e.pos++;}}function Ka(e){let t=e.grammar.numberPattern.exec(e.line.slice(e.pos));return !t||t.index!==0?false:(e.addToken("number",e.pos,e.pos+t[0].length),e.pos+=t[0].length,true)}function qa(e){let t=e.grammar.identifierPattern.exec(e.line.slice(e.pos));if(!t||t.index!==0)return false;let n=t[0],r="identifier";return e.grammar.keywords.has(n)?r="keyword":e.grammar.constants.has(n)?r="constant":e.grammar.builtins.has(n)?r="builtin":(e.grammar.types.has(n)||/^[A-Z]/.test(n))&&(r="type"),e.line.slice(e.pos+n.length).trimStart().startsWith("(")&&r==="identifier"&&(r="function"),e.addToken(r,e.pos,e.pos+n.length),e.pos+=n.length,true}function Xa(e){let t=e.grammar.operators.exec(e.line.slice(e.pos));return !t||t.index!==0?false:(e.addToken("operator",e.pos,e.pos+t[0].length),e.pos+=t[0].length,true)}function Ja(e){let t=e.line[e.pos]||"";return /[()[\]{},;.]/.test(t)?(e.addToken("punctuation",e.pos,e.pos+1),e.pos++,true):false}function Ye(e,t){let n=t.split(`
|
|
16
|
+
`);e.lineCount=n.length,e.fullInvalidate&&(e.entries.clear(),e.dirty.clear(),e.fullInvalidate=false);let r=[],o=he;for(let i=0;i<n.length;i++){let a=n[i]??"",l=e.entries.get(i);if(l&&l.text===a&&V(l.startState,o)&&!e.dirty.has(i))r.push(l),o=l.endState;else {let s=B(e.grammar,a,o);e.entries.set(i,s),e.dirty.delete(i),r.push(s),o=s.endState;let u=e.entries.get(i+1);u&&!V(o,u.startState)&&e.dirty.add(i+1);}}return r}function Ya(e,t,n,r){let o=performance.now(),i=t.split(`
|
|
17
|
+
`);e.lineCount=i.length;let a=Math.max(0,n),l=Math.min(i.length,r);e.fullInvalidate&&(e.entries.clear(),e.dirty.clear(),e.fullInvalidate=false);let s=he;for(let c=0;c<a;c++){let m=i[c]??"",h=e.entries.get(c);if(h&&h.text===m&&V(h.startState,s)&&!e.dirty.has(c))s=h.endState;else {let g=B(e.grammar,m,s);e.entries.set(c,g),e.dirty.delete(c),s=g.endState;}}let u=[];for(let c=a;c<l;c++){let m=i[c]??"",h=e.entries.get(c);if(h&&h.text===m&&V(h.startState,s)&&!e.dirty.has(c))u.push(h),s=h.endState;else {let g=B(e.grammar,m,s);e.entries.set(c,g),e.dirty.delete(c),u.push(g),s=g.endState;}}let d=l<i.length,f=performance.now()-o;return {lines:u,hasMore:d,nextLine:l,timeMs:f}}function Qa(e,t,n,r=100){let o=performance.now(),i=t.split(`
|
|
18
|
+
`);e.lineCount=i.length;let a=Math.max(0,Math.min(n,i.length)),l=Math.min(a+r,i.length),s=he,u=e.entries.get(a-1);if(a>0&&u)s=u.endState;else if(a>0)for(let m=0;m<a;m++){let h=i[m]??"",g=e.entries.get(m);if(g&&g.text===h&&V(g.startState,s))s=g.endState;else {let W=B(e.grammar,h,s);e.entries.set(m,W),s=W.endState;}}let d=[];for(let m=a;m<l;m++){let h=i[m]??"",g=B(e.grammar,h,s);e.entries.set(m,g),e.dirty.delete(m),d.push(g),s=g.endState;}let f=l<i.length,c=performance.now()-o;return {lines:d,hasMore:f,nextLine:l,timeMs:c}}function Qe(e){let t=e.slice(e.lastIndexOf(".")).toLowerCase();for(let n of qe)if(n.extensions.includes(t))return n;return j}function el(e){let t=e.split(`
|
|
19
|
+
`)[0]||"";if(t.startsWith("#!")){if(/python/.test(t))return U;if(/node|deno|bun/.test(t))return z;if(/bash|sh|zsh/.test(t))return pe}return /^package\s+\w+/.test(t)?Ze:/^(use\s+|mod\s+|fn\s+|struct\s+|impl\s+|pub\s+)/.test(t)?ge:/^(import|from|def|class)\s+/.test(t)?U:/^(import|export|const|let|var|function|class)\s+/.test(t)?z:/^\s*\{/.test(t)?Ke:j}function et(e){let t=e.toLowerCase();for(let n of qe)if(n.name===t)return n;return t==="ts"||t==="typescript"||t==="tsx"||t==="jsx"?z:t==="py"?U:t==="rs"?ge:t==="bash"||t==="sh"||t==="zsh"?pe:j}var tl=100,Kn=/^(#{1,6})\s+(.+)$/,qn=/^(`{3,}|~{3,})(\w*)?$/,Xn=/^([-*_])\s*\1\s*\1\s*(\1|\s)*$/,be=/^(\s*)[-*+]\s+(.*)$/,xe=/^(\s*)(\d+)[.)]\s+(.*)$/,nl=/^\[([ xX])\]\s+(.*)$/,tt=/^>\s?(.*)$/,rl=/^\|?[\s:-]+\|[\s:|+-]+\|?$/,$n=/^\|(.+)\|$/;function k(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return t}function A(e){let t=[],n=e,r=0;for(;r<n.length;){let o=il(n.slice(r));if(o){r>0&&(t.push({type:"text",content:n.slice(0,r)}),n=n.slice(r),r=0),t.push(o.element),n=n.slice(o.length);continue}r++;}return n.length>0&&t.push({type:"text",content:n}),t}var ol=[al,ll,sl,ul,dl,fl];function il(e){for(let t of ol){let n=t(e);if(n)return n}return null}function al(e){let t=e.match(/^`([^`]+)`/);return t?{element:{type:"code",content:t[1]??""},length:t[0].length}:null}function ll(e){let t=e.match(/^(\*\*|__)(.+?)\1/);if(!t)return null;let n=t[2]??"";return {element:{type:"bold",content:n,children:A(n)},length:t[0].length}}function sl(e){let t=e.match(/^(\*|_)(.+?)\1/);if(!t)return null;let n=t[2]??"";return {element:{type:"italic",content:n,children:A(n)},length:t[0].length}}function ul(e){let t=e.match(/^\[([^\]]+)\]\(([^)]+)\)/);return t?{element:{type:"link",content:t[1]??"",href:t[2]??""},length:t[0].length}:null}function dl(e){let t=e.match(/^!\[([^\]]*)\]\(([^)]+)\)/);return t?{element:{type:"image",content:t[1]??"",href:t[2]??""},length:t[0].length}:null}function fl(e){let t=e.match(/^~~(.+?)~~/);return t?{element:{type:"strikethrough",content:t[1]??""},length:t[0].length}:null}function nt(e){let t=performance.now(),n=e.split(`
|
|
20
|
+
`),r=[],o=0;for(;o<n.length;){let i=n[o];if(i===void 0){o++;continue}if(i.trim()===""){o++;continue}let a=ml(n,o);if(a){r.push(a.block),o=a.nextIndex;continue}o++;}return {blocks:r,parseTimeMs:performance.now()-t}}var cl=[hl,gl,pl,bl,xl,yl,Cl];function ml(e,t){for(let n of cl){let r=n(e,t);if(r)return r}return null}function hl(e,t){let n=e[t];if(n===void 0)return null;let r=n.match(Kn);if(!r)return null;let o=r[2]??"";return {block:{type:"heading",source:n,lineStart:t,lineEnd:t+1,hash:k(n),data:{kind:"heading",level:r[1]?.length??1,text:o,inline:A(o)}},nextIndex:t+1}}function gl(e,t){let n=e[t];return n===void 0||!Xn.test(n)?null:{block:{type:"hr",source:n,lineStart:t,lineEnd:t+1,hash:k(n),data:{kind:"hr"}},nextIndex:t+1}}function pl(e,t){let n=e[t];if(n===void 0)return null;let r=n.match(qn);if(!r)return null;let o=r[1]??"",i=r[2]??"",a=[],l=t,s=t+1;for(;s<e.length;){let d=e[s];if(d===void 0)break;if(d.startsWith(o)&&d.trim()===o){s++;break}a.push(d),s++;}let u=a.join(`
|
|
21
|
+
`);return {block:{type:"code",source:e.slice(l,s).join(`
|
|
22
|
+
`),lineStart:l,lineEnd:s,hash:k(u+i),data:{kind:"code",language:i||Qe("code.txt").name||"",code:u}},nextIndex:s}}function bl(e,t){let n=e[t];if(n===void 0||!tt.test(n))return null;let r=[],o=t,i=t;for(;i<e.length;){let s=e[i];if(s===void 0)break;let u=s.match(tt);if(!u&&s.trim()!=="")break;r.push(u?u[1]??"":""),i++;}let a=r.join(`
|
|
23
|
+
`),l=nt(a);return {block:{type:"blockquote",source:e.slice(o,i).join(`
|
|
24
|
+
`),lineStart:o,lineEnd:i,hash:k(a),data:{kind:"blockquote",content:a,blocks:l.blocks}},nextIndex:i}}function xl(e,t){let n=e[t],r=e[t+1];if(n===void 0||r===void 0||!$n.test(n)||!rl.test(r))return null;let o=t,i=Zn(n),a=Sl(r),l=[],s=t+2;for(;s<e.length;){let u=e[s];if(u===void 0||!$n.test(u))break;l.push(Zn(u)),s++;}return {block:{type:"table",source:e.slice(o,s).join(`
|
|
25
|
+
`),lineStart:o,lineEnd:s,hash:k(e.slice(o,s).join(`
|
|
26
|
+
`)),data:{kind:"table",headers:i,alignments:a,rows:l}},nextIndex:s}}function yl(e,t){let n=e[t];if(n===void 0)return null;let r=kl(n);if(!r)return null;let o=t,i=Tl(e,t,r.ordered);return {block:{type:"list",source:e.slice(o,i.nextIndex).join(`
|
|
27
|
+
`),lineStart:o,lineEnd:i.nextIndex,hash:k(e.slice(o,i.nextIndex).join(`
|
|
28
|
+
`)),data:{kind:"list",ordered:r.ordered,start:r.start,items:i.items}},nextIndex:i.nextIndex}}function Cl(e,t){let n=[],r=t,o=t;for(;o<e.length;){let a=e[o];if(a===void 0||a.trim()===""||n.length>0&&Al(a))break;n.push(a),o++;}if(n.length===0)return null;let i=n.join(" ");return {block:{type:"paragraph",source:n.join(`
|
|
29
|
+
`),lineStart:r,lineEnd:o,hash:k(i),data:{kind:"paragraph",text:i,inline:A(i)}},nextIndex:o}}function Zn(e){return Jn(e).map(t=>{let n=t.trim();return {content:n,inline:A(n)}})}function Sl(e){return Jn(e).map(t=>{let n=t.trim();return n.startsWith(":")&&n.endsWith(":")?"center":n.endsWith(":")?"right":n.startsWith(":")?"left":null})}function Jn(e){return e.slice(1,-1).split("|")}function Ll(e,t,n){let r=e[t];return r===void 0?false:n?xe.test(r):be.test(r)}function kl(e){let t=e.match(be),n=e.match(xe);return !t&&!n?null:{ordered:!!n,start:n?parseInt(n[2]??"1",10):void 0}}function Tl(e,t,n){let r=[],o=t;for(;o<e.length;){let i=e[o];if(i===void 0)break;let a=n?i.match(xe):i.match(be);if(!a&&i.trim()===""){if(!Ll(e,o+1,n))break;o++;continue}if(!a)break;r.push(Rl(a,n)),o++;}return {items:r,nextIndex:o}}function Rl(e,t){let n=(e[1]??"").length,r=t?e[3]??"":e[2]??"",o=r.match(nl),i=o?o[2]??"":r;return {content:i,inline:A(i),indent:n,checked:o?o[1]?.toLowerCase()==="x":void 0}}function Al(e){return Kn.test(e)||Xn.test(e)||qn.test(e)||be.test(e)||xe.test(e)||tt.test(e)}function wl(){return {blocks:new Map,sourceHash:0,highlightCaches:new Map,renderedLines:null}}function El(e){e.blocks.clear(),e.sourceHash=0,e.highlightCaches.clear(),e.renderedLines=null;}function Wl(e,t){let n=k(t);if(e.sourceHash===n&&e.renderedLines)return {blocks:Array.from(e.blocks.values()),parseTimeMs:0};let r=nt(t);e.blocks.clear();for(let o of r.blocks){let i=`${o.lineStart}-${o.lineEnd}`;e.blocks.set(i,o);}return e.sourceHash=n,e.renderedLines=null,r}function Ml(e,t,n){for(let[r,o]of e.blocks)o.lineStart<n&&o.lineEnd>t&&e.blocks.delete(r);e.renderedLines=null;}function rt(e,t){let n=[],r={},o=Il[e.data.kind];return o&&o(e,t,n,r),n}function ot(e,t){if(t.renderedLines)return t.renderedLines;let n=[],r=0;for(let[o,i]of e.blocks.entries()){let a=rt(i,t);for(let l of a)n.push({...l,blockIndex:o}),r++;o<e.blocks.length-1&&(n.push({content:"",style:{},blockIndex:o,lineInBlock:-1}),r++);}return t.renderedLines=n,n}var Il={heading:Dl,paragraph:vl,code:Bl,list:Pl,table:_l,blockquote:Fl,hr:Ol,html:Nl};function Dl(e,t,n,r){let o=e.data;o.kind==="heading"&&n.push({content:`${"#".repeat(o.level)} ${o.text}`,style:{bold:true},blockIndex:0,lineInBlock:0});}function vl(e,t,n,r){let o=e.data;o.kind==="paragraph"&&n.push({content:o.text,style:r,blockIndex:0,lineInBlock:0});}function Bl(e,t,n,r){let o=e.data;if(o.kind!=="code")return;let i=et(o.language||"plaintext"),a=t.highlightCaches.get(e.hash.toString());a?a.grammar.name!==i.name&&Je(a,i):(a=Xe(i),t.highlightCaches.set(e.hash.toString(),a)),Ye(a,o.code);for(let[l,s]of o.code.split(`
|
|
30
|
+
`).entries())n.push({content:s,style:{dim:true},blockIndex:0,lineInBlock:l});}function Pl(e,t,n,r){let o=e.data;if(o.kind==="list")for(let[i,a]of o.items.entries()){let l=o.ordered?`${(o.start||1)+i}. `:`${" ".repeat(a.indent/2)}- `,s=a.checked!==void 0?a.checked?"[x] ":"[ ] ":"";n.push({content:l+s+a.content,style:r,blockIndex:0,lineInBlock:i});}}function _l(e,t,n,r){let o=e.data;if(o.kind!=="table")return;let i=o.headers.map(l=>l.content).join(" | ");n.push({content:`| ${i} |`,style:{bold:true},blockIndex:0,lineInBlock:0});let a=o.headers.map((l,s)=>{let u=o.alignments[s];return u==="center"?":---:":u==="right"?"---:":u==="left"?":---":"---"}).join(" | ");n.push({content:`| ${a} |`,style:r,blockIndex:0,lineInBlock:1});for(let[l,s]of o.rows.entries()){let u=s.map(d=>d.content).join(" | ");n.push({content:`| ${u} |`,style:r,blockIndex:0,lineInBlock:l+2});}}function Fl(e,t,n,r){let o=e.data;if(o.kind==="blockquote"){for(let i of o.blocks){let a=rt(i,t);for(let l of a)n.push({...l,content:`> ${l.content}`,style:{...l.style,italic:true}});}n.length===0&&n.push({content:">",style:{italic:true},blockIndex:0,lineInBlock:0});}}function Ol(e,t,n,r){e.data.kind==="hr"&&n.push({content:"---",style:{dim:true},blockIndex:0,lineInBlock:0});}function Nl(e,t,n,r){let o=e.data;if(o.kind==="html")for(let[i,a]of o.html.split(`
|
|
31
|
+
`).entries())n.push({content:a,style:{dim:true},blockIndex:0,lineInBlock:i});}function Hl(e,t,n,r){let o=ot(e,t),i=Math.min(n+r,o.length);return {lines:o.slice(n,i),totalLines:o.length,startIndex:n,endIndex:i}}function Gl(e,t){return ot(e,t).length}function zl(e){let t=0,n=0,r=0,o=0,i=0,a=0;for(let l of e.blocks){switch(a+=l.lineEnd-l.lineStart,l.type){case "heading":t++;break;case "code":n++;break;case "list":r++;break;case "table":o++;break}let s=u=>{let d=0;for(let f of u)f.type==="link"&&d++,f.children&&(d+=s(f.children));return d};(l.data.kind==="paragraph"||l.data.kind==="heading")&&(i+=s(l.data.inline));}return {blockCount:e.blocks.length,lineCount:a,headingCount:t,codeBlockCount:n,listCount:r,tableCount:o,linkCount:i}}var Ul=512,Vl=256,jl=48;function $l(e){let t=0;for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t++;return t}function Zl(e){let t=[];for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t.push(n);return t}function $(e){let t=Zl(e);return {type:"leaf",text:e,length:e.length,newlines:t.length,lineBreaks:t}}function Z(){return {type:"leaf",text:"",length:0,newlines:0,lineBreaks:[]}}function ye(e,t){let n=e.type==="node"?e.depth:0,r=t.type==="node"?t.depth:0;return {type:"node",left:e,right:t,leftLength:e.length,length:e.length+t.length,newlines:e.newlines+t.newlines,depth:Math.max(n,r)+1}}function Kl(e){let t=e.left.type==="node"?e.left.depth:0,n=e.right.type==="node"?e.right.depth:0;return Math.abs(t-n)>1||e.depth>48}function Ce(e,t){if(e.type==="leaf"){e.length>0&&t.push(e.text);return}Ce(e.left,t),Ce(e.right,t);}function Se(e){if(e.length===0)return Z();if(e.length===1){let o=e[0];return o===void 0?Z():$(o)}let t=Math.floor(e.length/2),n=Se(e.slice(0,t)),r=Se(e.slice(t));return ye(n,r)}function ql(e){if(e.type==="leaf"||!Kl(e))return e;let t=[];Ce(e,t);let n=[];for(let r of t)if(r.length<=512)n.push(r);else for(let o=0;o<r.length;o+=512)n.push(r.slice(o,o+512));return Se(n)}function Yn(e=""){if(e.length===0)return Z();if(e.length<=512)return $(e);let t=[];for(let n=0;n<e.length;n+=512)t.push(e.slice(n,n+512));return Se(t)}function Xl(){return Z()}function Jl(e){return e.length}function Yl(e){return e.newlines}function Ql(e){return e.newlines+1}function es(e){return e.length===0}function it(e,t){if(!(t<0||t>=e.length))return e.type==="leaf"?e.text.charAt(t):t<e.leftLength?it(e.left,t):it(e.right,t-e.leftLength)}function T(e,t,n){let r=n??e.length,o=t;if(o<0&&(o=0),r>e.length)return T(e,o,e.length);if(o>=r)return "";if(e.type==="leaf")return e.text.slice(o,r);let i=e.leftLength;if(r<=i)return T(e.left,o,r);if(o>=i)return T(e.right,o-i,r-i);let a=T(e.left,o,i),l=T(e.right,0,r-i);return a+l}function ts(e){if(e.type==="leaf")return e.text;let t=[];return Ce(e,t),t.join("")}function at(e,t){if(t<=0)return 0;if(t>=e.length)return e.newlines;if(e.type==="leaf"){let r=0;for(let o of e.lineBreaks){if(o>=t)break;r++;}return r}return t<e.leftLength?at(e.left,t):e.left.newlines+at(e.right,t-e.leftLength)}function Qn(e,t){return t<0?-1:t===0?0:t>e.newlines?-1:lt(e,t,0)}function lt(e,t,n){if(e.type==="leaf"){let o=0;for(let i of e.lineBreaks)if(o++,o===t)return n+i+1;return -1}let r=e.left.newlines;return t<=r?lt(e.left,t,n):lt(e.right,t-r,n+e.leftLength)}function er(e,t){return t<0||t>e.newlines?-1:t===e.newlines?e.length:st(e,t,0)}function st(e,t,n){if(e.type==="leaf"){let o=0;for(let i of e.lineBreaks){if(o===t)return n+i;o++;}return -1}let r=e.left.newlines;return t<r?st(e.left,t,n):st(e.right,t-r,n+e.leftLength)}function tr(e,t){if(t<0||t>e.newlines)return;let n=Qn(e,t),r=er(e,t);return n===-1?{text:T(e,0,r===-1?e.length:r),start:0,end:r===-1?e.length:r,lineNumber:t}:{text:T(e,n,r===-1?e.length:r),start:n,end:r===-1?e.length:r,lineNumber:t}}function ns(e,t,n){let r=[],o=e.newlines+1;for(let i=t;i<n&&i<o;i++){let a=tr(e,i);a&&r.push(a);}return r}function K(e,t){if(t<=0)return {left:null,right:e};if(t>=e.length)return {left:e,right:null};if(e.type==="leaf"){let o=e.text.slice(0,t),i=e.text.slice(t);return {left:o.length>0?$(o):null,right:i.length>0?$(i):null}}if(t<=e.leftLength){let{left:o,right:i}=K(e.left,t);return i===null?{left:o,right:e.right}:{left:o,right:ye(i,e.right)}}let{left:n,right:r}=K(e.right,t-e.leftLength);return n===null?{left:e.left,right:r}:{left:ye(e.left,n),right:r}}function ut(e,t){if(e===null||e.length===0)return t??Z();if(t===null||t.length===0)return e;if(e.type==="leaf"&&t.type==="leaf"&&e.length+t.length<=512)return $(e.text+t.text);let n=ye(e,t);return ql(n)}function Le(e,t,n){if(n.length===0)return e;let r=t;r<0&&(r=0),r>e.length&&(r=e.length);let o=Yn(n),{left:i,right:a}=K(e,r);return ut(ut(i,o),a)}function rs(e,t){return Le(e,e.length,t)}function os(e,t){return Le(e,0,t)}function nr(e,t,n){let r=t,o=n;if(r<0&&(r=0),o>e.length&&(o=e.length),r>=o)return e;let{left:i}=K(e,r),{right:a}=K(e,o);return ut(i,a)}function is(e,t,n,r){let o=nr(e,t,n);return Le(o,t,r)}function as(e){let t=0,n=0,r=0;function o(i,a){if(i.type==="leaf"){t++,n+=i.length,r=Math.max(r,a);return}o(i.left,a+1),o(i.right,a+1);}return o(e,0),{length:e.length,newlines:e.newlines,leafCount:t,depth:r,avgLeafSize:t>0?n/t:0}}function dt(e){return e.type==="leaf"?e.length===e.text.length&&e.newlines===$l(e.text)&&e.lineBreaks.length===e.newlines:e.leftLength!==e.left.length||e.length!==e.left.length+e.right.length||e.newlines!==e.left.newlines+e.right.newlines?false:dt(e.left)&&dt(e.right)}var rr=(u=>(u[u.NONE=0]="NONE",u[u.BOLD=1]="BOLD",u[u.UNDERLINE=2]="UNDERLINE",u[u.BLINK=4]="BLINK",u[u.INVERSE=8]="INVERSE",u[u.INVISIBLE=16]="INVISIBLE",u[u.DIM=32]="DIM",u[u.ITALIC=64]="ITALIC",u[u.STRIKETHROUGH=128]="STRIKETHROUGH",u))(rr||{});function ft(e){let t=0;return e.bold&&(t|=1),e.underline&&(t|=2),e.blink&&(t|=4),e.inverse&&(t|=8),e.invisible&&(t|=16),e.dim&&(t|=32),e.italic&&(t|=64),e.strikethrough&&(t|=128),t}function ls(e){return {bold:(e&1)!==0,underline:(e&2)!==0,blink:(e&4)!==0,inverse:(e&8)!==0,invisible:(e&16)!==0,dim:(e&32)!==0,italic:(e&64)!==0,strikethrough:(e&128)!==0}}function ss(e,t=4294967295,n=0){return {fg:e.fg??t,bg:e.bg??n,attrs:ft(e)}}function us(e){return {fg:e.fg,bg:e.bg,attrs:ft(e)}}function ds(e,t){return e.fg===t.fg&&e.bg===t.bg&&e.attrs===t.attrs}function fs(e){return {fg:e.fg,bg:e.bg,attrs:e.attrs}}function cs(e,t){return {fg:t.fg??e.fg,bg:t.bg??e.bg,attrs:t.attrs!==void 0?t.attrs:e.attrs}}function ms(e,t){return (e.attrs&t)!==0}function hs(e,t){return {fg:e.fg,bg:e.bg,attrs:e.attrs|t}}function gs(e,t){return {fg:e.fg,bg:e.bg,attrs:e.attrs&~t}}function ps(e){return {fg:e.bg,bg:e.fg,attrs:e.attrs}}function bs(){return {fg:4294967295,bg:0,attrs:0}}function xs(e){let t=BigInt(e.fg>>>0),n=BigInt(e.bg>>>0)<<32n,r=BigInt(e.attrs)<<64n;return t|n|r}function ys(e){let t=Number(e&0xffffffffn),n=Number(e>>32n&0xffffffffn),r=Number(e>>64n&0xffn);return {fg:t,bg:n,attrs:r}}var w=4294967295,E=0,P=/\{(\/?[a-zA-Z0-9_#-]+|\/)\}/g,ke="\0LBRACE\0",Te="\0RBRACE\0",ct={black:255,red:4278190335,green:16711935,yellow:4294902015,blue:65535,magenta:4278255615,cyan:16777215,white:4294967295,"bright-black":2155905279,gray:2155905279,grey:2155905279,"bright-red":4286611711,"bright-green":2164228351,"bright-yellow":4294934783,"bright-blue":2155937791,"bright-magenta":4286644223,"bright-cyan":2164260863,"bright-white":4294967295,orange:4289003775,pink:4290825215,purple:2147516671,brown:2771004159,lime:852308735,navy:33023,teal:8421631,olive:2155872511,maroon:2147483903,aqua:16777215,silver:3233857791,default:0,transparent:0},or={bold:1,underline:2,ul:2,blink:4,inverse:8,invisible:16,hidden:16,dim:32,italic:64,strikethrough:128,strike:128},ir={left:"left",center:"center",right:"right"};function Cs(e){let t=e.startsWith("#")?e.slice(1):e;if(!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$/.test(t))return null;let n,r,o;if(t.length===3){let i=t[0]??"0",a=t[1]??"0",l=t[2]??"0";n=Number.parseInt(i+i,16),r=Number.parseInt(a+a,16),o=Number.parseInt(l+l,16);}else n=Number.parseInt(t.slice(0,2),16),r=Number.parseInt(t.slice(2,4),16),o=Number.parseInt(t.slice(4,6),16);return (n<<24|r<<16|o<<8|255)>>>0}function ht(e){let t=e.toLowerCase();if(t in ct)return ct[t]??null;let n=Cs(e);if(n!==null)return n;let r=Number.parseInt(e,10);return !Number.isNaN(r)&&r>=0&&r<=255?Ss(r):null}function Ss(e){if(e<8)return [255,2147483903,8388863,2155872511,33023,2147516671,8421631,3233857791][e]??255;if(e<16)return [2155905279,4278190335,16711935,4294902015,65535,4278255615,16777215,4294967295][e-8]??2155905279;if(e<232){let n=e-16,r=Math.floor(n/36)*51,o=Math.floor(n/6)%6*51,i=n%6*51;return (r<<24|o<<16|i<<8|255)>>>0}let t=(e-232)*10+8;return (t<<24|t<<16|t<<8|255)>>>0}function Ls(){return {fg:[],bg:[],attrs:new Map}}function ks(e,t){e.fg=w,e.bg=E,e.attrs=0,t.fg=[],t.bg=[],t.attrs.clear();}function Ts(e,t,n){n.attrs.get(e)?.pop()?.prevValue?t.attrs|=e:t.attrs&=~e;}function Rs(e,t,n,r){let o=r.attrs.get(e);o||(o=[],r.attrs.set(e,o)),o.push({type:"attr",prevValue:n.attrs&e,tagName:t}),n.attrs|=e;}function As(e,t,n,r){if(!(e in or))return false;let o=or[e];return o===void 0?false:(t?Ts(o,n,r):Rs(o,e,n,r),true)}function ws(e,t,n,r){let o=e.match(/^(.+)-fg$/);if(!o?.[1])return false;if(t)if(r.fg.length>0){let i=r.fg.pop();i&&(n.fg=i.prevValue);}else n.fg=w;else {let i=ht(o[1]);i!==null&&(r.fg.push({type:"fg",prevValue:n.fg,tagName:e}),n.fg=i);}return true}function Es(e,t,n,r){let o=e.match(/^(.+)-bg$/);if(!o?.[1])return false;if(t)if(r.bg.length>0){let i=r.bg.pop();i&&(n.bg=i.prevValue);}else n.bg=E;else {let i=ht(o[1]);i!==null&&(r.bg.push({type:"bg",prevValue:n.bg,tagName:e}),n.bg=i);}return true}function Ws(e,t,n,r){if(t)return false;let o=ht(e);return o===null?false:(r.fg.push({type:"fg",prevValue:n.fg,tagName:e}),n.fg=o,true)}function Ms(e,t,n){if(e==="/")return ks(t,n),null;let r=e.startsWith("/"),o=r?e.slice(1):e;return o in ir?ir[o]??null:(As(o,r,t,n)||ws(o,r,t,n)||Es(o,r,t,n)||Ws(o,r,t,n),null)}function Is(e){let t=[],n="left",r="",o=e.replace(/\{\{/g,ke).replace(/\}\}/g,Te),i={fg:w,bg:E,attrs:0},a=Ls(),l=0,s;for(P.lastIndex=0;(s=P.exec(o))!==null;){if(s.index>l){let d=ar(o.slice(l,s.index));r=lr(t,i,d,r);}let u=s[1];if(u!==void 0){let d=Ms(u,i,a);d!==null&&(n=d);}l=P.lastIndex;}if(l<o.length){let u=ar(o.slice(l));r=lr(t,i,u,r);}return t.length===0&&e.length===0?{segments:[],alignment:n,plainText:""}:{segments:t,alignment:n,plainText:r}}function ar(e){return e.replaceAll(ke,"{").replaceAll(Te,"}")}function lr(e,t,n,r){return n.length===0?r:(e.push({text:n,fg:t.fg,bg:t.bg,attrs:t.attrs}),r+n)}function gt(e){return e.replace(/\{\{/g,ke).replace(/\}\}/g,Te).replace(P,"").replaceAll(ke,"{").replaceAll(Te,"}")}function Ds(e){return gt(e).trim()}function Re(e){return e.replace(/\{/g,"{{").replace(/\}/g,"}}")}function vs(e,t){let n=[];if(t.bold&&n.push("{bold}"),t.underline&&n.push("{underline}"),t.blink&&n.push("{blink}"),t.inverse&&n.push("{inverse}"),t.invisible&&n.push("{invisible}"),t.dim&&n.push("{dim}"),t.italic&&n.push("{italic}"),t.strikethrough&&n.push("{strikethrough}"),t.fg!==void 0&&t.fg!==w){let o=mt(t.fg);n.push(`{#${o}-fg}`);}if(t.bg!==void 0&&t.bg!==E){let o=mt(t.bg);n.push(`{#${o}-bg}`);}let r=Re(e);return n.length===0?r:`${n.join("")}${r}{/}`}function mt(e){let t=e>>>24&255,n=e>>>16&255,r=e>>>8&255;return t.toString(16).padStart(2,"0")+n.toString(16).padStart(2,"0")+r.toString(16).padStart(2,"0")}function Bs(e){if(e.length===0)return [];let t=e[0];if(!t)return [];let n=[],r={...t};for(let o=1;o<e.length;o++){let i=e[o];i&&(i.fg===r.fg&&i.bg===r.bg&&i.attrs===r.attrs?r={...r,text:r.text+i.text}:(n.push(r),r={...i}));}return n.push(r),n}function Ps(e){return gt(e).length}function _s(e){let t=e.replace(/\{\{/g,"").replace(/\}\}/g,"");return P.lastIndex=0,P.test(t)}var sr=z$1.enum(["left","center","right"]);function q(e,t){for(let[r,o]of Object.entries(ct))if(o===e)return `{${r}-${t}}`;return `{#${mt(e)}-${t}}`}function Fs(e){return e&1?"{bold}":e&2?"{underline}":e&4?"{blink}":e&8?"{inverse}":e&16?"{invisible}":e&32?"{dim}":e&64?"{italic}":e&128?"{strikethrough}":""}function Os(e){let t=[];return e.bold&&t.push("{bold}"),e.underline&&t.push("{underline}"),e.blink&&t.push("{blink}"),e.inverse&&t.push("{inverse}"),e.invisible&&t.push("{invisible}"),e.dim&&t.push("{dim}"),e.italic&&t.push("{italic}"),e.strikethrough&&t.push("{strikethrough}"),e.fg!==void 0&&e.fg!==w&&t.push(q(e.fg,"fg")),e.bg!==void 0&&e.bg!==E&&t.push(q(e.bg,"bg")),t}function Ns(e){let t=[];return e.bg!==void 0&&e.bg!==E&&t.push("{/bg}"),e.fg!==void 0&&e.fg!==w&&t.push("{/fg}"),e.strikethrough&&t.push("{/strikethrough}"),e.italic&&t.push("{/italic}"),e.dim&&t.push("{/dim}"),e.invisible&&t.push("{/invisible}"),e.inverse&&t.push("{/inverse}"),e.blink&&t.push("{/blink}"),e.underline&&t.push("{/underline}"),e.bold&&t.push("{/bold}"),t}function Hs(e,t,n){let r=Re(e),o=t.join(""),i=n?n.join(""):"{/}";return `${o}${r}${i}`}function ur(e){let t=[];return e&1&&t.push("{bold}"),e&2&&t.push("{underline}"),e&4&&t.push("{blink}"),e&8&&t.push("{inverse}"),e&16&&t.push("{invisible}"),e&32&&t.push("{dim}"),e&64&&t.push("{italic}"),e&128&&t.push("{strikethrough}"),t}function dr(e){let t=[],n=ur(e.attrs);t.push(...n),e.fg!==w&&t.push(q(e.fg,"fg")),e.bg!==E&&t.push(q(e.bg,"bg"));let r=Re(e.text);return t.length===0?r:`${t.join("")}${r}{/}`}function Gs(e){let t=[];e.alignment!=="left"&&t.push(`{${e.alignment}}`);for(let n of e.segments)t.push(dr(n));return t.join("")}var fr=z$1.object({text:z$1.string(),fg:z$1.number(),bg:z$1.number(),attrs:z$1.number()}),zs=z$1.object({segments:z$1.array(fr),alignment:sr,plainText:z$1.string()});var Us=5e3,Vs=1e5,js=/(?:^|[^\w])/,$s=/(?:$|[^\w])/;function Zs(e){let t=new Map,n=e.length;for(let r=0;r<n-1;r++){let o=e[r];o!==void 0&&t.set(o,n-1-r);}return t}function cr(e,t,n=true,r=0){if(t.length===0)return [];let o=n?e:e.toLowerCase(),i=n?t:t.toLowerCase(),a=o.length,l=i.length,s=[];if(l>a)return s;let u=Zs(i),d=r+l-1;for(;d<a;){let f=l-1,c=d;for(;f>=0&&o[c]===i[f];)f--,c--;if(f<0)s.push(c+1),d++;else {let m=o[d],h=m!==void 0?u.get(m)??l:l;d+=Math.max(1,h);}}return s}function Ks(e){let t=0,n=Math.min(e.length,1e3);for(let r=0;r<n;r++){let o=e.charCodeAt(r);t=(t<<5)-t+o|0;}return t=(t<<5)-t+e.length|0,t}function qs(e,t){let n=0,r=0;for(let o=0;o<t&&o<e.length;o++)e[o]===`
|
|
32
|
+
`&&(n++,r=o+1);return {line:n,column:t-r}}function mr(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
33
|
+
`&&t.push(n+1);return t}function Xs(e,t){let n=0,r=e.length-1;for(;n<r;){let o=Math.floor((n+r+1)/2),i=e[o];i!==void 0&&i<=t?n=o:r=o-1;}return n}function hr(e,t,n={}){let r=performance.now(),o=n.caseSensitive??false,i=n.wholeWord??false,a=n.maxMatches,l=n.startPosition??0;if(t.length===0)return pt(t,r);let s=cr(e,t,o,l),u=mr(e),{matches:d,truncated:f}=Ys(e,t,s,u,i,a);return {matches:d,totalCount:f?s.length:d.length,truncated:f,timedOut:false,timeMs:performance.now()-r,query:t}}function gr(e,t,n={}){let r=performance.now(),o=n.caseSensitive??false,i=n.maxMatches,a=n.timeout??5e3,l=n.startPosition??0;if(t.length===0)return pt(t,r);let s=Js(t,o);if(!s)return pt(t,r);let u=mr(e),d=eu(e,s,u,l,r+a,i);return {matches:d.matches,totalCount:d.matches.length,truncated:d.truncated,timedOut:d.timedOut,timeMs:performance.now()-r,query:t}}function pt(e,t){return {matches:[],totalCount:0,truncated:false,timedOut:false,timeMs:performance.now()-t,query:e}}function Js(e,t){try{let n=t?"g":"gi";return new RegExp(e,n)}catch{return null}}function Ys(e,t,n,r,o,i){let a=[],l=false;for(let s of n)if(!(o&&!Qs(e,s,t.length))&&(a.push(pr(e,r,s,t.length)),i&&a.length>=i)){l=true;break}return {matches:a,truncated:l}}function Qs(e,t,n){let r=t>0?e[t-1]:"",o=e[t+n]??"";return !(r&&/\w/.test(r)||o&&/\w/.test(o))}function pr(e,t,n,r){let o=Xs(t,n),i=t[o]??0,a=e.slice(n,n+r);return {start:n,end:n+r,line:o,column:n-i,text:a}}function eu(e,t,n,r,o,i){let a=[],l=false,s=false,u=r;t.lastIndex=r;let d=t.exec(e);for(;d!==null;){if(a.length%1e3===0&&performance.now()>o){s=true;break}if(d.index===u&&(t.lastIndex=u+1),u=t.lastIndex,a.push(pr(e,n,d.index,d[0].length)),i&&a.length>=i){l=true;break}d=t.exec(e);}return {matches:a,truncated:l,timedOut:s}}function bt(e,t,n={}){return n.regex?gr(e,t,n):hr(e,t,n)}function br(e,t,n,r=1e5,o={}){let i=performance.now();if(t.length===0||n>=e.length)return {matches:[],hasMore:false,nextPosition:e.length,timeMs:performance.now()-i};let a=Math.min(n+r,e.length),l=e.slice(0,a),u=bt(l,t,{...o,startPosition:n}).matches.filter(f=>f.start>=n&&f.start<a),d=a<e.length;return {matches:u,hasMore:d,nextPosition:a,timeMs:performance.now()-i}}function tu(){return {query:"",options:{},matches:[],textHash:0,currentIndex:-1,complete:false,lastPosition:0}}function nu(e){e.query="",e.options={},e.matches=[],e.textHash=0,e.currentIndex=-1,e.complete=false,e.lastPosition=0;}function ru(e,t,n,r={}){let o=Ks(t),i=e.query!==n,a=e.options.caseSensitive!==r.caseSensitive||e.options.wholeWord!==r.wholeWord||e.options.regex!==r.regex,l=e.textHash!==o;return i||a||l?(e.query=n,e.options=r,e.matches=[],e.textHash=o,e.currentIndex=-1,e.complete=false,e.lastPosition=0,true):false}function ou(e,t,n=1e5){let r=performance.now();if(e.query.length===0)return {matches:e.matches,totalCount:0,truncated:false,timedOut:false,timeMs:performance.now()-r,query:e.query};if(e.complete)return {matches:e.matches,totalCount:e.matches.length,truncated:false,timedOut:false,timeMs:performance.now()-r,query:e.query};let o=br(t,e.query,e.lastPosition,n,e.options);return e.matches.push(...o.matches),e.lastPosition=o.nextPosition,e.complete=!o.hasMore,{matches:e.matches,totalCount:e.matches.length,truncated:false,timedOut:false,timeMs:performance.now()-r,query:e.query}}function iu(e){if(e.matches.length!==0)return e.currentIndex=(e.currentIndex+1)%e.matches.length,e.matches[e.currentIndex]}function au(e){if(e.matches.length!==0)return e.currentIndex=e.currentIndex<=0?e.matches.length-1:e.currentIndex-1,e.matches[e.currentIndex]}function lu(e,t){if(!(t<0||t>=e.matches.length))return e.currentIndex=t,e.matches[t]}function su(e,t,n=true){if(e.matches.length===0)return;let r=0,o=e.matches.length-1;for(;r<o;){let l=Math.floor((r+o)/2),s=e.matches[l];s&&s.start<t?r=l+1:o=l;}let i=e.matches[r],a=r>0?e.matches[r-1]:void 0;if(n&&i)return e.currentIndex=r,{match:i,index:r};if(!n&&a)return e.currentIndex=r-1,{match:a,index:r-1};if(i)return e.currentIndex=r,{match:i,index:r};if(a)return e.currentIndex=r-1,{match:a,index:r-1}}function uu(e,t,n){return e.matches.filter(r=>r.line>=t&&r.line<n)}function du(e){return {current:e.currentIndex+1,total:e.matches.length,complete:e.complete}}function fu(e,t,n={}){let r=bt(e,t,n);return {...r,matches:[...r.matches].reverse()}}export{Co as $,xn as $a,zi as $b,B as $c,ps as $d,Y as A,ne as Aa,oi as Ab,ya as Ac,es as Ad,cr as Ae,qr as B,H as Ba,ii as Bb,Ca as Bc,it as Bd,qs as Be,Xr as C,nn as Ca,ai as Cb,Sa as Cc,T as Cd,hr as Ce,M as D,rn as Da,li as Db,me as Dc,ts as Dd,gr as De,Ae as E,Fe as Ea,si as Eb,Vn as Ec,at as Ed,bt as Ee,Tt as F,on as Fa,ui as Fb,ka as Fc,Qn as Fd,br as Fe,Rt as G,Oe as Ga,di as Gb,jn as Gc,er as Gd,tu as Ge,we as H,Ne as Ha,fi as Hb,Ta as Hc,tr as Hd,nu as He,Jr as I,He as Ia,Fn as Ib,Ra as Ic,ns as Id,ru as Ie,Yr as J,I as Ja,ci as Jb,Aa as Jc,Le as Jd,ou as Je,Qr as K,S as Ka,mi as Kb,wa as Kc,rs as Kd,iu as Ke,eo as L,Ge as La,hi as Lb,he as Lc,os as Ld,au as Le,to as M,p as Ma,ki as Mb,z as Mc,nr as Md,lu as Me,no as N,R as Na,Ti as Nb,U as Nc,is as Nd,su as Ne,ro as O,Ue as Oa,Ei as Ob,ge as Oc,as as Od,uu as Oe,oo as P,sn as Pa,Wi as Pb,Ze as Pc,dt as Pd,du as Pe,Wt as Q,un as Qa,Mi as Qb,pe as Qc,rr as Qd,fu as Qe,co as R,dn as Ra,Ii as Rb,Ke as Rc,ft as Rd,mo as S,ae as Sa,Di as Sb,j as Sc,ls as Sd,ho as T,oe as Ta,vi as Tb,qe as Tc,ss as Td,Mt as U,ie as Ua,Bi as Ub,Xe as Uc,us as Ud,It as V,fn as Va,_i as Vb,Ea as Vc,ds as Vd,go as W,cn as Wa,Fi as Wb,Je as Wc,fs as Wd,po as X,mn as Xa,Oi as Xb,Wa as Xc,cs as Xd,bo as Y,gn as Ya,Ni as Yb,Ma as Yc,ms as Yd,xo as Z,pn as Za,Hi as Zb,Ia as Zc,hs as Zd,yo as _,bn as _a,Gi as _b,Da as _c,gs as _d,_ as a,So as aa,yn as ab,Ui as ac,Ye as ad,bs as ae,Lr as b,Lo as ba,Cn as bb,Vi as bc,Ya as bd,xs as be,kr as c,Fo as ca,Sn as cb,ji as cc,Qa as cd,ys as ce,Tr as d,Nt as da,Ln as db,$i as dc,Qe as dd,Is as de,Rr as e,Ht as ea,kn as eb,Zi as ec,el as ed,gt as ee,Ar as f,Gt as fa,Tn as fb,Ki as fc,et as fd,Ds as fe,wr as g,zt as ga,G as gb,qi as gc,tl as gd,Re as ge,Er as h,Ut as ha,Rn as hb,Xi as hc,A as hd,vs as he,Ir as i,Be as ia,b as ib,Ji as ic,nt as id,Bs as ie,Dr as j,Pe as ja,An as jb,Nn as jc,wl as jd,Ps as je,vr as k,N as ka,Ve as kb,Qi as kc,El as kd,_s as ke,kt as l,Vt as la,le as lb,ea as lc,Wl as ld,sr as le,Br as m,jt as ma,wn as mb,ta as mc,Ml as md,q as me,Pr as n,$t as na,En as nb,na as nc,rt as nd,Fs as ne,Fr as o,Zt as oa,Wn as ob,ra as oc,ot as od,Os as oe,Or as p,Kt as pa,Mn as pb,oa as pc,Hl as pd,Ns as pe,X as q,_e as qa,In as qb,ia as qc,Gl as qd,Hs as qe,Nr as r,qt as ra,Dn as rb,da as rc,zl as rd,ur as re,Hr as s,Xt as sa,vn as sb,fa as sc,Ul as sd,dr as se,Gr as t,Jt as ta,Bn as tb,ca as tc,Vl as td,Gs as te,zr as u,Yt as ua,Pn as ub,ma as uc,jl as ud,fr as ue,Ur as v,Qt as va,_n as vb,ga as vc,Yn as vd,zs as ve,jr as w,ee as wa,ei as wb,pa as wc,Xl as wd,Us as we,$r as x,en as xa,ti as xb,ba as xc,Jl as xd,Vs as xe,Zr as y,tn as ya,ni as yb,zn as yc,Yl as yd,js as ye,Kr as z,te as za,ri as zb,xa as zc,Ql as zd,$s as ze};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {f,B,a as a$3,b,A,x,y as y$1,z as z$2,D as D$1,Y,$,aa,pa,na,_ as _$2,ka,qa,xa,Ta,Ga,Aa as Aa$1,ca,ea as ea$1,za as za$1}from'./chunk-HLFORKXS.js';import {k as k$1,l as l$2}from'./chunk-OB66FB4F.js';import {l}from'./chunk-MTV2RJZD.js';import {a as a$2}from'./chunk-D42Q2KKR.js';import {a as a$5}from'./chunk-5N3O25O7.js';import {f as f$1,b as b$1,n as n$1}from'./chunk-6M2J5QUA.js';import {a as a$1}from'./chunk-EAY7B5GL.js';import {a,g,j as j$2,b as b$2,f as f$2}from'./chunk-K3SX2LY5.js';import {O,Q,_ as _$1,va,ya,za,Aa,Ba,la,ia,ha,$ as $$1,ea,fa}from'./chunk-XZJRWFOS.js';import {l as l$1,q,c as c$1,r}from'./chunk-OR3BZY7C.js';import {E as E$1,F,G,L,p as p$1,J,v,c as c$2,g as g$1,x as x$1}from'./chunk-ZAHG7Y3X.js';import {a as a$4,i as i$1}from'./chunk-G7GIWWLE.js';import {n,k,i,d,j as j$1,e,l as l$3,m}from'./chunk-PXXGH3BV.js';import {z as z$1}from'zod';n();var Bn=1e4;function Yn(e=Bn){return {animationId:new Uint32Array(e),playing:new Uint8Array(e),loop:new Uint8Array(e),speed:new Float32Array(e),elapsed:new Float32Array(e),currentFrameIndex:new Uint16Array(e),direction:new Int8Array(e)}}var Xn=Yn(),Ot=new WeakSet,wt=null;function Lt(e){return Ot.has(e)||(wt=l$3(e,m(()=>Xn)),Ot.add(e)),wt}function Vt(e){let t=Lt(e);return Array.from(k(e,[t]))}function zn(e,t){let n=Lt(e);return i(e,t,n)}var Ie=e=>{let t=a$2(),n=Vt(e);for(let r of n)O(e,r,t);return e};function In(){return Ie}function On(e,t=0){e.registerSystem(2,Ie,t);}function wn(e,t,n){for(let r of t)O(e,r,n);}n();var Ln=z$1.object({getPosition:z$1.function().optional(),applyMovement:z$1.function().optional(),getDelta:z$1.function()});function Vn(e,t){if(J(e,t))return {x:E$1.x[t],y:E$1.y[t]}}function Gn(e,t,n,r,o){i(e,t,E$1)&&(E$1.x[t]=E$1.x[t]+n*o,E$1.y[t]=E$1.y[t]+r*o);}function qn(e,t){let n=Ln.parse(e),r=n.getPosition??Vn,o=n.applyMovement??Gn;return i=>{let s=n.getDelta(),a=t(i);for(let l of a)f(i,l)&&(B(i,l,s),Un(i,l,s,r,o));return i}}function Un(e,t,n,r,o){let i=a$3.behaviorType[t];if(i===b.Idle)return;if(i===b.Custom){A(e,t,n);return}let s=r(e,t);if(!s)return;if(i===b.Patrol){Nn(e,t,s.x,s.y,n,o);return}let a=a$3.targetEntity[t];if(a===0)return;let l=r(e,a);l&&(i===b.Chase?_n(e,t,s.x,s.y,l.x,l.y,n,o):i===b.Flee&&jn(e,t,s.x,s.y,l.x,l.y,n,o));}function Nn(e,t,n,r,o,i){let s=x(e,t,n,r,o);s&&(s.dx!==0||s.dy!==0)&&i(e,t,s.dx,s.dy,o);}function _n(e,t,n,r,o,i,s,a){let l=y$1(e,t,n,r,o,i);l&&(l.dx!==0||l.dy!==0)&&a(e,t,l.dx,l.dy,s);}function jn(e,t,n,r,o,i,s,a){let l=z$2(e,t,n,r,o,i);l&&(l.dx!==0||l.dy!==0)&&a(e,t,l.dx,l.dy,s);}n();function Oe(e){return Array.from(k(e,[D$1]))}var we=e=>{let t=a$2(),n=Oe(e);for(let r of n)Y(e,r,t);return e};function Zn(){return we}function $n(e,t=20){e.registerSystem(2,we,t);}function Qn(e,t){let n=Oe(e);for(let r of n)Y(e,r,t);}n();var de=67108864;function Le(e,t){if(e>=de||t>=de)throw new RangeError(`Entity IDs must be below ${de} for collision-free pair keys. Got: ${e}, ${t}`);return e*de+t}var p={eventBus:l(),activePairs:a(),activeTriggers:a(),pairHandles:new Map,triggerHandles:new Map};function Kn(){return p.eventBus}function Jn(){return p.activePairs.size}function er(){return {data:p.activePairs.data,size:p.activePairs.size}}function tr(){return p.activeTriggers.size}function nr(){return {data:p.activeTriggers.data,size:p.activeTriggers.size}}function rr(){g(p.activePairs),g(p.activeTriggers),p.pairHandles.clear(),p.triggerHandles.clear();}function qt(e){return Array.from(k(e,[Q]))}function or(e,t,n,r,o,i$1,s,a){if(!i(e,a,E$1))return;let l=Q.layer[a],u=Q.mask[a];if(!$$1(o,i$1,l,u))return;let m=E$1.x[a],d=E$1.y[a];if(!ea(t,n,r,a,m,d))return;let g=_$1(e,a);return fa(t,a,s||g)}function Ut(e){let t=qt(e),n=[];for(let r=0;r<t.length;r++){let o=t[r];if(o===void 0||!i(e,o,E$1))continue;let i$1=E$1.x[o],s=E$1.y[o],a=Q.layer[o],l=Q.mask[o],u=_$1(e,o);for(let m=r+1;m<t.length;m++){let d=t[m];if(d===void 0)continue;let g=or(e,o,i$1,s,a,l,u,d);g&&n.push(g);}}return n}function Gt(e,t,n,r){let{data:o}=e;for(let i=e.size-1;i>=0;i--){let s=o[i];if(!s)continue;let a=Le(s.entityA,s.entityB);if(n.has(a))continue;let l=t.get(a);l&&(t.delete(a),f$2(e,l),p.eventBus.emit(r,{entityA:s.entityA,entityB:s.entityB}));}}function ir(e,t,n){let r=Le(e.entityA,e.entityB);if(e.isTrigger){if(n.add(r),!p.triggerHandles.has(r)){let o=b$2(p.activeTriggers,e);p.triggerHandles.set(r,o),p.eventBus.emit("triggerEnter",{entityA:e.entityA,entityB:e.entityB});}}else if(t.add(r),!p.pairHandles.has(r)){let o=b$2(p.activePairs,e);p.pairHandles.set(r,o),p.eventBus.emit("collisionStart",{entityA:e.entityA,entityB:e.entityB});}}function ar(e){let t=new Set,n=new Set;for(let r of e)ir(r,t,n);Gt(p.activePairs,p.pairHandles,t,"collisionEnd"),Gt(p.activeTriggers,p.triggerHandles,n,"triggerExit");}var Ve=e=>{let t=Ut(e);return ar(t),e};function sr(){return Ve}function lr(e,t=10){e.registerSystem(2,Ve,t);}function ur(e){let{data:t}=p.activePairs;for(let n=0;n<p.activePairs.size;n++){let r=t[n];if(r&&(r.entityA===e||r.entityB===e))return true}return false}function cr(e){let{data:t}=p.activeTriggers;for(let n=0;n<p.activeTriggers.size;n++){let r=t[n];if(r&&(r.entityA===e||r.entityB===e))return true}return false}function mr(e){let t=[],{data:n}=p.activePairs;for(let r=0;r<p.activePairs.size;r++){let o=n[r];o&&(o.entityA===e?t.push(o.entityB):o.entityB===e&&t.push(o.entityA));}return t}function fr(e){let t=[],{data:n}=p.activeTriggers;for(let r=0;r<p.activeTriggers.size;r++){let o=n[r];o&&(o.entityA===e?t.push(o.entityB):o.entityB===e&&t.push(o.entityA));}return t}function dr(e,t){let n=Math.min(e,t),r=Math.max(e,t),o=Le(n,r);return p.pairHandles.has(o)||p.triggerHandles.has(o)}var ye=new Map,pe=new Map;function pr(){return {dragging:null,startX:0,startY:0,offsetX:0,offsetY:0,lastX:0,lastY:0,constraints:{},verifyCallback:null}}function yr(e,t){ye.set(e,t);}function Nt(e){return ye.get(e)??{}}function gr(e){ye.delete(e);}function br(e,t){t?pe.set(e,t):pe.delete(e);}function _t(e){return pe.get(e)??null}function Sr(e,t,n,r){return r==="x"?{x:t,y:E$1.y[e]??n}:r==="y"?{x:E$1.x[e]??t,y:n}:{x:t,y:n}}function hr(e,t,n){return n?{x:Math.round(e/n.x)*n.x,y:Math.round(t/n.y)*n.y}:{x:e,y:t}}function xr(e,t,n){let r=e,o=t;return n.minX!==void 0&&(r=Math.max(r,n.minX)),n.maxX!==void 0&&(r=Math.min(r,n.maxX)),n.minY!==void 0&&(o=Math.max(o,n.minY)),n.maxY!==void 0&&(o=Math.min(o,n.maxY)),{x:r,y:o}}function vr(e,t,n,r,o){if(!o)return {x:n,y:r};let i=i$1(e,t);if(i===a$4)return {x:n,y:r};let s=x$1(e,i);if(!s)return {x:n,y:r};let a=x$1(e,t),l=a?.width??1,u=a?.height??1;return {x:Math.max(0,Math.min(n,s.width-l)),y:Math.max(0,Math.min(r,s.height-u))}}function Mr(e,t,n,r,o){let i=Sr(t,n,r,o.constrainAxis);return i=hr(i.x,i.y,o.snapToGrid),i=xr(i.x,i.y,o),i=vr(e,t,i.x,i.y,o.constrainToParent),i}function Er(e){let t=pr(),n=(r,o=null,i=false)=>{if(t.dragging===null)return;let s=t.dragging,a=G(r,s),l=a?.x??t.lastX,u=a?.y??t.lastY;e.emit("dragend",{entity:s,x:l,y:u,totalDx:l-t.startX,totalDy:u-t.startY,cancelled:i}),i||e.emit("drop",{entity:s,x:l,y:u,dropTarget:o}),t.dragging=null,t.startX=0,t.startY=0,t.offsetX=0,t.offsetY=0,t.lastX=0,t.lastY=0,t.constraints={},t.verifyCallback=null;};return {getState(){return t},isDragging(){return t.dragging!==null},getDraggingEntity(){return t.dragging},canDrag(r,o){return l$1(r,o)},startDrag(r,o,i,s){if(!l$1(r,o)||t.dragging!==null)return false;let a=G(r,o);if(!a)return false;if(t.dragging=o,t.startX=a.x,t.startY=a.y,t.offsetX=i-a.x,t.offsetY=s-a.y,t.lastX=a.x,t.lastY=a.y,t.constraints=Nt(o),t.verifyCallback=_t(o),t.constraints.bringToFront){let l=t.constraints.frontZIndex??9999;L(r,o,l);}return e.emit("dragstart",{entity:o,startX:a.x,startY:a.y,mouseX:i,mouseY:s}),true},updateDrag(r,o,i){if(t.dragging===null)return false;let s=t.dragging,a=o-t.offsetX,l=i-t.offsetY,u=Mr(r,s,a,l,t.constraints);a=u.x,l=u.y;let m=a-t.lastX,d=l-t.lastY;return m===0&&d===0||t.verifyCallback&&!t.verifyCallback(s,m,d)?false:(F(r,s,a,l),t.lastX=a,t.lastY=l,e.emit("drag",{entity:s,x:a,y:l,dx:m,dy:d,mouseX:o,mouseY:i}),true)},endDrag:n,cancelDrag(r){if(t.dragging===null)return;let o=t.dragging;F(r,o,t.startX,t.startY),n(r,null,true);}}}function Cr(){ye.clear(),pe.clear();}n();var ge=null,ee=new WeakMap,Ge=new WeakMap;function qe(e){let t=ee.get(e);return t||(t=[],ee.set(e,t)),t}function jt(){return ge||(ge=l()),ge}function Tr(){ge=null;}var Pr=e=>k(e,[E$1,c$2,c$1]);function N(e){let t=Pr(e),n=[];for(let r of t){if(!q(e,r)||!p$1(e,r))continue;let o=c$1.tabIndex[r];o<0||n.push({eid:r,tabIndex:o,y:E$1.y[r],x:E$1.x[r]});}return n.sort((r,o)=>r.tabIndex!==0&&o.tabIndex!==0?r.tabIndex-o.tabIndex:r.tabIndex!==0?-1:o.tabIndex!==0?1:r.y!==o.y?r.y-o.y:r.x-o.x),n.map(r=>r.eid)}function be(e){let t=f$1(e);if(!t)return null;let n=b$1.focused[t];return n===a$4?null:n}function _(e,t,n,r$1){let o=jt();r$1!==null&&(r(e,r$1,false),g$1(e,r$1),o.emit("blur",{entity:r$1,previousEntity:null,nextEntity:n})),n!==null&&(r(e,n,true),g$1(e,n),o.emit("focus",{entity:n,previousEntity:r$1,nextEntity:null})),n$1(e,t,n);}function z(e,t){let n=f$1(e);if(!n||!q(e,t)||!p$1(e,t))return false;let r=b$1.focused[n],o=r===0?null:r;return o===t||_(e,n,t,o),true}function Zt(e){let t=f$1(e);if(!t)return;let n=b$1.focused[t],r=n===0?null:n;r!==null&&_(e,t,null,r);}function kr(e){let t=f$1(e);if(!t)return null;let n=N(e);if(n.length===0)return null;let r=b$1.focused[t],o=r===0?null:r,i=0;if(o!==null){let a=n.indexOf(o);a>=0&&(i=(a+1)%n.length);}let s=n[i];return s===void 0?null:(_(e,t,s,o),s)}function Ar(e){let t=f$1(e);if(!t)return null;let n=N(e);if(n.length===0)return null;let r=b$1.focused[t],o=r===0?null:r,i=n.length-1;if(o!==null){let a=n.indexOf(o);a>=0&&(i=(a-1+n.length)%n.length);}let s=n[i];return s===void 0?null:(_(e,t,s,o),s)}function $t(e){let t=N(e);if(t.length===0)return null;let n=t[0];return n===void 0?null:z(e,n)?n:null}function Wr(e){let t=N(e);if(t.length===0)return null;let n=t[t.length-1];return n===void 0?null:z(e,n)?n:null}function Fr(e,t){let n=qe(e),r=be(e);return r!==null&&n.push(r),z(e,t)}function Hr(e){let t=qe(e);if(t.length===0)return Zt(e),null;let n=t.pop();return q(e,n)&&p$1(e,n)?(z(e,n),n):Qt(e)}function Dr(e){let t=be(e);Ge.set(e,t);}function Rr(e){let t=Ge.get(e);return Ge.delete(e),t==null?null:q(e,t)&&p$1(e,t)?(z(e,t),t):null}function Qt(e){let t=qe(e);for(;t.length>0;){let n=t.pop();if(q(e,n)&&p$1(e,n))return z(e,n),n}return $t(e)}function Br(e,t){if(t===0)return be(e);let n=f$1(e);if(!n)return null;let r=N(e);if(r.length===0)return null;let o=b$1.focused[n],i=o===0?null:o,s=-1;i!==null&&(s=r.indexOf(i));let a;s<0?a=t>0?0:r.length-1:a=((s+t)%r.length+r.length)%r.length;let l=r[a];return l===void 0?null:(_(e,n,l,i),l)}function Yr(e){let t=ee.get(e);return t?t.length:0}function Xr(e){let t=ee.get(e);t&&(t.length=0);}function zr(e){let t=ee.get(e);return !t||t.length===0?null:t[t.length-1]??null}var Kt=e=>{let t=f$1(e);if(!t)return e;let n=b$1.focused[t];if(n!==0){let r=n;(!q(e,r)||!p$1(e,r))&&_(e,t,null,r);}return e};function Ir(){return Kt}var Or=z$1.object({targetFrameMs:z$1.number().positive(),phaseBudgets:z$1.record(z$1.string(),z$1.number().positive()),rollingWindowSize:z$1.number().int().positive(),warnOnOverrun:z$1.boolean()}),en={targetFrameMs:16.67,phaseBudgets:{},rollingWindowSize:120,warnOnOverrun:true},y=null;function Ue(e){return {samples:Array.from({length:e},()=>0),idx:0,count:0,total:0,min:Number.POSITIVE_INFINITY,max:0}}function tn(e,t){let n=e.samples[e.idx%e.samples.length]??0;e.samples[e.idx%e.samples.length]=t,e.idx++,e.count<e.samples.length?(e.count++,e.total+=t):e.total+=t-n,t<e.min&&(e.min=t),t>e.max&&(e.max=t);}function j(e,t){if(e.count===0)return 0;let n=e.samples.slice(0,e.count).sort((o,i)=>o-i),r=Math.min(Math.floor(n.length*t),n.length-1);return n[r]??0}function Jt(e){return e.count>0?e.total/e.count:0}function wr(e){let t={...en,...e};return y={config:Or.parse(t),systemSamples:new Map,phaseTotals:new Map,frameSamples:Ue(t.rollingWindowSize),totalFrames:0,budgetOverruns:0,alerts:[],onAlert:null},Ne()}function nn(e,t){if(!y)return;let n=y.systemSamples.get(e);n||(n=Ue(y.config.rollingWindowSize),y.systemSamples.set(e,n)),tn(n,t);}function Lr(e,t){if(!y)return;y.phaseTotals.set(e,t);let n=y.config.phaseBudgets[e];if(n!==void 0&&t>n){let r={phase:e,budgetMs:n,actualMs:t,frame:y.totalFrames};y.alerts.push(r),y.alerts.length>100&&y.alerts.shift(),y.budgetOverruns++,y.onAlert&&y.onAlert(r);}}function Vr(e){y&&(tn(y.frameSamples,e),y.totalFrames++);}function Gr(e,t){return n=>{let r=performance.now(),o=t(n);return nn(e,performance.now()-r),o}}function Ne(){if(!y)return {config:en,stats:{frameTimeMs:0,avgFrameMs:0,p50FrameMs:0,p95FrameMs:0,p99FrameMs:0,fps:0,avgFps:0,totalFrames:0,budgetOverruns:0,systemTimings:[],phaseTimings:{}},alerts:[]};let e=y,t=[];for(let[i,s]of e.systemSamples)t.push({name:i,lastMs:s.count>0?s.samples[(s.idx-1+s.samples.length)%s.samples.length]??0:0,avgMs:Jt(s),minMs:s.min===Number.POSITIVE_INFINITY?0:s.min,maxMs:s.max,p50Ms:j(s,.5),p95Ms:j(s,.95),p99Ms:j(s,.99),count:s.count});let n={};for(let[i,s]of e.phaseTotals)n[a$5[i]??"unknown"]=s;let r=e.frameSamples.count>0?e.frameSamples.samples[(e.frameSamples.idx-1+e.frameSamples.samples.length)%e.frameSamples.samples.length]??0:0,o=Jt(e.frameSamples);return {config:e.config,stats:{frameTimeMs:r,avgFrameMs:o,p50FrameMs:j(e.frameSamples,.5),p95FrameMs:j(e.frameSamples,.95),p99FrameMs:j(e.frameSamples,.99),fps:r>0?1e3/r:0,avgFps:o>0?1e3/o:0,totalFrames:e.totalFrames,budgetOverruns:e.budgetOverruns,systemTimings:t,phaseTimings:n},alerts:[...e.alerts]}}function qr(e){y&&(y.onAlert=e);}function Ur(){y&&(y.systemSamples.clear(),y.phaseTotals.clear(),y.frameSamples=Ue(y.config.rollingWindowSize),y.totalFrames=0,y.budgetOverruns=0,y.alerts=[]);}function Nr(){y=null;}function _r(){let e=Ne();return {config:e.config,stats:e.stats,alerts:e.alerts,exportedAt:Date.now()}}n();var jr=1e4;function Zr(e=jr){return {x:new Float32Array(e),y:new Float32Array(e),maxSpeed:new Float32Array(e),friction:new Float32Array(e)}}var $r=Zr(),rn=new WeakSet,on=null;function an(e){return rn.has(e)||(on=l$3(e,m(()=>$r)),rn.add(e)),on}function sn(e){let t=an(e);return Array.from(k(e,[t]))}function Qr(e,t){let n=an(e);return i(e,t,n)}var _e=e=>{let t=a$2(),n=sn(e);for(let r of n)va(e,r)&&ya(r,t),za(r,t),Aa(r),i(e,r,E$1)&&Ba(r,t);return e};function Kr(){return _e}function Jr(e,t=0){e.registerSystem(4,_e,t);}function eo(e,t,n){for(let r of t)la(e,r)&&(va(e,r)&&ya(r,n),za(r,n),Aa(r),i(e,r,E$1)&&Ba(r,n));}var to=z$1.object({deferLayout:z$1.boolean(),outlineResize:z$1.boolean(),keyboardStep:z$1.number(),keyboardResizeStep:z$1.number()}),ne={minWidth:4,minHeight:2,maxWidth:0,maxHeight:0,constrainToScreen:true,screenWidth:80,screenHeight:24,snapGrid:0},je={deferLayout:true,outlineResize:false,keyboardStep:1,keyboardResizeStep:1};function ln(){return {entity:void 0,isMoving:false,isResizing:false,resizeHandle:void 0,startX:0,startY:0,panelStartX:0,panelStartY:0,panelStartWidth:0,panelStartHeight:0,layoutDeferred:false}}function no(e){let t={...je,...e};return to.parse(t)}function ro(e){return {...ne,...e}}function oo(e,t,n,r,o,i,s,a,l){let u={...je,...l};return {...e,entity:t,isMoving:true,isResizing:false,resizeHandle:void 0,startX:n,startY:r,panelStartX:o,panelStartY:i,panelStartWidth:s,panelStartHeight:a,layoutDeferred:u.deferLayout}}function io(e,t,n,r,o,i,s,a,l,u){let m={...je,...u};return {...e,entity:t,isMoving:false,isResizing:true,resizeHandle:n,startX:r,startY:o,panelStartX:i,panelStartY:s,panelStartWidth:a,panelStartHeight:l,layoutDeferred:m.deferLayout}}function ao(e,t,n,r){if(!e.isMoving)return {x:e.panelStartX,y:e.panelStartY,width:e.panelStartWidth,height:e.panelStartHeight,dirtyRects:[],clamped:false};let o={...ne,...r},i=t-e.startX,s=n-e.startY,a=e.panelStartX+i,l=e.panelStartY+s,u=false;if(o.snapGrid>0&&(a=Math.round(a/o.snapGrid)*o.snapGrid,l=Math.round(l/o.snapGrid)*o.snapGrid),o.constrainToScreen){let d=Math.max(0,Math.min(a,o.screenWidth-e.panelStartWidth)),g=Math.max(0,Math.min(l,o.screenHeight-e.panelStartHeight));(d!==a||g!==l)&&(u=true),a=d,l=g;}let m=ho(e.panelStartX+(t-e.startX-i+i),e.panelStartY+(n-e.startY-s+s),a,l,e.panelStartWidth,e.panelStartHeight);return {x:a,y:l,width:e.panelStartWidth,height:e.panelStartHeight,dirtyRects:m,clamped:u}}function so(e,t,n,r,o,i,s){let a=t,l=n,u=r,m=o;return (e.includes("right")||e==="right")&&(u+=i),(e.includes("bottom")||e==="bottom")&&(m+=s),(e.includes("left")||e==="left")&&(a+=i,u-=i),(e.includes("top")||e==="top")&&(l+=s,m-=s),{x:a,y:l,w:u,h:m}}function lo(e,t,n){let r=e,o=t,i=false;return r<n.minWidth&&(r=n.minWidth,i=true),o<n.minHeight&&(o=n.minHeight,i=true),n.maxWidth>0&&r>n.maxWidth&&(r=n.maxWidth,i=true),n.maxHeight>0&&o>n.maxHeight&&(o=n.maxHeight,i=true),{width:r,height:o,clamped:i}}function uo(e,t,n,r,o){return o<=0?{x:e,y:t,w:n,h:r}:{x:Math.round(e/o)*o,y:Math.round(t/o)*o,w:Math.round(n/o)*o,h:Math.round(r/o)*o}}function co(e,t,n,r,o){if(!o.constrainToScreen)return {x:e,y:t,w:n,h:r};let i=Math.max(0,e),s=Math.max(0,t),a=n,l=r;return i+a>o.screenWidth&&(a=o.screenWidth-i),s+l>o.screenHeight&&(l=o.screenHeight-s),{x:i,y:s,w:a,h:l}}function mo(e,t,n,r){if(!e.isResizing||!e.resizeHandle)return {x:e.panelStartX,y:e.panelStartY,width:e.panelStartWidth,height:e.panelStartHeight,dirtyRects:[],clamped:false};let o={...ne,...r},i=t-e.startX,s=n-e.startY,a=so(e.resizeHandle,e.panelStartX,e.panelStartY,e.panelStartWidth,e.panelStartHeight,i,s),l=lo(a.w,a.h,o);a.w=l.width,a.h=l.height;let u=l.clamped;a=uo(a.x,a.y,a.w,a.h,o.snapGrid),a=co(a.x,a.y,a.w,a.h,o);let m=[{x:e.panelStartX,y:e.panelStartY,width:e.panelStartWidth,height:e.panelStartHeight},{x:a.x,y:a.y,width:a.w,height:a.h}];return {x:a.x,y:a.y,width:a.w,height:a.h,dirtyRects:m,clamped:u}}function fo(e){return {...e,isMoving:false,isResizing:false,resizeHandle:void 0,layoutDeferred:false}}function po(e){return {state:ln(),restoreX:e.panelStartX,restoreY:e.panelStartY,restoreWidth:e.panelStartWidth,restoreHeight:e.panelStartHeight}}function yo(e,t,n,r,o,i,s){let a={...ne,...s},l=e,u=t;return o==="up"&&(u-=i),o==="down"&&(u+=i),o==="left"&&(l-=i),o==="right"&&(l+=i),a.constrainToScreen&&(l=Math.max(0,Math.min(l,a.screenWidth-n)),u=Math.max(0,Math.min(u,a.screenHeight-r))),a.snapGrid>0&&(l=Math.round(l/a.snapGrid)*a.snapGrid,u=Math.round(u/a.snapGrid)*a.snapGrid),{x:l,y:u}}function go(e,t,n,r,o){let i={...ne,...o},s=e,a=t;return n==="grow-horizontal"&&(s+=r),n==="shrink-horizontal"&&(s-=r),n==="grow-vertical"&&(a+=r),n==="shrink-vertical"&&(a-=r),s=Math.max(i.minWidth,s),a=Math.max(i.minHeight,a),i.maxWidth>0&&(s=Math.min(i.maxWidth,s)),i.maxHeight>0&&(a=Math.min(i.maxHeight,a)),{width:s,height:a}}function bo(e,t,n,r,o=1){let i=e<o,s=e>=n-o,a=t<o,l=t>=r-o;if(a&&i)return "topLeft";if(a&&s)return "topRight";if(l&&i)return "bottomLeft";if(l&&s)return "bottomRight";if(a)return "top";if(l)return "bottom";if(i)return "left";if(s)return "right"}function So(e){if(e.length===0)return;let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=0,o=0;for(let i of e)t=Math.min(t,i.x),n=Math.min(n,i.y),r=Math.max(r,i.x+i.width),o=Math.max(o,i.y+i.height);return {x:t,y:n,width:r-t,height:o-n}}function ho(e,t,n,r,o,i){return [{x:e,y:t,width:o,height:i},{x:n,y:r,width:o,height:i}]}n();var xo=z$1.object({emitters:z$1.function(),particles:z$1.function(),maxParticles:z$1.number().int().positive().optional(),archetypeName:z$1.string().optional()});function Ze(e,t,n,r){if(!i(e,t,$))return -1;let o;if(r){let P=k$1(e,r);if(P===null)return -1;o=P;}else o=d(e);let i$1=Math.floor(Math.random()*n.chars.length),s=n.chars[i$1]??42;aa(e,o,{lifetime:$.lifetime[t],char:s,startFg:n.startFg,endFg:n.endFg??n.startFg,fadeOut:n.fadeOut??true,emitter:t});let a=J(e,t)?E$1.x[t]:0,l=J(e,t)?E$1.y[t]:0;F(e,o,a,l);let u=$.angle[t],m=$.spread[t],d$1=u+(Math.random()-.5)*m,g=$.speed[t],v=Math.cos(d$1)*g,M=Math.sin(d$1)*g;return ia(e,o,v,M),pa(t,o),o}function vo(e,t,n,r=1e3,o=0){if(!i(e,t,$))return [];let i$1=na(t);if(!i$1)return [];let s=n??$.burstCount[t],a=[];for(let l=0;l<s&&!(o+a.length>=r);l++){let u=Ze(e,t,i$1);u!==-1&&a.push(u);}return a}function $e(e,t,n){if(!i(e,t,_$2))return;_$2.age[t]=_$2.age[t]+n;let r=_$2.emitter[t];if(r>0&&ka(e,r)){let o=$.gravity[r];o!==0&&la(e,t)&&(ha.y[t]=ha.y[t]+o*n);}}function Qe(e,t,n){!J(e,t)||!la(e,t)||(E$1.x[t]=E$1.x[t]+ha.x[t]*n,E$1.y[t]=E$1.y[t]+ha.y[t]*n);}function Ke(e$1,t,n){let r=_$2.emitter[t];r>0&&qa(r,t),n?(j$1(e$1,t,_$2),l$2(e$1,n,t)):e(e$1,t);}function Mo(e,t){return !(!i(e,t,$)||$.active[t]!==1)}function Eo(e,t,n,r,o,i){let s=na(t);if(!s)return o;let a=$.rate[t];if(a<=0)return o;$.accumulator[t]=$.accumulator[t]+n;let l=1/a,u=o;for(;$.accumulator[t]>=l&&u<r;)$.accumulator[t]=$.accumulator[t]-l,Ze(e,t,s,i)!==-1&&u++;return u}function Co(e,t,n,r,o,i){let s=o;for(let a of t)Mo(e,a)&&(s=Eo(e,a,n,r,s,i));return s}function To(e,t,n,r){ca(e,t)&&($e(e,t,n),Qe(e,t,n),ea$1(e,t)&&Ke(e,t,r));}function Po(e,t,n,r,o){for(let i=0;i<n;i++){let s=t[i];if(!s)continue;let a=s.particleId;ca(e,a)&&(o.add(a),$e(e,a,r),Qe(e,a,r));}}function ko(e,t,n,r){for(let o=n-1;o>=0;o--){let i=t[o];if(!i)continue;let s=i.particleId;ca(e,s)?ea$1(e,s)&&Ke(e,s,r):qa(i.emitterId,s);}}function Ao(e){let t=xo.parse(e),n=t.maxParticles??1e3,r=t.archetypeName,o=new Set;return i=>{let s=.016666666666666666,a=t.emitters(i),l=xa(),u=j$2(l),m=t.particles(i);Co(i,a,s,n,m.length,r),o.clear(),Po(i,u,l.size,s,o),ko(i,u,l.size,r);for(let d of m)o.has(d)||To(i,d,s,r);return i}}var un=z$1.object({friction:z$1.number().min(0).max(1),minVelocity:z$1.number().nonnegative(),maxVelocity:z$1.number().positive(),sensitivity:z$1.number(),springStiffness:z$1.number().nonnegative(),springDamping:z$1.number().nonnegative(),maxOverscroll:z$1.number().nonnegative(),enableMomentum:z$1.boolean(),enableBounce:z$1.boolean()}),cn={friction:.92,minVelocity:.1,maxVelocity:200,sensitivity:1,springStiffness:.3,springDamping:.8,maxOverscroll:50,enableMomentum:true,enableBounce:true},E=a$1({iterable:true});function Wo(e,t,n,r,o){let i=E.get(e);return i?(i.contentWidth=t,i.contentHeight=n,i.viewportWidth=r,i.viewportHeight=o):(i={scrollX:0,scrollY:0,velocityX:0,velocityY:0,contentWidth:t,contentHeight:n,viewportWidth:r,viewportHeight:o,isAnimating:false,isUserScrolling:false,targetX:null,targetY:null},E.set(e,i)),i}function Fo(e){E.delete(e);}function Ho(){E.clear();}function Do(e,t,n,r){let o={...cn,...r},i=un.parse(o),s=E.get(e);s&&(s.velocityX+=t*i.sensitivity,s.velocityY+=n*i.sensitivity,s.velocityX=Math.max(-i.maxVelocity,Math.min(i.maxVelocity,s.velocityX)),s.velocityY=Math.max(-i.maxVelocity,Math.min(i.maxVelocity,s.velocityY)),s.isAnimating=true,s.targetX=null,s.targetY=null);}function Ro(e,t,n){let r=E.get(e);r&&(r.targetX=t,r.targetY=n,r.isAnimating=true);}function Bo(e,t,n){let r=E.get(e);r&&(r.scrollX=t,r.scrollY=n,r.velocityX=0,r.velocityY=0,r.targetX=null,r.targetY=null,r.isAnimating=false);}function Yo(e){let t=E.get(e);t&&(t.isUserScrolling=true,t.velocityX=0,t.velocityY=0);}function Xo(e,t,n){let r=E.get(e);r&&(r.isUserScrolling=false,r.velocityX=t,r.velocityY=n,r.isAnimating=Math.abs(t)>.1||Math.abs(n)>.1);}function zo(e,t){let n=Math.max(0,e.contentWidth-e.viewportWidth),r=Math.max(0,e.contentHeight-e.viewportHeight);if(!t.enableBounce){e.scrollX=Math.max(0,Math.min(n,e.scrollX)),e.scrollY=Math.max(0,Math.min(r,e.scrollY));return}let o=e.scrollX<0?e.scrollX:e.scrollX>n?e.scrollX-n:0,i=e.scrollY<0?e.scrollY:e.scrollY>r?e.scrollY-r:0;Math.abs(o)>0&&!e.isUserScrolling&&(e.velocityX-=o*t.springStiffness,e.velocityX*=t.springDamping),Math.abs(i)>0&&!e.isUserScrolling&&(e.velocityY-=i*t.springStiffness,e.velocityY*=t.springDamping),e.scrollX=Math.max(-t.maxOverscroll,Math.min(n+t.maxOverscroll,e.scrollX)),e.scrollY=Math.max(-t.maxOverscroll,Math.min(r+t.maxOverscroll,e.scrollY));}function Io(e){if(!(e.targetX===null&&e.targetY===null)){if(e.targetX!==null){let t=e.targetX-e.scrollX;Math.abs(t)<.5?(e.scrollX=e.targetX,e.targetX=null,e.velocityX=0):e.velocityX=t*.15;}if(e.targetY!==null){let t=e.targetY-e.scrollY;Math.abs(t)<.5?(e.scrollY=e.targetY,e.targetY=null,e.velocityY=0):e.velocityY=t*.15;}}}function Oo(e,t){e.scrollX+=e.velocityX*t*60,e.scrollY+=e.velocityY*t*60;}function wo(e,t){!t.enableMomentum||e.isUserScrolling||(e.velocityX*=t.friction,e.velocityY*=t.friction);}function Lo(e,t){return Math.abs(e.velocityX)<t.minVelocity&&Math.abs(e.velocityY)<t.minVelocity&&e.targetX===null&&e.targetY===null}function Vo(e){e.velocityX=0,e.velocityY=0,e.isAnimating=false,e.scrollX=Math.round(e.scrollX),e.scrollY=Math.round(e.scrollY);let t=Math.max(0,e.contentWidth-e.viewportWidth),n=Math.max(0,e.contentHeight-e.viewportHeight);e.scrollX=Math.max(0,Math.min(t,e.scrollX)),e.scrollY=Math.max(0,Math.min(n,e.scrollY));}function mn(e,t,n){let r={...cn,...n},o=un.parse(r);if(!e.isAnimating)return false;let i=e.scrollX,s=e.scrollY;return Io(e),Oo(e,t),wo(e,o),zo(e,o),Lo(e,o)&&Vo(e),e.scrollX!==i||e.scrollY!==s}function Go(e){return E.get(e)?.isAnimating??false}function qo(e){let t=E.get(e);return t?{x:t.scrollX,y:t.scrollY}:null}function Uo(e){let t=performance.now();return n=>{let r=performance.now(),o=Math.min((r-t)/1e3,1/15);return t=r,E.forEach(i=>{mn(i,o,e);}),n}}n();var No=z$1.object({cellSize:z$1.number().positive(),initialCapacity:z$1.number().int().positive()}),fn=8,_o=.5;function jo(e){let t={cellSize:e?.cellSize??fn,initialCapacity:e?.initialCapacity??256};return {cellSize:No.parse(t).cellSize,cells:new Map,entityCells:new Map}}function tt(e,t){let n=e>=0?e*2:-e*2-1,r=t>=0?t*2:-t*2-1;return (n+r)*(n+r+1)/2+r}function Zo(e,t,n){return {cx:Math.floor(t/e.cellSize),cy:Math.floor(n/e.cellSize)}}function ie(e,t,n,r,o=1,i=1){nt(e,t);let s=t,a=new Set,l=Math.floor(n/e.cellSize),u=Math.floor(r/e.cellSize),m=Math.floor((n+o-.001)/e.cellSize),d=Math.floor((r+i-.001)/e.cellSize);for(let g=l;g<=m;g++)for(let v=u;v<=d;v++){let M=tt(g,v);a.add(M);let P=e.cells.get(M);P||(P=new Set,e.cells.set(M,P)),P.add(s);}e.entityCells.set(s,a);}function nt(e,t){let n=t,r=e.entityCells.get(n);if(r){for(let o of r){let i=e.cells.get(o);i&&(i.delete(n),i.size===0&&e.cells.delete(o));}e.entityCells.delete(n);}}function rt(e,t,n,r=1,o=1){let i=new Set,s=Math.floor(t/e.cellSize),a=Math.floor(n/e.cellSize),l=Math.floor((t+r-.001)/e.cellSize),u=Math.floor((n+o-.001)/e.cellSize);for(let m=s;m<=l;m++)for(let d=a;d<=u;d++){let g=tt(m,d),v=e.cells.get(g);if(v)for(let M of v)i.add(M);}return i}function $o(e,t){let n=t,r=new Set,o=e.entityCells.get(n);if(!o)return r;for(let i of o){let s=e.cells.get(i);if(s)for(let a of s)a!==n&&r.add(a);}return r}function dn(e,t,n){let r=tt(t,n);return e.cells.get(r)??new Set}function Qo(e,t,n){let r=Math.floor(t/e.cellSize),o=Math.floor(n/e.cellSize);return dn(e,r,o)}function pn(e){e.cells.clear(),e.entityCells.clear();}function Ko(e){let t=0,n=0;for(let o of e.cells.values())n+=o.size,o.size>t&&(t=o.size);let r=e.cells.size;return {cellCount:r,entityCount:e.entityCells.size,averageEntitiesPerCell:r>0?n/r:0,maxEntitiesInCell:t}}function et(e,t){pn(e);let n=k(t,[E$1,Q]);for(let r of n){let o=E$1.x[r],i=E$1.y[r],s=Q.width[r],a=Q.height[r],l=Q.offsetX[r],u=Q.offsetY[r];ie(e,r,o+l,i+u,s,a);}}function ot(e=_o){return {dirtyEntities:a(64),dirtyLookup:new Set,prevBounds:a$1({iterable:true}),initialized:false,dirtyThreshold:Math.max(0,Math.min(1,e))}}var oe=null,T=ot();function Jo(e){e!==oe&&(T.initialized=false,T.prevBounds.clear()),oe=e;}function ei(){return oe}function ti(){return T}function ni(e){let t=e;T.dirtyLookup.has(t)||(b$2(T.dirtyEntities,t),T.dirtyLookup.add(t));}function ri(){return T.dirtyEntities.size}function oi(){T=ot(T.dirtyThreshold);}function ii(e){T.dirtyThreshold=Math.max(0,Math.min(1,e));}function it(e){let t=E$1.x[e]+Q.offsetX[e],n=E$1.y[e]+Q.offsetY[e],r=Q.width[e],o=Q.height[e];return {x:t,y:n,w:r,h:o}}function ai(e,t){for(let n of t){let{x:r,y:o,w:i,h:s}=it(n),a=e.prevBounds.get(n);a?(a.x=r,a.y=o,a.w=i,a.h=s):e.prevBounds.set(n,{x:r,y:o,w:i,h:s});}}function si(e,t,n){let r=[];t.prevBounds.forEach((o,i)=>{n.has(i)||r.push(i);});for(let o of r)nt(e,o),t.prevBounds.delete(o);}function li(e,t){for(let n of t){let r=n,{x:o,y:i,w:s,h:a}=it(n),l=e.prevBounds.get(n);(!l||o!==l.x||i!==l.y||s!==l.w||a!==l.h)&&(e.dirtyLookup.has(r)||(b$2(e.dirtyEntities,r),e.dirtyLookup.add(r))),l?(l.x=o,l.y=i,l.w=s,l.h=a):e.prevBounds.set(n,{x:o,y:i,w:s,h:a});}}function yn(e,t,n){let r=k(n,[E$1,Q]);if(!t.initialized){et(e,n),ai(t,r),g(t.dirtyEntities),t.dirtyLookup.clear(),t.initialized=true;return}let o=new Set;for(let s of r)o.add(s);si(e,t,o),li(t,r);let i$1=t.dirtyEntities.size;if(i$1>0){let s=r.length;if(s>0&&i$1>t.dirtyThreshold*s)et(e,n);else {let{data:a}=t.dirtyEntities;for(let l=0;l<i$1;l++){let u=a[l];if(u===void 0)continue;let m=u;if(!i(n,m,E$1)||!i(n,m,Q))continue;let{x:d,y:g,w:v,h:M}=it(m);ie(e,m,d,g,v,M);}}}g(t.dirtyEntities),t.dirtyLookup.clear();}var gn=e=>(oe&&yn(oe,T,e),e);function ui(){return gn}n();var ci=1e4;function mi(e=ci){return {machineId:new Uint32Array(e),currentState:new Uint16Array(e),previousState:new Uint16Array(e),stateAge:new Float32Array(e)}}var D=mi(),bn=new WeakSet,Sn=null;function fi(e){return bn.has(e)||(Sn=l$3(e,m(()=>D)),bn.add(e)),Sn}function hn(e){let t=fi(e);return Array.from(k(e,[t]))}function di(){return D.stateAge}var at=e=>{let t=a$2(),n=hn(e);for(let r of n){let o=D.stateAge[r]??0;D.stateAge[r]=o+t;}return e};function pi(){return at}function yi(e,t=0){e.registerSystem(2,at,t);}function gi(e,t){for(let n of e){let r=D.stateAge[n]??0;D.stateAge[n]=r+t;}}function bi(e){D.stateAge[e]=0;}function Si(e){return D.stateAge[e]??0}n();z$1.object({viewportWidth:z$1.number().int().positive(),viewportHeight:z$1.number().int().positive(),camera:z$1.object({x:z$1.number().finite(),y:z$1.number().finite()})});var R=null,Se=null;function hi(e){R=e;}function xi(){return R}function vi(){return Se}function Mi(){Se=null;}function Ei(){R=null,Se=null;}function xn(e,t){let n=[];for(let r=0;r<t;r++){let o=[];for(let i=0;i<e;i++)o.push({char:" ",fg:0,bg:0});n.push(o);}return {width:e,height:t,cells:n}}function Ci(e,t,n,r){let o=" ",i=0,s=0;for(let a of e.layers){if(!a.visible)continue;let l=a.tiles[r*e.width+n];if(l===za$1)continue;let u=t.tiles[l];u&&(o=u.char,i=u.fg,s=u.bg);}return {char:o,fg:i,bg:s}}function Ti(e,t,n,r,o,i){for(let s=0;s<i;s++){let a=r+s;if(a<0||a>=e.height)continue;let l=e.cells[a];if(l)for(let u=0;u<o;u++){let m=n+u;m<0||m>=e.width||(l[m]=t);}}}function Pi(e,t,n,r,o,i,s,a){let l=Math.max(0,Math.floor(-e/o)),u=Math.max(0,Math.floor(-t/i)),m=Math.min(n,Math.ceil((s-e)/o)),d=Math.min(r,Math.ceil((a-t)/i));return [l,u,m,d]}function vn(e,t,n,r){let o=Ta.width[t],i=Ta.height[t],s=Ta.tileWidth[t],a=Ta.tileHeight[t],l=Ta.dataId[t],u=Ta.tilesetId[t],m=Ga.data.get(l),d=Aa$1.tilesets.get(u);if(!m||!d)return;let g=E$1.x[t],v=E$1.y[t],M=g-n,P=v-r,[kn,An,Wn,Fn]=Pi(M,P,o,i,s,a,e.width,e.height);for(let ae=An;ae<Fn;ae++)for(let se=kn;se<Wn;se++){let Hn=Ci(m,d,se,ae),Dn=Math.round(M+se*s),Rn=Math.round(P+ae*a);Ti(e,Hn,Dn,Rn,s,a);}}function Mn(e){if(!R)return null;let t=xn(R.viewportWidth,R.viewportHeight),n=k(e,[Ta,E$1]);for(let r of n)vn(t,r,R.camera.x,R.camera.y);return Se=t,t}var En=e=>(Mn(e),e);function ki(){return En}n();function Ai(){return {bounds:a$1({iterable:false})}}function Cn(e,t,n,r,o,i,s){let a=t.bounds.get(n);return a&&a.x===r&&a.y===o&&a.w===i&&a.h===s?false:(ie(e,n,r,o,i,s),a?(a.x=r,a.y=o,a.w=i,a.h=s):t.bounds.set(n,{x:r,y:o,w:i,h:s}),true)}function Wi(e,t){e.bounds.delete(t);}function Fi(e){e.bounds.clear();}function st(e,t){return rt(e,t.x,t.y,t.width,t.height)}function Hi(e,t,n){let r=st(e,t),o=Array.from(r);return {visible:o,total:n,culled:n-o.length}}function Di(e,t){return n=>{let r=k(n,[E$1]);for(let o of r){let i$1=E$1.x[o],s=E$1.y[o],a=1,l=1;i(n,o,v)&&(a=v.width[o],l=v.height[o]),Cn(e,t,o,i$1,s,a,l);}return n}}function Ri(e,t){return n=>{let r=t();return st(e,r),n}}var Bi=z$1.object({maxWorkers:z$1.number().int().positive(),taskTimeout:z$1.number().positive(),enabled:z$1.boolean()});function Yi(){try{let e=globalThis.require?.("os");if(e?.cpus)return Math.max(1,e.cpus().length-1)}catch{}return 2}var Tn={maxWorkers:Yi(),taskTimeout:5e3,enabled:true},c=null,lt=0;function Xi(e){let t={...Tn,...e};return c={config:Bi.parse(t),queue:[],running:new Map,handlers:new Map,completedCount:0,cancelledCount:0,failedCount:0,totalDurationMs:0},Pn()}function zi(e,t){c&&c.handlers.set(e,t);}function Ii(e,t,n="normal"){if(!c||!c.config.enabled)return Vi(e,t);let r=`task-${lt++}`,o={id:r,type:e,input:t,priority:n,queuedAt:Date.now()};return new Promise(i=>{if(!c){i({id:r,type:e,output:void 0,cancelled:false,error:"Worker pool not initialized",durationMs:0});return}let s=c.handlers.get(e);if(!s){i({id:r,type:e,output:void 0,cancelled:false,error:`No handler registered for task type: ${e}`,durationMs:0});return}let a={task:o,resolve:i,handler:s,timerHandle:null},l={high:0,normal:1,low:2},u=l[n],m=c.queue.length;for(let d=0;d<c.queue.length;d++){let g=c.queue[d];if(g&&l[g.task.priority]>u){m=d;break}}c.queue.splice(m,0,a),queueMicrotask(()=>_i());})}function Oi(e){if(!c)return false;let t=c.queue.findIndex(n=>n.task.id===e);if(t>=0){let[n]=c.queue.splice(t,1);return n?(n.resolve({id:e,type:n.task.type,output:void 0,cancelled:true,error:void 0,durationMs:0}),c.cancelledCount++,true):false}return false}function wi(e){if(!c)return 0;let t=0,n=[];for(let r of c.queue)r.task.type===e?(r.resolve({id:r.task.id,type:e,output:void 0,cancelled:true,error:void 0,durationMs:0}),t++):n.push(r);return c.queue=n,c.cancelledCount+=t,t}function Pn(){if(!c)return {config:Tn,stats:{activeWorkers:0,idleWorkers:0,queuedTasks:0,runningTasks:0,completedTasks:0,cancelledTasks:0,failedTasks:0,avgDurationMs:0,enabled:false}};let e=c.completedCount+c.failedCount;return {config:c.config,stats:{activeWorkers:c.running.size,idleWorkers:Math.max(0,c.config.maxWorkers-c.running.size),queuedTasks:c.queue.length,runningTasks:c.running.size,completedTasks:c.completedCount,cancelledTasks:c.cancelledCount,failedTasks:c.failedCount,avgDurationMs:e>0?c.totalDurationMs/e:0,enabled:c.config.enabled}}}function Li(){if(c){for(let e of c.queue)e.resolve({id:e.task.id,type:e.task.type,output:void 0,cancelled:true,error:void 0,durationMs:0});for(let e of c.running.values())e.timerHandle&&clearTimeout(e.timerHandle);c=null,lt=0;}}function Vi(e,t){let n=`sync-${lt++}`,r=c?.handlers.get(e);if(!r)return Promise.resolve({id:n,type:e,output:void 0,cancelled:false,error:`No handler registered for task type: ${e}`,durationMs:0});let o=performance.now();try{let i=r(t);return Promise.resolve({id:n,type:e,output:i,cancelled:!1,error:void 0,durationMs:performance.now()-o})}catch(i){return Promise.resolve({id:n,type:e,output:void 0,cancelled:false,error:i instanceof Error?i.message:String(i),durationMs:performance.now()-o})}}function Gi(e,t){t<=0||(e.timerHandle=setTimeout(()=>{c&&(c.running.delete(e.task.id),c.failedCount++,e.resolve({id:e.task.id,type:e.task.type,output:void 0,cancelled:false,error:`Task timed out after ${t}ms`,durationMs:t}));},t));}function qi(e,t,n){c&&c.running.has(e.task.id)&&(e.timerHandle&&clearTimeout(e.timerHandle),c.running.delete(e.task.id),c.completedCount++,c.totalDurationMs+=n,e.resolve({id:e.task.id,type:e.task.type,output:t,cancelled:false,error:void 0,durationMs:n}));}function Ui(e,t,n){c&&c.running.has(e.task.id)&&(e.timerHandle&&clearTimeout(e.timerHandle),c.running.delete(e.task.id),c.failedCount++,c.totalDurationMs+=n,e.resolve({id:e.task.id,type:e.task.type,output:void 0,cancelled:false,error:t instanceof Error?t.message:String(t),durationMs:n}));}function Ni(e){if(!c)return;Gi(e,c.config.taskTimeout);let t=performance.now();try{let n=e.handler(e.task.input),r=performance.now()-t;qi(e,n,r);}catch(n){let r=performance.now()-t;Ui(e,n,r);}}function _i(){if(c)for(;c.queue.length>0&&c.running.size<c.config.maxWorkers;){let e=c.queue.shift();if(!e)break;c.running.set(e.task.id,e),Ni(e);}}export{zr as $,nt as $a,fr as A,po as Aa,hi as Ab,dr as B,yo as Ba,xi as Bb,yr as C,go as Ca,vi as Cb,Nt as D,bo as Da,Mi as Db,gr as E,So as Ea,Ei as Eb,br as F,Ze as Fa,xn as Fb,_t as G,vo as Ga,vn as Gb,Er as H,$e as Ha,Mn as Hb,Cr as I,Qe as Ia,En as Ib,jt as J,Ke as Ja,ki as Jb,Tr as K,Ao as Ka,Ai as Kb,N as L,Wo as La,Cn as Lb,be as M,Fo as Ma,Wi as Mb,z as N,Ho as Na,Fi as Nb,Zt as O,Do as Oa,st as Ob,kr as P,Ro as Pa,Hi as Pb,Ar as Q,Bo as Qa,Di as Qb,$t as R,Yo as Ra,Ri as Rb,Wr as S,Xo as Sa,Xi as Sb,Fr as T,mn as Ta,zi as Tb,Hr as U,Go as Ua,Ii as Ub,Dr as V,qo as Va,Oi as Vb,Rr as W,Uo as Wa,wi as Wb,Qt as X,fn as Xa,Pn as Xb,Br as Y,jo as Ya,Li as Yb,Yr as Z,Zo as Za,Xr as _,ie as _a,Vt as a,Kt as aa,rt as ab,zn as b,Ir as ba,$o as bb,Ie as c,wr as ca,dn as cb,In as d,nn as da,Qo as db,On as e,Lr as ea,pn as eb,wn as f,Vr as fa,Ko as fb,qn as g,Gr as ga,et as gb,Oe as h,Ne as ha,ot as hb,we as i,qr as ia,Jo as ib,Zn as j,Ur as ja,ei as jb,$n as k,Nr as ka,ti as kb,Qn as l,_r as la,ni as lb,Kn as m,sn as ma,ri as mb,Jn as n,Qr as na,oi as nb,er as o,_e as oa,ii as ob,tr as p,Kr as pa,yn as pb,nr as q,Jr as qa,gn as qb,rr as r,eo as ra,ui as rb,qt as s,ln as sa,hn as sb,Ut as t,no as ta,di as tb,Ve as u,ro as ua,at as ub,sr as v,oo as va,pi as vb,lr as w,io as wa,yi as wb,ur as x,ao as xa,gi as xb,cr as y,mo as ya,bi as yb,mr as z,fo as za,Si as zb};
|