@visulima/packem 2.0.0-alpha.83 → 2.0.0-alpha.85
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/CHANGELOG.md +36 -0
- package/dist/builder/typedoc/index.d.ts +1 -1
- package/dist/builder/typedoc/index.js +3 -3
- package/dist/cli/index.js +36 -36
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/preset/preact.d.ts +1 -1
- package/dist/config/preset/preact.js +2 -2
- package/dist/config/preset/react.d.ts +1 -1
- package/dist/config/preset/react.js +1 -1
- package/dist/config/preset/solid.d.ts +1 -1
- package/dist/config/preset/solid.js +1 -1
- package/dist/config/preset/svelte.d.ts +1 -1
- package/dist/config/preset/svelte.js +1 -1
- package/dist/config/preset/vue.d.ts +1 -1
- package/dist/config/preset/vue.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +39 -35
- package/dist/packem_shared/create-or-update-key-storage-CRDW-Kwa.js +28 -0
- package/dist/packem_shared/default-nqaAQAPN.js +1 -0
- package/dist/packem_shared/index-BSqT47P3.js +244 -0
- package/dist/packem_shared/oxcTransformPlugin-Dwvbw2jE-BSBF_-9X.js +177 -0
- package/dist/packem_shared/{types.d-Cm6dnCyD.d.ts → types.d-ICL9GlqC.d.ts} +8 -5
- package/dist/packem_shared/utils-Bsoe7qJG.js +1 -0
- package/dist/rollup/plugins/oxc/oxc-transformer.js +1 -1
- package/package.json +5 -5
- package/dist/packem_shared/create-or-update-key-storage-DUTe5Prf.js +0 -13
- package/dist/packem_shared/default-Dj-WgmWM.js +0 -1
- package/dist/packem_shared/index-BcKJ8RJU.js +0 -255
- package/dist/packem_shared/oxcResolvePlugin-DeIohkWk-rspLVIoy.js +0 -170
- package/dist/packem_shared/oxcTransformPlugin-Dwvbw2jE-Bbz81VnA.js +0 -4
- package/dist/packem_shared/utils-nmTpa3um.js +0 -1
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import{createRequire as We,builtinModules as hm}from"node:module";import{g as fr,o as gm,a as Cp,P as Fs,b as vm,T as mr,N as ft,F as mt,u as Tp,t as hr,c as qs,J as _p,S as ym,d as pn,s as nt,i as Np,q as ne,j as je,e as Fe,h as Wo,I as zs,k as Zt,m as vs,l as Pp,_ as bm,H as Bo,E as Mp,n as Ht,K as $m,p as wm,f as xm,r as km}from"./create-or-update-key-storage-CRDW-Kwa.js";import ut,{env as Em,versions as Uo,platform as on}from"node:process";import{H as Z,_ as Ae,B as Vn,w as V,P as X,E as Sm,G as rn,V as rt,Z as Ip,k as jm,v as Hs,W as Wp}from"./utils-Bsoe7qJG.js";import{installPackage as Bp,detectPackageManager as Am}from"@antfu/install-pkg";import{E as Vo,L as Dp,p as Om,i as Lp,s as Rm,P as Fp,f as Cm,M as Tm,T as Nt,r as Oe,a as ro,b as gr,c as Js,d as qp,e as zp,g as _m,h as Hp,k as Nm,S as Pm,l as Mm,m as Qt,n as ys,v as Im,A as Wm,o as io,j as Bm}from"./oxcTransformPlugin-Dwvbw2jE-BSBF_-9X.js";import{importTrace as Jp,replace as Gp,alias as Up,purePlugin as Dm,pureNewExpressionPlugin as Lm,browserslistToEsbuild as Ga,polyfillNode as Fm,chunkSplitter as qm,wasm as zm,preserveDirectivesPlugin as Hm,dynamicImportVars as Jm,commonjs as Gm,jsxRemoveAttributes as Um,visualizer as Vm,patchErrorWithTrace as Km}from"@visulima/packem-rollup";import{ENDING_REGEX as Ym,svgToCssDataUri as Xm,svgToTinyDataUri as Zm,memoizeByKey as Gs,arrayify as Qm,enhanceRollupError as Vp,FileCache as eh}from"@visulima/packem-share";import{RUNTIME_EXPORT_CONVENTIONS as Kp,SPECIAL_EXPORT_CONVENTIONS as Yp,DEFAULT_EXTENSIONS as vr,ENDING_REGEX as Us,PRODUCTION_ENV as Hn,DEVELOPMENT_ENV as Ua,EXCLUDE_REGEXP as Ot,ALLOWED_TRANSFORM_EXTENSIONS_REGEX as jt,VALID_EXPORT_EXTENSIONS as th}from"@visulima/packem-share/constants";import{getCacheHash as Ke,memoize as nh,arrayify as bs,isFromNodeModules as Yr,isBareSpecifier as In,parseSpecifier as $s,isOutsideProject as oh,getPackageName as rh,replaceContentWithinMarker as ih,svgEncoder as sh,sortUserPlugins as Xp,getDtsExtension as Ye,getChunkFilename as Jn,getEntryFileNames as ah,getOutputExtension as Me,warn as Y}from"@visulima/packem-share/utils";import lh from"browserslist";import{createHooks as ch}from"hookable";import{createJiti as ph}from"jiti";import{x as Ko,exec as uh}from"tinyexec";import ke from"magic-string";import{fileURLToPath as Zp}from"node:url";import dh,{existsSync as Vs,createReadStream as Ks,createWriteStream as fh,watch as Va}from"node:fs";import{cpus as mh,tmpdir as Qp,homedir as hh}from"node:os";import{dirname as ws,join as eu,resolve as gh,isAbsolute as vh}from"node:path";import{createFilter as Qe,normalizePath as Kn}from"@rollup/pluginutils";import yh from"workerpool";import{transformAsync as bh}from"@babel/core";import tu,{stat as so,readFile as Yo,copyFile as $h,chmod as nu,readdir as wh,rm as yr,mkdtemp as ou,mkdir as ru,writeFile as iu,rename as xh}from"node:fs/promises";import*as kh from"rs-module-lexer";import{findStaticImports as br,isNodeBuiltin as bo,parseNodeModulePath as Ka,parseStaticImport as Eh,findExports as Sh,fileURLToPath as jh,resolveModuleExportNames as Ah,resolvePath as su,pathToFileURL as Oh}from"mlly";import Rh from"rollup-plugin-license";import at from"typescript";import Ch from"clean-css";import{minify as Th}from"html-minifier-next";import{init as au,parse as _h}from"cjs-module-lexer";import{parseSync as $r}from"oxc-parser";import Nh from"node:crypto";import{cjsInteropPlugin as lu}from"@visulima/packem-rollup/plugin/cjs-interop";import{JsonPlugin as Ph}from"@visulima/packem-rollup/plugin/json";import{confirm as Mh,isCancel as Ih,spinner as Wh}from"@clack/prompts";import Ya from"node:path/posix";import{readTsConfig as Bh,findTsConfig as Dh}from"@visulima/tsconfig";import{createDefu as Lh}from"defu";import Fh from"child_process";import qh from"node:child_process";import{promisify as zh,debuglog as Hh}from"node:util";import{distance as Jh}from"fastest-levenshtein";import{createBrotliCompress as Gh,constants as Uh,createGzip as Vh}from"node:zlib";import{Buffer as Kh}from"node:buffer";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
+
const __filename = import.meta.filename; // -- packem CommonJS __filename shim --
|
|
3
|
+
const __dirname = import.meta.dirname; // -- packem CommonJS __dirname shim --
|
|
4
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
5
|
+
var Yh=Object.defineProperty,oe=(e,t)=>Yh(e,"name",{value:t,configurable:!0});const Xh=We(import.meta.url),Jt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,wr=oe(e=>{if(typeof Jt<"u"&&Jt.versions&&Jt.versions.node){const[t,n]=Jt.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Jt.getBuiltinModule(e)}return Xh(e)},"__cjs_getBuiltinModule"),{createRequire:Zh}=wr("node:module"),Rt=Jt,{execFileSync:Qh}=wr("node:child_process"),Wn=wr("node:fs"),eg=wr("node:tty"),AO={alert:7,critical:6,debug:1,emergency:8,error:5,informational:2,notice:3,trace:2,warning:4},tg={alert:{color:"red",label:"alert",logLevel:"alert"},await:{color:"blue",label:"awaiting",logLevel:"informational"},complete:{color:"cyan",label:"complete",logLevel:"informational"},critical:{color:"redBright",label:"critical",logLevel:"critical"},debug:{color:"gray",label:"debug",logLevel:"debug"},emergency:{color:"redBright",label:"emergency",logLevel:"emergency"},error:{color:"red",label:"error",logLevel:"error"},info:{color:"blueBright",label:"info",logLevel:"informational"},log:{label:"",logLevel:"informational"},notice:{color:"magentaBright",label:"notice",logLevel:"notice"},pending:{color:"magenta",label:"pending",logLevel:"informational"},start:{color:"greenBright",label:"start",logLevel:"informational"},stop:{color:"red",label:"stop",logLevel:"informational"},success:{color:"green",label:"success",logLevel:"informational"},trace:{color:"cyanBright",label:"trace",logLevel:"trace"},wait:{color:"blue",label:"waiting",logLevel:"informational"},warn:{color:"yellow",label:"warning",logLevel:"warning"},warning:{color:"yellow",label:"warning",logLevel:"warning"},watch:{color:"yellowBright",label:"watching",logLevel:"informational"}},ng=Symbol("EMPTY");var og=Object.defineProperty,rg=oe((e,t)=>og(e,"name",{value:t,configurable:!0}),"g$6");const ig=rg(e=>{const t=Object.keys(e).map(n=>e[n].label??"");return t.length===0?"":t.reduce((n,o)=>n.length>o.length?n:o,"")},"getLongestLabel");var sg=Object.defineProperty,cu=oe((e,t)=>sg(e,"name",{value:t,configurable:!0}),"T$5"),ag=Object.defineProperty,se=cu((e,t)=>ag(e,"name",{value:t,configurable:!0}),"l"),lg=Object.defineProperty,cg=se((e,t)=>lg(e,"name",{value:t,configurable:!0}),"L");const ze=cg((e,t,n,o,r,i=", ")=>{const s=e.length;if(s===0)return"";let a=o;r!==void 0&&(a=r);const l=n.truncate;let p="",c="",u="";for(let d=0;d<s;d+=1){const f=d+1===e.length,m=d+2===e.length;u=`…(${String(e.length-d)})`;let h=e[d];n.truncate=l-p.length-(f?0:i.length);const v=c||a(h,t,n,o)+(f?"":i),y=p.length+v.length,g=y+u.length;if(f&&y>l&&p.length+u.length<=l||!f&&!m&&g>l)break;h=e[d+1];const $=m?"":i;if(f?c="":c=a(h,t,n,o)+$,!f&&m&&g>l&&y+c.length>l)break;if(p+=v,!f&&!m&&y+c.length>=l){u=`…(${String(e.length-d-1)})`;break}u=""}return`${p}${u}`},"inspectList");var pg=Object.defineProperty,xr=se((e,t)=>pg(e,"name",{value:t,configurable:!0}),"s$6");const ug=xr(([e,t],n,o)=>(o.truncate-=3,t?`${o.stylize(String(e),"yellow")}=${o.stylize(`"${t}"`,"string")}`:o.stylize(String(e),"yellow")),"inspectAttribute"),dg=xr((e,t,n)=>{switch(e.nodeType){case 1:return pu(e,e,n,t);case 3:return t(e.data,t,n);default:return t(e,t,n)}},"inspectNode"),xs=xr((e,t,n,o)=>ze(e,e,t,n,dg,`
|
|
6
|
+
`),"inspectNodeCollection"),pu=xr((e,t,n,o)=>{const r=e.getAttributeNames(),i=e.tagName.toLowerCase(),s=n.stylize(`<${i}`,"special"),a=n.stylize(">","special"),l=n.stylize(`</${i}>`,"special");n.truncate-=i.length*2+5;let p="";r.length>0&&(p+=" ",p+=ze(r.map(d=>[d,e.getAttribute(d)]),t,n,o,ug," ")),n.truncate-=p.length;const{truncate:c}=n;let u=xs(e.children,n,o,void 0);return u&&u.length>c&&(u=`…(${String(e.children.length)})`),`${s}${p}${a}${u}${l}`},"inspectHTMLElement");var fg=Object.defineProperty,mg=se((e,t)=>fg(e,"name",{value:t,configurable:!0}),"n$4");const hg=mg((e,t,n)=>e.length===0?"Arguments []":(t.truncate-=13,`Arguments [ ${ze(e,e,t,n)} ]`),"inspectArguments");var gg=Object.defineProperty,uu=se((e,t)=>gg(e,"name",{value:t,configurable:!0}),"r$3");const vg=uu((e,t)=>{let n;if(e===" ")n=" ";else if(typeof e=="number"&&e>0)n=Array.from({length:e+1}).join(" ");else return;return{base:n,prev:`
|
|
7
|
+
${Array.from({length:t+1}).join(n)}`}},"getIndent"),kr=uu((e,t)=>{if(e.length===0)return"";const n=t.prev+t.base;return n+e.split(", ").join(`,${n}`)+t.prev},"indentedJoin");var yg=Object.defineProperty,du=se((e,t)=>yg(e,"name",{value:t,configurable:!0}),"i$5");const bg=/^[a-z_]\w*$/i,$g=/^"|"$/g,wg=du((e,t)=>{if(bg.test(e))return e;const n=JSON.stringify(e);return t.quoteStyle==="double"?n.replaceAll('"',String.raw`\"`):n.replaceAll("'",String.raw`\'`).replaceAll(String.raw`\"`,'"').replaceAll($g,"'")},"quoteComplexKey"),Yn=du(([e,t],n,o,r)=>{o.truncate-=2;let i;typeof e=="string"?i=wg(e,o):typeof e=="number"?i=String(e):i=`[${r(e,n,o)}]`,o.truncate-=i.length;const s=r(t,n,o);return`${i}: ${s}`},"inspectProperty");var xg=Object.defineProperty,fu=se((e,t)=>xg(e,"name",{value:t,configurable:!0}),"p$4");const kg=fu(e=>{for(const t of e)if(Array.isArray(t)||typeof t=="object"&&t!==null)return!0;return!1},"multiLineValues"),Eg=fu((e,t,n,o)=>{const r=Object.keys(e).slice(e.length);if(e.length===0&&r.length===0)return"[]";t.truncate-=4;let i=ze(e,e,t,n);t.truncate-=i.length;let s="";r.length>0&&(s=ze(r.map(l=>[l,e[l]]),e,t,n,Yn));const a=o&&kg(e);return a&&(i=kr(i,o)),`[${a?"":" "}${i}${s?`, ${s}`:""}${a?"":" "}]`},"inspectArray");var Sg=Object.defineProperty,jg=se((e,t)=>Sg(e,"name",{value:t,configurable:!0}),"o$7");const Xa=/\d(?=(?:\d{3})+(?!\d))/g,Ag=/\d{3}/g,Og=/_$/,mu=jg((e,t)=>{if(e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||t.includes("e"))return t;if(typeof e=="number"){const n=e<0?-Math.floor(-e):Math.floor(e);if(n!==e){const o=String(n),r=t.slice(o.length+1);return`${o.replace(Xa,"$&_")}.${r.replace(Ag,"$&_").replace(Og,"")}`}}return t.replace(Xa,"$&_")},"addNumericSeparator");var Rg=Object.defineProperty,hu=se((e,t)=>Rg(e,"name",{value:t,configurable:!0}),"i$4");const Cg=hu(e=>e>="\uD800"&&e<="\uDBFF","isHighSurrogate"),yt=hu((e,t,n="…")=>{e=String(e);const o=n.length,r=e.length;if(o>t&&r>o)return n;if(r>t&&r>o){let i=t-o;return i>0&&Cg(e[i-1])&&(i-=1),`${e.slice(0,i)}${n}`}return e},"truncate");var Tg=Object.defineProperty,_g=se((e,t)=>Tg(e,"name",{value:t,configurable:!0}),"e$4");const Za=_g((e,t)=>{let n=yt(e.toString(),t.truncate-1);return n!=="…"&&(n+="n"),t.stylize(t.numericSeparator?mu(e,n):n,"bigint")},"inspectBigInt");var Ng=Object.defineProperty,Pg=se((e,t)=>Ng(e,"name",{value:t,configurable:!0}),"y");const Mg=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:void 0),Do=Pg((e,t,n,o)=>{if("window"in globalThis&&e===globalThis)return"{ [object Window] }";if(e===globalThis||"global"in globalThis&&e===globalThis)return"{ [object globalThis] }";const r=Object.getOwnPropertyNames(e),i=Object.getOwnPropertySymbols(e),s=Mg(e)===Object.prototype||e.constructor===Object,a=e instanceof Object?"":"null prototype";let l;!s&&Symbol.toStringTag in e?l=e[Symbol.toStringTag]:l=a?"Object":"";const p=l||a?`[${[l,a].filter(Boolean).join(": ")}] `:"";if(r.length===0&&i.length===0)return`${p}{}`;t.truncate-=4;const c=ze(r.map(f=>[f,e[f]]),e,t,n,Yn),u=ze(i.map(f=>[f,e[f]]),e,t,n,Yn);let d="";return c&&u&&(d=", "),o?`${p}{${kr(c+d+u,o)}}`:`${p}{ ${c}${d}${u} }`},"inspectObject");var Ig=Object.defineProperty,Wg=se((e,t)=>Ig(e,"name",{value:t,configurable:!0}),"s$3");const Bg=Wg((e,t,n,o)=>{let r="";return r=r||e.constructor.name,(!r||r==="_class")&&(r="<Anonymous Class>"),t.truncate-=r.length,`${r} ${Do(e,t,n,o)}`},"inspectClass");var Dg=Object.defineProperty,Lg=se((e,t)=>Dg(e,"name",{value:t,configurable:!0}),"i$3");const Fg=Lg((e,t)=>{const n=e.toJSON();if(n===null)return"Invalid Date";const o=n.split("T"),r=o[0];return t.stylize(`${r}T${yt(o[1],t.truncate-r.length-1)}`,"date")},"inspectDate");var qg=Object.defineProperty,zg=se((e,t)=>qg(e,"name",{value:t,configurable:!0}),"c$4");const Hg=new Set(["column","columnNumber","description","fileName","line","lineNumber","message","name","number","stack"]),Jg=zg((e,t,n)=>{const o=Object.getOwnPropertyNames(e).filter(a=>!Hg.has(a)),{name:r}=e;t.truncate-=r.length;let i="";typeof e.message=="string"?i=yt(e.message,t.truncate):o.unshift("message"),i=i?`: ${i}`:"",t.truncate-=i.length+5;const s=ze(o.map(a=>[a,e[a]]),e,t,n,Yn);return`${r}${i}${s?` { ${s} }`:""}`},"inspectObject");var Gg=Object.defineProperty,Ug=se((e,t)=>Gg(e,"name",{value:t,configurable:!0}),"c$3");const Qa=Ug((e,t)=>{const n=e[Symbol.toStringTag]||"Function",o=e.toString();if(o.length<t.truncate-12)return t.stylize(`[${n}: ${o}]`,"special");const{name:r}=e;return r?t.stylize(`[${n} ${yt(r,t.truncate-11)}]`,"special"):t.stylize(`[${n}]`,"special")},"inspectFunction");var Vg=Object.defineProperty,gu=se((e,t)=>Vg(e,"name",{value:t,configurable:!0}),"p$3");const Kg=gu(([e,t],n,o,r)=>(o.truncate-=4,e=r(e,n,o),o.truncate-=e.length,`${e} => ${r(t,n,o)}`),"inspectMapEntry"),Yg=gu((e,t,n,o)=>{if(e.size<=0)return"Map (0) {}";t.truncate-=7;let r=ze([...e.entries()],e,t,n,Kg);return o&&(r=kr(r,o)),`Map (${String(e.size)}) {${o?"":" "}${r}${o?"":" "}}`},"inspectMap");var Xg=Object.defineProperty,Zg=se((e,t)=>Xg(e,"name",{value:t,configurable:!0}),"e$3");function sn(e,t){return Number.isNaN(e)?t.stylize("NaN","number"):e===Number.POSITIVE_INFINITY?t.stylize("Infinity","number"):e===Number.NEGATIVE_INFINITY?t.stylize("-Infinity","number"):e===0?t.stylize(1/e===Number.POSITIVE_INFINITY?"+0":"-0","number"):t.stylize(yt(t.numericSeparator?mu(e,e.toString()):e.toString(),t.truncate),"number")}oe(sn,"j$5");cu(sn,"P");se(sn,"u$3");Zg(sn,"inspectNumber");var Qg=Object.defineProperty,ev=se((e,t)=>Qg(e,"name",{value:t,configurable:!0}),"e$2");const tv=ev(()=>"Promise{…}","getPromiseValue");var nv=Object.defineProperty,ov=se((e,t)=>nv(e,"name",{value:t,configurable:!0}),"p$1");const rv=ov((e,t)=>{const n=t.truncate-(2+e.flags.length);return t.stylize(`/${yt(e.source,n)}/${e.flags}`,"regexp")},"inspectRegExp");var iv=Object.defineProperty,sv=se((e,t)=>iv(e,"name",{value:t,configurable:!0}),"i$1");const av=sv((e,t,n,o)=>{if(e.size===0)return"Set (0) {}";t.truncate-=7;let r=ze([...e],e,t,n);return o&&(r=kr(r,o)),`Set (${String(e.size)}) {${o?"":" "}${r}${o?"":" "}}`},"inspectSet");var lv=Object.defineProperty,cv=se((e,t)=>lv(e,"name",{value:t,configurable:!0}),"l");const pv=cv((e,t)=>{const n=t.quoteStyle==="double"?'"':"'";return t.quoteStyle==="double"&&(e=e.replaceAll('"','"')),n+e+n},"wrapQuotes");var uv=Object.defineProperty,vu=se((e,t)=>uv(e,"name",{value:t,configurable:!0}),"e$1");const el=new RegExp(String.raw`['\0-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5`+String.raw`\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]`,"g"),dv={" ":String.raw`\t`,"\n":String.raw`\n`,"\f":String.raw`\f`,"\r":String.raw`\r`,"\b":String.raw`\b`,"'":String.raw`\'`,"\\":"\\\\"},fv=16,mv=vu(e=>dv[e]||String.raw`\u${`0000${e.codePointAt(0).toString(fv)}`.slice(-4)}`,"escape"),tl=vu((e,t)=>(el.test(e)&&(e=e.replaceAll(el,mv)),t.stylize(pv(yt(e,t.truncate-2),t),"string")),"inspectString");var hv=Object.defineProperty,gv=se((e,t)=>hv(e,"name",{value:t,configurable:!0}),"o");const nl=gv(e=>"description"in Symbol.prototype?e.description?`Symbol(${e.description})`:"Symbol()":e.toString(),"inspectSymbol");var vv=Object.defineProperty,yu=se((e,t)=>vv(e,"name",{value:t,configurable:!0}),"f");const yv=yu(e=>typeof Buffer=="function"&&e instanceof Buffer?"Buffer":e[Symbol.toStringTag],"getArrayName"),tt=yu((e,t,n)=>{const o=yv(e);t.truncate-=o.length+4;const r=Object.keys(e).slice(e.length);if(e.length===0&&r.length===0)return`${o}[]`;let i="";for(let a=0;a<e.length;a++){const l=`${t.stylize(yt(e[a],t.truncate),"number")}${a===e.length-1?"":", "}`;if(t.truncate-=l.length,e[a]!==e.length&&t.truncate<=3){i+=`…(${String(e.length-e[a]+1)})`;break}i+=l}let s="";return r.length>0&&(s=ze(r.map(a=>[a,e[a]]),e,t,n,Yn)),`${o}[ ${i}${s?`, ${s}`:""} ]`},"inspectTypedArray");var bv=Object.defineProperty,xe=se((e,t)=>bv(e,"name",{value:t,configurable:!0}),"r");const Xo=new WeakMap,ks={},$v={Arguments:hg,Array:Eg,ArrayBuffer:xe(()=>"","ArrayBuffer"),BigInt:Za,bigint:Za,Boolean:xe((e,t)=>t.stylize(String(e),"boolean"),"Boolean"),boolean:xe((e,t)=>t.stylize(String(e),"boolean"),"boolean"),DataView:xe(()=>"","DataView"),Date:Fg,Error:Jg,Float32Array:tt,Float64Array:tt,Function:Qa,function:Qa,Generator:xe(()=>"","Generator"),HTMLCollection:xs,Int8Array:tt,Int16Array:tt,Int32Array:tt,Map:Yg,NodeList:xs,null:xe((e,t)=>t.stylize("null","null"),"null"),Number:sn,number:sn,Promise:tv,RegExp:rv,Set:av,String:tl,string:tl,Symbol:nl,symbol:nl,Uint8Array:tt,Uint8ClampedArray:tt,Uint16Array:tt,Uint32Array:tt,undefined:xe((e,t)=>t.stylize("undefined","undefined"),"undefined"),WeakMap:xe((e,t)=>t.stylize("WeakMap{…}","special"),"WeakMap"),WeakSet:xe((e,t)=>t.stylize("WeakSet{…}","special"),"WeakSet")},ol=Symbol.for("nodejs.util.inspect.custom"),wv=xe((e,t,n,o)=>{if(!("window"in globalThis)&&typeof e[ol]=="function")return e[ol](o,t);if("inspect"in e&&typeof e.inspect=="function")return e.inspect(o,t);if("constructor"in e&&Xo.has(e.constructor))return Xo.get(e.constructor)?.(e,t)??"unknown";const r=ks[n];return r?r(e,t):""},"inspectCustom"),bu=xe((e,t,n,o)=>{if(o.includes(e))return"[Circular]";if(n>=t.depth&&t.depth>0&&typeof e=="object")return Array.isArray(e)?"[Array]":"[Object]";const r=xe((p,c,u)=>(c&&(o=[...o,c]),bu(p,u,n+1,o)),"inspect"),i=t.indent?vg(t.indent,n):void 0;let s=e===null?"null":typeof e;s==="object"&&(s=Object.prototype.toString.call(e).slice(8,-1));const a=$v[s];if(a!==void 0)return a(e,t,r,i);if(t.customInspect&&e){const p=wv(e,t,s,t.depth-n);if(p)return typeof p=="string"?p:r(p,e,t)}const l=e?Object.getPrototypeOf(e):!1;return l===Object.prototype||l===null?Do(e,t,r,i):e&&typeof HTMLElement=="function"&&e instanceof HTMLElement?pu(e,e,t,r):"constructor"in e?e.constructor!==Object?Bg(e,t,r,i):Do(e,t,r,i):e===Object(e)?Do(e,t,r,i):t.stylize(String(e),s)},"internalInspect"),rl=xe((e,t={})=>{const n={breakLength:Number.POSITIVE_INFINITY,customInspect:!0,depth:5,indent:void 0,maxArrayLength:Number.POSITIVE_INFINITY,numericSeparator:!0,quoteStyle:"single",showHidden:!1,showProxy:!1,stylize:xe(o=>o,"stylize"),truncate:Number.POSITIVE_INFINITY,...t};if(n.indent!==void 0&&n.indent!==" "&&!(Number.parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `undefined`');return bu(e,n,0,[])},"inspect");xe((e,t)=>Xo.has(e)?!1:(Xo.set(e,t),!0),"registerConstructor");xe((e,t)=>e in ks?!1:(ks[e]=t,!0),"registerStringTag");var xv=Object.defineProperty,kv=oe((e,t)=>xv(e,"name",{value:t,configurable:!0}),"r$6");const Ev=kv((e,t)=>(t.__write??t.write.bind(t)).call(t,e),"writeStream");var Sv=Object.defineProperty,jv=oe((e,t)=>Sv(e,"name",{value:t,configurable:!0}),"A$4"),Av=Object.defineProperty,Ys=jv((e,t)=>Av(e,"name",{value:t,configurable:!0}),"$"),Ov=Object.defineProperty,Rv=Ys((e,t)=>Ov(e,"name",{value:t,configurable:!0}),"r$1");const Cv=Rv(e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
8
|
+
`),"normalizeLF"),Tv=globalThis.process??Object.create(null),il={versions:{}},sl=new Proxy(Tv,{get(e,t){if(t in e)return e[t];if(t in il)return il[t]}});var _v=Object.defineProperty,Nv=Ys((e,t)=>_v(e,"name",{value:t,configurable:!0}),"b");const Pv=Nv((e,t,n,o)=>{const r={column:0,line:-1,...e.start},i={...r,...e.end},s=r.line,a=r.column,l=i.line,p=i.column;let c=Math.max(s-(n+1),0),u=Math.min(t.length,l+o);s===-1&&(c=0),l===-1&&(u=t.length);const d=l-s,f={};if(d)for(let m=0;m<=d;m++){const h=m+s;if(!a)f[h]=!0;else if(m===0){const v=t[h-1]?.length;f[h]=[a,(v??0)-a+1]}else if(m===d)f[h]=[0,p];else{const v=t[h-m]?.length;f[h]=[0,v]}}else a===p?f[s]=a?[a,0]:!0:f[s]=[a,(p??0)-(a??0)];return{end:u,markerLines:f,start:c}},"getMarkerLines");var Mv=Object.defineProperty,$o=Ys((e,t)=>Mv(e,"name",{value:t,configurable:!0}),"t");const Iv=sl.platform==="win32"&&!sl.env?.WT_SESSION?">":"❯",Wv=$o((e,t,n)=>{const o={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:$o(m=>m,"gutter"),marker:$o(m=>m,"marker"),message:$o(m=>m,"message"),...n?.color}},r=typeof t.start.column=="number";let i=Cv(e).split(`
|
|
9
|
+
`);typeof o.tabWidth=="number"&&(i=i.map(m=>m.replaceAll(" "," ".repeat(o.tabWidth))));const{end:s,markerLines:a,start:l}=Pv(t,i,o.linesAbove,o.linesBelow),p=String(s).length,{gutter:c,marker:u,message:d}=o.color;let f=i.slice(l,s).map((m,h)=>{const v=l+1+h,y=a[v],g=` ${String(v)}`.slice(-p),$=!a[v+1],b=` ${g}${o.showGutter?" |":""}`;if(y){let w="";if(Array.isArray(y)){const E=m.replaceAll(/[^\t]/g," ").slice(0,Math.max(y[0]-1,0)),x=y[1]||1;w=[`
|
|
10
|
+
`,o.prefix+c(b.replaceAll(/\d/g," "))," ",E,u("^").repeat(x)].join(""),$&&o.message&&(w+=` ${d(o.message)}`)}return[o.prefix+u(Iv),c(b),m.length>0?` ${m}`:"",w].join("")}return`${o.prefix} ${c(b)}${m.length>0?` ${m}`:""}`}).join(`
|
|
11
|
+
`);return o.message&&!r&&(f=`${o.prefix+" ".repeat(p+1)+o.message}
|
|
12
|
+
${f}`),f},"codeFrame");var Bv=Object.defineProperty,Dv=oe((e,t)=>Bv(e,"name",{value:t,configurable:!0}),"x$3"),Lv=Object.defineProperty,Fv=Dv((e,t)=>Lv(e,"name",{value:t,configurable:!0}),"x"),qv=Object.defineProperty,it=Fv((e,t)=>qv(e,"name",{value:t,configurable:!0}),"u");const Pt=it((e,...t)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${e}`,...t)},"debugLog"),Mt="<unknown>",zv=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Hv=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,Jv=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,Gv=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,Uv=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Vv=/in\s(.*)\s\(at\s(.+)\)\sat/,Kv=/^(?:.*@)?(.*):(\d+):(\d+)$/,Yv=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Xv=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Zv=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,al=/\(error: (.*)\)/,Qv=/at\s/,ey=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,ty=/^\s+|\s+$/g,ny=/\S*(?:Error: |AggregateError:)/,$u=/^Anonymous function$/,oy=/^\s*in\s.*/,ry=/^.*?\s*at\s.*/,iy=/^.*?\s*@.*|\[native code\]/,wu=it((e,t)=>{const n=e.includes("safari-extension"),o=e.includes("safari-web-extension");return n||o?[e.includes("@")?e.split("@")[0]:Mt,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},"extractSafariExtensionDetails"),xu=it((e,t)=>{const n=Jv.exec(t);n&&(e.file=n[1],e.line=+n[2],e.column=+n[3])},"parseMapped"),sy=it(e=>{const t=Vv.exec(e);if(t){Pt(`parse nested node error stack line: "${e}"`,`found: ${JSON.stringify(t)}`);const o=t[2].split(":");return{column:o[2]?+o[2]:void 0,file:o[0],line:o[1]?+o[1]:void 0,methodName:t[1]??Mt,raw:e,type:void 0}}const n=Uv.exec(e);if(n){Pt(`parse node error stack line: "${e}"`,`found: ${JSON.stringify(n)}`);const o={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(Qv,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??Mt,raw:e,type:e.startsWith("internal")?"internal":void 0};return xu(o,`${n[2]}:${n[3]}:${n[4]}`),o}},"parseNode"),ay=it(e=>{const t=zv.exec(e);if(t){Pt(`parse chrome error stack line: "${e}"`,`found: ${JSON.stringify(t)}`);const n=t[2]?.startsWith("native"),o=t[2]?.startsWith("eval")||t[1]?.startsWith("eval");let r,i;if(o){const p=Hv.exec(e);if(p){const c=ey.exec(p[1]);c?(t[2]=c[4]??c[1],t[3]=c[5]??c[2],t[4]=c[3]):p[2]&&(t[2]=p[1]),p[2]&&(r={column:p[4]?+p[4]:void 0,file:p[2],line:p[3]?+p[3]:void 0,methodName:"eval",raw:e,type:"eval"})}else{const c=Gv.exec(e);c&&(i={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0},r={column:c[6]?+c[6]:void 0,file:c[1],line:c[5]?+c[5]:void 0,methodName:"eval",raw:c[0],type:"eval"})}}const[s,a]=wu(t[1]?t[1].replace($u,"<anonymous>"):Mt,t[2]),l={column:t[4]?+t[4]:void 0,evalOrigin:r,file:a,line:t[3]?+t[3]:void 0,methodName:s,raw:e,type:o?"eval":n?"native":void 0};return i?(l.column=i.column,l.file=i.file,l.line=i.line):xu(l,`${a}:${t[3]}:${t[4]}`),l}},"parseChromium"),ly=it((e,t)=>{const n=Yv.exec(e);if(n){Pt(`parse gecko error stack line: "${e}"`,`found: ${JSON.stringify(n)}`);const o=n[3]?.includes(" > eval"),r=o&&n[3]&&Xv.exec(n[3]);let i;o&&r&&(n[3]=r[1],i={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:e,type:"eval"},n[4]=r[2]);const[s,a]=wu(n[1]?n[1].replace($u,"<anonymous>"):Mt,n[3]);let l;(t?.type==="safari"||!o&&t?.type==="firefox")&&t.column?l=t.column:!o&&n[5]&&(l=+n[5]);let p;return(t?.type==="safari"||!o&&t?.type==="firefox")&&t.line?p=t.line:n[4]&&(p=+n[4]),{column:l,evalOrigin:i,file:a,line:p,methodName:s,raw:e,type:o?"eval":a.includes("[native code]")?"native":void 0}}},"parseGecko"),cy=it((e,t)=>{const n=Zv.exec(e);if(!(n&&n[2].includes(" > eval"))&&n)return Pt(`parse firefox error stack line: "${e}"`,`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:t?.column??void 0,file:n[2],line:n[3]?+n[3]:t?.line??void 0,methodName:n[1]||Mt,raw:e,type:void 0}},"parseFirefox"),py=it(e=>{const t=Kv.exec(e);if(t)return Pt(`parse react android native error stack line: "${e}"`,`found: ${JSON.stringify(t)}`),{column:t[3]?+t[3]:void 0,file:t[1],line:t[2]?+t[2]:void 0,methodName:Mt,raw:e,type:void 0}},"parseReactAndroidNative"),ku=it((e,{filter:t,frameLimit:n=50}={})=>{const o=e;let r=(typeof o.stacktrace=="string"?o.stacktrace:e.stack??"").split(`
|
|
13
|
+
`).map(i=>(al.test(i)?i.replace(al,"$1"):i).replaceAll(ty,"")).filter(i=>!ny.test(i)&&i!=="eval code");return t&&(r=r.filter(i=>t(i))),r=r.slice(0,n),r.reduce((i,s,a)=>{if(!s||s.length>1024)return i;let l;if(oy.test(s))l=sy(s);else if(ry.test(s))l=ay(s);else if(iy.test(s)){let p;if(a===0){const c=e,u=c.columnNumber,d=c.lineNumber,f=c.line,m=c.column;u||d?p={column:u,line:d,type:"firefox"}:(f||m)&&(p={column:m,line:f,type:"safari"})}l=cy(s,p)??ly(s,p)}else l=py(s);return l?i.push(l):Pt(`parse error stack line: "${s}"`,"not parser found"),i},[])},"parseStacktrace");var uy=Object.defineProperty,dy=oe((e,t)=>uy(e,"name",{value:t,configurable:!0}),"p$6"),fy=Object.defineProperty,Eu=dy((e,t)=>fy(e,"name",{value:t,configurable:!0}),"m");const my=Zh(import.meta.url),Gt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xs=Eu(e=>{if(typeof Gt<"u"&&Gt.versions&&Gt.versions.node){const[t,n]=Gt.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Gt.getBuiltinModule(e)}return my(e)},"__cjs_getBuiltinModule"),{existsSync:hy,readFileSync:gy}=Xs("node:fs"),{relative:vy}=Xs("node:path"),{cwd:yy}=Gt,{fileURLToPath:by}=Xs("node:url");var $y=Object.defineProperty,he=Eu((e,t)=>$y(e,"name",{value:t,configurable:!0}),"o");const un=he((e,t,n)=>n===0?e:t===" "?e+" ".repeat(n):e+" ".repeat(t*n),"getPrefix"),wy=he((e,t)=>{const n=e.replace("async file:","file:");return vy(t,n.startsWith("file:")?by(n):n)},"getRelativePath"),xy=he((e,t,n)=>{if(t)return n.title(e.message);const o=e.message?`: ${e.message}`:"";return n.title(e.name+o)},"getTitleText"),Su=he((e,{color:t,hideErrorTitle:n,indentation:o,prefix:r},i)=>`${un(r,o,i)}${xy(e,n,t)}
|
|
14
|
+
`,"getMessage"),ju=he((e,{color:t,indentation:n,prefix:o},r)=>{if(e.hint===void 0)return;const i=un(o,n,r);let s="";if(Array.isArray(e.hint))for(const a of e.hint)s+=`${i+a}
|
|
15
|
+
`;else s+=i+e.hint;return t.hint(s)},"getHint"),Zs=he((e,{color:t,cwd:n,displayShortPath:o,indentation:r,prefix:i},s=0)=>{const a=o?wy(e.file,n):e.file,{fileLine:l,method:p}=t;return`${un(i,r,s)}at ${e.methodName?`${p(e.methodName)} `:""}${l(a)}:${l(e.line?.toString()??"")}`},"getMainFrame"),Au=he((e,{color:t,indentation:n,linesAbove:o,linesBelow:r,prefix:i,showGutter:s,showLineNumbers:a,tabWidth:l},p)=>{if(e.file===void 0)return;const c=e.file.replace("file://","");if(!hy(c))return;const u=gy(c,"utf8");return Wv(u,{start:{column:e.column,line:e.line}},{color:t,linesAbove:o,linesBelow:r,prefix:un(i,n,p),showGutter:s,showLineNumbers:a,tabWidth:l})},"getCode"),Ou=he((e,t,n)=>{if(e.errors.length===0)return;let o=`${un(t.prefix,t.indentation,n)}Errors:
|
|
16
|
+
|
|
17
|
+
`,r=!0;for(const i of e.errors)r?r=!1:o+=`
|
|
18
|
+
|
|
19
|
+
`,o+=Cu(i,{...t,framesMaxLimit:1,hideErrorCodeView:t.hideErrorErrorsCodeView},n+1);return`
|
|
20
|
+
${o}`},"getErrors"),Ru=he((e,t,n)=>{let o=`${un(t.prefix,t.indentation,n)}Caused by:
|
|
21
|
+
|
|
22
|
+
`;const r=e.cause;o+=Su(r,t,n);const i=ku(r).shift(),s=ju(r,t,n);if(s&&(o+=`${s}
|
|
23
|
+
`),i&&(o+=Zs(i,t,n),!t.hideErrorCauseCodeView)){const a=Au(i,t,n);a!==void 0&&(o+=`
|
|
24
|
+
${a}`)}if(r.cause)o+=`
|
|
25
|
+
${Ru(r,t,n+1)}`;else if(r instanceof AggregateError){const a=Ou(r,t,n);a!==void 0&&(o+=`
|
|
26
|
+
${a}`)}return`
|
|
27
|
+
${o}`},"getCause"),ky=he((e,t)=>(e.length>0?`
|
|
28
|
+
`:"")+e.map(n=>Zs(n,t)).join(`
|
|
29
|
+
`),"getStacktrace"),Cu=he((e,t,n)=>{const o={cwd:yy(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...t,color:{fileLine:he(s=>s,"fileLine"),gutter:he(s=>s,"gutter"),hint:he(s=>s,"hint"),marker:he(s=>s,"marker"),message:he(s=>s,"message"),method:he(s=>s,"method"),title:he(s=>s,"title"),...t.color}},r=ku(e,{filter:t.filterStacktrace,frameLimit:o.framesMaxLimit}),i=r.shift();return[t.hideMessage?void 0:Su(e,o,n),ju(e,o,n),i?Zs(i,o,n):void 0,i&&!o.hideErrorCodeView?Au(i,o,n):void 0,e instanceof AggregateError?Ou(e,o,n):void 0,e.cause===void 0?void 0:Ru(e,o,n),r.length>0?ky(r,o):void 0].filter(Boolean).join(`
|
|
30
|
+
`).replaceAll("\\","/")},"internalRenderError"),Xr=he((e,t={})=>{if(t.framesMaxLimit!==void 0&&t.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return Cu(e,t,0)},"renderError");var Ey=Object.defineProperty,Qs=oe((e,t)=>Ey(e,"name",{value:t,configurable:!0}),"s$3"),Sy=Object.defineProperty,Er=Qs((e,t)=>Sy(e,"name",{value:t,configurable:!0}),"l");const ea=[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,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],ta=[12288,12288,65281,65376,65504,65510],na=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],oa=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Sr=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var jy=Object.defineProperty,Ay=Er((e,t)=>jy(e,"name",{value:t,configurable:!0}),"r$1");const ao=Ay((e,t)=>{let n=0,o=Math.floor(e.length/2)-1;for(;n<=o;){const r=Math.floor((n+o)/2),i=r*2;if(t<e[i])o=r-1;else if(t>e[i+1])n=r+1;else return!0}return!1},"isInRange");var Oy=Object.defineProperty,Wt=Er((e,t)=>Oy(e,"name",{value:t,configurable:!0}),"r");const Ry=ea[0],Cy=ea.at(-1),Ty=ta[0],_y=ta.at(-1),Ny=na[0],Py=na.at(-1),My=oa[0],Iy=oa.at(-1),Wy=Sr[0],By=Sr.at(-1),ll=19968,[Dy,Ly]=lo(Sr);function lo(e){let t=e[0],n=e[1];for(let o=0;o<e.length;o+=2){const r=e[o],i=e[o+1];if(ll>=r&&ll<=i)return[r,i];i-r>n-t&&(t=r,n=i)}return[t,n]}oe(lo,"b$2");Qs(lo,"b");Er(lo,"N");Wt(lo,"findWideFastPathRange");const Tu=Wt(e=>e<Ry||e>Cy?!1:ao(ea,e),"isAmbiguous"),_u=Wt(e=>e<Ty||e>_y?!1:ao(ta,e),"isFullWidth"),Fy=Wt(e=>e<Ny||e>Py?!1:ao(na,e),"isHalfWidth"),qy=Wt(e=>e<My||e>Iy?!1:ao(oa,e),"isNarrow"),Nu=Wt(e=>e>=Dy&&e<=Ly?!0:e<Wy||e>By?!1:ao(Sr,e),"isWide");function co(e){return Tu(e)?"ambiguous":_u(e)?"fullwidth":Fy(e)?"halfwidth":qy(e)?"narrow":Nu(e)?"wide":"neutral"}oe(co,"v$2");Qs(co,"q");Er(co,"getCategory");Wt(co,"getCategory");var zy=Object.defineProperty,jr=oe((e,t)=>zy(e,"name",{value:t,configurable:!0}),"i$3"),Hy=Object.defineProperty,Ar=jr((e,t)=>Hy(e,"name",{value:t,configurable:!0}),"a"),Jy=Object.defineProperty,ra=Ar((e,t)=>Jy(e,"name",{value:t,configurable:!0}),"e");function dn(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}oe(dn,"s$2");jr(dn,"s");Ar(dn,"r");ra(dn,"validate");function fn(e){return dn(e),co(e)}oe(fn,"r$5");jr(fn,"p");Ar(fn,"eastAsianWidthType");ra(fn,"eastAsianWidthType");function Or(e,{ambiguousAsWide:t=!1}={}){return dn(e),_u(e)||Nu(e)||t&&Tu(e)?2:1}oe(Or,"o$5");jr(Or,"W");Ar(Or,"eastAsianWidth");ra(Or,"eastAsianWidth");var Gy=Object.defineProperty,Uy=oe((e,t)=>Gy(e,"name",{value:t,configurable:!0}),"p$3"),Vy=Object.defineProperty,Pu=Uy((e,t)=>Vy(e,"name",{value:t,configurable:!0}),"e"),Ky=Object.defineProperty,Yy=Pu((e,t)=>Ky(e,"name",{value:t,configurable:!0}),"E");const Mu=String.raw,cl=Mu`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Xy=Yy(()=>new RegExp(Mu`\p{RI}{2}|(?)${cl}(?:\u200D${cl})*`,"gu"),"default");var Zy=Object.defineProperty,Qy=Pu((e,t)=>Zy(e,"name",{value:t,configurable:!0}),"p");const mn=new Set(["\x1B",""]),Rr="\x07",Iu="[",ia="m",Zo="]8;;",eb=39,tb=/[\u200B\uFEFF\u2060-\u2064]/g,nb=new RegExp(`(?:\\${Iu}(?<code>\\d+)m|\\${Zo}(?<uri>.*)${Rr})`),ob=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),wn=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,wo=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,Lo=Xy();Qy(e=>e.replace(Lo,""),"stripEmoji");var rb=Object.defineProperty,ib=oe((e,t)=>rb(e,"name",{value:t,configurable:!0}),"E"),sb=Object.defineProperty,ab=ib((e,t)=>sb(e,"name",{value:t,configurable:!0}),"A"),lb=Object.defineProperty,Cr=ab((e,t)=>lb(e,"name",{value:t,configurable:!0}),"d");const pl=new Map,xo=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,Fo=Cr(e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other","getCharType"),cb=Cr((e,t)=>{const n=Math.floor(e/65536),o=e%65536;let r=pl.get(n);if(r||(r=new Map,pl.set(n,r)),r.has(o))return r.get(o);let i;if(Fo(e)==="latin")i=t.width.regular;else if(Fo(e)==="control")i=t.width.control;else if(Fo(e)==="wide")i=t.width.wide;else switch(fn(e)){case"ambiguous":{i=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{i=t.width.fullWidth;break}case"wide":{i=t.width.wide;break}default:i=t.width.regular}return r.set(o,i),i},"getCachedCharWidth"),pb=Cr(e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,"isCombiningCharacter"),Es=Cr((e,t={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const n={truncation:{countAnsiEscapeCodes:t.countAnsiEscapeCodes??!1,ellipsis:t.ellipsis??"",ellipsisWidth:t.ellipsisWidth??(t.ellipsis?Es(t.ellipsis,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:t.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:t.ambiguousIsNarrow??!1,ansi:t.ansiWidth??0,control:t.controlWidth??0,emoji:t.emojiWidth??2,fullWidth:t.fullWidth??2,halfWidth:t.halfWidth??1,regular:t.regularWidth??1,tab:t.tabWidth??8,wide:t.wideWidth??2}},o=Math.max(0,n.truncation.limit-n.truncation.ellipsisWidth),{length:r}=e,i=r>1e4;let s=0,a=0,l=r,p=!1;const c=e.includes("\x1B")||e.includes("");for(;s<r;){if(c&&(e[s]==="\x1B"||e[s]==="")){if(e.startsWith("\x1B]8;;",s)){const v="\x1B]8;;\x07",y=v.length,g=e.indexOf("\x07",s+5);if(g!==-1){const $=e.indexOf(v,g+1);if($!==-1){const b=$+y,w=e.slice(g+1,$).replace(wn,""),E=Es(w,{ambiguousIsNarrow:n.width.ambiguousIsNarrow,ansiWidth:n.width.ansi,controlWidth:n.width.control,countAnsiEscapeCodes:!1,ellipsis:n.truncation.ellipsis,ellipsisWidth:n.truncation.ellipsisWidth,emojiWidth:n.width.emoji,fullWidth:n.width.fullWidth,halfWidth:n.width.halfWidth,limit:Math.max(0,o-a),regularWidth:n.width.regular,tabWidth:n.width.tab,wideWidth:n.width.wide}),x=E.width;if(E.truncated)p=!0,l=Math.min(l,s);else if(a+x>o&&(l=Math.min(l,s),p=!0,a+x>n.truncation.limit))break;if(a+=x,s=b,p&&a>=n.truncation.limit)break;continue}}}if(wn.lastIndex=s,wn.test(e)){const v=wn.lastIndex-s,y=n.truncation.countAnsiEscapeCodes?v:n.width.ansi;if(a+y>o&&(l=Math.min(l,s),a+y>n.truncation.limit)){p=!0;break}a+=y,s=wn.lastIndex;continue}}const f=e.codePointAt(s);if(f===8203||f===65279||f>=8288&&f<=8292){s+=1;continue}if(f===9){if(a+n.width.tab>o&&(l=Math.min(l,s),a+n.width.tab>n.truncation.limit)){p=!0;break}a+=n.width.tab,s+=1;continue}if(xo.lastIndex=s,xo.test(e)){const v=(xo.lastIndex-s)*n.width.regular;if(a+v>o){const y=Math.floor((o-a)/n.width.regular);if(l=Math.min(l,s+y),a+v>n.truncation.limit){p=!0;break}}a+=v,s=xo.lastIndex;continue}if((f<=31||f>=127&&f<=159)&&(wo.lastIndex=s,wo.test(e))){const v=(wo.lastIndex-s)*n.width.control;if(a+v>o&&(l=Math.min(l,s+Math.floor((o-a)/n.width.control)),a+v>n.truncation.limit)){p=!0;break}a+=v,s=wo.lastIndex;continue}if(Lo.lastIndex=s,Lo.test(e)){if(a+n.width.emoji>o&&(l=Math.min(l,s),a+n.width.emoji>n.truncation.limit)){p=!0;break}a+=n.width.emoji,s=Lo.lastIndex;continue}const m=e.codePointAt(s)??0;if(pb(m)){s+=m>65535?2:1;continue}let h;if(i)h=cb(m,n);else switch(Fo(m)){case"control":{h=n.width.control;break}case"latin":{h=n.width.regular;break}case"wide":{h=n.width.wide;break}case"zero":{h=0;break}default:switch(fn(m)){case"ambiguous":{h=n.width.ambiguousIsNarrow?n.width.regular:n.width.wide;break}case"fullwidth":{h=n.width.fullWidth;break}case"wide":{h=n.width.wide;break}default:h=n.width.regular}}if(a+h>o&&(l=Math.min(l,s),a+h>n.truncation.limit)){p=!0;break}a+=h,s+=m>65535?2:1}let u=a,d=!1;return p&&n.truncation.limit>=n.truncation.ellipsisWidth&&(u=n.truncation.limit,d=!0),{ellipsed:d,index:p?l:r,truncated:p,width:u}},"getStringTruncatedWidth");var ub=Object.defineProperty,db=oe((e,t)=>ub(e,"name",{value:t,configurable:!0}),"i$1"),fb=Object.defineProperty,mb=db((e,t)=>fb(e,"name",{value:t,configurable:!0}),"e"),hb=Object.defineProperty,gb=mb((e,t)=>hb(e,"name",{value:t,configurable:!0}),"r");const Pe=gb((e,t={})=>Es(e,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");var vb=Object.defineProperty,Wu=oe((e,t)=>vb(e,"name",{value:t,configurable:!0}),"b"),yb=Object.defineProperty,Bt=Wu((e,t)=>yb(e,"name",{value:t,configurable:!0}),"d"),bb=Object.defineProperty,$b=Bt((e,t)=>bb(e,"name",{value:t,configurable:!0}),"a");const wb=/\x1B\[(\d+)m/;let Bu=class{static{oe(this,"T")}static{Wu(this,"T")}static{Bt(this,"d")}static{$b(this,"AnsiStateTracker")}activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(t){const n=wb.exec(t);if(!n)return;const o=Number.parseInt(n[1],10);switch(o){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(o>=30&&o<=37||o>=90&&o<=97)this.activeForeground=t;else if(o>=40&&o<=47||o>=100&&o<=107)this.activeBackground=t;else if([1,2,3,4,7,8,9].includes(o))this.activeFormatting.push(t);else if([22,23,24,27,28,29].includes(o)){const r={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[o];r&&(this.activeFormatting=this.activeFormatting.filter(i=>!i.includes(r)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const t=[];if(this.activeFormatting.length>0){const n={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(o=>{const r=n[o];r&&t.push(r)})}return this.activeForeground&&t.push("\x1B[39m"),this.activeBackground&&t.push("\x1B[49m"),t.join("")}};var xb=Object.defineProperty,Du=Bt((e,t)=>xb(e,"name",{value:t,configurable:!0}),"o");const Lu=Du((e,t)=>{if(!mn.has(e[t]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const n=!0,o=e.slice(t+1,t+1+Zo.length).join("")===Zo;return{isInsideEscape:n,isInsideLinkEscape:o}},"checkEscapeSequence"),kb=Du((e,t={})=>{const n=new Bu;let o="",r=!1,i="",s="",a=!1;const l=[...e];for(let p=0;p<l.length;p++){const c=l[p];if(c&&mn.has(c)){if(o){const h=t.getWidth?.(o)??0,v={isEscapeSequence:!1,isGrapheme:!0,text:o,width:h};if(a&&(v.isHyperlink=!0,v.hyperlinkUrl=s),t.onSegment?.(v,n)===!1)return;o=""}r=!0,i=c;const f=Lu(l,p),{isInsideLinkEscape:m}=f;if(m){let h=p+1;for(s="";h<l.length;){const y=l[h];if(y===Rr)break;s+=y,h+=1}s=s.slice(4);const v={hyperlinkUrl:s,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(t.onSegment?.(v,n)===!1)return;p=h,a=!0,r=!1,i="";continue}if(p+1<l.length&&l[p+1]==="\\"&&a){const h={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(t.onSegment?.(h,n)===!1)return;a=!1,s="",p+=1,r=!1,i="";continue}}if(r){if(i!==c&&(i+=c),c===ia){r=!1,n.processEscape(i);const f={isEscapeSequence:!0,isGrapheme:!1,text:i,width:0};if(t.onSegment?.(f,n)===!1)return;i=""}continue}o+=c;const u=t.getWidth?.(o)??0,d={isEscapeSequence:!1,isGrapheme:!0,text:o,width:u};if(a&&(d.isHyperlink=!0,d.hyperlinkUrl=s),t.onSegment?.(d,n)===!1)return;o=""}if(o){const p=t.getWidth?.(o)??0,c={isEscapeSequence:!1,isGrapheme:!0,text:o,width:p};a&&(c.isHyperlink=!0,c.hyperlinkUrl=s),t.onSegment?.(c,n)}if(i){const p={isEscapeSequence:!0,isGrapheme:!1,text:i,width:0};t.onSegment?.(p,n)}},"processAnsiString");var Eb=Object.defineProperty,Sb=Bt((e,t)=>Eb(e,"name",{value:t,configurable:!0}),"t$1");const ul=Sb(e=>`${mn.values().next().value}${Iu}${String(e)}${ia}`,"wrapAnsiCode");var jb=Object.defineProperty,Ab=Bt((e,t)=>jb(e,"name",{value:t,configurable:!0}),"s");const dl=Ab(e=>`${mn.values().next().value}${Zo}${e}${Rr}`,"wrapAnsiHyperlink");var Ob=Object.defineProperty,Rb=Bt((e,t)=>Ob(e,"name",{value:t,configurable:!0}),"l");const Cb=Rb(e=>{if(e.length===0)return"";if(e.length===1)return e[0];let t="",n,o;const r=e.join(`
|
|
31
|
+
`),i=[...r];let s=0;for(const[a,l]of i.entries()){if(t+=l,mn.has(l)){const c=nb.exec(r.slice(s))?.groups??{};if(c.code!==void 0){const u=Number.parseFloat(c.code);n=u===eb?void 0:u}else c.uri!==void 0&&(o=c.uri.length===0?void 0:c.uri)}const p=ob.get(Number(n));i[a+1]===`
|
|
32
|
+
`?(o&&(t+=dl("")),n&&p&&(t+=ul(p))):l===`
|
|
33
|
+
`&&(n&&p&&(t+=ul(n)),o&&(t+=dl(o))),s+=l.length}return t},"preserveAnsi");var Tb=Object.defineProperty,ht=Bt((e,t)=>Tb(e,"name",{value:t,configurable:!0}),"f");const Fu=/(?=\s)|(?<=\s)/,qu=/^\s+$/,Zr=ht(e=>{if(!e.includes("\x1B"))return e;let t=e;return e.includes("\x1B[30m")&&(t+="\x1B[39m"),e.includes("\x1B[42m")&&(t+="\x1B[49m"),t},"resetAnsiAtLineBreak"),Ct=ht(e=>{const t=e.split(" ");let n=t.length;for(;n>0&&Pe(t[n-1])===0;)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},"stringVisibleTrimSpacesRight"),zu=ht((e,t,n)=>{if(e.length===0)return[""];if(t<=0)return[e];const o=[],r=new Bu;let i="",s=0,a=!1,l=!1,p="",c=0;for(;c<e.length;){const u=e[c];if(mn.has(u)){a=!0,p=u,i+=u,l=Lu([...e],c).isInsideLinkEscape,c+=1;continue}if(a){p+=u,i+=u,l?u===Rr&&(a=l=!1):u===ia&&(a=!1,r.processEscape(p)),c+=1;continue}const d=Pe(u),f=u===" ";if(d===0){i+=u,c+=1;continue}if(s+d>t&&(i&&o.push(i+r.getEndEscapesForAllActiveAttributes()),i=r.getStartEscapesForAllActiveAttributes(),s=Pe(i),f&&n)){for(;c<e.length&&e[c]===" ";)c+=1;continue}if(i+=u,s+=d,s===t&&c<e.length-1&&(o.push(i+r.getEndEscapesForAllActiveAttributes()),i=r.getStartEscapesForAllActiveAttributes(),s=Pe(i),c+1<e.length&&e[c+1]===" "&&n)){for(c+=1;c<e.length&&e[c]===" ";)c+=1;continue}c+=1}return i&&o.push(i+r.getEndEscapesForAllActiveAttributes()),n?o.map(u=>Ct(u)):o},"wrapWithBreakAtWidth"),_b=ht((e,t,n)=>{if(e.length===0)return[];const o=n?e.trim():e;if(o.length===0)return[];const r=[];let i="",s=0;return kb(o,{getWidth:Pe,onSegment:ht((a,l)=>{const p=a.text??"";if(a.isEscapeSequence)i+=p;else{const c=p===" ";if(a.width===0)return i+=p,!0;if(s+a.width>t&&(i&&r.push(i),i=l.getStartEscapesForAllActiveAttributes(),s=0,c))return n||r.push(l.getStartEscapesForAllActiveAttributes()+p),!0;i+=p,s+=a.width}return!0},"onSegment")}),i&&r.push(i),n?r.map(a=>Ct(a)):r},"wrapCharByChar"),Nb=ht((e,t,n)=>{if(e.length===0)return[];const o=n?e.trim():e;if(o.length===0)return[];const r=o.split(Fu),i=[];let s="",a=0,l=0;for(;l<r.length;){const p=r[l],c=qu.test(p),u=Pe(p);if(p.length===0){l+=1;continue}if(n&&c&&a===0){l+=1;continue}if(a+u>t&&a>0){n?i.push(Ct(s)):i.push(s),s="",a=0;continue}s+=p,a+=u,l+=1}return s&&(n?i.push(Ct(s)):i.push(s)),i},"wrapWithWordBoundaries"),Pb=ht((e,t,n)=>{if(e.length===0)return[];const o=n?e.trim():e;if(o.length===0)return[];const r=o.split(Fu),i=[];let s="",a=0,l=0;for(;l<r.length;){const p=r[l],c=qu.test(p),u=Pe(p);if(p.length===0){l+=1;continue}if(n&&c&&a===0){l+=1;continue}if(u>t){s&&i.push(Zr(n?Ct(s):s));const d=zu(p,t,n);if(d.length>0){for(let f=0;f<d.length-1;f+=1)i.push(d[f]);s=d.at(-1),a=Pe(s)}else s="",a=0;l+=1;continue}if(a+u>t&&a>0&&(i.push(Zr(n?Ct(s):s)),s="",a=0,n&&c)){l+=1;continue}s+=p,a+=u,l+=1}return s&&i.push(Zr(n?Ct(s):s)),i},"wrapAndBreakWords"),Bn={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Mb=ht((e,t={})=>{const{removeZeroWidthCharacters:n=!0,trim:o=!0,width:r=80,wrapMode:i=Bn.PRESERVE_WORDS}=t;if(o&&e.trim()==="")return"";let s=e.normalize("NFC").replaceAll(`\r
|
|
34
|
+
`,`
|
|
35
|
+
`);return n&&(s=s.replaceAll(tb,"")),s.split(`
|
|
36
|
+
`).map(a=>{if(o&&a.trim()==="")return"";let l;switch(i){case Bn.BREAK_AT_CHARACTERS:{l=_b(a,r,o);break}case Bn.BREAK_WORDS:{l=Pb(a,r,o);break}case Bn.STRICT_WIDTH:{l=zu(a,r,o);break}default:l=Nb(a,r,o)}return Cb(l)}).join(`
|
|
37
|
+
`)},"wordWrap");var Ib=Object.defineProperty,bt=oe((e,t)=>Ib(e,"name",{value:t,configurable:!0}),"n$2");const Hu=80,Ju=24,Ss=bt((e,t,{shell:n,env:o}={})=>Qh(e,t,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:n,env:o}).trim(),"exec"),qo=bt((e,t)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(t,10)}),"create"),Gu=bt((e,t)=>{const{columns:n,rows:o}=qo(e,t);if(!(Number.isNaN(n)||Number.isNaN(o))&&!(n===Hu&&o===Ju))return{columns:n,rows:o}},"createIfNotDefault"),Wb=bt(()=>{if(Rt.platform!=="linux")return!0;try{const e=Wn.readFileSync("/proc/self/stat","utf8"),t=e.lastIndexOf(") ");if(t===-1)return!1;const n=e.slice(t+2).trim().split(/\s+/),o=Number.parseInt(n[2],10),r=Number.parseInt(n[5],10);return Number.isNaN(o)||Number.isNaN(r)||r<=0?!1:o===r}catch{return!1}},"isForegroundProcess");function sa(){const{env:e,stdout:t,stderr:n}=Rt;if(t?.columns&&t?.rows)return qo(t.columns,t.rows);if(n?.columns&&n?.rows)return qo(n.columns,n.rows);if(e.COLUMNS&&e.LINES)return qo(e.COLUMNS,e.LINES);const o={columns:Hu,rows:Ju};return Rt.platform==="win32"?Qr()??o:Rt.platform==="darwin"?fl()??Qr()??o:fl()??Qr()??Bb()??o}oe(sa,"O");bt(sa,"terminalSize");const fl=bt(()=>{try{const e=Rt.platform==="darwin"?Wn.constants.O_EVTONLY|Wn.constants.O_NONBLOCK:Wn.constants.O_NONBLOCK,{columns:t,rows:n}=eg.WriteStream(Wn.openSync("/dev/tty",e));return{columns:t,rows:n}}catch{}},"devTty"),Qr=bt(()=>{try{const e=Ss("tput",["cols"],{env:{TERM:"dumb",...Rt.env}}),t=Ss("tput",["lines"],{env:{TERM:"dumb",...Rt.env}});if(e&&t)return Gu(e,t)}catch{}},"tput"),Bb=bt(()=>{try{if(!Wb())return;const e=Ss("resize",["-u"]).match(/\d+/g);if(e.length===2)return Gu(e[0],e[1])}catch{}},"resize");var Db=Object.defineProperty,Lb=oe((e,t)=>Db(e,"name",{value:t,configurable:!0}),"r$2");const Fb=Lb(e=>{const t=Object.keys(e).map(n=>e[n].badge??"");return t.length===0?"":t.reduce((n,o)=>n.length>o.length?n:o,"")},"getLongestBadge");var qb=Object.defineProperty,zb=oe((e,t)=>qb(e,"name",{value:t,configurable:!0}),"r$1");const{bold:Hb,cyan:Jb,green:ml,grey:Gb,magenta:Ub,red:Vb,yellow:ei}=fr,Kb={indent:2,quoteStyle:"single",stylize:zb((e,t)=>{const n={bigint:ei,boolean:ei,date:Ub,null:Hb,number:ei,regexp:Vb,special:Jb,string:ml,symbol:ml,undefined:Gb};return Object.hasOwn(n,t)?n[t](e):e},"stylize")};var Yb=Object.defineProperty,Xb=oe((e,t)=>Yb(e,"name",{value:t,configurable:!0}),"o$1");const{bold:Zb,underline:Qb}=fr,e$=Xb((e,t)=>{let n=t.uppercase.label?e.toUpperCase():e;return n=t.underline.label?Qb(n):n,t.bold.label&&(n=Zb(n)),n},"formatLabel");var t$=Object.defineProperty,Uu=oe((e,t)=>t$(e,"name",{value:t,configurable:!0}),"o");const n$=Uu(e=>[e.getHours(),e.getMinutes(),e.getSeconds()].map(t=>String(t).padStart(2,"0")).join(":"),"dateFormatter");class o${static{oe(this,"AbstractPrettyReporter")}static{Uu(this,"AbstractPrettyReporter")}styles;loggerTypes;constructor(t){this.styles={bold:{label:!1},dateFormatter:n$,underline:{label:!1,message:!1,prefix:!1,suffix:!1},uppercase:{label:!1},...t},this.loggerTypes=tg}setLoggerTypes(t){this.loggerTypes=t}}var r$=Object.defineProperty,Vu=(e,t)=>r$(e,"name",{value:t,configurable:!0});We(import.meta.url);const i$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:s$,stderr:a$}=i$;var l$=Object.defineProperty,Ku=Vu((e,t)=>l$(e,"name",{value:t,configurable:!0}),"b");const{bgGrey:c$,bold:hl,cyan:p$,green:u$,greenBright:d$,grey:xt,red:ti,underline:gl,white:f$}=fr,m$=/[\\/]pail[\\/]dist/,ni=Ku(e=>!m$.test(e),"pailFileFilter");let RO=class extends o${static{Vu(this,"SimpleReporter")}static{Ku(this,"SimpleReporter")}#e;#r;#t;#i=!1;#n;#o;constructor(t={}){const{error:n,inspect:o,...r}=t;super({uppercase:{label:!0,...r.uppercase},...r}),this.#n={...Kb,indent:void 0,...o},this.#o={...n,color:{fileLine:u$,hint:p$,marker:ti,message:ti,method:d$,title:ti}},this.#e=s$,this.#r=a$}setStdout(t){this.#e=t}setStderr(t){this.#r=t}setInteractiveManager(t){this.#t=t}setIsInteractive(t){this.#i=t}log(t){const n=this.formatMessage(t),o=t.type.level,r=["error","trace","warn"].includes(o)?"stderr":"stdout",i=r==="stderr"?this.#r:this.#e;this.#i&&this.#t!==void 0&&i.isTTY?this.#t.update(r,n.split(`
|
|
38
|
+
`),0):Ev(`${n}
|
|
39
|
+
`,i)}formatMessage(t){const{columns:n}=sa();let o=n;typeof this.styles.messageLength=="number"&&(o=this.styles.messageLength);const{badge:r,context:i,date:s,error:a,file:l,groups:p,label:c,message:u,prefix:d,repeated:f,scope:m,suffix:h,traceError:v,type:y}=t,{color:g}=this.loggerTypes[y.name],$=g?fr[g]:f$,b=p.map(()=>" ").join(""),w=[];if(p.length>0&&w.push(`${b+xt(`[${p.at(-1)??""}]`)} `),s&&w.push(`${xt(this.styles.dateFormatter(typeof s=="string"?new Date(s):s))} `),r)w.push(hl($(r)));else{const j=Fb(this.loggerTypes);j.length>0&&w.push(xt(" ".repeat(j.length)))}const E=ig(this.loggerTypes),x=Pe(E);if(c){const j=Pe(c),S=Math.max(0,x-j);w.push(`${hl($(e$(c,this.styles)))} `," ".repeat(S))}else w.push(" ".repeat(x+1));f&&w.push(`${c$.white(`[${String(f)}x]`)} `),Array.isArray(m)&&m.length>0&&w.push(`${xt(`[${m.join(" > ")}]`)} `),d&&w.push(`${xt(`[${this.styles.underline.prefix?gl(d):d}]`)} `);const k=Pe(w.join(""));if(u!==ng){const j=typeof u=="string"?u:rl(u,this.#n);w.push(b+Mb(j,{trim:!1,width:o-3,wrapMode:Bn.STRICT_WIDTH}))}if(i){let j=!1;w.push(...i.map(S=>{if(S instanceof Error)return j=!0,`
|
|
40
|
+
|
|
41
|
+
${Xr(S,{...this.#o,filterStacktrace:ni,prefix:b})}`;if(typeof S=="object")return` ${rl(S,this.#n)}`;const R=(j?`
|
|
42
|
+
|
|
43
|
+
`:" ")+String(S);return j=!1,R}))}if(a&&w.push(Xr(a,{...this.#o,filterStacktrace:ni,prefix:b})),v&&w.push(`
|
|
44
|
+
|
|
45
|
+
${Xr(v,{...this.#o,filterStacktrace:ni,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:b})}`),h&&w.push(` ${b}${xt(this.styles.underline.suffix?gl(h):h)}`),l){const j=(l.name??"")+(l.line?`:${String(l.line)}`:""),S=Math.max(0,k-Pe("Caller: "));w.push(`
|
|
46
|
+
`,xt("Caller: ")," ".repeat(S),j,`
|
|
47
|
+
`)}return w.join("")}};var TO="@visulima/packem",Yu="2.0.0-alpha.84";const _O={version:Yu};var h$=Object.defineProperty,Xu=(e,t)=>h$(e,"name",{value:t,configurable:!0}),g$=Object.defineProperty,v$=Xu((e,t)=>g$(e,"name",{value:t,configurable:!0}),"o");let NO=class extends Error{static{Xu(this,"n")}static{v$(this,"DirectoryError")}constructor(t){super(`EISDIR: Illegal operation on a directory, ${t}`)}get code(){return"EISDIR"}set code(t){throw new Error("Cannot overwrite code EISDIR")}get name(){return"DirectoryError"}set name(t){throw new Error("Cannot overwrite name of DirectoryError")}};var y$=Object.defineProperty,Zu=(e,t)=>y$(e,"name",{value:t,configurable:!0}),b$=Object.defineProperty,$$=Zu((e,t)=>b$(e,"name",{value:t,configurable:!0}),"t");let MO=class extends Error{static{Zu(this,"n")}static{$$(this,"NotEmptyError")}constructor(t){super(`ENOTEMPTY: Directory not empty, ${t}`)}get code(){return"ENOTEMPTY"}set code(t){throw new Error("Cannot overwrite code ENOTEMPTY")}get name(){return"NotEmptyError"}set name(t){throw new Error("Cannot overwrite name of NotEmptyError")}};var w$=Object.defineProperty,Qu=(e,t)=>w$(e,"name",{value:t,configurable:!0}),x$=Object.defineProperty,k$=Qu((e,t)=>x$(e,"name",{value:t,configurable:!0}),"o");let It=class extends Error{static{Qu(this,"n")}static{k$(this,"NotFoundError")}constructor(t){super(`ENOENT: ${t}`)}get code(){return"ENOENT"}set code(t){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(t){throw new Error("Cannot overwrite name of NotFoundError")}};var E$=Object.defineProperty,S$=(e,t)=>E$(e,"name",{value:t,configurable:!0}),j$=Object.defineProperty,A$=S$((e,t)=>j$(e,"name",{value:t,configurable:!0}),"n");A$((e,{whitespace:t=!0}={})=>e.replace(gm,n=>n.startsWith('"')||n[1]==="*"&&!n.endsWith("*/")?n:t?n.replaceAll(/\S/g," "):""),"stripJsonComments");var O$=Object.defineProperty,ed=(e,t)=>O$(e,"name",{value:t,configurable:!0}),R$=Object.defineProperty,C$=ed((e,t)=>R$(e,"name",{value:t,configurable:!0}),"r");async function Tr(e,t,n){const{buffer:o,compression:r,encoding:i="utf8",flag:s,...a}=n??{},l=await Cp(e,{buffer:o,compression:r,encoding:i,flag:s});return typeof t=="function"?Vo(l,t,a):Vo(l,a)}ed(Tr,"l");C$(Tr,"readYaml");var T$=Object.defineProperty,td=(e,t)=>T$(e,"name",{value:t,configurable:!0}),_$=Object.defineProperty,N$=td((e,t)=>_$(e,"name",{value:t,configurable:!0}),"t");function _r(e,t,n){const{buffer:o,compression:r,encoding:i="utf8",flag:s,...a}=n??{},l=Fs(e,{buffer:o,compression:r,encoding:i,flag:s});return typeof t=="function"?Vo(l,t,a):Vo(l,a)}td(_r,"l");N$(_r,"readYamlSync");var P$=Object.defineProperty,nd=(e,t)=>P$(e,"name",{value:t,configurable:!0}),M$=Object.defineProperty,I$=nd((e,t)=>M$(e,"name",{value:t,configurable:!0}),"a");async function od(e,t,n,o){let r,i,s;typeof n=="object"&&n!==null&&!Array.isArray(n)&&typeof n!="function"?(r=n,i=r.replacer,s=r.space):typeof o=="object"?(r=o,i=n,s=r.space):(i=n,s=o);const a=Dp(t,i,s??r);await vm(e,a,r)}nd(od,"c");I$(od,"writeYaml");var W$=Object.defineProperty,rd=(e,t)=>W$(e,"name",{value:t,configurable:!0}),B$=Object.defineProperty,D$=rd((e,t)=>B$(e,"name",{value:t,configurable:!0}),"a");function id(e,t,n,o){let r,i,s;typeof n=="object"&&n!==null&&!Array.isArray(n)&&typeof n!="function"?(r=n,i=r.replacer,s=r.space):typeof o=="object"?(r=o,i=n,s=r.space):(i=n,s=o);const a=Dp(t,i,s??r);mr(e,a,r)}rd(id,"c");D$(id,"writeYamlSync");var L$=Object.defineProperty,F$=(e,t)=>L$(e,"name",{value:t,configurable:!0}),q$=Object.defineProperty,hn=F$((e,t)=>q$(e,"name",{value:t,configurable:!0}),"c");const sd=hn((e,t,n)=>{const o=Z(e),r=Z(t),i=r===o?".":Ae(o,r);return n.some(s=>{const a=s.startsWith("./")?s.slice(2):s,l=i.startsWith("./")?i.slice(2):i;if(a==="."&&l===".")return!0;if(a.endsWith("/**")){const p=a.slice(0,-3);return l===p||l.startsWith(`${p}/`)}if(a.endsWith("/*")){const p=a.slice(0,-2);return p===""?l!=="."&&!l.includes("/"):l.startsWith(`${p}/`)||l===p}return l===a||l.startsWith(`${a}/`)})},"isPackageInWorkspace"),ad=hn(async e=>{const t=await ft("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const n=await Tr(t),o=Array.isArray(n.packages)?n.packages:[];if(!sd(t,e,o))return;const r={};return n.catalog&&typeof n.catalog=="object"&&(r.catalog=n.catalog),n.catalogs&&typeof n.catalogs=="object"&&(r.catalogs=n.catalogs),Object.keys(r).length>0?r:void 0},"readPnpmCatalogs"),ld=hn(e=>{const t=mt("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const n=_r(t),o=Array.isArray(n.packages)?n.packages:[];if(!sd(t,e,o))return;const r={};return n.catalog&&typeof n.catalog=="object"&&(r.catalog=n.catalog),n.catalogs&&typeof n.catalogs=="object"&&(r.catalogs=n.catalogs),Object.keys(r).length>0?r:void 0},"readPnpmCatalogsSync"),z$=hn((e,t,n)=>{if(t==="catalog:")return n.catalog?.[e];if(t.startsWith("catalog:")){const o=t.slice(8);return n.catalogs?.[o]?.[e]}},"resolveCatalogReference"),H$=hn((e,t)=>{for(const[n,o]of Object.entries(e)){if(typeof o!="string")continue;const r=z$(n,o,t);r&&(e[n]=r)}},"resolveDependenciesCatalogReferences"),Nr=hn((e,t)=>{const n=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const o of n){if(!e[o]||typeof e[o]!="object")continue;const r=e[o];H$(r,t)}},"resolveCatalogReferences");var J$=Object.defineProperty,ge=(e,t)=>J$(e,"name",{value:t,configurable:!0});const G$=We(import.meta.url),xn=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,aa=ge(e=>{if(typeof xn<"u"&&xn.versions&&xn.versions.node){const[t,n]=xn.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return xn.getBuiltinModule(e)}return G$(e)},"__cjs_getBuiltinModule"),{existsSync:cd}=aa("node:fs"),{createInterface:U$}=aa("node:readline"),{styleText:_e}=aa("node:util");var V$=Object.defineProperty,be=ge((e,t)=>V$(e,"name",{value:t,configurable:!0}),"f");const Xe=be(e=>{const t=typeof e;return e!==null&&(t==="object"||t==="function")},"isObject"),K$=be(e=>{if(!Xe(e))return!1;for(const t in e)if(Object.hasOwn(e,t))return!1;return!0},"isEmptyObject"),pd=new Set(["__proto__","prototype","constructor"]),ud=1e6,Y$=be(e=>e>="0"&&e<="9","isDigit");function gn(e){if(e==="0")return!0;if(/^[1-9]\d*$/.test(e)){const t=Number.parseInt(e,10);return t<=Number.MAX_SAFE_INTEGER&&t<=ud}return!1}ge(gn,"p$1");be(gn,"shouldCoerceToNumber");function Gn(e,t){return pd.has(e)?!1:(e&&gn(e)?t.push(Number.parseInt(e,10)):t.push(e),!0)}ge(Gn,"y");be(Gn,"processSegment");function la(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);const t=[];let n="",o="start",r=!1,i=0;for(const s of e){if(i++,r){n+=s,r=!1;continue}if(s==="\\"){if(o==="index")throw new Error(`Invalid character '${s}' in an index at position ${i}`);if(o==="indexEnd")throw new Error(`Invalid character '${s}' after an index at position ${i}`);r=!0,o=o==="start"?"property":o;continue}switch(s){case".":{if(o==="index")throw new Error(`Invalid character '${s}' in an index at position ${i}`);if(o==="indexEnd"){o="property";break}if(!Gn(n,t))return[];n="",o="property";break}case"[":{if(o==="index")throw new Error(`Invalid character '${s}' in an index at position ${i}`);if(o==="indexEnd"){o="index";break}if(o==="property"||o==="start"){if((n||o==="property")&&!Gn(n,t))return[];n=""}o="index";break}case"]":{if(o==="index"){if(n==="")n=(t.pop()||"")+"[]",o="property";else{const a=Number.parseInt(n,10);!Number.isNaN(a)&&Number.isFinite(a)&&a>=0&&a<=Number.MAX_SAFE_INTEGER&&a<=ud&&n===String(a)?t.push(a):t.push(n),n="",o="indexEnd"}break}if(o==="indexEnd")throw new Error(`Invalid character '${s}' after an index at position ${i}`);n+=s;break}default:{if(o==="index"&&!Y$(s))throw new Error(`Invalid character '${s}' in an index at position ${i}`);if(o==="indexEnd")throw new Error(`Invalid character '${s}' after an index at position ${i}`);o==="start"&&(o="property"),n+=s}}}switch(r&&(n+="\\"),o){case"property":{if(!Gn(n,t))return[];break}case"index":throw new Error("Index was not closed");case"start":{t.push("");break}}return t}ge(la,"parsePath");be(la,"parsePath");function vn(e){if(typeof e=="string")return la(e);if(Array.isArray(e)){const t=[];for(const[n,o]of e.entries()){if(typeof o!="string"&&typeof o!="number")throw new TypeError(`Expected a string or number for path segment at index ${n}, got ${typeof o}`);if(typeof o=="number"&&!Number.isFinite(o))throw new TypeError(`Path segment at index ${n} must be a finite number, got ${o}`);if(pd.has(o))return[];typeof o=="string"&&gn(o)?t.push(Number.parseInt(o,10)):t.push(o)}return t}return[]}ge(vn,"d");be(vn,"normalizePath");function ot(e,t,n){if(!Xe(e)||typeof t!="string"&&!Array.isArray(t))return n===void 0?e:n;const o=vn(t);if(o.length===0)return n;for(let r=0;r<o.length;r++){const i=o[r];if(e=e[i],e==null){if(r!==o.length-1)return n;break}}return e===void 0?n:e}ge(ot,"getProperty");be(ot,"getProperty");function ca(e,t,n){if(!Xe(e)||typeof t!="string"&&!Array.isArray(t))return e;const o=e,r=vn(t);if(r.length===0)return e;for(let i=0;i<r.length;i++){const s=r[i];if(i===r.length-1)e[s]=n;else if(!Xe(e[s])){const a=typeof r[i+1]=="number";e[s]=a?[]:{}}e=e[s]}return o}ge(ca,"setProperty");be(ca,"setProperty");function dd(e,t){if(!Xe(e)||typeof t!="string"&&!Array.isArray(t))return!1;const n=vn(t);if(n.length===0)return!1;for(let o=0;o<n.length;o++){const r=n[o];if(o===n.length-1)return Object.hasOwn(e,r)?(delete e[r],!0):!1;if(e=e[r],!Xe(e))return!1}}ge(dd,"deleteProperty");be(dd,"deleteProperty");function Tt(e,t){if(!Xe(e)||typeof t!="string"&&!Array.isArray(t))return!1;const n=vn(t);if(n.length===0)return!1;for(const o of n){if(!Xe(e)||!(o in e))return!1;e=e[o]}return!0}ge(Tt,"hasProperty");be(Tt,"hasProperty");function Qo(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return e.replaceAll(/[\\.[]/g,String.raw`\$&`)}ge(Qo,"escapePath");be(Qo,"escapePath");function pa(e){const t=Object.entries(e);return Array.isArray(e)?t.map(([n,o])=>[gn(n)?Number.parseInt(n,10):n,o]):t}ge(pa,"m$2");be(pa,"normalizeEntries");function ua(e,t={}){if(!Array.isArray(e))throw new TypeError(`Expected an array, got ${typeof e}`);const{preferDotForIndices:n=!1}=t,o=[];for(const[r,i]of e.entries()){if(typeof i!="string"&&typeof i!="number")throw new TypeError(`Expected a string or number for path segment at index ${r}, got ${typeof i}`);if(typeof i=="number")if(!Number.isInteger(i)||i<0){const s=Qo(String(i));o.push(r===0?s:`.${s}`)}else n&&r>0?o.push(`.${i}`):o.push(`[${i}]`);else if(typeof i=="string")if(i==="")r===0||o.push(".");else if(gn(i)){const s=Number.parseInt(i,10);n&&r>0?o.push(`.${s}`):o.push(`[${s}]`)}else{const s=Qo(i);o.push(r===0?s:`.${s}`)}}return o.join("")}ge(ua,"stringifyPath");be(ua,"stringifyPath");function*Pr(e,t=[],n=new Set){if(!Xe(e)||K$(e)){t.length>0&&(yield ua(t));return}if(!n.has(e)){n.add(e);for(const[o,r]of pa(e))t.push(o),yield*Pr(r,t,n),t.pop();n.delete(e)}}ge(Pr,"x");be(Pr,"deepKeysIterator");function fd(e){return[...Pr(e)]}ge(fd,"deepKeys");be(fd,"deepKeys");function md(e){const t={};if(!Xe(e))return t;for(const[n,o]of Object.entries(e))ca(t,n,o);return t}ge(md,"unflatten");be(md,"unflatten");var X$=Object.defineProperty,oi=ge((e,t)=>X$(e,"name",{value:t,configurable:!0}),"i");const Z$=oi(async e=>{const{default:t=!1,message:n,transformer:o}=e,r=oi(s=>{const a=_e(["cyan","bold"],"?"),l=_e(["bold"],s),p=t?`${_e(["greenBright"],"Y")}${_e(["gray"],"/n")}`:`y/${_e(["yellowBright"],"N")}`;return`${a} ${l} ${_e(["gray"],`(${p})`)}`},"formatMessage"),i=oi(s=>o?o(s):s?_e(["greenBright"],"Yes"):_e(["yellowBright"],"No"),"formatAnswer");return new Promise(s=>{const a=U$({input:process.stdin,output:process.stdout}),l=r(n);a.question(l,p=>{a.close();const c=p.trim().toLowerCase();if(c===""){s(t);return}if(c==="y"||c==="yes"){console.log(`${_e(["greenBright"],"✓")} ${i(!0)}`),s(!0);return}if(c==="n"||c==="no"){console.log(`${_e(["yellowBright"],"✗")} ${i(!1)}`),s(!1);return}console.log(`${_e(["gray"],"→")} ${i(t)}`),s(t)}),a.on("SIGINT",()=>{a.close(),console.log(`
|
|
48
|
+
${_e(["gray"],"→")} ${i(t)}`),s(t)})})},"confirm"),Q$=typeof process.stdout<"u"&&!process.versions.deno&&!globalThis.window;var ew=Object.defineProperty,ye=ge((e,t)=>ew(e,"name",{value:t,configurable:!0}),"l");const hd=/, ([^,]*)$/,er=new Map,gd=new Map;let tw=class extends Error{static{ge(this,"M")}static{ye(this,"PackageJsonValidationError")}constructor(t){super(`The following warnings were encountered while normalizing package data:
|
|
49
|
+
- ${t.join(`
|
|
50
|
+
- `)}`),this.name="PackageJsonValidationError"}};const Mr=ye((e,t,n=[])=>{const o=[];if(Om(e,r=>{o.push(r)},t),t&&o.length>0){const r=o.filter(i=>!n.some(s=>s instanceof RegExp?s.test(i):s===i));if(r.length>0)throw new tw(r)}return e},"normalizeInput"),nw=ye(async e=>await Tr(e),"parseYamlFile"),ow=ye(e=>_r(e),"parseYamlFileSync"),rw=ye(async e=>{const t=await Cp(e);return Lp.parse(t)},"parseJson5File"),iw=ye(e=>{const t=Fs(e);return Lp.parse(t)},"parseJson5FileSync"),vd=ye(async(e,t)=>t?.yaml!==!1&&(e.endsWith(".yaml")||e.endsWith(".yml"))?nw(e):t?.json5!==!1&&e.endsWith(".json5")?rw(e):hr(e),"parsePackageFile"),yd=ye((e,t)=>t?.yaml!==!1&&(e.endsWith(".yaml")||e.endsWith(".yml"))?ow(e):t?.json5!==!1&&e.endsWith(".json5")?iw(e):qs(e),"parsePackageFileSync");ye(async(e,t={})=>{const n={type:"file"};e&&(n.cwd=e);const o=["package.json"];t.yaml!==!1&&o.push("package.yaml","package.yml"),t.json5!==!1&&o.push("package.json5");let r;for(const l of o)if(r=await ft(l,n),r)break;if(!r)throw new It(`No such file or directory, for ${o.join(", ").replace(hd," or $1")} found.`);const i=t.cache&&typeof t.cache!="boolean"?t.cache:gd;if(t.cache&&i.has(r))return i.get(r);const s=await vd(r,t);if(t.resolveCatalogs){const l=await ad(r);l&&Nr(s,l)}Mr(s,t.strict??!1,t.ignoreWarnings);const a={packageJson:s,path:r};return t.cache&&i.set(r,a),a},"findPackageJson");ye((e,t={})=>{const n={type:"file"};e&&(n.cwd=e);const o=["package.json"];t.yaml!==!1&&o.push("package.yaml","package.yml"),t.json5!==!1&&o.push("package.json5");let r;for(const l of o)if(r=mt(l,n),r)break;if(!r)throw new It(`No such file or directory, for ${o.join(", ").replace(hd," or $1")} found.`);const i=t.cache&&typeof t.cache!="boolean"?t.cache:gd;if(t.cache&&i.has(r))return i.get(r);const s=yd(r,t);if(t.resolveCatalogs){const l=ld(r);l&&Nr(s,l)}Mr(s,t.strict??!1,t.ignoreWarnings);const a={packageJson:s,path:r};return t.cache&&i.set(r,a),a},"findPackageJsonSync");ye(async(e,t={})=>{const{cwd:n,...o}=t,r=Vn(n??process.cwd());await _p(V(r,"package.json"),e,o)},"writePackageJson");ye((e,t={})=>{const{cwd:n,...o}=t,r=Vn(n??process.cwd());ym(V(r,"package.json"),e,o)},"writePackageJsonSync");const da=ye((e,t)=>{const n=typeof e=="object"&&!Array.isArray(e);if(!n&&typeof e!="string")throw new TypeError("`packageFile` should be either an `object` or a `string`.");let o,r=!1,i;if(n)o=structuredClone(e);else if(cd(e)){i=e;const a=t?.cache&&typeof t.cache!="boolean"?t.cache:er;if(t?.cache&&a.has(i))return a.get(i);o=yd(i,t),r=!0}else o=Tp(e);if(t?.resolveCatalogs)if(r){const a=ld(e);a&&Nr(o,a)}else throw new Error("The 'resolveCatalogs' option can only be used on a file path.");Mr(o,t?.strict??!1,t?.ignoreWarnings);const s=o;return r&&t?.cache&&(typeof t.cache=="boolean"?er:t.cache).set(i,s),s},"parsePackageJsonSync"),DO=ye(async(e,t)=>{const n=typeof e=="object"&&!Array.isArray(e);if(!n&&typeof e!="string")throw new TypeError("`packageFile` should be either an `object` or a `string`.");let o,r=!1,i;if(n)o=structuredClone(e);else if(cd(e)){i=e;const a=t?.cache&&typeof t.cache!="boolean"?t.cache:er;if(t?.cache&&a.has(i))return a.get(i);o=await vd(i,t),r=!0}else o=Tp(e);if(t?.resolveCatalogs)if(r){const a=await ad(e);a&&Nr(o,a)}else throw new Error("The 'resolveCatalogs' option can only be used on a file path.");Mr(o,t?.strict??!1,t?.ignoreWarnings);const s=o;return r&&t?.cache&&(typeof t.cache=="boolean"?er:t.cache).set(i,s),s},"parsePackageJson");ye((e,t,n)=>ot(e,t,n),"getPackageJsonProperty");ye((e,t)=>Tt(e,t),"hasPackageJsonProperty");const bd=ye((e,t,n)=>{const o=ot(e,"dependencies",{}),r=ot(e,"devDependencies",{}),i=ot(e,"peerDependencies",{}),s={...o,...r,...n?.peerDeps===!1?{}:i};for(const a of t)if(Tt(s,a))return!0;return!1},"hasPackageJsonAnyDependency"),sw=ye(async(e,t,n="dependencies",o={})=>{const r=ot(e,"dependencies",{}),i=ot(e,"devDependencies",{}),s=ot(e,"peerDependencies",{}),a=[],l={deps:!0,devDeps:!0,peerDeps:!1,...o};for(const p of t)l.deps&&Tt(r,p)||l.devDeps&&Tt(i,p)||l.peerDeps&&Tt(s,p)||a.push(p);if(a.length!==0){if(process.env.CI||Q$&&!process.stdout.isTTY){const p=`Skipping package installation for [${t.join(", ")}] because the process is not interactive.`;if(o.throwOnWarn)throw new Error(p);o.logger?.warn?o.logger.warn(p):console.warn(p);return}if(typeof l.confirm?.message=="function"&&(l.confirm.message=l.confirm.message(a)),l.confirm?.message===void 0){const p=`${a.length===1?"Package is":"Packages are"} required for this config: ${a.join(", ")}. Do you want to install them?`;l.confirm===void 0?l.confirm={message:p}:l.confirm.message=p}await Z$(l.confirm)&&await Bp(a,{...l.installPackage,cwd:l.cwd?Vn(l.cwd):void 0,dev:n==="devDependencies"})}},"ensurePackages"),fa=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"],aw=/\.(?:js|mjs|cjs|ts|cts|mts)$/,LO=async(e,t="")=>{let n=t;if(!n){for(const o of fa)if(await pn(V(e,o))){n=`./${o}`;break}}if(!aw.test(n))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return n},FO=async e=>{for(const t of fa)if(await pn(V(e,t)))return!0;return!1},lw={esbuild:"esbuild",oxc:"oxc-transform",sucrase:"sucrase",swc:"@swc/core"},vl=async(e,t)=>{const n=Array.isArray(e)?e:[e],o=await Am(t).catch(()=>{});let r;return o==="yarn"||o==="bun"?r=`${o} add -D`:o==="pnpm"?r="pnpm add -D":r="npm install -D",`${r} ${n.join(" ")}`},tr=e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},js=(e,t,n,o)=>{if(e==="module-sync")return"esm";if(o){const s=tr(o);if(s)return s}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return n;const[r,...i]=t;return js(r,i,n,o)},cw=new Set(["browser","bun","default","deno","electron","import","module-sync","node","node-addons","require","types","workerd",...Kp,...Yp]),ma=(e,t,n,o,r)=>{if(!e)return[];if(typeof e=="string"){const i=tr(e);if(i&&i!==t)throw new Error(`Exported file "${e}" has an extension that does not match the package.json type "${t==="esm"?"module":"commonjs"}".`);return[{file:e,key:"exports",type:i??t}]}if(typeof e=="object"){const i=Object.entries(e).filter(([a])=>!a.endsWith(".json"));let s=[];for(const[a,l]of i){const p=a.replace("./",""),c=r.some(u=>p===u||p.startsWith(`${u}/`));if(typeof l=="string"){let u;Number.isInteger(+a)?u={exportKey:"*"}:a.startsWith("./")?u={exportKey:a.replace("./","")}:u={exportKey:a==="."?".":"*",subKey:a},s.push({...u,file:l,key:"exports",type:js(a,o,t,l),...c&&{ignored:!0}})}else if(typeof l=="object"&&l!==null)for(const[u,d]of Object.entries(l)){if(n===!1&&u==="types")continue;const f=Number.isInteger(+a)?u:a;if(typeof d=="string")s.push({exportKey:f.replace("./",""),file:d,key:"exports",...cw.has(u)?{subKey:u}:{},type:js(u,o,t,d),...c&&{ignored:!0}});else{const m=f.replace("./",""),h=c||r.some(y=>m===y||m.startsWith(`${y}/`)),v=ma({[f]:d},t,n,[...o,u],r);h&&v.forEach(y=>{y.ignored=!0}),s=[...s,...v]}}}return s}return[]},As=new Map,an=/\.[^./]+$/,Te=/\.d\.[mc]?ts$/,Os=/\.d\.mts$/,Rs=/\.d\.cts$/,yl=/\.d\.[mc]ts$/,pw=/^\.\/dist\//,Cs=/^dist\//,uw=/^\//,Dn=/^\.\//,dw=/\/$/,bl=/\.\w+$/,$l=/\*.*$/,fw=/\.(?:tsx?|cts|mts)$/,mw=/\.[cm]?tsx?$/,hw=/^(.+?)\.[^.]*$/,gw=/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,Ce=e=>e===void 0||e==="node16",$d=(e,t)=>{const n=Te.exec(e);if(n!==null)return n[0];if(t)for(const o of Object.values(t)){const r=o.startsWith(".")?o:`.${o}`;if(e.endsWith(r))return r}return rn(e)},vw=async e=>{try{return await tu.readdir(e,{withFileTypes:!0})}catch(t){const{code:n}=t;if(n==="ENOENT")return[];throw t}},wd=async(e,t)=>{const n=await vw(e);return(await Promise.all(n.map(async o=>{const r=Ya.join(e,o.name);return o.isDirectory()?wd(r,t):o.isFile()?Ya.relative(t,r):[]}))).flat()},yw=async e=>{let t=As.get(e);return t||(t=wd(e,e),As.set(e,t)),t},wl=(e,t,n)=>{const o=e.replace(an,"");if(t==="*"){const s=o.split("/").filter(Boolean);return s.length===0?void 0:n&&n>1?s:[s[0]]}const r=t.replaceAll(/[.+?^${}()|[\]\\]/g,String.raw`\$&`).replaceAll("*","(.*)"),i=new RegExp(`^${r}$`).exec(o);return i?i.slice(1):void 0},kt=(e,t)=>{let n=e;for(const o of t)n=n.replace("*",o);return n},bw=e=>e.endsWith(".d.mts")?"d.mts":e.endsWith(".d.cts")?"d.cts":"d.ts",$w=(e,t)=>e.key==="exports"&&e.subKey===Hn?Hn:e.key==="exports"&&e.subKey===Ua?Ua:t,ww=e=>{const t=e.replace(pw,"").replace(Cs,"").replace(an,"").split("/"),n=t.at(-1)??"",o=[".browser",".server",".development",".production",".node",".workerd"];for(const i of o)if(n.includes(i)){const s=n.replace(i,""),a=t.length>1?t.slice(0,-1).join("/"):"";return{baseName:a?`${a}/${s}`:s,pattern:i}}const r=n.split(".");if(r.length>2){const i=r.slice(0,-2).join("."),s=`.${r[r.length-2]}`,a=t.length>1?t.slice(0,-1).join("/"):"";return{baseName:a?`${a}/${i}`:i,pattern:s}}},xw=(e,t,n,o)=>{const r=`${t.replace(new RegExp(`^${o}/?`),"")}${n}`,i=r.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),s=new RegExp(String.raw`${i}\.([cm]?[tj]sx?|ts|js)$`),a=e.find(p=>{const c=p.replace(o,"").replace(uw,"");return s.test(c)});if(a)return a;const l=`${o}/${r}`;return e.find(p=>{const c=p.replace(an,"");return c===l||c.endsWith(`/${r}`)})??void 0},lt=(e,t,n,o,r,i,s,a)=>{const l=$w(r,i.environment);let{runtime:p}=i.options;const c=r.subKey==="browser"||typeof r.subKey=="string"&&r.subKey.includes("browser"),u=r.file.includes(".browser");if(c||u)p="browser";else{for(const b of Kp)if(r.file.includes(`.${b}.`)||r.subKey===b){p=b;break}(r.subKey==="node"||r.subKey==="workerd"||r.file.includes(".node")||r.file.includes(".workerd")||r.file.includes(".server"))&&(p="node")}const d=$d(r.file,i.options.outputExtensionMap),f=r.file.replace(d,""),m=i.options.outDir.replace(Dn,""),h=f.replace(new RegExp(`^(./)?${m}/`),""),v=t.replace(an,"").split("/").pop()??"",y=h.split("/").pop()??"",g=!t.includes(h)&&v!==y;let $=e.find(b=>b.input===t&&b.environment===l&&b.runtime===p&&b.fileAlias===(g?h:void 0));if($===void 0?$=e[e.push({environment:l,exportKey:new Set([r.exportKey].filter(Boolean)),fileAlias:g?h:void 0,input:t,runtime:p})-1]:$.exportKey&&r.exportKey&&$.exportKey.add(r.exportKey),s&&($.isGlob=!0),n&&($.outDir=o),r.isExecutable)$.executable=!0,$.declaration=!1,r.type==="cjs"?$.cjs=!0:r.type==="esm"&&($.esm=!0);else{const b=Te.test(r.file),w=a.filter(x=>x.exportKey===r.exportKey),E=w.length>0&&w.every(x=>Te.test(x.file));if(b&&i.options.declaration!==!1){$.declaration=i.options.declaration;const x=bw(r.file);$.declarationExtensions??=new Set,$.declarationExtensions.add(x)}if(b||E){E&&i.options.declaration!==!1&&($.declaration=i.options.declaration);const x=w.some(j=>Os.test(j.file)),k=w.some(j=>Rs.test(j.file));if(x&&k?(Ce(i.options.declaration)&&(i.options.declaration="compatible"),i.options.emitCJS=!0,i.options.emitESM=!0):k?(i.options.emitCJS=!0,Ce(i.options.declaration)&&(i.options.declaration="compatible")):x&&(i.options.emitESM=!0,Ce(i.options.declaration)&&(i.options.declaration="compatible")),E){const j=a.filter(N=>Te.test(N.file)),S=j.some(N=>Os.test(N.file)),R=j.some(N=>Rs.test(N.file));w.every(N=>!N.subKey||N.subKey==="types")?(R&&($.cjs=!0),S&&($.esm=!0)):(R&&($.declarationCjs=!0),S&&($.declarationEsm=!0))}}else r.type==="cjs"?$.cjs=!0:r.type==="esm"&&($.esm=!0)}g&&!$.fileAlias&&($.fileAlias=h)};let ri=!1;const xl=e=>{if(e.pkg.dependencies?.typescript===void 0&&e.pkg.devDependencies?.typescript===void 0)throw new Error("You tried to use a `.ts`, `.cts` or `.mts` file but `typescript` was not found in your package.json.")},kw=async(e,t,n)=>{const o=e.types||e.typings;As.clear(),ri=!1;const r=[];t.sort((f,m)=>f.split("/").length-m.split("/").length);const i=e.type==="module"?"esm":"cjs",s=n.options.declaration??"node16",a=ma(e.exports,i,s,[],n.options.ignoreExportKeys??[]).filter(f=>!f.ignored),l=new Set;for(const f of a){const m=a.filter(h=>h.exportKey===f.exportKey);if(m.length>0&&m.every(h=>Te.test(h.file))&&!l.has(f.exportKey)){l.add(f.exportKey);const h=m.some(y=>y.file.endsWith(".d.mts")),v=m.some(y=>y.file.endsWith(".d.cts"));h&&v?(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitCJS=!0,n.options.emitESM=!0):v?(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitCJS=!0):h&&(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitESM=!0)}}n.options.declaration??="node16";const p=a.some(f=>f.type==="esm"&&!Os.test(f.file)),c=a.some(f=>f.type==="cjs"&&!Rs.test(f.file));p&&c?(n.options.emitESM=!0,n.options.emitCJS=!0):p?n.options.emitESM=!0:c?n.options.emitCJS=!0:i==="esm"?n.options.emitESM=!0:n.options.emitCJS=!0;const u=n.options.emitCJS&&n.options.emitESM;if(n.options.declaration==="node16"&&u&&(n.options.declaration="compatible"),e.bin){const f=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const m of f){const h=tr(m);if(h&&h!==i)throw new Error(`Exported file "${m}" has an extension that does not match the package.json type "${e.type??"commonjs"}".`);a.push({file:m,isExecutable:!0,key:"bin",type:h??i})}}e.main&&a.push({file:e.main,key:"main",type:tr(e.main)??i}),e.module&&a.push({file:e.module,key:"module",type:"esm"}),o&&(xl(n),Ce(n.options.declaration)&&u&&(n.options.declaration="compatible"),a.push({file:o,key:"types"}));const d=[];if(!n.options.outputExtensionMap){const f=a.some(v=>!v.isExecutable&&!Te.test(v.file)&&v.file.endsWith(".mjs")),m=a.some(v=>!v.isExecutable&&!Te.test(v.file)&&v.file.endsWith(".cjs")),h=a.some(v=>!v.isExecutable&&!Te.test(v.file)&&v.file.endsWith(".js"));f&&!m&&!h?n.options.outputExtensionMap={esm:"mjs"}:m&&!f&&!h&&(n.options.outputExtensionMap={cjs:"cjs"})}for(const f of a){const m=Te.test(f.file),h=$d(f.file,n.options.outputExtensionMap),v=[...vr];if(n.options.outputExtensionMap)for(const S of Object.values(n.options.outputExtensionMap)){const R=S.startsWith(".")?S:`.${S}`;v.includes(R)||v.push(R)}if(!m&&h!==""&&!v.includes(h)||!m&&fw.test(f.file))continue;let y=f.type;if(!y&&m){if(f.file.endsWith(".d.mts"))y="esm";else if(f.file.endsWith(".d.cts"))y="cjs";else if(f.file.endsWith(".d.ts")){const S=a.some(N=>N.subKey==="import"&&N.file.endsWith(".d.mts")),R=a.some(N=>N.subKey==="require"&&N.file.endsWith(".d.cts"));S&&R?y=void 0:y=n.pkg.type==="module"?"esm":"cjs"}}if(Te.test(f.file)||(n.options.emitCJS===void 0&&(y==="cjs"||f.type==="cjs")&&(n.options.emitCJS=!0),n.options.emitESM===void 0&&(y==="esm"||f.type==="esm")&&(n.options.emitESM=!0)),Ce(n.options.declaration)){const S=n.options.emitCJS&&n.options.emitESM;n.options.declaration=S?"compatible":"node16"}let g=f.file;if(n.options.outputExtensionMap)for(const S of Object.values(n.options.outputExtensionMap)){const R=S.startsWith(".")?S:`.${S}`;if(f.file.endsWith(R)){g=f.file.slice(0,-R.length);break}}g===f.file&&(g=f.file.replace(gw,""));const $=g.endsWith("/");if($&&["./","/"].includes(g))continue;const b=g.replace(new RegExp(`(./)?${n.options.outDir}`),n.options.sourceDir).replace("./",""),w=$?"":String.raw`(\.d\.[cm]?ts|(\.[cm]?[tj]sx?))$`,E="(?:^|/)";if((f.file.includes("/*")||g.includes("*"))&&f.key==="exports"){ri||(n.logger?.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),ri=!0);let S;f.exportKey?S=f.exportKey.startsWith("./")?f.exportKey.slice(2):f.exportKey:S=(f.file.startsWith("./")?f.file.slice(2):f.file).replace(Cs,"");const R=f.file,N=bl.exec(R);if(R.includes("*")&&!N&&f.exportKey&&!f.subKey){const P=R.replace($l,"").replace(Dn,""),M=S.replace($l,"").replace(Dn,"");if(P!==M){const q=`package.json#exports["${f.exportKey==="."?".":`./${f.exportKey}`}"]`;r.push(`Wildcard pattern must include a file extension: ${R} at ${q}`);continue}}const J=n.options.sourceDir.replace(Dn,""),G=X(n.options.rootDir,J),H=[],_=await yw(G),O=R.split("*").length-1,F=S.split("*").length-1;for(const P of _){const M=wl(P,S,O);if(M){if(O>F&&O>1){if(M.length>=O){const B=M[0];if(M.every(D=>D===B)){const D=kt(R,M.slice(0,O));D.includes("*")||H.push({input:X(G,P),output:D})}continue}const U=P.replace(an,"").split("/").filter(Boolean);if(U.length>=O){const B=Math.floor(U.length/O),D=[];for(let z=0;z<O;z+=1){const A=z*B,ae=z===O-1?U.length:(z+1)*B;D.push(U.slice(A,ae).join("/"))}const K=D[0];if(D.every(z=>z===K)){const z=kt(R,D);z.includes("*")||H.push({input:X(G,P),output:z})}}else if(U.length>0){const B=U[0];if(U.every(D=>D===B)){const D=Array.from({length:O}).fill(B),K=kt(R,D);K.includes("*")||H.push({input:X(G,P),output:K})}}continue}if(M.length<O)continue;if(F>0&&F<O&&O>1&&M.length>1){const U=M[0];if(!M.every(B=>B===U))continue}const q=kt(R,M);if(q.includes("*"))continue;H.push({input:X(G,P),output:q})}}if(H.length===0&&R.includes("*")){let P=(f.file.startsWith("./")?f.file.slice(2):f.file).replace(Cs,"");P=P.replace(bl,"");for(const M of _){const q=wl(M,P,O);if(q){if(O>1&&F<O){if(q.length>=O){const D=q[0];if(q.every(K=>K===D)){const K=kt(R,q);K.includes("*")||H.push({input:X(G,M),output:K});continue}}const U=M.replace(an,""),B=P.split("*");if(B.length>=2){const D=B.map(A=>A.replaceAll(/[.+?^${}()|[\]\\]/g,String.raw`\$&`));let K=`${D[0]}(.+)`;for(let A=1;A<D.length;A+=1)K+=D[A],A<D.length-1&&(K+=String.raw`\1`);const z=new RegExp(`^${K}$`).exec(U);if(z){const A=z[1],ae=kt(R,Array.from({length:O}).fill(A));ae.includes("*")||H.push({input:X(G,M),output:ae})}}continue}if(q.length>=O){if(F>0&&F<O&&O>1&&q.length>1){const B=q[0];if(!q.every(D=>D===B))continue}const U=kt(R,q);U.includes("*")||H.push({input:X(G,M),output:U})}}}}if(H.length===0){a.length>1||r.push(`Could not find entrypoints matching pattern \`${S}\` for output \`${R}\``);continue}const I=a.filter(P=>P.exportKey===f.exportKey);if(I.length>0&&I.every(P=>Te.test(P.file))){const P=I.some(D=>D.file.endsWith(".d.ts")),M=I.some(D=>D.file.endsWith(".d.mts")),q=I.some(D=>D.file.endsWith(".d.cts"));M&&q?(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitCJS=!0,n.options.emitESM=!0):q?(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitCJS=!0):M&&(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitESM=!0);const U=I.find(D=>D.file.endsWith(".d.ts")),B=U??I.find(D=>D.file.endsWith(".d.mts"))??I.find(D=>D.file.endsWith(".d.cts"))??f;if(!(B===f||U!==void 0&&f===U||U===void 0&&B===f))continue;for(const{input:D,output:K}of H){let z=K;if(K.endsWith(".d.mts")||K.endsWith(".d.cts"))z=K.replace(yl,".d.ts");else if(!K.endsWith(".d.ts")){const ae=K.replace(yl,".d.ts");P&&(z=ae)}const A={...B,file:z,subKey:"types",type:void 0};lt(d,D,!1,g,A,n,!0,a)}}else for(const{input:P,output:M}of H){const q=Te.test(M);let U=f.type;q||(M.endsWith(".mjs")?U="esm":M.endsWith(".cjs")?U="cjs":M.endsWith(".js")&&!U&&(U=n.pkg.type==="module"?"esm":"cjs"));const B={...f,file:M,...!q&&U&&{type:U}};lt(d,P,!1,g,B,n,!0,a)}continue}const x=new RegExp(E+b.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+w);let k=t.find(S=>x.test(S));if(k===void 0){const S=n.options.sourceDir.replace(Dn,""),R=X(n.options.rootDir,S),N=ww(f.file);if(N){const J=xw(t,N.baseName,N.pattern,R);if(J)k=J;else{const G=N.baseName,H=new RegExp(E+G.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+w);k=t.find(_=>H.test(_))}}else{const J=b.replace(hw,"$1").replace(dw,"");if(Yp.has(f.subKey)){const G=new RegExp(E+J.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+w);k=t.find(H=>G.test(H))}}}if(k===void 0){nt(X(n.options.rootDir,f.file))||r.push(`Could not find entrypoint for \`${f.file}\``);continue}nt(k)&&mw.test(k)&&xl(n);const j=a.filter(S=>S.exportKey===f.exportKey);if(j.length>0&&j.every(S=>Te.test(S.file))){const S=j.some(J=>J.file.endsWith(".d.mts")),R=j.some(J=>J.file.endsWith(".d.cts"));S&&R?(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitCJS=!0,n.options.emitESM=!0):R?(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitCJS=!0):S&&(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitESM=!0);const N={...f,subKey:"types",type:void 0};lt(d,k,$,g,N,n,!1,a)}else{const S=Sm(k.replace(Us,"")),R=`${S}.cts`,N=`${S}.mts`,J=nt(R),G=nt(N),H=f.file.endsWith(".d.mts")||f.file.endsWith(".mjs"),_=f.file.endsWith(".d.cts")||f.file.endsWith(".cjs");H&&G?lt(d,N,$,g,{...f,type:"esm"},n,!1,a):_&&J?lt(d,R,$,g,{...f,type:"cjs"},n,!1,a):J&&G?(lt(d,R,$,g,{...f,type:"cjs"},n,!1,a),lt(d,N,$,g,{...f,type:"esm"},n,!1,a)):lt(d,k,$,g,f,n,!1,a)}}return{entries:d,warnings:r}},kn=e=>typeof e=="string"&&e!=="",Ew=(e,t)=>{const{publishConfig:n}=e;return n&&(n.bin&&(typeof n.bin=="object"||typeof n.bin=="string")&&(e.bin=n.bin),kn(n.type)&&(e.type=n.type),kn(n.main)&&(e.main=n.main),kn(n.module)&&(e.module=n.module),t===void 0&&kn(n.types)?e.types=n.types:t===void 0&&kn(n.typings)&&(e.typings=n.typings),n.exports&&typeof n.exports=="object"&&(e.exports=n.exports)),e},xd=/.*\/dist\/.*/,kl=/\/$/,Sw=/\.mjs$/,jw=/\.cjs$/,Aw=/\.d\.[mc]?ts$/,Ow=/(?<!\.d)\.js$/,Rw=e=>{const t=[],n=new Set,o=r=>{if(typeof r=="string"){t.push(r);return}if(Array.isArray(r)){for(const i of r)o(i);return}if(r&&typeof r=="object")for(const[i,s]of Object.entries(r))i.startsWith(".")||n.add(i),o(s)};e.exports&&o(e.exports);for(const r of[e.main,e.module,e.types])typeof r=="string"&&t.push(r);return{conditions:n,files:t}},Cw=(e,t,n)=>{if(e.options.emitESM!==void 0||e.options.emitCJS!==void 0)return;const o=e.pkg.type==="module"?"esm":"cjs",r=n.some(a=>Ow.test(a));let i=n.some(a=>Sw.test(a))||t.has("import")||t.has("module"),s=n.some(a=>jw.test(a))||t.has("require");(r||!i&&!s)&&o==="esm"?i=!0:(r||!i&&!s)&&(s=!0),e.options.emitESM=i,e.options.emitCJS=s},Tw=(e,t,n)=>{if(e.options.declaration!==void 0)return;const o=!!e.pkg.types||t.has("types")||n.some(r=>Aw.test(r));e.options.declaration=o?"node16":!1},_w=e=>{e.options.entries.length=0;const t=V(e.options.rootDir,e.options.sourceDir);if(!nt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const n=Np(t,{extensions:[],includeDirs:!1,includeSymlinks:!1,skip:[Ot,xd]}).filter(p=>jt.test(p)&&!p.endsWith(".d.ts")),{conditions:o,files:r}=Rw(e.pkg);Cw(e,o,r),Tw(e,o,r);const i=e.options.emitESM??!1,s=e.options.emitCJS??!1;for(const p of n){const c=p.replace(`${t}/`,"").replace(jt,"").replaceAll("\\","/");e.options.entries.push({cjs:s,declaration:e.options.declaration,esm:i,input:p,name:c})}const a=[];i&&a.push("[esm]"),s&&a.push("[cjs]"),e.options.declaration&&a.push("[dts]");const l=e.options.entries.length;e.logger.info("Unbundle mode: preserving source structure for",ne(`${String(l)} ${l===1?"entry":"entries"}`),Fe(a.join(" ")))},Nw={hooks:{"build:prepare":async function(e){if(e.options.unbundle){_w(e);return}if(e.options.entries.length>0)return;const t=V(e.options.rootDir,e.options.sourceDir);if(!nt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const n=Np(t,{extensions:[],includeDirs:!1,includeSymlinks:!1,skip:[Ot,xd]});if(n.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");const o=e.logger;let r={...e.pkg};r.publishConfig&&(o.info(`Using publishConfig found in package.json, to override the default key-value pairs of "${Object.keys(r.publishConfig).join(", ")}".`),o.debug(r.publishConfig),r=Ew(r,e.options.declaration));const i=await kw(r,n,e);for(const s of i.warnings)o.warn(s);if(e.options.entries.push(...i.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");o.info("Automatically detected entries:",ne(e.options.entries.map(s=>s.fileAlias?`${je(s.fileAlias)} => ${je(s.input.replace(`${e.options.rootDir}/`,"").replace(kl,"/*"))}`:je(s.input.replace(`${e.options.rootDir}/`,"").replace(kl,"/*"))).join(", ")),Fe([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(s=>`[${s}]`).join(" ")))}}},Pw=We(import.meta.url),Ut=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ha=e=>{if(typeof Ut<"u"&&Ut.versions&&Ut.versions.node){const[t,n]=Ut.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Ut.getBuiltinModule(e)}return Pw(e)},{existsSync:ii}=ha("node:fs"),{env:si,cwd:Mw}=Ut,{createRequire:po}=ha("node:module"),Iw=0,ai=2,Ww=Symbol("findUpStop"),kd=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},El=e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"},Bw=po(import.meta.url),En=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Dw=e=>{if(typeof En<"u"&&En.versions&&En.versions.node){const[t,n]=En.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return En.getBuiltinModule(e)}return Bw(e)},{lstatSync:Sl,mkdirSync:Lw}=Dw("node:fs"),Fw=e=>{kd(e);try{const t=Sl(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(El(t))}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{Lw(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const n=Sl(e);if(!n.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(El(n))}'`,{cause:t})}},qw=/^[A-Z]:\//i,uo=(e="")=>e&&e.replaceAll("\\","/").replace(qw,t=>t.toUpperCase()),zw=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Hw=/^[A-Z]:$/i,Jw=/.(\.[^./]+)$/,Gw=/^[/\\]|^[a-z]:[/\\]/i,Uw=/\/$/,Vw=()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/",Kw=(e,t)=>{let n="",o=0,r=-1,i=0,s;for(let a=0;a<=e.length;++a){if(a<e.length)s=e[a];else{if(s==="/")break;s="/"}if(s==="/"){if(!(r===a-1||i===1))if(i===2){if(n.length<2||o!==2||!n.endsWith(".")||n.at(-2)!=="."){if(n.length>2){const l=n.lastIndexOf("/");l===-1?(n="",o=0):(n=n.slice(0,l),o=n.length-1-n.lastIndexOf("/")),r=a,i=0;continue}else if(n.length>0){n="",o=0,r=a,i=0;continue}}t&&(n+=n.length>0?"/..":"..",o=2)}else n.length>0?n+=`/${e.slice(r+1,a)}`:n=e.slice(r+1,a),o=a-r-1;r=a,i=0}else s==="."&&i!==-1?++i:i=-1}return n},nr=e=>zw.test(e),li=function(...e){e=e.map(o=>uo(o));let t="",n=!1;for(let o=e.length-1;o>=-1&&!n;o--){const r=o>=0?e[o]:Vw();!r||r.length===0||(t=`${r}/${t}`,n=nr(r))}return t=Kw(t,!n),n&&!nr(t)?`/${t}`:t.length>0?t:"."},Yw=function(e){return Jw.exec(uo(e))?.[1]??""},Ed=e=>{const t=uo(e).replace(Uw,"").split("/").slice(0,-1);return t.length===1&&Hw.test(t[0])&&(t[0]=`${t[0]}/`),t.join("/")||(nr(e)?"/":".")},Xw=(e,t)=>uo(e).split("/").pop(),Zw=function(e){const t=Gw.exec(e)?.[0]?.replaceAll("\\","/")??"",n=Xw(e),o=Yw(n);return{base:n,dir:Ed(e),ext:o,name:n.slice(0,n.length-o.length),root:t}},Qw=po(import.meta.url),Sn=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,e0=e=>{if(typeof Sn<"u"&&Sn.versions&&Sn.versions.node){const[t,n]=Sn.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Sn.getBuiltinModule(e)}return Qw(e)},{fileURLToPath:t0}=e0("node:url");function n0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jl,Al;function o0(){return Al||(Al=1,jl=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),jl}var r0=o0();const i0=n0(r0);new Set(i0);const Ts=e=>uo(e instanceof URL?t0(e):e),s0=po(import.meta.url),jn=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Sd=e=>{if(typeof jn<"u"&&jn.versions&&jn.versions.node){const[t,n]=jn.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return jn.getBuiltinModule(e)}return s0(e)};Sd("node:fs/promises");Sd("node:url");const a0=po(import.meta.url),An=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,jd=e=>{if(typeof An<"u"&&An.versions&&An.versions.node){const[t,n]=An.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return An.getBuiltinModule(e)}return a0(e)},{statSync:l0,lstatSync:c0}=jd("node:fs"),{fileURLToPath:p0}=jd("node:url"),u0=(e,t={})=>{const n=t.cwd?Ts(t.cwd):process.cwd();let o=li(n);const{root:r}=Zw(o),i=Ts(t.stopAt??r),s=li(o,i),a=t.type??"file",l=function(c){return[e]};t.allowSymlinks??=!0;const p=t.allowSymlinks?l0:c0;for(;o&&o!==s&&o!==r;){for(let c of l()){if(c===Ww)return;if(c===void 0)continue;Buffer.isBuffer(c)?c=c.toString():c instanceof URL&&(c=p0(c));const u=nr(c)?c:li(o,c);try{const d=p(u);if(a==="file"&&d.isFile()||a==="directory"&&d.isDirectory())return u}catch{}}o=Ed(o)}},d0=po(import.meta.url),On=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f0=e=>{if(typeof On<"u"&&On.versions&&On.versions.node){const[t,n]=On.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return On.getBuiltinModule(e)}return d0(e)};f0("node:fs/promises");const{accessSync:m0}=ha("node:fs");function ci(e,t=Iw){kd(e),e=Ts(e);try{return m0(e,t),!0}catch{return!1}}let h0=class extends Error{constructor(t){super(`ENOENT: ${t}`)}get code(){return"ENOENT"}set code(t){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(t){throw new Error("Cannot overwrite name of NotFoundError")}};const g0=/^[A-Z]:\//i,Ad=(e="")=>e&&e.replaceAll("\\","/").replace(g0,t=>t.toUpperCase()),v0=/^[/\\]{2}/,y0=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Od=/^[A-Z]:$/i,b0=/\/$/,$0=(e,t)=>{let n="",o=0,r=-1,i=0,s;for(let a=0;a<=e.length;++a){if(a<e.length)s=e[a];else{if(s==="/")break;s="/"}if(s==="/"){if(!(r===a-1||i===1))if(i===2){if(n.length<2||o!==2||!n.endsWith(".")||n.at(-2)!=="."){if(n.length>2){const l=n.lastIndexOf("/");l===-1?(n="",o=0):(n=n.slice(0,l),o=n.length-1-n.lastIndexOf("/")),r=a,i=0;continue}else if(n.length>0){n="",o=0,r=a,i=0;continue}}t&&(n+=n.length>0?"/..":"..",o=2)}else n.length>0?n+=`/${e.slice(r+1,a)}`:n=e.slice(r+1,a),o=a-r-1;r=a,i=0}else s==="."&&i!==-1?++i:i=-1}return n},_s=e=>y0.test(e),w0=function(e){if(e.length===0)return".";e=Ad(e);const t=v0.exec(e),n=_s(e),o=e.at(-1)==="/";return e=$0(e,!n),e.length===0?n?"/":o?"./":".":(o&&(e+="/"),Od.test(e)&&(e+="/"),t?n?`//${e}`:`//./${e}`:n&&!_s(e)?`/${e}`:e)},ko=(...e)=>{let t="";for(const n of e)if(n)if(t.length>0){const o=t.at(-1)==="/",r=n[0]==="/";o&&r?t+=n.slice(1):t+=o||r?n:`/${n}`}else t+=n;return w0(t)},x0=e=>{const t=Ad(e).replace(b0,"").split("/").slice(0,-1);return t.length===1&&Od.test(t[0])&&(t[0]=`${t[0]}/`),t.join("/")||(_s(e)?"/":".")},Ol=(e,t)=>(t?.create&&Fw(e),e),k0=(e,t)=>{if(si.CACHE_DIR&&!["0","1","false","true"].includes(si.CACHE_DIR))return Ol(ko(si.CACHE_DIR,e),t);const n=u0("package.json",{cwd:t?.cwd??Mw(),type:"file"});if(!n){if(t?.throwError)throw new h0("No such file or directory found.");return}const o=ko(x0(n),"node_modules"),r=ko(o,".cache"),i=ko(r,e);if(!(ii(i)&&!ci(i,ai))&&!(ii(r)&&!ci(r,ai))&&!(ii(o)&&!ci(o,ai)))return Ol(i,t)},E0=k0,S0=/^(?<value>-?\d+(?:[.,]\d+)*) *(?<type>[a-z]+)?$/i,j0=/^KIBI/,A0=/^MIBI/,O0=/^GIBI/,R0=/^TEBI/,C0=/^PEBI/,T0=/^EXBI/,_0=/^ZEBI/,N0=/^YIBI/,P0=/^(.)IB$/,Rd={iec:[{long:"Bytes",short:"B"},{long:"Kibibytes",short:"KiB"},{long:"Mebibytes",short:"MiB"},{long:"Gibibytes",short:"GiB"},{long:"Tebibytes",short:"TiB"},{long:"Pebibytes",short:"PiB"},{long:"Exbibytes",short:"EiB"},{long:"Zebibytes",short:"ZiB"},{long:"Yobibytes",short:"YiB"}],iec_octet:[{long:"Octets",short:"o"},{long:"Kibioctets",short:"Kio"},{long:"Mebioctets",short:"Mio"},{long:"Gibioctets",short:"Gio"},{long:"Tebioctets",short:"Tio"},{long:"Pebioctets",short:"Pio"},{long:"Exbioctets",short:"Eio"},{long:"Zebioctets",short:"Zio"},{long:"Yobioctets",short:"Yio"}],metric:[{long:"Bytes",short:"Bytes"},{long:"Kilobytes",short:"KB"},{long:"Megabytes",short:"MB"},{long:"Gigabytes",short:"GB"},{long:"Terabytes",short:"TB"},{long:"Petabytes",short:"PB"},{long:"Exabytes",short:"EB"},{long:"Zettabytes",short:"ZB"},{long:"Yottabytes",short:"YB"}],metric_octet:[{long:"Octets",short:"o"},{long:"Kilo-octets",short:"ko"},{long:"Mega-octets",short:"Mo"},{long:"Giga-octets",short:"Go"},{long:"Tera-octets",short:"To"},{long:"Peta-octets",short:"Po"},{long:"Exa-octets",short:"Eo"},{long:"Zetta-octets",short:"Zo"},{long:"Yotta-octets",short:"Yo"}]},M0=(e,t)=>{const n=new Intl.NumberFormat(t).format(11111).replaceAll(new RegExp("\\p{Number}","gu"),""),o=new Intl.NumberFormat(t).format(1.1).replaceAll(new RegExp("\\p{Number}","gu"),"");return Number.parseFloat(e.replaceAll(new RegExp(`\\${n}`,"g"),"").replace(new RegExp(`\\${o}`),"."))},Cd=e=>{switch(e){case 2:return 1024;case 10:return 1e3;default:throw new Error("Unsupported base.")}},I0=(e,t)=>{const n={base:2,locale:"en-US",units:"metric",...t};if(typeof e!="string"||e.length===0)throw new TypeError("Value is not a string or is empty.");if(e.length>100)throw new TypeError("Value exceeds the maximum length of 100 characters.");const o=S0.exec(e)?.groups;if(!o)return Number.NaN;const r=M0(o.value,n.locale),i=(o.type??"Bytes").toUpperCase().replace(j0,"KILO").replace(A0,"MEGA").replace(O0,"GIGA").replace(R0,"TERA").replace(C0,"PETA").replace(T0,"EXA").replace(_0,"ZETTA").replace(N0,"YOTTA").replace(P0,"$1B"),s=Rd[n.units].findIndex(l=>l.short[0].toUpperCase()===i[0]),a=Cd(n.base);return r*a**s},Se=(e,t)=>{if(typeof e!="number"||!Number.isFinite(e))throw new TypeError("Bytesize is not a number.");const{base:n,decimals:o,locale:r,long:i,unit:s,units:a,...l}={base:2,decimals:0,locale:"en-US",long:!1,units:"metric",...t},p=Cd(n),c=Math.abs(e),u=t?.space??!0?" ":"",d=Rd[a],f=d.findIndex(g=>g.short===s);if(e===0){const g=Math.min(0,Math.max(f,d.length-1));return"0"+u+d[g][i?"long":"short"]}const m=f===-1?Math.min(Math.floor(Math.log(c)/Math.log(p)),d.length-1):f,h=d[m][i?"long":"short"],v=e/p**m,y=o<0?void 0:o;return new Intl.NumberFormat(r,{maximumFractionDigits:y,minimumFractionDigits:y,...l}).format(v)+u+h},W0=(e,t,n,o,r,i,s,a,l,p,c,u,d,f)=>{const m={d:o,h:r,m:i,mo:t,ms:a,s,w:n,y:e};return m.future=l,m.past=p,m.decimal=c,u!==void 0&&(m.unitMap=u),m.groupSeparator=d,m.placeholderSeparator=f,m},B0={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},D0=W0(e=>`year${e===1?"":"s"}`,e=>`month${e===1?"":"s"}`,e=>`week${e===1?"":"s"}`,e=>`day${e===1?"":"s"}`,e=>`hour${e===1?"":"s"}`,e=>`minute${e===1?"":"s"}`,e=>`second${e===1?"":"s"}`,e=>`millisecond${e===1?"":"s"}`,"in %s","%s ago",".",B0,",","_"),L0=e=>{const t=["y","mo","w","d","h","m","s","ms","future","past"];for(const o of t)if(!Object.hasOwn(e,o))throw new TypeError(`Missing required property: ${o}`);if(typeof e.future!="string"||typeof e.past!="string")throw new TypeError("Properties future and past must be of type string");const n=["y","mo","w","d","h","m","s","ms"];for(const o of n)if(typeof e[o]!="string"&&typeof e[o]!="function")throw new TypeError(`Property ${o} must be of type string or function`);if(e.decimal&&typeof e.decimal!="string")throw new TypeError("Property decimal must be of type string");if(e.delimiter&&typeof e.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(e._digitReplacements&&!Array.isArray(e._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(e._numberFirst&&typeof e._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(e.unitMap&&typeof e.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(e.unitMap&&Object.values(e.unitMap).some(o=>typeof o!="string"))throw new TypeError("All values in unitMap must be of type string")},Td=(e,t)=>{t=t||-1;const n=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(t)}})?`).exec(e.toString());return n===null?e:Number.parseFloat(n[0])},Rl=({unitCount:e,unitName:t},n,o)=>{let{spacer:r}=o;const{maxDecimalPoints:i}=o;let s=".";o.decimal!==void 0?s=o.decimal:n.decimal!==void 0&&(s=n.decimal);let a;"digitReplacements"in o?a=o.digitReplacements:"_digitReplacements"in n&&(a=n._digitReplacements);let l,p=e;i!==void 0&&(p=Td(e,i));const c=p.toString();if(!n._hideCountIf2||e!==2)if(a){l="";for(const f of c)l+=f==="."?s:a[f]}else l=c.replace(".",s);else l="";const u=n[t];let d=u;return typeof u=="function"&&(d=u(e)),n._hideCountIf2&&e===2&&(r=""),n._numberFirst?d+r+l:l+r+d},F0=(e,t)=>{const{units:n}=t;if(n.length===0)return[];const{unitMeasures:o}=t,r=t.largest??Number.POSITIVE_INFINITY,i={};let s,a,l,p=e;for(a=0;a<n.length;a++){s=n[a];const u=o[s];l=a===n.length-1?p/u:Math.floor(p/u),i[s]=l,p-=l*u}if(t.round){let u=r;for(a=0;a<n.length;a++)if(s=n[a],l=i[s],l!==0&&(u--,u===0)){for(let d=a+1;d<n.length;d++){const f=n[d],m=i[f];i[s]=(i[s]??0)+m*o[f]/o[s],i[f]=0}break}for(a=n.length-1;a>=0;a--){if(s=n[a],l=i[s],l===0)continue;const d=Math.round(l);if(i[s]=d,a===0)break;const f=n[a-1],m=o[f],h=Math.floor(d*o[s]/m);if(h)i[f]=(i[f]??0)+h,i[s]=0;else break}}const c=[];for(a=0;a<n.length&&c.length<r;a++){if(s=n[a],l=i[s],l&&!t.round&&c.length===r-1){let u,d=0;for(u=a+1,n.length;u<n.length;u++){const f=n[u];d+=i[f]*(t.unitMeasures[f]/t.unitMeasures[s])}l+=d,t.maxDecimalPoints!==void 0&&(l=Td(l,t.maxDecimalPoints))}l&&c.push({unitCount:l,unitName:s})}return c},q0=(e,t,n)=>{const{language:o,units:r}=t;if(e.length===0){const u=r.at(-1);return Rl({unitCount:0,unitName:u},o,t)}const{conjunction:i,serialComma:s}=t;let a=", ";t.delimiter!==void 0?a=t.delimiter:o.delimiter!==void 0&&(a=o.delimiter);let l="";t.timeAdverb&&n!==0&&(l=o.future??"",n<0&&(l=o.past??""));const p=e.map(u=>Rl(u,o,t));let c;return!i||e.length===1?c=p.join(a):e.length===2?c=p.join(i):c=p.slice(0,-1).join(a)+(s?",":"")+i+(p.at(-1)??""),l&&(c=l.replace("%s",c)),c},Cl=(e,t)=>{if(Number.isNaN(e))throw new TypeError("Expected a valid number");if(typeof e!="number")throw new TypeError("Expected a number for milliseconds input");const n={conjunction:"",language:D0,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...t};L0(n.language);const o=Math.abs(e),r=F0(o,n);return q0(r,n,e)};var z0=Object.defineProperty,_d=(e,t)=>z0(e,"name",{value:t,configurable:!0});const H0=We(import.meta.url),Rn=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Nd=_d(e=>{if(typeof Rn<"u"&&Rn.versions&&Rn.versions.node){const[t,n]=Rn.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Rn.getBuiltinModule(e)}return H0(e)},"__cjs_getBuiltinModule"),{execSync:J0}=Nd("node:child_process"),{existsSync:Tl,readFileSync:G0}=Nd("node:fs");var U0=Object.defineProperty,Ze=_d((e,t)=>U0(e,"name",{value:t,configurable:!0}),"r");const ga=["yarn.lock","package-lock.json","pnpm-lock.yaml","npm-shrinkwrap.json","bun.lockb"],Pd=Ze(e=>{let t;if(ga.forEach(o=>{!t&&Tl(V(e,o))&&(t=V(e,o))}),t)return t;const n=V(e,"package.json");if(Tl(n)&&da(G0(n,"utf8")).packageManager!==void 0)return n},"packageMangerFindUpMatcher"),Md=Ze(e=>{if(!e)throw new It("Could not find a package manager");if(e.endsWith("package.json")){const t=da(e);if(t.packageManager){const n=["npm","yarn","pnpm","bun"].find(o=>t.packageManager.startsWith(o));if(n)return{packageManager:n,path:Z(e)}}}if(e.endsWith("yarn.lock"))return{packageManager:"yarn",path:Z(e)};if(e.endsWith("package-lock.json")||e.endsWith("npm-shrinkwrap.json"))return{packageManager:"npm",path:Z(e)};if(e.endsWith("pnpm-lock.yaml"))return{packageManager:"pnpm",path:Z(e)};if(e.endsWith("bun.lockb"))return{packageManager:"bun",path:Z(e)};throw new It("Could not find a package manager")},"resolvePackageManagerFromFile"),V0=Ze(async e=>{const t=await ft(ga,{type:"file",...e&&{cwd:e}});if(!t)throw new Error("Could not find lock file");return t},"findLockFile"),K0=Ze(e=>{const t=mt(ga,{type:"file",...e&&{cwd:e}});if(!t)throw new Error("Could not find lock file");return t},"findLockFileSync"),Y0=Ze(async e=>{const t=await ft(Pd,{...e&&{cwd:e}});return Md(t)},"findPackageManager"),Id=Ze(e=>{const t=mt(Pd,{...e&&{cwd:e}});return Md(t)},"findPackageManagerSync");Ze(e=>J0(`${e} --version`).toString("utf8").trim(),"getPackageManagerVersion");Ze(()=>{if(!process.env.npm_config_user_agent)return;const e=process.env.npm_config_user_agent.split(" ")[0],t=e.lastIndexOf("/"),n=e.slice(0,Math.max(0,t));return{name:n==="npminstall"?"cnpm":n,version:e.slice(Math.max(0,t+1))}},"identifyInitiatingPackageManager");Ze((e,t,n)=>{const o=t.length===1?"":"s";if(n.packageManagers??=["npm","pnpm","yarn"],n.packageManagers.length===0)throw new Error("No package managers provided, please provide at least one package manager");if(t.length===0)throw new Error("No missing packages provided, please provide at least one missing package");let r=`
|
|
51
|
+
${n.preMessage??""}
|
|
52
|
+
${e} could not find the following package${o}
|
|
53
|
+
|
|
54
|
+
${t.join(`
|
|
55
|
+
`)}
|
|
56
|
+
|
|
57
|
+
To install the missing package${o}, please run the following command:
|
|
58
|
+
`;const i=Ze(a=>a.split("@").includes("@")?a:`${a}@latest`,"atLatest"),s=n.packageManagers.map(a=>{const l=t.map(p=>i(p)).join(" ");switch(a){case"bun":return` bun add ${l} -D`;case"npm":return` npm install ${l} --save-dev`;case"pnpm":return` pnpm add ${l} -D`;case"yarn":return` yarn add ${l} --dev`;default:throw new Error("Unknown package manager")}});return r+=s.join(`
|
|
59
|
+
|
|
60
|
+
or
|
|
61
|
+
|
|
62
|
+
`),n.postMessage&&(r+=n.postMessage),r},"generateMissingPackagesInstallMessage");var X0=Object.defineProperty,Wd=(e,t)=>X0(e,"name",{value:t,configurable:!0}),Z0=Object.defineProperty,Q0=Wd((e,t)=>Z0(e,"name",{value:t,configurable:!0}),"t");let zO=class extends Error{static{Wd(this,"s")}static{Q0(this,"PackageNotFoundError")}constructor(t,n){if(typeof t=="string"&&(t=[t]),t.length===0){super("Package was not found.");return}if(n===void 0)try{n=Id().packageManager}catch{}n??="npm",super(`Package '${t.join(" ")}' was not found. Please install it using '${n} install ${t.join(" ")}'`)}get code(){return"PACKAGE_NOT_FOUND"}set code(t){throw new Error("Cannot overwrite code PACKAGE_NOT_FOUND")}get name(){return"PackageNotFoundError"}set name(t){throw new Error("Cannot overwrite name of PackageNotFoundError")}};var ex=Object.defineProperty,Bd=(e,t)=>ex(e,"name",{value:t,configurable:!0});const tx=We(import.meta.url),Cn=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Dd=Bd(e=>{if(typeof Cn<"u"&&Cn.versions&&Cn.versions.node){const[t,n]=Cn.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Cn.getBuiltinModule(e)}return tx(e)},"__cjs_getBuiltinModule"),{readFileSync:nx}=Dd("node:fs"),{readFile:ox}=Dd("node:fs/promises");var rx=Object.defineProperty,$e=Bd((e,t)=>rx(e,"name",{value:t,configurable:!0}),"g");const ix={sha256:"sha256",sha384:"sha384",sha512:"sha512"},sx=1024,ax=/^[A-Z0-9+/]+={0,2}$/i,lx=/.*node_modules\/((?:@[^/]+\/)?[^/]+)$/,Xn=/^['"]/,Zn=/['"]$/,cx=/^[a-z][a-zA-Z0-9]*:\s*$/m,px=/resolution:\s*\{[^}]*integrity:\s*([^,}\s]+)/,ux=/^["']?((?:@[^/@"']+\/)?[^@"'\n]+)@[^"'\n]+["']?:?[\t\v\f\r \u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n((?:[\t ][^\n]*\n?)+)/gm,dx=/^\s+version:?\s+"?([^"\n]+)"?/m,fx=/^\s+integrity[\s:]+"?([^"\s]+)"?/m,Ir=$e(e=>{if(e.length>sx)return;const t=e.indexOf("-");if(t<=0)return;const n=ix[e.slice(0,t).toLowerCase()];if(!n)return;const o=e.slice(t+1);if(ax.test(o))try{const r=Buffer.from(o,"base64");return r.length===0?void 0:{algorithm:n,hex:r.toString("hex")}}catch{return}},"decodeSriIntegrity"),Wr=$e((e,t,n)=>{const o=`${n.name}@${n.version}`;t.has(o)||(t.add(o),e.push(n))},"pushUniqueEntry"),Ie=$e((e,t,n)=>{n&&Object.keys(n).length>0&&(e[t]={...n})},"copyDepMap"),en=$e(e=>{if(!e)return;const t={};for(const[n,o]of Object.entries(e))t[n]=[o];return Object.keys(t).length>0?t:void 0},"liftDepMap"),mx=$e(e=>{const t=[],n=new Set;let o;try{o=JSON.parse(e)}catch{return t}if(!o.packages)return t;for(const[r,i]of Object.entries(o.packages)){if(!r||!i.version)continue;const s=lx.exec(r);if(!s?.[1])continue;const a=i.name??s[1];if(a.startsWith("."))continue;const l={name:a,version:i.version};if(i.integrity){const p=Ir(i.integrity);p&&(l.integrity=p)}Ie(l,"dependencies",en(i.dependencies)),Ie(l,"peerDependencies",en(i.peerDependencies)),Ie(l,"optionalDependencies",en(i.optionalDependencies)),Wr(t,n,l)}return t},"parseNpmLockFile"),Ld=$e(e=>{let t=e.trim();t.startsWith("/")&&(t=t.slice(1)),t=t.replace(Xn,"").replace(Zn,"");const n=t.indexOf("(");n>0&&(t=t.slice(0,n));const o=t.lastIndexOf("@");if(o<=0)return;const r=t.slice(0,o),i=t.slice(o+1);if(!(!r||!i||i.startsWith("link:")||i.startsWith("workspace:")||i.startsWith("file:")))return{name:r,version:i}},"splitPnpmPackageKey"),Fd=$e((e,t)=>{const n=new RegExp(String.raw`^${t}:\s*$`,"m").exec(e);if(!n)return;const o=n.index+n[0].length,r=cx.exec(e.slice(o));return e.slice(o,r?o+r.index:e.length)},"sliceTopLevelSection"),hx=$e(e=>{const t=new Map,n=Fd(e,"snapshots");if(!n)return t;const o=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let r;for(;(r=o.exec(n)??void 0)!==void 0;){const i=Ld(r[1]);if(!i)continue;const s=`${i.name}@${i.version}`,a=r[2],l=t.get(s)??{};for(const p of["dependencies","peerDependencies","optionalDependencies"]){const c=zo(a,p);if(!c)continue;const u=l[p]??{};for(const[d,f]of Object.entries(c)){const m=u[d]??[];for(const h of f)m.includes(h)||m.push(h);u[d]=m}l[p]=u}t.set(s,l)}return t},"parsePnpmSnapshotEdges"),gx=$e(e=>{const t=[],n=new Set,o=Fd(e,"packages");if(!o)return t;const r=hx(e),i=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let s;for(;(s=i.exec(o)??void 0)!==void 0;){const a=Ld(s[1]);if(!a)continue;const l=s[2],p=px.exec(l),c={name:a.name,version:a.version};if(p?.[1]){const d=Ir(p[1]);d&&(c.integrity=d)}const u=r.get(`${a.name}@${a.version}`);Ie(c,"dependencies",u?.dependencies??zo(l,"dependencies")),Ie(c,"peerDependencies",u?.peerDependencies??zo(l,"peerDependencies")),Ie(c,"optionalDependencies",u?.optionalDependencies??zo(l,"optionalDependencies")),Wr(t,n,c)}return t},"parsePnpmLockFile"),zo=$e((e,t)=>{const n=new RegExp(String.raw`^ {4}${t}:\s*\n((?: {6,}[^\n]*\n?)+)`,"m").exec(e);if(!n?.[1])return;const o={},r=/^ {6}([^\s:]+):\s*([^\n]+)/gm;let i;for(;(i=r.exec(n[1])??void 0)!==void 0;){const s=i[1].replace(Xn,"").replace(Zn,"");let a=i[2].trim();a=a.replace(Xn,"").replace(Zn,"");const l=a.indexOf("(");if(l>0&&(a=a.slice(0,l).trim()),!s||!a)continue;const p=o[s]??[];p.includes(a)||p.push(a),o[s]=p}return Object.keys(o).length>0?o:void 0},"extractPnpmDependencyMap"),vx=$e(e=>{const t=[],n=new Set,o=ux;o.lastIndex=0;let r;for(;(r=o.exec(e)??void 0)!==void 0;){const i=r[1].replace(Xn,"").replace(Zn,"");if(!i)continue;const s=r[2],a=dx.exec(s);if(!a?.[1])continue;const l={name:i,version:a[1].trim()},p=fx.exec(s);if(p?.[1]){const c=Ir(p[1]);c&&(l.integrity=c)}Ie(l,"dependencies",pi(s,"dependencies")),Ie(l,"peerDependencies",pi(s,"peerDependencies")),Ie(l,"optionalDependencies",pi(s,"optionalDependencies")),Wr(t,n,l)}return t},"parseYarnLockFile"),pi=$e((e,t)=>{const n=new RegExp(String.raw`^ {2}${t}:\s*\n((?: {4,}[^\n]*\n?)+)`,"m").exec(e);if(!n?.[1])return;const o={},r=/^ {4}(['"]?[^\s:'"]+['"]?)\s*(?::\s*)?['"]([^'"\n]+)['"]/gm;let i;for(;(i=r.exec(n[1])??void 0)!==void 0;){const s=i[1].replace(Xn,"").replace(Zn,""),a=i[2];if(s&&a){const l=o[s]??[];l.includes(a)||l.push(a),o[s]=l}}return Object.keys(o).length>0?o:void 0},"extractYarnDependencyMap"),yx=/,(?=\s*[}\]])/g,bx=$e(e=>{const t=[],n=new Set;let o;try{o=JSON.parse(e.replaceAll(yx,""))}catch{return t}if(!o.packages)return t;for(const r of Object.values(o.packages)){const i=r[0];if(typeof i!="string")continue;const s=i.indexOf("@",1);if(s<=0)continue;const a=i.slice(0,s),l=i.slice(s+1);if(!a||!l||l.startsWith("workspace:")||l.startsWith("link:")||l.startsWith("file:"))continue;const p={name:a,version:l},c=r[3];if(typeof c=="string"&&c.length>0){const d=Ir(c);d&&(p.integrity=d)}const u=r[2];if(u&&typeof u=="object"&&!Array.isArray(u)){const d=u;Ie(p,"dependencies",en(d.dependencies)),Ie(p,"peerDependencies",en(d.peerDependencies)),Ie(p,"optionalDependencies",en(d.optionalDependencies))}Wr(t,n,p)}return t},"parseBunLockFile"),qd=$e(e=>{if(e.endsWith("pnpm-lock.yaml"))return"pnpm";if(e.endsWith("package-lock.json"))return"npm";if(e.endsWith("yarn.lock"))return"yarn";if(e.endsWith("bun.lock"))return"bun"},"inferLockFileType"),zd=$e((e,t)=>{switch(t){case"bun":return bx(e);case"npm":return mx(e);case"pnpm":return gx(e);case"yarn":return vx(e);default:return[]}},"parseLockFileContent"),Hd=["pnpm-lock.yaml","package-lock.json","yarn.lock","bun.lock"];$e(async e=>{const t=await ft(Hd,{type:"file",...e&&{cwd:e}});if(!t)throw new Error("Could not find a supported lock file (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lock)");const n=qd(t);if(!n)throw new Error(`Unsupported lock file: ${t}`);const o=await ox(t,"utf8");return{entries:zd(o,n),path:t,type:n}},"parseLockFile");$e(e=>{const t=mt(Hd,{type:"file",...e&&{cwd:e}});if(!t)throw new Error("Could not find a supported lock file (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lock)");const n=qd(t);if(!n)throw new Error(`Unsupported lock file: ${t}`);return{entries:zd(nx(t,"utf8"),n),path:t,type:n}},"parseLockFileSync");var $x=Object.defineProperty,Jd=(e,t)=>$x(e,"name",{value:t,configurable:!0});const wx=We(import.meta.url),Tn=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,xx=Jd(e=>{if(typeof Tn<"u"&&Tn.versions&&Tn.versions.node){const[t,n]=Tn.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Tn.getBuiltinModule(e)}return wx(e)},"__cjs_getBuiltinModule"),{existsSync:or,readFileSync:Gd}=xx("node:fs");var kx=Object.defineProperty,Ud=Jd((e,t)=>kx(e,"name",{value:t,configurable:!0}),"i");Ud(async e=>{const t=await ft(["lerna.json","turbo.json"],{type:"file",...e&&{cwd:e}});if(t?.endsWith("lerna.json")){const o=await hr(t);if(o&&typeof o=="object"&&!Array.isArray(o)){const r=o;if(r.useWorkspaces||r.packages)return{path:Z(t),strategy:"lerna"}}}const n=t?.endsWith("turbo.json");try{const{packageManager:o,path:r}=await Y0(e);if(["npm","yarn"].includes(o)){const i=V(r,"package.json");if(or(i)&&Gd(V(r,"package.json"),"utf8").includes("workspaces"))return{path:r,strategy:n?"turbo":o}}else if(o==="pnpm"){const i=V(r,"pnpm-workspace.yaml");if(or(i))return{path:r,strategy:n?"turbo":"pnpm"}}}catch(o){if(!(o instanceof It))throw o}throw new Error(`No monorepo root could be found upwards from the directory ${e} using lerna, yarn, pnpm, or npm as indicators.`)},"findMonorepoRoot");Ud(e=>{const t=mt(["lerna.json","turbo.json"],{type:"file",...e&&{cwd:e}});if(t?.endsWith("lerna.json")){const o=qs(t);if(o.useWorkspaces||o.packages)return{path:Z(t),strategy:"lerna"}}const n=t?.endsWith("turbo.json");try{const{packageManager:o,path:r}=Id(e);if(["npm","yarn"].includes(o)){const i=V(r,"package.json");if(or(i)&&Gd(V(r,"package.json"),"utf8").includes("workspaces"))return{path:r,strategy:n?"turbo":o}}else if(o==="pnpm"){const i=V(r,"pnpm-workspace.yaml");if(or(i))return{path:r,strategy:n?"turbo":"pnpm"}}}catch(o){if(!(o instanceof It))throw o}throw new Error(`No monorepo root could be found upwards from the directory ${e} using lerna, yarn, pnpm, or npm as indicators.`)},"findMonorepoRootSync");var Ex=Object.defineProperty,Vd=(e,t)=>Ex(e,"name",{value:t,configurable:!0});const Sx=We(import.meta.url),_n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,jx=Vd(e=>{if(typeof _n<"u"&&_n.versions&&_n.versions.node){const[t,n]=_n.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return _n.getBuiltinModule(e)}return Sx(e)},"__cjs_getBuiltinModule"),{existsSync:Ax}=jx("node:fs");var Ox=Object.defineProperty,va=Vd((e,t)=>Ox(e,"name",{value:t,configurable:!0}),"r");const Kd=va(e=>{if(Ax(V(e,"package.json"))){const t=qs(V(e,"package.json"));if(t.name&&t.private!==!0)return"package.json"}},"packageJsonMatcher");va(async e=>{try{const o=await V0(e);return Z(o)}catch{}const t=await ft(".git/config",{...e&&{cwd:e},type:"file"});if(t)return Z(Z(t));const n=await ft(Kd,{...e&&{cwd:e},type:"file"});if(n)return Z(n);throw new Error("Could not find root directory")},"findPackageRoot");va(e=>{try{const o=K0(e);return Z(o)}catch{}const t=mt(".git/config",{...e&&{cwd:e},type:"file"});if(t)return Z(Z(t));const n=mt(Kd,{...e&&{cwd:e},type:"file"});if(n)return Z(n);throw new Error("Could not find root directory")},"findPackageRootSync");const _l=async e=>{try{const t=await e();return typeof t.rolldown=="function"?t.rolldown:void 0}catch{return}},Yd=async()=>{const e=await _l(()=>import("@rolldown/node"));if(e)return e;const t=await _l(()=>import("rolldown"));if(t)return t;throw new Error("Rolldown is not installed. Please install '@rolldown/node' or 'rolldown' to use bundler: 'rolldown'.")};var Rx=Object.defineProperty,Cx=(e,t)=>Rx(e,"name",{value:t,configurable:!0}),Tx=Object.defineProperty,Dt=Cx((e,t)=>Tx(e,"name",{value:t,configurable:!0}),"u");const Xd="__packem_cache_wrapped",Ns="__packem_watch_files",ct=Dt(e=>typeof e=="function"?e:e.handler,"getHandler"),ui=Dt(e=>{if(e&&typeof e=="object"&&"filter"in e)return e.filter},"getHookFilter"),Nl=new Map,_x=Dt(e=>{const t=JSON.stringify(e);let n=Nl.get(t);return n===void 0&&(n=Ke(t),Nl.set(t,n)),n},"hashResolveOptions"),Nx=Dt(e=>e!==null&&typeof e=="object"&&e[Xd]===!0,"isWrappedCacheValue"),Px=Dt(e=>e!==null&&typeof e=="object"&&Array.isArray(e[Ns]),"isWatchFilesCacheValue"),Eo=Dt(e=>Nx(e)?e.data:e,"unwrapCachedValue"),Ee=Dt((e,t,n="")=>{if(!t.isEnabled)return e;const o=V(n,e.name),r={...e,async buildEnd(l){e.buildEnd&&await ct(e.buildEnd).call(this,l)},async buildStart(l){e.buildStart&&await ct(e.buildStart).call(this,l)},async load(l){if(!e.load)return;const p=l.includes("?")?l.split("?")[0]:l;let c="";try{if(p&&Rm(p)){const h=Fp(p);c=Ke(h)}}catch{}const u=V("load",Ke(l),c),d=await t.get(u,o);if(d!==void 0)return Eo(d);const f=await ct(e.load).call(this,l);if(f==null)return f;const m=typeof f=="object"&&"code"in f?f:{data:f,[Xd]:!0};return t.set(u,m,o),f},name:`cached(${e.name})`,async resolveId(l,p,c){if(!e.resolveId)return;const u=V("resolveId",Ke(l),p?Ke(p):"",_x(c)),d=await t.get(u,o);if(d!==void 0)return Eo(d);const f=await ct(e.resolveId).call(this,l,p,c);return t.set(u,f,o),f},async transform(l,p){if(!e.transform)return;const c=V("transform",Ke(p),Ke(l)),u=await t.get(c,o);if(u!==void 0){const h=Eo(u);if(Px(h)){for(const v of h[Ns])this.addWatchFile(v);return Eo(h.result)}return h}const d=[],f=Object.create(this);f.addWatchFile=h=>{d.push(h),this.addWatchFile(h)};const m=await ct(e.transform).call(f,l,p);return d.length>0?t.set(c,{[Ns]:d,result:m},o):t.set(c,m,o),m}},i=ui(e.load),s=ui(e.resolveId),a=ui(e.transform);return i&&r.load&&(r.load={filter:i,handler:ct(r.load)}),s&&r.resolveId&&(r.resolveId={filter:s,handler:ct(r.resolveId)}),a&&r.transform&&(r.transform={filter:a,handler:ct(r.transform)}),r},"cachePlugin");var Mx=Object.defineProperty,Ix=(e,t)=>Mx(e,"name",{value:t,configurable:!0}),Wx=Object.defineProperty,Bx=Ix((e,t)=>Wx(e,"name",{value:t,configurable:!0}),"c");const Dx=Bx(()=>({name:"packem:fix-dynamic-import-extension",renderChunk(e,t,n){if(n.format==="es"||n.format==="cjs"){const o=new ke(e),r=n.format==="es"?"mjs":"cjs",i=/(import\(.*?)(?<!\.d)(\.ts)(?=['´"`]\))/g;let s=!1,a;for(;(a=i.exec(e))!==null;){const[,l,p]=a;if(l&&p){const c=a.index+l.length,u=c+p.length;o.overwrite(c,u,`.${r}`),s=!0}}if(s)return{code:o.toString(),map:n.sourcemap?o.generateMap({hires:!0}):void 0}}}}),"fixDynamicImportExtension");var Lx=Object.defineProperty,Fx=(e,t)=>Lx(e,"name",{value:t,configurable:!0}),qx=Object.defineProperty,zx=Fx((e,t)=>qx(e,"name",{value:t,configurable:!0}),"i");const Hx=zx(()=>({generateBundle(e,t){const n=[];for(const r of this.getModuleIds()){const i=this.getModuleInfo(r);if(i!==null&&!i.isExternal)for(const s of i.importedIds)n.push({source:r,target:s})}if(Array.isArray(n)&&n.length===0)return;const o=Object.keys(t);this.emitFile({fileName:`metafile-${o[0].replace(Ym,"")}-${e.format??"unknown"}.json`,source:JSON.stringify(n,void 0,2),type:"asset"})},name:"packem:metafile"}),"metafilePlugin");var Jx=Object.defineProperty,Gx=(e,t)=>Jx(e,"name",{value:t,configurable:!0}),Ux=Object.defineProperty,Vx=Gx((e,t)=>Ux(e,"name",{value:t,configurable:!0}),"r");const Kx=/^file:\/\//,Zd=Vx(()=>({name:"packem:resolve-file-url",resolveId:{filter:{id:Kx},handler(e){if(e.startsWith("file://"))return Zp(e)}}}),"resolveFileUrl");var Yx=Object.defineProperty,Xx=(e,t)=>Yx(e,"name",{value:t,configurable:!0}),Zx=Object.defineProperty,Qx=Xx((e,t)=>Zx(e,"name",{value:t,configurable:!0}),"s");const e1=/^(\w+)-runtime$/,t1=Qx(e=>{const t=rt(e).split(".");if(t.length>=2){const[n,o]=t.slice(-2),r=t[0]??"",i=e1.exec(n)?.[1];if(vr.includes(o)&&i&&i.length>0)return`${r}-${i}`}},"getCustomModuleLayer");var n1=Object.defineProperty,o1=(e,t)=>n1(e,"name",{value:t,configurable:!0}),r1=Object.defineProperty,i1=o1((e,t)=>r1(e,"name",{value:t,configurable:!0}),"t");const s1=/^use /,Un=i1(e=>(e.preserveDirectives??{directives:[]}).directives.map(t=>t.replace(s1,"")).find(t=>t!=="strict"),"getModuleLayer");var a1=Object.defineProperty,l1=(e,t)=>a1(e,"name",{value:t,configurable:!0}),c1=Object.defineProperty,rr=l1((e,t)=>c1(e,"name",{value:t,configurable:!0}),"p");const p1=/[\\/]node_modules[\\/]@swc[\\/]helper/,di=nh(e=>{let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.codePointAt(n);return(t>>>0).toString(36).slice(0,3)}),Qd=rr((e,t,n,o=new Set)=>{if(n.has(e))return n.get(e);if(o.has(e))return;o.add(e);const r=t(e);if(!r){n.set(e,void 0);return}const i=Un(r.meta);if(i)return n.set(e,i),i;let s;for(const a of r.importers){const l=Qd(a,t,n,o);if(l){s=l;break}}return n.set(e,s),s},"getEffectiveModuleLayer"),u1=rr((e,t,n)=>{const o=t(e);if(!o)return new Set;const r=new Set;for(const i of o.importers){const s=t(i);if(!s)continue;const a=Un(s.meta);if(a)r.add(a);else{const l=Qd(i,t,n,new Set([e]));l&&r.add(l)}}return r},"getImporterLayers"),d1=rr((e,t,n=!0)=>{const o=new Map,r=new Map;return rr(function(i,s){if(p1.test(i))return"cc";const a=s.getModuleInfo(i);if(!a)return;const{isEntry:l}=a,p=a.meta;let c=Un(p);if(c&&(c=di(c)),!l){const u=o.get(i);if(u)return u;const d=t1(i);if(d)return o.set(i,d),d}if(l&&c){const u=typeof s.getModuleIds=="function"?s.getModuleIds():(()=>{const d=new Set,f=[i];for(;f.length>0;){const m=f.pop();if(d.has(m))continue;d.add(m);const h=s.getModuleInfo(m);if(h)for(const v of h.importedIds)d.has(v)||f.push(v)}return d})();for(const d of u){const f=s.getModuleInfo(d);f&&Un(f.meta)===c&&(e.has(d)||e.set(d,new Set),e.get(d).add([i,c]))}}if(n&&!c&&!l){const u=u1(i,s.getModuleInfo,r);if(u.size>1){if(o.has(i))return o.get(i);const d=rt(i,rn(i)),f=[...u].toSorted((h,v)=>h.localeCompare(v)).join("-"),m=`${d}-${di(f)}`;return o.set(i,m),m}}if(c&&!l&&e.has(i)){const u=[...e.get(i)];if(u.some(([h])=>{if(t.some(v=>v.path===h)){const v=s.getModuleInfo(h);return Un(v?v.meta:{})===c}return!1}))return;if(u.every(([,h])=>h===c))return o.has(i)?o.get(i):void 0;const d=rt(i,rn(i)),f=di(c),m=`${d}-${f}`;return o.set(i,m),m}},"splitChunks")},"createSplitChunks");var f1=Object.defineProperty,m1=(e,t)=>f1(e,"name",{value:t,configurable:!0}),h1=Object.defineProperty,g1=m1((e,t)=>h1(e,"name",{value:t,configurable:!0}),"i");const Br=g1((e,t)=>{let n={};return e.name&&(n[e.name]=t.rootDir),n={...n,...t.alias},t.rollup.alias&&t.rollup.alias.entries&&(Array.isArray(t.rollup.alias.entries)?Object.assign(n,Object.fromEntries(t.rollup.alias.entries.map(o=>[o.find,o.replacement]))):Object.assign(n,t.rollup.alias.entries)),n},"resolveAliases");var v1=Object.defineProperty,y1=(e,t)=>v1(e,"name",{value:t,configurable:!0}),b1=Object.defineProperty,ya=y1((e,t)=>b1(e,"name",{value:t,configurable:!0}),"a");const $1=/\.tsx?$/,w1=/['"]use memo['"]/,x1=ya(e=>e.find(t=>t==="babel-plugin-react-compiler"||Array.isArray(t)&&t[0]==="babel-plugin-react-compiler"),"getReactCompilerPlugin"),k1=ya((e,t)=>{if(e.length===0)return;const n=x1(e);if(!(!n||!Array.isArray(n))&&n[1]?.compilationMode==="annotation"&&!w1.test(t)){const o=e.indexOf(n);o!==-1&&e.splice(o,1)}},"filterReactCompilerByAnnotation"),E1=ya(async(e,t,{filename:n,generatorOpts:o,sourceFileName:r,...i})=>{let s=[];i.plugins&&Array.isArray(i.plugins)&&(s=[...i.plugins]),s.length>0&&k1(s,e);const a=[];(t.endsWith(".jsx")||t.endsWith(".tsx"))&&a.push("jsx"),$1.test(t)&&a.push("typescript");const l=i.parserOpts?.plugins;l&&Array.isArray(l)&&a.unshift(...l);const p=[...new Set(a)],c=await bh(e,{...i,filename:n??t,generatorOpts:{...o,decoratorsBeforeExport:!0,importAttributesKeyword:"with"},parserOpts:{...i.parserOpts,allowAwaitOutsideFunction:!0,plugins:p.length>0?p:[],sourceType:"module"},plugins:s.length>0?s:[],sourceFileName:r??t});if(c?.code)return{code:c.code,map:c.map??void 0}},"transformCode");var S1=Object.defineProperty,j1=(e,t)=>S1(e,"name",{value:t,configurable:!0}),A1=Object.defineProperty,Qn=j1((e,t)=>A1(e,"name",{value:t,configurable:!0}),"i");const O1=20,R1=4,C1=eu("babel-runtime","plugins","babel","worker.js"),T1=Qn(e=>{const t=Qn(n=>{if(n===null)return!0;if(Array.isArray(n))return n.every(o=>t(o));switch(typeof n){case"boolean":case"number":case"string":case"undefined":return!0;case"object":return Object.values(n).every(o=>t(o));default:return!1}},"isSerializable");for(const n of Object.keys(e))if(!t(e[n]))return n},"findNonSerializableOption"),_1=Qn(()=>{let e;try{e=ws(Zp(import.meta.url))}catch{return}for(let t=0;t<6;t+=1){const n=eu(e,C1);if(Vs(n))return n;const o=ws(e);if(o===e)break;e=o}},"resolveWorkerScript"),N1=Qn(({exclude:e,filename:t,generatorOpts:n,include:o,parallel:r=!0,parallelThreshold:i=O1,sourceFileName:s,...a})=>{const l=Qe(o,e??Ot),p={...a,filename:t,generatorOpts:n,sourceFileName:s};let c=0,u,d=r===!1;const f=Qn(()=>{if(d)return;if(u)return u;if(c<i)return;if(T1(p)!==void 0){d=!0;return}const m=_1();if(!m){d=!0;return}const h=typeof r=="number"?r:Math.min(mh().length,R1);return u=yh.pool(m,{maxWorkers:h,workerType:"thread"}),u},"ensurePool");return{async closeBundle(){this.meta.watchMode||(await u?.terminate(),u=void 0)},async closeWatcher(){await u?.terminate(),u=void 0},name:"packem:babel",async transform(m,h){if(!l(h))return;c+=1;const v=f();if(v)return v.exec("transform",[m,h,p]);const y=await E1(m,h,p);if(y)return{code:y.code,map:y.map??void 0}}}},"babelTransformPlugin");var P1=Object.defineProperty,M1=(e,t)=>P1(e,"name",{value:t,configurable:!0}),I1=Object.defineProperty,W1=M1((e,t)=>I1(e,"name",{value:t,configurable:!0}),"u");const B1=W1((e,t)=>{const n=new Map,o={copyOnce:!0,exactFileNames:!0,flatten:!1,...e};let{targets:r}=o;return Array.isArray(r)?r=r.map(i=>{if(typeof i=="string")return{src:i};if(typeof i=="object"&&"src"in i)return i}).filter(Boolean):typeof r=="string"&&(r=[{src:r}]),{async buildStart(){const i=await Promise.all(r.flatMap(s=>Array.isArray(s.src)?s.src.map(a=>({...s,src:a})):[s]).map(async s=>await Cm(bs(s.src),{ignore:bs(s.exclude).filter(Boolean)}).then(a=>({dest:s.dest??"",parent:Tm(s.src),src:a}))));for(const s of i)for(const a of s.src){let l;n.has(a)?l=n.get(a):(l={copied:[],dest:[],timestamp:0},n.set(a,l));const p=o.flatten?Ip(s.dest):V(s.dest,Ae(s.parent,Z(a)));l.dest.includes(p)||l.dest.push(p),this.addWatchFile(a)}t.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all(Array.from(n,async([s,a])=>{let l;try{const p=await so(s);if(!p.isFile())return;const c=p.mtime.getTime();c>a.timestamp&&(a.timestamp=c,a.copied=[]),l=await Nt(s,{buffer:!0})}catch(p){t.error({context:[p],message:`error reading file ${s}`,prefix:"plugin:copy"});return}for(const p of a.dest){if(o.copyOnce&&a.copied.includes(p))continue;const c=rt(s),u=V(p,c);try{this.emitFile({[o.exactFileNames?"fileName":"name"]:u,source:l,type:"asset"}),t.debug({message:`copied ${s} → ${u}`,prefix:"plugin:copy"}),a.copied.push(p)}catch(d){t.error({context:[d],message:`error copying file ${s} → ${u}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");var D1=Object.defineProperty,ba=(e,t)=>D1(e,"name",{value:t,configurable:!0});const ef={"application/prs.cww":["cww"],"application/prs.xsf+xml":["xsf"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["*xfdf"],"application/vnd.age":["age"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.autodesk.fbx":["fbx"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dcmp+xml":["dcmp"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["*fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.slides":["ggs"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.drawing":["gdraw"],"application/vnd.google-apps.form":["gform"],"application/vnd.google-apps.jam":["gjam"],"application/vnd.google-apps.map":["gmap"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.script":["gscript"],"application/vnd.google-apps.site":["gsite"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.gov.sk.xmldatacontainer+xml":["xdcf"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["*mpp","mpt"],"application/vnd.ms-visio.viewer":["vdx"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.nato.bindingdataobject+xml":["bdo"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.procrate.brushset":["brushset"],"application/vnd.procreate.brush":["brush"],"application/vnd.procreate.dream":["drm"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.pwg-xhtml-print+xml":["xhtm"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml","uo"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw","vsdx","vtx"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blender":["blend"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-compressed":["*rar"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-ipynb+json":["ipynb"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["*prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["*sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zip-compressed":["*zip"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["*aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif","btf"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.blockfact.facti":["facti"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-adobe-dng":["dng"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.bary":["bary"],"model/vnd.cld":["cld"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["*mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.pytha.pyox":["pyo","pyox"],"model/vnd.sap.vds":["vds"],"model/vnd.usda":["usda"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.familysearch.gedcom":["ged"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};Object.freeze(ef);const tf={"application/andrew-inset":["ez"],"application/appinstaller":["appinstaller"],"application/applixware":["aw"],"application/appx":["appx"],"application/appxbundle":["appxbundle"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/automationml-aml+xml":["aml"],"application/automationml-amlx+zip":["amlx"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cpl+xml":["cpl"],"application/cu-seeme":["cu"],"application/cwl":["cwl"],"application/dash+xml":["mpd"],"application/dash-patch+xml":["mpp"],"application/davmount+xml":["davmount"],"application/dicom":["dcm"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdf":["fdf"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["*js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/media-policy-dataset+xml":["mpf"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["*mp4","*mpg4","mp4s","m4p"],"application/msix":["msix"],"application/msixbundle":["msixbundle"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg","one","onea"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-keys":["asc"],"application/pgp-signature":["sig","*asc"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/sql":["sql"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/watcherinfo+xml":["wif"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xfdf":["xfdf"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"application/zip+dotlottie":["lottie"],"audio/3gpp":["*3gpp"],"audio/aac":["adts","aac"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a","m4b"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avci":["avci"],"image/avcs":["avcs"],"image/avif":["avif"],"image/bmp":["bmp","dib"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/dpx":["dpx"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/ief":["ief"],"image/jaii":["jaii"],"image/jais":["jais"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpg","jpeg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm","jpgm"],"image/jpx":["jpx","jpf"],"image/jxl":["jxl"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/pjpeg":["jfif"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime","mht","mhtml"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/jt":["jt"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/prc":["prc"],"model/step":["step","stp","stpnc","p21","210"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/u3d":["u3d"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/javascript":["js","mjs"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["md","markdown"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/wgsl":["wgsl"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","*jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts","m2t","m2ts","mts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};Object.freeze(tf);var L1=Object.defineProperty,F1=ba((e,t)=>L1(e,"name",{value:t,configurable:!0}),"g"),Ne=ba(function(e,t,n,o){if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?o:n==="a"?o.call(e):o?o.value:t.get(e)},"n"),Vt,Ln,Et;let q1=class{static{ba(this,"p")}static{F1(this,"Mime")}constructor(...t){Vt.set(this,new Map),Ln.set(this,new Map),Et.set(this,new Map);for(const n of t)this.define(n)}define(t,n=!1){for(let[o,r]of Object.entries(t)){o=o.toLowerCase(),r=r.map(a=>a.toLowerCase()),Ne(this,Et,"f").has(o)||Ne(this,Et,"f").set(o,new Set);const i=Ne(this,Et,"f").get(o);let s=!0;for(let a of r){const l=a.startsWith("*");if(a=l?a.slice(1):a,i?.add(a),s&&Ne(this,Ln,"f").set(o,a),s=!1,l)continue;const p=Ne(this,Vt,"f").get(a);if(p&&p!=o&&!n)throw new Error(`"${o} -> ${a}" conflicts with "${p} -> ${a}". Pass \`force=true\` to override this definition.`);Ne(this,Vt,"f").set(a,o)}}return this}getType(t){if(typeof t!="string")return null;const n=t.replace(/^.*[/\\]/s,"").toLowerCase(),o=n.replace(/^.*\./s,"").toLowerCase(),r=n.length<t.length;return!(o.length<n.length-1)&&r?null:Ne(this,Vt,"f").get(o)??null}getExtension(t){return typeof t!="string"?null:(t=t?.split?.(";")[0],(t&&Ne(this,Ln,"f").get(t.trim().toLowerCase()))??null)}getAllExtensions(t){return typeof t!="string"?null:Ne(this,Et,"f").get(t.toLowerCase())??null}_freeze(){this.define=()=>{throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances")},Object.freeze(this);for(const t of Ne(this,Et,"f").values())Object.freeze(t);return this}_getTestState(){return{types:Ne(this,Vt,"f"),extensions:Ne(this,Ln,"f")}}};Vt=new WeakMap,Ln=new WeakMap,Et=new WeakMap;const nf=new q1(tf,ef)._freeze();var z1=Object.defineProperty,H1=(e,t)=>z1(e,"name",{value:t,configurable:!0}),J1=Object.defineProperty,G1=H1((e,t)=>J1(e,"name",{value:t,configurable:!0}),"l");const U1=/\?data-uri/,V1=G1((e={})=>{const t=Qe(e.include??[U1],e.exclude);return{async load(n){if(!t(n)||!n.includes("?data-uri"))return;const o=new URL(n,"file://"),r=o.pathname,i=o.searchParams.get("encoding")??"tiny",s=o.searchParams.has("srcset")||e.srcset;this.addWatchFile(r);const a=nf.getType(r)??"application/octet-stream";if(a==="image/svg+xml"){const c=await Nt(r,{buffer:!1}),u=i==="css"?Xm(c):Zm(c);return`export default "${s?u.replaceAll(" ","%20"):u}"`}const l=await Nt(r,{buffer:!0}),p=Buffer.from(l).toString("base64");return`export default "${`${a.startsWith("text/")?`data:${a};charset=utf-8;base64,`:`data:${a};base64,`}${p}`}"`},name:"packem:data-uri"}},"dataUriPlugin");var K1=Object.defineProperty,Y1=(e,t)=>K1(e,"name",{value:t,configurable:!0}),X1=Object.defineProperty,ve=Y1((e,t)=>X1(e,"name",{value:t,configurable:!0}),"u");const Z1=/\.[mc]?tsx?(?:\?.*)?$/,Q1=/(?:\.[tj]sx?|\/index\.[tj]sx?)(?:\?.*)?$/,e2=/^\s*export/,t2=/^(?:import|export)\s+([\w$]+)/,n2=/([\w$]+)\s*,\s*\{|\}\s*,\s*([\w$]+)/,fi=/[{,]\s*(type\s+)?([\w$]+)(?:\s+as\s+([\w$]+))?/gi,o2=/default\s+([a-zA-Z_$][\w$]*)(?:[;\n]|$)/,r2=/([\w$]+)\s*as\s*$/,i2=/^export\s+\*(?!\s+as)/,s2=/\bas\b/,a2={exports:[],facade:!1,imports:[]},of=ve(e=>Z1.test(e),"isSourceFile"),rf=ve(e=>e.includes("/build/cache/vite/")||e.includes("/node_modules/"),"isIgnoredModule"),l2=ve((e,t)=>rf(e)?!1:Q1.test(e)?!0:t.possibleBarrelFiles?t.possibleBarrelFiles.some(n=>typeof n=="string"?e.includes(n):n.test(e)):!1,"isPossibleBarrelSpecifier"),sf=ve(e=>e2.test(e)?"export":"import","getDeclarationKind"),{parseAsync:c2}=kh,af=ve(async(e,t,n)=>{try{const{output:o}=await c2({input:[{code:t,filename:e}]});return o[0]}catch(o){return n.debug({message:`Failed to parse ${e}:
|
|
63
|
+
${o instanceof Error?o.message:String(o)}`,prefix:"plugin:debarrel"}),a2}},"safeParse"),p2=ve(async(e,t,n,o)=>{const r=e.parseCache.get(t);if(r!==void 0)return r;const i=await af(t,n,o);return e.parseCache.set(t,i),i},"parsePotentialBarrelFile"),lf=ve((e,t)=>{const n=e.fileCache.get(t);if(n!==void 0)return n;const o=tu.readFile(t,"utf8");return e.fileCache.set(t,o),o},"readFileCached"),cf=ve(e=>{fi.lastIndex=0;const t=[];if(e.includes("*"))return t;if(!e.includes("{")){const r=t2.exec(e);return r&&t.push({imported:"default",local:r[1]}),t}const n=n2.exec(e);n&&t.push({imported:"default",local:n[1]??n[2]});let o=fi.exec(e);for(;o!==null;)!o[1]&&o[2]&&t.push({imported:o[2],local:o[3]}),o=fi.exec(e);return t},"getImportNames"),u2=ve((e,t,n)=>{let o=e.ln,r=t.find(i=>i.ss<e.s&&i.se>e.e&&i.d===-1);if(!r?.n){const i=o??o2.exec(n.slice(e.s))?.[1];i&&(r=t.find(s=>{const a=cf(n.slice(s.ss,s.s)).find(l=>l.local===i);return a&&(o=a.imported),a}))}if(r&&!o){const i=n.slice(r.ss,e.s);if(!i.includes("*")){const s=r2.exec(i)?.[1];s&&(o=s)}}return{imp:r,localExportName:o}},"findMatchingImport"),Pl=new Map,d2=ve((e,t)=>{if(sf(e)!=="import"||!s2.test(e))return;let n=Pl.get(t);return n||(n=new RegExp(String.raw`(\w+)\s+as\s+${t}(?!\w)`),Pl.set(t,n)),n.exec(e)?.[0]},"findAliasedImportName");let eo;const f2=ve(async(e,t,n,o,r,i,s,a)=>{const{resolve:l}=e,p=u2(o,r,n),{imp:c,localExportName:u}=p;if(!c?.n)return{exportName:i,id:t,resolved:!0};if(c.d>-1)return{exportName:i,id:t,resolved:!0};const d=n.slice(c.ss,o.s),f=d2(d,i),m=(await l(c.n,t))?.id;return m?l2(m,s)?eo(e,m,u??o.n,s,a):{aliasedImportName:f,exportName:u??i,id:m,resolved:!1}:{aliasedImportName:f,exportName:u,id:t,resolved:!1}},"resolveExportThroughBarrel"),m2=ve(async(e,t,n,o,r,i,s)=>{const a=o.filter(l=>i2.test(n.slice(l.ss,l.s)));if(a.length===1){const l=a[0]?.n,p=(l?await e.resolve(l,t):void 0)?.id;if(!p)return;const c=await eo(e,p,r,i,s);if(c.resolved)return c}else if(a.length>1){const l=(await Promise.all(a.map(async p=>{const c=p.n;if(!c)return;const u=(await e.resolve(c,t))?.id;if(u)return eo(e,u,r,i,s)}))).find(p=>p?.resolved);if(l)return l}},"resolveWildcardReExports");eo=ve(async(e,t,n,o,r)=>{const i=await lf(e,t),{exports:s,imports:a}=await p2(e,t,i,r);for(const l of s)if(l.n===n)return await f2(e,t,i,l,a,n,o,r);return await m2(e,t,i,a,n,o,r)||{exportName:n,id:t,resolved:!1}},"resolveThroughBarrel");const h2=ve((e,t,n)=>{const{aliasedImportName:o,exportName:r}=e,i=t.local??t.imported;if(o)return`{${o}}`;if(r==="default"&&n!=="export")return i;const s=r??i;return`{${s!==i?`${s} as ${i}`:s}}`},"getDeclarationClause"),g2=ve(async(e,t,n,o,r)=>{const i=[],s=await lf(e,t),{imports:a}=await af(t,s,r);return await Promise.all(a.map(async l=>{if(!l.n||l.d!==-1)return;const p=s.slice(l.ss,l.s),c=cf(p);if(c.length===0)return;const u=(await e.resolve(l.n,t))?.id;if(!u||!of(u)||rf(u))return;const d=sf(p);try{const f=await Promise.all(c.map(async m=>{const h=await eo(e,u,m.imported,o,r),v=h2(h,m,d),y=JSON.stringify(h.id);return`${d} ${v} from ${y}`}));i.push([l.ss,l.se,f.join(";")])}catch(f){r.warn({context:{error:f},message:String(f),prefix:"plugin:debarrel"})}})),i},"getDebarrelModifications"),v2=ve((e,t,n,o)=>{if(n.length===0)return;const r=new ke(t,{filename:e});for(const[i,s,a]of n)r.update(i,s,a);return{code:r.toString(),map:o?r.generateMap({file:e}):void 0}},"applyModifications"),y2=ve((e,t)=>{const n=new Map,o=new Map,r=ve(()=>{n.clear(),o.clear()},"purgeCaches"),i=e.include?Qe(e.include,[]):void 0;let s=!0;return{buildEnd:r,buildStart:r,async load(a){const l=n.get(a);if(l)return await l},name:"packem:debarrel",options(a){const{output:l}=a;let p;Array.isArray(l)?p=l[0]?.sourcemap:l&&(p=l.sourcemap),p===!1&&(s=!1)},async transform(a,l){if(l.includes("\0")||l.includes("?")||!of(l)||i&&!i(l))return;const p={fileCache:n,parseCache:o,resolve:this.resolve.bind(this)},c=await g2(p,l,a,e,t);return v2(l,a,c,s)},watchChange(a){n.delete(a),o.delete(a)}}},"debarrelPlugin");var mi,Ml;function b2(){if(Ml)return mi;Ml=1;const e=Oe();return mi=(n,o,r,i,s)=>{typeof r=="string"&&(s=i,i=r,r=void 0);try{return new e(n instanceof e?n.version:n,r).inc(o,i,s).version}catch{return null}},mi}var hi,Il;function $2(){if(Il)return hi;Il=1;const e=ro();return hi=(n,o)=>{const r=e(n,null,!0),i=e(o,null,!0),s=r.compare(i);if(s===0)return null;const a=s>0,l=a?r:i,p=a?i:r,c=!!l.prerelease.length;if(p.prerelease.length&&!c){if(!p.patch&&!p.minor)return"major";if(p.compareMain(l)===0)return p.minor&&!p.patch?"minor":"patch"}const u=c?"pre":"";return r.major!==i.major?u+"major":r.minor!==i.minor?u+"minor":r.patch!==i.patch?u+"patch":"prerelease"},hi}var gi,Wl;function w2(){if(Wl)return gi;Wl=1;const e=Oe();return gi=(n,o)=>new e(n,o).major,gi}var vi,Bl;function x2(){if(Bl)return vi;Bl=1;const e=Oe();return vi=(n,o)=>new e(n,o).minor,vi}var yi,Dl;function k2(){if(Dl)return yi;Dl=1;const e=Oe();return yi=(n,o)=>new e(n,o).patch,yi}var bi,Ll;function E2(){if(Ll)return bi;Ll=1;const e=ro();return bi=(n,o)=>{const r=e(n,o);return r&&r.prerelease.length?r.prerelease:null},bi}var $i,Fl;function He(){if(Fl)return $i;Fl=1;const e=Oe();return $i=(n,o,r)=>new e(n,r).compare(new e(o,r)),$i}var wi,ql;function S2(){if(ql)return wi;ql=1;const e=He();return wi=(n,o,r)=>e(o,n,r),wi}var xi,zl;function j2(){if(zl)return xi;zl=1;const e=He();return xi=(n,o)=>e(n,o,!0),xi}var ki,Hl;function $a(){if(Hl)return ki;Hl=1;const e=Oe();return ki=(n,o,r)=>{const i=new e(n,r),s=new e(o,r);return i.compare(s)||i.compareBuild(s)},ki}var Ei,Jl;function A2(){if(Jl)return Ei;Jl=1;const e=$a();return Ei=(n,o)=>n.sort((r,i)=>e(r,i,o)),Ei}var Si,Gl;function O2(){if(Gl)return Si;Gl=1;const e=$a();return Si=(n,o)=>n.sort((r,i)=>e(i,r,o)),Si}var ji,Ul;function Dr(){if(Ul)return ji;Ul=1;const e=He();return ji=(n,o,r)=>e(n,o,r)>0,ji}var Ai,Vl;function wa(){if(Vl)return Ai;Vl=1;const e=He();return Ai=(n,o,r)=>e(n,o,r)<0,Ai}var Oi,Kl;function pf(){if(Kl)return Oi;Kl=1;const e=He();return Oi=(n,o,r)=>e(n,o,r)===0,Oi}var Ri,Yl;function uf(){if(Yl)return Ri;Yl=1;const e=He();return Ri=(n,o,r)=>e(n,o,r)!==0,Ri}var Ci,Xl;function xa(){if(Xl)return Ci;Xl=1;const e=He();return Ci=(n,o,r)=>e(n,o,r)>=0,Ci}var Ti,Zl;function ka(){if(Zl)return Ti;Zl=1;const e=He();return Ti=(n,o,r)=>e(n,o,r)<=0,Ti}var _i,Ql;function df(){if(Ql)return _i;Ql=1;const e=pf(),t=uf(),n=Dr(),o=xa(),r=wa(),i=ka();return _i=(a,l,p,c)=>{switch(l){case"===":return typeof a=="object"&&(a=a.version),typeof p=="object"&&(p=p.version),a===p;case"!==":return typeof a=="object"&&(a=a.version),typeof p=="object"&&(p=p.version),a!==p;case"":case"=":case"==":return e(a,p,c);case"!=":return t(a,p,c);case">":return n(a,p,c);case">=":return o(a,p,c);case"<":return r(a,p,c);case"<=":return i(a,p,c);default:throw new TypeError(`Invalid operator: ${l}`)}},_i}var Ni,ec;function R2(){if(ec)return Ni;ec=1;const e=Oe(),t=ro(),{safeRe:n,t:o}=gr();return Ni=(i,s)=>{if(i instanceof e)return i;if(typeof i=="number"&&(i=String(i)),typeof i!="string")return null;s=s||{};let a=null;if(!s.rtl)a=i.match(s.includePrerelease?n[o.COERCEFULL]:n[o.COERCE]);else{const f=s.includePrerelease?n[o.COERCERTLFULL]:n[o.COERCERTL];let m;for(;(m=f.exec(i))&&(!a||a.index+a[0].length!==i.length);)(!a||m.index+m[0].length!==a.index+a[0].length)&&(a=m),f.lastIndex=m.index+m[1].length+m[2].length;f.lastIndex=-1}if(a===null)return null;const l=a[2],p=a[3]||"0",c=a[4]||"0",u=s.includePrerelease&&a[5]?`-${a[5]}`:"",d=s.includePrerelease&&a[6]?`+${a[6]}`:"";return t(`${l}.${p}.${c}${u}${d}`,s)},Ni}var Pi,tc;function C2(){if(tc)return Pi;tc=1;const e=ro(),t=Js(),n=Oe(),o=(a,l,p)=>{if(!t.RELEASE_TYPES.includes(l))return null;const c=r(a,p);return c&&i(c,l)},r=(a,l)=>{const p=a instanceof n?a.version:a;return e(p,l)},i=(a,l)=>{if(s(l))return a.version;switch(a.prerelease=[],l){case"major":a.minor=0,a.patch=0;break;case"minor":a.patch=0;break}return a.format()},s=a=>a.startsWith("pre");return Pi=o,Pi}var Mi,nc;function T2(){if(nc)return Mi;nc=1;class e{constructor(){this.max=1e3,this.map=new Map}get(n){const o=this.map.get(n);if(o!==void 0)return this.map.delete(n),this.map.set(n,o),o}delete(n){return this.map.delete(n)}set(n,o){if(!this.delete(n)&&o!==void 0){if(this.map.size>=this.max){const r=this.map.keys().next().value;this.delete(r)}this.map.set(n,o)}return this}}return Mi=e,Mi}var Ii,oc;function Je(){if(oc)return Ii;oc=1;const e=/\s+/g;class t{constructor(O,F){if(F=r(F),O instanceof t)return O.loose===!!F.loose&&O.includePrerelease===!!F.includePrerelease?O:new t(O.raw,F);if(O instanceof i)return this.raw=O.value,this.set=[[O]],this.formatted=void 0,this;if(this.options=F,this.loose=!!F.loose,this.includePrerelease=!!F.includePrerelease,this.raw=O.trim().replace(e," "),this.set=this.raw.split("||").map(I=>this.parseRange(I.trim())).filter(I=>I.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const I=this.set[0];if(this.set=this.set.filter(P=>!y(P[0])),this.set.length===0)this.set=[I];else if(this.set.length>1){for(const P of this.set)if(P.length===1&&g(P[0])){this.set=[P];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let O=0;O<this.set.length;O++){O>0&&(this.formatted+="||");const F=this.set[O];for(let I=0;I<F.length;I++)I>0&&(this.formatted+=" "),this.formatted+=F[I].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(O){O=O.replace(v,"");const F=((this.options.includePrerelease&&m)|(this.options.loose&&h))+":"+O,I=o.get(F);if(I)return I;const P=this.options.loose,M=P?l[c.HYPHENRANGELOOSE]:l[c.HYPHENRANGE];O=O.replace(M,G(this.options.includePrerelease)),s("hyphen replace",O),O=O.replace(l[c.COMPARATORTRIM],u),s("comparator trim",O),O=O.replace(l[c.TILDETRIM],d),s("tilde trim",O),O=O.replace(l[c.CARETTRIM],f),s("caret trim",O);let q=O.split(" ").map(K=>b(K,this.options)).join(" ").split(/\s+/).map(K=>J(K,this.options));P&&(q=q.filter(K=>(s("loose invalid filter",K,this.options),!!K.match(l[c.COMPARATORLOOSE])))),s("range list",q);const U=new Map,B=q.map(K=>new i(K,this.options));for(const K of B){if(y(K))return[K];U.set(K.value,K)}U.size>1&&U.has("")&&U.delete("");const D=[...U.values()];return o.set(F,D),D}intersects(O,F){if(!(O instanceof t))throw new TypeError("a Range is required");return this.set.some(I=>$(I,F)&&O.set.some(P=>$(P,F)&&I.every(M=>P.every(q=>M.intersects(q,F)))))}test(O){if(!O)return!1;if(typeof O=="string")try{O=new a(O,this.options)}catch{return!1}for(let F=0;F<this.set.length;F++)if(H(this.set[F],O,this.options))return!0;return!1}}Ii=t;const n=T2(),o=new n,r=qp(),i=Lr(),s=zp(),a=Oe(),{safeRe:l,src:p,t:c,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=gr(),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:h}=Js(),v=new RegExp(p[c.BUILD],"g"),y=_=>_.value==="<0.0.0-0",g=_=>_.value==="",$=(_,O)=>{let F=!0;const I=_.slice();let P=I.pop();for(;F&&I.length;)F=I.every(M=>P.intersects(M,O)),P=I.pop();return F},b=(_,O)=>(_=_.replace(l[c.BUILD],""),s("comp",_,O),_=k(_,O),s("caret",_),_=E(_,O),s("tildes",_),_=S(_,O),s("xrange",_),_=N(_,O),s("stars",_),_),w=_=>!_||_.toLowerCase()==="x"||_==="*",E=(_,O)=>_.trim().split(/\s+/).map(F=>x(F,O)).join(" "),x=(_,O)=>{const F=O.loose?l[c.TILDELOOSE]:l[c.TILDE];return _.replace(F,(I,P,M,q,U)=>{s("tilde",_,I,P,M,q,U);let B;return w(P)?B="":w(M)?B=`>=${P}.0.0 <${+P+1}.0.0-0`:w(q)?B=`>=${P}.${M}.0 <${P}.${+M+1}.0-0`:U?(s("replaceTilde pr",U),B=`>=${P}.${M}.${q}-${U} <${P}.${+M+1}.0-0`):B=`>=${P}.${M}.${q} <${P}.${+M+1}.0-0`,s("tilde return",B),B})},k=(_,O)=>_.trim().split(/\s+/).map(F=>j(F,O)).join(" "),j=(_,O)=>{s("caret",_,O);const F=O.loose?l[c.CARETLOOSE]:l[c.CARET],I=O.includePrerelease?"-0":"";return _.replace(F,(P,M,q,U,B)=>{s("caret",_,P,M,q,U,B);let D;return w(M)?D="":w(q)?D=`>=${M}.0.0${I} <${+M+1}.0.0-0`:w(U)?M==="0"?D=`>=${M}.${q}.0${I} <${M}.${+q+1}.0-0`:D=`>=${M}.${q}.0${I} <${+M+1}.0.0-0`:B?(s("replaceCaret pr",B),M==="0"?q==="0"?D=`>=${M}.${q}.${U}-${B} <${M}.${q}.${+U+1}-0`:D=`>=${M}.${q}.${U}-${B} <${M}.${+q+1}.0-0`:D=`>=${M}.${q}.${U}-${B} <${+M+1}.0.0-0`):(s("no pr"),M==="0"?q==="0"?D=`>=${M}.${q}.${U}${I} <${M}.${q}.${+U+1}-0`:D=`>=${M}.${q}.${U}${I} <${M}.${+q+1}.0-0`:D=`>=${M}.${q}.${U} <${+M+1}.0.0-0`),s("caret return",D),D})},S=(_,O)=>(s("replaceXRanges",_,O),_.split(/\s+/).map(F=>R(F,O)).join(" ")),R=(_,O)=>{_=_.trim();const F=O.loose?l[c.XRANGELOOSE]:l[c.XRANGE];return _.replace(F,(I,P,M,q,U,B)=>{s("xRange",_,I,P,M,q,U,B);const D=w(M),K=D||w(q),z=K||w(U),A=z;return P==="="&&A&&(P=""),B=O.includePrerelease?"-0":"",D?P===">"||P==="<"?I="<0.0.0-0":I="*":P&&A?(K&&(q=0),U=0,P===">"?(P=">=",K?(M=+M+1,q=0,U=0):(q=+q+1,U=0)):P==="<="&&(P="<",K?M=+M+1:q=+q+1),P==="<"&&(B="-0"),I=`${P+M}.${q}.${U}${B}`):K?I=`>=${M}.0.0${B} <${+M+1}.0.0-0`:z&&(I=`>=${M}.${q}.0${B} <${M}.${+q+1}.0-0`),s("xRange return",I),I})},N=(_,O)=>(s("replaceStars",_,O),_.trim().replace(l[c.STAR],"")),J=(_,O)=>(s("replaceGTE0",_,O),_.trim().replace(l[O.includePrerelease?c.GTE0PRE:c.GTE0],"")),G=_=>(O,F,I,P,M,q,U,B,D,K,z,A)=>(w(I)?F="":w(P)?F=`>=${I}.0.0${_?"-0":""}`:w(M)?F=`>=${I}.${P}.0${_?"-0":""}`:q?F=`>=${F}`:F=`>=${F}${_?"-0":""}`,w(D)?B="":w(K)?B=`<${+D+1}.0.0-0`:w(z)?B=`<${D}.${+K+1}.0-0`:A?B=`<=${D}.${K}.${z}-${A}`:_?B=`<${D}.${K}.${+z+1}-0`:B=`<=${B}`,`${F} ${B}`.trim()),H=(_,O,F)=>{for(let I=0;I<_.length;I++)if(!_[I].test(O))return!1;if(O.prerelease.length&&!F.includePrerelease){for(let I=0;I<_.length;I++)if(s(_[I].semver),_[I].semver!==i.ANY&&_[I].semver.prerelease.length>0){const P=_[I].semver;if(P.major===O.major&&P.minor===O.minor&&P.patch===O.patch)return!0}return!1}return!0};return Ii}var Wi,rc;function Lr(){if(rc)return Wi;rc=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(c,u){if(u=n(u),c instanceof t){if(c.loose===!!u.loose)return c;c=c.value}c=c.trim().split(/\s+/).join(" "),s("comparator",c,u),this.options=u,this.loose=!!u.loose,this.parse(c),this.semver===e?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(c){const u=this.options.loose?o[r.COMPARATORLOOSE]:o[r.COMPARATOR],d=c.match(u);if(!d)throw new TypeError(`Invalid comparator: ${c}`);this.operator=d[1]!==void 0?d[1]:"",this.operator==="="&&(this.operator=""),d[2]?this.semver=new a(d[2],this.options.loose):this.semver=e}toString(){return this.value}test(c){if(s("Comparator.test",c,this.options.loose),this.semver===e||c===e)return!0;if(typeof c=="string")try{c=new a(c,this.options)}catch{return!1}return i(c,this.operator,this.semver,this.options)}intersects(c,u){if(!(c instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new l(c.value,u).test(this.value):c.operator===""?c.value===""?!0:new l(this.value,u).test(c.semver):(u=n(u),u.includePrerelease&&(this.value==="<0.0.0-0"||c.value==="<0.0.0-0")||!u.includePrerelease&&(this.value.startsWith("<0.0.0")||c.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&c.operator.startsWith(">")||this.operator.startsWith("<")&&c.operator.startsWith("<")||this.semver.version===c.semver.version&&this.operator.includes("=")&&c.operator.includes("=")||i(this.semver,"<",c.semver,u)&&this.operator.startsWith(">")&&c.operator.startsWith("<")||i(this.semver,">",c.semver,u)&&this.operator.startsWith("<")&&c.operator.startsWith(">")))}}Wi=t;const n=qp(),{safeRe:o,t:r}=gr(),i=df(),s=zp(),a=Oe(),l=Je();return Wi}var Bi,ic;function fo(){if(ic)return Bi;ic=1;const e=Je();return Bi=(n,o,r)=>{try{o=new e(o,r)}catch{return!1}return o.test(n)},Bi}var Di,sc;function _2(){if(sc)return Di;sc=1;const e=Je();return Di=(n,o)=>new e(n,o).set.map(r=>r.map(i=>i.value).join(" ").trim().split(" ")),Di}var Li,ac;function N2(){if(ac)return Li;ac=1;const e=Oe(),t=Je();return Li=(o,r,i)=>{let s=null,a=null,l=null;try{l=new t(r,i)}catch{return null}return o.forEach(p=>{l.test(p)&&(!s||a.compare(p)===-1)&&(s=p,a=new e(s,i))}),s},Li}var Fi,lc;function P2(){if(lc)return Fi;lc=1;const e=Oe(),t=Je();return Fi=(o,r,i)=>{let s=null,a=null,l=null;try{l=new t(r,i)}catch{return null}return o.forEach(p=>{l.test(p)&&(!s||a.compare(p)===1)&&(s=p,a=new e(s,i))}),s},Fi}var qi,cc;function M2(){if(cc)return qi;cc=1;const e=Oe(),t=Je(),n=Dr();return qi=(r,i)=>{r=new t(r,i);let s=new e("0.0.0");if(r.test(s)||(s=new e("0.0.0-0"),r.test(s)))return s;s=null;for(let a=0;a<r.set.length;++a){const l=r.set[a];let p=null;l.forEach(c=>{const u=new e(c.semver.version);switch(c.operator){case">":u.prerelease.length===0?u.patch++:u.prerelease.push(0),u.raw=u.format();case"":case">=":(!p||n(u,p))&&(p=u);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${c.operator}`)}}),p&&(!s||n(s,p))&&(s=p)}return s&&r.test(s)?s:null},qi}var zi,pc;function I2(){if(pc)return zi;pc=1;const e=Je();return zi=(n,o)=>{try{return new e(n,o).range||"*"}catch{return null}},zi}var Hi,uc;function Ea(){if(uc)return Hi;uc=1;const e=Oe(),t=Lr(),{ANY:n}=t,o=Je(),r=fo(),i=Dr(),s=wa(),a=ka(),l=xa();return Hi=(c,u,d,f)=>{c=new e(c,f),u=new o(u,f);let m,h,v,y,g;switch(d){case">":m=i,h=a,v=s,y=">",g=">=";break;case"<":m=s,h=l,v=i,y="<",g="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(r(c,u,f))return!1;for(let $=0;$<u.set.length;++$){const b=u.set[$];let w=null,E=null;if(b.forEach(x=>{x.semver===n&&(x=new t(">=0.0.0")),w=w||x,E=E||x,m(x.semver,w.semver,f)?w=x:v(x.semver,E.semver,f)&&(E=x)}),w.operator===y||w.operator===g||(!E.operator||E.operator===y)&&h(c,E.semver)||E.operator===g&&v(c,E.semver))return!1}return!0},Hi}var Ji,dc;function W2(){if(dc)return Ji;dc=1;const e=Ea();return Ji=(n,o,r)=>e(n,o,">",r),Ji}var Gi,fc;function B2(){if(fc)return Gi;fc=1;const e=Ea();return Gi=(n,o,r)=>e(n,o,"<",r),Gi}var Ui,mc;function D2(){if(mc)return Ui;mc=1;const e=Je();return Ui=(n,o,r)=>(n=new e(n,r),o=new e(o,r),n.intersects(o,r)),Ui}var Vi,hc;function L2(){if(hc)return Vi;hc=1;const e=fo(),t=He();return Vi=(n,o,r)=>{const i=[];let s=null,a=null;const l=n.sort((d,f)=>t(d,f,r));for(const d of l)e(d,o,r)?(a=d,s||(s=d)):(a&&i.push([s,a]),a=null,s=null);s&&i.push([s,null]);const p=[];for(const[d,f]of i)d===f?p.push(d):!f&&d===l[0]?p.push("*"):f?d===l[0]?p.push(`<=${f}`):p.push(`${d} - ${f}`):p.push(`>=${d}`);const c=p.join(" || "),u=typeof o.raw=="string"?o.raw:String(o);return c.length<u.length?c:o},Vi}var Ki,gc;function F2(){if(gc)return Ki;gc=1;const e=Je(),t=Lr(),{ANY:n}=t,o=fo(),r=He(),i=(u,d,f={})=>{if(u===d)return!0;u=new e(u,f),d=new e(d,f);let m=!1;e:for(const h of u.set){for(const v of d.set){const y=l(h,v,f);if(m=m||y!==null,y)continue e}if(m)return!1}return!0},s=[new t(">=0.0.0-0")],a=[new t(">=0.0.0")],l=(u,d,f)=>{if(u===d)return!0;if(u.length===1&&u[0].semver===n){if(d.length===1&&d[0].semver===n)return!0;f.includePrerelease?u=s:u=a}if(d.length===1&&d[0].semver===n){if(f.includePrerelease)return!0;d=a}const m=new Set;let h,v;for(const k of u)k.operator===">"||k.operator===">="?h=p(h,k,f):k.operator==="<"||k.operator==="<="?v=c(v,k,f):m.add(k.semver);if(m.size>1)return null;let y;if(h&&v&&(y=r(h.semver,v.semver,f),y>0||y===0&&(h.operator!==">="||v.operator!=="<=")))return null;for(const k of m){if(h&&!o(k,String(h),f)||v&&!o(k,String(v),f))return null;for(const j of d)if(!o(k,String(j),f))return!1;return!0}let g,$,b,w,E=v&&!f.includePrerelease&&v.semver.prerelease.length?v.semver:!1,x=h&&!f.includePrerelease&&h.semver.prerelease.length?h.semver:!1;E&&E.prerelease.length===1&&v.operator==="<"&&E.prerelease[0]===0&&(E=!1);for(const k of d){if(w=w||k.operator===">"||k.operator===">=",b=b||k.operator==="<"||k.operator==="<=",h){if(x&&k.semver.prerelease&&k.semver.prerelease.length&&k.semver.major===x.major&&k.semver.minor===x.minor&&k.semver.patch===x.patch&&(x=!1),k.operator===">"||k.operator===">="){if(g=p(h,k,f),g===k&&g!==h)return!1}else if(h.operator===">="&&!k.test(h.semver))return!1}if(v){if(E&&k.semver.prerelease&&k.semver.prerelease.length&&k.semver.major===E.major&&k.semver.minor===E.minor&&k.semver.patch===E.patch&&(E=!1),k.operator==="<"||k.operator==="<="){if($=c(v,k,f),$===k&&$!==v)return!1}else if(v.operator==="<="&&!k.test(v.semver))return!1}if(!k.operator&&(v||h)&&y!==0)return!1}return!(h&&b&&!v&&y!==0||v&&w&&!h&&y!==0||x||E)},p=(u,d,f)=>{if(!u)return d;const m=r(u.semver,d.semver,f);return m>0?u:m<0||d.operator===">"&&u.operator===">="?d:u},c=(u,d,f)=>{if(!u)return d;const m=r(u.semver,d.semver,f);return m<0?u:m>0||d.operator==="<"&&u.operator==="<="?d:u};return Ki=i,Ki}var Yi,vc;function q2(){if(vc)return Yi;vc=1;const e=gr(),t=Js(),n=Oe(),o=_m(),r=ro(),i=Hp(),s=Nm(),a=b2(),l=$2(),p=w2(),c=x2(),u=k2(),d=E2(),f=He(),m=S2(),h=j2(),v=$a(),y=A2(),g=O2(),$=Dr(),b=wa(),w=pf(),E=uf(),x=xa(),k=ka(),j=df(),S=R2(),R=C2(),N=Lr(),J=Je(),G=fo(),H=_2(),_=N2(),O=P2(),F=M2(),I=I2(),P=Ea(),M=W2(),q=B2(),U=D2(),B=L2(),D=F2();return Yi={parse:r,valid:i,clean:s,inc:a,diff:l,major:p,minor:c,patch:u,prerelease:d,compare:f,rcompare:m,compareLoose:h,compareBuild:v,sort:y,rsort:g,gt:$,lt:b,eq:w,neq:E,gte:x,lte:k,cmp:j,coerce:S,truncate:R,Comparator:N,Range:J,satisfies:G,toComparators:H,maxSatisfying:_,minSatisfying:O,minVersion:F,validRange:I,outside:P,gtr:M,ltr:q,intersects:U,simplifyRange:B,subset:D,SemVer:n,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:o.compareIdentifiers,rcompareIdentifiers:o.rcompareIdentifiers},Yi}var qe=q2(),z2=Object.defineProperty,ff=(e,t)=>z2(e,"name",{value:t,configurable:!0}),H2=Object.defineProperty,mf=ff((e,t)=>H2(e,"name",{value:t,configurable:!0}),"r");const ir=/.*\/node_modules\/(?:@[^/]+\/)?[^/]+/,Ps=Gs(async e=>{const t=V(e,"package.json");try{const n=await Pm(t);return{directory:Z(t),name:n.name,version:n.version}}catch{return}})(),hf=mf(async e=>{const t=Kn(e),n=ir.exec(t);if(!n)return;const o=await Ps(n[0]);if(o)return o;const r=t.lastIndexOf("node_modules");if(r<=0)return;const i=ir.exec(t.slice(0,r-1));if(i)return Ps(i[0])},"getPackageInfo"),J2=mf(()=>{Ps.destroy()},"destroyPackageInfoCache");var G2=Object.defineProperty,gt=ff((e,t)=>G2(e,"name",{value:t,configurable:!0}),"d");const yc=Gs(async(e,t)=>{const n=Kn(e);if(ir.test(n)){const o=await hf(n);if(o)return`${o.name}@${o.version}`}return n.replace(`${Kn(t)}/`,"")})(),U2=gt(e=>new Set([...e].toSorted((t,n)=>t.localeCompare(n))),"sortImporters"),V2=gt(e=>new Map([...e.entries()].toSorted((t,n)=>t[0].localeCompare(n[0])).map(([t,n])=>[t,U2(n)])),"sortDirectoryMap"),K2=gt(e=>new Map([...e.entries()].toSorted((t,n)=>qe.compare(t[0],n[0])).map(([t,n])=>[t,V2(n)])),"sortVersionMap"),Y2=gt(e=>new Map([...e.entries()].toSorted((t,n)=>t[0].localeCompare(n[0])).map(([t,n])=>[t,K2(n)])),"sortPackagesInfo"),X2=gt((e,t,n,o,r)=>{let i=e.get(t);i||(i=new Map,e.set(t,i));let s=i.get(n);s||(s=new Map,i.set(n,s));let a=s.get(o);a||(a=new Set,s.set(o,a)),a.add(r)},"addImporter"),Z2=gt((e,t,n,o)=>{const r=Math.max(0,...t.map(a=>a.length)),i=gt((a,l)=>a.filter(p=>p!==`${e}@${l}`).map(p=>zs(p)).join(", "),"colorizeImporters"),s=[`
|
|
64
|
+
${Wo(e)}:`];for(const a of t){const l=n.get(e)?.get(a);if(!l)continue;const p=je(Zt(a.padEnd(r," ")));if(l.size===1){const[c]=[...l.values()],u=c?[...c]:[];s.push(` - ${p} imported by ${i(u,a)}`);continue}s.push(` - ${p}`);for(const[c,u]of l){const d=je(ne(c.replace(Kn(o),".")));s.push(` - ${d} imported by ${i([...u],a)}`)}}return s},"formatDuplicatedPackage"),Q2=gt((e,t,{customErrorMessage:n,deep:o=!0,ignore:r={},throwErrorWhenDuplicated:i=!1}={})=>({async buildEnd(){const s=new Map;await Promise.all([...this.getModuleIds()].map(async d=>{const f=this.getModuleInfo(d);if(f===null||f.isExternal||f.isIncluded===!1)return;const m=await hf(d);if(!m)return;const{directory:h,name:v,version:y}=m;for(const g of[...f.importers,...f.dynamicImporters]){const $=Kn(g);!o&&ir.test($)||X2(s,v,y,h,await yc($,t))}})),J2(),yc.destroy();const a=Y2(s),l={},p=new Map;for(const[d,f]of a.entries()){const m=[...f.values()];if(m.length>1||m.length===1&&(m[0]?.size??0)>1){l[d]=[...f.keys()];for(const h of f.keys()){const v=r[d];if(!(v!==void 0&&(v.includes("*")||v.includes(h)))){const y=p.get(d)??[];y.push(h),p.set(d,y)}}}}if(p.size===0)return;const c=[`packages ${[...p.keys()].map(d=>Wo(d)).join(", ")} is bundled multiple times!`];for(const[d,f]of p)c.push(...Z2(d,f,a,t));const u=n?n(a):c.join(`
|
|
65
|
+
`);i&&(e.error(u),e.info(`Fix this error by eliminating the duplicated dependencies or adjusting the ${Wo("ignore")} option.`),e.info(`You can copy the following duplicated dependencies as the value of the ${Wo("ignore")} option:`),e.info(`
|
|
66
|
+
${JSON.stringify(l,void 0,4)}
|
|
67
|
+
`),this.error("Duplicated dependencies detected.")),e.warn(u)},name:"packem:detect-duplicated"}),"detectDuplicatedPlugin");var ek=Object.defineProperty,tk=(e,t)=>ek(e,"name",{value:t,configurable:!0}),nk=Object.defineProperty,Fr=tk((e,t)=>nk(e,"name",{value:t,configurable:!0}),"t");const ok=/(?:^|[^.\w'"`])require(\.resolve)?\(\s*([\w'"`])/,rk=Fr((e,t)=>{if(Em.INTERNAL_PACKEM_BUILD!=="1"&&(e.includes("// -- packem CommonJS __filename shim")||e.includes("// -- packem CommonJS __dirname shim")||e.includes("// -- packem CommonJS require shim")))return;let n=!1,o=!1,r=!1;if(e.includes("__filename")&&(n=!0),e.includes("__dirname")&&(o=!0),ok.test(e)&&(r=!0),!n&&!o&&!r)return;const i=br(e).pop(),s=i?i.end:0,a=new ke(e);return a.appendRight(s,t(n,o,r)),{code:a.toString(),map:a.generateMap()}},"CJSToESM"),ik=Fr((e,t,n)=>{let o="";return(e||t)&&(o+=`import __cjs_url__ from "node:url"; // -- packem CommonJS __filename shim --
|
|
68
|
+
`),t&&(o+=`import __cjs_path__ from "node:path"; // -- packem CommonJS __dirname shim --
|
|
69
|
+
`),n&&(o+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
70
|
+
`),(e||t)&&(o+=`const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
71
|
+
`),t&&(o+=`const __dirname = __cjs_path__.dirname(__filename);
|
|
72
|
+
`),n&&(o+=`const require = __cjs_mod__.createRequire(import.meta.url);
|
|
73
|
+
`),o},"generateCJSShim"),sk=Fr((e,t,n)=>{let o="";return n&&(o+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
74
|
+
`),e&&(o+=`const __filename = import.meta.filename; // -- packem CommonJS __filename shim --
|
|
75
|
+
`),t&&(o+=`const __dirname = import.meta.dirname; // -- packem CommonJS __dirname shim --
|
|
76
|
+
`),n&&(o+=`const require = __cjs_mod__.createRequire(import.meta.url);
|
|
77
|
+
`),o},"generateCJSShimNode20_11"),ak=Fr((e,t)=>{const n=Qe(t.include,t.exclude);return{name:"packem:esm-shim-cjs-syntax",renderChunk(o,r,i){if(i.format==="es"&&n(r.fileName)){let s=ik;if(e.engines?.node){const a=qe.minVersion(e.engines.node);a&&(a.major>20||a.major===20&&a.minor>=11)&&(s=sk)}return rk(o,s)}}}},"esmShimCjsSyntaxPlugin");var lk=Object.defineProperty,ck=(e,t)=>lk(e,"name",{value:t,configurable:!0}),pk=Object.defineProperty,Le=ck((e,t)=>pk(e,"name",{value:t,configurable:!0}),"c");const Ms=/[.*+?^${}()|[\]\\]/g,uk=/.*/,dk=/^(?:\0|\.{1,2}\/)/,fk=/^node:/,mk=/^@visulima\/css-style-inject(?:\/.+)?$/,bc=Le((e,t,n)=>e.reduce((o,r,i)=>(r instanceof RegExp?o.push(r):typeof r=="string"&&r.length>0?o.push(new RegExp(`^${r.replaceAll(Ms,String.raw`\$&`)}$`)):n.warn(`Ignoring wrong entry type #${String(i)} in '${t}' option: ${JSON.stringify(r)}`),o),[]),"getRegExps"),$c=new Map,hk=Le((e,t)=>{$c.has(e)||t.info({message:`Inlined implicit external "${ne(e)}". If this is incorrect, add it to the "externals" option.`,prefix:"plugin:packem:externals"}),$c.set(e,!0)},"logExternalMessage"),wc=new Set(["node:sqlite","node:test"]),gk=/[\\:]/,vk=Le(e=>e.length>0&&!gk.test(e),"isValidPackageName"),Sa="@types/",xc=Le(e=>{if(e.startsWith("@")){const[t,n]=e.split("/");return`${t??""}/types/${n??""}`}return`${Sa}${e}`},"getAtTypesPackageName"),yk=Le(e=>{if(e.startsWith("@")){const t=e.split("/");if(t[1]==="types")return`${t[0]??""}/${t.slice(2).join("/")}`}return e.replace(Sa,"")},"getOriginalPackageName"),bk=["peerDependencies","dependencies","optionalDependencies"],gf=Le((e,t)=>{const n=dh.realpathSync.native(process.cwd()),{pkg:o}=e,r=new Set;for(const x of bk){const k=o[x];if(k)for(const j of Object.keys(k))j.startsWith(Sa)?r.add(yk(j)):r.add(j)}const i=new Set(Object.keys(o.devDependencies??{})),s=new Set([...Object.keys(o.dependencies??{}),...Object.keys(o.devDependencies??{}),...Object.keys(o.peerDependencies??{}),...Object.keys(o.optionalDependencies??{})]),a=e.options.rollup.resolveExternals??{},l=new Set(bc([...e.options.externals??[]],"include",e.logger)),p=new Set(bc([...a.exclude??[]],"exclude",e.logger));if(t?.dtsResolve)if(t.dtsResolve===!0)p.add(uk);else for(const x of t.dtsResolve)typeof x=="string"?p.add(new RegExp(`^${x.replaceAll(Ms,String.raw`\$&`)}(?:/.+)?$`)):p.add(x);const c=Le(x=>{const{dtsResolve:k}=t??{};return k?typeof k=="boolean"?k:k.some(j=>typeof j=="string"?x===j:j.test(x)):!1},"shouldResolveForDts"),u={...a.deps?o.dependencies??{}:void 0,...a.devDeps?o.devDependencies??{}:void 0,...a.peerDeps?o.peerDependencies??{}:void 0,...a.optDeps?o.optionalDependencies??{}:void 0},d=Object.keys(u);if(d.length>0&&l.add(new RegExp(`^(?:${d.join("|")})(?:/.+)?$`)),l.add(mk),o.peerDependenciesMeta)for(const[x,k]of Object.entries(o.peerDependenciesMeta))k&&typeof k=="object"&&"optional"in k&&l.add(new RegExp(`^${x}(?:/.+)?$`));const f=[...l],m=[...p],h=Le(x=>f.some(k=>k.test(x)),"isIncluded"),v=Le(x=>m.some(k=>k.test(x)),"isExcluded");let y=[];e.tsconfig&&(y=Object.entries(e.tsconfig.config.compilerOptions?.paths??{}).map(([x])=>x.endsWith("*")?new RegExp(`^${x.replace("*","(.*)")}$`):new RegExp(`^${x}$`)));const g=Br(o,e.options),$=e.options.sourceDir?new RegExp(String.raw`(?:^|/)${e.options.sourceDir.replaceAll(Ms,String.raw`\$&`)}/`):void 0,b=new Set,w=new Set,E=new Map;return{name:"packem:externals",options:Le(x=>{x.external=(k,j)=>{const S=`${k}::${j??""}`;if(E.has(S))return E.get(S);const R=Vn(k),N=j?Vn(j):void 0;let J;if(Object.keys(g).length>0){const O=jm(R,g);O!==R&&(J=O)}let G="";J&&In(J)&&(G=Ka(J).name??""),!G&&In(R)&&(G=Ka(R).name??rh(R));const H=G&&In(G)&&vk(G)?G:"";if(H&&!bo(H)){e.usedDependencies.add(H);const O=!N||!Yr(N,e.options.rootDir),F=s.has(H);O&&!F&&e.options.validation&&e.options.validation.dependencies&&e.options.validation.dependencies.hoisted!==!1&&!e.options.validation.dependencies.hoisted?.exclude.includes(H)&&e.hoistedDependencies.add(H)}const _=J?[R,J]:[R];for(const O of _){const F=o.name?O===o.name||O.startsWith(`${o.name}/`):!1;if(dk.test(O)||Hs(O)||($?.test(O)??!1)||F)return E.set(S,!1),!1;if(bo(O)||wc.has(O)){let I=a.builtins;return I===void 0&&N&&(I=h(N)&&!v(N)),E.set(S,I),I}if(O[0]==="#"&&!O.startsWith("#/"))return E.set(S,!1),!1;if(h(O)&&!v(O))return E.set(S,!0),!0;if(y.some(I=>I.test(O))||H&&c(H))return E.set(S,!1),!1}return e.implicitDependencies.add(R),hk(R,e.logger),E.set(S,!1),!1}},"options"),resolveId:{filter:{id:Le(x=>!x.startsWith("\0"),"id")},async handler(x,k,j){if(j.isEntry)return;if(x[0]==="#"&&!x.startsWith("#/")&&o.imports)return k&&!Yr(k,e.options.rootDir)?{external:!0,id:x}:void 0;if(wc.has(x))return{external:!0,id:x,moduleSideEffects:!1};if(bo(x)){const R=x.replace(fk,"");let N=R;return(a.builtinsPrefix==="add"||!bo(R))&&(N=`node:${R}`),{external:(a.builtins??h(x))&&!v(x),id:a.builtinsPrefix==="ignore"?x:N,moduleSideEffects:!1}}if(!In(x)||x.includes("?")||x.includes(" "))return;const[S]=$s(x);if(i.has(S)&&!r.has(S)){if(h(x)&&!v(x))return;if(t?.forTypes)return t.dtsResolve&&c(S)?void 0:{external:!0,id:x,moduleSideEffects:!1};const R=await this.resolve(x,k,{skipSelf:!0,...j});if(!R)throw new Error(`Could not resolve "${x}" even though it's declared in package.json. Try re-installing node_modules.`);if(t?.forTypes){const N=xc(S);r.has(N)&&!b.has(N)&&(b.add(N),e.logger.warn(`Recommendation: "${N}" is externalized but "${S}" is bundled (devDependencies). This may cause type mismatches for consumers. Consider moving "${S}" to dependencies or "${N}" to devDependencies.`))}return R}if(r.has(S)){if(t?.forTypes){const R=xc(S);i.has(R)&&!b.has(R)&&(b.add(R),e.logger.warn(`Recommendation: "${R}" is bundled (devDependencies) but "${S}" is externalized. Place "${R}" in dependencies/peerDependencies as well so users don't have missing types.`))}return}if(!i.has(S)&&k&&!Yr(k,n)&&!t?.skipUnlistedWarnings&&!w.has(S)&&(w.add(S),e.logger.warn(`"${S}" imported by "${k}" but not declared in package.json. Will be bundled to prevent failure at runtime.`)),t?.forTypes&&k&&oh(k,n))return{external:!0,id:x,moduleSideEffects:!1}},order:"pre"}}},"externalsPlugin");var $k=Object.defineProperty,wk=(e,t)=>$k(e,"name",{value:t,configurable:!0}),xk=Object.defineProperty,kc=wk((e,t)=>xk(e,"name",{value:t,configurable:!0}),"p");const Xi="\0packem-import-attribute/",kk=/(import[\s\S]+?from\s*["'])([^"']+)(["'])\s*with\s*\{\s*type\s*:\s*["'](text|bytes)["']\s*\}/g,Ek=/(\bimport\s*\(\s*["'])([^"']+)["']\s*,\s*\{\s*with\s*:\s*\{\s*type\s*:\s*["'](text|bytes)["']\s*\}\s*\}\s*\)/g,Sk=/\.[mc]?[jt]sx?$/,jk=kc(()=>{const e=new Map;let t=0;const n=kc(o=>{const r=`${Xi}${String(t)}`;return t+=1,e.set(r,o),r},"allocateId");return{buildStart(){e.clear(),t=0},async load(o){const r=e.get(o);if(!r)return null;const{importer:i,source:s,type:a}=r;if(!s.startsWith("./")&&!s.startsWith("../")&&!s.startsWith("/"))return null;const l=s.startsWith("/")?s:gh(ws(i),s);if(this.addWatchFile(l),a==="text"){const p=await Yo(l,"utf8");return`export default ${JSON.stringify(p)}`}return`export default new Uint8Array([${(await Yo(l)).join(",")}])`},name:"packem:import-attributes",resolveId(o,r){return o.startsWith(Xi)&&e.has(o)?o:null},transform(o,r){const i=r.split("?")[0]??r;if(i.startsWith(Xi)||!Sk.test(i)||!o.includes("with")||!o.includes("text")&&!o.includes("bytes"))return null;const s=o.replaceAll(kk,(a,l,p,c,u)=>{const d=n({importer:r,source:p,type:u});return`${l}${d}${c}`}).replaceAll(Ek,(a,l,p,c)=>{const u=n({importer:r,source:p,type:c});return`${l}${u}")`});return s===o?null:{code:s,map:null}}}},"importAttributesPlugin");var Ak=Object.defineProperty,vf=(e,t)=>Ak(e,"name",{value:t,configurable:!0}),Ok=Object.defineProperty,ln=vf((e,t)=>Ok(e,"name",{value:t,configurable:!0}),"a");const Rk=ln(e=>{const t=[],n=[];e.forEach(r=>{r.startsWith("(")?t.push(r):n.push(r)});const o=ln((r,i)=>r.localeCompare(i),"byLocale");return[...n.toSorted(o),...t.toSorted(o)]},"sortLicenses"),Ck=ln((e,t,n)=>{const o=new Set;for(const r of[e,...t,...n]){const i=typeof r=="string"?r:r?.name;i&&o.add(i)}return[...o]},"collectAuthorNames");function ja(e){return e?`> ${e}`:">"}vf(ja,"P");ln(ja,"prefixQuoteMarker");const Tk=ln((e,t,n)=>e.trim().replaceAll(/\r\n|\r/g,`
|
|
78
|
+
`).replaceAll(`<!-- ${t} -->`,"").replaceAll(n?`<!-- ${n} -->`:"","").replaceAll(`<!-- /${t} -->`,"").replaceAll(n?`<!-- /${n} -->`:"","").trim().split(`
|
|
79
|
+
`).map(o=>ja(o)).join(`
|
|
80
|
+
`),"formatLicenseBody"),yf=ln(({dtsMarker:e,licenseFilePath:t,licenseTemplate:n,logger:o,marker:r,mode:i,packageName:s})=>Rh({thirdParty(a){const l=new Set,p=a.toSorted(({name:u},{name:d})=>{const f=u??"",m=d??"";return f.localeCompare(m)}).map(({author:u,contributors:d,license:f,licenseText:m,maintainers:h,name:v,repository:y})=>{let g=`## ${v??""}
|
|
81
|
+
`;f&&(g+=`License: ${f}
|
|
82
|
+
`);const $=Ck(u,h,d);return $.length>0&&(g+=`By: ${$.join(", ")}
|
|
83
|
+
`),y&&(g+=`Repository: ${typeof y=="string"?y:y.url}
|
|
84
|
+
`),m&&(g+=`
|
|
85
|
+
${Tk(m,r,e)}
|
|
86
|
+
`),f&&l.add(f),g}).join(`
|
|
87
|
+
---------------------------------------
|
|
88
|
+
|
|
89
|
+
`);if(p===""){o.info({message:"No dependencies license information found.",prefix:`plugin:license:${i}`});return}const c=n(Rk(l),p,s);try{const u=Fp(t),d=ih(u,r,c);if(!d){o.error({message:`Could not find the license marker: <!-- ${r} --><!-- /${r} --> in ${t}`,prefix:`plugin:license:${i}`});return}u!==d&&(Mm(t,d),o.info({message:`${t} updated.`,prefix:`plugin:license:${i}`}))}catch(u){o.error(u)}}}),"licensePlugin");var _k=Object.defineProperty,mo=(e,t)=>_k(e,"name",{value:t,configurable:!0});let Lt;const Kt={getHeadTemplatePart(e){const t=e.getFullText(Lt),n=t.indexOf("`")+1,o=at.isTemplateHead(e)?-2:-1;return{end:e.end+o,start:e.pos+n,text:t.slice(n,t.length+o)}},getMiddleTailTemplatePart(e){const t=e.getText(Lt),n=at.isTemplateMiddle(e)?2:1;return{end:e.end-n,start:e.getStart(Lt)+1,text:t.slice(1,t.length-n)}},getRootNode(e,t=""){return at.createSourceFile(t,e,at.ScriptTarget.ESNext)},getTaggedTemplateTemplate(e){return e.template},getTagText(e){return e.tag.getText(Lt)},getTemplateParts(e){return at.isNoSubstitutionTemplateLiteral(e)?[Kt.getHeadTemplatePart(e)]:[Kt.getHeadTemplatePart(e.head),...e.templateSpans.map(t=>Kt.getMiddleTailTemplatePart(t.literal))]},isTaggedTemplate:at.isTaggedTemplateExpression,isTemplate:at.isTemplateLiteral,walkChildNodes(e,t){t(e),at.forEachChild(e,n=>{Kt.walkChildNodes(n,t)})},walkNodes(e,t){Lt=e,Kt.walkChildNodes(e,t),Lt=void 0}};var Nk=Object.defineProperty,Pk=mo((e,t)=>Nk(e,"name",{value:t,configurable:!0}),"i");const Mk=Pk((e,t={})=>{const n={...Kt,...t.strategy},o=[],r=[];return n.walkNodes(n.getRootNode(e,t.fileName),i=>{if(n.isTaggedTemplate(i)){const s=n.getTaggedTemplateTemplate(i);r.push(s),o.push({parts:n.getTemplateParts(s),tag:n.getTagText(i)})}else n.isTemplate(i)&&!r.includes(i)&&o.push({parts:n.getTemplateParts(i)})}),o},"parseLiterals");var Ik=Object.defineProperty,Aa=mo((e,t)=>Ik(e,"name",{value:t,configurable:!0}),"c");const tn={One:"1",Two:"2",Zero:"0"},Wk=Aa(e=>{const t={[tn.One]:{tidySelectors:!1,transform:void 0},[tn.Two]:{tidySelectors:!1,transform:void 0},[tn.Zero]:{}};if(e===void 0)return t;if(typeof e=="number"){const n=e.toString();return{...t,[n]:{...t[n]}}}return e},"optimizationLevelFrom"),Bk=/(:[^()\s]+\(([^()]*)\))\s*\{/g,Dk=/\s/g,Lk=/\s/,Ec=Aa((e,t)=>{let n=t;const o=[...e.matchAll(Bk)];for(const r of o){const i=r[1],s=r[2];if(!i||!s||!Lk.test(s))continue;const a=s.replaceAll(Dk,""),l=i.replace(s,a),p=n.indexOf(l);if(p===-1)continue;const c=p+l.length;n=n.slice(0,Math.max(0,p))+i+n.slice(Math.max(0,c))}return n},"fixCleanCssTidySelectors"),Fk={},qk={caseSensitive:!0,collapseWhitespace:!0,decodeEntities:!0,minifyCSS:Fk,minifyJS:!0,removeAttributeQuotes:!1,removeComments:!0,removeEmptyAttributes:!0,removeScriptTypeAttributes:!0,removeStyleLinkTypeAttributes:!0,useShortDoctype:!0},Sc=Aa((e={})=>{const t=Wk(e.level),n=typeof e.level=="object"&&typeof e.level[1]?.transform=="function"?e.level[1].transform:!1;return t[tn.One].transform=(o,r)=>r.startsWith("@TEMPLATE_EXPRESSION")&&!r.endsWith(";")?`${r};`:n?n(o,r):r,{...e,level:t}},"adjustMinifyCSSOptions"),zk={combineHTMLStrings(e,t){return e.map(n=>n.text).join(t)},getPlaceholder(e){let t="@TEMPLATE_EXPRESSION";for(;e.some(n=>n.text.includes(t+"();"));)t+="_";return t+"();"},minifyCSS(e,t={}){const n=Sc(t),o=new Ch(n).minify(e);if(o.errors.length>0)throw new Error(o.errors.join(`
|
|
90
|
+
|
|
91
|
+
`));return n.level?.[tn.One]?.tidySelectors&&(o.styles=Ec(e,o.styles)),o.styles},async minifyHTML(e,t={}){let n;t.minifyCSS?n=t.minifyCSS!==!0&&typeof t.minifyCSS!="function"?{...t.minifyCSS}:{}:n=!1;let o=!1;n&&(o=Sc(n));let r=await Th(e,{...t,minifyCSS:o});if(t.collapseWhitespace){const i=[...r.matchAll(/<svg/g)].toReversed();for(const s of i){const a=s.index,l=r.indexOf("</svg",a);if(l===-1)continue;const p=r.slice(0,Math.max(0,a));let c=r.slice(a,l);const u=r.slice(Math.max(0,l));c=c.replaceAll(/\r?\n/g,""),r=p+c+u}}return(o?o.level:void 0)?.[tn.One]?.tidySelectors&&(r=Ec(e,r)),r},splitHTMLByPlaceholder(e,t){const n=e.split(t);if(t.endsWith(";")){const o=t.slice(0,Math.max(0,t.length-1));for(let r=n.length-1;r>=0;r-=1){const i=n[r];i!==void 0&&n.splice(r,1,...i.split(o))}}return n}};var Hk=Object.defineProperty,qr=mo((e,t)=>Hk(e,"name",{value:t,configurable:!0}),"f");const Jk=qr((e,t)=>e.generateMap({file:`${t}.map`,hires:!0,source:t}),"defaultGenerateSourceMap"),Gk=qr(e=>{const t=e.tag?.toLowerCase();return!!t&&(t.includes("html")||t.includes("svg"))},"defaultShouldMinify"),Uk=qr(e=>!!e.tag&&e.tag.toLowerCase().includes("css"),"defaultShouldMinifyCSS"),Vk={ensureHTMLPartsValid(e,t){if(e.length!==t.length)throw new Error("splitHTMLByPlaceholder() must return same number of strings as template parts")},ensurePlaceholderValid(e){if(typeof e!="string"||e.length===0)throw new Error("getPlaceholder() must return a non-empty string")}};async function Oa(e,t={}){t.minifyOptions={...qk,...t.minifyOptions},t.MagicString??=ke,t.parseLiterals??=Mk,t.shouldMinify??=Gk,t.shouldMinifyCSS??=Uk,t.parseLiteralsOptions={fileName:t.fileName,...t.parseLiteralsOptions};const n=t.parseLiterals(e,t.parseLiteralsOptions),o=t.strategy??zk,{shouldMinify:r,shouldMinifyCSS:i}=t;let s;t.validate!==!1&&(s=t.validate??Vk);const a=new t.MagicString(e);for(const c of n){const u=r(c),d=!!o.minifyCSS&&i(c);if(u||d){const f=o.getPlaceholder(c.parts);s&&s.ensurePlaceholderValid(f);const m=o.combineHTMLStrings(c.parts,f);let h;if(d){const y=t.minifyOptions?.minifyCSS;if(typeof y=="function"){const g=y(m);h=typeof g=="string"?g:await g}else if(y===!1)h=m;else{const g=typeof y=="object"&&y!==null?y:void 0,$=o.minifyCSS;if(!$)throw new Error("Strategy does not implement minifyCSS but minifyCSS was requested");const b=$(m,g);h=typeof b=="string"?b:await b}}else{const y=o.minifyHTML(m,t.minifyOptions);h=typeof y=="string"?y:await y}const v=o.splitHTMLByPlaceholder(h,f);s&&s.ensureHTMLPartsValid(c.parts,v),c.parts.forEach((y,g)=>{y.start<y.end&&v[g]!==void 0&&a.overwrite(y.start,y.end,v[g])})}}const l=a.toString();if(e===l)return;let p;return t.generateSourceMap!==!1&&(p=(t.generateSourceMap??Jk)(a,t.fileName??"")),{code:l,map:p}}mo(Oa,"minifyHTMLLiterals");qr(Oa,"minifyHTMLLiterals");var Kk=Object.defineProperty,Yk=mo((e,t)=>Kk(e,"name",{value:t,configurable:!0}),"o");const Xk=Yk(({exclude:e,failOnError:t=!1,include:n,logger:o,minifyHTMLLiterals:r,options:i})=>{r??=Oa;const s=Qe(n,e),a=i??{};return{name:"packem:minify-html-literals",async transform(l,p){if(s(p))try{return await r(l,{...a,fileName:p})}catch(c){const u=c instanceof Error?c.message:c;t?this.error(u):o.warn({message:u,prefix:"plugin:minify-html-literals"})}}}},"minifyHTMLLiteralsPlugin");var Zk=Object.defineProperty,Qk=(e,t)=>Zk(e,"name",{value:t,configurable:!0}),eE=Object.defineProperty,jc=Qk((e,t)=>eE(e,"name",{value:t,configurable:!0}),"f");const tE=/\.node$/,Zi="\0packem-natives/",nE=jc((e={})=>{const{nativesDirectory:t="natives"}=e,n=new Map;let o=0,r;return{buildStart(){n.clear(),o=0},generateBundle:jc(async i=>{if(n.size===0)return;let s;if(i.dir?s=i.dir:i.file&&(s=Z(i.file)),!s)throw new Error("Output directory not detected. Please ensure Rollup output options are configured.");const a=V(s,t);await ys(a);const l=new Set,p=[];for(const{outputName:c,sourcePath:u}of n.values())l.has(u)||(l.add(u),p.push($h(u,V(a,c))));await Promise.all(p)},"generateBundle"),load(i){const s=n.get(i);if(!s)return;const{outputName:a}=s;if(!r){if(this.meta.rollupVersion)return`export default require("./${t}/${a}");`;this.error("Output directory not detected. Please ensure Rollup output options are configured.")}return`export default require("${`./${t}/${a}`.replaceAll("\\","/")}");`},name:"native-modules",options(i){const s=i;if(s.output){const a=Array.isArray(s.output)?s.output[0]:s.output;a?.dir?r=a.dir:a?.file&&(r=Z(a.file))}return i},resolveId:{filter:{id:tE},async handler(i,s){if(i.startsWith(Zi))return;if(s?.startsWith(Zi))return{external:!0,id:i};const a=s?X(Z(s),i):X(i);if(!await Qt(a)){this.warn(`Native module not found: ${a}`);return}for(const[f,m]of n)if(m.sourcePath===a)return f;const l=rt(a);let p=l,c=1;const u=new Set(Array.from(n.values(),f=>f.outputName));for(;u.has(p);){const f=rn(l);p=`${rt(l,f)}_${String(c)}${f}`,c+=1}const d=`${Zi}${String(o)}`;return o+=1,n.set(d,{outputName:p,sourcePath:a}),d}}}},"nativeModulesPlugin");var oE=Object.defineProperty,rE=(e,t)=>oE(e,"name",{value:t,configurable:!0}),iE=Object.defineProperty,sE=rE((e,t)=>iE(e,"name",{value:t,configurable:!0}),"a");const aE=sE(e=>{const t=Qe(e.include,e.exclude);return{async load(n){if(n.includes("?raw")){const o=n.split("?")[0];try{const r=await Nt(o);return process.platform==="win32"?r.replaceAll(`\r
|
|
92
|
+
`,`
|
|
93
|
+
`):r}catch{this.error(`Failed to read file: ${o}`)}}return null},name:"packem:raw",transform(n,o){const r=o.includes("?raw"),i=r?o.split("?")[0]:o;if(t(i)||r){const s=process.platform==="win32"?n.replaceAll(`\r
|
|
94
|
+
`,`
|
|
95
|
+
`):n;return{code:`const data = ${JSON.stringify(s)};
|
|
96
|
+
export default data;`,map:null}}return null}}},"rawPlugin");var lE=Object.defineProperty,bf=(e,t)=>lE(e,"name",{value:t,configurable:!0}),cE=Object.defineProperty,pE=bf((e,t)=>cE(e,"name",{value:t,configurable:!0}),"i");let Ac=!1;const uE=new Map,dE=pE(async(e,t,n)=>{if(Ac||(await au(),Ac=!0),e.startsWith("node:"))return!1;if(e.endsWith(".cjs"))return!0;if(e.endsWith(".js")||!e.includes("/")&&!e.startsWith(".")){let o;if(n)try{o=(await n(e,t))?.id}catch{}if(!o&&t&&!t.includes("!~{"))try{o=We(t).resolve(e)}catch{}if(o){try{const{packageJson:r}=await Im(o,{cache:uE});if(r.type==="module")return!1;if(r.type==="commonjs")return!0}catch{}try{const r=await Nt(o,{encoding:"utf8"});try{return _h(r,o),!0}catch{}}catch{}}}return!1},"isPureCJS");var fE=Object.defineProperty,yn=bf((e,t)=>fE(e,"name",{value:t,configurable:!0}),"d");const Ra="__cjs_require",mE='import { createRequire as __cjs_createRequire } from "node:module";',hE=`const ${Ra} = __cjs_createRequire(import.meta.url);`,gE='const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;',vE=`const __cjs_getBuiltinModule = (module) => {
|
|
97
|
+
// Check if we're in Node.js and version supports getBuiltinModule
|
|
98
|
+
if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
|
|
99
|
+
const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
|
|
100
|
+
// Node.js 20.16.0+ and 22.3.0+
|
|
101
|
+
if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
|
|
102
|
+
return __cjs_getProcess.getBuiltinModule(module);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Fallback to createRequire
|
|
106
|
+
return ${Ra}(module);
|
|
107
|
+
};`,So={builtin:/const\s+__cjs_getBuiltinModule\s*=\s*\(module\)\s*=>\s*\{[\s\S]*?\};\s*/g,import:/import\s*\{\s*createRequire(?:\s+as\s+__cjs_createRequire)?\s*\}\s*from\s*["']node:module["'];?\s*/g,process:/const\s+__cjs_getProcess\s*=\s*typeof\s+globalThis[^;]*;\s*/g,require:/const\s+__cjs_require\s*=\s*(?:__cjs_)?createRequire\s*\([^)]*\);\s*/g},yE=[/node_modules/,/\.d\.[cm]?ts$/],bE=[/\.[cm]?[jt]sx?$/];let Oc=!1;const $E=yn((e,t)=>t&&(hm.includes(e)||e.startsWith("node:")),"isBuiltinModule"),wE=yn(async(e,t,n,o,r)=>t?!0:await n?.(e,o,r)??await dE(e,o,r),"shouldTransformImport"),xE=yn((e,t)=>t?e==="process"||e==="node:process"?{code:"__cjs_getProcess",needsBuiltin:!1,needsProcess:!0,needsRequire:!0}:{code:`__cjs_getBuiltinModule(${JSON.stringify(e)})`,needsBuiltin:!0,needsProcess:!0,needsRequire:!0}:{code:`${Ra}(${JSON.stringify(e)})`,needsBuiltin:!1,needsProcess:!1,needsRequire:!0},"generateRequireCode"),kE=yn(e=>{const t=new ke(e),n={builtin:[...e.matchAll(So.builtin)],import:[...e.matchAll(So.import)],process:[...e.matchAll(So.process)],require:[...e.matchAll(So.require)]};return Object.values(n).forEach(o=>{if(o.length>1)for(let r=o.length-1;r>0;r-=1){const i=o[r];i&&t.remove(i.index,i.index+i[0].length)}}),t.toString()},"removeDuplicates"),EE=yn(e=>{if(Array.isArray(e.shouldTransform)){const{shouldTransform:t}=e;e.shouldTransform=n=>t.includes(n)}return{builtinNodeModules:!!e.builtinNodeModules,cwd:e.cwd??ut.cwd(),exclude:e.exclude??yE,include:e.include??bE,order:"order"in e?e.order:"pre",shouldTransform:e.shouldTransform}},"resolveOptions"),SE=yn((e,t)=>{if(ut.env.INTERNAL_PACKEM_BUILD)return{name:"require-cjs-transformer"};const{builtinNodeModules:n,cwd:o,exclude:r,include:i,order:s,shouldTransform:a}=EE(e),l=Qe(i,r);return{async buildStart(){Oc||(await au(),Oc=!0)},name:"packem:plugin-require-cjs",renderChunk:{async handler(p,c,u){if(u.format!=="es"||!l(c.fileName))return;const d=$r(c.fileName,p,{astType:"js",lang:"js",sourceType:"module"}),f=new ke(p);let m=!1,h=!1,v=!1;for(const g of d.program.body){if(g.type!=="ImportDeclaration"||g.importKind==="type")continue;const $=g.source.value,b=$E($,n),w=this.resolve;if(!await wE($,b,a,o,w))continue;const{code:E,needsBuiltin:x,needsProcess:k,needsRequire:j}=xE($,b);if(m||=j,h||=k,v||=x,g.specifiers.length===0){b?f.remove(g.start,g.end):f.overwrite(g.start,g.end,`${E};`);continue}const S=[];let R,N;for(const G of g.specifiers)if(G.type==="ImportNamespaceSpecifier")R=G.local.name;else if(G.type==="ImportSpecifier"&&G.importKind!=="type"){const H=p.slice(G.imported.start,G.imported.end);S.push([H,G.local.name])}else G.type==="ImportDefaultSpecifier"&&(N=G.local.name);const J=[];if(R&&(N??=`_cjs_${R}_default`),N&&J.push(`const ${N} = ${E};`),R&&J.push(`const ${R} = { ...${N??""}, default: ${N??""} };`),S.length>0){const G=`const {
|
|
108
|
+
${S.map(([H,_])=>` ${H===_?_:`${H}: ${_}`}`).join(`,
|
|
109
|
+
`)}
|
|
110
|
+
} = ${N??E};`;J.push(G)}f.overwrite(g.start,g.end,J.join(`
|
|
111
|
+
`))}if(m||h||v){const g=[];m&&g.push(mE,hE),h&&g.push(gE),v&&g.push(vE);const $=`${g.join(`
|
|
112
|
+
|
|
113
|
+
`)}
|
|
114
|
+
|
|
115
|
+
`,b=f.toString();if(b[0]==="#"){const w=b.indexOf(`
|
|
116
|
+
`)+1;f.appendLeft(w,$)}else f.prepend($)}const y=new ke(kE(f.toString()));return{code:y.toString(),map:y.generateMap()}},order:s}}},"requireCJSTransformerPlugin");var jE=Object.defineProperty,AE=(e,t)=>jE(e,"name",{value:t,configurable:!0}),OE=Object.defineProperty,sr=AE((e,t)=>OE(e,"name",{value:t,configurable:!0}),"l");const Rc=/\bfrom\s+['"`]([^'"`]+)['"`]/g,RE=/[/\\]node_modules[/\\]/,CE=/^\0/,TE=sr(async e=>{try{const o=await so(e);if(o.isFile())return e;if(o.isDirectory()){const r=V(e,"index.js");if(await Qt(r))return r;const i=V(e,"index.json");if(await Qt(i))return i}}catch{}const t=`${e}.js`;if(await Qt(t))return t;const n=`${e}.json`;if(await Qt(n))return n},"tryResolveImplicit"),_E=sr(async(e,t)=>{let n=e;const o=X("/");for(;n!==o&&n!==Z(n);){const r=V(n,"node_modules",t,"package.json");if(await Qt(r))return r;n=Z(n)}},"findPackageJson"),$f=sr(e=>{const t=new Map,n=new Map,o=new Set;e.pkg.dependencies&&Object.keys(e.pkg.dependencies).forEach(i=>o.add(i)),e.pkg.peerDependencies&&Object.keys(e.pkg.peerDependencies).forEach(i=>o.add(i)),e.pkg.optionalDependencies&&Object.keys(e.pkg.optionalDependencies).forEach(i=>o.add(i));const r=sr(i=>o.has(i),"isExternalPackage");return{name:"packem:resolve-implicit-externals",transform:{filter:{id:{exclude:[CE,RE]}},async handler(i,s){if(s.includes("/node_modules/")||s.startsWith("\0"))return;const a=[];let l;for(Rc.lastIndex=0;(l=Rc.exec(i))!==null;){const d=l[1];if(!d||!In(d))continue;const[f,m]=$s(d);if(m&&f&&r(f)){const h=l.index+l[0].indexOf(d);a.push({importId:d,quoteEnd:h+d.length,quoteStart:h})}}if(a.length===0)return;const p=Z(s),c=(await Promise.all(a.map(async d=>{const[f,m]=$s(d.importId);if(!m)return;const h=`${f}:${m}:${p}`,v=n.get(h);if(v!==void 0)return v?{...d,resolvedId:v}:void 0;const y=await _E(p,f);if(!y){n.set(h,void 0);return}let g=t.get(y);if(g===void 0)try{g=Wm(y,{resolveCatalogs:!0}),t.set(y,g)}catch{t.set(y,void 0),n.set(h,void 0);return}if(g.exports){n.set(h,void 0);return}const $=Z(y),b=V($,m),w=await TE(b);if(!w){n.set(h,void 0);return}const E=Ae($,w),x=`${f}/${E}`;return n.set(h,x),{...d,resolvedId:x}}))).filter(d=>d!==void 0);if(c.length===0)return;const u=new ke(i);for(const{quoteEnd:d,quoteStart:f,resolvedId:m}of c)u.overwrite(f,d,m),this.debug(`[resolve-implicit-externals] Rewriting ${i.slice(f,d)} -> ${m} in ${s}`);return{code:u.toString(),map:u.generateMap({hires:!0})}}}}},"resolveImplicitExternalsPlugin");var NE=Object.defineProperty,PE=(e,t)=>NE(e,"name",{value:t,configurable:!0}),ME=Object.defineProperty,zr=PE((e,t)=>ME(e,"name",{value:t,configurable:!0}),"o");const ar=/^#![^\n]*/,Is=zr(async e=>{await nu(e,493).catch(()=>{})},"makeExecutable"),IE=zr((e,t)=>({name:"packem:shebang",renderChunk:{handler(n,o,r){if(!o.isEntry||!o.facadeModuleId)return;const i=n.startsWith("#")&&n[1]==="!";if(i&&t.replace)return{code:n.replace(ar,`${t.shebang}
|
|
117
|
+
`),map:void 0};if(!i&&e.includes(o.name)){const s=new ke(n);return s.prepend(`${t.shebang}
|
|
118
|
+
`),{code:s.toString(),map:r.sourcemap?s.generateMap({hires:!0}):void 0}}},order:"post"},async writeBundle(n,o){for(const[r,i]of Object.entries(o))if(i.type==="chunk"&&ar.test(i.code)&&n.dir){const s=X(n.dir,r);await Is(s)}}}),"shebangPlugin"),WE=zr(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace(ar,"")}}),"removeShebangPlugin"),BE=zr((e,t=`
|
|
119
|
+
`)=>{const n=ar.exec(e);return n?`${n[0]}${t}`:""},"getShebang");var DE=44,Cc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",LE=new Uint8Array(64),wf=new Uint8Array(128);for(let e=0;e<Cc.length;e++){const t=Cc.charCodeAt(e);LE[e]=t,wf[t]=e}function Nn(e,t){let n=0,o=0,r=0;do{const s=e.next();r=wf[s],n|=(r&31)<<o,o+=5}while(r&32);const i=n&1;return n>>>=1,i&&(n=-2147483648|-n),t+n}function Tc(e,t){return e.pos>=t?!1:e.peek()!==DE}typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u";var FE=class{constructor(t){this.pos=0,this.buffer=t}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(t){const{buffer:n,pos:o}=this,r=n.indexOf(t,o);return r===-1?n.length:r}};function qE(e){const{length:t}=e,n=new FE(e),o=[];let r=0,i=0,s=0,a=0,l=0;do{const p=n.indexOf(";"),c=[];let u=!0,d=0;for(r=0;n.pos<p;){let f;r=Nn(n,r),r<d&&(u=!1),d=r,Tc(n,p)?(i=Nn(n,i),s=Nn(n,s),a=Nn(n,a),Tc(n,p)?(l=Nn(n,l),f=[r,i,s,a,l]):f=[r,i,s,a]):f=[r],c.push(f),n.pos++}u||zE(c),o.push(c),n.pos=p+1}while(n.pos<=t);return o}function zE(e){e.sort(HE)}function HE(e,t){return e[0]-t[0]}var Ho={exports:{}},JE=Ho.exports,_c;function GE(){return _c||(_c=1,(function(e,t){(function(n,o){e.exports=o()})(JE,(function(){const n=/^[\w+.-]+:\/\//,o=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,r=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function i(g){return n.test(g)}function s(g){return g.startsWith("//")}function a(g){return g.startsWith("/")}function l(g){return g.startsWith("file:")}function p(g){return/^[.?#]/.test(g)}function c(g){const $=o.exec(g);return d($[1],$[2]||"",$[3],$[4]||"",$[5]||"/",$[6]||"",$[7]||"")}function u(g){const $=r.exec(g),b=$[2];return d("file:","",$[1]||"","",a(b)?b:"/"+b,$[3]||"",$[4]||"")}function d(g,$,b,w,E,x,k){return{scheme:g,user:$,host:b,port:w,path:E,query:x,hash:k,type:7}}function f(g){if(s(g)){const b=c("http:"+g);return b.scheme="",b.type=6,b}if(a(g)){const b=c("http://foo.com"+g);return b.scheme="",b.host="",b.type=5,b}if(l(g))return u(g);if(i(g))return c(g);const $=c("http://foo.com/"+g);return $.scheme="",$.host="",$.type=g?g.startsWith("?")?3:g.startsWith("#")?2:4:1,$}function m(g){if(g.endsWith("/.."))return g;const $=g.lastIndexOf("/");return g.slice(0,$+1)}function h(g,$){v($,$.type),g.path==="/"?g.path=$.path:g.path=m($.path)+g.path}function v(g,$){const b=$<=4,w=g.path.split("/");let E=1,x=0,k=!1;for(let S=1;S<w.length;S++){const R=w[S];if(!R){k=!0;continue}if(k=!1,R!=="."){if(R===".."){x?(k=!0,x--,E--):b&&(w[E++]=R);continue}w[E++]=R,x++}}let j="";for(let S=1;S<E;S++)j+="/"+w[S];(!j||k&&!j.endsWith("/.."))&&(j+="/"),g.path=j}function y(g,$){if(!g&&!$)return"";const b=f(g);let w=b.type;if($&&w!==7){const x=f($),k=x.type;switch(w){case 1:b.hash=x.hash;case 2:b.query=x.query;case 3:case 4:h(b,x);case 5:b.user=x.user,b.host=x.host,b.port=x.port;case 6:b.scheme=x.scheme}k>w&&(w=k)}v(b,w);const E=b.query+b.hash;switch(w){case 2:case 3:return E;case 4:{const x=b.path.slice(1);return x?p($||g)&&!p(x)?"./"+x+E:x+E:E||"."}case 5:return b.path+E;default:return b.scheme+"//"+b.user+b.host+b.port+b.path+E}}return y}))})(Ho)),Ho.exports}var UE=GE();const VE=io(UE);function KE(e){if(!e)return"";const t=e.lastIndexOf("/");return e.slice(0,t+1)}function YE(e,t){const n=KE(e),o=t?t+"/":"";return r=>VE(o+(r||""),n)}var to=0,XE=1,ZE=2,QE=3,eS=4;function tS(e,t){const n=Nc(e,0);if(n===e.length)return e;t||(e=e.slice());for(let o=n;o<e.length;o=Nc(e,o+1))e[o]=oS(e[o],t);return e}function Nc(e,t){for(let n=t;n<e.length;n++)if(!nS(e[n]))return n;return e.length}function nS(e){for(let t=1;t<e.length;t++)if(e[t][to]<e[t-1][to])return!1;return!0}function oS(e,t){return t||(e=e.slice()),e.sort(rS)}function rS(e,t){return e[to]-t[to]}function iS(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function Ca(e){return typeof e=="string"?JSON.parse(e):e}var sS=function(e,t){const n=Ca(e);if(!("sections"in n))return new Ta(n,t);const o=[],r=[],i=[],s=[],a=[];xf(n,t,o,r,i,s,a,0,0,1/0,1/0);const l={version:3,file:n.file,names:s,sources:r,sourcesContent:i,mappings:o,ignoreList:a};return pS(l)};function xf(e,t,n,o,r,i,s,a,l,p,c){const{sections:u}=e;for(let d=0;d<u.length;d++){const{map:f,offset:m}=u[d];let h=p,v=c;if(d+1<u.length){const y=u[d+1].offset;h=Math.min(p,a+y.line),h===p?v=Math.min(c,l+y.column):h<p&&(v=l+y.column)}aS(f,t,n,o,r,i,s,a+m.line,l+m.column,h,v)}}function aS(e,t,n,o,r,i,s,a,l,p,c){const u=Ca(e);if("sections"in u)return xf(...arguments);const d=new Ta(u,t),f=o.length,m=i.length,h=cS(d),{resolvedSources:v,sourcesContent:y,ignoreList:g}=d;if(Qi(o,v),Qi(i,d.names),y)Qi(r,y);else for(let $=0;$<v.length;$++)r.push(null);if(g)for(let $=0;$<g.length;$++)s.push(g[$]+f);for(let $=0;$<h.length;$++){const b=a+$;if(b>p)return;const w=lS(n,b),E=$===0?l:0,x=h[$];for(let k=0;k<x.length;k++){const j=x[k],S=E+j[to];if(b===p&&S>=c)return;if(j.length===1){w.push([S]);continue}const R=f+j[XE],N=j[ZE],J=j[QE];w.push(j.length===4?[S,R,N,J]:[S,R,N,J,m+j[eS]])}}}function Qi(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}function lS(e,t){for(let n=e.length;n<=t;n++)e[n]=[];return e[t]}var Ta=class{constructor(t,n){const o=typeof t=="string";if(!o&&t._decodedMemo)return t;const r=Ca(t),{version:i,file:s,names:a,sourceRoot:l,sources:p,sourcesContent:c}=r;this.version=i,this.file=s,this.names=a||[],this.sourceRoot=l,this.sources=p,this.sourcesContent=c,this.ignoreList=r.ignoreList||r.x_google_ignoreList||void 0;const u=YE(n,l);this.resolvedSources=p.map(u);const{mappings:d}=r;if(typeof d=="string")this._encoded=d,this._decoded=void 0;else if(Array.isArray(d))this._encoded=void 0,this._decoded=tS(d,o);else throw r.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(r)}`);this._decodedMemo=iS(),this._bySources=void 0,this._bySourceMemos=void 0}};function cS(e){var t;return(t=e)._decoded||(t._decoded=qE(e._encoded))}function pS(e,t){const n=new Ta(uS(e,[]),t);return n._decoded=e.mappings,n}function uS(e,t){return{version:e.version,file:e.file,names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,mappings:t,ignoreList:e.ignoreList||e.x_google_ignoreList}}var dS=Object.defineProperty,kf=(e,t)=>dS(e,"name",{value:t,configurable:!0});const fS=We(import.meta.url),Pn=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ef=kf(e=>{if(typeof Pn<"u"&&Pn.versions&&Pn.versions.node){const[t,n]=Pn.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Pn.getBuiltinModule(e)}return fS(e)},"__cjs_getBuiltinModule"),{readFileSync:Pc}=Ef("node:fs"),{resolve:mS,toNamespacedPath:es,dirname:hS}=Ef("node:path");var gS=Object.defineProperty,ho=kf((e,t)=>gS(e,"name",{value:t,configurable:!0}),"s");const vS=/^data:application\/json[^,]+base64,/,yS=/\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+)[ \t]*$|\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*\*\/[ \t]*$/,bS=/\r?\n/,Sf=ho(e=>vS.test(e),"isInlineMap"),ts=ho((e,t)=>{const n=e instanceof Error?e.message:String(e),o=`${t}:
|
|
120
|
+
${n}`;throw new Error(o)},"enhanceError"),$S=ho((e,t)=>{const n=e.split(bS);let o;for(let i=n.length-1;i>=0&&!o;i--)o=yS.exec(n[i])??void 0;if(!o)return;const r=o[1]??o[2];if(r)return Sf(r)?r:mS(t,r)},"resolveSourceMapUrl"),wS=ho(e=>{const t=e.slice(e.indexOf(",")+1);return Buffer.from(t,"base64").toString()},"decodeInlineMap"),xS=ho(e=>{let t;try{t=Pc(e,{encoding:"utf8"})}catch(r){ts(r,`Error reading sourcemap for file "${es(e)}"`)}const n=$S(t,hS(e));if(!n)return;let o;if(Sf(n))o=wS(n);else try{o=Pc(n,{encoding:"utf8"})}catch(r){ts(r,`Error reading sourcemap for file "${es(e)}"`)}try{return new sS(o,n)}catch(r){ts(r,`Error parsing sourcemap for file "${es(e)}"`)}},"loadSourceMap");var kS=Object.defineProperty,ES=(e,t)=>kS(e,"name",{value:t,configurable:!0}),SS=Object.defineProperty,jS=ES((e,t)=>SS(e,"name",{value:t,configurable:!0}),"o");const AS=/\?[^?]*$/,OS=jS(({exclude:e,include:t}={})=>{const n=Qe(t,e);return{async load(o){if(!n(o))return;let r;try{r=await Nt(o,{buffer:!1}),this.addWatchFile(o)}catch{try{const s=o.replace(AS,"");r=await Nt(s,{buffer:!1}),this.addWatchFile(s)}catch{this.warn("Failed reading file");return}}let i;try{const s=xS(o);if(s===void 0)return r;i=s}catch{return this.warn("Failed resolving source map"),{code:r}}return{code:r,map:i}},name:"packem:sourcemaps"}},"sourcemapsPlugin");var RS=Object.defineProperty,CS=(e,t)=>RS(e,"name",{value:t,configurable:!0}),TS=Object.defineProperty,jf=CS((e,t)=>TS(e,"name",{value:t,configurable:!0}),"g");const _S=jf(async(e,t)=>{await new Promise((n,o)=>{const r=Ks(e);r.on("error",o);const i=fh(t);i.on("error",o),i.on("finish",()=>{n(void 0)}),r.pipe(i)})},"copy"),NS=jf(({destDir:e,emitFiles:t,exclude:n,fileName:o,include:r,limit:i,publicPath:s,sourceDir:a})=>{const l=Qe(r,n),p={};return{async generateBundle(c){if(!t)return;const u=e??c.dir??Z(c.file??"");await ys(u),await Promise.all(Object.keys(p).map(async d=>{const f=p[d],m=V(u,Z(f));await ys(m),await _S(d,V(u,f))}))},async load(c){if(!l(c))return;this.addWatchFile(c);const[u,d]=await Promise.all([so(c),Yo(c)]);let f;if(i&&u.size>i||i===0){const m=Nh.createHash("sha1").update(d).digest("hex").slice(0,16),h=rn(c),v=rt(c,h),y=a?Ae(a,Z(c)):rt(Z(c)),g=o.replaceAll("[hash]",m).replaceAll("[extname]",h).replaceAll("[dirname]",y===""?"":`${y}/`).replaceAll("[name]",v);f=V(s??"",g),p[c]=g}else{const m=nf.getType(c);if(m===null)throw new Error(`Could not determine mimetype for ${c}`);f=m==="image/svg+xml"?sh(d):d.toString("base64"),f=`data:${m};base64,${f}`}return`export default "${f}"`},name:"packem:url"}},"urlPlugin");var PS=Object.defineProperty,Re=(e,t)=>PS(e,"name",{value:t,configurable:!0}),MS=Object.defineProperty,jo=Re((e,t)=>MS(e,"name",{value:t,configurable:!0}),"i");let Af=class{static{Re(this,"WalkerBase")}static{jo(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:jo(()=>this.should_skip=!0,"skip"),remove:jo(()=>this.should_remove=!0,"remove"),replace:jo(t=>this.replacement=t,"replace")}}replace(t,n,o,r){t&&n&&(o!=null?t[n][o]=r:t[n]=r)}remove(t,n,o){t&&n&&(o!=null?t[n].splice(o,1):delete t[n])}};var IS=Object.defineProperty,Fn=Re((e,t)=>IS(e,"name",{value:t,configurable:!0}),"c$1");let WS=class extends Af{static{Re(this,"SyncWalker")}static{Fn(this,"SyncWalker")}constructor(t,n){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:Fn(()=>this.should_skip=!0,"skip"),remove:Fn(()=>this.should_remove=!0,"remove"),replace:Fn(o=>this.replacement=o,"replace")},this.enter=t,this.leave=n}visit(t,n,o,r){if(t){if(this.enter){const s=this.should_skip,a=this.should_remove,l=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,t,n,o,r),this.replacement&&(t=this.replacement,this.replace(n,o,r,t)),this.should_remove&&this.remove(n,o,r);const p=this.should_skip,c=this.should_remove;if(this.should_skip=s,this.should_remove=a,this.replacement=l,p)return t;if(c)return null}let i;for(i in t){const s=t[i];if(s&&typeof s=="object")if(Array.isArray(s)){const a=s;for(let l=0;l<a.length;l+=1){const p=a[l];lr(p)&&(this.visit(p,t,i,l)||l--)}}else lr(s)&&this.visit(s,t,i,null)}if(this.leave){const s=this.replacement,a=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,t,n,o,r),this.replacement&&(t=this.replacement,this.replace(n,o,r,t)),this.should_remove&&this.remove(n,o,r);const l=this.should_remove;if(this.replacement=s,this.should_remove=a,l)return null}}return t}};function lr(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}Re(lr,"n");Fn(lr,"isNode");var BS=Object.defineProperty,qn=Re((e,t)=>BS(e,"name",{value:t,configurable:!0}),"c");let DS=class extends Af{static{Re(this,"AsyncWalker")}static{qn(this,"AsyncWalker")}constructor(t,n){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:qn(()=>this.should_skip=!0,"skip"),remove:qn(()=>this.should_remove=!0,"remove"),replace:qn(o=>this.replacement=o,"replace")},this.enter=t,this.leave=n}async visit(t,n,o,r){if(t){if(this.enter){const s=this.should_skip,a=this.should_remove,l=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,await this.enter.call(this.context,t,n,o,r),this.replacement&&(t=this.replacement,this.replace(n,o,r,t)),this.should_remove&&this.remove(n,o,r);const p=this.should_skip,c=this.should_remove;if(this.should_skip=s,this.should_remove=a,this.replacement=l,p)return t;if(c)return null}let i;for(i in t){const s=t[i];if(s&&typeof s=="object")if(Array.isArray(s)){const a=s;for(let l=0;l<a.length;l+=1){const p=a[l];cr(p)&&(await this.visit(p,t,i,l)||l--)}}else cr(s)&&await this.visit(s,t,i,null)}if(this.leave){const s=this.replacement,a=this.should_remove;this.replacement=null,this.should_remove=!1,await this.leave.call(this.context,t,n,o,r),this.replacement&&(t=this.replacement,this.replace(n,o,r,t)),this.should_remove&&this.remove(n,o,r);const l=this.should_remove;if(this.replacement=s,this.should_remove=a,l)return null}}return t}};function cr(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}Re(cr,"a$1");qn(cr,"isNode");var LS=Object.defineProperty,Of=Re((e,t)=>LS(e,"name",{value:t,configurable:!0}),"a");function _a(e,{enter:t,leave:n}){return new WS(t,n).visit(e,null)}Re(_a,"walk");Of(_a,"walk");async function Rf(e,{enter:t,leave:n}){return await new DS(t,n).visit(e,null)}Re(Rf,"asyncWalk");Of(Rf,"asyncWalk");var FS=Object.defineProperty,$t=Re((e,t)=>FS(e,"name",{value:t,configurable:!0}),"l");const qS=/\s/,zS=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,HS=/MIT License|MIT license|BSD license/,JS=/\n{2,}/g,GS=/\b(\w+)\$\d+\b/g,US=/[-/\\^$*+?.()|[\]{}]/g,VS=$t(e=>e.replaceAll(US,String.raw`\$&`),"escapeRegex"),KS=$t(e=>[...new Set(e)],"unique"),YS=/\.[^/.]+$/;function Na(e){return HS.test(e)?"":e}Re(Na,"k");$t(Na,"stripLicenseComment");const XS=$t(e=>e.replaceAll(zS,Na).replaceAll(JS,`
|
|
121
|
+
|
|
122
|
+
`),"cleanUnnecessaryComments"),Mc=new Map;function Pa(e,t,{identifierReplacements:n},o){const r=br(e);let i=e;for(const a of Object.keys(n??{})){const l=r.find(c=>c.specifier===a&&c.imports.includes("{"));if(!l){this.warn(`${t.fileName} does not import "${a}" for replacement`),process.exitCode=1;continue}const p=n?.[a]??{};for(const c of Object.keys(p)){if(!l.imports.includes(c))throw new Error(`${t.fileName} does not import "${c}" from "${a}" for replacement`);const u=p[c],d=VS(c);u.includes(".")&&(i=i.replace(new RegExp(String.raw`\b\w+\b as ${d},?\s?`),"")),i=i.replaceAll(new RegExp(String.raw`\b${d}\b`,"g"),u)}}const s=KS(Array.from(i.matchAll(GS),a=>a[0]));if(s.length>0){const a=s.map(p=>`
|
|
123
|
+
- ${p}`).join(""),l=t.fileName.replace(YS,"");Mc.has(l)||o.warn({message:`${t.fileName} contains confusing identifier names${a}
|
|
124
|
+
|
|
125
|
+
To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),Mc.set(l,!0)}return i}Re(Pa,"O");$t(Pa,"replaceConfusingTypeNames");function Ma(e,t){if(!e.includes("@internal"))return e;const n=new ke(e),o=$r(t.fileName,e,{lang:"dts",sourceType:"module"}),r=$t(a=>{let l=a,p=!0;for(;p;){for(p=!1;l<e.length&&qS.test(e[l]);)l+=1;for(const c of o.comments)if(c.start===l){l=c.end,p=!0;break}}return l},"skipPastCommentsAndWhitespace"),i=[];for(const a of o.comments)a.type!=="Block"||!a.value.includes("@internal")||i.push({commentStart:a.start,nextStart:r(a.end)});i.length>0&&_a(o.program,{enter(a){if(a.type==="Program")return;const{end:l,start:p}=a;if(typeof p!="number"||typeof l!="number")return;const c=i.findIndex(f=>f.nextStart===p);if(c===-1)return;const[{commentStart:u}]=i.splice(c,1),d=e[l]===","?l+1:l;n.remove(u,d),this.skip()}});const s=n.toString();if(s.includes("@internal"))throw new Error(`${t.fileName} has unhandled @internal declarations`);return s}Re(Ma,"v");$t(Ma,"stripInternalTypes");const ZS=$t((e,t)=>({name:"packem:patch-types",renderChunk(n,o){return n=Pa.call(this,n,o,e,t),n=Ma.call(this,n,o),n=XS(n),n}}),"patchTypescriptTypes");var QS=Object.defineProperty,ej=(e,t)=>QS(e,"name",{value:t,configurable:!0}),tj=Object.defineProperty,et=ej((e,t)=>tj(e,"name",{value:t,configurable:!0}),"o");const nj=/^\./,oj=/\0/,rj=42,ij=et(e=>{let t=!1;for(let n=0;n<e.length;n++)if(e.codePointAt(n)===rj){if(t)return!1;t=!0}return!0},"hasZeroOrOneAsteriskCharacter"),sj=et(e=>{const t=e.indexOf("*");return t===-1?void 0:{prefix:e.slice(0,t),suffix:e.slice(t+1)}},"tryParsePattern"),aj=et(({prefix:e,suffix:t},n)=>n.length>=e.length+t.length&&n.startsWith(e)&&n.endsWith(t),"isPatternMatch"),lj=et((e,t,n)=>{let o,r=-1;for(const i of e){const s=t(i);aj(s,n)&&s.prefix.length>r&&(r=s.prefix.length,o=i)}return o},"findBestPatternMatch"),cj=et(e=>{const t=[],n=new Set;for(const o of e){if(!ij(o))continue;const r=sj(o);r?t.push(r):n.add(o)}return{exact:n,patterns:t}},"parsePathPatterns"),pj=et((e,t)=>e.exact.has(t)?t:lj(e.patterns,n=>n,t),"matchPatternOrExact"),uj=et((e,t)=>t.substring(e.prefix.length,t.length-e.suffix.length),"matchedText"),dj=et(({prefix:e,suffix:t})=>`${e}*${t}`,"patternText"),fj=et((e,t,n)=>{let o=Z(t.path);t.config.compilerOptions?.baseUrl&&(o=X(e,t.config.compilerOptions.baseUrl)),n?.debug({message:`Resolved baseUrl to ${o}`,prefix:"plugin:resolve-tsconfig-paths"});const r=t.config.compilerOptions?.paths??{};return Object.keys(r).length===0&&n?.debug({message:"No paths found in tsconfig.json",prefix:"plugin:resolve-tsconfig-paths"}),{paths:r,resolvedBaseUrl:o}},"getTsconfigPaths"),Cf=et((e,t,n,o)=>{const{paths:r,resolvedBaseUrl:i}=fj(e,t,n),s=Object.keys(r),a=cj(s);return{name:"plugin:resolve-tsconfig-paths",resolveId:{filter:{id:{exclude:[nj,oj]}},async handler(l,p,c){if(s.length===0)return;if(l.includes("\0")){n.debug({message:`Skipping resolution of ${l} as it is a virtual module`,prefix:"plugin:resolve-tsconfig-paths"});return}if(l.includes("node_modules")){n.debug({message:`Skipping request as it is inside node_modules ${l}`,prefix:"plugin:resolve-tsconfig-paths"});return}if(!o.resolveAbsolutePath&&Hs(l)){n.debug({message:`Skipping request as it is an absolute path ${l}`,prefix:"plugin:resolve-tsconfig-paths"});return}if(Wp(l)){n.debug({message:`Skipping request as it is a relative path ${l}`,prefix:"plugin:resolve-tsconfig-paths"});return}const u=pj(a,l);if(!u){n.debug({message:`moduleName did not match any paths pattern ${l}`,prefix:"plugin:resolve-tsconfig-paths"});return}const d=typeof u=="string"?void 0:uj(u,l),f=typeof u=="string"?u:dj(u);for(const m of r[f]){const h=d?m.replace("*",d):m;if(h.endsWith(".d.ts")||h.endsWith(".d.cts")||h.endsWith(".d.mts"))continue;const v=V(i,h);try{const y=await this.resolve(v,p,{skipSelf:!0,...c});if(y)return y}catch(y){n.debug({context:[y],message:`Failed to resolve ${v} from ${l}`,prefix:"plugin:resolve-tsconfig-paths"})}}}}}},"resolveTsconfigPathsPlugin");var mj=Object.defineProperty,hj=(e,t)=>mj(e,"name",{value:t,configurable:!0}),gj=Object.defineProperty,Tf=hj((e,t)=>gj(e,"name",{value:t,configurable:!0}),"u");const vj=/^\./,yj=Tf((e,t)=>{if(!t)return;const{config:n,path:o}=t;if(!n.compilerOptions)return;const{rootDirs:r}=n.compilerOptions;if(!r)return;const i=[];for(const s of r){if(s.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${o}.`);if(s.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${o}.`);i.push(X(e,s))}return i},"getRootDirectories"),_f=Tf((e,t,n)=>{const o=yj(e,n);return{name:"packem:resolve-tsconfig-root-dirs",resolveId:{filter:{id:vj},async handler(r,i,s){if(!(o===void 0||o.length===0)&&r.startsWith("."))for(const a of o){const l=V(a,r),p=await this.resolve(l,i,{skipSelf:!0,...s});if(p)return t.debug({message:`Resolved ${r} to ${p.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),p.id}}}}},"resolveTsconfigRootDirectories");var bj=Object.defineProperty,$j=(e,t)=>bj(e,"name",{value:t,configurable:!0}),wj=Object.defineProperty,Ia=$j((e,t)=>wj(e,"name",{value:t,configurable:!0}),"l");const xj={".cjs":[".cts"],".js":[".ts",".tsx"],".jsx":[".tsx",".ts"],".mjs":[".mts"]},Ic=/\.(?:[mc]?js|jsx)$/,kj=Ia(e=>{const t=e[0];return!(t==="."||t==="/"||t==="#"||vh(e))},"isBareSpecifier"),Wc=Ia(async(e,t,n,o,r,i)=>{for(const s of t)try{const a=await e.resolve(n+s,o,r);if(a)return a}catch(a){if(!i)throw a}},"tryRewrites"),Nf=Ia(()=>({name:"packem:resolve-typescript-mjs-cjs",resolveId:{filter:{id:Ic},async handler(e,t,n){if(!t)return;const o=Ic.exec(e);if(!o)return;const r=o[0],i=xj[r];if(!i)return;const s=e.slice(0,-r.length),a={...n,skipSelf:!0};return!kj(e)&&!t.includes("/node_modules/")&&!e.includes("/node_modules/")?Wc(this,i,s,t,a,!1):await this.resolve(e,t,a)||Wc(this,i,s,t,a,!0)}}}),"resolveTypescriptMjsCts");var Ej=Object.defineProperty,Pf=(e,t)=>Ej(e,"name",{value:t,configurable:!0}),Sj=Object.defineProperty,vt=Pf((e,t)=>Sj(e,"name",{value:t,configurable:!0}),"h");const jj=/^export\s+default\s+(\w+);/m,Aj=/export\s*\{([^}]*)\}/,Oj=/\s*as\s+default\s*/,Rj=/\s+\}$/,Ao=/;$/,Cj=/(?:\r?\n\s*){2,}/g,ns=/^type\s+/,Bc=/\bas\s+default\b/,Tj=vt((e,t,n)=>{const o=Sh(e).find(l=>l.names.includes("default")),r=jj.exec(e);if(r?.[1])return{defaultAlias:r[1],defaultExport:{code:r[0],end:r.index+r[0].length,names:["default"],specifier:void 0,start:r.index,type:"default"},exports:[]};if(!o)return;const i=Aj.exec(o.code);if(!i?.length){n.warn?.(`A default export was indicated in ${t.fileName}, but its structure could not be parsed.`);return}let s;const a=[];for(const l of i[1].split(",").map(p=>p.trim())){if(l==="default"){s=l;continue}const p=Oj.exec(l);p?s=l.replace(p[0],""):a.push(l)}if(!s){n.warn?.(`A default export was indicated in ${t.fileName}, but its alias could not be determined from the export statement.`);return}return{defaultAlias:s,defaultExport:o,exports:a}},"extractExports"),_j=vt((e,t,n)=>{if("declarations"in t&&t.declarations.length>0){const o=t.declarations[0];if(o?.id.type==="Identifier"){e.set(o.id.name,{declare:t.declare===!0,end:t.end,isVariable:!0,start:t.start});return}}if("id"in t&&t.id?.type==="Identifier"){const{name:o}=t.id;e.set(o,{declare:t.declare===!0,end:t.end,isClass:t.type==="ClassDeclaration",start:t.start});return}e.set(n(),{declare:t.declare===!0,end:t.end,start:t.start})},"prepareDeclaration"),no=vt((e,t,n,o)=>{const r=$r(n.fileName,e,{astType:"ts",lang:"ts",sourceType:"module"});let i,s=0;const a=vt(()=>(s+=1,`__unnamed_${String(s)}$$`),"generateUnnamed"),l=new Map,p=new Map,{program:c}=r;for(const m of c.body)if(m.type==="ExportNamedDeclaration")for(const h of m.specifiers)h.exported.type==="Identifier"&&(h.exported.name==="default"?h.local.type==="Identifier"&&(i={end:h.end,local:h.local.name,start:h.start}):p.set(h.exported.name,{type:h.exportKind==="type"}));else{if(m.type==="ImportDeclaration")continue;switch(m.type){case"ClassDeclaration":case"FunctionDeclaration":case"TSDeclareFunction":case"TSEnumDeclaration":case"TSInterfaceDeclaration":case"TSTypeAliasDeclaration":case"VariableDeclaration":{_j(l,m,a);break}case"TSImportEqualsDeclaration":case"TSModuleDeclaration":{l.set(a(),{declare:!1,end:m.end,start:m.start});break}}}const u=[];if(i)for(const[m,h]of p.entries())m!==i.local&&h.type&&u.push(m);if(!i){const m=[...p.values()].every(h=>h.type);return t.startsWith("export type")&&p.size>0&&m||o.warn?.(`Cannot infer default export from the file: ${n.fileName}`),t}if(!l.get(i.local))return o.warn?.(`Cannot infer default export from the file: ${n.fileName}. Declaration for '${i.local}' not found.`),t;const d=t,f=new ke(`${d}
|
|
126
|
+
declare namespace ${i.local} {
|
|
127
|
+
`);for(const[m,h]of l.entries()){if(u.includes(m)&&m!==i.local)continue;const v=e.slice(h.start,h.end).replace(Rj," }");f.append(" "),h.declare?f.append(v.replace("declare","export").replaceAll(" "," ")):f.append(`export ${v}`.replaceAll(" "," ")),f.append(`
|
|
128
|
+
`)}return f.append(` import _default = ${i.local};
|
|
129
|
+
export { _default as default };
|
|
130
|
+
`),f.append(`}
|
|
131
|
+
export = ${i.local};
|
|
132
|
+
`),f.toString()},"createCjsNamespace"),os=vt((e,t,n)=>{const{defaultExport:o,exports:r}=t;if(n){const u=r.length===0?`export = ${n.defaultImport??""};`:`// @ts-ignore
|
|
133
|
+
export = ${n.defaultImport??""};
|
|
134
|
+
export { ${r.join(", ")} } from '${o.specifier??""}'`,d=e.replace(o.code.replace(Ao,""),u.replace(Ao,""));return d.endsWith(";")?d:`${d};`}const i=`import _default from '${o.specifier??""}';`,s=new ke(e),a=br(e),l=a.length>0?a.at(-1):void 0;l?.end!==void 0&&l.end>0?s.appendRight(l.end,`
|
|
135
|
+
${i}
|
|
136
|
+
`):s.prepend(`${i}
|
|
137
|
+
`);let p=s.toString();p=p.replaceAll(Cj,`
|
|
138
|
+
`);let c;if(r.length===0)c=p.replace(o.code.replace(Ao,""),"export = _default");else{const u=`// @ts-ignore
|
|
139
|
+
export = _default;
|
|
140
|
+
export { ${r.join(", ")} } from '${o.specifier??""}';`;c=p.replace(o.code.replace(Ao,""),u)}return c.replaceAll(";;",";")},"handleDefaultCJSExportAsDefault"),Nj=vt((e,t,n,o,r,i)=>{const{defaultAlias:s,defaultExport:a,exports:l}=n;if(i){if(i.namedImports?.[s]===s){if(l.length===0)return e.replace(a.code,`export = ${s}`);const f=`export { ${l.join(", ")} } from '${a.specifier??""}'`,m=new ke(e).replace(a.code,f).toString();return no(e,m,t,r)}r.warn?.(`Cannot parse "${s}" named export from ${i.specifier} import at ${t.fileName}!.`);return}const p=`import { ${s} } from '${a.specifier??""}';
|
|
141
|
+
`;let c=e;const u=o.length>0?o.at(-1)?.end??0:0,d=new ke(c);if(u>0?d.appendRight(u,`
|
|
142
|
+
${p}`):d.prepend(p),c=d.toString(),l.length>0){const f=`export { ${l.join(", ")} } from '${a.specifier??""}'`,m=new ke(c).replace(a.code,f).toString();return no(e,m,t,r)}return new ke(c).replace(a.code,`export = ${s}`).toString()},"handleDefaultNamedCJSExport"),Dc=vt((e,t,{defaultAlias:n,defaultExport:o,exports:r},i)=>{const s=r.filter(l=>ns.test(l)),a=r.filter(l=>!ns.test(l));if(s.length>0){let l="";return n&&(l+=`// @ts-ignore
|
|
143
|
+
${n};
|
|
144
|
+
`),l+=`export type { ${s.map(p=>p.replace(ns,"").trim()).join(", ")} };
|
|
145
|
+
`,a.length>0&&(l+=`export { ${a.join(", ")} };
|
|
146
|
+
`),no(e,l.trim(),t,i)}if(n&&a.length>0&&s.length===0){let l=`// @ts-ignore
|
|
147
|
+
${n};
|
|
148
|
+
`;return l+=`export { ${a.join(", ")} };
|
|
149
|
+
`,no(e,l.trim(),t,i)}if(n&&a.length===0&&s.length===0){const l=new RegExp(String.raw`^export\\s+default\\s+${n};`,"m").exec(e);return l?`${e.slice(0,Math.max(0,l.index))}export = ${n};`:e.replace(o.code,`export = ${n};`).replace(";;",";")}},"handleNoSpecifierDefaultCJSExport"),Pj=/^export\s+default\s+from\s+['"]([^'"]+)['"];?$/m,Mj=vt((e,t,n)=>{const o=Pj.exec(e);if(o)return{code:`import _default from '${o[1]??""}';
|
|
150
|
+
export = _default;`,map:void 0};const r=Tj(e,t,n);if(r){let l;if(r.defaultExport.specifier){const{specifier:p}=r.defaultExport,c=br(e),u=c.filter(y=>y.imports).map(y=>Eh(y)),d=u.find(y=>y.specifier===p),{defaultAlias:f,defaultExport:m,exports:h}=r,v=m.exports;if(f==="default"&&m.specifier&&h.length>0)l=os(e,r,d);else if(f==="default"&&m.specifier&&h.length===0&&v&&Bc.test(v))u.find(y=>y.specifier===m.specifier)?.defaultImport?l=os(e,r,d):(n.warn?.(`Cannot parse default export name from ${m.specifier} import at ${t.fileName}!. The module might not have a default export, or it's aliased as 'default'.`),l=void 0);else if(f==="default"&&m.specifier&&h.length===0)l=os(e,r,d);else if(m.specifier&&f!=="default"){l=Nj(e,t,r,c,n,d);const y=d&&r.defaultExport.specifier&&f!=="default"&&d.namedImports?.[f]!==f;if(!(l===void 0&&y)&&l===void 0&&!(f==="default"&&h.length===0&&v&&Bc.test(v))){const g=Dc(e,t,r,n);g&&(l=g)}}}else l=Dc(e,t,r,n);return l?{code:l,map:void 0}:void 0}const i=$r(t.fileName,e,{astType:"ts",lang:"ts",sourceType:"module"});let s=[],a=!1;if(i.program.body.length>0){const l=i.program.body.at(-1);l?.type==="ExportNamedDeclaration"&&!l.declaration&&l.specifiers.length>0&&l.specifiers.every(p=>p.exportKind==="type")&&(a=!0,s=l.specifiers.map(p=>p.local.type==="Identifier"?p.local.name:"").filter(Boolean))}if(a&&s.length>0){const l=`export type { ${s.join(", ")} };`,p=no(e,l,t,n);return p?{code:p,map:void 0}:void 0}},"fixDtsDefaultCJSExports");var Ij=Object.defineProperty,Lc=Pf((e,t)=>Ij(e,"name",{value:t,configurable:!0}),"s");const Wj=/\.d\.c?ts$/,Bj=Lc((e={})=>{const{matcher:t=Lc(n=>n.exports.length>0&&Wj.test(n.fileName)&&n.isEntry,"matcher")}=e;return{name:"packem:fix-dts-default-cjs-exports-plugin",renderChunk(n,o){return t(o)?Mj(n,{fileName:o.fileName,imports:o.imports},{warn:this.warn}):void 0}}},"fixDtsDefaultCjsExportsPlugin"),Hr=(e,t={},n={})=>({...t,...e,values:e.values?{...e.values}:{...n}}),oo=e=>!!e?.endsWith(".d"),ce=e=>e.logger,Dj=/Circular dependency:[\s\S]*node_modules/,Lj=/\.mts$/,Fj=/\.(?:m|c)?(?:j|t)sx?$/,qj=/^['|"](use (\w+))['|"]$/,zj=/\.(?:[cm]?jsx?|[cm]?tsx?|json)$/,Hj=e=>e instanceof RegExp?e.source:e,Jj=e=>{if(typeof e=="boolean")return String(e);const t=[];for(const n of e)t.push(Hj(n));return t.toSorted((n,o)=>n.localeCompare(o)).join(",")},Fc=(e,t)=>t?n=>{if(!oo(n.name))return`${n.name}.${e()}`}:n=>{if(!oo(n.name))return Jn(n,e())},qc=(e,t)=>t?n=>{const{name:o}=n;if(!oo(o))return`${o??"[name]"}.${e(n)}`}:n=>{const{name:o}=n;if(!oo(o))return ah(n,e(n))},Mf=e=>{const t=`node${Uo.node.split(".")[0]}`;if(!e.pkg.engines?.node)return t;const n=qe.minVersion(e.pkg.engines.node);return n?`node${String(n.major)}`:t},If=(e,t,n)=>{const o=e.options.browserTargets&&e.options.browserTargets.length>0?e.options.browserTargets:e.options.resolvedBrowserTargets??e.options.browserTargets??[];if(t){const r=Qm(t);return e.options.runtime==="node"?[...new Set([n,...r])]:e.options.runtime==="browser"?[...new Set([...Ga(o),...r])]:r}return e.options.runtime==="node"?[n]:Ga(o)},Gj=(e,t)=>{if(!e.options.rollup.esbuild)throw new Error("No esbuild options found in your configuration.");const n=e.tsconfig?.config.compilerOptions?.target?.toLowerCase()==="es3";n&&ce(e).warn(["ES3 target is not supported by esbuild, so ES5 will be used instead..","Please set 'target' option in tsconfig to at least ES5 to disable this error"].join(" "));const o=n?"es5":If(e,e.options.rollup.esbuild.target,t);let r=e.options.rollup.esbuild.keepNames;return e.options.minify||(r=!1,ce(e).debug("Disabling keepNames because minify is disabled")),(n||e.tsconfig?.config.compilerOptions?.target==="es5")&&(r=!1,ce(e).debug("Disabling keepNames because target is set to es5")),{logger:ce(e),minify:e.options.minify,minifyWhitespace:e.options.minify,sourceMap:e.options.sourcemap,...e.options.rollup.esbuild,keepNames:r,target:o}},Uj=e=>{if(!e.options.rollup.swc)throw new Error("No swc options found in your configuration.");return{minify:e.options.minify,...e.options.rollup.swc,jsc:{minify:{compress:{directives:!1,passes:2},format:{comments:"some"},mangle:{topLevel:!0},sourceMap:e.options.sourcemap,toplevel:e.options.emitCJS??e.options.emitESM},...e.options.rollup.swc.jsc},sourceMaps:e.options.sourcemap}},Wf=(e,t)=>{if(!e.options.rollup.oxc)throw new Error("No oxc options found in your configuration.");const{jsx:n}=e.options.rollup.oxc;let o;return typeof n=="string"?o=n:n?o={...n,refresh:!1}:o=void 0,e.options.rollup.oxc={...e.options.rollup.oxc,cwd:e.options.rootDir,jsx:o,sourcemap:e.options.sourcemap,typescript:e.tsconfig?.config?{allowDeclareFields:!0,allowNamespaces:!0,declaration:void 0,jsxPragma:e.tsconfig.config.compilerOptions?.jsxFactory,jsxPragmaFrag:e.tsconfig.config.compilerOptions?.jsxFragmentFactory,onlyRemoveTypeImports:!0,rewriteImportExtensions:!1}:void 0},e.options.rollup.oxc.target=If(e,e.options.rollup.oxc.target,t),e.options.rollup.oxc},Vj=(e,t,n)=>{if(n)return"js";if(t.facadeModuleId?.endsWith(".mts")){const o=t.facadeModuleId.replace(Lj,".cts");if(Vs(o))return"mjs"}return!e.options.emitCJS&&e.options.emitESM&&e.pkg.main?.endsWith(".cjs")?"mjs":Me(e,"esm")},Kj=(e,t)=>{const n=Mf(t);if(e==="esbuild")return Gj(t,n);if(e==="swc")return Uj(t);if(e==="sucrase"){if(!t.options.rollup.sucrase)throw new Error("No sucrase options found in your configuration.");return t.options.rollup.sucrase}if(e==="oxc")return Wf(t,n);throw new Error("A Unknown transformer was provided")},Yj=e=>{const{browser:t,exportConditions:n}=e,o={...e};delete o.allowExportsFolderMapping,delete o.browser,delete o.exportConditions,delete o.preferBuiltins,delete o.unresolvedImportBehavior;const r=new Set(Array.isArray(o.conditionNames)?o.conditionNames:[]);return Array.isArray(n)&&(o.conditionNames=[...new Set([...n,...r])]),t&&(o.conditionNames=[...new Set(["browser",...o.conditionNames??[]])],o.aliasFields=[["browser"],...o.aliasFields??[]]),o},Bf=e=>{const{resolve:t}=e.options.rollup;if(t)return Bm(Yj(t),e.options.rootDir,ce(e),e.tsconfig?.path)},Df=(e,t)=>{if(e.code==="CIRCULAR_DEPENDENCY"&&Dj.test(e.message))return!0;if(e.code==="UNRESOLVED_IMPORT"){const{resolve:n}=t.options.rollup;if(n&&n.unresolvedImportBehavior==="warn")return!1;const o=new Error(`Failed to resolve the module "${e.exporter??""}" imported by "${ne(Ae(X(),e.id??""))}"
|
|
151
|
+
Is the module installed? Note:
|
|
152
|
+
↳ to inline a module into your bundle, install it to "devDependencies".
|
|
153
|
+
↳ to depend on a module via import/require, install it to "dependencies".`);throw o.id=e.id,o}return e.code==="MODULE_LEVEL_DIRECTIVE"?!0:e.code==="MIXED_EXPORTS"&&(t.options.cjsInterop??!1)},Xj=e=>{const t={};for(const n of e.options.entries){if(n.name===void 0)continue;const{name:o}=n,r=X(e.options.rootDir,n.input);if(t[o]!==void 0&&t[o]!==r)throw new Error(`Duplicate rollup input name "${o}" — one maps to "${t[o]}", another to "${r}". Each entry must have a unique name.`);t[o]=r}return t},Zj=e=>e.stack?`${e.message}
|
|
154
|
+
${e.stack}`:e.message,Qj=(e,t,n,o)=>{if(t==="dts"&&o.code==="EMPTY_BUNDLE")return;const r=Zj(o),i=t+(o.plugin?`:plugin:${o.plugin}`:"");switch(n){case"info":{ce(e).info({message:r,prefix:i});return}case"warn":{ce(e).warn({message:r,prefix:i});return}case"debug":ce(e).debug({message:r,prefix:i})}},Lf=(e,t)=>({input:Xj(e),logLevel:e.options.debug?"debug":"info",onLog:(n,o)=>{Qj(e,t,n,o)},onwarn(n,o){Df(n,e)||n.code||o(n)},preserveEntrySignatures:"strict",treeshake:{moduleSideEffects:!0,preset:"smallest"},watch:e.mode==="watch"?e.options.rollup.watch:!1}),e9=(e,t,n,o)=>{const r={...e.options.rollup.alias,entries:t};return!n&&o&&(r.customResolver=o),Up(r)},t9=e=>{if(!e.options.rollup.pure)return{pureNewExpressionPluginInstance:void 0,purePluginInstance:void 0};const t=Dm({...e.options.rollup.pure,functions:["Object.defineProperty","Object.assign","Object.create","Object.freeze","Object.seal","Object.setPrototypeOf","Object.getOwnPropertyDescriptor","Object.getOwnPropertyDescriptors","Object.getPrototypeOf","Object.hasOwnProperty","Object.isExtensible","Object.isFrozen","Object.isSealed","Symbol","Symbol.for","Symbol.keyFor","Symbol.iterator","Symbol.asyncIterator","Symbol.hasInstance","Symbol.isConcatSpreadable","Symbol.species","Symbol.toPrimitive","Symbol.toStringTag","Proxy","Reflect.apply","Reflect.construct","Reflect.defineProperty","Reflect.deleteProperty","Reflect.get","Reflect.getOwnPropertyDescriptor","Reflect.getPrototypeOf","Reflect.has","Reflect.isExtensible","Reflect.ownKeys","Reflect.preventExtensions","Reflect.set","Reflect.setPrototypeOf","WeakMap","WeakSet","WeakRef","Array.from","Array.of","Array.isArray","Number.isFinite","Number.isInteger","Number.isNaN","Number.isSafeInteger","Number.parseFloat","Number.parseInt","String.fromCharCode","String.fromCodePoint","String.raw","Date.now","Date.parse","Date.UTC","Math.abs","Math.acos","Math.acosh","Math.asin","Math.asinh","Math.atan","Math.atan2","Math.atanh","Math.cbrt","Math.ceil","Math.clz32","Math.cos","Math.cosh","Math.exp","Math.expm1","Math.floor","Math.fround","Math.hypot","Math.imul","Math.log","Math.log10","Math.log1p","Math.log2","Math.max","Math.min","Math.pow","Math.random","Math.round","Math.sign","Math.sin","Math.sinh","Math.sqrt","Math.tan","Math.tanh","Math.trunc","JSON.parse","JSON.stringify","require.resolve","Buffer.from","Buffer.alloc","Buffer.allocUnsafe","Buffer.isBuffer",...e.options.rollup.pure.functions??[]],sourcemap:e.options.sourcemap});return t.transform.order="pre",{pureNewExpressionPluginInstance:Lm({constructors:["Proxy","WeakMap","WeakSet","WeakRef",...e.options.rollup.pure.functions?.filter(n=>typeof n=="string"&&!n.includes("."))??[]],sourcemap:e.options.sourcemap}),purePluginInstance:t}},n9=(e,t,n)=>{if(e.pkg.peerDependenciesMeta)for(const[o,r]of Object.entries(e.pkg.peerDependenciesMeta))r&&typeof r=="object"&&"optional"in r&&r.optional&&o in t&&n.push(o)},o9=(e,t,n)=>{if(!e.options.rollup.resolveExternals?.devDeps)for(const o of Object.keys(e.pkg.devDependencies??{}))e.usedDependencies.has(o)&&!(o in t)&&n.push(o)},r9=e=>{const t=new Set,n=[];for(const o of e)typeof o=="string"?t.has(o)||(t.add(o),n.push(o)):n.push(o);return n},i9=e=>{const t=e.options.rollup.dts?.resolve;if(t===!1)return!1;if(t===!0)return!0;const n=Object.keys(e.pkg.optionalDependencies??{}),o=e.pkg.peerDependencies??{};return n9(e,o,n),o9(e,o,n),n.length===0&&!t?!1:r9([...n,...t??[]])},s9=async(e,t)=>{const{dts:n}=await import("@visulima/rollup-plugin-dts"),o=e.options.rollup.dts??{};return n({...o,compilerOptions:{...o.compilerOptions,incremental:void 0,inlineSources:void 0,lib:void 0,sourceMap:void 0,tsBuildInfoFile:void 0},emitDtsOnly:!0,resolve:t,tsconfig:e.tsconfig?.path})},a9=Gs(s9),Ff=async(e,t)=>{const n=Br(e.pkg,e.options),o=i9(e),r=Bf(e),i=Jj(o),s=e.options.entries.map(u=>u.name??"").filter(u=>u!=="").toSorted((u,d)=>u.localeCompare(d)).join(","),a=`dts-plugin:${String(process.pid)}${e.tsconfig?.path??""}:${i}:${s}`,[l,p,c]=Xp(e.options.rollup.plugins,"dts");return{...Lf(e,"dts"),onwarn(u,d){Df(u,e)||u.code!=="EMPTY_BUNDLE"&&u.code!=="CIRCULAR_DEPENDENCY"&&d(u)},output:[e.options.emitCJS&&{chunkFileNames:u=>Jn(u,Ye(e,"cjs")),compact:e.options.minify,dir:X(e.options.rootDir,e.options.outDir),entryFileNames:`[name].${Ye(e,"cjs")}`,format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.emitESM&&{chunkFileNames:u=>Jn(u,Ye(e,"esm")),compact:e.options.minify,dir:X(e.options.rootDir,e.options.outDir),entryFileNames:`[name].${Ye(e,"esm")}`,format:"esm",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.declaration==="compatible"&&{chunkFileNames:u=>Jn(u,"d.mjs"),compact:e.options.minify,dir:X(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output}].filter(Boolean),plugins:[Jp(),Ee(Zd(),t),Ee(Nf(),t),gf(e,{dtsResolve:o,forTypes:!0,skipUnlistedWarnings:!0}),{load(u){if(!zj.test(u))return""},name:"packem:ignore-files"},e.tsconfig&&Ee(_f(e.options.rootDir,ce(e),e.tsconfig),t),e.tsconfig&&e.options.rollup.tsconfigPaths&&Ee(Cf(e.options.rootDir,e.tsconfig,ce(e),e.options.rollup.tsconfigPaths),t),$f(e),e.options.rollup.replace&&Gp(Hr(e.options.rollup.replace,{sourcemap:e.options.sourcemap})),e.options.rollup.alias&&Up({customResolver:r,...e.options.rollup.alias,entries:n}),...l,r,...p,...await a9(a)(e,o),e.options.emitCJS&&Bj(),e.options.cjsInterop&&e.options.emitCJS&&lu({...e.options.rollup.cjsInterop,logger:ce(e)}),e.options.rollup.patchTypes&&Ee(ZS(e.options.rollup.patchTypes,ce(e)),t),WE(),...c,e.options.rollup.license!==!1&&e.options.rollup.license?.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&yf({licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dtsTemplate,logger:ce(e),marker:e.options.rollup.license.dtsMarker??"TYPE_DEPENDENCIES",mode:"types",packageName:e.pkg.name})].filter(Boolean)}},qf=async(e,t,n)=>{const o=Br(e.pkg,e.options),r=n==="rolldown",i=r?void 0:Bf(e),s=e.options.rollup.css&&e.options.rollup.css.loaders&&e.options.rollup.css.loaders.length>0?await import("@visulima/rollup-plugin-css"):void 0,a=!!(e.options.unbundle||e.options.rollup.output?.preserveModules),l=a?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output?.preserveModulesRoot??e.options.sourceDir}:{manualChunks:d1(e.dependencyGraphMap,e.buildEntries,!r&&!!e.options.rollup.preserveDirectives),preserveModules:!1},[p,c,u]=Xp(e.options.rollup.plugins,"build"),d=e.tsconfig?.config.compilerOptions?.esModuleInterop,{pureNewExpressionPluginInstance:f,purePluginInstance:m}=t9(e);return{...Lf(e,"build"),output:[e.options.emitCJS&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:Fc(()=>Me(e,"cjs"),a),compact:e.options.minify,dir:X(e.options.rootDir,e.options.outDir),entryFileNames:qc(h=>Me(e,"cjs"),a),esModule:d??"if-default-prop",exports:"auto",extend:!0,externalLiveBindings:!1,format:"cjs",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,interop:"compat",sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...l},e.options.emitESM&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:Fc(()=>Me(e,"esm"),a),compact:e.options.minify,dir:X(e.options.rootDir,e.options.outDir),entryFileNames:qc(h=>Vj(e,h,a),a),esModule:d??"if-default-prop",exports:"auto",extend:!0,externalLiveBindings:!1,format:"esm",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...l}].filter(Boolean),plugins:[!r&&Jp(),jk(),Ee(Zd(),t),gf(e),Nf(),e.tsconfig&&Ee(_f(e.options.rootDir,ce(e),e.tsconfig),t),e.tsconfig&&e.options.rollup.tsconfigPaths&&Ee(Cf(e.options.rootDir,e.tsconfig,ce(e),e.options.rollup.tsconfigPaths),t),$f(e),e.options.rollup.replace&&Gp(Hr(e.options.rollup.replace,{sourcemap:e.options.sourcemap})),e.options.rollup.alias&&e9(e,o,r,i),...p,i,e.options.rollup.nativeModules&&nE(e.options.rollup.nativeModules),e.options.rollup.dataUri&&V1({...e.options.rollup.dataUri}),e.options.rollup.polyfillNode&&Fm({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),!r&&e.options.rollup.json&&Ph({...e.options.rollup.json}),e.options.rollup.debarrel&&y2(e.options.rollup.debarrel,ce(e)),!r&&qm(),e.options.rollup.wasm&&zm(e.options.rollup.wasm),e.options.rollup.url&&NS(e.options.rollup.url),s&&Ee(s.rollupCssPlugin({dts:!!e.options.declaration,sourceMap:e.options.sourcemap,...e.options.rollup.css},e.options.runtime==="browser"&&(!e.options.browserTargets||e.options.browserTargets.length===0)?e.options.resolvedBrowserTargets??[]:e.options.browserTargets??[],e.options.rootDir,e.options.sourceDir,e.environment,e.options.sourcemap,e.options.debug,e.options.minify??!1,o),t),e.options.rollup.css&&e.options.rollup.css.loaders&&e.options.rollup.css.loaders.length>0&&(e.options.declaration||e.options.rollup.css.dts)&&s?.cssModulesTypesPlugin(e.options.rollup.css,e.options.rootDir),e.options.rollup.raw&&Ee(aE(e.options.rollup.raw),t),e.options.sourcemap&&OS(e.options.rollup.sourcemap),...c,e.options.rollup.minifyHTMLLiterals&&e.options.minify&&Xk({...e.options.rollup.minifyHTMLLiterals,logger:ce(e)}),e.options.rollup.requireCJS&&e.options.emitESM&&Ee(SE({...e.options.rollup.requireCJS,cwd:e.options.rootDir},ce(e)),t),e.options.rollup.babel&&Ee(N1({include:e.options.rollup.babel.include??Fj,...e.options.rollup.babel,root:e.options.rootDir,sourceMaps:e.options.rollup.babel.sourceMaps??e.options.sourcemap}),t),!r&&f,!r&&m,e.options.rollup.detectDuplicated!==!1&&Q2(ce(e),e.options.rootDir,e.options.rollup.detectDuplicated),!r&&e.options.transformer&&Ee(e.options.transformer(Kj(e.options.transformerName,e)),t),!r&&e.options.rollup.preserveDirectives&&Hm({directiveRegex:qj,...e.options.rollup.preserveDirectives,logger:ce(e)}),e.options.rollup.shebang&&IE(e.options.entries.filter(h=>h.executable).map(h=>h.name).filter(Boolean),e.options.rollup.shebang),!r&&e.options.cjsInterop&&e.options.emitCJS&&lu({...e.options.rollup.cjsInterop,logger:ce(e)}),e.options.rollup.dynamicVars&&Dx(),!r&&e.options.rollup.dynamicVars&&Jm(e.options.rollup.dynamicVars),!r&&e.options.rollup.commonjs&&Ee(Gm({sourceMap:e.options.sourcemap,...e.options.rollup.commonjs}),t),e.options.rollup.preserveDynamicImports&&{name:"packem:preserve-dynamic-imports",renderDynamicImport(){return{left:"import(",right:")"}}},e.options.cjsInterop&&e.options.rollup.shim&&ak(e.pkg,e.options.rollup.shim),!r&&e.options.rollup.jsxRemoveAttributes&&Ee(Um({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:ce(e)}),t),...u,e.options.rollup.metafile&&Hx(),e.options.rollup.copy&&B1(e.options.rollup.copy,ce(e)),e.options.rollup.license!==!1&&e.options.rollup.license?.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&yf({dtsMarker:e.options.rollup.license.dtsMarker??"TYPE_DEPENDENCIES",licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dependenciesTemplate,logger:ce(e),marker:e.options.rollup.license.dependenciesMarker??"DEPENDENCIES",mode:"dependencies",packageName:e.pkg.name}),e.options.analyze&&e.options.rollup.visualizer!==!1&&Vm({brotliSize:!0,gzipSize:!0,projectRoot:e.options.rootDir,sourcemap:e.options.sourcemap,...e.options.rollup.visualizer,filename:"packem-bundle-analyze.html",title:"Packem Visualizer"})].filter(Boolean),preserveEntrySignatures:"strict"}},zf=(e,t)=>qf(e,t,"rollup"),l9=e=>{if(!e.options.rollup.oxc)return{};const t=Wf(e,Mf(e));return{jsx:t.jsx,target:t.target,typescript:t.typescript}},c9=async(e,t)=>{const n=await qf(e,t,"rolldown");return n.transform=l9(e),e.options.minify&&Array.isArray(n.output)&&(n.output=n.output.map(o=>({...o,minify:!0}))),n},Hf=(e,t,n)=>{const o=e.filter(i=>i.type==="chunk"&&i.isEntry),r=new Set(o.map(i=>i.fileName));for(const i of o)t.buildEntries.push({chunks:(i.imports??[]).filter(s=>r.has(s)),dynamicImports:i.dynamicImports??[],exports:i.exports??[],modules:Object.entries(i.modules??{}).map(([s,a])=>({bytes:a.renderedLength,id:s})),path:i.fileName,size:{bytes:Buffer.byteLength(i.code??"","utf8")},type:"entry"});for(const i of e.filter(s=>s.type==="asset")){if(n.has(i.fileName))continue;const s=i.source??"",a=typeof s=="string"?Buffer.byteLength(s,"utf8"):s.byteLength;n.set(i.fileName,{path:i.fileName,size:{bytes:a},type:"asset"})}},Jf=async(e,t)=>{try{return t(await e())}catch{return}},Gf="Rollup is not installed. Please install 'rollup' to use bundler: 'rollup' or DTS generation with the rollup driver.",Wa=async()=>{const e=await Jf(()=>import("rollup"),t=>t.rollup);if(!e)throw new Error(Gf);return e},p9=async()=>{const e=await Jf(()=>import("rollup"),t=>t.watch);if(!e)throw new Error(Gf);return e},zc="rollup-build.json",nn="dependencies-cache.json",Uf=e=>e??"rollup",u9={".css":"js",".less":"js",".pcss":"js",".sass":"js",".scss":"js",".styl":"js",".stylus":"js"},d9=async(e,t,n,o)=>{const r=e.options.validation&&e.options.validation.dependencies!==!1&&!!t.get(nn,n),i=!e.options.validation||e.options.validation.dependencies===!1||r;let s=o;if(i&&(s={...o,cache:t.get(zc,n)},r)){const l=t.get(nn,n);l&&(l.used?.forEach(p=>e.usedDependencies.add(p)),l.hoisted?.forEach(p=>e.hoistedDependencies.add(p)))}const a=await(await Wa())(s);try{i&&t.set(zc,a.cache,n),e.options.validation&&e.options.validation.dependencies!==!1&&t.set(nn,{hoisted:[...e.hoistedDependencies],used:[...e.usedDependencies]},n),await e.hooks.callHook("rollup:build",e,a);const l=new Map;for(const p of o.output){const{output:c}=await a.write(p);Hf(c,e,l)}e.buildEntries.push(...l.values())}finally{await a.close()}},f9=async(e,t,n,o)=>{if(e.options.validation&&e.options.validation.dependencies!==!1&&t.get(nn,n)){const a=t.get(nn,n);a&&(a.used?.forEach(l=>e.usedDependencies.add(l)),a.hoisted?.forEach(l=>e.hoistedDependencies.add(l)))}const r=await Yd(),i={...o,moduleTypes:{...u9,...o.moduleTypes}},s=await r(i);try{e.options.validation&&e.options.validation.dependencies!==!1&&t.set(nn,{hoisted:[...e.hoistedDependencies],used:[...e.usedDependencies]},n),await e.hooks.callHook("rollup:build",e,s);const a=new Map;for(const l of o.output){const{output:p}=await s.write(l);Hf(p,e,a)}e.buildEntries.push(...a.values())}finally{await s.close?.()}},m9=async(e,t,n,o)=>{const r=o==="rolldown",i=r?await c9(e,t):await zf(e,t);await e.hooks.callHook("rollup:options",e,i),Object.keys(i.input??{}).length!==0&&(await(r?f9(e,t,n,i):d9(e,t,n,i)),await t.flush())},Hc=async e=>{try{return await(e==="rolldown"?Yd():Wa()),!0}catch{return!1}},Jc=(e,t)=>{const n=[V(t,"noop.js"),import.meta.url];for(const o of n)try{return We(o).resolve(e),!0}catch{}return!1},Vf=async(e,t,n,o,r)=>{if(!(process.stdout.isTTY&&!process.env.CI)){const a=await vl(e,n);throw new Error(`${e} is required but is not installed. Run: ${a}`)}const i=await Mh({initialValue:!0,message:t});if(Ih(i)||!i){const a=await vl(e,n);throw new Error(`Cannot continue without ${e}. Run: ${a}`)}const s=Wh();s.start(`Installing ${e}`);try{await Bp([e],{cwd:n,dev:!0,silent:!0}),s.stop(`Installed ${e}`)}catch(a){throw s.stop(`Failed to install ${e}`),a}if(!await r())throw o.error(`Installed ${e} but it still cannot be loaded. Try restarting packem.`),new Error(`${e} was installed but is not loadable in the current process. Re-run packem to pick it up.`)},Gc=async(e,t,n)=>{await Hc(e)||await Vf(e,`${e} is required as the bundler but is not installed. Install it now?`,t,n,()=>Hc(e))},h9=async(e,t,n)=>{const o=lw[e];Jc(o,t)||await Vf(o,`${o} is required for transformer: "${e}" but is not installed. Install it now?`,t,n,()=>Promise.resolve(Jc(o,t)))},Jr=e=>{const t=V(e,"package.json");if(!nt(t))throw new Error(`package.json not found at ${t}`);const n=da(t,{resolveCatalogs:!0});return n.publishConfig&&Object.assign(n,n.publishConfig),{packageJson:n,packageJsonPath:t}},g9=async(e,t,n,o)=>{let r;if(o){const i=V(e,o);if(!await pn(i))throw new Error(`tsconfig.json not found at ${i}`);r={config:Bh(i),path:i},n.info("Using tsconfig settings at",i)}else if(bd(t,["typescript"]))try{r=await Dh(e),n.debug("Using tsconfig settings found at",r.path)}catch{n.info("No tsconfig.json or jsconfig.json found.")}return r},v9=/^\.\.?\//,y9=(e,t)=>{if(e.executable&&(e.cjs===void 0||e.esm===void 0)){t.pkg.type==="commonjs"&&e.cjs===void 0&&t.options.emitCJS!==void 0?(e.cjs=t.options.emitCJS,e.esm=!1):t.pkg.type==="module"&&e.esm===void 0&&t.options.emitESM!==void 0&&(e.esm=t.options.emitESM,e.cjs=!1);return}e.cjs!==void 0||e.esm!==void 0||e.declaration||(t.options.emitCJS!==void 0&&(e.cjs=t.options.emitCJS),t.options.emitESM!==void 0&&(e.esm=t.options.emitESM))},Uc=(e,t)=>{if(typeof e.name!="string"){let n=Hs(e.input)?Ae(t.options.rootDir,e.input):Ip(e.input);n.startsWith("./")&&(n=n.slice(2)),e.name=n.replace(new RegExp(`^${t.options.sourceDir}/`),"").replace(Us,"")}if(!e.input)throw new Error(`Missing entry input: ${JSON.stringify(e)}`);Wp(e.input)&&(e.input=X(t.options.rootDir,e.input)),t.options.declaration&&e.declaration===void 0&&(e.declaration=t.options.declaration),y9(e,t),e.outDir=X(t.options.rootDir,e.outDir??t.options.outDir)},b9=e=>{e.options.entries=e.options.entries.map(t=>typeof t=="string"?{input:t,isGlob:vs(t)}:{...t,exportKey:t.exportKey??new Set,isGlob:vs(t.input)})},$9=e=>{const t=["**/.git/**","**/node_modules/**","**/test-results/**"],{watch:n}=e.options.rollup;if(n){if(typeof n.exclude=="string")t.push(n.exclude);else if(Array.isArray(n.exclude))for(const o of n.exclude)typeof o=="string"&&t.push(o)}return t},w9=e=>{for(const t of e.options.entries.filter(n=>n.isGlob)){const n={...t};delete n.isGlob;const o=Pp([n.input],{cwd:e.options.rootDir,dot:!1,ignore:$9(e),onlyFiles:!0});if(o.length===0)throw new It(`No files found in the glob pattern: ${ne(V(e.options.rootDir,n.input))}`);for(const r of o)e.options.entries.push({...n,input:X(e.options.rootDir,r)});e.options.entries.splice(e.options.entries.indexOf(t),1)}},x9=e=>{for(const t of e)if(t==="node"||t==="workerd"||t.includes("node")||t.includes("workerd"))return!0;return!1},k9=e=>e.includes(".server")||e.includes(".node")||e.includes(".workerd"),E9=e=>{const t=e.exportKey&&[...e.exportKey].some(o=>o.includes("browser")||o==="browser"),n=e.fileAlias?.includes(".browser")??!1;if(t||n)return"browser";if(e.exportKey&&x9(e.exportKey)||e.fileAlias&&k9(e.fileAlias))return"node"},S9=e=>{for(const t of e.options.entries){if(t.runtime)continue;const n=E9(t);n&&(t.runtime=n)}},j9=e=>{for(const t of e.options.entries)if(t.fileAlias){let n=t.fileAlias;for(;n.startsWith("./")||n.startsWith("../");)n=n.replace(v9,"");t.name=n}},Kf=e=>{b9(e),w9(e),S9(e),j9(e);for(const t of e.options.entries.filter(n=>!n.fileAlias))Uc(t,e);for(const t of e.options.entries.filter(n=>n.fileAlias))Uc(t,e),t.fileAlias=void 0},A9=/^[_$a-z\u00A0-\uFFFF][\w$\u00A0-\uFFFF]*$/iu,O9=(e,t)=>{const n=e.options.jiti.transformOptions?.babel?.plugins;return JSON.stringify({...e.options.jiti,alias:{...Br(e.pkg,e.options),...e.options.jiti.alias},transformOptions:{...e.options.jiti.transformOptions,babel:{...e.options.jiti.transformOptions?.babel,plugins:"__$BABEL_PLUGINS"}}},void 0,2).replace('"__$BABEL_PLUGINS"',Array.isArray(n)?`[${n.map((o,r)=>{if(Array.isArray(o)){const[i,...s]=o;return t.push(i),`[${[`plugin${String(r)}`,...s.map(a=>JSON.stringify(a))].join(", ")}]`}return t.push(o),`plugin${String(r)}`}).join(",")}]`:"[]")},R9=e=>e.filter(t=>t!=="default").map((t,n)=>{if(A9.test(t))return`export const ${t} = _module.${t};`;const o=`__packem_export_${String(n)}`,r=t.startsWith("'")&&t.endsWith("'")?`_module[${t}]`:`_module[${JSON.stringify(t)}]`;return`const ${o} = ${r};
|
|
155
|
+
export { ${o} as ${JSON.stringify(t)} };`}),Yf=(e,t,n)=>{mr(e,`export * from "${t}";
|
|
156
|
+
${n?`export { default } from "${t}";`:""}`)},C9=async(e,t,n,o,r,i,s,a,l,p)=>{const c=t(Z(n),await su("jiti",{conditions:["node","import"],url:import.meta.url})),u=Ye(e,"esm"),d=`${r}.${u}`;mr(`${n}.${Me(e,"esm")}`,i+[`import { createJiti } from "${c}";`,...a.map((f,m)=>`import plugin${String(m)} from "${f}";`),"",`const jiti = createJiti(import.meta.url, ${s});`,"",`/** @type {import("${d}")} */`,`const _module = await jiti.import("${o}");`,...p?["export default _module?.default ?? _module;"]:[],...R9(l)].join(`
|
|
157
|
+
`)),e.options.declaration&&Yf(`${n}.${u}`,d,p)},T9=async(e,t,n,o,r,i,s,a,l)=>{const p=t(Z(n),await su("jiti",{conditions:["node","require"],url:import.meta.url})),c=Ye(e,"cjs"),u=`${r}.${c}`;mr(`${n}.${Me(e,"cjs")}`,i+[`const { createJiti } = require("${p}");`,...a.map((d,f)=>`const plugin${String(f)} = require(${JSON.stringify(d)})`),"",`const jiti = createJiti(__filename, ${s});`,"",`/** @type {import("${u}")} */`,`module.exports = jiti("${o}")`].join(`
|
|
158
|
+
`)),e.options.declaration&&Yf(`${n}.${c}`,u,l)},_9=async e=>{const t=[],n=O9(e,t);for(const o of e.options.entries){const r=X(e.options.rootDir,e.options.outDir,o.name),i=jh(e.jiti.esmResolve(o.input,{try:!0})??o.input),s=i.replace(Us,""),a=Fs(i),l=BE(a);let p;try{p=await Ah(i,{extensions:vr})}catch(d){Y(e,`Cannot analyze ${i} for exports: ${String(d)}`);return}const c=p.includes("default")||p.length===0,u=e.options.jiti.absoluteJitiPath?(...d)=>Oh(X(...d)):Ae;e.options.emitESM&&await C9(e,u,r,i,s,l,n,t,p,c),e.options.emitCJS&&await T9(e,u,r,i,s,l,n,t,c),l&&(await Is(`${r}.${Me(e,"cjs")}`),await Is(`${r}.${Me(e,"esm")}`))}await e.hooks.callHook("rollup:done",e)},Ba=e=>e.logger,pr="rollup-watch.json",Vc=({context:e,doOnSuccessCleanup:t,fileCache:n,mode:o,runBuilder:r,runOnsuccess:i,useCache:s,watcher:a})=>{const l=`watcher:${o}`,p=Ba(e);a.on("change",async(c,{event:u})=>{await t?.(),p.info({message:`${ne(Ae(".",c))} was ${u}d`,prefix:l})}),a.on("restart",()=>{p.info({message:"Rebuilding ...",prefix:l})}),a.on("event",async c=>{switch(c.code){case"BUNDLE_END":{await c.result.close(),s&&n.set(o==="bundle"?pr:`dts-${pr}`,c.result.cache),p.raw(`
|
|
159
|
+
⚡️ Build run in ${String(c.duration)}ms
|
|
160
|
+
|
|
161
|
+
`),await r?.(!0);break}case"BUNDLE_START":{p.info({message:ne("build started..."),prefix:l});break}case"END":{p.success({message:"Rebuild finished",prefix:l}),await i?.();break}case"ERROR":{Vp(c.error),p.error({context:[c.error],message:`Rebuild failed: ${c.error.message}`,prefix:l});break}}})},N9=(e,t)=>{const n=[];Array.isArray(t.input)?n.push(...t.input):typeof t.input=="string"?n.push(t.input):n.push(...Object.keys(t.input??{}));let o="Starting watcher for entries:";for(const r of n)o+=Fe(`
|
|
162
|
+
└─ ${Ae(process.cwd(),r)}`);Ba(e).info(o)},P9=(e,t,n)=>{const o=[V(e.options.sourceDir,"**","*"),"package.json","packem.config.*","tsconfig.json","tsconfig.*.json"],{include:r}=n;Array.isArray(r)?o.push(...r):r!==void 0&&o.push(r);const i=t.chokidar??{},s=["**/.git/**","**/node_modules/**","**/test-results/**",...i.ignored??[]];return{...t,...n,chokidar:{cwd:e.options.rootDir,...i,ignored:s},include:o}},M9=(e,t)=>{const n=e.options.rollup.watch;return!n||typeof t!="object"||t.include!==void 0?t:P9(e,t,n)},I9=async(e,t,n,o,r)=>{let i=!0;e.options.rollup.css&&(i=!1);let s=[];const a=async()=>{await Promise.all(s.map(m=>m.close())),s=[]},l=async()=>{const m=await p9(),h=await zf(e,t);if(await e.hooks.callHook("rollup:options",e,h),Object.keys(h.input??{}).length===0)return;i&&(h.cache=t.get(pr)),h.watch=M9(e,h.watch);const v=m(h);if(await e.hooks.callHook("rollup:watch",e,v),N9(e,h),Vc({context:e,doOnSuccessCleanup:r,fileCache:t,mode:"bundle",runBuilder:n,runOnsuccess:o,useCache:i,watcher:v}),s.push(v),e.options.declaration){const y=await Ff(e,t);i&&(y.cache=t.get(`dts-${pr}`)),await e.hooks.callHook("rollup:dts:options",e,y);const g=m(y);await e.hooks.callHook("rollup:watch",e,g),Vc({context:e,fileCache:t,mode:"types",useCache:i,watcher:g}),s.push(g)}};await l();const p=V(e.options.rootDir,"package.json"),c=fa.map(m=>V(e.options.rootDir,m));let u;const d=async m=>{const h=Ba(e);h.info(`${Ae(".",m)} changed, restarting watchers...`);try{await a();const{packageJson:v}=Jr(e.options.rootDir);e.pkg=v,e.options.entries.length=0,e.buildEntries.length=0,await e.hooks.callHook("build:prepare",e),Kf(e),await l()}catch(v){h.error({message:`Failed to restart watchers: ${v.message}`,prefix:"watcher"})}},f=m=>{clearTimeout(u),u=setTimeout(()=>{d(m).catch(()=>{})},100)};Va(p,()=>{f(p)});for(const m of c)if(nt(m)){Va(m,()=>{f(m)});break}},W9=async e=>{if(e.options.clean){const t=e.logger,n=[];for(const o of new Set(e.options.entries.map(r=>r.outDir).filter(Boolean).toSorted((r,i)=>r.localeCompare(i))))o===e.options.rootDir||o===e.options.sourceDir||e.options.rootDir.startsWith(o.endsWith("/")?o:`${o}/`)||n.some(r=>o.startsWith(r))||(n.push(o),t.info(`Cleaning dist directory: \`./${Ae(e.options.rootDir,o)}\``),await bm(o))}},B9=()=>Lh((e,t,n)=>{if(t==="hooks"&&typeof n=="object"&&n!==null&&!Array.isArray(n)){const o=typeof e[t]=="object"&&e[t]!==null&&!Array.isArray(e[t])?e[t]:{};return e[t]={...o,...n},!0}return!1}),D9=Qe,L9=(e,t)=>{const{sideEffects:n}=t;let o;if(typeof n=="boolean")o=()=>n;else if(Array.isArray(n))if(n.length<=0)o=()=>!1;else{const r=n.map(i=>i.includes("/")?i:`**/${i}`);o=D9(r,void 0,{resolve:e})}else o=()=>{};return o};var rs,Kc;function F9(){if(Kc)return rs;Kc=1;var e=Fh,t=e.spawn,n=e.exec;rs=function(s,a,l){if(typeof a=="function"&&l===void 0&&(l=a,a=void 0),s=parseInt(s),Number.isNaN(s)){if(l)return l(new Error("pid must be a number"));throw new Error("pid must be a number")}var p={},c={};switch(p[s]=[],c[s]=1,process.platform){case"win32":n("taskkill /pid "+s+" /T /F",l);break;case"darwin":i(s,p,c,function(u){return t("pgrep",["-P",u])},function(){o(p,a,l)});break;default:i(s,p,c,function(u){return t("ps",["-o","pid","--no-headers","--ppid",u])},function(){o(p,a,l)});break}};function o(s,a,l){var p={};try{Object.keys(s).forEach(function(c){s[c].forEach(function(u){p[u]||(r(u,a),p[u]=1)}),p[c]||(r(c,a),p[c]=1)})}catch(c){if(l)return l(c);throw c}if(l)return l()}function r(s,a){try{process.kill(parseInt(s,10),a)}catch(l){if(l.code!=="ESRCH")throw l}}function i(s,a,l,p,c){var u=p(s),d="";u.stdout.on("data",function(h){var h=h.toString("ascii");d+=h});var f=function(m){if(delete l[s],m!=0){Object.keys(l).length==0&&c();return}d.match(/\d+/g).forEach(function(h){h=parseInt(h,10),a[s].push(h),a[h]=[],l[h]=1,i(h,a,l,p,c)})};u.on("close",f)}return rs}var q9=F9();const z9=io(q9),H9=e=>process.platform==="win32"&&"cmd"in e&&"code"in e&&typeof e.cmd=="string"&&e.cmd.startsWith("taskkill")&&e.code===128,J9=async({pid:e,signal:t})=>{await new Promise((n,o)=>{if(!Number.isInteger(e)||e<=0){o(new Error("Invalid process ID"));return}z9(e,t,r=>{if(r&&!H9(r)){o(r);return}n()})})},Yc=(e,t)=>{if(e.warnings.size>0){const n=e.logger;if(t&&n.raw(`
|
|
163
|
+
`),n.warn(`Build is done with some warnings:
|
|
164
|
+
|
|
165
|
+
${Array.from(e.warnings,o=>`- ${o}`).join(`
|
|
166
|
+
`)}`),e.options.failOnWarn)throw new Error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`.")}},G9=async(e,t,n,o)=>{try{await yr(V(e,t),{force:!0,recursive:!0})}catch(r){return n.error({message:`Failed to remove cache directory ${t}: ${r instanceof Error?r.message:String(r)}`,prefix:"file-cache"}),o}return o&&n.raw(`
|
|
167
|
+
`),n.info({message:`Removing ${t} file cache, the cache key is not used anymore.`,prefix:"file-cache"}),!1},U9=async(e,t,n)=>{if(!e)return;const o=V(e,"keystore.json");if(!await pn(o))return;const r=await hr(o),i=(await wh(e,{withFileTypes:!0})).filter(a=>a.isDirectory());let s=n;for(const a of i)r[a.name]||(s=await G9(e,a.name,t,s))},Xc=(e,t)=>{for(const n of bs(e??[]))if(typeof n=="string"&&n.startsWith("node")){const o=qe.coerce(n.slice(4));o&&t.push(o.version)}},V9=e=>{if(e.options.runtime!=="node"||!e.options.emitCJS)return;const t=[],n=e.pkg.engines?.node,o=n?qe.minVersion(n):void 0;o&&t.push(o.version);const r=e.options.rollup;if(Xc(r.esbuild?.target,t),Xc(r.oxc?.target,t),t.length===0){const i=qe.coerce(Uo.node);i&&t.push(i.version)}t.some(i=>qe.satisfies(i,">=23.0.0 || >=22.12.0"))&&e.logger.warn(["We recommend using the ESM format instead of CommonJS.","The ESM format is compatible with modern platforms and runtimes, and most new libraries are now distributed only in ESM format.","Learn more at https://nodejs.org/en/learn/modules/publishing-a-package#how-did-we-get-here"].join(`
|
|
168
|
+
`))},K9=We(import.meta.url),Yt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:dt,Da=e=>{if(typeof Yt<"u"&&Yt.versions&&Yt.versions.node){const[t,n]=Yt.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Yt.getBuiltinModule(e)}return K9(e)},dt=Yt,{execFileSync:Y9}=Da("node:child_process"),zn=Da("node:fs"),X9=Da("node:tty"),La=[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,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Fa=[12288,12288,65281,65376,65504,65510],qa=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],za=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Gr=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],go=(e,t)=>{let n=0,o=Math.floor(e.length/2)-1;for(;n<=o;){const r=Math.floor((n+o)/2),i=r*2;if(t<e[i])o=r-1;else if(t>e[i+1])n=r+1;else return!0}return!1},Z9=La[0],Q9=La.at(-1),e8=Fa[0],t8=Fa.at(-1),n8=qa[0],o8=qa.at(-1),r8=za[0],i8=za.at(-1),s8=Gr[0],a8=Gr.at(-1),Zc=19968,[l8,c8]=p8(Gr);function p8(e){let t=e[0],n=e[1];for(let o=0;o<e.length;o+=2){const r=e[o],i=e[o+1];if(Zc>=r&&Zc<=i)return[r,i];i-r>n-t&&(t=r,n=i)}return[t,n]}const u8=e=>e<Z9||e>Q9?!1:go(La,e),d8=e=>e<e8||e>t8?!1:go(Fa,e),f8=e=>e<n8||e>o8?!1:go(qa,e),m8=e=>e<r8||e>i8?!1:go(za,e),h8=e=>e>=l8&&e<=c8?!0:e<s8||e>a8?!1:go(Gr,e);function g8(e){return u8(e)?"ambiguous":d8(e)?"fullwidth":f8(e)?"halfwidth":m8(e)?"narrow":h8(e)?"wide":"neutral"}function v8(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Xf(e){return v8(e),g8(e)}const Zf=String.raw,Qc=Zf`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,y8=()=>new RegExp(Zf`\p{RI}{2}|(?)${Qc}(?:\u200D${Qc})*`,"gu"),bn=new Set(["\x1B",""]),Ur="\x07",Qf="[",Ha="m",ur="]8;;",b8=39,$8=/[\u200B\uFEFF\u2060-\u2064]/g,w8=new RegExp(`(?:\\${Qf}(?<code>\\d+)m|\\${ur}(?<uri>.*)${Ur})`),x8=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),At=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,ep=/\u001B\[(\d+(?:;\d+)*)?m[^\u001B]*(?:\u001B\[(?:\d+(?:;\d+)*)?m|$)/g,tp=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)(.*?)\u001B\]8;;(?:\u0007|\u001B\\)/g,Oo=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,is=y8(),np=new Map,Ro=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,Jo=e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other",k8=(e,t)=>{const n=Math.floor(e/65536),o=e%65536;let r=np.get(n);if(r||(r=new Map,np.set(n,r)),r.has(o))return r.get(o);let i;if(Jo(e)==="latin")i=t.width.regular;else if(Jo(e)==="control")i=t.width.control;else if(Jo(e)==="wide")i=t.width.wide;else switch(Xf(e)){case"ambiguous":{i=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{i=t.width.fullWidth;break}case"wide":{i=t.width.wide;break}default:i=t.width.regular}return r.set(o,i),i},E8=e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,cn=(e,t={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const n={truncation:{countAnsiEscapeCodes:t.countAnsiEscapeCodes??!1,ellipsis:t.ellipsis??"",ellipsisWidth:t.ellipsisWidth??(t.ellipsis?cn(t.ellipsis,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:t.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:t.ambiguousIsNarrow??!1,ansi:t.ansiWidth??0,control:t.controlWidth??0,emoji:t.emojiWidth??2,fullWidth:t.fullWidth??2,halfWidth:t.halfWidth??1,regular:t.regularWidth??1,tab:t.tabWidth??8,wide:t.wideWidth??2}},o=Math.max(0,n.truncation.limit-n.truncation.ellipsisWidth),{length:r}=e,i=r>1e4;let s=0,a=0,l=r,p=!1;const c=e.includes("\x1B")||e.includes("");for(;s<r;){if(c&&(e[s]==="\x1B"||e[s]==="")){if(e.startsWith("\x1B]8;;",s)){const v="\x1B]8;;\x07",y=v.length,g=e.indexOf("\x07",s+5);if(g!==-1){const $=e.indexOf(v,g+1);if($!==-1){const b=$+y,w=e.slice(g+1,$).replace(At,""),E=cn(w,{ambiguousIsNarrow:n.width.ambiguousIsNarrow,ansiWidth:n.width.ansi,controlWidth:n.width.control,countAnsiEscapeCodes:!1,ellipsis:n.truncation.ellipsis,ellipsisWidth:n.truncation.ellipsisWidth,emojiWidth:n.width.emoji,fullWidth:n.width.fullWidth,halfWidth:n.width.halfWidth,limit:Math.max(0,o-a),regularWidth:n.width.regular,tabWidth:n.width.tab,wideWidth:n.width.wide}),x=E.width;if(E.truncated)p=!0,l=Math.min(l,s);else if(a+x>o&&(l=Math.min(l,s),p=!0,a+x>n.truncation.limit))break;if(a+=x,s=b,p&&a>=n.truncation.limit)break;continue}}}if(At.lastIndex=s,At.test(e)){const v=At.lastIndex-s,y=n.truncation.countAnsiEscapeCodes?v:n.width.ansi;if(a+y>o&&(l=Math.min(l,s),a+y>n.truncation.limit)){p=!0;break}a+=y,s=At.lastIndex;continue}}const f=e.codePointAt(s);if(f===8203||f===65279||f>=8288&&f<=8292){s+=1;continue}if(f===9){if(a+n.width.tab>o&&(l=Math.min(l,s),a+n.width.tab>n.truncation.limit)){p=!0;break}a+=n.width.tab,s+=1;continue}if(Ro.lastIndex=s,Ro.test(e)){const v=(Ro.lastIndex-s)*n.width.regular;if(a+v>o){const y=Math.floor((o-a)/n.width.regular);if(l=Math.min(l,s+y),a+v>n.truncation.limit){p=!0;break}}a+=v,s=Ro.lastIndex;continue}if((f<=31||f>=127&&f<=159)&&(Oo.lastIndex=s,Oo.test(e))){const v=(Oo.lastIndex-s)*n.width.control;if(a+v>o&&(l=Math.min(l,s+Math.floor((o-a)/n.width.control)),a+v>n.truncation.limit)){p=!0;break}a+=v,s=Oo.lastIndex;continue}if(is.lastIndex=s,is.test(e)){if(a+n.width.emoji>o&&(l=Math.min(l,s),a+n.width.emoji>n.truncation.limit)){p=!0;break}a+=n.width.emoji,s=is.lastIndex;continue}const m=e.codePointAt(s)??0;if(E8(m)){s+=m>65535?2:1;continue}let h;if(i)h=k8(m,n);else switch(Jo(m)){case"control":{h=n.width.control;break}case"latin":{h=n.width.regular;break}case"wide":{h=n.width.wide;break}case"zero":{h=0;break}default:switch(Xf(m)){case"ambiguous":{h=n.width.ambiguousIsNarrow?n.width.regular:n.width.wide;break}case"fullwidth":{h=n.width.fullWidth;break}case"wide":{h=n.width.wide;break}default:h=n.width.regular}}if(a+h>o&&(l=Math.min(l,s),a+h>n.truncation.limit)){p=!0;break}a+=h,s+=m>65535?2:1}let u=a,d=!1;return p&&n.truncation.limit>=n.truncation.ellipsisWidth&&(u=n.truncation.limit,d=!0),{ellipsed:d,index:p?l:r,truncated:p,width:u}},de=(e,t={})=>cn(e,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width;let S8=class{capacity;cache;keyOrder;constructor(t){this.capacity=t,this.cache=new Map,this.keyOrder=[]}get(t){if(this.cache.has(t))return this.keyOrder=this.keyOrder.filter(n=>n!==t),this.keyOrder.push(t),this.cache.get(t)}has(t){return this.cache.has(t)}set(t,n){if(this.cache.has(t))this.keyOrder=this.keyOrder.filter(o=>o!==t);else if(this.cache.size>=this.capacity){const o=this.keyOrder.shift();o!==void 0&&this.cache.delete(o)}this.cache.set(t,n),this.keyOrder.push(t)}delete(t){this.cache.delete(t),this.keyOrder=this.keyOrder.filter(n=>n!==t)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};const op=new S8(100),j8=new Intl.Segmenter("en",{granularity:"grapheme"}),A8=/^[\u0000-\u007F]*$/,O8=new Set(["0","22","23","24","27","28","29","39","49"]),R8=new Set(["1","3","4","7","8","9"]),rp=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),Co=e=>e>="30"&&e<="37"||e>="90"&&e<="97"||e.startsWith("38;"),To=e=>e>="40"&&e<="47"||e>="100"&&e<="107"||e.startsWith("48;"),C8=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],ip=(e,t)=>{let n=-1;for(const o of t){const r=e.indexOf(o);r!==-1&&(n===-1||r<n)&&(n=r)}return n},T8=(e,t)=>{if(!e.includes("\x1B"))return[{after:"",before:"",content:e,visibleLength:de(e,t.width)}];const n=op.get(e);if(n)return n;const o=[],r=[];let i=0,s;for(At.lastIndex=0;(s=At.exec(e))!==null;){const c=s[0];o.push(e.slice(i,s.index)),r.push(c),i=s.index+c.length}i<e.length&&o.push(e.slice(i));const a=[];for(const c of r){if(c==="\x1B[0m"||c==="\x1B]8;;\x07"){a.push(c);continue}if(c.startsWith("\x1B[")&&c.endsWith("m")){const u=c.slice(2,-1);if(O8.has(u)){a.push(c);continue}}}const l=new Set,p=[];for(const[c,u]of o.entries()){if(c>0&&r[c-1]){const m=r[c-1];if(m==="\x1B[0m")l.clear();else if(m==="\x1B]8;;\x07"){for(const h of l)if(h.startsWith("\x1B]8;;")&&!h.endsWith("\x1B]8;;\x07")){l.delete(h);break}}else if(m.startsWith("\x1B[")&&m.endsWith("m")){const h=m.slice(2,-1);if(h==="39"){for(const v of l)if(v.startsWith("\x1B[")&&v.endsWith("m")){const y=v.slice(2,-1);if(Co(y)){l.delete(v);break}}}else if(h==="49"){for(const v of l)if(v.startsWith("\x1B[")&&v.endsWith("m")){const y=v.slice(2,-1);if(To(y)){l.delete(v);break}}}else if(rp.has(h)){const v=rp.get(h);for(const y of l)if(y===`\x1B[${v}m`){l.delete(y);break}}else{if(Co(h)){for(const v of l)if(v.startsWith("\x1B[")&&v.endsWith("m")){const y=v.slice(2,-1);if(Co(y)){l.delete(v);break}}}else if(To(h)){for(const v of l)if(v.startsWith("\x1B[")&&v.endsWith("m")){const y=v.slice(2,-1);if(To(y)){l.delete(v);break}}}else if(R8.has(h)){const v=`\x1B[${h}m`;l.has(v)&&l.delete(v)}l.add(m)}}else if(m.startsWith("\x1B]8;;")&&!m.endsWith("\x1B]8;;\x07")){for(const h of l)if(h.startsWith("\x1B]8;;")&&!h.endsWith("\x1B]8;;\x07")){l.delete(h);break}l.add(m)}}if(u==="")continue;let d="";if(l.size>0)if(a.includes("\x1B[0m"))d="\x1B[0m";else{const m=[];let h=!1;for(const $ of l)if($.startsWith("\x1B]8;;")&&!$.endsWith("\x1B]8;;\x07")){h=!0;break}h&&a.includes("\x1B]8;;\x07")&&m.push("\x1B]8;;\x07");let v=!1,y=!1;for(const $ of l)if($.startsWith("\x1B[")&&$.endsWith("m")){const b=$.slice(2,-1);Co(b)?v=!0:To(b)&&(y=!0)}if(v&&y){const $=ip(e,["\x1B[3","\x1B[9","\x1B[38;"]),b=ip(e,["\x1B[4","\x1B[10","\x1B[48;"]);$>=0&&b>=0?$>b?m.push("\x1B[39m","\x1B[49m"):m.push("\x1B[49m","\x1B[39m"):m.push("\x1B[39m","\x1B[49m")}else v&&m.push("\x1B[39m"),y&&m.push("\x1B[49m");v&&y&&e.includes("\x1B[39m")&&e.includes("\x1B[49m")&&(e.indexOf("\x1B[39m")<e.indexOf("\x1B[49m")?(m.length-=2,m.push("\x1B[39m","\x1B[49m")):e.indexOf("\x1B[49m")<e.indexOf("\x1B[39m")&&(m.length-=2,m.push("\x1B[49m","\x1B[39m")));const g=C8.filter($=>l.has($.open)).map($=>({position:e.indexOf($.open),style:$})).filter($=>$.position>=0).toSorted(($,b)=>b.position-$.position);for(const $ of g){const b=$;a.includes(b.style.close)&&m.push(b.style.close)}d=m.join("")}const f=[...l].join("");p.push({after:d,before:f,content:u,visibleLength:de(u,{fullWidth:1,wideWidth:1})})}return op.set(e,p),p},_8=(e,t,n,o)=>{const r=[...o.segmenter.segment(e)],i=[];let s=0,a=!1;for(const l of r){const p=de(l.segment,o.width),c=s,u=s+p;if(!a)if(c<t){s=u;continue}else a=!0;if(c>=n||u>n)break;i.push(l.segment),s=u}return i.join("")},pt=(e,t=0,n=Number.MAX_SAFE_INTEGER,o={})=>{const r={segmenter:j8,...o};if(t>=n||e==="")return"";const i=de(e,r.width);if(t===0&&n>=i)return e;if(t<0||n<0)throw new RangeError("Negative indices aren't supported");if(!e.includes("\x1B"))return A8.test(e)?e.slice(t,n):_8(e,t,n,r);if(ep.lastIndex=0,tp.lastIndex=0,!ep.test(e)&&!tp.test(e))return e;const s=T8(e,r);if(s.length===0)return"";let a=0;const l=[];for(const[u,d]of s.entries()){const f=a,m=a+d.visibleLength;if(m>t&&f<n){const h=Math.max(0,t-f),v=Math.min(d.visibleLength,n-f);l.push({end:v,index:u,segment:d,start:h})}a=m}if(l.length===0)return"";const p=[],c=l[0].segment;p.push(c.before);for(let u=0;u<l.length;u++){const{end:d,segment:f,start:m}=l[u];if(m===0&&d===f.visibleLength)p.push(f.content);else{const h=[...r.segmenter.segment(f.content)];p.push(h.slice(m,d).map(v=>v.segment).join(""))}if(u<l.length-1){const h=l[u+1].segment,v=f.after,y=h.before;v!==y&&(v||y)&&p.push(v,y)}}return p.push(l.at(-1).segment.after),p.join("")},sp="…",N8=3,_o=(e,t,n=!1)=>{if(e.charAt(t)===" ")return t;const o=n?1:-1,r=Math.min(N8,n?e.length-t:t);for(let i=1;i<=r;i++){const s=t+i*o;if(e.charAt(s)===" ")return s}return t},No=(e,t,n)=>cn(e,{...n,ellipsis:"",ellipsisWidth:0,limit:t}).index,Po=(e,t,n)=>de(e.slice(0,t),n),ap=(e,t,n={})=>{if(typeof e!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof e}`);if(typeof t!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof t}`);if(e===""||t<=0)return"";const o=e.normalize("NFC"),{ellipsis:r=sp,position:i="end",preferTruncationOnSpace:s=!1}=n;let a=n.ellipsisWidth??r===sp?1:void 0;a??=cn(r,{...n.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width;const{width:l}=cn(o,{...n.width,ellipsis:r,ellipsisWidth:a});if(l<=t)return o;switch(i){case"end":{if(s){const p=t-a,c=No(o,p,n.width),u=_o(o,c),d=Po(o,u,n.width);return pt(o,0,d,{width:n.width})+r}return pt(o,0,t-a,{width:n.width})+r}case"middle":{const p=Math.floor(t/2),c=Math.max(0,t-a),u=Math.min(p,c),d=Math.max(0,c-u);if(s){const f=No(o,u,n.width),m=_o(o,f),h=Po(o,m,n.width),v=l-d,y=No(o,v,n.width),g=_o(o,y,!0),$=Po(o,g,n.width);return pt(o,0,h,{width:n.width})+r+pt(o,$,l,{width:n.width}).trim()}return pt(o,0,u,{width:n.width})+r+pt(o,l-d,l,{width:n.width})}case"start":{if(s){const p=l-t+a,c=No(o,p,n.width),u=_o(o,c,!0),d=Po(o,u,n.width);return r+pt(o,d,l,{width:n.width}).trim()}return r+pt(o,l-t+a,l,{width:n.width})}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${i}'`)}},P8=/\x1B\[(\d+)m/;class em{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(t){const n=P8.exec(t);if(!n)return;const o=Number.parseInt(n[1],10);switch(o){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(o>=30&&o<=37||o>=90&&o<=97)this.activeForeground=t;else if(o>=40&&o<=47||o>=100&&o<=107)this.activeBackground=t;else if([1,2,3,4,7,8,9].includes(o))this.activeFormatting.push(t);else if([22,23,24,27,28,29].includes(o)){const r={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[o];r&&(this.activeFormatting=this.activeFormatting.filter(i=>!i.includes(r)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const t=[];if(this.activeFormatting.length>0){const n={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(o=>{const r=n[o];r&&t.push(r)})}return this.activeForeground&&t.push("\x1B[39m"),this.activeBackground&&t.push("\x1B[49m"),t.join("")}}const tm=(e,t)=>{if(!bn.has(e[t]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const n=!0,o=e.slice(t+1,t+1+ur.length).join("")===ur;return{isInsideEscape:n,isInsideLinkEscape:o}},M8=(e,t={})=>{const n=new em;let o="",r=!1,i="",s="",a=!1;const l=[...e];for(let p=0;p<l.length;p++){const c=l[p];if(c&&bn.has(c)){if(o){const h=t.getWidth?.(o)??0,v={isEscapeSequence:!1,isGrapheme:!0,text:o,width:h};if(a&&(v.isHyperlink=!0,v.hyperlinkUrl=s),t.onSegment?.(v,n)===!1)return;o=""}r=!0,i=c;const f=tm(l,p),{isInsideLinkEscape:m}=f;if(m){let h=p+1;for(s="";h<l.length;){const y=l[h];if(y===Ur)break;s+=y,h+=1}s=s.slice(4);const v={hyperlinkUrl:s,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(t.onSegment?.(v,n)===!1)return;p=h,a=!0,r=!1,i="";continue}if(p+1<l.length&&l[p+1]==="\\"&&a){const h={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(t.onSegment?.(h,n)===!1)return;a=!1,s="",p+=1,r=!1,i="";continue}}if(r){if(i!==c&&(i+=c),c===Ha){r=!1,n.processEscape(i);const f={isEscapeSequence:!0,isGrapheme:!1,text:i,width:0};if(t.onSegment?.(f,n)===!1)return;i=""}continue}o+=c;const u=t.getWidth?.(o)??0,d={isEscapeSequence:!1,isGrapheme:!0,text:o,width:u};if(a&&(d.isHyperlink=!0,d.hyperlinkUrl=s),t.onSegment?.(d,n)===!1)return;o=""}if(o){const p=t.getWidth?.(o)??0,c={isEscapeSequence:!1,isGrapheme:!0,text:o,width:p};a&&(c.isHyperlink=!0,c.hyperlinkUrl=s),t.onSegment?.(c,n)}if(i){const p={isEscapeSequence:!0,isGrapheme:!1,text:i,width:0};t.onSegment?.(p,n)}},lp=e=>`${bn.values().next().value}${Qf}${String(e)}${Ha}`,cp=e=>`${bn.values().next().value}${ur}${e}${Ur}`,I8=e=>{if(e.length===0)return"";if(e.length===1)return e[0];let t="",n,o;const r=e.join(`
|
|
169
|
+
`),i=[...r];let s=0;for(const[a,l]of i.entries()){if(t+=l,bn.has(l)){const c=w8.exec(r.slice(s))?.groups??{};if(c.code!==void 0){const u=Number.parseFloat(c.code);n=u===b8?void 0:u}else c.uri!==void 0&&(o=c.uri.length===0?void 0:c.uri)}const p=x8.get(Number(n));i[a+1]===`
|
|
170
|
+
`?(o&&(t+=cp("")),n&&p&&(t+=lp(p))):l===`
|
|
171
|
+
`&&(n&&p&&(t+=lp(n)),o&&(t+=cp(o))),s+=l.length}return t},nm=/(?=\s)|(?<=\s)/,om=/^\s+$/,ss=e=>{if(!e.includes("\x1B"))return e;let t=e;return e.includes("\x1B[30m")&&(t+="\x1B[39m"),e.includes("\x1B[42m")&&(t+="\x1B[49m"),t},_t=e=>{const t=e.split(" ");let n=t.length;for(;n>0&&de(t[n-1])===0;)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},rm=(e,t,n)=>{if(e.length===0)return[""];if(t<=0)return[e];const o=[],r=new em;let i="",s=0,a=!1,l=!1,p="",c=0;for(;c<e.length;){const u=e[c];if(bn.has(u)){a=!0,p=u,i+=u,l=tm([...e],c).isInsideLinkEscape,c+=1;continue}if(a){p+=u,i+=u,l?u===Ur&&(a=l=!1):u===Ha&&(a=!1,r.processEscape(p)),c+=1;continue}const d=de(u),f=u===" ";if(d===0){i+=u,c+=1;continue}if(s+d>t&&(i&&o.push(i+r.getEndEscapesForAllActiveAttributes()),i=r.getStartEscapesForAllActiveAttributes(),s=de(i),f&&n)){for(;c<e.length&&e[c]===" ";)c+=1;continue}if(i+=u,s+=d,s===t&&c<e.length-1&&(o.push(i+r.getEndEscapesForAllActiveAttributes()),i=r.getStartEscapesForAllActiveAttributes(),s=de(i),c+1<e.length&&e[c+1]===" "&&n)){for(c+=1;c<e.length&&e[c]===" ";)c+=1;continue}c+=1}return i&&o.push(i+r.getEndEscapesForAllActiveAttributes()),n?o.map(u=>_t(u)):o},W8=(e,t,n)=>{if(e.length===0)return[];const o=n?e.trim():e;if(o.length===0)return[];const r=[];let i="",s=0;return M8(o,{getWidth:de,onSegment:(a,l)=>{const p=a.text??"";if(a.isEscapeSequence)i+=p;else{const c=p===" ";if(a.width===0)return i+=p,!0;if(s+a.width>t&&(i&&r.push(i),i=l.getStartEscapesForAllActiveAttributes(),s=0,c))return n||r.push(l.getStartEscapesForAllActiveAttributes()+p),!0;i+=p,s+=a.width}return!0}}),i&&r.push(i),n?r.map(a=>_t(a)):r},B8=(e,t,n)=>{if(e.length===0)return[];const o=n?e.trim():e;if(o.length===0)return[];const r=o.split(nm),i=[];let s="",a=0,l=0;for(;l<r.length;){const p=r[l],c=om.test(p),u=de(p);if(p.length===0){l+=1;continue}if(n&&c&&a===0){l+=1;continue}if(a+u>t&&a>0){n?i.push(_t(s)):i.push(s),s="",a=0;continue}s+=p,a+=u,l+=1}return s&&(n?i.push(_t(s)):i.push(s)),i},D8=(e,t,n)=>{if(e.length===0)return[];const o=n?e.trim():e;if(o.length===0)return[];const r=o.split(nm),i=[];let s="",a=0,l=0;for(;l<r.length;){const p=r[l],c=om.test(p),u=de(p);if(p.length===0){l+=1;continue}if(n&&c&&a===0){l+=1;continue}if(u>t){s&&i.push(ss(n?_t(s):s));const d=rm(p,t,n);if(d.length>0){for(let f=0;f<d.length-1;f+=1)i.push(d[f]);s=d.at(-1),a=de(s)}else s="",a=0;l+=1;continue}if(a+u>t&&a>0&&(i.push(ss(n?_t(s):s)),s="",a=0,n&&c)){l+=1;continue}s+=p,a+=u,l+=1}return s&&i.push(ss(n?_t(s):s)),i},Mo={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},L8=(e,t={})=>{const{removeZeroWidthCharacters:n=!0,trim:o=!0,width:r=80,wrapMode:i=Mo.PRESERVE_WORDS}=t;if(o&&e.trim()==="")return"";let s=e.normalize("NFC").replaceAll(`\r
|
|
172
|
+
`,`
|
|
173
|
+
`);return n&&(s=s.replaceAll($8,"")),s.split(`
|
|
174
|
+
`).map(a=>{if(o&&a.trim()==="")return"";let l;switch(i){case Mo.BREAK_AT_CHARACTERS:{l=W8(a,r,o);break}case Mo.BREAK_WORDS:{l=D8(a,r,o);break}case Mo.STRICT_WIDTH:{l=rm(a,r,o);break}default:l=B8(a,r,o)}return I8(l)}).join(`
|
|
175
|
+
`)},im=80,sm=24,Ws=(e,t,{shell:n,env:o}={})=>Y9(e,t,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:n,env:o}).trim(),Go=(e,t)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(t,10)}),am=(e,t)=>{const{columns:n,rows:o}=Go(e,t);if(!(Number.isNaN(n)||Number.isNaN(o))&&!(n===im&&o===sm))return{columns:n,rows:o}},F8=()=>{if(dt.platform!=="linux")return!0;try{const e=zn.readFileSync("/proc/self/stat","utf8"),t=e.lastIndexOf(") ");if(t===-1)return!1;const n=e.slice(t+2).trim().split(/\s+/),o=Number.parseInt(n[2],10),r=Number.parseInt(n[5],10);return Number.isNaN(o)||Number.isNaN(r)||r<=0?!1:o===r}catch{return!1}};function q8(){const{env:e,stdout:t,stderr:n}=dt;if(t?.columns&&t?.rows)return Go(t.columns,t.rows);if(n?.columns&&n?.rows)return Go(n.columns,n.rows);if(e.COLUMNS&&e.LINES)return Go(e.COLUMNS,e.LINES);const o={columns:im,rows:sm};return dt.platform==="win32"?as()??o:dt.platform==="darwin"?pp()??as()??o:pp()??as()??z8()??o}const pp=()=>{try{const e=dt.platform==="darwin"?zn.constants.O_EVTONLY|zn.constants.O_NONBLOCK:zn.constants.O_NONBLOCK,{columns:t,rows:n}=X9.WriteStream(zn.openSync("/dev/tty",e));return{columns:t,rows:n}}catch{}},as=()=>{try{const e=Ws("tput",["cols"],{env:{TERM:"dumb",...dt.env}}),t=Ws("tput",["lines"],{env:{TERM:"dumb",...dt.env}});if(e&&t)return am(e,t)}catch{}},z8=()=>{try{if(!F8())return;const e=Ws("resize",["-u"]).match(/\d+/g);if(e.length===2)return am(e[0],e[1])}catch{}},Ft=(e,t)=>{switch(t){case"bottom":return{body:e.bottomBody,join:e.bottomJoin,left:e.bottomLeft,right:e.bottomRight};case"middle":return{body:e.joinBody,join:e.joinJoin,left:e.joinLeft,right:e.joinRight};case"top":return{body:e.topBody,join:e.topJoin,left:e.topLeft,right:e.topRight};default:throw new Error(`Invalid borderType: ${String(t)}`)}},H8=e=>({join:e.bodyJoin,left:e.bodyLeft,right:e.bodyRight}),dr=(e,t,n)=>{let o=0;for(let r=0;r<n;r+=1)o+=e[t+r]??0;return n>1&&(o+=n-1),o},Bs=(e,t,n,o)=>{let r=t;for(;r>0&&e[r-1]?.[n]===o;)r-=1;let i=t;for(;i<e.length-1&&e[i+1]?.[n]===o;)i+=1;let s;const a=i-r+1;if(a===1)s=!0;else switch(o.vAlign){case"bottom":{s=t===i;break}case"middle":{const l=r+Math.floor(a/2);s=t===l;break}case"top":{s=t===r;break}default:s=t===r}return{firstRow:r,lastRow:i,showContent:s}},J8=(e,t,n,o,r)=>{if(e.length===0)return[];let i=e.length-1;for(let l=0;l<e.length;l+=1){const p=e[l];if(p){for(const[c,u]of p.entries())if(u&&r(e,l,c,u)===l){const d=Bs(e,l,c,u);i=Math.max(i,d.lastRow)}}}const s=Array.from({length:i+1}).fill(1);for(let l=0;l<e.length;l+=1){const p=e[l];if(p)for(let c=0;c<n.columns;c+=1){const u=p[c];if(u&&r(e,l,c,u)===l&&(u.rowSpan??1)===1){const d=u.colSpan??1,f=dr(t,c,d),m=o(u,f).length;s[l]=Math.max(s[l]??1,m)}}}const a=Array.from({length:s.length}).fill(!1);if(n.fixedRowHeights)for(let l=0;l<s.length;l+=1){let p;n.fixedRowHeights[l]!==void 0?p=n.fixedRowHeights[l]:n.fixedRowHeights.length===1&&n.fixedRowHeights[0]!==void 0&&(p=n.fixedRowHeights[0]),p!==void 0&&(s[l]=Math.max(1,p),a[l]=!0)}for(let l=0;l<e.length;l+=1){const p=e[l];if(p)for(let c=0;c<n.columns;c+=1){const u=p[c];if(u&&r(e,l,c,u)===l&&(u.rowSpan??1)>1){const d=u.colSpan??1,f=dr(t,c,d),m=o(u,f).length-1,h=Bs(e,l,c,u),{firstRow:v,lastRow:y}=h;let g=0,$=0;for(let w=v;w<=y&&w<s.length;w+=1)g+=s[w]??1,a[w]||($+=1);const b=m-g;if(b>0)if($>0){const w=Math.ceil(b/$);let E=0;for(let x=v;x<=y&&x<s.length;x+=1)if(!a[x]){const k=Math.min(w,b-E);if(s[x]=(s[x]??1)+k,E+=k,E>=b)break}}else console.warn(`[calculateRowHeights] Content of spanning cell exceeds fixed height allocated. Cell: ${JSON.stringify(u.content)}, Required: ${String(m)}, Allocated: ${String(g)} (fixed).`)}}}return s},qt=(e,t,n,o)=>{let r=t;for(;r>0&&e[r-1]?.[n]===o;)r-=1;return r},Ds="__EMPTY__",up=e=>{if(typeof e=="string")return{content:e};if(typeof e=="number"||typeof e=="bigint"||typeof e=="boolean")return{content:String(e)};if(e==null)return{content:Ds};if(typeof e=="object"&&"content"in e){let{content:t}=e;if(typeof t=="number"||typeof t=="bigint"||typeof t=="boolean")t=String(t);else if(t==null)t=Ds;else if(typeof t!="string")throw new TypeError(`Invalid item type in grid cell: expected string, number, null, undefined, or GridItem object, but received ${JSON.stringify(e)} (type: ${typeof e})`);return{...e,content:t}}throw new TypeError(`Invalid item type in grid cell: expected string, number, null, undefined, or GridItem object, but received ${JSON.stringify(e)} (type: ${typeof e})`)},G8=(e,t,n,o,r)=>{const i=de(e),s=" ".repeat(Math.max(0,o)),a=" ".repeat(Math.max(0,r));if(i===0)return s+" ".repeat(Math.max(0,t))+a;const l=Math.max(0,t-i);switch(n){case"center":{const p=Math.floor(l/2),c=l-p;return s+" ".repeat(p)+e+" ".repeat(c)+a}case"right":return s+" ".repeat(l)+e+a;default:return s+e+" ".repeat(l)+a}},Mn=/\r?\n/,dp=/\s+/,te=(e,t)=>!e||!t?e:typeof t=="function"?t(e):t.open+e+t.close;class Ja{#e;#r=[];#t;#i=new WeakMap;#n=new WeakMap;static createGridLayout(){return[]}constructor(t){const n={autoColumns:1,autoFlow:"row",autoRows:1,balancedWidths:!1,gap:0,paddingLeft:1,paddingRight:1,rows:0,showBorders:t.border!==void 0,truncate:!1,truncateOverflow:!0,wordWrap:!1};let o;Array.isArray(t.fixedRowHeights)?o=t.fixedRowHeights:typeof t.fixedRowHeights=="number"&&(o=[t.fixedRowHeights]),this.#e={...n,...t,columns:t.columns,fixedRowHeights:o,showBorders:t.border!==void 0||(t.showBorders??!1)};let{terminalWidth:r}=this.#e;if(r===void 0){const{columns:i}=q8();r=i}this.#t=r,this.#e.maxWidth&&(this.#e.maxWidth=Math.min(this.#e.maxWidth,this.#t))}addItem(t){return this.#r.push(up(t)),this}addItems(t){return this.#r.push(...t.map(n=>up(n))),this}setColumns(t){return this.#e.columns=t,this}setRows(t){return this.#e.rows=t,this}setBorder(t){return this.#e.border=t,this}setShowBorders(t){return this.#e.showBorders=t,this}setMaxWidth(t){return this.#e.maxWidth=t,this}toString(){const t=Ja.createGridLayout();if(this.placeItems(t),t.length===0||t[0]?.length===0)return"";let n=this.calculateColumnWidths(t);const o=this.calculateTotalGridWidth(n),r=typeof this.#e.maxWidth=="number"&&this.#e.maxWidth>0?Math.min(this.#e.maxWidth,this.#t):this.#t;return o>r&&(n=this.adjustColumnWidthsForTerminal(n,o)),this.renderGrid(t,n)}placeItems(t){let n=0,o=0;const r=this.#e.rows>0?this.#e.rows:Number.POSITIVE_INFINITY;for(let i=0;i<this.#r.length;i+=1){const s=this.#r[i];if(s.content===Ds&&!(s.rowSpan&&s.rowSpan>1)&&!(s.colSpan&&s.colSpan>1)){if(this.#e.autoFlow==="row")o+=1,o>=this.#e.columns&&(o=0,n+=1);else{n+=1;const m=t.length>0?t.length:r;n>=m&&m!==Number.POSITIVE_INFINITY?(n=0,o+=1):t.length===0&&m===Number.POSITIVE_INFINITY&&(o+=1)}continue}const a=s.colSpan??1,l=s.rowSpan??1;let p=!1,c=n,u=o,d=0;const f=(t.length+l+5)*this.#e.columns;for(;!p&&c<r&&d<f;){for(d+=1;c+l>t.length;)t.push(Array.from({length:this.#e.columns}).fill(void 0));if(this.canPlaceItem(t,c,u,a,l))if(this.placeItem(t,c,u,s),p=!0,this.#e.autoFlow==="row")o=u+a,n=c,o>=this.#e.columns&&(o=0,n+=1);else{n=c+l,o=u;const m=t.length>0?t.length:r;n>=m&&(n=0,o+=1)}else if(this.#e.autoFlow==="row")u+=1,u>=this.#e.columns&&(u=0,c+=1);else{for(c+=1;c+l>t.length;)t.push(Array.from({length:this.#e.columns}).fill(void 0));const m=t.length>0?t.length:r;if(c>=m&&(c=0,u+=1,u>=this.#e.columns))break}}if(!p)if(console.warn(`@visulima/tabular: Could not find position for item: ${JSON.stringify(s)} after ${String(d)} attempts. Grid might be too small or layout impossible.`),this.#e.autoFlow==="row")o+=1,o>=this.#e.columns&&(o=0,n+=1);else{n+=1;const m=t.length>0?t.length:r;n>=m&&(n=0,o+=1)}if(d>=f)break}if(this.#e.rows===0)for(;t.length>0&&t.at(-1)?.every(i=>i===void 0);)t.pop()}canPlaceItem(t,n,o,r,i,s=!1){if(o+r>this.#e.columns)return!1;for(let a=n;a<n+i;a+=1)if(a<t.length){if(!t[a])return console.warn(`Grid layout unexpectedly missing row ${String(a)} during canPlaceItem check.`),!1;for(let l=o;l<o+r;l+=1)if(t[a]?.[l]!==void 0)return!1}else if(!s)return!1;return!0}computeWrappedContentWidth(t,n,o,r){let i=t;if(r){if(i>20){let s=0;for(const a of n){const l=a.split(dp);for(const p of l)s=Math.max(s,Math.min(de(p),o))}i=Math.min(i,Math.max(s+4,12))}}else{let s=0;for(const a of n){const l=a.split(dp);for(const p of l)s=Math.max(s,Math.min(de(p),o))}i=Math.min(i,Math.max(s+12,20))}return i}placeItem(t,n,o,r){const i=r.rowSpan??1,s=r.colSpan??1;for(let a=n;a<n+i;a+=1){for(;a>=t.length;)t.push(Array.from({length:this.#e.columns}).fill(void 0));for(let l=o;l<o+s;l+=1)l<this.#e.columns&&(t[a]||(console.error(`Logic error: Row ${String(a)} not found in placeItem despite check.`),t[a]=Array.from({length:this.#e.columns}).fill(void 0)),t[a][l]=r)}}calculateTotalGridWidth(t){let n=0;const o=this.#e.showBorders?this.#e.border:void 0;o&&(n+=o.bodyLeft.width,n+=o.bodyRight.width);const r=t.length,i=this.#e.showBorders?o?.bodyJoin.width??0:0,s=this.#e.gap;for(let a=0;a<r;a+=1)n+=t[a]??0,a<r-1&&(n+=s,n+=i);return n}adjustColumnWidthsForTerminal(t,n){const o=typeof this.#e.maxWidth=="number"&&this.#e.maxWidth>0?Math.min(this.#e.maxWidth??0,this.#t):this.#t;if(n<=o)return t;let r=0;const i=t.length,s=this.#e.showBorders?this.#e.border:void 0;if(s&&(r+=s.bodyLeft.width,r+=s.bodyRight.width),i>1){r+=(i-1)*this.#e.gap;const u=s?.bodyJoin.width??0;r+=(i-1)*u}if(r>=o)return Array.from({length:i}).fill(1);const a=o-r,l=t.reduce((u,d)=>u+d,0);if(l===0){const u=Math.floor(a/i);return Array.from({length:i}).fill(u)}const p=t.map(u=>{const d=u/l;return Math.max(1,Math.floor(a*d))});let c=a-p.reduce((u,d)=>u+d,0);if(c>0){const u=p.map((d,f)=>{const m=l>0?(t[f]??0)/l:1/i;return{index:f,remainder:a*m%1}}).toSorted((d,f)=>f.remainder-d.remainder);for(const d of u){if(c<=0)break;const{index:f}=d;p[f]!==void 0&&(p[f]+=1,c-=1)}}return p}calculateBalancedColumnWidths(t){const n=this.calculateMinimumColumnWidthsWithGrowableInfo(t),o=n.widths,{growableColumns:r}=n,i=typeof this.#e.maxWidth=="number"&&this.#e.maxWidth>0?Math.min(this.#e.maxWidth,this.#t):this.#t,s=this.#e.showBorders?this.#e.border:void 0;let a=0;if(s&&(a+=s.bodyLeft.width,a+=s.bodyRight.width),this.#e.columns>1){a+=(this.#e.columns-1)*this.#e.gap;const c=s?.bodyJoin.width??0;a+=(this.#e.columns-1)*c}const l=Math.max(0,i-a);if(o.reduce((c,u)=>c+u,0)>0){const c=Math.floor(l/this.#e.columns),u=Array.from({length:this.#e.columns}).fill(c),d=c*this.#e.columns;let f=l-d;for(let y=0;y<u.length&&f>0;y+=1)u[y]=(u[y]??0)+1,f-=1;const m=[];let h=0;for(let y=0;y<this.#e.columns;y+=1){const g=u[y]??0,$=o[y]??0,b=Math.max(g,$);m.push(b),h+=b}if(h>l){const y=l/h,g=m.map(w=>Math.max(3,Math.floor(w*y))),$=g.reduce((w,E)=>w+E,0);let b=l-$;for(let w=0;w<g.length&&b>0;w+=1)g[w]=(g[w]??0)+1,b-=1;return g}let v=l-h;if(v>0){const y=r.length>0?r:m.map((g,$)=>$);for(;v>0&&y.length>0;)for(const g of y){if(v<=0)break;m[g]=(m[g]??0)+1,v-=1}}return m}const p=Math.floor(l/this.#e.columns);return Array.from({length:this.#e.columns}).fill(p)}calculateMinimumColumnWidthsWithGrowableInfo(t){const n=Array.from({length:this.#e.columns}).fill(0),o=[],r=this.#e.paddingLeft+this.#e.paddingRight,i=this.#e.gap+(this.#e.showBorders?this.#e.border?.bodyJoin.width??0:0);for(let s=0;s<this.#e.columns;s+=1)for(let a=0;a<t.length;a+=1){const l=t[a]?.[s];if(!l||qt(t,a,s,l)!==a||s>0&&t[a]?.[s-1]===l)continue;const p=l.colSpan??1,c=l.maxWidth??Number.POSITIVE_INFINITY,u=String(l.content??"").split(Mn),d=this.#e.wordWrap&&l.wordWrap!==!1;let f=0;for(const m of u)f=Math.max(f,Math.min(de(m),c));f=this.computeWrappedContentWidth(f,u,c,d),p===1&&(n[s]=Math.max(n[s]??0,f+r),d&&!o.includes(s)&&o.push(s))}for(let s=0;s<t.length;s+=1)for(let a=0;a<this.#e.columns;a+=1){const l=t[s]?.[a];if(!l||qt(t,s,a,l)!==s||a>0&&t[s]?.[a-1]===l)continue;const p=l.colSpan??1;if(p>1){const c=l.maxWidth??Number.POSITIVE_INFINITY,u=String(l.content??"").split(Mn),d=this.#e.wordWrap&&l.wordWrap!==!1;let f=0;for(const y of u)f=Math.max(f,Math.min(de(y),c));f=this.computeWrappedContentWidth(f,u,c,d);const m=(p-1)*i,h=f+r+m;let v=0;for(let y=a;y<a+p;y+=1)v+=n[y]??0;if(h>v){const y=h-v,g=Math.ceil(y/p);for(let $=0;$<p&&a+$<this.#e.columns;$+=1)n[a+$]=Math.max(n[a+$]??0,g)}}}return{growableColumns:o,widths:n}}calculateColumnWidths(t){if(this.#e.fixedColumnWidths&&this.#e.fixedColumnWidths.length===this.#e.columns){const i=this.#e.fixedColumnWidths;if(!i.some(s=>s===void 0||!Number.isFinite(s)))return[...i];if(this.#e.balancedWidths){const s=Array.from({length:i.length}).fill(0),a=typeof this.#e.maxWidth=="number"&&this.#e.maxWidth>0?Math.min(this.#e.maxWidth,this.#t):this.#t,l=this.calculateTotalGridWidth(Array.from({length:s.length}).fill(0)),p=Math.max(0,a-l);let c=0;const u=[];for(const[m,h]of i.entries())typeof h=="number"&&Number.isFinite(h)?(s[m]=h,c+=h):u.push(m);let d=Math.max(0,p-c);const f=u.length>0?Math.floor(d/u.length):0;for(const m of u)s[m]=f;d-=f*u.length;for(const m of u){if(d<=0)break;s[m]+=1,d-=1}return s}}if(this.#e.balancedWidths)return this.calculateBalancedColumnWidths(t);const n=Array.from({length:this.#e.columns}).fill(0),o=this.#e.paddingLeft+this.#e.paddingRight,r=this.#e.gap+(this.#e.showBorders?this.#e.border?.bodyJoin.width??0:0);for(let i=0;i<this.#e.columns;i+=1)for(let s=0;s<t.length;s+=1){const a=t[s]?.[i];if(!a||qt(t,s,i,a)!==s||i>0&&t[s]?.[i-1]===a)continue;const l=a.colSpan??1,p=a.maxWidth??Number.POSITIVE_INFINITY,c=String(a.content??"").split(Mn);let u=0;for(const d of c)u=Math.max(u,Math.min(de(d),p));l===1&&(n[i]=Math.max(n[i]??0,u+o))}for(let i=0;i<t.length;i+=1)for(let s=0;s<this.#e.columns;s+=1){const a=t[i]?.[s];if(!a||qt(t,i,s,a)!==i||s>0&&t[i]?.[s-1]===a)continue;const l=a.colSpan??1;if(l>1){const p=a.maxWidth??Number.POSITIVE_INFINITY,c=String(a.content??"").split(Mn),u=this.#e.wordWrap&&a.wordWrap!==!1;let d=0;for(const y of c)d=Math.max(d,Math.min(de(y),p));d=this.computeWrappedContentWidth(d,c,p,u);let f=0;for(let y=s;y<s+l;y+=1)f+=n[y]??0;const m=l>1?(l-1)*r:0,h=d+o+m,v=f+m;if(h>v){const y=h-v,g=Math.floor(y/l);let $=0;for(let b=0;b<l&&s+b<this.#e.columns;b+=1){const w=Math.min(g,y-$);if(n[s+b]=(n[s+b]??0)+w,$+=w,$>=y)break}}}}if(this.#e.maxWidth){const i=this.calculateTotalGridWidth(n);if(i>this.#e.maxWidth)return this.adjustColumnWidthsForTerminal(n,i)}return n}renderVisualRowContent(t,n,o,r,i){const s=t[n];if(!s)return"";const a=this.#e.borderColor??this.#e.foregroundColor??void 0,l=[],p=this.#e.showBorders&&this.#e.border?H8(this.#e.border):void 0,c=p&&p.left.width>0?p.left.char:"",u=p&&p.right.width>0?p.right.char:"",d=p&&p.join.width>0?p.join.char:"",f=" ".repeat(this.#e.gap);c&&l.push(te(te(c,a),this.#e.backgroundColor));let m=0;for(;m<this.#e.columns;){const h=s[m]??void 0;let v=1,y;if(h){const g=h.colSpan??1;v=g;const $=qt(t,n,m,h),b=dr(r,m,g),w=this.alignCellContent(h,b),E=w.length,x=this.getCachedCellVerticalPosition(t,n,m,h);x.firstRow!==$&&console.warn(`Mismatch between findFirstOccurrenceRow (${String($)}) and determineCellVerticalPosition (${String(x.firstRow)})`);const k=i.slice($,x.lastRow+1).reduce((H,_)=>H+_,0),j=x.lastRow-x.firstRow+1;let S=o,R=0;for(let H=$;H<n;H+=1)H<i.length&&(S+=i[H]??1),H<x.lastRow&&(R+=1);S+=R;const N=h.vAlign??"top";let J;switch(N){case"bottom":{let H=o;for(let O=$;O<n;O+=1)H+=i[O]??1;const _=k-E;J=H>=_?H-_:-1;break}case"middle":{const H=Math.round((k-E)/2);let _=o;for(let O=$;O<n;O+=1)_+=i[O]??1;J=_>=H&&_<H+E?_-H:-1;break}case"top":{J=S;break}default:J=S}const G=J>=0&&J<E;if(y=" ".repeat(Math.max(0,b)),G){let H=!1;N==="middle"&&j%2===0&&J===0&&(H=!0),H||(y=w[J]??y)}h.colSpan&&h.colSpan>1&&(y+=f.repeat(h.colSpan)),h.foregroundColor?y=te(y,h.foregroundColor):this.#e.foregroundColor&&(y=te(y,this.#e.foregroundColor)),h.backgroundColor?y=te(y,h.backgroundColor):this.#e.backgroundColor&&(y=te(y,this.#e.backgroundColor))}else{const g=this.#e.paddingLeft+this.#e.paddingRight,$=Math.max(0,(r[m]??0)-g),b=" ".repeat(this.#e.paddingLeft+$+this.#e.paddingRight);y=te(te(o===0?b:" ".repeat(b.length),this.#e.foregroundColor),this.#e.backgroundColor)}l.push(y),m+v<this.#e.columns&&(l.push(f),this.#e.showBorders&&d&&l.push(te(te(d,a),this.#e.backgroundColor)),this.#e.gap>0&&l.push(f)),m+=v}return u&&l.push(te(te(u,a),this.#e.backgroundColor)),l.join("")}alignCellContent(t,n){const o=this.#i.get(t);if(o?.has(n))return o.get(n);const{paddingLeft:r,paddingRight:i}=this.#e,s=r+i,a=n-s;if(a<=0){const u=[" ".repeat(s+this.#e.gap)];return o?o.set(n,u):this.#i.set(t,new Map([[n,u]])),u}let l;const p=String(t.content??"");if(l=p.includes(`
|
|
176
|
+
`)||p.includes("\r")?p.split(Mn):[p],this.#e.wordWrap&&t.wordWrap!==!1){const u=typeof this.#e.wordWrap=="object"?this.#e.wordWrap:{},d=typeof t.wordWrap=="object"?t.wordWrap:u;l=L8(p,{...d,width:a}).split(`
|
|
177
|
+
`)}if(this.#e.truncate&&t.truncate!==!1){const u=typeof this.#e.truncate=="object"?this.#e.truncate:{},d=typeof t.truncate=="object"?t.truncate:u;l=l.map(f=>ap(f,a,d))}else this.#e.truncateOverflow&&(l=l.map(u=>de(u)>a?ap(u,a,{}):u));const c=l.map(u=>G8(u,a,t.hAlign??"left",r,i));return o?o.set(n,c):this.#i.set(t,new Map([[n,c]])),c}renderHorizontalBorder(t,n,o,r,i,s=-1){if(!this.#e.showBorders||!this.#e.border)return"";const a=this.#e.border,l=Ft(a,i),p=l.body.char,c=l.body.width,u=a.bodyJoin.char;if(i!=="middle"&&c===0)return"";let d=l.left.char,f=l.right.char;if(i==="middle"&&s!==-1){const y=t[o]?.[0]??void 0,g=t[s]?.[0]??void 0;y&&g&&y===g&&(d=u);const $=this.#e.columns-1,b=t[o]?.[$]??void 0,w=t[s]?.[$]??void 0;b&&w&&b===w&&(f=u)}const m=[],h=" ".repeat(this.#e.gap);d&&m.push(te(te(d,this.#e.borderColor),this.#e.backgroundColor));let v;for(let y=0;y<this.#e.columns;y+=1){const g=t[o]?.[y]??void 0,$=i==="middle"&&s!==-1?t[s]?.[y]??void 0:void 0;let b,w=!1;if(g&&(y===0||t[o]?.[y-1]!==g)&&(b=g,w=!0),g&&!w)continue;if(!g){const k=r[y]??0;if(v=c>0?p.repeat(k):" ".repeat(k),m.push(te(te(v,this.#e.borderColor),this.#e.backgroundColor)),y<this.#e.columns-1){const j=this.determineJoinChar(i,t,o,s,y,y+1);m.push(h),j.width>0&&m.push(te(te(j.char,this.#e.borderColor),this.#e.backgroundColor))}continue}const E=b?.colSpan??1;if(i==="middle"&&i==="middle"&&$&&g===$&&b){const k=b.vAlign==="middle",{firstRow:j,lastRow:S}=this.getCachedCellVerticalPosition(t,o,y,b),R=S-j+1,N=R%2===0,J=j+Math.ceil(R/2)-1,G=dr(r,y,E),H=this.alignCellContent(b,G),_=H.length;if(k&&N&&o===J)v=te(H[0]??"",this.#e.borderColor);else{let O=0;for(let I=j;I<=o;I+=1)O+=n[I]??1,I<o&&(O+=1);const F=O;if(F>=0&&F<_)v=te(H[F]??"",this.#e.foregroundColor);else{const I=r.slice(y,y+E).reduce((P,M)=>P+M,0)+(E-1)*(this.#e.gap+this.#e.border.bodyJoin.width);v=te(" ".repeat(I),this.#e.borderColor)}}m.push(te(v,this.#e.backgroundColor))}else{const k=[];for(let j=y;j<y+E;j+=1){const S=r[j]??0,R=c>0?p:" ";if(k.push(R.repeat(S+this.#e.gap)),j<y+E-1){const N=this.determineJoinChar(i,t,o,s,j,j+1);N.width>0&&k.push(N.char)}}v=k.join(""),m.push(te(te(v,this.#e.borderColor),this.#e.backgroundColor))}const x=y+E-1;if(x<this.#e.columns-1){const k=this.determineJoinChar(i,t,o,s,x,x+1);k.width>0&&m.push(te(te(k.char,this.#e.borderColor),this.#e.backgroundColor))}y+=E-1}return f&&m.push(te(te(f,this.#e.borderColor),this.#e.backgroundColor)),m.join("")}determineJoinChar(t,n,o,r,i,s=-1){if(!this.#e.showBorders||!this.#e.border)return{char:" ",width:this.#e.gap};const a=this.#e.border;if(t!=="middle"){const w=Ft(a,t),E=n[o]?.[i]??void 0,x=s===-1?i+1:s,k=n[o]?.[x]??void 0,j=E!==void 0&&k!==void 0&&E===k?w.body:w.join,{char:S,width:R}=j;return{char:S,width:R>0?R:this.#e.gap}}if(r===-1||s===-1)return{char:" ",width:this.#e.gap};const l=a.bodyJoin,p=n[o]?.[i]??void 0,c=n[r]?.[i]??void 0,u=n[o]?.[s]??void 0,d=n[r]?.[s]??void 0,f=p!==void 0&&c!==void 0&&p===c,m=u!==void 0&&d!==void 0&&u===d,h=p!==void 0&&u!==void 0&&p===u,v=c!==void 0&&d!==void 0&&c===d;let y;const g=Ft(a,"middle");f&&m?y=h?{char:" ",width:l.width}:l:f?y=a.joinLeft:m?y=a.joinRight:h&&v?y=g.body:h?y=a.topJoin:v?y=a.bottomJoin:y=a.joinJoin;const{char:$,width:b}=y;return{char:$,width:b>0?b:this.#e.gap}}renderGrid(t,n){if(t.length===0)return"";const o=[],r=J8(t,n,this.#e,this.alignCellContent.bind(this),qt),i=this.#e.showBorders&&this.#e.border?Ft(this.#e.border,"top"):void 0;i&&i.body.width>0&&o.push(this.renderHorizontalBorder(t,r,0,n,"top"));for(let a=0;a<t.length;a+=1){const l=r[a]??1;for(let c=0;c<l;c+=1)o.push(this.renderVisualRowContent(t,a,c,n,r));const p=this.#e.showBorders&&this.#e.border?Ft(this.#e.border,"middle"):void 0;if(a<t.length-1&&p&&p.body.width>0){const c=t[a],u=t[a+1];let d=!1;if(c&&u)for(let f=0;f<this.#e.columns;f+=1){const m=c[f],h=u[f];if(m!==h){d=!0;break}}d&&o.push(this.renderHorizontalBorder(t,r,a,n,"middle",a+1))}}const s=this.#e.showBorders&&this.#e.border?Ft(this.#e.border,"bottom"):void 0;return s&&s.body.width>0&&o.push(this.renderHorizontalBorder(t,r,t.length-1,n,"bottom")),o.join(`
|
|
178
|
+
`)}getCachedCellVerticalPosition(t,n,o,r){const i=this.#n.get(r);if(i)return i;const s=Bs(t,n,o,r);return this.#n.set(r,s),s}}const U8={bodyJoin:{char:"│",width:1},bodyLeft:{char:"│",width:1},bodyRight:{char:"│",width:1},bottomBody:{char:"─",width:1},bottomJoin:{char:"┴",width:1},bottomLeft:{char:"└",width:1},bottomRight:{char:"┘",width:1},joinBody:{char:"─",width:1},joinJoin:{char:"┼",width:1},joinLeft:{char:"├",width:1},joinRight:{char:"┤",width:1},topBody:{char:"─",width:1},topJoin:{char:"┬",width:1},topLeft:{char:"┌",width:1},topRight:{char:"┐",width:1}},V8={bodyJoin:{char:"│",width:1},bodyLeft:{char:"│",width:1},bodyRight:{char:"│",width:1},bottomBody:{char:"─",width:1},bottomJoin:{char:"┴",width:1},bottomLeft:{char:"╰",width:1},bottomRight:{char:"╯",width:1},joinBody:{char:"─",width:1},joinJoin:{char:"┼",width:1},joinLeft:{char:"├",width:1},joinRight:{char:"┤",width:1},topBody:{char:"─",width:1},topJoin:{char:"┬",width:1},topLeft:{char:"╭",width:1},topRight:{char:"╮",width:1}},K8=e=>e.reduce((t,n)=>n===null?t+1:typeof n=="object"&&!Array.isArray(n)?(n.colSpan??=1,n.colSpan<=0?t+1:t+n.colSpan):t+1,0);let Y8=class{#e;#r=[];#t=[];#i=[];#n=!0;#o=void 0;constructor(t={}){this.#e={...t,showFooter:t.showFooter??!0,showHeader:t.showHeader??!0,style:{border:U8,paddingLeft:1,paddingRight:1,...t.style}}}setHeaders(t){return t.length>0&&!Array.isArray(t[0])?this.#t=[t]:this.#t=t.map(n=>Array.isArray(n)?n:[n]),this.#n=!0,this.#o=void 0,this}setFooter(t){return t.length>0&&!Array.isArray(t[0])?this.#i=[t]:this.#i=t.map(n=>Array.isArray(n)?n:[n]),this.#n=!0,this.#o=void 0,this}addRow(t){if(!Array.isArray(t))throw new TypeError("Row must be an array");return this.#r.push(t),this.#n=!0,this.#o=void 0,this}addRows(...t){for(const n of t)this.addRow(n);return this.#n=!0,this.#o=void 0,this}toString(){if(!this.#n&&this.#o!==void 0)return this.#o;const t=this.#e.showHeader?this.#t:[],n=this.#e.showFooter?this.#i:[],o=[...t,...this.#r,...n];if(o.length===0)return this.#o="",this.#n=!1,"";let r=0;for(const u of o){const d=u;Array.isArray(d)?r=Math.max(r,K8(d)):console.error("Unexpected non-array element found while calculating columns:",d)}if(r===0)return this.#o="",this.#n=!1,"";let i;Array.isArray(this.#e.columnWidths)?i=this.#e.columnWidths.length>=r?this.#e.columnWidths.slice(0,r):[...this.#e.columnWidths,...Array.from({length:r-this.#e.columnWidths.length}).fill(void 0)]:typeof this.#e.columnWidths=="number"&&(i=Array.from({length:r}).fill(this.#e.columnWidths));let s;const a=o.length;if(Array.isArray(this.#e.rowHeights)?s=this.#e.rowHeights:typeof this.#e.rowHeights=="number"&&(s=Array.from({length:a}).fill(this.#e.rowHeights)),i&&Array.isArray(i)){const u=[...i];for(const d of o){const f=d;for(const[m,h]of f.entries()){let v={};if(typeof h=="object"&&h!==null&&!Array.isArray(h)){const{content:y,href:g,...$}=h;v=$}v.width!==void 0?u[m]=v.width:v.maxWidth!==void 0&&u[m]!==void 0&&(u[m]=Math.min(u[m],v.maxWidth))}}i=u}const l={autoFlow:"row",backgroundColor:this.#e.style?.backgroundColor,balancedWidths:this.#e.balancedWidths??!1,border:this.#e.style?.border,borderColor:this.#e.style?.borderColor,columns:r,fixedColumnWidths:i,fixedRowHeights:s,foregroundColor:this.#e.style?.foregroundColor,gap:this.#e.gap??0,maxWidth:this.#e.maxWidth,paddingLeft:this.#e.style?.paddingLeft,paddingRight:this.#e.style?.paddingRight,terminalWidth:this.#e.terminalWidth,truncate:this.#e.truncate??(i?.every(u=>typeof u=="number")||this.#e.maxWidth!==void 0&&!this.#e.balancedWidths),truncateOverflow:this.#e.truncateOverflow??!0,wordWrap:this.#e.wordWrap??!1},p=new Ja(l),c=[];for(const[u,d]of o.entries()){const f=d;if(!Array.isArray(f)){console.error("Skipping non-array row while creating GridItems:",f);continue}const m=this.#e.showHeader?this.#t.length:0,h=this.#r.length,v=this.#e.showHeader&&u<m,y=this.#e.showFooter&&u>=m+h,g=v&&f.length===1&&r>1,$=y&&f.length===1&&r>1;for(const b of f){let w=b,E={};if(typeof w=="object"&&w!==null&&!Array.isArray(w)){const{content:S,href:R,...N}=w;w=R?`\x1B]8;;${R}\x1B\\${String(S)}\x1B]8;;\x1B\\`:S,E=N}g&&(E.colSpan=r),$&&(E.colSpan=r);const x=this.#e.transformTabToSpace&&typeof w=="string"?w.replaceAll(" "," ".repeat(this.#e.transformTabToSpace)):w,{maxWidth:k,width:j}=E;c.push({backgroundColor:E.backgroundColor,colSpan:E.colSpan,content:x,foregroundColor:E.foregroundColor,hAlign:E.hAlign,maxWidth:k,rowSpan:E.rowSpan,truncate:E.truncate??(k===void 0?void 0:!0),vAlign:E.vAlign,width:j,wordWrap:E.wordWrap})}}return p.addItems(c),this.#o=p.toString(),this.#n=!1,this.#o}};const X8=e=>new Y8(e),Z8=e=>e.logger,Q8=/\{\s*"name"/,e3=zh(qh.exec);class lm extends Error{}function t3(e){const t=new Map;return(...n)=>{const o=n.toString();if(t.has(o))return t.get(o);const r=e(...n);return t.set(o,r),r}}const n3={bundler:"bundler",node10:"node10","node16-cjs":"node16 (from CJS)","node16-esm":"node16 (from ESM)"},o3={"":"",1:"(CJS)",99:"(ESM)"},fp={CJSOnlyExportsDefault:Bo,CJSResolvesToESM:Zt,FallbackCondition:Zt,FalseCJS:Ht,FalseESM:Ht,FalseExportDefault:Bo,InternalResolutionError:Ht,MissingExportEquals:Bo,NamedExports:Zt,NoResolution:Ht,UnexpectedModuleSyntax:Ht,UntypedResolution:Zt},r3={esmOnly:["node10","node16-cjs"],node16:["node10"],strict:[]},i3=e=>{if(e.startsWith("{"))return e;const t=Q8.exec(e)?.index;if(t!==void 0)return e.slice(t);const n=e.indexOf("{");return n!==-1?e.slice(n):e},s3=e=>{const t=e.split(`
|
|
179
|
+
`);let n="[";for(const o of t)o&&(n+=`${o},`);return n.at(-1)===","&&(n=n.slice(0,-1)),n+="]",n},a3=async(e,t)=>{switch(e){case"auto":{const{detect:n}=await import("package-manager-detector/detect"),o=await n({cwd:t});if(!o)return;if(o.name==="bun")throw new Error("Bun does not support --json on the pack command");return o.name}case"bun":throw new Error("Bun does not support --json on the pack command");case"pnpm":return"pnpm";case"yarn":return"yarn";default:return"npm"}},l3=(e,t,n)=>{const{allResolutionKinds:o,filterProblems:r,getResolutionOption:i,groupProblemsByKind:s,problemAffectsEntrypoint:a,problemAffectsResolutionKind:l,problemKindInfo:p}=n,c=o.filter(b=>!t.includes(b)),u=o.filter(b=>t.includes(b)),d=[...c,...u],f=Object.keys(e.entrypoints),m=f.map(b=>`"${b==="."?e.packageName:`${e.packageName}/${b.slice(2)}`}"`),h=f.map((b,w)=>{const E=e.problems.some(x=>a(x,b,e))?"redBright":"greenBright";return je[E](m[w])}),v=t3((b,w)=>{const E=t.includes(w)?"(ignored) ":"",x=s(r(e.problems,e,{entrypoint:b,resolutionKind:w})),k=e.entrypoints[b].resolutions[w],{resolution:j}=k,S=Object.keys(x);if(S.length>0)return S.map(G=>E+fp[G](p[G].shortDescription)).join(`
|
|
180
|
+
`);const R="OK (JSON)",N=e.programInfo[i(w)].moduleKinds?.[j?.fileName??""]?.detectedKind??"",J=k.isWildcard?"(wildcard)":`OK ${o3[N]}`;return E+(j?.isJson?R:J)}),y=X8({style:{border:V8}});y.setHeaders(["",...d.map(b=>n3[b])]),h.forEach((b,w)=>{const[E,x,k,j]=d.map(S=>f.map(R=>v(R,S)));y.addRow([b,E[w]??null,x[w]??null,k[w]??null,j[w]??null])});const g=s(e.problems),$=Object.entries(g).map(([b,w])=>{const E=p[b],x=w.some(j=>c.some(S=>l(j,S,e))),k=`${`${E.description}${E.details?` Use \`-f json\` to see ${E.details}.`:""}`} ${E.docsUrl}`;return`${x?"":"(ignored per resolution) "}${fp[b](k)}`});return`Are the types wrong problems found:
|
|
181
|
+
|
|
182
|
+
${y.toString()}
|
|
183
|
+
|
|
184
|
+
${$.join(`
|
|
185
|
+
|
|
186
|
+
`)}`},c3=async(e,t,n)=>{let o=`--pack-destination ${t}`;e==="yarn"?o=`--out "${V(t,"package.tgz")}"`:e==="bun"&&(o=` --destination "${t}"`);let r=" --ignore-scripts";e==="yarn"?r="":e==="pnpm"&&(r=" --config.ignore-scripts=true");let i=(await e3(`${e} pack --json ${o}${r}`,{cwd:n,encoding:"utf8"})).stdout.trim();e==="pnpm"?i=i3(i):e==="yarn"&&(i=s3(i));const s=JSON.parse(i);if(!s?.filename)throw new Error(`Invalid npm pack output format: ${i}`);return s.filename},p3=(e,t,n,o,r,i)=>{if(t.types!==!1&&t.problems.length>0){const s=l3(t,n,i);if(o==="error")throw e.error({message:s,prefix:"attw"}),new lm("attw reported types problems; see the log above.");e.warn({message:s,prefix:"attw"});return}e.success({message:zs(`No Are the types wrong problems found ${Mp`(${Math.round(performance.now()-r).toString()}ms)`}`),prefix:"attw"})},u3=async(e,t)=>{if(!e.options?.validation)return;const{validation:n}=e.options;if(!n.attw)return;const o=Z8(e),{packageJson:r}=Jr(e.options.rootDir);e.pkg=r,t&&o.raw(`
|
|
187
|
+
`),await sw(e.pkg,["@arethetypeswrong/core","package-manager-detector"],"devDependencies",{logger:{warn:b=>{o.warn({message:b,prefix:"attw"})}}});let{level:i="warn",pm:s="auto",profile:a="strict",...l}=n.attw===!0?{}:n.attw;const p=performance.now();o.debug({message:"Running attw check",prefix:"attw"});const c=await ou(V(Qp(),"packem-attw-"));let u;try{u=await import("@arethetypeswrong/core")}catch{o.error({message:`ATTW check requires ${Bo`@arethetypeswrong/core`} to be installed.`,prefix:"attw"});return}const d=await a3(s,e.options.rootDir);if(d===void 0)throw new Error("Could not detect a package manager to run the attw check.");const{allResolutionKinds:f,getResolutionOption:m,groupProblemsByKind:h}=await import("@arethetypeswrong/core/utils"),{filterProblems:v,problemAffectsEntrypoint:y,problemAffectsResolutionKind:g,problemKindInfo:$}=await import("@arethetypeswrong/core/problems");try{const b=await c3(d,c,e.options.rootDir),w=await Yo(b),E=u.createPackageFromTarballData(new Uint8Array(w)),x=await u.checkPackage(E,l),k=r3[a];p3(o,x,k,i,p,{allResolutionKinds:f,filterProblems:v,getResolutionOption:m,groupProblemsByKind:h,problemAffectsEntrypoint:y,problemAffectsResolutionKind:g,problemKindInfo:$})}catch(b){throw b instanceof lm||o.error({message:`ATTW check failed: ${b instanceof Error?b.message:String(b)}`,prefix:"attw"}),b}finally{await yr(c,{force:!0,recursive:!0}).catch(()=>{})}},mp=e=>Array.from(e,t=>Zt(t)).join(", "),d3=e=>{if(e.hoistedDependencies.size>0){const i=`These dependencies are shamefully hoisted: ${mp(e.hoistedDependencies)}`;Y(e,i)}let t=Object.keys(e.pkg.dependencies??{}).filter(i=>!e.usedDependencies.has(i));const{validation:n}=e.options,o=n===!1||n===void 0?!1:n.dependencies,r=o===!1?!1:o.unused;if(r!==!1&&(t=t.filter(i=>!r.exclude.includes(i))),t.length>0){const i=`These dependencies are listed in package.json but not used: ${mp(t)}`;Y(e,i)}},hp=">=18.0.0",f3=e=>{const t=e.options.validation,{pkg:n}=e;if(t.packageJson?.engines===!1)return;const o=process.version,r=n.engines?.node;if(!r){Y(e,`The 'engines.node' field is missing in your package.json. Consider adding "engines": { "node": "${hp}" } to specify Node.js version requirements.`);return}if(!qe.validRange(r)){Y(e,`Invalid Node.js version range "${r}" in engines.node field. Please use a valid semver range like "${hp}".`);return}if(!qe.satisfies(o,r))throw new Error(`Node.js version mismatch: Current version ${o} does not satisfy the required range "${r}" specified in package.json engines.node field.`)},m3=(e,t)=>Jh(e,t)<=e.length/3||t.includes(e),h3=(e,t)=>{const n=e.toLowerCase();return t.filter(o=>m3(o.toLowerCase(),n))},g3=/\/[^*/]*\*[^\n\r/\u2028\u2029]*(?:[\n\r\u2028\u2029][^*/]*\*[^\n\r/\u2028\u2029]*)*(?:\/.*)?$/,v3=(e,t)=>{const{options:n}=e;return ma(e.pkg.exports,t,n.declaration,[],n.ignoreExportKeys??[]).filter(o=>!o.ignored).map(o=>n.dtsOnly?o.subKey==="types"?o.file:void 0:o.file)},y3=(e,t)=>e.options.dtsOnly||!t?[""]:typeof e.pkg.bin=="string"?[e.pkg.bin]:typeof e.pkg.bin=="object"?Object.values(e.pkg.bin):[],b3=(e,t)=>{let n="Potential missing or wrong package.json files:";for(const o of e){const r=h3(o,t);n+=`
|
|
188
|
+
- ${ne(o)}${r.length>0?$m` (did you mean ${r.map(i=>`"${i}"`).join(", ")}?)`:""}`}return n},$3=e=>{const{options:t}=e,n=t.validation,{packageJson:o}=n;if(!o?.exports)return;const r=y3(e,!!o.bin),i=e.pkg.type==="module"?"esm":"cjs",s=new Set([t.declaration&&o.types?e.pkg.types:"",t.declaration&&o.types?e.pkg.typings:"",...r,t.dtsOnly&&!o.main?"":e.pkg.main,t.dtsOnly&&!o.module?"":e.pkg.module,...v3(e,i)].filter(Boolean).map(c=>c&&X(t.rootDir,c.replace(g3,"")))),a=[];for(const c of s)c&&!c.includes("*")&&!Vs(c)&&a.push(c.replace(`${t.rootDir}/`,""));const l=c=>Ae(t.rootDir,X(t.outDir,c)),p=e.buildEntries.filter(c=>!c.chunk).map(c=>l(c.path));if(a.length>0){const c=b3(a,p);Y(e,c)}},w3=(e,t)=>{const n=e.options.validation;if(n.packageJson?.exports===!1)return;const o=new Set(["default","import","module-sync","node","node-addons","require"]),r=new Set(["browser","bun","deno","development","edge-light","electron","production","react-native","react-server","types","workerd"]),i=n.packageJson?.extraConditions??[],s=new Set(i),a=new Set([...r,...s,...o]),l=(d,f)=>{if(d!==null){if(typeof d=="string"){if(!d.startsWith("./")){Y(e,`Invalid exports path "${d}" at ${f}. Export paths must start with "./"`);return}if(d.includes("../")){Y(e,`Invalid exports path "${d}" at ${f}. Export paths should not contain "../" for security reasons`);return}const m=n.packageJson?.allowedExportExtensions??[],h=[...th,...m];if(vs(d)){try{const v=d.startsWith("./")?X(e.options.rootDir,d.slice(2)):X(e.options.rootDir,d),y=Pp([v],{cwd:e.options.rootDir,dot:!1,ignore:["**/node_modules/**","**/.git/**","**/dist/**"]});if(y.length===0)return;const g=y.filter($=>!h.some(b=>$.endsWith(b)));g.length>0&&Y(e,`Export path "${d}" at ${f} matches files with invalid extensions: ${g.join(", ")}. Valid extensions are: ${h.join(", ")}`)}catch(v){Y(e,`Could not validate glob pattern "${d}" at ${f}: ${v instanceof Error?v.message:"Unknown error"}`)}return}h.some(v=>d.endsWith(v))||Y(e,`Export path "${d}" at ${f} should have a valid file extension (${h.join(", ")})`);return}if(Array.isArray(d)){if(d.length===0){Y(e,`Empty fallback array at ${f}. Fallback arrays should contain at least one entry`);return}d.forEach((m,h)=>{l(m,`${f}[${String(h)}]`)});return}if(typeof d=="object"){const m=Object.keys(d);if(m.length===0){Y(e,`Empty conditions object at ${f}. Conditional exports should define at least one condition`);return}const h=m.filter(y=>!a.has(y));if(h.length>0){const y=i.length>0,g=[...o].join(", ");y?Y(e,`Unknown export conditions [${h.join(", ")}] at ${f}. Consider using standard conditions (${g}) or add custom conditions to 'validation.packageJson.extraConditions' in your packem config.`):Y(e,`Unknown export conditions [${h.join(", ")}] at ${f}. Consider using standard conditions (${g}) or add custom conditions using the 'extraConditions' option in your validation config.`)}const v=m.filter(y=>o.has(y));if(v.length>1){const y=["node-addons","node","import","require","module-sync","default"],g=v,$=y.filter(b=>g.includes(b));JSON.stringify(g)!==JSON.stringify($)&&Y(e,`Incorrect condition order at ${f}. Standard conditions should be ordered: ${$.join(" > ")}`)}m.forEach(y=>{l(d[y],`${f}.${y}`)});return}Y(e,`Invalid exports value type at ${f}. Expected string, array, object, or null`)}},p=(d,f)=>{d.startsWith(".")&&!d.startsWith("./")&&d!=="."&&Y(e,`Invalid subpath "${d}". Subpaths should start with "./" or be exactly "."`),d.includes("*")&&(d.match(/\*/g)??[]).length>1&&Y(e,`Invalid subpath pattern "${d}". Only one "*" wildcard is allowed per subpath`),l(f[d],`exports["${d}"]`)},c=(d,f,m)=>{const h=d.filter(y=>y!=="."),v=e.pkg.bin!==void 0&&h.length<=1&&h.every(y=>y==="./package.json");!f.includes(".")&&!v&&Y(e,'Missing main export ".". Subpaths exports should include a main export entry');for(const y of f)p(y,m)},u=d=>{const f=Object.keys(d);if(f.length===0){Y(e,"Empty exports object. Define at least one export entry");return}const m=f.filter(v=>v.startsWith(".")),h=f.filter(v=>!v.startsWith("."));if(m.length>0&&h.length>0){Y(e,'Mixed subpaths and conditions in exports object. Use either subpaths (keys starting with ".") or conditions, not both');return}m.length>0?c(m,f,d):l(d,"exports")};(d=>{if(typeof d=="string"){l(d,"exports");return}if(Array.isArray(d)){d.forEach((f,m)=>{l(f,`exports[${String(m)}]`)});return}if(typeof d=="object"&&d!==null){u(d);return}Y(e,"Invalid exports field type. Expected string, array, or object")})(t)},x3=({context:e,pkg:t,validation:n})=>{t.name===void 0&&n.packageJson?.name!==!1&&Y(e,"The 'name' field is missing in your package.json. Please provide a valid package name."),n.packageJson?.files!==!1&&Array.isArray(t.files)&&!t.files.includes("*")&&(t.files.length===0?Y(e,"The 'files' field in your package.json is empty. Please specify the files to be included in the package."):t.files.some(o=>o.includes(e.options.outDir))||Y(e,`The 'files' field in your package.json is missing the '${e.options.outDir}' directory. Ensure the output directory is included.`))},k3=({cjsJSExtension:e,context:t,esmJSExtension:n,pkg:o,validation:r})=>{r.packageJson?.main!==!1&&(o.main===void 0&&Y(t,"The 'main' field is missing in your package.json. This field should point to your main entry file."),o.main?.endsWith(`.${n}`)&&Y(t,`The 'main' field in your package.json should not use a '.${n}' extension for CommonJS modules.`)),r.packageJson?.module!==!1&&(o.module===void 0&&t.options.emitESM&&Y(t,"The 'module' field is missing in your package.json, but you are emitting ES modules."),o.module&&o.main&&o.module===o.main&&Y(t,`Conflict detected: The 'module' and 'main' fields both point to '${o.module}'. Please ensure they refer to different module types.`),t.options.emitESM&&o.module?.endsWith(`.${e}`)&&Y(t,`The 'module' field in your package.json should not use a '.${e}' extension for ES modules.`))},E3=({cjsJSExtension:e,context:t,pkg:n,validation:o})=>{o.packageJson?.main!==!1&&n.main===void 0&&Y(t,"The 'main' field is missing in your package.json. This field is needed when emitting CommonJS modules."),o.packageJson?.module!==!1&&(n.module===void 0&&Y(t,"The 'module' field is missing in your package.json. This field is necessary when emitting ES modules."),n.module?.endsWith(`.${e}`)&&Y(t,`The 'module' field should not use a '.${e}' extension for ES modules.`),n.module&&n.main&&n.module===n.main&&Y(t,`Conflict detected: The 'module' and 'main' fields both point to '${n.module}'. Please ensure they refer to different module types.`)),o.packageJson?.exports!==!1&&n.exports===void 0&&Y(t,"The 'exports' field is missing in your package.json. This field is required for defining explicit exports.")},S3=e=>{const{context:t,pkg:n,validation:o}=e;n.exports===void 0&&!t.options.emitCJS?o.packageJson?.exports!==!1&&Y(t,"The 'exports' field is missing in your package.json. Define module exports explicitly."):t.options.emitCJS&&E3(e)},j3=({cjsJSExtension:e,context:t,esmJSExtension:n,pkg:o,validation:r},i)=>{if(r.packageJson?.bin===!1)return;const s=i?n:e;if(e===n)return;const a=i?"CommonJS":"ES modules";if(typeof o.bin=="string"&&o.bin.endsWith(`.${s}`))Y(t,`The 'bin' field in your package.json should not use a .${s} extension for ${a} binaries.`);else if(typeof o.bin=="object")for(const[l,p]of Object.entries(o.bin))p?.endsWith(`.${s}`)&&Y(t,`The 'bin.${l}' field in your package.json should not use a .${s} extension for ${a} binaries.`)},A3=({cjsJSExtension:e,context:t,pkg:n,validation:o})=>{if(!t.options.declaration)return;let r=!0;n.type==="module"&&(r=!!n.main?.endsWith(`.${e}`));const i=n.types!==void 0||n.typings!==void 0;!i&&r&&o.packageJson?.types!==!1&&Y(t,"The 'types' field is missing in your package.json. This field should point to your type definitions file.");const s=n.type==="module"&&n.main!==void 0&&i;(t.options.declaration===!0||t.options.declaration==="compatible")&&r&&!s&&o.packageJson?.typesVersions!==!1&&(()=>{const a=n.typesVersions;return a===void 0||Object.keys(a).length===0})()&&Y(t,"No 'typesVersions' field found in your package.json. Consider adding this field, or change the declaration option to 'node16' or 'false'.")},O3=e=>{const t=e.options.validation,{pkg:n}=e,o=Me(e,"cjs"),r=Me(e,"esm"),i={cjsJSExtension:o,context:e,esmJSExtension:r,pkg:n,validation:t};x3(i);const s=n.type==="commonjs"||n.type===void 0,a=n.type==="module";s?k3(i):a&&S3(i),n.exports!==void 0&&w3(e,n.exports),j3(i,s),A3(i),t.packageJson?.sideEffects!==!1&&n.sideEffects===void 0&&Y(e,"The 'sideEffects' field is missing in your package.json. Consider adding this field to your package.json.")},R3=e=>{const{packageJson:t}=Jr(e.options.rootDir);e.pkg=t,d3(e),f3(e),O3(e),$3(e)},C3=/^[^a-z_@#~]|[^\w/@#~-]|@\/|#\/|~\//i,T3=new Set(["abstract","await","boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","let","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","undefined","var","void","volatile","while","with","yield"]),_3=(e,t)=>{if(e.trim()==="")throw new Error(`Alias name "${e}" is invalid. Alias names should be non-empty strings.`);if(C3.test(e))throw new Error(`Alias name "${e}" is invalid. Alias names should start with a letter or underscore and only contain letters, numbers, underscores, and dashes.`);if(T3.has(e))throw new Error(`Alias name "${e}" is a reserved keyword and cannot be used.`);const n=X(t);if(!nt(n))throw new Error(`Target path "${n}" for alias "${e}" does not exist.`)},gp=e=>{if(Array.isArray(e))return;const t=e;for(const[n,o]of Object.entries(t))_3(n,o)};var ls={},cs,vp;function Vr(){if(vp)return cs;vp=1;const e="[^\\\\/]",t="(?=.)",n="[^/]",o="(?:\\/|$)",r="(?:^|\\/)",i=`\\.{1,2}${o}`,s="(?!\\.)",a=`(?!${r}${i})`,l=`(?!\\.{0,1}${o})`,p=`(?!${i})`,c="[^.\\/]",u=`${n}*?`,d="/",f={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:t,QMARK:n,END_ANCHOR:o,DOTS_SLASH:i,NO_DOT:s,NO_DOTS:a,NO_DOT_SLASH:l,NO_DOTS_SLASH:p,QMARK_NO_DOT:c,STAR:u,START_ANCHOR:r,SEP:d},m={...f,SLASH_LITERAL:"[\\\\/]",QMARK:e,STAR:`${e}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},h={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return cs={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:h,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(v){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${v.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(v){return v===!0?m:f}},cs}var yp;function Kr(){return yp||(yp=1,(function(e){const{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_GLOBAL:r}=Vr();e.isObject=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),e.hasRegexChars=i=>o.test(i),e.isRegexChar=i=>i.length===1&&e.hasRegexChars(i),e.escapeRegex=i=>i.replace(r,"\\$1"),e.toPosixSlashes=i=>i.replace(t,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const i=navigator.platform.toLowerCase();return i==="win32"||i==="windows"}return process.platform?process.platform==="win32":!1},e.removeBackslashes=i=>i.replace(n,s=>s==="\\"?"":s),e.escapeLast=(i,s,a)=>{const l=i.lastIndexOf(s,a);return l===-1?i:i[l-1]==="\\"?e.escapeLast(i,s,l-1):`${i.slice(0,l)}\\${i.slice(l)}`},e.removePrefix=(i,s={})=>{let a=i;return a.startsWith("./")&&(a=a.slice(2),s.prefix="./"),a},e.wrapOutput=(i,s={},a={})=>{const l=a.contains?"":"^",p=a.contains?"":"$";let c=`${l}(?:${i})${p}`;return s.negated===!0&&(c=`(?:^(?!${c}).*$)`),c},e.basename=(i,{windows:s}={})=>{const a=i.split(s?/[\\/]/:"/"),l=a[a.length-1];return l===""?a[a.length-2]:l}})(ls)),ls}var ps,bp;function N3(){if(bp)return ps;bp=1;const e=Kr(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:o,CHAR_COMMA:r,CHAR_DOT:i,CHAR_EXCLAMATION_MARK:s,CHAR_FORWARD_SLASH:a,CHAR_LEFT_CURLY_BRACE:l,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:c,CHAR_PLUS:u,CHAR_QUESTION_MARK:d,CHAR_RIGHT_CURLY_BRACE:f,CHAR_RIGHT_PARENTHESES:m,CHAR_RIGHT_SQUARE_BRACKET:h}=Vr(),v=$=>$===a||$===o,y=$=>{$.isPrefix!==!0&&($.depth=$.isGlobstar?1/0:1)};return ps=($,b)=>{const w=b||{},E=$.length-1,x=w.parts===!0||w.scanToEnd===!0,k=[],j=[],S=[];let R=$,N=-1,J=0,G=0,H=!1,_=!1,O=!1,F=!1,I=!1,P=!1,M=!1,q=!1,U=!1,B=!1,D=0,K,z,A={value:"",depth:0,isGlob:!1};const ae=()=>N>=E,Ge=()=>R.charCodeAt(N+1),we=()=>(K=z,R.charCodeAt(++N));for(;N<E;){z=we();let fe;if(z===o){M=A.backslashes=!0,z=we(),z===l&&(P=!0);continue}if(P===!0||z===l){for(D++;ae()!==!0&&(z=we());){if(z===o){M=A.backslashes=!0,we();continue}if(z===l){D++;continue}if(P!==!0&&z===i&&(z=we())===i){if(H=A.isBrace=!0,O=A.isGlob=!0,B=!0,x===!0)continue;break}if(P!==!0&&z===r){if(H=A.isBrace=!0,O=A.isGlob=!0,B=!0,x===!0)continue;break}if(z===f&&(D--,D===0)){P=!1,H=A.isBrace=!0,B=!0;break}}if(x===!0)continue;break}if(z===a){if(k.push(N),j.push(A),A={value:"",depth:0,isGlob:!1},B===!0)continue;if(K===i&&N===J+1){J+=2;continue}G=N+1;continue}if(w.noext!==!0&&(z===u||z===n||z===t||z===d||z===s)&&Ge()===p){if(O=A.isGlob=!0,F=A.isExtglob=!0,B=!0,z===s&&N===J&&(U=!0),x===!0){for(;ae()!==!0&&(z=we());){if(z===o){M=A.backslashes=!0,z=we();continue}if(z===m){O=A.isGlob=!0,B=!0;break}}continue}break}if(z===t){if(K===t&&(I=A.isGlobstar=!0),O=A.isGlob=!0,B=!0,x===!0)continue;break}if(z===d){if(O=A.isGlob=!0,B=!0,x===!0)continue;break}if(z===c){for(;ae()!==!0&&(fe=we());){if(fe===o){M=A.backslashes=!0,we();continue}if(fe===h){_=A.isBracket=!0,O=A.isGlob=!0,B=!0;break}}if(x===!0)continue;break}if(w.nonegate!==!0&&z===s&&N===J){q=A.negated=!0,J++;continue}if(w.noparen!==!0&&z===p){if(O=A.isGlob=!0,x===!0){for(;ae()!==!0&&(z=we());){if(z===p){M=A.backslashes=!0,z=we();continue}if(z===m){B=!0;break}}continue}break}if(O===!0){if(B=!0,x===!0)continue;break}}w.noext===!0&&(F=!1,O=!1);let C=R,T="",Be="";J>0&&(T=R.slice(0,J),R=R.slice(J),G-=J),C&&O===!0&&G>0?(C=R.slice(0,G),Be=R.slice(G)):O===!0?(C="",Be=R):C=R,C&&C!==""&&C!=="/"&&C!==R&&v(C.charCodeAt(C.length-1))&&(C=C.slice(0,-1)),w.unescape===!0&&(Be&&(Be=e.removeBackslashes(Be)),C&&M===!0&&(C=e.removeBackslashes(C)));const ie={prefix:T,input:$,start:J,base:C,glob:Be,isBrace:H,isBracket:_,isGlob:O,isExtglob:F,isGlobstar:I,negated:q,negatedExtglob:U};if(w.tokens===!0&&(ie.maxDepth=0,v(z)||j.push(A),ie.tokens=j),w.parts===!0||w.tokens===!0){let fe;for(let ue=0;ue<k.length;ue++){const De=fe?fe+1:J,wt=k[ue],$n=$.slice(De,wt);w.tokens&&(ue===0&&J!==0?(j[ue].isPrefix=!0,j[ue].value=T):j[ue].value=$n,y(j[ue]),ie.maxDepth+=j[ue].depth),(ue!==0||$n!=="")&&S.push($n),fe=wt}if(fe&&fe+1<$.length){const ue=$.slice(fe+1);S.push(ue),w.tokens&&(j[j.length-1].value=ue,y(j[j.length-1]),ie.maxDepth+=j[j.length-1].depth)}ie.slashes=k,ie.parts=S}return ie},ps}var us,$p;function P3(){if($p)return us;$p=1;const e=Vr(),t=Kr(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:o,REGEX_NON_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_BACKREF:i,REPLACEMENTS:s}=e,a=(g,$)=>typeof $.expandRange=="function"?$.expandRange(...g,$):(g.sort(),`[${g.join("-")}]`),l=(g,$)=>`Missing ${g}: "${$}" - use "\\\\${$}" to match literal characters`,p=g=>{const $=[];let b=0,w=0,E=0,x="",k=!1;for(const j of g){if(k===!0){x+=j,k=!1;continue}if(j==="\\"){x+=j,k=!0;continue}if(j==='"'){E=E===1?0:1,x+=j;continue}if(E===0){if(j==="[")b++;else if(j==="]"&&b>0)b--;else if(b===0){if(j==="(")w++;else if(j===")"&&w>0)w--;else if(j==="|"&&w===0){$.push(x),x="";continue}}}x+=j}return $.push(x),$},c=g=>{let $=!1;for(const b of g){if($===!0){$=!1;continue}if(b==="\\"){$=!0;continue}if(/[?*+@!()[\]{}]/.test(b))return!1}return!0},u=g=>{let $=g.trim(),b=!0;for(;b===!0;)b=!1,/^@\([^\\()[\]{}|]+\)$/.test($)&&($=$.slice(2,-1),b=!0);if(c($))return $.replace(/\\(.)/g,"$1")},d=g=>{const $=g.map(u).filter(Boolean);for(let b=0;b<$.length;b++)for(let w=b+1;w<$.length;w++){const E=$[b],x=$[w],k=E[0];if(!(!k||E!==k.repeat(E.length)||x!==k.repeat(x.length))&&(E===x||E.startsWith(x)||x.startsWith(E)))return!0}return!1},f=(g,$=!0)=>{if(g[0]!=="+"&&g[0]!=="*"||g[1]!=="(")return;let b=0,w=0,E=0,x=!1;for(let k=1;k<g.length;k++){const j=g[k];if(x===!0){x=!1;continue}if(j==="\\"){x=!0;continue}if(j==='"'){E=E===1?0:1;continue}if(E!==1){if(j==="["){b++;continue}if(j==="]"&&b>0){b--;continue}if(!(b>0)){if(j==="("){w++;continue}if(j===")"&&(w--,w===0))return $===!0&&k!==g.length-1?void 0:{type:g[0],body:g.slice(2,k),end:k}}}}},m=g=>{let $=0;const b=[];for(;$<g.length;){const w=f(g.slice($),!1);if(!w||w.type!=="*")return;const E=p(w.body).map(k=>k.trim());if(E.length!==1)return;const x=u(E[0]);if(!x||x.length!==1)return;b.push(x),$+=w.end+1}return b.length<1?void 0:`${b.length===1?t.escapeRegex(b[0]):`[${b.map(w=>t.escapeRegex(w)).join("")}]`}*`},h=g=>{let $=0,b=g.trim(),w=f(b);for(;w;)$++,b=w.body.trim(),w=f(b);return $},v=(g,$)=>{if($.maxExtglobRecursion===!1)return{risky:!1};const b=typeof $.maxExtglobRecursion=="number"?$.maxExtglobRecursion:e.DEFAULT_MAX_EXTGLOB_RECURSION,w=p(g).map(E=>E.trim());if(w.length>1&&(w.some(E=>E==="")||w.some(E=>/^[*?]+$/.test(E))||d(w)))return{risky:!0};for(const E of w){const x=m(E);if(x)return{risky:!0,safeOutput:x};if(h(E)>b)return{risky:!0}}return{risky:!1}},y=(g,$)=>{if(typeof g!="string")throw new TypeError("Expected a string");g=s[g]||g;const b={...$},w=typeof b.maxLength=="number"?Math.min(n,b.maxLength):n;let E=g.length;if(E>w)throw new SyntaxError(`Input length: ${E}, exceeds maximum allowed length: ${w}`);const x={type:"bos",value:"",output:b.prepend||""},k=[x],j=b.capture?"":"?:",S=e.globChars(b.windows),R=e.extglobChars(S),{DOT_LITERAL:N,PLUS_LITERAL:J,SLASH_LITERAL:G,ONE_CHAR:H,DOTS_SLASH:_,NO_DOT:O,NO_DOT_SLASH:F,NO_DOTS_SLASH:I,QMARK:P,QMARK_NO_DOT:M,STAR:q,START_ANCHOR:U}=S,B=L=>`(${j}(?:(?!${U}${L.dot?_:N}).)*?)`,D=b.dot?"":O,K=b.dot?P:M;let z=b.bash===!0?B(b):q;b.capture&&(z=`(${z})`),typeof b.noext=="boolean"&&(b.noextglob=b.noext);const A={input:g,index:-1,start:0,dot:b.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:k};g=t.removePrefix(g,A),E=g.length;const ae=[],Ge=[],we=[];let C=x,T;const Be=()=>A.index===E-1,ie=A.peek=(L=1)=>g[A.index+L],fe=A.advance=()=>g[++A.index]||"",ue=()=>g.slice(A.index+1),De=(L="",le=0)=>{A.consumed+=L,A.index+=le},wt=L=>{A.output+=L.output!=null?L.output:L.value,De(L.value)},$n=()=>{let L=1;for(;ie()==="!"&&(ie(2)!=="("||ie(3)==="?");)fe(),A.start++,L++;return L%2===0?!1:(A.negated=!0,A.start++,!0)},vo=L=>{A[L]++,we.push(L)},st=L=>{A[L]--,we.pop()},Q=L=>{if(C.type==="globstar"){const le=A.braces>0&&(L.type==="comma"||L.type==="brace"),W=L.extglob===!0||ae.length&&(L.type==="pipe"||L.type==="paren");L.type!=="slash"&&L.type!=="paren"&&!le&&!W&&(A.output=A.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=z,A.output+=C.output)}if(ae.length&&L.type!=="paren"&&(ae[ae.length-1].inner+=L.value),(L.value||L.output)&&wt(L),C&&C.type==="text"&&L.type==="text"){C.output=(C.output||C.value)+L.value,C.value+=L.value;return}L.prev=C,k.push(L),C=L},yo=(L,le)=>{const W={...R[le],conditions:1,inner:""};W.prev=C,W.parens=A.parens,W.output=A.output,W.startIndex=A.index,W.tokensIndex=k.length;const ee=(b.capture?"(":"")+W.open;vo("parens"),Q({type:L,value:le,output:A.output?"":H}),Q({type:"paren",extglob:!0,value:fe(),output:ee}),ae.push(W)},mm=L=>{const le=g.slice(L.startIndex,A.index+1),W=g.slice(L.startIndex+2,A.index),ee=v(W,b);if((L.type==="plus"||L.type==="star")&&ee.risky){const re=ee.safeOutput?(L.output?"":H)+(b.capture?`(${ee.safeOutput})`:ee.safeOutput):void 0,Ue=k[L.tokensIndex];Ue.type="text",Ue.value=le,Ue.output=re||t.escapeRegex(le);for(let Ve=L.tokensIndex+1;Ve<k.length;Ve++)k[Ve].value="",k[Ve].output="",delete k[Ve].suffix;A.output=L.output+Ue.output,A.backtrack=!0,Q({type:"paren",extglob:!0,value:T,output:""}),st("parens");return}let pe=L.close+(b.capture?")":""),me;if(L.type==="negate"){let re=z;if(L.inner&&L.inner.length>1&&L.inner.includes("/")&&(re=B(b)),(re!==z||Be()||/^\)+$/.test(ue()))&&(pe=L.close=`)$))${re}`),L.inner.includes("*")&&(me=ue())&&/^\.[^\\/.]+$/.test(me)){const Ue=y(me,{...$,fastpaths:!1}).output;pe=L.close=`)${Ue})${re})`}L.prev.type==="bos"&&(A.negatedExtglob=!0)}Q({type:"paren",extglob:!0,value:T,output:pe}),st("parens")};if(b.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(g)){let L=!1,le=g.replace(i,(W,ee,pe,me,re,Ue)=>me==="\\"?(L=!0,W):me==="?"?ee?ee+me+(re?P.repeat(re.length):""):Ue===0?K+(re?P.repeat(re.length):""):P.repeat(pe.length):me==="."?N.repeat(pe.length):me==="*"?ee?ee+me+(re?z:""):z:ee?W:`\\${W}`);return L===!0&&(b.unescape===!0?le=le.replace(/\\/g,""):le=le.replace(/\\+/g,W=>W.length%2===0?"\\\\":W?"\\":"")),le===g&&b.contains===!0?(A.output=g,A):(A.output=t.wrapOutput(le,A,$),A)}for(;!Be();){if(T=fe(),T==="\0")continue;if(T==="\\"){const W=ie();if(W==="/"&&b.bash!==!0||W==="."||W===";")continue;if(!W){T+="\\",Q({type:"text",value:T});continue}const ee=/^\\+/.exec(ue());let pe=0;if(ee&&ee[0].length>2&&(pe=ee[0].length,A.index+=pe,pe%2!==0&&(T+="\\")),b.unescape===!0?T=fe():T+=fe(),A.brackets===0){Q({type:"text",value:T});continue}}if(A.brackets>0&&(T!=="]"||C.value==="["||C.value==="[^")){if(b.posix!==!1&&T===":"){const W=C.value.slice(1);if(W.includes("[")&&(C.posix=!0,W.includes(":"))){const ee=C.value.lastIndexOf("["),pe=C.value.slice(0,ee),me=C.value.slice(ee+2),re=o[me];if(re){C.value=pe+re,A.backtrack=!0,fe(),!x.output&&k.indexOf(C)===1&&(x.output=H);continue}}}(T==="["&&ie()!==":"||T==="-"&&ie()==="]")&&(T=`\\${T}`),T==="]"&&(C.value==="["||C.value==="[^")&&(T=`\\${T}`),b.posix===!0&&T==="!"&&C.value==="["&&(T="^"),C.value+=T,wt({value:T});continue}if(A.quotes===1&&T!=='"'){T=t.escapeRegex(T),C.value+=T,wt({value:T});continue}if(T==='"'){A.quotes=A.quotes===1?0:1,b.keepQuotes===!0&&Q({type:"text",value:T});continue}if(T==="("){vo("parens"),Q({type:"paren",value:T});continue}if(T===")"){if(A.parens===0&&b.strictBrackets===!0)throw new SyntaxError(l("opening","("));const W=ae[ae.length-1];if(W&&A.parens===W.parens+1){mm(ae.pop());continue}Q({type:"paren",value:T,output:A.parens?")":"\\)"}),st("parens");continue}if(T==="["){if(b.nobracket===!0||!ue().includes("]")){if(b.nobracket!==!0&&b.strictBrackets===!0)throw new SyntaxError(l("closing","]"));T=`\\${T}`}else vo("brackets");Q({type:"bracket",value:T});continue}if(T==="]"){if(b.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){Q({type:"text",value:T,output:`\\${T}`});continue}if(A.brackets===0){if(b.strictBrackets===!0)throw new SyntaxError(l("opening","["));Q({type:"text",value:T,output:`\\${T}`});continue}st("brackets");const W=C.value.slice(1);if(C.posix!==!0&&W[0]==="^"&&!W.includes("/")&&(T=`/${T}`),C.value+=T,wt({value:T}),b.literalBrackets===!1||t.hasRegexChars(W))continue;const ee=t.escapeRegex(C.value);if(A.output=A.output.slice(0,-C.value.length),b.literalBrackets===!0){A.output+=ee,C.value=ee;continue}C.value=`(${j}${ee}|${C.value})`,A.output+=C.value;continue}if(T==="{"&&b.nobrace!==!0){vo("braces");const W={type:"brace",value:T,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};Ge.push(W),Q(W);continue}if(T==="}"){const W=Ge[Ge.length-1];if(b.nobrace===!0||!W){Q({type:"text",value:T,output:T});continue}let ee=")";if(W.dots===!0){const pe=k.slice(),me=[];for(let re=pe.length-1;re>=0&&(k.pop(),pe[re].type!=="brace");re--)pe[re].type!=="dots"&&me.unshift(pe[re].value);ee=a(me,b),A.backtrack=!0}if(W.comma!==!0&&W.dots!==!0){const pe=A.output.slice(0,W.outputIndex),me=A.tokens.slice(W.tokensIndex);W.value=W.output="\\{",T=ee="\\}",A.output=pe;for(const re of me)A.output+=re.output||re.value}Q({type:"brace",value:T,output:ee}),st("braces"),Ge.pop();continue}if(T==="|"){ae.length>0&&ae[ae.length-1].conditions++,Q({type:"text",value:T});continue}if(T===","){let W=T;const ee=Ge[Ge.length-1];ee&&we[we.length-1]==="braces"&&(ee.comma=!0,W="|"),Q({type:"comma",value:T,output:W});continue}if(T==="/"){if(C.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",k.pop(),C=x;continue}Q({type:"slash",value:T,output:G});continue}if(T==="."){if(A.braces>0&&C.type==="dot"){C.value==="."&&(C.output=N);const W=Ge[Ge.length-1];C.type="dots",C.output+=T,C.value+=T,W.dots=!0;continue}if(A.braces+A.parens===0&&C.type!=="bos"&&C.type!=="slash"){Q({type:"text",value:T,output:N});continue}Q({type:"dot",value:T,output:N});continue}if(T==="?"){if(!(C&&C.value==="(")&&b.noextglob!==!0&&ie()==="("&&ie(2)!=="?"){yo("qmark",T);continue}if(C&&C.type==="paren"){const W=ie();let ee=T;(C.value==="("&&!/[!=<:]/.test(W)||W==="<"&&!/<([!=]|\w+>)/.test(ue()))&&(ee=`\\${T}`),Q({type:"text",value:T,output:ee});continue}if(b.dot!==!0&&(C.type==="slash"||C.type==="bos")){Q({type:"qmark",value:T,output:M});continue}Q({type:"qmark",value:T,output:P});continue}if(T==="!"){if(b.noextglob!==!0&&ie()==="("&&(ie(2)!=="?"||!/[!=<:]/.test(ie(3)))){yo("negate",T);continue}if(b.nonegate!==!0&&A.index===0){$n();continue}}if(T==="+"){if(b.noextglob!==!0&&ie()==="("&&ie(2)!=="?"){yo("plus",T);continue}if(C&&C.value==="("||b.regex===!1){Q({type:"plus",value:T,output:J});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||A.parens>0){Q({type:"plus",value:T});continue}Q({type:"plus",value:J});continue}if(T==="@"){if(b.noextglob!==!0&&ie()==="("&&ie(2)!=="?"){Q({type:"at",extglob:!0,value:T,output:""});continue}Q({type:"text",value:T});continue}if(T!=="*"){(T==="$"||T==="^")&&(T=`\\${T}`);const W=r.exec(ue());W&&(T+=W[0],A.index+=W[0].length),Q({type:"text",value:T});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=T,C.output=z,A.backtrack=!0,A.globstar=!0,De(T);continue}let L=ue();if(b.noextglob!==!0&&/^\([^?]/.test(L)){yo("star",T);continue}if(C.type==="star"){if(b.noglobstar===!0){De(T);continue}const W=C.prev,ee=W.prev,pe=W.type==="slash"||W.type==="bos",me=ee&&(ee.type==="star"||ee.type==="globstar");if(b.bash===!0&&(!pe||L[0]&&L[0]!=="/")){Q({type:"star",value:T,output:""});continue}const re=A.braces>0&&(W.type==="comma"||W.type==="brace"),Ue=ae.length&&(W.type==="pipe"||W.type==="paren");if(!pe&&W.type!=="paren"&&!re&&!Ue){Q({type:"star",value:T,output:""});continue}for(;L.slice(0,3)==="/**";){const Ve=g[A.index+4];if(Ve&&Ve!=="/")break;L=L.slice(3),De("/**",3)}if(W.type==="bos"&&Be()){C.type="globstar",C.value+=T,C.output=B(b),A.output=C.output,A.globstar=!0,De(T);continue}if(W.type==="slash"&&W.prev.type!=="bos"&&!me&&Be()){A.output=A.output.slice(0,-(W.output+C.output).length),W.output=`(?:${W.output}`,C.type="globstar",C.output=B(b)+(b.strictSlashes?")":"|$)"),C.value+=T,A.globstar=!0,A.output+=W.output+C.output,De(T);continue}if(W.type==="slash"&&W.prev.type!=="bos"&&L[0]==="/"){const Ve=L[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(W.output+C.output).length),W.output=`(?:${W.output}`,C.type="globstar",C.output=`${B(b)}${G}|${G}${Ve})`,C.value+=T,A.output+=W.output+C.output,A.globstar=!0,De(T+fe()),Q({type:"slash",value:"/",output:""});continue}if(W.type==="bos"&&L[0]==="/"){C.type="globstar",C.value+=T,C.output=`(?:^|${G}|${B(b)}${G})`,A.output=C.output,A.globstar=!0,De(T+fe()),Q({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-C.output.length),C.type="globstar",C.output=B(b),C.value+=T,A.output+=C.output,A.globstar=!0,De(T);continue}const le={type:"star",value:T,output:z};if(b.bash===!0){le.output=".*?",(C.type==="bos"||C.type==="slash")&&(le.output=D+le.output),Q(le);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&b.regex===!0){le.output=T,Q(le);continue}(A.index===A.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?(A.output+=F,C.output+=F):b.dot===!0?(A.output+=I,C.output+=I):(A.output+=D,C.output+=D),ie()!=="*"&&(A.output+=H,C.output+=H)),Q(le)}for(;A.brackets>0;){if(b.strictBrackets===!0)throw new SyntaxError(l("closing","]"));A.output=t.escapeLast(A.output,"["),st("brackets")}for(;A.parens>0;){if(b.strictBrackets===!0)throw new SyntaxError(l("closing",")"));A.output=t.escapeLast(A.output,"("),st("parens")}for(;A.braces>0;){if(b.strictBrackets===!0)throw new SyntaxError(l("closing","}"));A.output=t.escapeLast(A.output,"{"),st("braces")}if(b.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&Q({type:"maybe_slash",value:"",output:`${G}?`}),A.backtrack===!0){A.output="";for(const L of A.tokens)A.output+=L.output!=null?L.output:L.value,L.suffix&&(A.output+=L.suffix)}return A};return y.fastpaths=(g,$)=>{const b={...$},w=typeof b.maxLength=="number"?Math.min(n,b.maxLength):n,E=g.length;if(E>w)throw new SyntaxError(`Input length: ${E}, exceeds maximum allowed length: ${w}`);g=s[g]||g;const{DOT_LITERAL:x,SLASH_LITERAL:k,ONE_CHAR:j,DOTS_SLASH:S,NO_DOT:R,NO_DOTS:N,NO_DOTS_SLASH:J,STAR:G,START_ANCHOR:H}=e.globChars(b.windows),_=b.dot?N:R,O=b.dot?J:R,F=b.capture?"":"?:",I={negated:!1,prefix:""};let P=b.bash===!0?".*?":G;b.capture&&(P=`(${P})`);const M=D=>D.noglobstar===!0?P:`(${F}(?:(?!${H}${D.dot?S:x}).)*?)`,q=D=>{switch(D){case"*":return`${_}${j}${P}`;case".*":return`${x}${j}${P}`;case"*.*":return`${_}${P}${x}${j}${P}`;case"*/*":return`${_}${P}${k}${j}${O}${P}`;case"**":return _+M(b);case"**/*":return`(?:${_}${M(b)}${k})?${O}${j}${P}`;case"**/*.*":return`(?:${_}${M(b)}${k})?${O}${P}${x}${j}${P}`;case"**/.*":return`(?:${_}${M(b)}${k})?${x}${j}${P}`;default:{const K=/^(.*?)\.(\w+)$/.exec(D);if(!K)return;const z=q(K[1]);return z?z+x+K[2]:void 0}}},U=t.removePrefix(g,I);let B=q(U);return B&&b.strictSlashes!==!0&&(B+=`${k}?`),B},us=y,us}var ds,wp;function M3(){if(wp)return ds;wp=1;const e=N3(),t=P3(),n=Kr(),o=Vr(),r=s=>s&&typeof s=="object"&&!Array.isArray(s),i=(s,a,l=!1)=>{if(Array.isArray(s)){const v=s.map(y=>i(y,a,l));return y=>{for(const g of v){const $=g(y);if($)return $}return!1}}const p=r(s)&&s.tokens&&s.input;if(s===""||typeof s!="string"&&!p)throw new TypeError("Expected pattern to be a non-empty string");const c=a||{},u=c.windows,d=p?i.compileRe(s,a):i.makeRe(s,a,!1,!0),f=d.state;delete d.state;let m=()=>!1;if(c.ignore){const v={...a,ignore:null,onMatch:null,onResult:null};m=i(c.ignore,v,l)}const h=(v,y=!1)=>{const{isMatch:g,match:$,output:b}=i.test(v,d,a,{glob:s,posix:u}),w={glob:s,state:f,regex:d,posix:u,input:v,output:b,match:$,isMatch:g};return typeof c.onResult=="function"&&c.onResult(w),g===!1?(w.isMatch=!1,y?w:!1):m(v)?(typeof c.onIgnore=="function"&&c.onIgnore(w),w.isMatch=!1,y?w:!1):(typeof c.onMatch=="function"&&c.onMatch(w),y?w:!0)};return l&&(h.state=f),h};return i.test=(s,a,l,{glob:p,posix:c}={})=>{if(typeof s!="string")throw new TypeError("Expected input to be a string");if(s==="")return{isMatch:!1,output:""};const u=l||{},d=u.format||(c?n.toPosixSlashes:null);let f=s===p,m=f&&d?d(s):s;return f===!1&&(m=d?d(s):s,f=m===p),(f===!1||u.capture===!0)&&(u.matchBase===!0||u.basename===!0?f=i.matchBase(s,a,l,c):f=a.exec(m)),{isMatch:!!f,match:f,output:m}},i.matchBase=(s,a,l)=>(a instanceof RegExp?a:i.makeRe(a,l)).test(n.basename(s)),i.isMatch=(s,a,l)=>i(a,l)(s),i.parse=(s,a)=>Array.isArray(s)?s.map(l=>i.parse(l,a)):t(s,{...a,fastpaths:!1}),i.scan=(s,a)=>e(s,a),i.compileRe=(s,a,l=!1,p=!1)=>{if(l===!0)return s.output;const c=a||{},u=c.contains?"":"^",d=c.contains?"":"$";let f=`${u}(?:${s.output})${d}`;s&&s.negated===!0&&(f=`^(?!${f}).*$`);const m=i.toRegex(f,a);return p===!0&&(m.state=s),m},i.makeRe=(s,a={},l=!1,p=!1)=>{if(!s||typeof s!="string")throw new TypeError("Expected a non-empty string");let c={negated:!1,fastpaths:!0};return a.fastpaths!==!1&&(s[0]==="."||s[0]==="*")&&(c.output=t.fastpaths(s,a)),c.output||(c=t(s,a)),i.compileRe(c,a,l,p)},i.toRegex=(s,a)=>{try{const l=a||{};return new RegExp(s,l.flags||(l.nocase?"i":""))}catch(l){if(a&&a.debug===!0)throw l;return/$^/}},i.constants=o,ds=i,ds}var fs,xp;function I3(){if(xp)return fs;xp=1;const e=M3(),t=Kr();function n(o,r,i=!1){return r&&(r.windows===null||r.windows===void 0)&&(r={...r,windows:t.isWindows()}),e(o,r,i)}return Object.assign(n,e),fs=n,fs}var W3=I3();const B3=io(W3),D3=e=>e.logger,Ls="Validation: File Size",cm=e=>typeof e=="string"?I0(e):e,pm=(e,t,n,o,r)=>{if(n){r&&e.raw(`
|
|
189
|
+
`),e.warn({message:t,prefix:"validation:file-size"});return}Y(o,t)},L3=(e,t,n,o,r)=>{for(const[i,s]of Object.entries(n)){const a=cm(s);if(!Number.isFinite(a)||a<=0){t.debug({message:`Invalid limit for ${i}: ${String(s)}`,prefix:Ls});continue}const l=e.buildEntries.find(p=>{const c=i.replace(new RegExp(`^.?/?${e.options.outDir}/?`),"");return p.path.endsWith(c)||B3(i)(p.path)});if(!l?.size?.bytes){t.debug({message:l?`Entry file has no size information: ${i}.`:`Entry file not found: ${i}, please check your configuration.`,prefix:Ls});continue}if(l.size.bytes>a){const p=`File size exceeds the limit: ${V(e.options.outDir,l.path)} (${Se(l.size.bytes)} / ${Se(a,{decimals:2})})`;pm(t,p,o,e,r)}}},F3=(e,t,n,o,r)=>{const i=e.buildEntries.reduce((a,l)=>{const p=l.size?.bytes;return a+(typeof p=="number"?p:0)},0),s=cm(n);if(!Number.isFinite(s)||s<=0){t.debug({message:`Invalid total limit: ${String(n)}`,prefix:Ls});return}if(i>s){const a=`Total file size exceeds the limit: ${Se(i)} / ${Se(s,{decimals:2})}`;pm(t,a,o,e,r)}},q3=(e,t)=>{const n=e.options.validation,{allowFail:o=!1,limit:r,limits:i={}}=n.bundleLimit??{},s=D3(e);L3(e,s,i,o,t),r&&F3(e,s,r,o,t&&Object.keys(i).length===0)},kp="rollup-dts.json",z3=e=>{const t=new Set,n=[];for(const[o,r]of Object.entries(e))r.type==="chunk"&&r.isEntry&&(t.add(o),n.push(o));if(n.length!==0){for(;n.length>0;){const o=n.pop(),r=e[o];if(r.type==="chunk")for(const i of[...r.imports,...r.dynamicImports])Object.hasOwn(e,i)&&e[i].type==="chunk"&&!t.has(i)&&(t.add(i),n.push(i))}return t}},H3=e=>{const t=z3(e);if(t)for(const[n,o]of Object.entries(e))o.type==="chunk"&&!o.isEntry&&!t.has(n)&&delete e[n]},J3=e=>e.logger,Ep="__packem_skip__/",Sp=(e,t)=>{const n=new Set;if(t.options.emitCJS&&n.add(Ye(t,"cjs")),t.options.emitESM&&n.add(Ye(t,"esm")),(t.options.declaration===!0||t.options.declaration==="compatible")&&n.add("d.ts"),e.declarationExtensions)for(const o of e.declarationExtensions)n.add(o);return n},G3=async(e,t,n)=>{const o=await Ff(e,t);if(await e.hooks.callHook("rollup:dts:options",e,o),Object.keys(o.input??{}).length===0)return;const r=`${n}/${Ke(e.options.entries.map(s=>s.name??"").filter(Boolean).toSorted((s,a)=>s.localeCompare(a)).join(","))}`;o.cache=t.get(kp,r);const i=await(await Wa())(o);try{t.set(kp,i.cache,r),await e.hooks.callHook("rollup:dts:build",e,i),J3(e).info({message:"Building declaration files...",prefix:"dts"});const s=new Map;for(const c of e.options.entries)c.name&&s.set(c.name,c);const a=new Set;for(const c of e.options.entries)for(const u of Sp(c,e))a.add(u);const l=X(e.options.rootDir,e.options.outDir),p={generateBundle(c,u){for(const d of Object.keys(u))d.startsWith(Ep)&&delete u[d];H3(u)},name:"packem:filter-skip-chunks"};for(const c of a)await i.write({chunkFileNames:u=>Jn(u,c),dir:l,entryFileNames:u=>{const d=u.name.endsWith(".d")?u.name.slice(0,-2):u.name,f=d?s.get(d):void 0;return f&&!Sp(f,e).has(c)?`${Ep}[name].${c}`:`[name].${c}`},plugins:[p]});await e.hooks.callHook("rollup:dts:done",e)}finally{await i.close(),await t.flush()}};var U3=fo();const um=io(U3),V3=Hh("packem:exe"),K3=/(?:^|,)packem:exe(?:,|$)/,Y3=()=>{const e=process.env.NODE_DEBUG;return e?K3.test(e):!1},dm=()=>{const e=((t,...n)=>{V3(t,...n)});return Object.defineProperty(e,"enabled",{get:Y3}),e},X3=()=>{const e=hh();if(on==="darwin")return V(e,"Library/Caches/packem");if(on==="win32"){const n=process.env.LOCALAPPDATA;return n?V(n,"packem/Caches"):V(e,"AppData/Local/packem/Caches")}const t=process.env.XDG_CACHE_HOME;return t?V(t,"packem"):V(e,".cache/packem")},Z3=e=>{const t=X3(),n=e.platform==="win"?"node.exe":"node";return V(t,"node",`v${e.nodeVersion}`,`${e.platform}-${e.arch}`,n)};var Q3=Hp();const eA=io(Q3),fm=e=>e==="win"?"zip":e==="linux"?"tar.xz":"tar.gz",tA=e=>{const{arch:t,nodeVersion:n,platform:o}=e,r=fm(o);return`https://nodejs.org/dist/v${n}/node-v${n}-${o}-${t}.${r}`},nA=e=>{const{arch:t,nodeVersion:n,platform:o}=e,r=`node-v${n}-${o}-${t}`;return o==="win"?`${r}/node.exe`:`${r}/bin/node`},jp="https://nodejs.org/dist/index.json",oA=/^v/,rA=async e=>{let t=e;if(t==="latest"||t==="latest-lts"){const o=await fetch(jp);if(!o.ok)throw new Error(`Failed to fetch Node.js releases: HTTP ${String(o.status)} from ${jp}`);const r=await o.json(),i=t==="latest";let s="";for(const a of r)if(i||a.lts!==!1){s=a.version;break}if(s==="")throw new Error(`No matching Node.js release found for "${t}".`);t=s.replace(oA,"")}const n=eA(t);if(!n)throw new Error(`Invalid Node.js version: ${t}. Please provide a valid version string (e.g., "25.7.0").`);if(!um(n,">=25.7.0"))throw new Error(`Node.js ${n} does not support SEA (Single Executable Applications). Required minimum version is 25.7.0. Please update the nodeVersion in your target configuration.`);return n},iA=e=>`-${e.platform}-${e.arch}`,St=dm(),sA=async(e,t,n)=>{const o=nA(n),r=Z(t);if(St("Extracting %s from archive to %s",o,r),n.platform==="win")await Ko("tar",["-xf",e,"-C",r,"--strip-components=1",o],{nodeOptions:{stdio:"inherit"},throwOnError:!0});else{const a=e.endsWith(".tar.xz")?"J":"z";await Ko("tar",[`-x${a}f`,e,"-C",r,"--strip-components=2",o],{nodeOptions:{stdio:"inherit"},throwOnError:!0})}const i=n.platform==="win"?"node.exe":"node",s=V(r,i);s!==t&&await xh(s,t)},aA=async(e,t)=>{St("Resolving Node.js binary for target: %O",e);const n={...e,nodeVersion:await rA(e.nodeVersion)},o=Z3(n);if(St("Cache path: %s",o),await pn(o))return St("Cache hit: %s",o),t.info(`Using cached Node.js ${n.nodeVersion} for ${n.platform}-${n.arch}`),o;const r=tA(n);St("Cache miss, downloading from: %s",r),t.info(`Downloading Node.js ${n.nodeVersion} for ${n.platform}-${n.arch}...`),t.info(` ${r}`),await ru(Z(o),{recursive:!0});const i=await fetch(r);if(!i.ok)throw new Error(`Failed to download Node.js binary: HTTP ${String(i.status)} from ${r}`);const s=fm(n.platform),a=`${o}.download.${s}`,l=Kh.from(await i.arrayBuffer());St("Downloaded %d bytes, writing to: %s",l.length,a),await iu(a,l);try{await sA(a,o,n),n.platform!=="win"&&await nu(o,493),St("Binary cached at: %s",o),t.info(`Cached Node.js binary at: ${o}`)}finally{await yr(a,{force:!0})}return o},Xt=dm(),lA=/\.d\.[mc]?ts$/,cA=e=>({buildEntries:e.buildEntries,logger:e.logger,options:e.options,packageType:e.pkg.type}),pA=e=>{const{logger:t,options:n}=e;if(Uo.bun||Uo.deno)throw new Error("The `exe` option is not supported in Bun and Deno environments.");if(!um(process.version,">=25.7.0"))throw new Error(`Node.js ${process.version} does not support \`exe\` option. Please upgrade to Node.js 25.7.0 or later.`);if(n.entries.length>1){const o=n.entries.map(r=>`- ${r.input}`).join(`
|
|
190
|
+
`);throw new Error(`The \`exe\` feature only supports a single entry point. Found ${String(n.entries.length)} entries:
|
|
191
|
+
${o}`)}n.declaration&&t.warn("Generating .d.ts files with the `exe` option is not recommended since they won't be included in the executable. Consider separating your library and executable targets if you need type declarations."),t.info("`exe` option is experimental and may change in future releases.")},uA=(e,t)=>e.endsWith(".cjs")?"commonjs":e.endsWith(".mjs")||t==="module"?"module":"commonjs",Ap=on==="win32"?"win":on,Op=(e,t,n,o,r)=>{let i;return e.fileName?i=typeof e.fileName=="function"?e.fileName(t):e.fileName:i=rt(n,rn(n)),r&&(i+=r),o==="win"&&(i+=".exe"),i},Rp=async(e,t,n,o,r,i,s)=>{const{logger:a,options:l,packageType:p}=e,c=X(l.rootDir,t.outDir??"build");await ru(c,{recursive:!0});const u=V(c,r);Xt("Building SEA executable: %s -> %s",o,u);const d=performance.now(),f=await ou(V(Qp(),"packem-sea-"));try{const h={disableExperimentalSEAWarning:!0,...t.seaConfig,main:o,mainFormat:uA(n.path,p),output:u};s&&(h.executable=s);const v=V(f,"sea-config.json");await iu(v,JSON.stringify(h)),Xt("Wrote sea-config.json: %O -> %s",h,v),Xt("Running: %s --build-sea %s",process.execPath,v),await Ko(process.execPath,["--build-sea",v],{nodeOptions:{stdio:["ignore","ignore","inherit"]},throwOnError:!0})}finally{Xt.enabled?Xt("Preserving temp directory for debugging: %s",f):await yr(f,{force:!0,recursive:!0})}if(i==="darwin")try{await Ko("codesign",["--sign","-",u],{nodeOptions:{stdio:"inherit"},throwOnError:!0})}catch{const h=on==="darwin"?`You can sign it manually using:
|
|
192
|
+
codesign --sign - "${u}"`:`Automatic code signing is not supported on ${on}.`;a.warn(`Failed to code-sign the executable. ${h}`)}if(await pn(u)){const h=await so(u),v=Se(h.size,{decimals:2});a.info(`${je(Ae(l.rootDir,u))} ${Mp(v)}`)}const m=Math.round(performance.now()-d);a.success(`Built executable: ${Ht(Ae(l.rootDir,u))} ${Fe(`(${String(m)}ms)`)}`)},dA=async e=>{const t=cA(e),{buildEntries:n,logger:o,options:r}=t,i=r.exe;if(!i)return;const s=typeof i=="object"?i:{};pA(t);const a=n.filter(u=>u.type==="entry"&&!lA.test(u.path));if(a.length===0)throw new Error("The `exe` feature requires a built entry, but no entry chunks were found.");if(a.length>1){const u=a.map(d=>`- ${d.path}`).join(`
|
|
193
|
+
`);throw new Error(`The \`exe\` feature only supports single-chunk outputs. Found ${String(a.length)} chunks:
|
|
194
|
+
${u}`)}const l=a[0],p=V(r.rootDir,r.outDir,l.path);Xt("Building executable with SEA for chunk: %s",l.path);const{targets:c}=s;if(c!==void 0&&c.length>0){s.seaConfig?.executable&&o.warn("`seaConfig.executable` is ignored when `targets` is specified.");for(const u of c){const d=await aA(u,o),f=iA(u),m=Op(s,l,p,u.platform,f);await Rp(t,s,l,p,m,u.platform,d)}}else{const u=Op(s,l,p,Ap);await Rp(t,s,l,p,u,Ap)}},fA=async(e,t)=>{if(e.length===0)return[];const n=t<=0||!Number.isFinite(t)?1/0:t,o=Array.from({length:e.length});let r=0;const i=async()=>{for(;r<e.length;){const a=r;r+=1;const l=e[a];l&&(o[a]=await l())}},s=Array.from({length:Math.min(n,e.length)},()=>i());return await Promise.all(s),o},mA=async e=>await new Promise((t,n)=>{let o=0;const r=Ks(e).pipe(Gh({params:{[Uh.BROTLI_PARAM_QUALITY]:4}}));r.on("error",n),r.on("data",i=>{o+=i.length}),r.on("end",()=>{t(o)})}),ms=e=>e==null?"undefined":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"||typeof e=="symbol"?e.toString():JSON.stringify(e),hs=(e,t,n)=>{let o=e.get(t);return o===void 0&&(o=n(),e.set(t,o)),o},hA=(e,t,n,o)=>{{const r=new Map;for(const s of e){const a=hs(r,ms(s[t]),()=>new Map),l=hs(a,ms(s[n]),()=>new Map);hs(l,ms(s[o]),()=>[]).push(s)}const i={};for(const[s,a]of r){const l={};for(const[p,c]of a)l[p]=Object.fromEntries(c);i[s]=l}return i}},gA=async e=>await new Promise((t,n)=>{let o=0;const r=Ks(e).pipe(Vh({level:9}));r.on("error",n),r.on("data",i=>{o+=i.length}),r.on("end",()=>{t(o)})}),vA=2,yA=/\.js$/,bA=/\.d\.[m|c]ts$/,$A=(e,t,n)=>[`total size: ${ne(Se(t,{decimals:2}))}`,e.size?.brotli&&`brotli size: ${ne(Se(e.size.brotli,{decimals:2}))}`,e.size?.gzip&&`gzip size: ${ne(Se(e.size.gzip,{decimals:2}))}`,n!==0&&`chunk size: ${ne(Se(n,{decimals:2}))}`].filter(Boolean).join(", "),wA=(e,t,n,o)=>{const r=Me(t,"cjs"),i=Me(t,"esm"),s=Ye(t,"cjs"),a=Ye(t,"esm");let l=e.path.replace(yA,".d.ts"),p="commonjs";e.path.endsWith(`.${r}`)?l=e.path.replace(new RegExp(String.raw`\.${r}$`),`.${s}`):e.path.endsWith(`.${i}`)&&(p="module",l=e.path.replace(new RegExp(String.raw`\.${i}$`),`.${a}`));const c=t.buildEntries.find(d=>d.path.endsWith(l));if(!c)return"";o.push(c.path);let u;return!l.includes(".d.ts")&&(l=l.replace(bA,".d.ts"),u=t.buildEntries.find(d=>d.path.endsWith(l)),!u)?"":(u&&o.push(u.path),p==="commonjs"&&u?`
|
|
195
|
+
types:
|
|
196
|
+
${[c,u].map(d=>`${Fe(" └─ ")+je(n(d.path))} (total size: ${ne(Se(d.size?.bytes??0,{decimals:2}))})`).join(`
|
|
197
|
+
`)}`:`
|
|
198
|
+
types: ${je(n(c.path))} (total size: ${ne(Se(c.size?.bytes??0,{decimals:2}))})`)},xA=(e,t,n,o)=>{let r=e.size?.bytes??0,i=0;for(const a of e.chunks??[]){const l=t.buildEntries.find(p=>p.path.endsWith(a))?.size?.bytes??0;r+=l,i+=l}let s=` ${je(n(e.path))} (${$A(e,r,i)})`;if(s+=e.exports?.length?`
|
|
199
|
+
exports: ${Fe(e.exports.join(", "))}`:"",e.chunks?.length&&(s+=`
|
|
200
|
+
${e.chunks.map(a=>{const l=t.buildEntries.find(p=>p.path===a)?.bytes;return Fe(` └─ ${n(a)}${je(l?` (${Se(l,{decimals:2})})`:"")}`)}).join(`
|
|
201
|
+
`)}`),e.dynamicImports&&e.dynamicImports.length>0&&(s+=`
|
|
202
|
+
dynamic imports:`,s+=`
|
|
203
|
+
${e.dynamicImports.map(a=>Fe(` └─ ${n(a)}`)).join(`
|
|
204
|
+
`)}`),e.modules&&e.modules.length>0){const a=e.modules.filter(l=>l.id.includes("node_modules")).toSorted((l,p)=>(p.bytes||0)-(l.bytes||0)).map(l=>Fe(` 📦 ${n(l.id)}${je(l.bytes?` (${Se(l.bytes,{decimals:2})})`:"")}`)).join(`
|
|
205
|
+
`);s+=a.length>0?`
|
|
206
|
+
inlined modules:
|
|
207
|
+
${a}`:""}return t.options.declaration&&(s+=wA(e,t,n,o)),s+=`
|
|
208
|
+
|
|
209
|
+
`,e.chunk?Fe(s):s},kA=(e,t)=>{const n=s=>Ae(t.options.rootDir,X(t.options.outDir,s));let o=!1;const r=[],i=t.buildEntries.filter(s=>s.type==="entry");if(i.length>0){e.raw(`Entries:
|
|
210
|
+
`);for(const s of i){const a=xA(s,t,n,r);o=!0,e.raw(a)}}if(t.buildEntries.filter(s=>s.type==="asset").length>0){let s="Assets:";for(const a of t.buildEntries.filter(l=>l.type==="asset"&&!r.includes(l.path)))s+=`${Fe(`
|
|
211
|
+
└─ `)+je(n(a.path))} (total size: ${ne(Se(a.size?.bytes??0,{decimals:2}))})`;s+=`
|
|
212
|
+
|
|
213
|
+
`,e.raw(s)}return o&&e.raw("Σ Total dist size (byte size):",ne(Se(t.buildEntries.reduce((s,a)=>s+(a.size?.bytes??0),0),{decimals:2})),`
|
|
214
|
+
`),o},EA=/\.d\.[mc]?ts$/,gs=e=>e.filter(t=>!EA.test(t.input)),SA=(e,t)=>{const n=[];return e!=="undefined"&&n.push(`${ne(e)} environment`),t!=="undefined"&&n.push(`${ne(t)} runtime`),n.length>0?`Preparing build for ${n.join(" with ")}`:""},jA=(e,t)=>{const n={};return e!=="undefined"&&(n[["process","env","NODE_ENV"].join(".")]=JSON.stringify(e)),n[["process","env","EdgeRuntime"].join(".")]=JSON.stringify(t==="edge-light"),Object.freeze(n)},AA=(e,t)=>{const n=[];return e!=="undefined"&&n.push(e),t!=="undefined"&&n.push(t),n.length>0?`${n.join("/")}/`:""},Io=(e,t,n,o,r,i)=>({...e,options:{...e.options,emitCJS:t,emitESM:n,entries:o,minify:r,rollup:{...e.options.rollup,replace:e.options.rollup.replace?Hr(e.options.rollup.replace,{},i):!1}}}),OA=async(e,t)=>{const n=e.logger,o=l=>{const p=l.name??l.fileAlias;if(!p)return"default";const c=[".browser",".server",".development",".node",".workerd"];for(const u of c)if(p.includes(u))return u.slice(1);return"default"},r=e.options.entries.map(l=>({...l,environment:l.environment??"undefined",runtime:l.runtime??"undefined",type:o(l)})),i=hA(r,"environment","runtime","type"),s=new Set,a=new Set;for(const[l,p]of Object.entries(i))for(const[c,u]of Object.entries(p))for(const[,d]of Object.entries(u)){const f={...e,environment:l==="undefined"?void 0:l,options:{...e.options,rollup:{...e.options.rollup,replace:e.options.rollup.replace?{...e.options.rollup.replace,values:{}}:e.options.rollup.replace}}};if(!e.options.dtsOnly&&(l!=="undefined"||c!=="undefined")){const S=SA(l,c);S&&n.info(S)}const m=c==="undefined"?void 0:c;f.options.runtime=m;try{await e.hooks.callHook("rollup:options",f,{})}catch(S){throw n.error(`Error calling rollup:options hook: ${String(S)}`),S}const h=f.options.rollup.replace,v=e.options.rollup.replace,y=h?jA(l,c):{};if(h){h.values??={};const S=v?Hr(v).values:{};Object.assign(h.values,y,S)}else n.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");const g=h?h.values??y:y,$=AA(l,c);let b=f.options.minify??!1;l==="development"?b=!1:l==="production"&&(b=!0);const w=d.map(S=>{const{environment:R,runtime:N,...J}=S;return{...J,environment:R==="undefined"?void 0:R,runtime:N==="undefined"?void 0:N}}),E=[],x=[],k=[],j=[];for(const S of w){if(oo(S.name)){S.declaration&&j.push(S);continue}S.cjs&&S.esm?E.push(S):S.cjs?k.push(S):S.esm?x.push(S):S.declaration&&j.push(S)}if(E.length>0){const S=Io(f,!0,!0,gs(E),b,g);if(e.options.dtsOnly||s.add({context:S,fileCache:t,subDirectory:$}),e.options.declaration){const R=E.filter(N=>N.declaration);R.length>0&&a.add({context:{...S,options:{...S.options,entries:R}},fileCache:t,subDirectory:$})}}if(x.length>0){const S=Io(f,!1,!0,gs(x),b,g);if(e.options.dtsOnly||s.add({context:S,fileCache:t,subDirectory:$}),e.options.declaration){const R=x.filter(N=>N.declaration);R.length>0&&a.add({context:{...S,options:{...S.options,entries:R}},fileCache:t,subDirectory:$})}}if(k.length>0){const S=Io(f,!0,!1,gs(k),b,g);if(e.options.dtsOnly||s.add({context:S,fileCache:t,subDirectory:$}),e.options.declaration){const R=k.filter(N=>N.declaration);R.length>0&&a.add({context:{...S,options:{...S.options,entries:R}},fileCache:t,subDirectory:$})}}if(f.options.declaration&&j.length>0){const S=j.some(G=>G.declarationCjs),R=j.some(G=>G.declarationEsm),N=j.some(G=>G.declaration&&!G.declarationCjs&&!G.declarationEsm),J=Io(f,S||N,R,j,b,g);a.add({context:J,fileCache:t,subDirectory:$})}}return{builders:s,typeBuilders:a}},RA=async(e,t)=>{const n=e.logger;await e.hooks.callHook("build:before",e);const{builders:o,typeBuilders:r}=await OA(e,t);if(o.size>0&&await Promise.all(Array.from(o,async({context:l,fileCache:p,subDirectory:c})=>m9(l,p,c,Uf(l.options.bundler)))),r.size>0){const l=e.options.dtsConcurrency??vA;await fA(Array.from(r,({context:p,fileCache:c,subDirectory:u})=>()=>G3(p,c,u)),l)}n.success(zs(e.options.name?`Build succeeded for ${e.options.name}`:"Build succeeded"));const i=new Set;e.buildEntries=e.buildEntries.filter(l=>i.has(l.path)?!1:(i.add(l.path),!0));const s=V(e.options.rootDir,e.options.outDir),a=[];for await(const l of wm(s,{includeDirs:!1,includeFiles:!0})){let p=e.buildEntries.find(d=>V(s,d.path)===l.path);p||(p={chunk:!0,path:l.path},e.buildEntries.push(p)),p.size??={};const c=X(s,l.path),u=p.size;a.push((async()=>{if(!u.bytes){const m=await so(c);u.bytes=m.size}const[d,f]=await Promise.all([u.brotli??mA(c),u.gzip??gA(c)]);u.brotli=d,u.gzip=f})())}return await Promise.all(a),e.options.exe&&await dA(e),await e.hooks.callHook("build:done",e),kA(n,e)},CA=e=>Object.fromEntries(Object.entries(e).map(([t,n])=>{if(!n)return[t,{}];const o=Object.fromEntries(Object.entries(n).map(([r,i])=>Array.isArray(i)?[r,[...new Set(i)]]:[r,[]]));return[t,o]})),TA=async(e,t,n,o,r,i)=>{const s=e;if(i!=="*"&&qe.valid(qe.coerce(i))===null)throw new Error("Invalid typeScriptVersion option. It must be a valid semver range.");s.info({message:"Declaration node10 compatibility mode is enabled.",prefix:"plugin:packem:node10-compatibility"});const a={};for(const c of t){if(c.exportKey===void 0||c.name===void 0)continue;const{name:u}=c;for(const d of c.exportKey)a[d]=d.includes("/*")?[`./${V(n,Z(u),"*.d.ts")}`]:[...a[d]??[],`./${V(n,`${u}.d.ts`)}`]}const l=V(o,"package.json"),p=await hr(l);r==="file"&&Object.keys(a).length>0?(await _p(l,{...p,typesVersions:CA({...p.typesVersions,[i]:a})},{detectIndent:!0}),s.info({message:'Your package.json "typesVersions" field has been updated.',prefix:"plugin:packem:node10-compatibility"})):Object.keys(a).length>0&&s.info({message:`Please add the following field into your package.json to enable node 10 compatibility:
|
|
215
|
+
|
|
216
|
+
${JSON.stringify({typesVersions:{"*":a}},void 0,4)}
|
|
217
|
+
`,prefix:"plugin:packem:node10-compatibility"})},zt=e=>e??{},_A=/\.(md|txt|htm|html|data)$/,NA=/^@swc\/helpers(?:\/.*)?$/,PA=e=>{switch(e){case"preserve":case"react-native":return"preserve";case"react":return"transform";case"react-jsx":case"react-jsxdev":return"automatic";default:return}},MA=(e,t,n,o,r,i,s,a)=>{const l=PA(s?.config.compilerOptions?.jsx),p=a.split("."),c=B9()(Nw,r,{alias:{},browserTargets:lh(),cjsInterop:!1,clean:!0,debug:o,declaration:void 0,emitCJS:void 0,emitESM:void 0,entries:[],externals:[],failOnWarn:!0,fileCache:!0,jiti:{alias:{},debug:o,interopDefault:!0},minify:n===Hn,name:(i.name??"").split("/").pop()??"default",outDir:s?.config.compilerOptions?.outDir??"dist",rollup:{alias:{},cjsInterop:{addDefaultProperty:!1},commonjs:{extensions:[".mjs",".js",".json",".node",".cjs"],ignoreTryCatch:!0,preserveSymlinks:!0,transformMixedEsModules:!0},css:{autoModules:!0,extensions:[".css",".pcss",".postcss",".sss"],namedExports:!0},dataUri:{srcset:!0},debarrel:{},detectDuplicated:{},dts:{compilerOptions:{baseUrl:s?.config.compilerOptions?.baseUrl??".",checkJs:!1,composite:!1,declaration:!0,declarationMap:!1,emitDeclarationOnly:!0,incremental:!1,moduleResolution:100,noEmit:!1,noEmitOnError:!0,preserveSymlinks:!1,skipLibCheck:!0,target:99}},dynamicVars:{errorWhenNoFilesFound:!0,exclude:Ot,include:jt},esbuild:{charset:"utf8",jsx:l,jsxDev:s?.config.compilerOptions?.jsx==="react-jsxdev",jsxFactory:s?.config.compilerOptions?.jsxFactory,jsxFragment:zt(s?.config.compilerOptions).jsxFragmentFactory,jsxImportSource:zt(s?.config.compilerOptions).jsxImportSource,jsxSideEffects:!0,keepNames:!1,sourcesContent:!1,supported:{"import-attributes":!0},target:s?.config.compilerOptions?.target,treeShaking:!0,tsconfigRaw:s?.config},json:{preferConst:!1},license:{dependenciesTemplate:(f,m,h)=>`
|
|
218
|
+
# Licenses of bundled dependencies
|
|
219
|
+
The published ${h} artifact additionally contains code with the following licenses:
|
|
220
|
+
${f.length>0?`${f.join(", ")}
|
|
221
|
+
|
|
222
|
+
`:`
|
|
223
|
+
`}# Bundled dependencies:
|
|
224
|
+
${m}`,dtsTemplate:(f,m,h)=>`
|
|
225
|
+
# Licenses of bundled types
|
|
226
|
+
The published ${h} artifact additionally contains code with the following licenses:
|
|
227
|
+
${f.length>0?`${f.join(", ")}
|
|
228
|
+
|
|
229
|
+
`:`
|
|
230
|
+
`}# Bundled types:
|
|
231
|
+
${m}`},nativeModules:{},node10Compatibility:!1,output:{importAttributesKey:Number(p[0])>=22?"with":"assert"},oxc:{jsx:l==="preserve"?"preserve":{development:n!=="production",pragma:s?.config.compilerOptions?.jsxFactory,pragmaFrag:zt(s?.config.compilerOptions).jsxFragmentFactory,pure:!0,runtime:l==="transform"||l==="automatic"?"automatic":"classic",useBuiltIns:!0,useSpread:!0}},patchTypes:{},polyfillNode:{},preserveDirectives:{include:jt},preserveDynamicImports:!0,pure:{},raw:{exclude:Ot,include:[_A]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{aliasFields:[],builtinModules:!1,conditionNames:[n??"production","module-sync","import","require","default"],extensions:vr,mainFields:["module","main"]},resolveExternals:{builtins:!0,builtinsPrefix:"add",deps:!0,devDeps:!1,exclude:[],optDeps:!0,peerDeps:!0},shebang:{replace:!1,shebang:"#!/usr/bin/env node"},shim:{exclude:Ot,include:jt},sourcemap:{},sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:!s?.config.compilerOptions?.esModuleInterop,include:jt,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:n===Hn,...s?.config.compilerOptions?.jsx&&["react","react-jsx","react-jsxdev"].includes(s.config.compilerOptions.jsx)?{jsxFragmentPragma:zt(s.config.compilerOptions).jsxFragmentFactory,jsxImportSource:zt(s.config.compilerOptions).jsxImportSource,jsxPragma:s.config.compilerOptions.jsxFactory,jsxRuntime:l,transforms:["typescript","jsx"]}:{transforms:["typescript"]}},swc:{include:jt,inlineSourcesContent:!1,inputSourceMap:!1,isModule:!0,jsc:{experimental:{keepImportAttributes:!0},externalHelpers:!0,keepClassNames:!0,loose:!0,parser:{decorators:s?.config.compilerOptions?.experimentalDecorators,syntax:s?"typescript":"ecmascript",[s?"tsx":"jsx"]:!0},target:s?.config.compilerOptions?.target?.toLowerCase(),transform:{decoratorMetadata:s?.config.compilerOptions?.emitDecoratorMetadata,decoratorVersion:"2022-03",legacyDecorator:s?.config.compilerOptions?.experimentalDecorators,react:{development:n!==Hn,pragma:s?.config.compilerOptions?.jsxFactory,pragmaFrag:zt(s?.config.compilerOptions).jsxFragmentFactory,runtime:l,throwIfNamespace:!0},treatConstEnumAsEnum:s?.config.compilerOptions?.preserveConstEnums,useDefineForClassFields:s?.config.compilerOptions?.useDefineForClassFields}},module:{ignoreDynamic:!0,importInterop:"none",preserveImportMeta:!0,strict:!1,strictMode:!1,type:"es6"}},treeshake:{moduleSideEffects:L9(t,i),preset:"recommended",propertyReadSideEffects:!0},tsconfigPaths:{resolveAbsolutePath:!1},url:{emitFiles:!0,fileName:"[hash][extname]",include:["**/*.svg","**/*.png","**/*.jp(e)?g","**/*.gif","**/*.webp"],limit:14*1024},visualizer:{},watch:{chokidar:{ignoreInitial:!0,ignorePermissionErrors:!0},clearScreen:!0,exclude:Ot}},rootDir:t,sourceDir:"src",sourcemap:!1,transformerName:void 0,typedoc:{excludePrivate:!0,format:"inline",githubPages:!1,groupOrder:["Classes","Constructors","Accessors","Methods","Functions","Namespaces","Variables","Enumerations","Interfaces","Type Aliases","*"],kindSortOrder:["Project","Module","Class","Interface","Function","Namespace","Variable","Enum","EnumMember","TypeAlias","Reference","Constructor","Property","Accessor","Method","Parameter","TypeParameter","TypeLiteral","CallSignature","ConstructorSignature","IndexSignature","GetSignature","SetSignature"],marker:"TYPEDOC",name:i.name??"unknown",pretty:!0,readme:"none",showConfig:o,tsconfig:s?.path},validation:{dependencies:{hoisted:{exclude:[]},unused:{exclude:[]}},packageJson:{bin:!0,dependencies:!0,exports:!0,files:!0,main:!0,module:!0,name:!0,types:!0,typesVersions:!0}}});c.runtime===void 0&&(e.warn("No runtime specified, defaulting to 'node'. This will change in packem v2 to 'browser', please add 'runtime: node' to your packem config or command call"),c.runtime="node");const u=new Map([...Object.entries(i.dependencies??{}),...Object.entries(i.devDependencies??{})]),d=c.bundler==="rolldown";if(d&&r.transformer!==void 0)throw new Error('The `transformer` option is not supported when `bundler: "rolldown"`. Rolldown uses its own oxc-based transform — remove `transformer` from your packem config.');if(!d){if(c.transformer?.NAME===void 0)throw new Error("Unknown transformer, check your transformer options or install one of the supported transformers: esbuild, swc, sucrase");c.transformerName=c.transformer.NAME,c.transformerName==="swc"&&(c.externals=[...c.externals,NA])}if(e.info({message:`Using ${ne("node ")}${a}`,prefix:"system"}),e.info({message:d?`Using ${ne("rolldown")} with ${ne(c.runtime)} build runtime`:`Using ${ne("rollup")} with ${ne(c.runtime)} build runtime`,prefix:"bundler"}),!d&&c.transformerName){let f=c.transformerName;c.transformerName==="oxc"?f="oxc-transform":c.transformerName==="swc"&&(f="@swc/core");const m=u.get(f)??"0.0.0";e.info({message:`Using ${ne(c.transformerName)} ${m}`,prefix:"transformer"})}if(c.rollup.resolve&&(c.rollup.resolve.preferBuiltins=c.runtime==="node",c.rollup.resolve.preferBuiltins&&(c.rollup.polyfillNode=!1,e.debug("Disabling polyfillNode because preferBuiltins is set to true"))),c.resolvedBrowserTargets??=c.browserTargets??[],c.runtime==="node"&&(c.browserTargets=[]),c.runtime==="browser"&&(c.rollup.resolve&&c.rollup.resolve.browser===void 0&&(c.rollup.resolve.browser=!0),c.browserTargets&&c.browserTargets.length>0&&e.debug(`Using browser targets: ${c.browserTargets.join(", ")}`)),gp(c.alias),c.rollup.alias!==!1&&c.rollup.alias?.entries&&gp(c.rollup.alias.entries),c.outputExtensionMap){let f;for(const[m,h]of Object.entries(c.outputExtensionMap)){if(!["cjs","esm"].includes(m))throw new Error(`Invalid output extension map: ${m} must be "cjs" or "esm"`);if(typeof h!="string")throw new TypeError(`Invalid output extension map: ${m} must be a string`);if(h.startsWith("."))throw new Error(`Invalid output extension map: ${m} must not start with a dot. Example: "cjs": "c.js", "esm": "m.js"`);if(f===void 0)f=h;else if(f===h)throw new Error(`Invalid output extension map: ${m} must be different from the other key`)}}return s?.config.compilerOptions?.declarationMap&&(c.sourcemap=!0,e.info("Enabling sourcemap because declarationMap is enabled in tsconfig.json")),c},IA=async(e,t,n,o,r,i,s,a,l)=>{const p=i.hooks,c=MA(e,t,o,r,i,s,a,l);km(V(c.rootDir,c.outDir));const u={buildEntries:[],dependencyGraphMap:new Map,environment:o,hoistedDependencies:new Set,hooks:ch(),implicitDependencies:new Set,jiti:ph(c.rootDir,c.jiti),logger:e,mode:n,options:c,pkg:s,tsconfig:a,usedDependencies:new Set,warnings:new Set};p&&u.hooks.addHooks(p),await u.hooks.callHook("build:prepare",u),u.options.emitESM===void 0&&e.info("Emitting of ESM bundles, is disabled."),u.options.emitCJS===void 0&&e.info("Emitting of CJS bundles, is disabled."),u.options.minify&&e.info("Minification is enabled, the output will be minified"),V9(u);const d=bd(s,["typescript"]);if(u.options.declaration&&u.tsconfig===void 0&&d)throw new Error("Cannot build declaration files without a tsconfig.json");return d?u.options.declaration===!1&&e.info({message:"Generation of declaration files are disabled.",prefix:"dts"}):(u.options.declaration=!1,e.info({message:"Typescript is not installed. Generation of declaration files are disabled.",prefix:"dts"})),u.options.declaration&&e.info(`Using typescript version: ${ne(s.devDependencies?.typescript??s.dependencies?.typescript??"unknown")}`),u.options.declaration&&(s.dependencies?.typescript||s.devDependencies?.typescript)&&!u.tsconfig?.config.compilerOptions?.isolatedModules&&e.warn(`'compilerOptions.isolatedModules' is not enabled in tsconfig.
|
|
232
|
+
Because none of the third-party transpiler, packem uses under the hood is type-aware, some techniques or features often used in TypeScript are not properly checked and can cause mis-compilation or even runtime errors.
|
|
233
|
+
To mitigate this, you should set the isolatedModules option to true in tsconfig and let your IDE warn you when such incompatible constructs are used.`),Kf(u),u},WA=e=>{switch(e){case"build":return"Building";case"jit":return"Stubbing";case"watch":return"Watching";default:throw new Error(`Unknown mode: ${String(e)}`)}},QO=async(e,t,n,o,r,i,s)=>{const a=ut.version.slice(1);o.wrapAll(),e=X(ut.cwd(),e),o.debug("Root directory:",e);const{packageJson:l,packageJsonPath:p}=Jr(e);o.debug("Using package.json found at",p);const c=await g9(e,l,o,s),u=E0("@visulima/packem",{cwd:e});let d=!1,f,m,h;const v=Ke(JSON.stringify({packemVersion:Yu,version:l.version,...l.dependencies,...l.devDependencies,...l.peerDependencies,...l.peerDependenciesMeta,browser:l.browser,eNode:l.engines?.node,exports:l.exports,main:l.main,module:l.module,nodeVersion:a,type:l.type,types:l.types}))+Ke(JSON.stringify(i));u&&xm(v,u,o);const y=new eh(e,u,v,o);try{const g=await IA(o,e,t,n,r,i,l,c,a);y.isEnabled=g.options.fileCache??!0;const $=Uf(g.options.bundler);await Gc($,e,o),$==="rolldown"&&g.options.declaration&&await Gc("rollup",e,o),g.options.transformerName&&await h9(g.options.transformerName,e,o),o.info(ne(`${WA(t)} ${g.options.name}`)),o.debug({context:g.options.entries,message:`${je("Root dir:")} ${g.options.rootDir}
|
|
234
|
+
${je("Entries:")}`});const b=async j=>{for(const[S,R]of Object.entries(g.options.builder??{})){o.raw(`
|
|
235
|
+
`),await g.hooks.callHook("builder:before",S,g);const N=Date.now(),J=()=>Cl(Math.floor(Date.now()-N));await R(g,u,y,d),await g.hooks.callHook("builder:done",S,g),o.raw(`
|
|
236
|
+
⚡️ ${S} run in ${J()}`),j&&o.raw(`
|
|
237
|
+
|
|
238
|
+
`)}},w=async()=>{if(f?.pid!==void 0)await J9({pid:f.pid,signal:i.killSignal??"SIGTERM"});else if(m!==void 0)try{typeof m=="function"&&await m()}catch(j){throw new Error(`onSuccess function cleanup failed: ${j instanceof Error?j.message:String(j)}`,{cause:j})}f=void 0,m=void 0},E=async()=>{if(typeof g.options.onSuccess=="function")try{m=await g.options.onSuccess()}catch(j){throw new Error(`onSuccess function failed: ${j instanceof Error?j.message:String(j)}`,{cause:j})}else if(typeof g.options.onSuccess=="string"){const j=g.options.onSuccessTimeout??3e4,S=f=uh(g.options.onSuccess,[],{nodeOptions:{shell:!0,stdio:"inherit",timeout:j}});await S;const{exitCode:R}=S;if(typeof R=="number"&&R!==0)throw new Error(`onSuccess script failed with exit code ${String(R)}. Check the output above for details.`)}},x=Date.now(),k=()=>Cl(Math.floor(Date.now()-x));if(t==="watch"){if(g.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem config.");g.options.bundler==="rolldown"&&o.warn({message:"Watch mode falls back to rollup; rolldown watch isn't supported yet.",prefix:"bundler"}),await I9(g,y,b,E,w),Yc(g,!1);return}if(await W9(g),t==="jit")await _9(g),await g.hooks.callHook("build:done",g);else{if(d=await RA(g,y),g.options.emitCJS&&g.options.declaration==="compatible"){d&&o.raw(`
|
|
239
|
+
`);let j="console",S="*";g.options.node10Compatibility&&(j=g.options.node10Compatibility.writeToPackageJson?"file":"console",S=g.options.node10Compatibility.typeScriptVersion??"*"),await TA(o,g.options.entries,g.options.outDir,g.options.rootDir,j,S)}await g.hooks.callHook("validate:before",g),typeof g.options.validation=="object"&&(g.options.validation.packageJson&&R3(g),g.options.validation.attw&&await u3(g,d),g.options.validation.bundleLimit&&q3(g,d)),await g.hooks.callHook("validate:done",g),Yc(g,d)}o.raw(`
|
|
240
|
+
⚡️ Build run in ${k()}
|
|
241
|
+
`),h=()=>{w().catch(j=>{o.raw(`
|
|
242
|
+
onSuccess cleanup failed: ${j instanceof Error?j.message:String(j)}
|
|
243
|
+
`)})},ut.once("SIGINT",h),ut.once("SIGTERM",h),await b(),await E()}catch(g){throw o.raw(`
|
|
244
|
+
`),Km(g),Vp(g),g}finally{h&&(ut.off("SIGINT",h),ut.off("SIGTERM",h)),o.restoreAll(),await U9(u,o,d)}};export{Pe as A,Nw as B,ng as J,e$ as K,sa as M,DO as S,QO as T,o$ as X,AO as Y,ig as Z,Fb as a,Bn as b,Xr as c,RO as d,vl as e,FO as f,lw as g,rl as h,B9 as i,_O as j,Mb as k,TO as l,tg as n,Kb as q,LO as r,Yu as v,Ev as y};
|