@visulima/packem 2.0.0-alpha.88 → 2.0.0-alpha.89
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
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## @visulima/packem [2.0.0-alpha.89](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.88...@visulima/packem@2.0.0-alpha.89) (2026-06-15)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **packem:** emit a single __cjs_getBuiltinModule helper in bundled output ([de09df0](https://github.com/visulima/packem/commit/de09df0bfc078885f61538d9f27445343e48e93a))
|
|
6
|
+
|
|
1
7
|
## @visulima/packem [2.0.0-alpha.88](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.87...@visulima/packem@2.0.0-alpha.88) (2026-06-12)
|
|
2
8
|
|
|
3
9
|
### Features
|
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createCerebro as Q}from"@visulima/cerebro";import Z from"@visulima/cerebro/logger/pail";import{e as q,S as G,m as ee,f as te,g as se,i as ae,B as ie,T as ne,j as T,v as oe,l as re,d as ce}from"../packem_shared/index-
|
|
2
|
+
import{createCerebro as Q}from"@visulima/cerebro";import Z from"@visulima/cerebro/logger/pail";import{e as q,S as G,m as ee,f as te,g as se,i as ae,B as ie,T as ne,j as T,v as oe,l as re,d as ce}from"../packem_shared/index-BnalE1Ho.js";import k,{cwd as O,exit as le}from"node:process";import{installPackage as h}from"@antfu/install-pkg";import{spinner as D,confirm as f,cancel as B,select as g,multiselect as K,intro as U,log as E,outro as W,isCancel as F}from"@clack/prompts";import{a as de,b as ue,q as pe,s as N,T as me,S as fe}from"../packem_shared/create-or-update-key-storage-DHOKZmnD.js";import{P as L,w as b}from"../packem_shared/utils-Bsoe7qJG.js";import ge from"magic-string";import{exec as ye}from"tinyexec";import{PRODUCTION_ENV as z,DEVELOPMENT_ENV as we}from"@visulima/packem-share/constants";import{createJiti as be}from"jiti";import{writeFile as J,readFile as he}from"node:fs/promises";import{existsSync as V}from"node:fs";import{parseEnv as R}from"node:util";import{createInterface as ve}from"node:readline/promises";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
3
3
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
4
4
|
const _={less:["less"],lightningcss:["lightningcss"],"node-sass":["node-sass"],postcss:["postcss","postcss-load-config","postcss-modules-extract-imports","postcss-modules-local-by-default","postcss-modules-scope","postcss-modules-values","postcss-value-parser","@csstools/css-parser-algorithms","@csstools/css-tokenizer","@csstools/postcss-slow-plugins","icss-utils","@visulima/css-style-inject"],sass:["sass"],"sass-embedded":["sass-embedded"],stylus:["stylus"],tailwindcss:["@tailwindcss/node","@tailwindcss/oxide","tailwindcss"]},ke=/defineConfig\s*\(\s*\{/,$e=/preset:\s*['"][^'"]+['"]/,Se=["typedoc","typedoc-plugin-markdown","typedoc-plugin-rename-defaults"],Ce=["@babel/core","@babel/preset-react"],je=["react","react-dom"],xe=["@babel/core","babel-preset-solid"],Pe=["solid-js"],Ee=["@babel/core","@babel/preset-react","babel-plugin-transform-hook-names"],De=["preact"],Le=["unplugin-vue"],Ie=["vue"],Me=["rollup-plugin-svelte"],Ne=["svelte"],$=(t,e,a)=>t.includes(`preset: '${e}'`)||t.includes(`preset: "${e}"`)||t.includes(`preset: '${e}',`)||t.includes(`preset: "${e}",`)||t.includes(a)||t.includes(`@visulima/packem/config/preset/${e}`),S=(t,e)=>{const{logger:a,magic:s,packemConfig:i}=t,n=ke.exec(i);if(n?.index!==void 0){const r=n.index+n[0].length;if(i.includes("preset:")){const o=$e.exec(i);if(o)s.replace(o[0],`preset: '${e}'`);else throw a.warn(`A preset already exists in the config. Please manually set it to '${e}'.`),new Error("Preset exists but is not a string")}else s.appendLeft(r,`
|
|
5
5
|
preset: '${e}',`)}else if(i.includes("transformer:"))s.replace("transformer:",`preset: '${e}',
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as He}from"node:module";import{n as Ht,Z as xe,Y as Jt,J as Je,h as Se,y as yt,X as Gt,q as Ut,M as zt,a as Kt,A as be,K as Yt,k as Qt,b as Zt,c as Be,d as Xt,T as er}from"./packem_shared/index-C47QUEeX.js";import{g as wt}from"./packem_shared/create-or-update-key-storage-DHOKZmnD.js";const tr=He(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:Q,Ge=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,r]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ie.getBuiltinModule(t)}return tr(t)},Q=ie,{execFileSync:rr}=Ge("node:child_process"),ue=Ge("node:fs"),sr=Ge("node:tty"),Ue=[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],ze=[12288,12288,65281,65376,65504,65510],Ke=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Ye=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ae=[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],ge=(t,e)=>{let r=0,s=Math.floor(t.length/2)-1;for(;r<=s;){const i=Math.floor((r+s)/2),o=i*2;if(e<t[o])s=i-1;else if(e>t[o+1])r=i+1;else return!0}return!1},ir=Ue[0],nr=Ue.at(-1),or=ze[0],ar=ze.at(-1),lr=Ke[0],cr=Ke.at(-1),ur=Ye[0],fr=Ye.at(-1),hr=Ae[0],gr=Ae.at(-1),nt=19968,[dr,pr]=mr(Ae);function mr(t){let e=t[0],r=t[1];for(let s=0;s<t.length;s+=2){const i=t[s],o=t[s+1];if(nt>=i&&nt<=o)return[i,o];o-i>r-e&&(e=i,r=o)}return[e,r]}const br=t=>t<ir||t>nr?!1:ge(Ue,t),yr=t=>t<or||t>ar?!1:ge(ze,t),wr=t=>t<lr||t>cr?!1:ge(Ke,t),$r=t=>t<ur||t>fr?!1:ge(Ye,t),vr=t=>t>=dr&&t<=pr?!0:t<hr||t>gr?!1:ge(Ae,t);function xr(t){return br(t)?"ambiguous":yr(t)?"fullwidth":wr(t)?"halfwidth":$r(t)?"narrow":vr(t)?"wide":"neutral"}function Sr(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function $t(t){return Sr(t),xr(t)}const vt=String.raw,ot=vt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,kr=()=>new RegExp(vt`\p{RI}{2}|(?)${ot}(?:\u200D${ot})*`,"gu"),ae=new Set(["\x1B",""]),Le="\x07",xt="[",Qe="m",ke="]8;;",Er=39,Tr=/[\u200B\uFEFF\u2060-\u2064]/g,Ar=new RegExp(`(?:\\${xt}(?<code>\\d+)m|\\${ke}(?<uri>.*)${Le})`),Lr=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]])),le=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,ye=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,je=kr(),at=new Map,we=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,$e=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",Mr=(t,e)=>{const r=Math.floor(t/65536),s=t%65536;let i=at.get(r);if(i||(i=new Map,at.set(r,i)),i.has(s))return i.get(s);let o;if($e(t)==="latin")o=e.width.regular;else if($e(t)==="control")o=e.width.control;else if($e(t)==="wide")o=e.width.wide;else switch($t(t)){case"ambiguous":{o=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{o=e.width.fullWidth;break}case"wide":{o=e.width.wide;break}default:o=e.width.regular}return i.set(s,o),o},Or=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,Ce=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?Ce(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},s=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:i}=t,o=i>1e4;let a=0,n=0,c=i,u=!1;const l=t.includes("\x1B")||t.includes("");for(;a<i;){if(l&&(t[a]==="\x1B"||t[a]==="")){if(t.startsWith("\x1B]8;;",a)){const v="\x1B]8;;\x07",B=v.length,V=t.indexOf("\x07",a+5);if(V!==-1){const H=t.indexOf(v,V+1);if(H!==-1){const d=H+B,g=t.slice(V+1,H).replace(le,""),$=Ce(g,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,s-n),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),I=$.width;if($.truncated)u=!0,c=Math.min(c,a);else if(n+I>s&&(c=Math.min(c,a),u=!0,n+I>r.truncation.limit))break;if(n+=I,a=d,u&&n>=r.truncation.limit)break;continue}}}if(le.lastIndex=a,le.test(t)){const v=le.lastIndex-a,B=r.truncation.countAnsiEscapeCodes?v:r.width.ansi;if(n+B>s&&(c=Math.min(c,a),n+B>r.truncation.limit)){u=!0;break}n+=B,a=le.lastIndex;continue}}const w=t.codePointAt(a);if(w===8203||w===65279||w>=8288&&w<=8292){a+=1;continue}if(w===9){if(n+r.width.tab>s&&(c=Math.min(c,a),n+r.width.tab>r.truncation.limit)){u=!0;break}n+=r.width.tab,a+=1;continue}if(we.lastIndex=a,we.test(t)){const v=(we.lastIndex-a)*r.width.regular;if(n+v>s){const B=Math.floor((s-n)/r.width.regular);if(c=Math.min(c,a+B),n+v>r.truncation.limit){u=!0;break}}n+=v,a=we.lastIndex;continue}if((w<=31||w>=127&&w<=159)&&(ye.lastIndex=a,ye.test(t))){const v=(ye.lastIndex-a)*r.width.control;if(n+v>s&&(c=Math.min(c,a+Math.floor((s-n)/r.width.control)),n+v>r.truncation.limit)){u=!0;break}n+=v,a=ye.lastIndex;continue}if(je.lastIndex=a,je.test(t)){if(n+r.width.emoji>s&&(c=Math.min(c,a),n+r.width.emoji>r.truncation.limit)){u=!0;break}n+=r.width.emoji,a=je.lastIndex;continue}const N=t.codePointAt(a)??0;if(Or(N)){a+=N>65535?2:1;continue}let k;if(o)k=Mr(N,r);else switch($e(N)){case"control":{k=r.width.control;break}case"latin":{k=r.width.regular;break}case"wide":{k=r.width.wide;break}case"zero":{k=0;break}default:switch($t(N)){case"ambiguous":{k=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{k=r.width.fullWidth;break}case"wide":{k=r.width.wide;break}default:k=r.width.regular}}if(n+k>s&&(c=Math.min(c,a),n+k>r.truncation.limit)){u=!0;break}n+=k,a+=N>65535?2:1}let h=n,p=!1;return u&&r.truncation.limit>=r.truncation.ellipsisWidth&&(h=r.truncation.limit,p=!0),{ellipsed:p,index:u?c:i,truncated:u,width:h}},Z=(t,e={})=>Ce(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,Br=/\x1B\[(\d+)m/;class St{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const r=Br.exec(e);if(!r)return;const s=Number.parseInt(r[1],10);switch(s){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(s>=30&&s<=37||s>=90&&s<=97)this.activeForeground=e;else if(s>=40&&s<=47||s>=100&&s<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(s))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(s)){const i={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[s];i&&(this.activeFormatting=this.activeFormatting.filter(o=>!o.includes(i)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const r={"\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(s=>{const i=r[s];i&&e.push(i)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}const kt=(t,e)=>{if(!ae.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const r=!0,s=t.slice(e+1,e+1+ke.length).join("")===ke;return{isInsideEscape:r,isInsideLinkEscape:s}},jr=(t,e={})=>{const r=new St;let s="",i=!1,o="",a="",n=!1;const c=[...t];for(let u=0;u<c.length;u++){const l=c[u];if(l&&ae.has(l)){if(s){const k=e.getWidth?.(s)??0,v={isEscapeSequence:!1,isGrapheme:!0,text:s,width:k};if(n&&(v.isHyperlink=!0,v.hyperlinkUrl=a),e.onSegment?.(v,r)===!1)return;s=""}i=!0,o=l;const w=kt(c,u),{isInsideLinkEscape:N}=w;if(N){let k=u+1;for(a="";k<c.length;){const B=c[k];if(B===Le)break;a+=B,k+=1}a=a.slice(4);const v={hyperlinkUrl:a,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(v,r)===!1)return;u=k,n=!0,i=!1,o="";continue}if(u+1<c.length&&c[u+1]==="\\"&&n){const k={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(k,r)===!1)return;n=!1,a="",u+=1,i=!1,o="";continue}}if(i){if(o!==l&&(o+=l),l===Qe){i=!1,r.processEscape(o);const w={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};if(e.onSegment?.(w,r)===!1)return;o=""}continue}s+=l;const h=e.getWidth?.(s)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:s,width:h};if(n&&(p.isHyperlink=!0,p.hyperlinkUrl=a),e.onSegment?.(p,r)===!1)return;s=""}if(s){const u=e.getWidth?.(s)??0,l={isEscapeSequence:!1,isGrapheme:!0,text:s,width:u};n&&(l.isHyperlink=!0,l.hyperlinkUrl=a),e.onSegment?.(l,r)}if(o){const u={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};e.onSegment?.(u,r)}},lt=t=>`${ae.values().next().value}${xt}${String(t)}${Qe}`,ct=t=>`${ae.values().next().value}${ke}${t}${Le}`,Nr=t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",r,s;const i=t.join(`
|
|
1
|
+
import{createRequire as He}from"node:module";import{n as Ht,Z as xe,Y as Jt,J as Je,h as Se,y as yt,X as Gt,q as Ut,M as zt,a as Kt,A as be,K as Yt,k as Qt,b as Zt,c as Be,d as Xt,T as er}from"./packem_shared/index-BnalE1Ho.js";import{g as wt}from"./packem_shared/create-or-update-key-storage-DHOKZmnD.js";const tr=He(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:Q,Ge=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,r]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ie.getBuiltinModule(t)}return tr(t)},Q=ie,{execFileSync:rr}=Ge("node:child_process"),ue=Ge("node:fs"),sr=Ge("node:tty"),Ue=[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],ze=[12288,12288,65281,65376,65504,65510],Ke=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Ye=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ae=[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],ge=(t,e)=>{let r=0,s=Math.floor(t.length/2)-1;for(;r<=s;){const i=Math.floor((r+s)/2),o=i*2;if(e<t[o])s=i-1;else if(e>t[o+1])r=i+1;else return!0}return!1},ir=Ue[0],nr=Ue.at(-1),or=ze[0],ar=ze.at(-1),lr=Ke[0],cr=Ke.at(-1),ur=Ye[0],fr=Ye.at(-1),hr=Ae[0],gr=Ae.at(-1),nt=19968,[dr,pr]=mr(Ae);function mr(t){let e=t[0],r=t[1];for(let s=0;s<t.length;s+=2){const i=t[s],o=t[s+1];if(nt>=i&&nt<=o)return[i,o];o-i>r-e&&(e=i,r=o)}return[e,r]}const br=t=>t<ir||t>nr?!1:ge(Ue,t),yr=t=>t<or||t>ar?!1:ge(ze,t),wr=t=>t<lr||t>cr?!1:ge(Ke,t),$r=t=>t<ur||t>fr?!1:ge(Ye,t),vr=t=>t>=dr&&t<=pr?!0:t<hr||t>gr?!1:ge(Ae,t);function xr(t){return br(t)?"ambiguous":yr(t)?"fullwidth":wr(t)?"halfwidth":$r(t)?"narrow":vr(t)?"wide":"neutral"}function Sr(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function $t(t){return Sr(t),xr(t)}const vt=String.raw,ot=vt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,kr=()=>new RegExp(vt`\p{RI}{2}|(?)${ot}(?:\u200D${ot})*`,"gu"),ae=new Set(["\x1B",""]),Le="\x07",xt="[",Qe="m",ke="]8;;",Er=39,Tr=/[\u200B\uFEFF\u2060-\u2064]/g,Ar=new RegExp(`(?:\\${xt}(?<code>\\d+)m|\\${ke}(?<uri>.*)${Le})`),Lr=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]])),le=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,ye=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,je=kr(),at=new Map,we=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,$e=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",Mr=(t,e)=>{const r=Math.floor(t/65536),s=t%65536;let i=at.get(r);if(i||(i=new Map,at.set(r,i)),i.has(s))return i.get(s);let o;if($e(t)==="latin")o=e.width.regular;else if($e(t)==="control")o=e.width.control;else if($e(t)==="wide")o=e.width.wide;else switch($t(t)){case"ambiguous":{o=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{o=e.width.fullWidth;break}case"wide":{o=e.width.wide;break}default:o=e.width.regular}return i.set(s,o),o},Or=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,Ce=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?Ce(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},s=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:i}=t,o=i>1e4;let a=0,n=0,c=i,u=!1;const l=t.includes("\x1B")||t.includes("");for(;a<i;){if(l&&(t[a]==="\x1B"||t[a]==="")){if(t.startsWith("\x1B]8;;",a)){const v="\x1B]8;;\x07",B=v.length,V=t.indexOf("\x07",a+5);if(V!==-1){const H=t.indexOf(v,V+1);if(H!==-1){const d=H+B,g=t.slice(V+1,H).replace(le,""),$=Ce(g,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,s-n),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),I=$.width;if($.truncated)u=!0,c=Math.min(c,a);else if(n+I>s&&(c=Math.min(c,a),u=!0,n+I>r.truncation.limit))break;if(n+=I,a=d,u&&n>=r.truncation.limit)break;continue}}}if(le.lastIndex=a,le.test(t)){const v=le.lastIndex-a,B=r.truncation.countAnsiEscapeCodes?v:r.width.ansi;if(n+B>s&&(c=Math.min(c,a),n+B>r.truncation.limit)){u=!0;break}n+=B,a=le.lastIndex;continue}}const w=t.codePointAt(a);if(w===8203||w===65279||w>=8288&&w<=8292){a+=1;continue}if(w===9){if(n+r.width.tab>s&&(c=Math.min(c,a),n+r.width.tab>r.truncation.limit)){u=!0;break}n+=r.width.tab,a+=1;continue}if(we.lastIndex=a,we.test(t)){const v=(we.lastIndex-a)*r.width.regular;if(n+v>s){const B=Math.floor((s-n)/r.width.regular);if(c=Math.min(c,a+B),n+v>r.truncation.limit){u=!0;break}}n+=v,a=we.lastIndex;continue}if((w<=31||w>=127&&w<=159)&&(ye.lastIndex=a,ye.test(t))){const v=(ye.lastIndex-a)*r.width.control;if(n+v>s&&(c=Math.min(c,a+Math.floor((s-n)/r.width.control)),n+v>r.truncation.limit)){u=!0;break}n+=v,a=ye.lastIndex;continue}if(je.lastIndex=a,je.test(t)){if(n+r.width.emoji>s&&(c=Math.min(c,a),n+r.width.emoji>r.truncation.limit)){u=!0;break}n+=r.width.emoji,a=je.lastIndex;continue}const N=t.codePointAt(a)??0;if(Or(N)){a+=N>65535?2:1;continue}let k;if(o)k=Mr(N,r);else switch($e(N)){case"control":{k=r.width.control;break}case"latin":{k=r.width.regular;break}case"wide":{k=r.width.wide;break}case"zero":{k=0;break}default:switch($t(N)){case"ambiguous":{k=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{k=r.width.fullWidth;break}case"wide":{k=r.width.wide;break}default:k=r.width.regular}}if(n+k>s&&(c=Math.min(c,a),n+k>r.truncation.limit)){u=!0;break}n+=k,a+=N>65535?2:1}let h=n,p=!1;return u&&r.truncation.limit>=r.truncation.ellipsisWidth&&(h=r.truncation.limit,p=!0),{ellipsed:p,index:u?c:i,truncated:u,width:h}},Z=(t,e={})=>Ce(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,Br=/\x1B\[(\d+)m/;class St{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const r=Br.exec(e);if(!r)return;const s=Number.parseInt(r[1],10);switch(s){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(s>=30&&s<=37||s>=90&&s<=97)this.activeForeground=e;else if(s>=40&&s<=47||s>=100&&s<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(s))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(s)){const i={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[s];i&&(this.activeFormatting=this.activeFormatting.filter(o=>!o.includes(i)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const r={"\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(s=>{const i=r[s];i&&e.push(i)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}const kt=(t,e)=>{if(!ae.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const r=!0,s=t.slice(e+1,e+1+ke.length).join("")===ke;return{isInsideEscape:r,isInsideLinkEscape:s}},jr=(t,e={})=>{const r=new St;let s="",i=!1,o="",a="",n=!1;const c=[...t];for(let u=0;u<c.length;u++){const l=c[u];if(l&&ae.has(l)){if(s){const k=e.getWidth?.(s)??0,v={isEscapeSequence:!1,isGrapheme:!0,text:s,width:k};if(n&&(v.isHyperlink=!0,v.hyperlinkUrl=a),e.onSegment?.(v,r)===!1)return;s=""}i=!0,o=l;const w=kt(c,u),{isInsideLinkEscape:N}=w;if(N){let k=u+1;for(a="";k<c.length;){const B=c[k];if(B===Le)break;a+=B,k+=1}a=a.slice(4);const v={hyperlinkUrl:a,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(v,r)===!1)return;u=k,n=!0,i=!1,o="";continue}if(u+1<c.length&&c[u+1]==="\\"&&n){const k={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(k,r)===!1)return;n=!1,a="",u+=1,i=!1,o="";continue}}if(i){if(o!==l&&(o+=l),l===Qe){i=!1,r.processEscape(o);const w={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};if(e.onSegment?.(w,r)===!1)return;o=""}continue}s+=l;const h=e.getWidth?.(s)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:s,width:h};if(n&&(p.isHyperlink=!0,p.hyperlinkUrl=a),e.onSegment?.(p,r)===!1)return;s=""}if(s){const u=e.getWidth?.(s)??0,l={isEscapeSequence:!1,isGrapheme:!0,text:s,width:u};n&&(l.isHyperlink=!0,l.hyperlinkUrl=a),e.onSegment?.(l,r)}if(o){const u={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};e.onSegment?.(u,r)}},lt=t=>`${ae.values().next().value}${xt}${String(t)}${Qe}`,ct=t=>`${ae.values().next().value}${ke}${t}${Le}`,Nr=t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",r,s;const i=t.join(`
|
|
2
2
|
`),o=[...i];let a=0;for(const[n,c]of o.entries()){if(e+=c,ae.has(c)){const l=Ar.exec(i.slice(a))?.groups??{};if(l.code!==void 0){const h=Number.parseFloat(l.code);r=h===Er?void 0:h}else l.uri!==void 0&&(s=l.uri.length===0?void 0:l.uri)}const u=Lr.get(Number(r));o[n+1]===`
|
|
3
3
|
`?(s&&(e+=ct("")),r&&u&&(e+=lt(u))):c===`
|
|
4
4
|
`&&(r&&u&&(e+=lt(r)),s&&(e+=ct(s))),a+=c.length}return e},Et=/(?=\s)|(?<=\s)/,Tt=/^\s+$/,Ne=t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},te=t=>{const e=t.split(" ");let r=e.length;for(;r>0&&Z(e[r-1])===0;)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},At=(t,e,r)=>{if(t.length===0)return[""];if(e<=0)return[t];const s=[],i=new St;let o="",a=0,n=!1,c=!1,u="",l=0;for(;l<t.length;){const h=t[l];if(ae.has(h)){n=!0,u=h,o+=h,c=kt([...t],l).isInsideLinkEscape,l+=1;continue}if(n){u+=h,o+=h,c?h===Le&&(n=c=!1):h===Qe&&(n=!1,i.processEscape(u)),l+=1;continue}const p=Z(h),w=h===" ";if(p===0){o+=h,l+=1;continue}if(a+p>e&&(o&&s.push(o+i.getEndEscapesForAllActiveAttributes()),o=i.getStartEscapesForAllActiveAttributes(),a=Z(o),w&&r)){for(;l<t.length&&t[l]===" ";)l+=1;continue}if(o+=h,a+=p,a===e&&l<t.length-1&&(s.push(o+i.getEndEscapesForAllActiveAttributes()),o=i.getStartEscapesForAllActiveAttributes(),a=Z(o),l+1<t.length&&t[l+1]===" "&&r)){for(l+=1;l<t.length&&t[l]===" ";)l+=1;continue}l+=1}return o&&s.push(o+i.getEndEscapesForAllActiveAttributes()),r?s.map(h=>te(h)):s},Ir=(t,e,r)=>{if(t.length===0)return[];const s=r?t.trim():t;if(s.length===0)return[];const i=[];let o="",a=0;return jr(s,{getWidth:Z,onSegment:(n,c)=>{const u=n.text??"";if(n.isEscapeSequence)o+=u;else{const l=u===" ";if(n.width===0)return o+=u,!0;if(a+n.width>e&&(o&&i.push(o),o=c.getStartEscapesForAllActiveAttributes(),a=0,l))return r||i.push(c.getStartEscapesForAllActiveAttributes()+u),!0;o+=u,a+=n.width}return!0}}),o&&i.push(o),r?i.map(n=>te(n)):i},Pr=(t,e,r)=>{if(t.length===0)return[];const s=r?t.trim():t;if(s.length===0)return[];const i=s.split(Et),o=[];let a="",n=0,c=0;for(;c<i.length;){const u=i[c],l=Tt.test(u),h=Z(u);if(u.length===0){c+=1;continue}if(r&&l&&n===0){c+=1;continue}if(n+h>e&&n>0){r?o.push(te(a)):o.push(a),a="",n=0;continue}a+=u,n+=h,c+=1}return a&&(r?o.push(te(a)):o.push(a)),o},Fr=(t,e,r)=>{if(t.length===0)return[];const s=r?t.trim():t;if(s.length===0)return[];const i=s.split(Et),o=[];let a="",n=0,c=0;for(;c<i.length;){const u=i[c],l=Tt.test(u),h=Z(u);if(u.length===0){c+=1;continue}if(r&&l&&n===0){c+=1;continue}if(h>e){a&&o.push(Ne(r?te(a):a));const p=At(u,e,r);if(p.length>0){for(let w=0;w<p.length-1;w+=1)o.push(p[w]);a=p.at(-1),n=Z(a)}else a="",n=0;c+=1;continue}if(n+h>e&&n>0&&(o.push(Ne(r?te(a):a)),a="",n=0,r&&l)){c+=1;continue}a+=u,n+=h,c+=1}return a&&o.push(Ne(r?te(a):a)),o},fe={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Rr=(t,e={})=>{const{removeZeroWidthCharacters:r=!0,trim:s=!0,width:i=80,wrapMode:o=fe.PRESERVE_WORDS}=e;if(s&&t.trim()==="")return"";let a=t.normalize("NFC").replaceAll(`\r
|
|
@@ -44,7 +44,7 @@ ${Go(k,{...this.#n,filterStacktrace:Zo,prefix:b})}`;if(typeof k=="object")return
|
|
|
44
44
|
|
|
45
45
|
${Go(y,{...this.#n,filterStacktrace:Zo,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:b})}`),h&&v.push(` ${b}${vt(this.styles.underline.suffix?ul(h):h)}`),l){const j=(l.name??"")+(l.line?`:${String(l.line)}`:""),k=Math.max(0,E-Ne("Caller: "));v.push(`
|
|
46
46
|
`,vt("Caller: ")," ".repeat(k),j,`
|
|
47
|
-
`)}return v.join("")}};var SO="@visulima/packem",Jp="2.0.0-alpha.87";const kO={version:Jp};var fb=Object.defineProperty,zp=(e,t)=>fb(e,"name",{value:t,configurable:!0}),db=Object.defineProperty,mb=zp((e,t)=>db(e,"name",{value:t,configurable:!0}),"o");let jO=class extends Error{static{zp(this,"n")}static{mb(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 hb=Object.defineProperty,Up=(e,t)=>hb(e,"name",{value:t,configurable:!0}),gb=Object.defineProperty,yb=Up((e,t)=>gb(e,"name",{value:t,configurable:!0}),"t");let OO=class extends Error{static{Up(this,"n")}static{yb(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 $b=Object.defineProperty,Gp=(e,t)=>$b(e,"name",{value:t,configurable:!0}),bb=Object.defineProperty,wb=Gp((e,t)=>bb(e,"name",{value:t,configurable:!0}),"o");let _t=class extends Error{static{Gp(this,"n")}static{wb(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 vb=Object.defineProperty,xb=(e,t)=>vb(e,"name",{value:t,configurable:!0}),Eb=Object.defineProperty,Sb=xb((e,t)=>Eb(e,"name",{value:t,configurable:!0}),"n");Sb((e,{whitespace:t=!0}={})=>e.replace(pm,r=>r.startsWith('"')||r[1]==="*"&&!r.endsWith("*/")?r:t?r.replaceAll(/\S/g," "):""),"stripJsonComments");var kb=Object.defineProperty,Vp=(e,t)=>kb(e,"name",{value:t,configurable:!0}),jb=Object.defineProperty,Ab=Vp((e,t)=>jb(e,"name",{value:t,configurable:!0}),"r");async function ko(e,t,r){const{buffer:n,compression:o,encoding:s="utf8",flag:i,...a}=r??{},l=await Eu(e,{buffer:n,compression:o,encoding:s,flag:i});return typeof t=="function"?Ln(l,t,a):Ln(l,a)}Vp(ko,"l");Ab(ko,"readYaml");var Ob=Object.defineProperty,Kp=(e,t)=>Ob(e,"name",{value:t,configurable:!0}),Rb=Object.defineProperty,Cb=Kp((e,t)=>Rb(e,"name",{value:t,configurable:!0}),"t");function jo(e,t,r){const{buffer:n,compression:o,encoding:s="utf8",flag:i,...a}=r??{},l=Bi(e,{buffer:n,compression:o,encoding:s,flag:i});return typeof t=="function"?Ln(l,t,a):Ln(l,a)}Kp(jo,"l");Cb(jo,"readYamlSync");var Tb=Object.defineProperty,Yp=(e,t)=>Tb(e,"name",{value:t,configurable:!0}),Nb=Object.defineProperty,Pb=Yp((e,t)=>Nb(e,"name",{value:t,configurable:!0}),"a");async function Xp(e,t,r,n){let o,s,i;typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r!="function"?(o=r,s=o.replacer,i=o.space):typeof n=="object"?(o=n,s=r,i=o.space):(s=r,i=n);const a=Nu(t,s,i??o);await fm(e,a,o)}Yp(Xp,"c");Pb(Xp,"writeYaml");var Mb=Object.defineProperty,Zp=(e,t)=>Mb(e,"name",{value:t,configurable:!0}),_b=Object.defineProperty,Ib=Zp((e,t)=>_b(e,"name",{value:t,configurable:!0}),"a");function Qp(e,t,r,n){let o,s,i;typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r!="function"?(o=r,s=o.replacer,i=o.space):typeof n=="object"?(o=n,s=r,i=o.space):(s=r,i=n);const a=Nu(t,s,i??o);ao(e,a,o)}Zp(Qp,"c");Ib(Qp,"writeYamlSync");var Wb=Object.defineProperty,Bb=(e,t)=>Wb(e,"name",{value:t,configurable:!0}),Db=Object.defineProperty,ur=Bb((e,t)=>Db(e,"name",{value:t,configurable:!0}),"c");const ef=ur((e,t,r)=>{const n=Z(e),o=Z(t),s=o===n?".":Se(n,o);return r.some(i=>{const a=i.startsWith("./")?i.slice(2):i,l=s.startsWith("./")?s.slice(2):s;if(a==="."&&l===".")return!0;if(a.endsWith("/**")){const u=a.slice(0,-3);return l===u||l.startsWith(`${u}/`)}if(a.endsWith("/*")){const u=a.slice(0,-2);return u===""?l!=="."&&!l.includes("/"):l.startsWith(`${u}/`)||l===u}return l===a||l.startsWith(`${a}/`)})},"isPackageInWorkspace"),tf=ur(async e=>{const t=await ft("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const r=await ko(t),n=Array.isArray(r.packages)?r.packages:[];if(!ef(t,e,n))return;const o={};return r.catalog&&typeof r.catalog=="object"&&(o.catalog=r.catalog),r.catalogs&&typeof r.catalogs=="object"&&(o.catalogs=r.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogs"),rf=ur(e=>{const t=dt("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const r=jo(t),n=Array.isArray(r.packages)?r.packages:[];if(!ef(t,e,n))return;const o={};return r.catalog&&typeof r.catalog=="object"&&(o.catalog=r.catalog),r.catalogs&&typeof r.catalogs=="object"&&(o.catalogs=r.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogsSync"),Lb=ur((e,t,r)=>{if(t==="catalog:")return r.catalog?.[e];if(t.startsWith("catalog:")){const n=t.slice(8);return r.catalogs?.[n]?.[e]}},"resolveCatalogReference"),Fb=ur((e,t)=>{for(const[r,n]of Object.entries(e)){if(typeof n!="string")continue;const o=Lb(r,n,t);o&&(e[r]=o)}},"resolveDependenciesCatalogReferences"),Ao=ur((e,t)=>{const r=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const n of r){if(!e[n]||typeof e[n]!="object")continue;const o=e[n];Fb(o,t)}},"resolveCatalogReferences");var Hb=Object.defineProperty,ge=(e,t)=>Hb(e,"name",{value:t,configurable:!0});const qb=_e(import.meta.url),yr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,na=ge(e=>{if(typeof yr<"u"&&yr.versions&&yr.versions.node){const[t,r]=yr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return yr.getBuiltinModule(e)}return qb(e)},"__cjs_getBuiltinModule"),{existsSync:nf}=na("node:fs"),{createInterface:Jb}=na("node:readline"),{styleText:Te}=na("node:util");var zb=Object.defineProperty,be=ge((e,t)=>zb(e,"name",{value:t,configurable:!0}),"f");const Ye=be(e=>{const t=typeof e;return e!==null&&(t==="object"||t==="function")},"isObject"),Ub=be(e=>{if(!Ye(e))return!1;for(const t in e)if(Object.hasOwn(e,t))return!1;return!0},"isEmptyObject"),of=new Set(["__proto__","prototype","constructor"]),sf=1e6,Gb=be(e=>e>="0"&&e<="9","isDigit");function pr(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<=sf}return!1}ge(pr,"p$1");be(pr,"shouldCoerceToNumber");function Dr(e,t){return of.has(e)?!1:(e&&pr(e)?t.push(Number.parseInt(e,10)):t.push(e),!0)}ge(Dr,"y");be(Dr,"processSegment");function oa(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);const t=[];let r="",n="start",o=!1,s=0;for(const i of e){if(s++,o){r+=i,o=!1;continue}if(i==="\\"){if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);o=!0,n=n==="start"?"property":n;continue}switch(i){case".":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd"){n="property";break}if(!Dr(r,t))return[];r="",n="property";break}case"[":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd"){n="index";break}if(n==="property"||n==="start"){if((r||n==="property")&&!Dr(r,t))return[];r=""}n="index";break}case"]":{if(n==="index"){if(r==="")r=(t.pop()||"")+"[]",n="property";else{const a=Number.parseInt(r,10);!Number.isNaN(a)&&Number.isFinite(a)&&a>=0&&a<=Number.MAX_SAFE_INTEGER&&a<=sf&&r===String(a)?t.push(a):t.push(r),r="",n="indexEnd"}break}if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);r+=i;break}default:{if(n==="index"&&!Gb(i))throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);n==="start"&&(n="property"),r+=i}}}switch(o&&(r+="\\"),n){case"property":{if(!Dr(r,t))return[];break}case"index":throw new Error("Index was not closed");case"start":{t.push("");break}}return t}ge(oa,"parsePath");be(oa,"parsePath");function fr(e){if(typeof e=="string")return oa(e);if(Array.isArray(e)){const t=[];for(const[r,n]of e.entries()){if(typeof n!="string"&&typeof n!="number")throw new TypeError(`Expected a string or number for path segment at index ${r}, got ${typeof n}`);if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`Path segment at index ${r} must be a finite number, got ${n}`);if(of.has(n))return[];typeof n=="string"&&pr(n)?t.push(Number.parseInt(n,10)):t.push(n)}return t}return[]}ge(fr,"d");be(fr,"normalizePath");function nt(e,t,r){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return r===void 0?e:r;const n=fr(t);if(n.length===0)return r;for(let o=0;o<n.length;o++){const s=n[o];if(e=e[s],e==null){if(o!==n.length-1)return r;break}}return e===void 0?r:e}ge(nt,"getProperty");be(nt,"getProperty");function sa(e,t,r){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return e;const n=e,o=fr(t);if(o.length===0)return e;for(let s=0;s<o.length;s++){const i=o[s];if(s===o.length-1)e[i]=r;else if(!Ye(e[i])){const a=typeof o[s+1]=="number";e[i]=a?[]:{}}e=e[i]}return n}ge(sa,"setProperty");be(sa,"setProperty");function af(e,t){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return!1;const r=fr(t);if(r.length===0)return!1;for(let n=0;n<r.length;n++){const o=r[n];if(n===r.length-1)return Object.hasOwn(e,o)?(delete e[o],!0):!1;if(e=e[o],!Ye(e))return!1}}ge(af,"deleteProperty");be(af,"deleteProperty");function Ot(e,t){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return!1;const r=fr(t);if(r.length===0)return!1;for(const n of r){if(!Ye(e)||!(n in e))return!1;e=e[n]}return!0}ge(Ot,"hasProperty");be(Ot,"hasProperty");function zn(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return e.replaceAll(/[\\.[]/g,String.raw`\$&`)}ge(zn,"escapePath");be(zn,"escapePath");function ia(e){const t=Object.entries(e);return Array.isArray(e)?t.map(([r,n])=>[pr(r)?Number.parseInt(r,10):r,n]):t}ge(ia,"m$2");be(ia,"normalizeEntries");function aa(e,t={}){if(!Array.isArray(e))throw new TypeError(`Expected an array, got ${typeof e}`);const{preferDotForIndices:r=!1}=t,n=[];for(const[o,s]of e.entries()){if(typeof s!="string"&&typeof s!="number")throw new TypeError(`Expected a string or number for path segment at index ${o}, got ${typeof s}`);if(typeof s=="number")if(!Number.isInteger(s)||s<0){const i=zn(String(s));n.push(o===0?i:`.${i}`)}else r&&o>0?n.push(`.${s}`):n.push(`[${s}]`);else if(typeof s=="string")if(s==="")o===0||n.push(".");else if(pr(s)){const i=Number.parseInt(s,10);r&&o>0?n.push(`.${i}`):n.push(`[${i}]`)}else{const i=zn(s);n.push(o===0?i:`.${i}`)}}return n.join("")}ge(aa,"stringifyPath");be(aa,"stringifyPath");function*Oo(e,t=[],r=new Set){if(!Ye(e)||Ub(e)){t.length>0&&(yield aa(t));return}if(!r.has(e)){r.add(e);for(const[n,o]of ia(e))t.push(n),yield*Oo(o,t,r),t.pop();r.delete(e)}}ge(Oo,"x");be(Oo,"deepKeysIterator");function lf(e){return[...Oo(e)]}ge(lf,"deepKeys");be(lf,"deepKeys");function cf(e){const t={};if(!Ye(e))return t;for(const[r,n]of Object.entries(e))sa(t,r,n);return t}ge(cf,"unflatten");be(cf,"unflatten");var Vb=Object.defineProperty,Qo=ge((e,t)=>Vb(e,"name",{value:t,configurable:!0}),"i");const Kb=Qo(async e=>{const{default:t=!1,message:r,transformer:n}=e,o=Qo(i=>{const a=Te(["cyan","bold"],"?"),l=Te(["bold"],i),u=t?`${Te(["greenBright"],"Y")}${Te(["gray"],"/n")}`:`y/${Te(["yellowBright"],"N")}`;return`${a} ${l} ${Te(["gray"],`(${u})`)}`},"formatMessage"),s=Qo(i=>n?n(i):i?Te(["greenBright"],"Yes"):Te(["yellowBright"],"No"),"formatAnswer");return new Promise(i=>{const a=Jb({input:process.stdin,output:process.stdout}),l=o(r);a.question(l,u=>{a.close();const c=u.trim().toLowerCase();if(c===""){i(t);return}if(c==="y"||c==="yes"){console.log(`${Te(["greenBright"],"✓")} ${s(!0)}`),i(!0);return}if(c==="n"||c==="no"){console.log(`${Te(["yellowBright"],"✗")} ${s(!1)}`),i(!1);return}console.log(`${Te(["gray"],"→")} ${s(t)}`),i(t)}),a.on("SIGINT",()=>{a.close(),console.log(`
|
|
47
|
+
`)}return v.join("")}};var SO="@visulima/packem",Jp="2.0.0-alpha.88";const kO={version:Jp};var fb=Object.defineProperty,zp=(e,t)=>fb(e,"name",{value:t,configurable:!0}),db=Object.defineProperty,mb=zp((e,t)=>db(e,"name",{value:t,configurable:!0}),"o");let jO=class extends Error{static{zp(this,"n")}static{mb(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 hb=Object.defineProperty,Up=(e,t)=>hb(e,"name",{value:t,configurable:!0}),gb=Object.defineProperty,yb=Up((e,t)=>gb(e,"name",{value:t,configurable:!0}),"t");let OO=class extends Error{static{Up(this,"n")}static{yb(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 $b=Object.defineProperty,Gp=(e,t)=>$b(e,"name",{value:t,configurable:!0}),bb=Object.defineProperty,wb=Gp((e,t)=>bb(e,"name",{value:t,configurable:!0}),"o");let _t=class extends Error{static{Gp(this,"n")}static{wb(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 vb=Object.defineProperty,xb=(e,t)=>vb(e,"name",{value:t,configurable:!0}),Eb=Object.defineProperty,Sb=xb((e,t)=>Eb(e,"name",{value:t,configurable:!0}),"n");Sb((e,{whitespace:t=!0}={})=>e.replace(pm,r=>r.startsWith('"')||r[1]==="*"&&!r.endsWith("*/")?r:t?r.replaceAll(/\S/g," "):""),"stripJsonComments");var kb=Object.defineProperty,Vp=(e,t)=>kb(e,"name",{value:t,configurable:!0}),jb=Object.defineProperty,Ab=Vp((e,t)=>jb(e,"name",{value:t,configurable:!0}),"r");async function ko(e,t,r){const{buffer:n,compression:o,encoding:s="utf8",flag:i,...a}=r??{},l=await Eu(e,{buffer:n,compression:o,encoding:s,flag:i});return typeof t=="function"?Ln(l,t,a):Ln(l,a)}Vp(ko,"l");Ab(ko,"readYaml");var Ob=Object.defineProperty,Kp=(e,t)=>Ob(e,"name",{value:t,configurable:!0}),Rb=Object.defineProperty,Cb=Kp((e,t)=>Rb(e,"name",{value:t,configurable:!0}),"t");function jo(e,t,r){const{buffer:n,compression:o,encoding:s="utf8",flag:i,...a}=r??{},l=Bi(e,{buffer:n,compression:o,encoding:s,flag:i});return typeof t=="function"?Ln(l,t,a):Ln(l,a)}Kp(jo,"l");Cb(jo,"readYamlSync");var Tb=Object.defineProperty,Yp=(e,t)=>Tb(e,"name",{value:t,configurable:!0}),Nb=Object.defineProperty,Pb=Yp((e,t)=>Nb(e,"name",{value:t,configurable:!0}),"a");async function Xp(e,t,r,n){let o,s,i;typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r!="function"?(o=r,s=o.replacer,i=o.space):typeof n=="object"?(o=n,s=r,i=o.space):(s=r,i=n);const a=Nu(t,s,i??o);await fm(e,a,o)}Yp(Xp,"c");Pb(Xp,"writeYaml");var Mb=Object.defineProperty,Zp=(e,t)=>Mb(e,"name",{value:t,configurable:!0}),_b=Object.defineProperty,Ib=Zp((e,t)=>_b(e,"name",{value:t,configurable:!0}),"a");function Qp(e,t,r,n){let o,s,i;typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r!="function"?(o=r,s=o.replacer,i=o.space):typeof n=="object"?(o=n,s=r,i=o.space):(s=r,i=n);const a=Nu(t,s,i??o);ao(e,a,o)}Zp(Qp,"c");Ib(Qp,"writeYamlSync");var Wb=Object.defineProperty,Bb=(e,t)=>Wb(e,"name",{value:t,configurable:!0}),Db=Object.defineProperty,ur=Bb((e,t)=>Db(e,"name",{value:t,configurable:!0}),"c");const ef=ur((e,t,r)=>{const n=Z(e),o=Z(t),s=o===n?".":Se(n,o);return r.some(i=>{const a=i.startsWith("./")?i.slice(2):i,l=s.startsWith("./")?s.slice(2):s;if(a==="."&&l===".")return!0;if(a.endsWith("/**")){const u=a.slice(0,-3);return l===u||l.startsWith(`${u}/`)}if(a.endsWith("/*")){const u=a.slice(0,-2);return u===""?l!=="."&&!l.includes("/"):l.startsWith(`${u}/`)||l===u}return l===a||l.startsWith(`${a}/`)})},"isPackageInWorkspace"),tf=ur(async e=>{const t=await ft("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const r=await ko(t),n=Array.isArray(r.packages)?r.packages:[];if(!ef(t,e,n))return;const o={};return r.catalog&&typeof r.catalog=="object"&&(o.catalog=r.catalog),r.catalogs&&typeof r.catalogs=="object"&&(o.catalogs=r.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogs"),rf=ur(e=>{const t=dt("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const r=jo(t),n=Array.isArray(r.packages)?r.packages:[];if(!ef(t,e,n))return;const o={};return r.catalog&&typeof r.catalog=="object"&&(o.catalog=r.catalog),r.catalogs&&typeof r.catalogs=="object"&&(o.catalogs=r.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogsSync"),Lb=ur((e,t,r)=>{if(t==="catalog:")return r.catalog?.[e];if(t.startsWith("catalog:")){const n=t.slice(8);return r.catalogs?.[n]?.[e]}},"resolveCatalogReference"),Fb=ur((e,t)=>{for(const[r,n]of Object.entries(e)){if(typeof n!="string")continue;const o=Lb(r,n,t);o&&(e[r]=o)}},"resolveDependenciesCatalogReferences"),Ao=ur((e,t)=>{const r=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const n of r){if(!e[n]||typeof e[n]!="object")continue;const o=e[n];Fb(o,t)}},"resolveCatalogReferences");var Hb=Object.defineProperty,ge=(e,t)=>Hb(e,"name",{value:t,configurable:!0});const qb=_e(import.meta.url),yr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,na=ge(e=>{if(typeof yr<"u"&&yr.versions&&yr.versions.node){const[t,r]=yr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return yr.getBuiltinModule(e)}return qb(e)},"__cjs_getBuiltinModule"),{existsSync:nf}=na("node:fs"),{createInterface:Jb}=na("node:readline"),{styleText:Te}=na("node:util");var zb=Object.defineProperty,be=ge((e,t)=>zb(e,"name",{value:t,configurable:!0}),"f");const Ye=be(e=>{const t=typeof e;return e!==null&&(t==="object"||t==="function")},"isObject"),Ub=be(e=>{if(!Ye(e))return!1;for(const t in e)if(Object.hasOwn(e,t))return!1;return!0},"isEmptyObject"),of=new Set(["__proto__","prototype","constructor"]),sf=1e6,Gb=be(e=>e>="0"&&e<="9","isDigit");function pr(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<=sf}return!1}ge(pr,"p$1");be(pr,"shouldCoerceToNumber");function Dr(e,t){return of.has(e)?!1:(e&&pr(e)?t.push(Number.parseInt(e,10)):t.push(e),!0)}ge(Dr,"y");be(Dr,"processSegment");function oa(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);const t=[];let r="",n="start",o=!1,s=0;for(const i of e){if(s++,o){r+=i,o=!1;continue}if(i==="\\"){if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);o=!0,n=n==="start"?"property":n;continue}switch(i){case".":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd"){n="property";break}if(!Dr(r,t))return[];r="",n="property";break}case"[":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd"){n="index";break}if(n==="property"||n==="start"){if((r||n==="property")&&!Dr(r,t))return[];r=""}n="index";break}case"]":{if(n==="index"){if(r==="")r=(t.pop()||"")+"[]",n="property";else{const a=Number.parseInt(r,10);!Number.isNaN(a)&&Number.isFinite(a)&&a>=0&&a<=Number.MAX_SAFE_INTEGER&&a<=sf&&r===String(a)?t.push(a):t.push(r),r="",n="indexEnd"}break}if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);r+=i;break}default:{if(n==="index"&&!Gb(i))throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);n==="start"&&(n="property"),r+=i}}}switch(o&&(r+="\\"),n){case"property":{if(!Dr(r,t))return[];break}case"index":throw new Error("Index was not closed");case"start":{t.push("");break}}return t}ge(oa,"parsePath");be(oa,"parsePath");function fr(e){if(typeof e=="string")return oa(e);if(Array.isArray(e)){const t=[];for(const[r,n]of e.entries()){if(typeof n!="string"&&typeof n!="number")throw new TypeError(`Expected a string or number for path segment at index ${r}, got ${typeof n}`);if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`Path segment at index ${r} must be a finite number, got ${n}`);if(of.has(n))return[];typeof n=="string"&&pr(n)?t.push(Number.parseInt(n,10)):t.push(n)}return t}return[]}ge(fr,"d");be(fr,"normalizePath");function nt(e,t,r){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return r===void 0?e:r;const n=fr(t);if(n.length===0)return r;for(let o=0;o<n.length;o++){const s=n[o];if(e=e[s],e==null){if(o!==n.length-1)return r;break}}return e===void 0?r:e}ge(nt,"getProperty");be(nt,"getProperty");function sa(e,t,r){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return e;const n=e,o=fr(t);if(o.length===0)return e;for(let s=0;s<o.length;s++){const i=o[s];if(s===o.length-1)e[i]=r;else if(!Ye(e[i])){const a=typeof o[s+1]=="number";e[i]=a?[]:{}}e=e[i]}return n}ge(sa,"setProperty");be(sa,"setProperty");function af(e,t){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return!1;const r=fr(t);if(r.length===0)return!1;for(let n=0;n<r.length;n++){const o=r[n];if(n===r.length-1)return Object.hasOwn(e,o)?(delete e[o],!0):!1;if(e=e[o],!Ye(e))return!1}}ge(af,"deleteProperty");be(af,"deleteProperty");function Ot(e,t){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return!1;const r=fr(t);if(r.length===0)return!1;for(const n of r){if(!Ye(e)||!(n in e))return!1;e=e[n]}return!0}ge(Ot,"hasProperty");be(Ot,"hasProperty");function zn(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return e.replaceAll(/[\\.[]/g,String.raw`\$&`)}ge(zn,"escapePath");be(zn,"escapePath");function ia(e){const t=Object.entries(e);return Array.isArray(e)?t.map(([r,n])=>[pr(r)?Number.parseInt(r,10):r,n]):t}ge(ia,"m$2");be(ia,"normalizeEntries");function aa(e,t={}){if(!Array.isArray(e))throw new TypeError(`Expected an array, got ${typeof e}`);const{preferDotForIndices:r=!1}=t,n=[];for(const[o,s]of e.entries()){if(typeof s!="string"&&typeof s!="number")throw new TypeError(`Expected a string or number for path segment at index ${o}, got ${typeof s}`);if(typeof s=="number")if(!Number.isInteger(s)||s<0){const i=zn(String(s));n.push(o===0?i:`.${i}`)}else r&&o>0?n.push(`.${s}`):n.push(`[${s}]`);else if(typeof s=="string")if(s==="")o===0||n.push(".");else if(pr(s)){const i=Number.parseInt(s,10);r&&o>0?n.push(`.${i}`):n.push(`[${i}]`)}else{const i=zn(s);n.push(o===0?i:`.${i}`)}}return n.join("")}ge(aa,"stringifyPath");be(aa,"stringifyPath");function*Oo(e,t=[],r=new Set){if(!Ye(e)||Ub(e)){t.length>0&&(yield aa(t));return}if(!r.has(e)){r.add(e);for(const[n,o]of ia(e))t.push(n),yield*Oo(o,t,r),t.pop();r.delete(e)}}ge(Oo,"x");be(Oo,"deepKeysIterator");function lf(e){return[...Oo(e)]}ge(lf,"deepKeys");be(lf,"deepKeys");function cf(e){const t={};if(!Ye(e))return t;for(const[r,n]of Object.entries(e))sa(t,r,n);return t}ge(cf,"unflatten");be(cf,"unflatten");var Vb=Object.defineProperty,Qo=ge((e,t)=>Vb(e,"name",{value:t,configurable:!0}),"i");const Kb=Qo(async e=>{const{default:t=!1,message:r,transformer:n}=e,o=Qo(i=>{const a=Te(["cyan","bold"],"?"),l=Te(["bold"],i),u=t?`${Te(["greenBright"],"Y")}${Te(["gray"],"/n")}`:`y/${Te(["yellowBright"],"N")}`;return`${a} ${l} ${Te(["gray"],`(${u})`)}`},"formatMessage"),s=Qo(i=>n?n(i):i?Te(["greenBright"],"Yes"):Te(["yellowBright"],"No"),"formatAnswer");return new Promise(i=>{const a=Jb({input:process.stdin,output:process.stdout}),l=o(r);a.question(l,u=>{a.close();const c=u.trim().toLowerCase();if(c===""){i(t);return}if(c==="y"||c==="yes"){console.log(`${Te(["greenBright"],"✓")} ${s(!0)}`),i(!0);return}if(c==="n"||c==="no"){console.log(`${Te(["yellowBright"],"✗")} ${s(!1)}`),i(!1);return}console.log(`${Te(["gray"],"→")} ${s(t)}`),i(t)}),a.on("SIGINT",()=>{a.close(),console.log(`
|
|
48
48
|
${Te(["gray"],"→")} ${s(t)}`),i(t)})})},"confirm"),Yb=typeof process.stdout<"u"&&!process.versions.deno&&!globalThis.window;var Xb=Object.defineProperty,$e=ge((e,t)=>Xb(e,"name",{value:t,configurable:!0}),"l");const uf=/, ([^,]*)$/,Un=new Map,pf=new Map;let Zb=class extends Error{static{ge(this,"M")}static{$e(this,"PackageJsonValidationError")}constructor(t){super(`The following warnings were encountered while normalizing package data:
|
|
49
49
|
- ${t.join(`
|
|
50
50
|
- `)}`),this.name="PackageJsonValidationError"}};const Ro=$e((e,t,r=[])=>{const n=[];if(Em(e,o=>{n.push(o)},t),t&&n.length>0){const o=n.filter(s=>!r.some(i=>i instanceof RegExp?i.test(s):i===s));if(o.length>0)throw new Zb(o)}return e},"normalizeInput"),Qb=$e(async e=>await ko(e),"parseYamlFile"),e1=$e(e=>jo(e),"parseYamlFileSync"),t1=$e(async e=>{const t=await Eu(e);return Pu.parse(t)},"parseJson5File"),r1=$e(e=>{const t=Bi(e);return Pu.parse(t)},"parseJson5FileSync"),ff=$e(async(e,t)=>t?.yaml!==!1&&(e.endsWith(".yaml")||e.endsWith(".yml"))?Qb(e):t?.json5!==!1&&e.endsWith(".json5")?t1(e):lo(e),"parsePackageFile"),df=$e((e,t)=>t?.yaml!==!1&&(e.endsWith(".yaml")||e.endsWith(".yml"))?e1(e):t?.json5!==!1&&e.endsWith(".json5")?r1(e):Di(e),"parsePackageFileSync");$e(async(e,t={})=>{const r={type:"file"};e&&(r.cwd=e);const n=["package.json"];t.yaml!==!1&&n.push("package.yaml","package.yml"),t.json5!==!1&&n.push("package.json5");let o;for(const l of n)if(o=await ft(l,r),o)break;if(!o)throw new _t(`No such file or directory, for ${n.join(", ").replace(uf," or $1")} found.`);const s=t.cache&&typeof t.cache!="boolean"?t.cache:pf;if(t.cache&&s.has(o))return s.get(o);const i=await ff(o,t);if(t.resolveCatalogs){const l=await tf(o);l&&Ao(i,l)}Ro(i,t.strict??!1,t.ignoreWarnings);const a={packageJson:i,path:o};return t.cache&&s.set(o,a),a},"findPackageJson");$e((e,t={})=>{const r={type:"file"};e&&(r.cwd=e);const n=["package.json"];t.yaml!==!1&&n.push("package.yaml","package.yml"),t.json5!==!1&&n.push("package.json5");let o;for(const l of n)if(o=dt(l,r),o)break;if(!o)throw new _t(`No such file or directory, for ${n.join(", ").replace(uf," or $1")} found.`);const s=t.cache&&typeof t.cache!="boolean"?t.cache:pf;if(t.cache&&s.has(o))return s.get(o);const i=df(o,t);if(t.resolveCatalogs){const l=rf(o);l&&Ao(i,l)}Ro(i,t.strict??!1,t.ignoreWarnings);const a={packageJson:i,path:o};return t.cache&&s.set(o,a),a},"findPackageJsonSync");$e(async(e,t={})=>{const{cwd:r,...n}=t,o=Fr(r??process.cwd());await ku(G(o,"package.json"),e,n)},"writePackageJson");$e((e,t={})=>{const{cwd:r,...n}=t,o=Fr(r??process.cwd());dm(G(o,"package.json"),e,n)},"writePackageJsonSync");const la=$e((e,t)=>{const r=typeof e=="object"&&!Array.isArray(e);if(!r&&typeof e!="string")throw new TypeError("`packageFile` should be either an `object` or a `string`.");let n,o=!1,s;if(r)n=structuredClone(e);else if(nf(e)){s=e;const a=t?.cache&&typeof t.cache!="boolean"?t.cache:Un;if(t?.cache&&a.has(s))return a.get(s);n=df(s,t),o=!0}else n=Su(e);if(t?.resolveCatalogs)if(o){const a=rf(e);a&&Ao(n,a)}else throw new Error("The 'resolveCatalogs' option can only be used on a file path.");Ro(n,t?.strict??!1,t?.ignoreWarnings);const i=n;return o&&t?.cache&&(typeof t.cache=="boolean"?Un:t.cache).set(s,i),i},"parsePackageJsonSync"),NO=$e(async(e,t)=>{const r=typeof e=="object"&&!Array.isArray(e);if(!r&&typeof e!="string")throw new TypeError("`packageFile` should be either an `object` or a `string`.");let n,o=!1,s;if(r)n=structuredClone(e);else if(nf(e)){s=e;const a=t?.cache&&typeof t.cache!="boolean"?t.cache:Un;if(t?.cache&&a.has(s))return a.get(s);n=await ff(s,t),o=!0}else n=Su(e);if(t?.resolveCatalogs)if(o){const a=await tf(e);a&&Ao(n,a)}else throw new Error("The 'resolveCatalogs' option can only be used on a file path.");Ro(n,t?.strict??!1,t?.ignoreWarnings);const i=n;return o&&t?.cache&&(typeof t.cache=="boolean"?Un:t.cache).set(s,i),i},"parsePackageJson");$e((e,t,r)=>nt(e,t,r),"getPackageJsonProperty");$e((e,t)=>Ot(e,t),"hasPackageJsonProperty");const mf=$e((e,t,r)=>{const n=nt(e,"dependencies",{}),o=nt(e,"devDependencies",{}),s=nt(e,"peerDependencies",{}),i={...n,...o,...r?.peerDeps===!1?{}:s};for(const a of t)if(Ot(i,a))return!0;return!1},"hasPackageJsonAnyDependency"),n1=$e(async(e,t,r="dependencies",n={})=>{const o=nt(e,"dependencies",{}),s=nt(e,"devDependencies",{}),i=nt(e,"peerDependencies",{}),a=[],l={deps:!0,devDeps:!0,peerDeps:!1,...n};for(const u of t)l.deps&&Ot(o,u)||l.devDeps&&Ot(s,u)||l.peerDeps&&Ot(i,u)||a.push(u);if(a.length!==0){if(process.env.CI||Yb&&!process.stdout.isTTY){const u=`Skipping package installation for [${t.join(", ")}] because the process is not interactive.`;if(n.throwOnWarn)throw new Error(u);n.logger?.warn?n.logger.warn(u):console.warn(u);return}if(typeof l.confirm?.message=="function"&&(l.confirm.message=l.confirm.message(a)),l.confirm?.message===void 0){const u=`${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:u}:l.confirm.message=u}await Kb(l.confirm)&&await Tu(a,{...l.installPackage,cwd:l.cwd?Fr(l.cwd):void 0,dev:r==="devDependencies"})}},"ensurePackages"),Gn=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"],o1=/\.(?:js|mjs|cjs|ts|cts|mts)$/,PO=async(e,t="")=>{if(t){const r=Tt(t)?t:G(e,t);if(!o1.test(r))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");if(!await Ct(r))throw new Error(`The packem config file "${t}" could not be found at "${r}".`);return r}for(const r of Gn){const n=G(e,r);if(await Ct(n))return n}throw new Error(`No packem config file found in "${e}". Expected one of: ${Gn.join(", ")}.`)},MO=async e=>{for(const t of Gn)if(await Ct(G(e,t)))return!0;return!1},s1={esbuild:"esbuild",oxc:"oxc-transform",sucrase:"sucrase",swc:"@swc/core"},pl=async(e,t)=>{const r=Array.isArray(e)?e:[e],n=await xm(t).catch(()=>{});let o;return n==="yarn"||n==="bun"?o=`${n} add -D`:n==="pnpm"?o="pnpm add -D":o="npm install -D",`${o} ${r.join(" ")}`},Vn=e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},xi=(e,t,r,n)=>{if(e==="module-sync")return"esm";if(n){const i=Vn(n);if(i)return i}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return r;const[o,...s]=t;return xi(o,s,r,n)},i1=new Set(["browser","bun","default","deno","electron","import","module-sync","node","node-addons","require","types","workerd",...Hu,...qu]),ca=(e,t,r,n,o)=>{if(!e)return[];if(typeof e=="string"){const s=Vn(e);if(s&&s!==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:s??t}]}if(typeof e=="object"){const s=Object.entries(e).filter(([a])=>!a.endsWith(".json"));let i=[];for(const[a,l]of s){const u=a.replace("./",""),c=o.some(p=>u===p||u.startsWith(`${p}/`));if(typeof l=="string"){let p;Number.isInteger(+a)?p={exportKey:"*"}:a.startsWith("./")?p={exportKey:a.replace("./","")}:p={exportKey:a==="."?".":"*",subKey:a},i.push({...p,file:l,key:"exports",type:xi(a,n,t,l),...c&&{ignored:!0}})}else if(typeof l=="object"&&l!==null)for(const[p,f]of Object.entries(l)){if(r===!1&&p==="types")continue;const d=Number.isInteger(+a)?p:a;if(typeof f=="string")i.push({exportKey:d.replace("./",""),file:f,key:"exports",...i1.has(p)?{subKey:p}:{},type:xi(p,n,t,f),...c&&{ignored:!0}});else{const m=d.replace("./",""),h=c||o.some($=>m===$||m.startsWith(`${$}/`)),y=ca({[d]:f},t,r,[...n,p],o);h&&y.forEach($=>{$.ignored=!0}),i=[...i,...y]}}}return i}return[]},Ei=new Map,nr=/\.[^./]+$/,Ce=/\.d\.[mc]?ts$/,Si=/\.d\.mts$/,ki=/\.d\.cts$/,fl=/\.d\.[mc]ts$/,a1=/^\.\/dist\//,ji=/^dist\//,l1=/^\//,Mr=/^\.\//,c1=/\/$/,dl=/\.\w+$/,ml=/\*.*$/,u1=/\.(?:tsx?|cts|mts)$/,p1=/\.[cm]?tsx?$/,f1=/^(.+?)\.[^.]*$/,d1=/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,Re=e=>e===void 0||e==="node16",hf=(e,t)=>{const r=Ce.exec(e);if(r!==null)return r[0];if(t)for(const n of Object.values(t)){const o=n.startsWith(".")?n:`.${n}`;if(e.endsWith(o))return o}return tr(e)},m1=async e=>{try{return await Vu.readdir(e,{withFileTypes:!0})}catch(t){const{code:r}=t;if(r==="ENOENT")return[];throw t}},gf=async(e,t)=>{const r=await m1(e);return(await Promise.all(r.map(async n=>{const o=Ja.join(e,n.name);return n.isDirectory()?gf(o,t):n.isFile()?Ja.relative(t,o):[]}))).flat()},h1=async e=>{let t=Ei.get(e);return t||(t=gf(e,e),Ei.set(e,t)),t},hl=(e,t,r)=>{const n=e.replace(nr,"");if(t==="*"){const i=n.split("/").filter(Boolean);return i.length===0?void 0:r&&r>1?i:[i[0]]}const o=t.replaceAll(/[.+?^${}()|[\]\\]/g,String.raw`\$&`).replaceAll("*","(.*)"),s=new RegExp(`^${o}$`).exec(n);return s?s.slice(1):void 0},xt=(e,t)=>{let r=e;for(const n of t)r=r.replace("*",n);return r},g1=e=>e.endsWith(".d.mts")?"d.mts":e.endsWith(".d.cts")?"d.cts":"d.ts",y1=(e,t)=>e.key==="exports"&&e.subKey===Wr?Wr:e.key==="exports"&&e.subKey===Fa?Fa:t,$1=e=>{const t=e.replace(a1,"").replace(ji,"").replace(nr,"").split("/"),r=t.at(-1)??"",n=[".browser",".server",".development",".production",".node",".workerd"];for(const s of n)if(r.includes(s)){const i=r.replace(s,""),a=t.length>1?t.slice(0,-1).join("/"):"";return{baseName:a?`${a}/${i}`:i,pattern:s}}const o=r.split(".");if(o.length>2){const s=o.slice(0,-2).join("."),i=`.${o[o.length-2]}`,a=t.length>1?t.slice(0,-1).join("/"):"";return{baseName:a?`${a}/${s}`:s,pattern:i}}},b1=(e,t,r,n)=>{const o=`${t.replace(new RegExp(`^${n}/?`),"")}${r}`,s=o.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),i=new RegExp(String.raw`${s}\.([cm]?[tj]sx?|ts|js)$`),a=e.find(u=>{const c=u.replace(n,"").replace(l1,"");return i.test(c)});if(a)return a;const l=`${n}/${o}`;return e.find(u=>{const c=u.replace(nr,"");return c===l||c.endsWith(`/${o}`)})??void 0},at=(e,t,r,n,o,s,i,a)=>{const l=y1(o,s.environment);let{runtime:u}=s.options;const c=o.subKey==="browser"||typeof o.subKey=="string"&&o.subKey.includes("browser"),p=o.file.includes(".browser");if(c||p)u="browser";else{for(const b of Hu)if(o.file.includes(`.${b}.`)||o.subKey===b){u=b;break}(o.subKey==="node"||o.subKey==="workerd"||o.file.includes(".node")||o.file.includes(".workerd")||o.file.includes(".server"))&&(u="node")}const f=hf(o.file,s.options.outputExtensionMap),d=o.file.replace(f,""),m=s.options.outDir.replace(Mr,""),h=d.replace(new RegExp(`^(./)?${m}/`),""),y=t.replace(nr,"").split("/").pop()??"",$=h.split("/").pop()??"",g=!t.includes(h)&&y!==$;let w=e.find(b=>b.input===t&&b.environment===l&&b.runtime===u&&b.fileAlias===(g?h:void 0));if(w===void 0?w=e[e.push({environment:l,exportKey:new Set([o.exportKey].filter(Boolean)),fileAlias:g?h:void 0,input:t,runtime:u})-1]:w.exportKey&&o.exportKey&&w.exportKey.add(o.exportKey),i&&(w.isGlob=!0),r&&(w.outDir=n),o.isExecutable)w.executable=!0,w.declaration=!1,o.type==="cjs"?w.cjs=!0:o.type==="esm"&&(w.esm=!0);else{const b=Ce.test(o.file),v=a.filter(x=>x.exportKey===o.exportKey),S=v.length>0&&v.every(x=>Ce.test(x.file));if(b&&s.options.declaration!==!1){w.declaration=s.options.declaration;const x=g1(o.file);w.declarationExtensions??=new Set,w.declarationExtensions.add(x)}if(b||S){S&&s.options.declaration!==!1&&(w.declaration=s.options.declaration);const x=v.some(j=>Si.test(j.file)),E=v.some(j=>ki.test(j.file));if(x&&E?(Re(s.options.declaration)&&(s.options.declaration="compatible"),s.options.emitCJS=!0,s.options.emitESM=!0):E?(s.options.emitCJS=!0,Re(s.options.declaration)&&(s.options.declaration="compatible")):x&&(s.options.emitESM=!0,Re(s.options.declaration)&&(s.options.declaration="compatible")),S){const j=a.filter(P=>Ce.test(P.file)),k=j.some(P=>Si.test(P.file)),R=j.some(P=>ki.test(P.file));v.every(P=>!P.subKey||P.subKey==="types")?(R&&(w.cjs=!0),k&&(w.esm=!0)):(R&&(w.declarationCjs=!0),k&&(w.declarationEsm=!0))}}else o.type==="cjs"?w.cjs=!0:o.type==="esm"&&(w.esm=!0)}g&&!w.fileAlias&&(w.fileAlias=h)};let es=!1;const gl=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.")},w1=async(e,t,r)=>{const n=e.types||e.typings;Ei.clear(),es=!1;const o=[];t.sort((d,m)=>d.split("/").length-m.split("/").length);const s=e.type==="module"?"esm":"cjs",i=r.options.declaration??"node16",a=ca(e.exports,s,i,[],r.options.ignoreExportKeys??[]).filter(d=>!d.ignored),l=new Set;for(const d of a){const m=a.filter(h=>h.exportKey===d.exportKey);if(m.length>0&&m.every(h=>Ce.test(h.file))&&!l.has(d.exportKey)){l.add(d.exportKey);const h=m.some($=>$.file.endsWith(".d.mts")),y=m.some($=>$.file.endsWith(".d.cts"));h&&y?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0,r.options.emitESM=!0):y?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0):h&&(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitESM=!0)}}r.options.declaration??="node16";const u=a.some(d=>d.type==="esm"&&!Si.test(d.file)),c=a.some(d=>d.type==="cjs"&&!ki.test(d.file));u&&c?(r.options.emitESM=!0,r.options.emitCJS=!0):u?r.options.emitESM=!0:c?r.options.emitCJS=!0:s==="esm"?r.options.emitESM=!0:r.options.emitCJS=!0;const p=r.options.emitCJS&&r.options.emitESM;if(r.options.declaration==="node16"&&p&&(r.options.declaration="compatible"),e.bin){const d=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const m of d){const h=Vn(m);if(h&&h!==s)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??s})}}e.main&&a.push({file:e.main,key:"main",type:Vn(e.main)??s}),e.module&&a.push({file:e.module,key:"module",type:"esm"}),n&&(gl(r),Re(r.options.declaration)&&p&&(r.options.declaration="compatible"),a.push({file:n,key:"types"}));const f=[];if(!r.options.outputExtensionMap){const d=a.some(y=>!y.isExecutable&&!Ce.test(y.file)&&y.file.endsWith(".mjs")),m=a.some(y=>!y.isExecutable&&!Ce.test(y.file)&&y.file.endsWith(".cjs")),h=a.some(y=>!y.isExecutable&&!Ce.test(y.file)&&y.file.endsWith(".js"));d&&!m&&!h?r.options.outputExtensionMap={esm:"mjs"}:m&&!d&&!h&&(r.options.outputExtensionMap={cjs:"cjs"})}for(const d of a){const m=Ce.test(d.file),h=hf(d.file,r.options.outputExtensionMap),y=[...uo];if(r.options.outputExtensionMap)for(const k of Object.values(r.options.outputExtensionMap)){const R=k.startsWith(".")?k:`.${k}`;y.includes(R)||y.push(R)}if(!m&&h!==""&&!y.includes(h)||!m&&u1.test(d.file))continue;let $=d.type;if(!$&&m){if(d.file.endsWith(".d.mts"))$="esm";else if(d.file.endsWith(".d.cts"))$="cjs";else if(d.file.endsWith(".d.ts")){const k=a.some(P=>P.subKey==="import"&&P.file.endsWith(".d.mts")),R=a.some(P=>P.subKey==="require"&&P.file.endsWith(".d.cts"));k&&R?$=void 0:$=r.pkg.type==="module"?"esm":"cjs"}}if(Ce.test(d.file)||(r.options.emitCJS===void 0&&($==="cjs"||d.type==="cjs")&&(r.options.emitCJS=!0),r.options.emitESM===void 0&&($==="esm"||d.type==="esm")&&(r.options.emitESM=!0)),Re(r.options.declaration)){const k=r.options.emitCJS&&r.options.emitESM;r.options.declaration=k?"compatible":"node16"}let g=d.file;if(r.options.outputExtensionMap)for(const k of Object.values(r.options.outputExtensionMap)){const R=k.startsWith(".")?k:`.${k}`;if(d.file.endsWith(R)){g=d.file.slice(0,-R.length);break}}g===d.file&&(g=d.file.replace(d1,""));const w=g.endsWith("/");if(w&&["./","/"].includes(g))continue;const b=g.replace(new RegExp(`(./)?${r.options.outDir}`),r.options.sourceDir).replace("./",""),v=w?"":String.raw`(\.d\.[cm]?ts|(\.[cm]?[tj]sx?))$`,S="(?:^|/)";if((d.file.includes("/*")||g.includes("*"))&&d.key==="exports"){es||(r.logger?.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),es=!0);let k;d.exportKey?k=d.exportKey.startsWith("./")?d.exportKey.slice(2):d.exportKey:k=(d.file.startsWith("./")?d.file.slice(2):d.file).replace(ji,"");const R=d.file,P=dl.exec(R);if(R.includes("*")&&!P&&d.exportKey&&!d.subKey){const M=R.replace(ml,"").replace(Mr,""),_=k.replace(ml,"").replace(Mr,"");if(M!==_){const H=`package.json#exports["${d.exportKey==="."?".":`./${d.exportKey}`}"]`;o.push(`Wildcard pattern must include a file extension: ${R} at ${H}`);continue}}const z=r.options.sourceDir.replace(Mr,""),U=X(r.options.rootDir,z),J=[],N=await h1(U),O=R.split("*").length-1,F=k.split("*").length-1;for(const M of N){const _=hl(M,k,O);if(_){if(O>F&&O>1){if(_.length>=O){const B=_[0];if(_.every(D=>D===B)){const D=xt(R,_.slice(0,O));D.includes("*")||J.push({input:X(U,M),output:D})}continue}const V=M.replace(nr,"").split("/").filter(Boolean);if(V.length>=O){const B=Math.floor(V.length/O),D=[];for(let q=0;q<O;q+=1){const A=q*B,ae=q===O-1?V.length:(q+1)*B;D.push(V.slice(A,ae).join("/"))}const K=D[0];if(D.every(q=>q===K)){const q=xt(R,D);q.includes("*")||J.push({input:X(U,M),output:q})}}else if(V.length>0){const B=V[0];if(V.every(D=>D===B)){const D=Array.from({length:O}).fill(B),K=xt(R,D);K.includes("*")||J.push({input:X(U,M),output:K})}}continue}if(_.length<O)continue;if(F>0&&F<O&&O>1&&_.length>1){const V=_[0];if(!_.every(B=>B===V))continue}const H=xt(R,_);if(H.includes("*"))continue;J.push({input:X(U,M),output:H})}}if(J.length===0&&R.includes("*")){let M=(d.file.startsWith("./")?d.file.slice(2):d.file).replace(ji,"");M=M.replace(dl,"");for(const _ of N){const H=hl(_,M,O);if(H){if(O>1&&F<O){if(H.length>=O){const D=H[0];if(H.every(K=>K===D)){const K=xt(R,H);K.includes("*")||J.push({input:X(U,_),output:K});continue}}const V=_.replace(nr,""),B=M.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 q=new RegExp(`^${K}$`).exec(V);if(q){const A=q[1],ae=xt(R,Array.from({length:O}).fill(A));ae.includes("*")||J.push({input:X(U,_),output:ae})}}continue}if(H.length>=O){if(F>0&&F<O&&O>1&&H.length>1){const B=H[0];if(!H.every(D=>D===B))continue}const V=xt(R,H);V.includes("*")||J.push({input:X(U,_),output:V})}}}}if(J.length===0){a.length>1||o.push(`Could not find entrypoints matching pattern \`${k}\` for output \`${R}\``);continue}const I=a.filter(M=>M.exportKey===d.exportKey);if(I.length>0&&I.every(M=>Ce.test(M.file))){const M=I.some(D=>D.file.endsWith(".d.ts")),_=I.some(D=>D.file.endsWith(".d.mts")),H=I.some(D=>D.file.endsWith(".d.cts"));_&&H?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0,r.options.emitESM=!0):H?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0):_&&(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitESM=!0);const V=I.find(D=>D.file.endsWith(".d.ts")),B=V??I.find(D=>D.file.endsWith(".d.mts"))??I.find(D=>D.file.endsWith(".d.cts"))??d;if(!(B===d||V!==void 0&&d===V||V===void 0&&B===d))continue;for(const{input:D,output:K}of J){let q=K;if(K.endsWith(".d.mts")||K.endsWith(".d.cts"))q=K.replace(fl,".d.ts");else if(!K.endsWith(".d.ts")){const ae=K.replace(fl,".d.ts");M&&(q=ae)}const A={...B,file:q,subKey:"types",type:void 0};at(f,D,!1,g,A,r,!0,a)}}else for(const{input:M,output:_}of J){const H=Ce.test(_);let V=d.type;H||(_.endsWith(".mjs")?V="esm":_.endsWith(".cjs")?V="cjs":_.endsWith(".js")&&!V&&(V=r.pkg.type==="module"?"esm":"cjs"));const B={...d,file:_,...!H&&V&&{type:V}};at(f,M,!1,g,B,r,!0,a)}continue}const x=new RegExp(S+b.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+v);let E=t.find(k=>x.test(k));if(E===void 0){const k=r.options.sourceDir.replace(Mr,""),R=X(r.options.rootDir,k),P=$1(d.file);if(P){const z=b1(t,P.baseName,P.pattern,R);if(z)E=z;else{const U=P.baseName,J=new RegExp(S+U.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+v);E=t.find(N=>J.test(N))}}else{const z=b.replace(f1,"$1").replace(c1,"");if(qu.has(d.subKey)){const U=new RegExp(S+z.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+v);E=t.find(J=>U.test(J))}}}if(E===void 0){rt(X(r.options.rootDir,d.file))||o.push(`Could not find entrypoint for \`${d.file}\``);continue}rt(E)&&p1.test(E)&&gl(r);const j=a.filter(k=>k.exportKey===d.exportKey);if(j.length>0&&j.every(k=>Ce.test(k.file))){const k=j.some(z=>z.file.endsWith(".d.mts")),R=j.some(z=>z.file.endsWith(".d.cts"));k&&R?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0,r.options.emitESM=!0):R?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0):k&&(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitESM=!0);const P={...d,subKey:"types",type:void 0};at(f,E,w,g,P,r,!1,a)}else{const k=wm(E.replace(qi,"")),R=`${k}.cts`,P=`${k}.mts`,z=rt(R),U=rt(P),J=d.file.endsWith(".d.mts")||d.file.endsWith(".mjs"),N=d.file.endsWith(".d.cts")||d.file.endsWith(".cjs");J&&U?at(f,P,w,g,{...d,type:"esm"},r,!1,a):N&&z?at(f,R,w,g,{...d,type:"cjs"},r,!1,a):z&&U?(at(f,R,w,g,{...d,type:"cjs"},r,!1,a),at(f,P,w,g,{...d,type:"esm"},r,!1,a)):at(f,E,w,g,d,r,!1,a)}}return{entries:f,warnings:o}},$r=e=>typeof e=="string"&&e!=="",v1=(e,t)=>{const{publishConfig:r}=e;return r&&(r.bin&&(typeof r.bin=="object"||typeof r.bin=="string")&&(e.bin=r.bin),$r(r.type)&&(e.type=r.type),$r(r.main)&&(e.main=r.main),$r(r.module)&&(e.module=r.module),t===void 0&&$r(r.types)?e.types=r.types:t===void 0&&$r(r.typings)&&(e.typings=r.typings),r.exports&&typeof r.exports=="object"&&(e.exports=r.exports)),e},yf=/.*\/dist\/.*/,yl=/\/$/,x1=/\.mjs$/,E1=/\.cjs$/,S1=/\.d\.[mc]?ts$/,k1=/(?<!\.d)\.js$/,j1=e=>{const t=[],r=new Set,n=o=>{if(typeof o=="string"){t.push(o);return}if(Array.isArray(o)){for(const s of o)n(s);return}if(o&&typeof o=="object")for(const[s,i]of Object.entries(o))s.startsWith(".")||r.add(s),n(i)};e.exports&&n(e.exports);for(const o of[e.main,e.module,e.types])typeof o=="string"&&t.push(o);return{conditions:r,files:t}},A1=(e,t,r)=>{if(e.options.emitESM!==void 0||e.options.emitCJS!==void 0)return;const n=e.pkg.type==="module"?"esm":"cjs",o=r.some(a=>k1.test(a));let s=r.some(a=>x1.test(a))||t.has("import")||t.has("module"),i=r.some(a=>E1.test(a))||t.has("require");(o||!s&&!i)&&n==="esm"?s=!0:(o||!s&&!i)&&(i=!0),e.options.emitESM=s,e.options.emitCJS=i},O1=(e,t,r)=>{if(e.options.declaration!==void 0)return;const n=!!e.pkg.types||t.has("types")||r.some(o=>S1.test(o));e.options.declaration=n?"node16":!1},R1=e=>{e.options.entries.length=0;const t=G(e.options.rootDir,e.options.sourceDir);if(!rt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const r=ju(t,{extensions:[],includeDirs:!1,includeSymlinks:!1,skip:[kt,yf]}).filter(u=>Et.test(u)&&!u.endsWith(".d.ts")),{conditions:n,files:o}=j1(e.pkg);A1(e,n,o),O1(e,n,o);const s=e.options.emitESM??!1,i=e.options.emitCJS??!1;for(const u of r){const c=u.replace(`${t}/`,"").replace(Et,"").replaceAll("\\","/");e.options.entries.push({cjs:i,declaration:e.options.declaration,esm:s,input:u,name:c})}const a=[];s&&a.push("[esm]"),i&&a.push("[cjs]"),e.options.declaration&&a.push("[dts]");const l=e.options.entries.length;e.logger.info("Unbundle mode: preserving source structure for",re(`${String(l)} ${l===1?"entry":"entries"}`),De(a.join(" ")))},C1={hooks:{"build:prepare":async function(e){if(e.options.unbundle){R1(e);return}if(e.options.entries.length>0)return;const t=G(e.options.rootDir,e.options.sourceDir);if(!rt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const r=ju(t,{extensions:[],includeDirs:!1,includeSymlinks:!1,skip:[kt,yf]});if(r.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");const n=e.logger;let o={...e.pkg};o.publishConfig&&(n.info(`Using publishConfig found in package.json, to override the default key-value pairs of "${Object.keys(o.publishConfig).join(", ")}".`),n.debug(o.publishConfig),o=v1(o,e.options.declaration));const s=await w1(o,r,e);for(const i of s.warnings)n.warn(i);if(e.options.entries.push(...s.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");n.info("Automatically detected entries:",re(e.options.entries.map(i=>i.fileAlias?`${Ae(i.fileAlias)} => ${Ae(i.input.replace(`${e.options.rootDir}/`,"").replace(yl,"/*"))}`:Ae(i.input.replace(`${e.options.rootDir}/`,"").replace(yl,"/*"))).join(", ")),De([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(i=>`[${i}]`).join(" ")))}}},T1=_e(import.meta.url),Ut=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ua=e=>{if(typeof Ut<"u"&&Ut.versions&&Ut.versions.node){const[t,r]=Ut.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return Ut.getBuiltinModule(e)}return T1(e)},{existsSync:ts}=ua("node:fs"),{env:rs,cwd:N1}=Ut,{createRequire:nn}=ua("node:module"),P1=0,ns=2,M1=Symbol("findUpStop"),$f=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},$l=e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"},_1=nn(import.meta.url),br=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I1=e=>{if(typeof br<"u"&&br.versions&&br.versions.node){const[t,r]=br.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return br.getBuiltinModule(e)}return _1(e)},{lstatSync:bl,mkdirSync:W1}=I1("node:fs"),B1=e=>{$f(e);try{const t=bl(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String($l(t))}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{W1(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const r=bl(e);if(!r.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String($l(r))}'`,{cause:t})}},D1=/^[A-Z]:\//i,on=(e="")=>e&&e.replaceAll("\\","/").replace(D1,t=>t.toUpperCase()),L1=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,F1=/^[A-Z]:$/i,H1=/.(\.[^./]+)$/,q1=/^[/\\]|^[a-z]:[/\\]/i,J1=/\/$/,z1=()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/",U1=(e,t)=>{let r="",n=0,o=-1,s=0,i;for(let a=0;a<=e.length;++a){if(a<e.length)i=e[a];else{if(i==="/")break;i="/"}if(i==="/"){if(!(o===a-1||s===1))if(s===2){if(r.length<2||n!==2||!r.endsWith(".")||r.at(-2)!=="."){if(r.length>2){const l=r.lastIndexOf("/");l===-1?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),o=a,s=0;continue}else if(r.length>0){r="",n=0,o=a,s=0;continue}}t&&(r+=r.length>0?"/..":"..",n=2)}else r.length>0?r+=`/${e.slice(o+1,a)}`:r=e.slice(o+1,a),n=a-o-1;o=a,s=0}else i==="."&&s!==-1?++s:s=-1}return r},Kn=e=>L1.test(e),os=function(...e){e=e.map(n=>on(n));let t="",r=!1;for(let n=e.length-1;n>=-1&&!r;n--){const o=n>=0?e[n]:z1();!o||o.length===0||(t=`${o}/${t}`,r=Kn(o))}return t=U1(t,!r),r&&!Kn(t)?`/${t}`:t.length>0?t:"."},G1=function(e){return H1.exec(on(e))?.[1]??""},bf=e=>{const t=on(e).replace(J1,"").split("/").slice(0,-1);return t.length===1&&F1.test(t[0])&&(t[0]=`${t[0]}/`),t.join("/")||(Kn(e)?"/":".")},V1=(e,t)=>on(e).split("/").pop(),K1=function(e){const t=q1.exec(e)?.[0]?.replaceAll("\\","/")??"",r=V1(e),n=G1(r);return{base:r,dir:bf(e),ext:n,name:r.slice(0,r.length-n.length),root:t}},Y1=nn(import.meta.url),wr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,X1=e=>{if(typeof wr<"u"&&wr.versions&&wr.versions.node){const[t,r]=wr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return wr.getBuiltinModule(e)}return Y1(e)},{fileURLToPath:Z1}=X1("node:url");function Q1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wl,vl;function ew(){return vl||(vl=1,wl=["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"]),wl}var tw=ew();const rw=Q1(tw);new Set(rw);const Ai=e=>on(e instanceof URL?Z1(e):e),nw=nn(import.meta.url),vr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,wf=e=>{if(typeof vr<"u"&&vr.versions&&vr.versions.node){const[t,r]=vr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return vr.getBuiltinModule(e)}return nw(e)};wf("node:fs/promises");wf("node:url");const ow=nn(import.meta.url),xr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,vf=e=>{if(typeof xr<"u"&&xr.versions&&xr.versions.node){const[t,r]=xr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return xr.getBuiltinModule(e)}return ow(e)},{statSync:sw,lstatSync:iw}=vf("node:fs"),{fileURLToPath:aw}=vf("node:url"),lw=(e,t={})=>{const r=t.cwd?Ai(t.cwd):process.cwd();let n=os(r);const{root:o}=K1(n),s=Ai(t.stopAt??o),i=os(n,s),a=t.type??"file",l=function(c){return[e]};t.allowSymlinks??=!0;const u=t.allowSymlinks?sw:iw;for(;n&&n!==i&&n!==o;){for(let c of l()){if(c===M1)return;if(c===void 0)continue;Buffer.isBuffer(c)?c=c.toString():c instanceof URL&&(c=aw(c));const p=Kn(c)?c:os(n,c);try{const f=u(p);if(a==="file"&&f.isFile()||a==="directory"&&f.isDirectory())return p}catch{}}n=bf(n)}},cw=nn(import.meta.url),Er=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,uw=e=>{if(typeof Er<"u"&&Er.versions&&Er.versions.node){const[t,r]=Er.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return Er.getBuiltinModule(e)}return cw(e)};uw("node:fs/promises");const{accessSync:pw}=ua("node:fs");function ss(e,t=P1){$f(e),e=Ai(e);try{return pw(e,t),!0}catch{return!1}}let fw=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 dw=/^[A-Z]:\//i,xf=(e="")=>e&&e.replaceAll("\\","/").replace(dw,t=>t.toUpperCase()),mw=/^[/\\]{2}/,hw=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Ef=/^[A-Z]:$/i,gw=/\/$/,yw=(e,t)=>{let r="",n=0,o=-1,s=0,i;for(let a=0;a<=e.length;++a){if(a<e.length)i=e[a];else{if(i==="/")break;i="/"}if(i==="/"){if(!(o===a-1||s===1))if(s===2){if(r.length<2||n!==2||!r.endsWith(".")||r.at(-2)!=="."){if(r.length>2){const l=r.lastIndexOf("/");l===-1?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),o=a,s=0;continue}else if(r.length>0){r="",n=0,o=a,s=0;continue}}t&&(r+=r.length>0?"/..":"..",n=2)}else r.length>0?r+=`/${e.slice(o+1,a)}`:r=e.slice(o+1,a),n=a-o-1;o=a,s=0}else i==="."&&s!==-1?++s:s=-1}return r},Oi=e=>hw.test(e),$w=function(e){if(e.length===0)return".";e=xf(e);const t=mw.exec(e),r=Oi(e),n=e.at(-1)==="/";return e=yw(e,!r),e.length===0?r?"/":n?"./":".":(n&&(e+="/"),Ef.test(e)&&(e+="/"),t?r?`//${e}`:`//./${e}`:r&&!Oi(e)?`/${e}`:e)},gn=(...e)=>{let t="";for(const r of e)if(r)if(t.length>0){const n=t.at(-1)==="/",o=r[0]==="/";n&&o?t+=r.slice(1):t+=n||o?r:`/${r}`}else t+=r;return $w(t)},bw=e=>{const t=xf(e).replace(gw,"").split("/").slice(0,-1);return t.length===1&&Ef.test(t[0])&&(t[0]=`${t[0]}/`),t.join("/")||(Oi(e)?"/":".")},xl=(e,t)=>(t?.create&&B1(e),e),ww=(e,t)=>{if(rs.CACHE_DIR&&!["0","1","false","true"].includes(rs.CACHE_DIR))return xl(gn(rs.CACHE_DIR,e),t);const r=lw("package.json",{cwd:t?.cwd??N1(),type:"file"});if(!r){if(t?.throwError)throw new fw("No such file or directory found.");return}const n=gn(bw(r),"node_modules"),o=gn(n,".cache"),s=gn(o,e);if(!(ts(s)&&!ss(s,ns))&&!(ts(o)&&!ss(o,ns))&&!(ts(n)&&!ss(n,ns)))return xl(s,t)},vw=ww,xw=/^(?<value>-?\d+(?:[.,]\d+)*) *(?<type>[a-z]+)?$/i,Ew=/^KIBI/,Sw=/^MIBI/,kw=/^GIBI/,jw=/^TEBI/,Aw=/^PEBI/,Ow=/^EXBI/,Rw=/^ZEBI/,Cw=/^YIBI/,Tw=/^(.)IB$/,Sf={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"}]},Nw=(e,t)=>{const r=new Intl.NumberFormat(t).format(11111).replaceAll(new RegExp("\\p{Number}","gu"),""),n=new Intl.NumberFormat(t).format(1.1).replaceAll(new RegExp("\\p{Number}","gu"),"");return Number.parseFloat(e.replaceAll(new RegExp(`\\${r}`,"g"),"").replace(new RegExp(`\\${n}`),"."))},kf=e=>{switch(e){case 2:return 1024;case 10:return 1e3;default:throw new Error("Unsupported base.")}},Pw=(e,t)=>{const r={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 n=xw.exec(e)?.groups;if(!n)return Number.NaN;const o=Nw(n.value,r.locale),s=(n.type??"Bytes").toUpperCase().replace(Ew,"KILO").replace(Sw,"MEGA").replace(kw,"GIGA").replace(jw,"TERA").replace(Aw,"PETA").replace(Ow,"EXA").replace(Rw,"ZETTA").replace(Cw,"YOTTA").replace(Tw,"$1B"),i=Sf[r.units].findIndex(l=>l.short[0].toUpperCase()===s[0]),a=kf(r.base);return o*a**i},je=(e,t)=>{if(typeof e!="number"||!Number.isFinite(e))throw new TypeError("Bytesize is not a number.");const{base:r,decimals:n,locale:o,long:s,unit:i,units:a,...l}={base:2,decimals:0,locale:"en-US",long:!1,units:"metric",...t},u=kf(r),c=Math.abs(e),p=t?.space??!0?" ":"",f=Sf[a],d=f.findIndex(g=>g.short===i);if(e===0){const g=Math.min(0,Math.max(d,f.length-1));return"0"+p+f[g][s?"long":"short"]}const m=d===-1?Math.min(Math.floor(Math.log(c)/Math.log(u)),f.length-1):d,h=f[m][s?"long":"short"],y=e/u**m,$=n<0?void 0:n;return new Intl.NumberFormat(o,{maximumFractionDigits:$,minimumFractionDigits:$,...l}).format(y)+p+h},Mw=(e,t,r,n,o,s,i,a,l,u,c,p,f,d)=>{const m={d:n,h:o,m:s,mo:t,ms:a,s:i,w:r,y:e};return m.future=l,m.past=u,m.decimal=c,p!==void 0&&(m.unitMap=p),m.groupSeparator=f,m.placeholderSeparator=d,m},_w={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"},Iw=Mw(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",".",_w,",","_"),Ww=e=>{const t=["y","mo","w","d","h","m","s","ms","future","past"];for(const n of t)if(!Object.hasOwn(e,n))throw new TypeError(`Missing required property: ${n}`);if(typeof e.future!="string"||typeof e.past!="string")throw new TypeError("Properties future and past must be of type string");const r=["y","mo","w","d","h","m","s","ms"];for(const n of r)if(typeof e[n]!="string"&&typeof e[n]!="function")throw new TypeError(`Property ${n} 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(n=>typeof n!="string"))throw new TypeError("All values in unitMap must be of type string")},jf=(e,t)=>{t=t||-1;const r=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(t)}})?`).exec(e.toString());return r===null?e:Number.parseFloat(r[0])},El=({unitCount:e,unitName:t},r,n)=>{let{spacer:o}=n;const{maxDecimalPoints:s}=n;let i=".";n.decimal!==void 0?i=n.decimal:r.decimal!==void 0&&(i=r.decimal);let a;"digitReplacements"in n?a=n.digitReplacements:"_digitReplacements"in r&&(a=r._digitReplacements);let l,u=e;s!==void 0&&(u=jf(e,s));const c=u.toString();if(!r._hideCountIf2||e!==2)if(a){l="";for(const d of c)l+=d==="."?i:a[d]}else l=c.replace(".",i);else l="";const p=r[t];let f=p;return typeof p=="function"&&(f=p(e)),r._hideCountIf2&&e===2&&(o=""),r._numberFirst?f+o+l:l+o+f},Bw=(e,t)=>{const{units:r}=t;if(r.length===0)return[];const{unitMeasures:n}=t,o=t.largest??Number.POSITIVE_INFINITY,s={};let i,a,l,u=e;for(a=0;a<r.length;a++){i=r[a];const p=n[i];l=a===r.length-1?u/p:Math.floor(u/p),s[i]=l,u-=l*p}if(t.round){let p=o;for(a=0;a<r.length;a++)if(i=r[a],l=s[i],l!==0&&(p--,p===0)){for(let f=a+1;f<r.length;f++){const d=r[f],m=s[d];s[i]=(s[i]??0)+m*n[d]/n[i],s[d]=0}break}for(a=r.length-1;a>=0;a--){if(i=r[a],l=s[i],l===0)continue;const f=Math.round(l);if(s[i]=f,a===0)break;const d=r[a-1],m=n[d],h=Math.floor(f*n[i]/m);if(h)s[d]=(s[d]??0)+h,s[i]=0;else break}}const c=[];for(a=0;a<r.length&&c.length<o;a++){if(i=r[a],l=s[i],l&&!t.round&&c.length===o-1){let p,f=0;for(p=a+1,r.length;p<r.length;p++){const d=r[p];f+=s[d]*(t.unitMeasures[d]/t.unitMeasures[i])}l+=f,t.maxDecimalPoints!==void 0&&(l=jf(l,t.maxDecimalPoints))}l&&c.push({unitCount:l,unitName:i})}return c},Dw=(e,t,r)=>{const{language:n,units:o}=t;if(e.length===0){const p=o.at(-1);return El({unitCount:0,unitName:p},n,t)}const{conjunction:s,serialComma:i}=t;let a=", ";t.delimiter!==void 0?a=t.delimiter:n.delimiter!==void 0&&(a=n.delimiter);let l="";t.timeAdverb&&r!==0&&(l=n.future??"",r<0&&(l=n.past??""));const u=e.map(p=>El(p,n,t));let c;return!s||e.length===1?c=u.join(a):e.length===2?c=u.join(s):c=u.slice(0,-1).join(a)+(i?",":"")+s+(u.at(-1)??""),l&&(c=l.replace("%s",c)),c},Sl=(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 r={conjunction:"",language:Iw,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};Ww(r.language);const n=Math.abs(e),o=Bw(n,r);return Dw(o,r,e)};var Lw=Object.defineProperty,Af=(e,t)=>Lw(e,"name",{value:t,configurable:!0});const Fw=_e(import.meta.url),Sr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Of=Af(e=>{if(typeof Sr<"u"&&Sr.versions&&Sr.versions.node){const[t,r]=Sr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return Sr.getBuiltinModule(e)}return Fw(e)},"__cjs_getBuiltinModule"),{execSync:Hw}=Of("node:child_process"),{existsSync:kl,readFileSync:qw}=Of("node:fs");var Jw=Object.defineProperty,Xe=Af((e,t)=>Jw(e,"name",{value:t,configurable:!0}),"r");const pa=["yarn.lock","package-lock.json","pnpm-lock.yaml","npm-shrinkwrap.json","bun.lockb"],Rf=Xe(e=>{let t;if(pa.forEach(n=>{!t&&kl(G(e,n))&&(t=G(e,n))}),t)return t;const r=G(e,"package.json");if(kl(r)&&la(qw(r,"utf8")).packageManager!==void 0)return r},"packageMangerFindUpMatcher"),Cf=Xe(e=>{if(!e)throw new _t("Could not find a package manager");if(e.endsWith("package.json")){const t=la(e);if(t.packageManager){const r=["npm","yarn","pnpm","bun"].find(n=>t.packageManager.startsWith(n));if(r)return{packageManager:r,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 _t("Could not find a package manager")},"resolvePackageManagerFromFile"),zw=Xe(async e=>{const t=await ft(pa,{type:"file",...e&&{cwd:e}});if(!t)throw new Error("Could not find lock file");return t},"findLockFile"),Uw=Xe(e=>{const t=dt(pa,{type:"file",...e&&{cwd:e}});if(!t)throw new Error("Could not find lock file");return t},"findLockFileSync"),Gw=Xe(async e=>{const t=await ft(Rf,{...e&&{cwd:e}});return Cf(t)},"findPackageManager"),Tf=Xe(e=>{const t=dt(Rf,{...e&&{cwd:e}});return Cf(t)},"findPackageManagerSync");Xe(e=>Hw(`${e} --version`).toString("utf8").trim(),"getPackageManagerVersion");Xe(()=>{if(!process.env.npm_config_user_agent)return;const e=process.env.npm_config_user_agent.split(" ")[0],t=e.lastIndexOf("/"),r=e.slice(0,Math.max(0,t));return{name:r==="npminstall"?"cnpm":r,version:e.slice(Math.max(0,t+1))}},"identifyInitiatingPackageManager");Xe((e,t,r)=>{const n=t.length===1?"":"s";if(r.packageManagers??=["npm","pnpm","yarn"],r.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 o=`
|
|
@@ -104,7 +104,7 @@ export default data;`,map:null}}return null}}},"rawPlugin");var nS=Object.define
|
|
|
104
104
|
}
|
|
105
105
|
// Fallback to createRequire
|
|
106
106
|
return ${Ea}(module);
|
|
107
|
-
};`,$n={builtin:/const\s+__cjs_getBuiltinModule\s*=\s*\(
|
|
107
|
+
};`,$n={builtin:/const\s+__cjs_getBuiltinModule\s*=\s*\(\w*\)\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(?:\$\w+)?\s*\([^)]*\);\s*/g},fS=[/node_modules/,/\.d\.[cm]?ts$/],dS=[/\.[cm]?[jt]sx?$/];let vc=!1;const mS=dr((e,t)=>t&&(um.includes(e)||e.startsWith("node:")),"isBuiltinModule"),hS=dr(async(e,t,r,n,o)=>t?!0:await r?.(e,n,o)??await iS(e,n,o),"shouldTransformImport"),gS=dr((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:`${Ea}(${JSON.stringify(e)})`,needsBuiltin:!1,needsProcess:!1,needsRequire:!0},"generateRequireCode"),yS=dr(e=>{const t=new Ee(e),r={builtin:[...e.matchAll($n.builtin)],import:[...e.matchAll($n.import)],process:[...e.matchAll($n.process)],require:[...e.matchAll($n.require)]};return Object.values(r).forEach(n=>{if(n.length>1)for(let o=n.length-1;o>0;o-=1){const s=n[o];s&&t.remove(s.index,s.index+s[0].length)}}),t.toString()},"removeDuplicates"),$S=dr(e=>{if(Array.isArray(e.shouldTransform)){const{shouldTransform:t}=e;e.shouldTransform=r=>t.includes(r)}return{builtinNodeModules:!!e.builtinNodeModules,cwd:e.cwd??ut.cwd(),exclude:e.exclude??fS,include:e.include??dS,order:"order"in e?e.order:"pre",shouldTransform:e.shouldTransform}},"resolveOptions"),bS=dr((e,t)=>{if(ut.env.INTERNAL_PACKEM_BUILD)return{name:"require-cjs-transformer"};const{builtinNodeModules:r,cwd:n,exclude:o,include:s,order:i,shouldTransform:a}=$S(e),l=Ze(s,o);return{async buildStart(){sS(),vc||(await tp(),vc=!0)},name:"packem:plugin-require-cjs",renderChunk:{async handler(u,c,p){if(p.format!=="es"||!l(c.fileName))return;const f=mo(c.fileName,u,{astType:"js",lang:"js",sourceType:"module"}),d=new Ee(u);let m=!1,h=!1,y=!1;for(const g of f.program.body){if(g.type!=="ImportDeclaration"||g.importKind==="type")continue;const w=g.source.value,b=mS(w,r),v=this.resolve;if(!await hS(w,b,a,n,v))continue;const{code:S,needsBuiltin:x,needsProcess:E,needsRequire:j}=gS(w,b);if(m||=j,h||=E,y||=x,g.specifiers.length===0){b?d.remove(g.start,g.end):d.overwrite(g.start,g.end,`${S};`);continue}const k=[];let R,P;for(const U of g.specifiers)if(U.type==="ImportNamespaceSpecifier")R=U.local.name;else if(U.type==="ImportSpecifier"&&U.importKind!=="type"){const J=u.slice(U.imported.start,U.imported.end);k.push([J,U.local.name])}else U.type==="ImportDefaultSpecifier"&&(P=U.local.name);const z=[];if(R&&(P??=`_cjs_${R}_default`),P&&z.push(`const ${P} = ${S};`),R&&z.push(`const ${R} = { ...${P??""}, default: ${P??""} };`),k.length>0){const U=`const {
|
|
108
108
|
${k.map(([J,N])=>` ${J===N?N:`${J}: ${N}`}`).join(`,
|
|
109
109
|
`)}
|
|
110
110
|
} = ${P??S};`;z.push(U)}d.overwrite(g.start,g.end,z.join(`
|